% Differences between my TEX80 and TeX82 macros
% Uses counters 1 thru 6
% Things to fix:
% (?) change internal absolute \*skips to ex and em instead of pt
% provide for centered figure captions (optional)?
% Fix \twoline!
% Modify \pcomm to use small and \hbox par
% Add automatic indentation to \prog
% Put penalty around \figspaces (but not \capfigs?), like math displays
% MATH SYMBOLS AND FUNCTIONS
% Math functions and other spelled-out operators
\def\mod{\<\,\mathbin{\char m\char o\char d}\<\,} % [\bmod]
% Delimiters
\def\}{\~} % backslash-brace as equivalent to backslash-tilde [no more]
% Multiple dots
\def\ldotss{{.\.\.\}} [no more]
\def\cdotss{\cdots\} [no more]
\def\ldotsm{{\.\.\.\}} [no more]
\def\cdotsm{{\\cdots\}} [no more]
% Special constructs
\def\pr{^\prime} % [becomes ']
\def\prr{^{\prime\prime}} % [becomes '']
\def\star{^\ast} % asterisk in superscript position. % [becomes \st]
\def\bar#1{{\overline{#1}}}% [some cases become \overline ]
\def\modulo#1{\penalty0\;(\char m\char o\char d\char u\char l\char o,\,#1)}% [now \pmod ]
% ALIGNMENT MACROS
% Two-line formulas.
% Usage: \twoline{line1}{glue}{line2}
\def\twoline#1#2#3{\vbox{ % [use \displaylines instead ]
\hbox to \textwidth pt{$ \quad\dispstyle {#1} $\hfill}
\vskip#2
\hbox to \textwidth pt{\hfill $\dispstyle {#3}\quad$}}}
% Centered vertical stacks of boxes.
\def\cpile#1{\vcenter{\halign{\hfill$## $\hfill\cr#1}}}
\def\lpile#1{\vcenter{\halign{$## $\hfill\cr#1}}}
\def\rpile#1{\vcenter{\halign{\hfill$## $\cr#1}}}
% rectangular matrices
\def\matrix#1#2{ % [Now only one arg]
% LOOPING
[replaced by \loop ... \if ... \repeat]
% Repeats #1 times argument #2 (warning: uses counter 9)
\def\repeat#1#2{\setcount9 #1\reploop{#2}}
\def\reploop#1{\ifpos9 {#1\advcount9 by -1\reploop{#1}}\else{}}
% BOX TWIDDLING
% pretends that #2 is #1pt deep (warning: uses box 0)
\def\chop % [no more] to#1pt#2{\save0\hbox{$\dispstyle{#2}$}\hbox{\lower#1pt\null
\vbox to 1ht0{\box0\vss}}} %
% Macros for measuring boxes
[use \the, and glue/dimen arthmetic?]
% The macro \convert divides dimension #1 by the unit #2,
% and sets \count6 to the result (rounded down and clamped above zero).
% For example, \convert{2in}{pt} sets \count6 to 2x72=144.
\def\convert#1#2{\setcount6 0
\xdef\convdim{#1}\xdef\convunit{#2}\convloopa}
\def\convloopa{\ifdimen \convdim > \count6\convunit
{{\advcount6 by 64}\convloopa} \else {\convloopb}}
\def\convloopb{\ifdimen \convdim < \count6\convunit
{{\advcount6 by -16}\convloopb} \else {\convloopc}}
\def\convloopc{\ifdimen \convdim > \count6\convunit
{{\advcount6 by 4}\convloopc} \else{\convloopd}}
\def\convloopd{\ifdimen \convdim < \count6\convunit
{{\advcount6 by -1}\convloopd} \else{}} % (WHAT A CROCK...)
% PARAGRAPH MACROS
[Use \line, \leftline, \rightline, \centerline]
% Left-justified (i.e., standard), centered, and right-justified \hbox par.
% Usage:
% \lftpar 200 pt {This is the first line.\lp This is the second line.}
% \ctrpar 200 pt {This is the first line.\cp This is the second line.}
% \rtpar 200 pt {This is the first line.\rp This is the second line.}
\def\lftpar#1pt#2{\hbox par #1 pt{#2}}
\def\ctrpar#1pt#2{\hbox par #1 pt{\hfil #2}}
\def\rtpar#1pt#2{\hbox par #1 pt{\hfil #2\hfilneg}}
\def\boxparskipper{\vbox to3ex{}} % for par spacing in boxed text
% Line breaks in \hbox par{...}
\def\lb{\hfil\linebreak } % line break in \lftpar (or paragraph)
\def\cb{\hfil\linebreak\hfil } % line break in \ctrpar
\def\rb{\linebreak\hfil } % line break in \rtpar
% Fake paragraph breaks in \hbox par{...}
\def\lp{\hfil\linebreak\boxparskipper } % parag. break in \lftpar
\def\cp{\hfil\linebreak\boxparskipper\hfil } % parag. break in \ctrpar
\def\rp{\linebreak\boxparskipper\hfil } % parag. break in \rtpar
% Fake display math in \hbox par{...}
% Usage: \lp\boxdisp{\pi>e}\lp
% or \lp\boxdisp{\pi>e}\boxeqno{(73)}\lp
\def\boxdisp#1{\hfil\vbox{\vskip 1ex \hbox{$\dispstyle #1 $}\vskip 1ex}}
\def\boxeqno#1{\hfil \hbox{#1}\hfilneg}
% Indented paragraphs.
% Usage:
% \indent Bla bla bla... or
% \begitems\item Foo;\item Bar;...\item Baz.\enditems OR
% \begitems\itemno{1.}Foo;\itemno{2.}Bar;...\itemno{9.}Baz.\enditems
\def\begitems{\par\vskip1ex plus0.3ex\penalty800 }
\def\enditems{\par\vskip1.1ex plus0.4ex }
\def\indent{\par\vskip 0.3ex\hangindent\textindent pt after0 }
\def\item{\itemno{$\bullet$}} % for unnumbered items
\def\itemno#1{\par\vskip-0.1ex\hangindent\itemindent pt after0
{$\rspose{#1\ } $}} % numbered items
% Digressions: small print text, indented.
% Usage: \digress{Mumble mumble.\dp More mumble.}
\def\digress#1{\vskip 0.2ex plus0.5ex \hangindent \textindent pt after0
{\small #1\par}\vskip0.2ex plus0.5ex}
\def\dp{\par\hangindent 15pt after0} % new paragraph in digression
% Page break control.
\def\opteject{\vfil\penalty0\vfilneg} % optional break w/ short page
\def\keep#1cm{\vbox to #1cm{}\vskip-#1cm} % keeps next #1 cm on same page
% MISCELLANEOUS
% Accent macros that work in any font
% A crock to get cmr accents in other fonts
\let\umlautac=\"
\let\tildeac=\s
\let\tieac=\t
\let\acuteac=\'
\let\graveac=\`
\let\hatac=\A
\let\cedillaac=\c
\let\breveac=\u
\let\longac=\=
\let\doubleS=\ss
\def\"#1{{\cmr\umlautac\mainfont #1}} % umlaut
\def\s#1{{\cmr\tildeac\mainfont #1}} % tilde
\def\t#1{{\cmr\tieac\mainfont #1}} % ligature (for russian IA etc)
\def\'#1{{\cmr\acuteac\mainfont #1}} % acute accent
\def\`#1{{\cmr\graveac\mainfont #1}} % grave accent
\def\A#1{{\cmr\hatac\mainfont #1}} % hat accent
\def\c#1{{\cmr\cedillaac\mainfont #1}} % cedilla accent
\def\C#1{{\spose{\cmr\char'30} #1}} % cedilla accent for capitals
\def\=#1{{\cmr\longac\mainfont #1}} % long accent
\def\u#1{{\cmr\breveac\mainfont #1}} % breve accent
\def\ss{{\cmr\doubleS}} % German double s
% Puts border around given box, 3pt away from it.
\def\framebox#1{\vbox
{\hrule
\hbox{\vrule\hskip3pt\vbox{\vskip3pt #1 \vskip3pt}\hskip3pt\vrule}
\hrule}}
% Mnemonics for TEX parameters
\def\jpar{\chpar1←}
\def\ragged{\chpar8←}
\def\jjpar{\chpar15←}
\def\loose{\chpar14←}
\def\uchyph{\chpar16←}
% DEBUGGING
% TEX trace macros
\def\trace{\chpar0←}
\def\macrotrace{\trace'355}
\def\pagetrace{\trace'347}
\def\fullpagetrace{\trace'77777747}
\def\normaltrace{\trace'345}
% Puts thin border around box #1 on the inside (useful to debug boxes).
\def\showbox#1{\vbox
{\hrule height0.2pt\vskip-0.2pt
\hbox{\vrule width0.2pt\hskip-0.2pt #1 \hskip-0.2pt\vrule width0.2pt}
\vskip-0.2pt\hrule height0.2pt}}
% Shows a 1em by 1ex black box for the current font, and its size in pt.
% Usage: {\rm \showfontbox}
\def\showfontbox{This box is 1em by 1ex
\save7\hbox{\vrule height1ex width1em}
$(\approx\convert{10wd7}{pt}{{\count6}\over{10}}\hbox{\rm pt}\times
\convert{10ht7}{pt} {{\count6}\over{10}}\hbox{\rm pt})$:
\box7.}