diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/plain/contrib/misc |
Initial commit
Diffstat (limited to 'macros/plain/contrib/misc')
91 files changed, 11234 insertions, 0 deletions
diff --git a/macros/plain/contrib/misc/2columns.mac b/macros/plain/contrib/misc/2columns.mac new file mode 100644 index 0000000000..2f36486164 --- /dev/null +++ b/macros/plain/contrib/misc/2columns.mac @@ -0,0 +1,35 @@ +% +% This is the two column output format from Chapter 23 of the TeXbook. +% +% +\hoffset=-.5in +\newdimen\fullhsize +\fullhsize=7.5in \hsize=3.6in +\def\fullline{\hbox to \fullhsize} +% +\def\makeheadline{% + \vbox to 0pt{\vskip-22.5pt + \fullline{\vbox to8.5pt{}\the\headline}\vss} + \nointerlineskip +} +% +\def\makefootline{% + \baselineskip=2\normalbaselineskip + \fullline{\the\footline} +} +% +\let\lr=L \newbox\leftcolumn +\output={\if L\lr + \global\setbox\leftcolumn=\columnbox \global\let\lr=R + \else \doubleformat \global\let\lr=L\fi + \ifnum\outputpenalty>-20000 \else\dosupereject\fi} +\def\doubleformat{\shipout\vbox{\makeheadline + \fullline{\box\leftcolumn\hfil\vrule\hfil\columnbox} + \makefootline} + \advancepageno} +\def\columnbox{\leftline{\pagebody}} +% +\def\endtwocol{% + \vfill\supereject + \if R\lr \null\vfill\eject\fi +} diff --git a/macros/plain/contrib/misc/2side.tex b/macros/plain/contrib/misc/2side.tex new file mode 100644 index 0000000000..0b5e6d80ca --- /dev/null +++ b/macros/plain/contrib/misc/2side.tex @@ -0,0 +1,43 @@ +% +% This is a 2-side format for TeX. Simply +% +% \input 2side +% \gutter{5pt} +% +% You want to have set your hsize, vsize, hoffset, and voffset +% (and magnification) *before* inputting this file. +% +% You can also say `\top{...}' and the `...' will be placed at +% the top of the page, and the columns will be reduced +% proportionally. This is useful for the title of the document, +% and any comments you might want to put later in the document. +% Note that if you put this command after the first half of the +% page has been `shipped', it will be postponed until the next +% page. +% +\newdimen\fullsize\fullsize=\hsize +\newdimen\realvsize\realvsize=\vsize +\def\gutter#1{\global\advance\hsize by-#1 \global\divide\hsize by 2}% +\def\makefootline{\baselineskip24pt\hbox to\fullsize{\the\footline}}% +\let\lr=L \newbox\leftcolumn +\let\ntop=\relax +\output={\if L\lr + \global\setbox\leftcolumn=\columnbox \global\let\lr=R + \else\global\let\lr=L\doubleformat\global\fi + \ifnum\outputpenalty>-20000\else\dosupereject\fi + \global\let\ntop=\relax}% +\def\doubleformat{\shipout\vbox{\hbox{\box\topbox}% + \hbox to\fullsize{\box\leftcolumn\hfil\columnbox}% + \makefootline}% + \global\vsize=\realvsize\ntop + \advancepageno}% +\def\columnbox{\leftline{\pagebody}}% +\newbox\topbox +\def\top#1{\if L\lr\message{Setting...} + {\hsize=\fullsize\global\setbox\topbox=\vbox{#1}% + \global\vsize=\realvsize + \global\advance\vsize by-\ht\topbox + \global\advance\vsize by-\baselineskip}% + \else\global\def\ntop{\top{#1}}\message{Saving...}% + \fi}% +\def\bye{\vfill\eject\if R\lr\null\vfill\eject\fi\end}% diff --git a/macros/plain/contrib/misc/alexmisc.tex b/macros/plain/contrib/misc/alexmisc.tex new file mode 100644 index 0000000000..eaecaec187 --- /dev/null +++ b/macros/plain/contrib/misc/alexmisc.tex @@ -0,0 +1,27 @@ +% some small miscellaneous macros + +%capital roman numerals +\def\Romannumeral#1{\uppercase\expandafter{\romannumeral#1}} + +%half in textstyle (smaller --- sometimes looks better) +\def\half{\textstyle{1\over2}} + +%a couple of useful abbreviations +\def\ie{i.\thinspace e.} +\def\eg{e.\thinspace g.} + +%slant fractions (slightly offset and smaller a/b) +%usage \slfrac{numerator}/{denominator} +\def\slfrac#1/#2{\leavevmode\kern.1em\raise.5ex\hbox{\the\scriptfont0 #1} +\kern-.1em/\kern-.15em\lower.25ex\hbox{\the\scriptfont0 #2}} + +% makes real and complex number-set symbols with vertical bars +\def\Reals{{\hbox{$\mathpalette{}{I\kern-.2em R}$}}} +\def\Complexes{{\hbox{$\mathpalette{}{C\kern-.46em + \vrule depth 0ex height 1.4ex width .05em\kern.41em}$}}} + +%poor man's bold (The TeXbook, p. 386) +\def\pmb#1{\leavevmode\setbox0=\hbox{#1}% + \kern-.025em\copy0\kern-\wd0 + \kern.05em\copy0\kern-\wd0 + \kern-.025em\raise.0433em\box0} diff --git a/macros/plain/contrib/misc/appelt-chess.tex b/macros/plain/contrib/misc/appelt-chess.tex new file mode 100644 index 0000000000..4efd561f56 --- /dev/null +++ b/macros/plain/contrib/misc/appelt-chess.tex @@ -0,0 +1,243 @@ +%--------------------- Cut here ---------------------------------- + +% +%---------------------- General ---------------------------------- +% +\font\gray=gray +\font\sym =cmsy10 +\font\bsym =cmsy10 scaled \magstep1 +\font\bbrm =cmr10 scaled \magstep2 +\font\bbss =cmss10 scaled \magstep2 +\font\ssbf =cmssbx10 +\font\bssbf =cmssbx10 scaled \magstep1 +\font\bbssbf =cmssbx10 scaled \magstep2 +\font\bbbf =cmbx10 scaled \magstep2 +\font\bbbbsym=cmsy10 scaled \magstep4 +\font\bsymbf =cmbsy10 scaled \magstep1 +\font\symbf =cmbsy10 +\font\ninesym=cmsy9 +\font\eightsym=cmsy8 + +\newif\ifblackfield +\newcount\movenumber +\newcount\linecount +\newcount\colcount + +\newbox\boxone \newdimen\dimenone +\newbox\boxtwo \newdimen\dimentwo +\newdimen\dimenthree +\newskip\headskipamount \headskipamount=-8pt +\newskip\footskipamount \footskipamount=-5pt + +% 1 dot = 15787.6224 sp bei 300 dots/inch +\newdimen\lowerpiece \lowerpiece=47363sp +\newdimen\fieldwidth \fieldwidth=1326160sp % 84 dots bei 300 dpi +\newdimen\fieldheight \fieldheight=994620sp % 63 dots +\newdimen\fielddepth \fielddepth=\fieldwidth % Rest + \advance\fielddepth by -\fieldheight +\newdimen\framewidth \framewidth=252602sp % 16 dots + +\def\notation{% + \catcode`\8=11 \catcode`\2=11 \catcode`\3=11 \catcode`\4=11 + \catcode`\5=11 \catcode`\6=11 \catcode`\7=11 \catcode`\1=11} +\catcode`\@=11 +% +%---------------------- Pieces ----------------------------------- +% +\def\setpiece#1{\lower\lowerpiece\hbox to \fieldwidth{\hfill#1\hfill}} + +\def\together#1#2{% + \setbox\boxone=\hbox{#1}\setbox\boxtwo=\hbox{#2}% + \dimenone=\wd\boxone \dimentwo=\wd\boxtwo + \dimenthree=-\dimenone + \advance\dimenone by -\dimentwo \divide\dimenone by 2 + \advance\dimenthree by \dimenone + \unhbox\boxone\kern\dimenthree\unhbox\boxtwo} + +\def\pmb#1{\setbox0=\hbox{#1}% + \kern-.025em\copy0\kern-\wd0 + \kern .05em\copy0\kern-\wd0 + \kern-0.025em\raise .0433em\box0 } +\def\WB{\together{\kern 0pt\hbox{\bbbbsym\char14 }}% + {\kern -1pt\hbox{\vrule height 1.4pt depth 0pt width 8pt}}} +\def\SB{\together{\kern 0pt\hbox{\bbbbsym\char15 }}% + {\kern -1pt\hbox{\vrule height 1.4pt depth 0pt width 8pt}}} +\edef\WS{\setbox0=\hbox{\bsym\char120 }\raise\dp0\hbox{\unhbox0 }} +\edef\SS{\setbox0=\hbox{\pmb{\bsymbf\char120 }}% + \together{\raise\dp0\hbox{\unhbox0 }}% + {\raise3pt\hbox{\pmb{\symbf\char15 }}}} +\edef\WT{{\bbrm\char5 }} +\edef\ST{\together{\kern-1pt\hbox{\bbbf\char5 }}% + {\vrule height 9.5pt width 6pt depth 0pt}} +\edef\WK{\together{\symbf\char117 }% + {\together{\raise 4pt\hbox{\sym\char121 }}% + {\vrule width 5pt depth0pt height 0.4pt}}} +\edef\SK{\together{\vrule width 6pt depth 0pt height 6pt}% + {\raise 5pt \hbox{\symbf\char121 }}} +\edef\WL{{\bbss\char3 }} +\edef\SL{\together{\bbssbf\char3 }% + {\together{\bssbf\char3 }{\together{\vrule height 5pt width 5pt + depth 0pt}{\ssbf\char3 }}}} +\edef\SD{\together{\together{\pmb{\symbf\char52 }}% + {\together{\pmb{\ninesym\char52 }}% + {\together{\pmb{\eightsym\char52 }}{\symbf\char15 }}}}% + {\kern 1pt\hbox{\raise 6pt\hbox{\symbf\char15 }}}} +\edef\WD{\together{\symbf\char52 }% + {\kern 0pt\hbox{\raise 6pt\hbox{\symbf\char14 }}}} +% +%---------------------- Board ------------------------------------ +% +\def\fieldstrut{\vrule height \fieldheight depth \fielddepth width 0pt} +\def\void{} + +\def\field#1.#2.{\def\next{#1}% + \ifx\next\empty\blackfieldfalse + \else\blackfieldtrue\fi + \ifblackfield\edef\next{#2}% + \ifx\next\empty\vrule\fieldstrut\hbox to \fieldwidth + {\hfill\emptyblackfield\hfill}% + \else\vrule\fieldstrut\blackborder\setpiece{#2}\fi + \else\vrule\fieldstrut\setpiece{#2}\fi} + +\def\nfield#1{\vrule height 0pt depth 0pt\fieldstrut\hbox to \fieldwidth + {\hfil\rm#1\hfil}} + +\def\linenumber#1{\hbox to 0pt{\rm \kern -10pt #1\hss}} + +\def\innerloop#1\innerrepeat{\def\innerbody{#1}\inneriterate} +\def\inneriterate{\innerbody\let\next=\inneriterate + \else\let\next=\relax\fi\next} + +% +% This is for a character width of 1.4454pt +% +\newcount\numberofchars +\newcount\numberofborderchars +\newcount\numberofgapchars +\numberofchars=14 \numberofborderchars=4 +% +% This is for a character width of 0.9636pt +% +%\numberofchars=21 \numberofborderchars=5 + +\numberofgapchars=\numberofchars +\advance\numberofgapchars by -\numberofborderchars +\advance\numberofgapchars by -\numberofborderchars + +\def\emptyblackfield{\vbox to \fieldheight{\gray + \offinterlineskip\parindent=0pt + \setbox0=\hbox{\char1 }\hsize=\wd0 \multiply \hsize by \numberofchars\relax + \linecount=0 + \loop\advance\linecount by 1 \colcount=0 + \innerloop\advance\colcount by 1 \char1 + \ifnum\colcount<\numberofchars\relax\innerrepeat + \ifnum\linecount<\numberofchars\relax\break\repeat + \vss}} + +\def\blackborder{\hbox to 0pt{\vbox to \fieldheight{\gray + \offinterlineskip\parindent=0pt + \setbox0=\hbox{\char1 }\hsize=\wd0 \multiply \hsize by \numberofchars\relax + \linecount=0 + \count0=\numberofchars \advance\count0 by -\numberofborderchars + \loop\advance\linecount by 1 \colcount=0 + \innerloop\advance\colcount by 1 \char1 + \ifnum\colcount<\numberofchars\relax\innerrepeat + \ifnum\linecount<\numberofborderchars\relax\break\repeat + \break + \loop\advance\linecount by 1 \colcount=0 + \innerloop\advance\colcount by 1 \char1 + \ifnum\colcount<\numberofborderchars\relax\innerrepeat + \hfill\colcount=0 + \innerloop\advance\colcount by 1 \char1 + \ifnum\colcount<\numberofborderchars\relax\innerrepeat + \ifnum\linecount<\count0\relax\break\repeat + \break + \loop\advance\linecount by 1 \colcount=0 + \innerloop\advance\colcount by 1 \char1 + \ifnum\colcount<\numberofchars\relax\innerrepeat + \ifnum\linecount<\numberofchars\relax\break\repeat + \vss}\hss}} + +{\notation + \gdef\showboard{\par\centerline{Board after + \ifx\colour\whitecolour Black's \else White's \fi + \number\movenumber.\ move}\vskip \headskipamount + $$\vbox{\offinterlineskip + \halign{\linenumber{##}&\vrule\field##.&\field##.&\field##.&\field##.& + \field##.&\field##.&\field##.&\field##.\vrule\vrule\cr + \noalign{\hrule}\noalign{\hrule} + 8& .\@a8&*.\@b8& .\@c8&*.\@d8& .\@e8&*.\@f8& .\@g8&*.\@h8\cr + \noalign{\hrule} + 7&*.\@a7& .\@b7&*.\@c7& .\@d7&*.\@e7& .\@f7&*.\@g7& .\@h7\cr + \noalign{\hrule} + 6& .\@a6&*.\@b6& .\@c6&*.\@d6& .\@e6&*.\@f6& .\@g6&*.\@h6\cr + \noalign{\hrule} + 5&*.\@a5& .\@b5&*.\@c5& .\@d5&*.\@e5& .\@f5&*.\@g5& .\@h5\cr + \noalign{\hrule} + 4& .\@a4&*.\@b4& .\@c4&*.\@d4& .\@e4&*.\@f4& .\@g4&*.\@h4\cr + \noalign{\hrule} + 3&*.\@a3& .\@b3&*.\@c3& .\@d3&*.\@e3& .\@f3&*.\@g3& .\@h3\cr + \noalign{\hrule} + 2& .\@a2&*.\@b2& .\@c2&*.\@d2& .\@e2&*.\@f2& .\@g2&*.\@h2\cr + \noalign{\hrule} + 1&*.\@a1& .\@b1&*.\@c1& .\@d1&*.\@e1& .\@f1&*.\@g1& .\@h1\cr + \noalign{\hrule}\noalign{\hrule} + }\vskip \footskipamount + \halign{\linenumber{##}&\nfield{##}&\nfield{##}&\nfield{##}&\nfield{##}& + \nfield{##}&\nfield{##}&\nfield{##}&\nfield{##}\cr + &a&b&c&d&e&f&g&h\cr} + }$$\par} +} + +{\notation + \gdef\setupboard{\def\colour{W}\movenumber=0 + \gdef\@a8{\ST}\gdef\@b8{\SS}\gdef\@c8{\SL}\gdef\@d8{\SD}% + \gdef\@e8{\SK}\gdef\@f8{\SL}\gdef\@g8{\SS}\gdef\@h8{\ST}% + \gdef\@a7{\SB}\gdef\@b7{\SB}\gdef\@c7{\SB}\gdef\@d7{\SB}% + \gdef\@e7{\SB}\gdef\@f7{\SB}\gdef\@g7{\SB}\gdef\@h7{\SB}% + \gdef\@a6{\void}\gdef\@b6{\void}\gdef\@c6{\void}\gdef\@d6{\void}% + \gdef\@e6{\void}\gdef\@f6{\void}\gdef\@g6{\void}\gdef\@h6{\void}% + \gdef\@a5{\void}\gdef\@b5{\void}\gdef\@c5{\void}\gdef\@d5{\void}% + \gdef\@e5{\void}\gdef\@f5{\void}\gdef\@g5{\void}\gdef\@h5{\void}% + \gdef\@a4{\void}\gdef\@b4{\void}\gdef\@c4{\void}\gdef\@d4{\void}% + \gdef\@e4{\void}\gdef\@f4{\void}\gdef\@g4{\void}\gdef\@h4{\void}% + \gdef\@a3{\void}\gdef\@b3{\void}\gdef\@c3{\void}\gdef\@d3{\void}% + \gdef\@e3{\void}\gdef\@f3{\void}\gdef\@g3{\void}\gdef\@h3{\void}% + \gdef\@a2{\WB}\gdef\@b2{\WB}\gdef\@c2{\WB}\gdef\@d2{\WB}% + \gdef\@e2{\WB}\gdef\@f2{\WB}\gdef\@g2{\WB}\gdef\@h2{\WB}% + \gdef\@a1{\WT}\gdef\@b1{\WS}\gdef\@c1{\WL}\gdef\@d1{\WD}% + \gdef\@e1{\WK}\gdef\@f1{\WL}\gdef\@g1{\WS}\gdef\@h1{\WT}} +} +\setupboard +% +%---------------------- Moves ------------------------------------ +% +\def\move#1#2#3#4#5#6 {% Syntax: [KDTLS ][a-h][1-8][-x][a-h][1-8] + % Man beachte, dass der erste Parameter fehlen kann, d.h., dies muss + % erst ermittelt werden mit hilfe des dritten. + \if#3-\@move B#1#2#3#4#5% + \else\if#3x\@move B#1#2#3#4#5% + \else\@move #1#2#3#4#5#6\fi\fi + \ifx\colour\whitecolour\def\colour{S}\advance\movenumber by 1 + \else\def\colour{W}\fi + } + +\def\whitecolour{W} +\def\colour{W} + +\def\@move#1#2#3#4#5#6{% Syntax: [KDTLSB][a-h][1-8][-x][a-h][1-8] + \expandafter\def\csname @#2#3\endcsname{\void}% + \ifx\colour\whitecolour + \expandafter\def\csname @#5#6\endcsname{\csname W#1\endcsname}% + \else\expandafter\def\csname @#5#6\endcsname{\csname S#1\endcsname}\fi} + +\catcode`\@=12 +% +%---------------------- End of Macro Definitions ----------------- +% + \move e2-e4 \move c7-c6 + \move d2-d4 \move d7-d5 + \move Sb1-d2 \move d5xe4 + \move Sd2xe4 \move Sb8-d7 + \move Sg1-f3 + \showboard diff --git a/macros/plain/contrib/misc/automagic.tex b/macros/plain/contrib/misc/automagic.tex new file mode 100644 index 0000000000..75d047cb53 --- /dev/null +++ b/macros/plain/contrib/misc/automagic.tex @@ -0,0 +1,105 @@ +% for automagic equation numbering + +\newcount\LastEqNum +\LastEqNum=0 +\def\BuildEqBox#1{\hbox{{\rm\the\count1--\the#1}}} +\def\nexteqnum{{\count9=\LastEqNum\advance\count9 by1 + \BuildEqBox{\count9}}} +\def\lasteqnum{\BuildEqBox{\LastEqNum}} +\def\neweqnum{\global\advance\LastEqNum by1 \lasteqnum} +\def\namelasteq#1{\xdef#1{\BuildEqBox{\LastEqNum}}} + +% for automagic section numbering + +\newcount\sectiondepth +\newbox\sectnum +\newif\iftoc +\let\Z=\relax +\def\SP{ } + +\def\sectA{\LastEqNum=0\goodbreak} +\let\sectB=\goodbreak +\let\sectC=\goodbreak +\let\sectD=\goodbreak +\let\sectE=\goodbreak +\let\sectF=\goodbreak +\let\sectG=\goodbreak +\let\sectH=\goodbreak +\let\sectI=\goodbreak + +% Start a new section. First argument is depth (1 to 9 please!), second +% is caption. \esection is a section that has nothing above it and +% shouldn't get a \goodbreak\bigskip. + +\outer\def\section{\bigskip\SECTION} +\outer\def\esection{\nobreak\smallskip\SECTION} +\def\SECTBAD{\errmessage{Section depths should be between 1 and 9}} +\def\SECTION#1#2{% + \sectiondepth=#1 + \ifcase\sectiondepth\SectBad\or\sectA\or\sectB\or\sectC\or + \sectD\or\sectE\or\sectF\or\sectG\or\sectH\or\sectI\else + \SECTBAD\fi + \advance\count\sectiondepth by1 + \loop\advance\sectiondepth by1 % zero all lower levels + \ifnum\sectiondepth<10\count\sectiondepth=0\repeat + \sectiondepth=1 + \setbox\sectnum=\hbox{\number\count1}% + \global\def\Sectnum{\number\count1}% + \loop\ifnum\sectiondepth<#1 % Glue together each level + \advance\sectiondepth by1 + \ifnum0=\count\sectiondepth % force to 1 + \set\count\sectiondepth=1 + \fi + \setbox\sectnum=\hbox + {\unhbox\sectnum.\number\count\sectiondepth}% + \global\edef\Sectnum{\Sectnum.\number\count\sectiondepth}% + \repeat + \message{\Sectnum. #2}% + \setbox0=\hbox{\bf\copy\sectnum.\hskip1em#2}% + \def\text{\Sectnum.\SP!#2}% + \tocentry{#1}{\text}{\box0\hfil} + \ignorespaces +} + +% unnumbered section +\def\unsection#1{% + \message{#1}% + \setbox0=\hbox{\bf#1}% + \def\text{\SP!#1}% + \tocentry{0}{\text}{\box0\hfil}% + \ignorespaces +} + +% print arg 3 as a line, put arg 2 into the table of contents with +% a "level" of arg 1 +% takes care of putting box0 out as a line, and putting it into the +% table of contents if required +\def\tocentry#1#2#3{% + \line{#3}% stuff to appear in the text + \nobreak\smallskip\nobreak % now in vert mode + \iftoc{\let\the=0 % make it unexpandable + \xdef\ixout{\write\inx{\Z#1\SP!#2!\SP\the\pageno.}}\ixout + }\fi +} + +\ifx\titlefont\undefinecontrolsequence + \font\titlefont=amssbx10 scaled\magstep2 +\fi +\newcount\Siz +\newwrite\inx +\def\DoContents{\toctrue\immediate\openout\inx=\jobname.toc} +\def\PrintTOC{\vfill\supereject\immediate\closeout\inx + \def\LeadFill{\leaders\hbox to .75em{\hss.\hss}\hfill} + \def\Z##1!##2!##3!##4.{ + \Siz=##1\count1=\Siz + \advance\Siz by 1 \multiply\Siz by \count1 + \divide\Siz by 2 \advance\Siz by -1 + \dimen0=1em\multiply\dimen0 by \Siz + \Siz=##1\advance\Siz by 1 + \dimen1=1em\multiply\dimen1 by \Siz + \line{\hskip\dimen0\hbox to\dimen1{##2\hfil}{##3}\LeadFill\hbox{##4}} + } + \centerline{\titlefont Table of Contents}\vskip .75in + \global\count0=-1 + \input \jobname.toc +} diff --git a/macros/plain/contrib/misc/autotoc.tex b/macros/plain/contrib/misc/autotoc.tex new file mode 100644 index 0000000000..3b2f8ce6e8 --- /dev/null +++ b/macros/plain/contrib/misc/autotoc.tex @@ -0,0 +1,53 @@ +% +% Automatically generate a Table Of Contents (TOC) while the +% document is being processed by PLAIN TeX +% +% Use \tocref{ texta }{ textb } to insert TOC entries. `texta' +% will be typeset in the TOC and at the current location, +% for example `\centerline{\tocref{Chapter 1}{}}' inserts +% `Chapter 1' at the current location in your document +% centered, and enters it in the TOC (not centered). +% `textb' is a prefix text/TeX commands to precede `texta' +% in the TOC only (it will not appear in the current loc- +% ation of your document -- {{`textb'`texta'}.....\folio}). +% Use \tocline to add info only intended for the TOC (no page number or +% dotfill is used for tocline entries). +% Use \tocgen to force the last TOC page to be printed (last command +% before \end?) +% To specialize, look at the below comments in the right +% +% Uses variable names +% tocnew, tocopage, tocbox, tocsize, tocstrut, tocref, +% tocbanner, tocsuffix, tocline, tocstart, tocont, tocgen +% +\newcount\tocnew\tocnew=1\newcount\tocopage +\newbox\tocbox\newdimen\tocsize +\def\tocstrut{{\vrule height8.5pt depth3.5pt width0pt}} % TOC baselineskip -1pt +\def\tocref#1#2{\tocbanner#1 % Where `texta' is duplicated + \global\setbox\tocbox=\vbox{ + \box\tocbox\vbox{ + \line{\tocstrut{#2#1}~\dotfill~\folio} % Where the TOC line is made + }}\tocsuffix} +\def\tocline#1{\tocbanner + \global\setbox\tocbox=\vbox{ + \box\tocbox\vbox{ + \line{\tocstrut{#1}} + }}\tocsuffix} +\def\tocbanner{\ifnum\tocnew=1\tocstart\fi + \ifnum\tocnew=3\tocont\fi} +\def\tocsuffix{\ifdim\tocsize<\ht\tocbox\tocgen + \global\tocnew=3\fi} +% Do not change tocsize = 1.0 (TeX may go into an infinite loop) +\def\tocstart{\global\tocsize=.95\vsize % TOC page >95% full, print it + \global\setbox\tocbox=\vbox{ + \centerline{\tocstrut\bf Table Of Contents} % TOC page 1 banner line 1 + \line{\tocstrut\hfil} % TOC page 1 banner line 2 blank line + }\global\tocnew=2} +\def\tocont{\global\setbox\tocbox=\vbox{ + \centerline{\tocstrut Table Of Contents (Continued)} % TOC page <> 1 banner + }\global\tocnew=2} +\def\tocgen{\ifnum\tocnew=1 + \message{No TOC entries found.}\else + \tocopage=\pageno\pageno=0\message{(TOC} + \shipout\box\tocbox\message{)} + \pageno=\tocopage\global\tocnew=1\fi} diff --git a/macros/plain/contrib/misc/bellmac.tex b/macros/plain/contrib/misc/bellmac.tex new file mode 100644 index 0000000000..ea5f26f38b --- /dev/null +++ b/macros/plain/contrib/misc/bellmac.tex @@ -0,0 +1,235 @@ +% From: <BELL@UKANVAX.BITNET> +% Ed Bell +% BITnet: BELL@UKANVAX +% SPAN: KUPHSX::BELL +% +% \title AutoLetter: A \TeX\ form letter procedure. +% \\Edwin V. Bell, II\cr +% Department of Physics and Astronomy +% University of Kansas +% \endx +% +% \pagexref{bell} +% +% The inquiry from John Lee (\TUB, October 1986) concerning form letters was +% particularly interesting to me as I had recently completed such a procedure +% at the request of our office staff. The procedure (called AutoLetter) is +% a ``plain'' \TeX\ procedure which requires two files, one containing a +% delimited listing of names and addresses, the other a generic form letter. +% +% Each entry in the address file is followed by a line containing a single +% asterisk. The last entry must also be followed by this line, which in turn +% {\it must} be followed by the end-of-file mark. Each individual entry consists +% of six lines for the addressee's title, name, etc., followed by as many +% address lines as desired. The lines for the addressee's name are: +% +% \item{(1)}Title (Prof., Mr., Ms., etc.) +% \item{(2)}First name/initial +% \item{(3)}Name to be used as a familiar form of address. +% \item{(4)}Middle name(s)/initial(s) +% \item{(5)}Last/family name +% \item{(6)}Additional name information (Jr., II, Esq., etc.) +% +% \noindent +% These lines are then used to reconstruct the persons name for various forms +% of address(including for the address block) and to address the person formally +% (Sir, Madam, Sir or Madam), familiarly (by item (3) above or, if (3) is +% blank, by first name), or by title and last name. If any of these lines +% are left blank, AutoLetter doesn't mind, but if the entry is irrelevant +% or absent from the persons name, {\it it must still be left blank}. An example +% of an address entry might be: +% \begintt +% Mr. +% Edwin +% Ed +% V. +% Bell +% II +% Department of Physics \& Astronomy +% University of Kansas +% Lawrence, KS\ \ \ 66045 +% * +% \endtt +% +% The letter file is quite simple and used macros that are the same as or +% slight variations of those listed in Appendix E of {\sl The \TeX book}. +% AutoLetter takes care of the placement of the date and address block (and +% could as well the letterhead, although I have not yet implemented that here +% as yet), so the letter file might appear as: +% \begintt +% \letterbody +% Dear \person-- +% +% ...text... +% +% \closing +% Sincerely, +% ... +% +% \annotations... +% \ps... +% +% \endletter +% \endtt +% +% AutoLetter consists of two files, on the \TeX\ procedure itself, the other +% containing the letter-formatting macros (and local macros, if desired). +% The AutoLetter procedure looks like: +% \begintt +% \input letter_format +% +\message{+------------------------------------------+} +\message{| AutoLetter Version 1.1 -- 9 October 1986 |} +\message{+------------------------------------------+} + +\newread\addressfile + +\message{Enter name of file containing the addresses:} +\read-1 to\addfile +\openin\addressfile=\addfile + +\message{Enter name of file containing the body of the letter:} +\read-1 to\letfile + +%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +% Now read in an entry containing the person to whom to send the letter +%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +\endlinechar=-1 +\read\addressfile to\text \let\title=\text + +\loop + \read\addressfile to\text \let\firstname=\text + \read\addressfile to\text \let\nickname=\text + \read\addressfile to\text \let\middlename=\text + \read\addressfile to\text \let\lastname=\text + \read\addressfile to\text + \ifx\text\blank\def\jr{}\else\def\jr{, \text}\fi + \endlinechar='015 + \message{Now processing letter to \addressee.} + \getaddress + \doletter + \endlinechar=-1 + \read\addressfile to\text \let\title=\text + \ifeof\addressfile\endfalse\else\endtrue\fi + \ifend +\repeat + +\bye +% \endtt +% +% \noindent +% Our local letter-formatting macros are: +% \begintt +% \input whatever local macro package you wish here +% +% \twelvept % 12-point size is so much easier to read +% +% \hsize=6.5truein +% \vsize=8.0truein +% \hoffset=1.0truein +% \voffset=1.5truein +% +% \raggedbottom +% \interlinepenalty=1000 +% \parindent=0pt +% \parskip=0pt +% +% \nopagenumbers +% +%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +% Define some stuff so that the headlines will come out the way +% we want them to be. +%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +% +% \newbox\headbox +% \headline={\ifnum\pageno>1 +% {\twelverm +% \global\setbox\headbox=\vbox\bgroup% +% \leftline{\addressee} +% \leftline{\today} +% \leftline{Page \folio}\egroup}\copy\headbox +% \else\hfil\fi} +% +% \def\makeheadline{\vbox to 0pt{\vskip-70.6pt +% \line{\vbox to30.6pt{}\the\headline}\vss} +% \nointerlineskip} +% +% \newif\ifend +% +%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +% Macros for reading in the address from the file. +%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +% +% \def\blank{} +% +% \def\endletter{\endmode\vfill\eject\pageno=1} +% +% \newdimen\longindentation \longindentation=10truecm +% \newbox\theaddress +% \newif\ifast +% \def\aster{* } +% \def\getaddress{{\global\setbox\theaddress=\vbox\bgroup\raggedright% +% \hsize=\longindentation +% \everypar{\hangindent2em} +% \line{\vbox to10.2pt{}\addressee\hss}\egroup% +% {\loop{\read\addressfile to\text +% \ifx\text\aster\astfalse\else\asttrue\fi +% \ifast\global\setbox\theaddress=\vbox\bgroup\unvbox\theaddress +% \line{\vbox to 10.2pt{}\text\hss}\egroup}\repeat}}} +% +%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +% Macros for formatting the letter. +%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +% +% \def\letterbody{\beginparmode} +% \def\closing{\beginlinemode\getclosing} +% {\obeylines\gdef\getclosing #1 +% #2 +% {#1\nobreak\bigskip \leftskip=\longindentation #2 +% \nobreak\bigskip\bigskip\bigskip\bigskip % space for signature +% \def +% {\endgraf\nobreak}}} +% \def\annotations{\beginlinemode\def\par{\endgraf\nobreak}\obeylines\par} +% \def\ps{\beginparmode\nobreak +% \interlinepenalty5000\def\par{\endgraf\penalty5000} +% P.cS.\ } +% +% \def\address{\beginlinemode \copy\theaddress \endgroup} +% \def\doletter{{\leftskip=\longindentation% +% \rm\today\bigskip\address\bigskip} +% \input \letfile} +% +%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +% Macros for setting up forms of salutation. +%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +% +% \def\mr{Mr.} +% \def\ms{Ms.} +% \def\mrs{Mrs.} +% \def\miss{Miss} +% +% \def\addressee{\ifx\blank\title\else\title\space\fi% +% \firstname\space\ifx\blank\middlename\else\middlename\space\fi% +% \lastname\jr} +% \def\person{\ifx\blank\title Sir or Madam\else\title\space\lastname\fi} +% \def\familiar{\ifx\blank\nickname \firstname\else\nickname\fi} +% \def\formal{\ifx\mr\title Sir\else{\ifx\ms\title Madam\else% +% {\ifx\mrs\title Madam\else{\ifx\miss\title Madam\else{\person}\fi}% +% \fi}\fi}\fi} +% \endtt +% +% The AutoLetter procedure prompts the user for the names of the address and +% letter files and then goes to work. A similar procedure (called {\smc Labels}) +% can also be used with the address file to produce 33 labels/page (3 columns +% of 11 labels). This enables us to produce form letters with or without labels +% or to maintain mailing lists without requiring letters (for abstract mailings, +% for example). +% +%If anyone is interested in having these procedures, drop me a line. If response +% is high, I would be more than willing to provide them to the \TeX\ community +% at large. Mail may be sent to: +% +% \leftline{Bitnet: Bell@UKANVAX} +% \leftline{SPAN: KUPHSX::Bell} +% diff --git a/macros/plain/contrib/misc/bfsymb.tex b/macros/plain/contrib/misc/bfsymb.tex new file mode 100644 index 0000000000..2fbd828f81 --- /dev/null +++ b/macros/plain/contrib/misc/bfsymb.tex @@ -0,0 +1,32 @@ +% +%% bfsymb.tex, written by Uwe M\"unch +%% e-mail: muench@ph-cip.uni-koeln.de +% +% This macro package provides the command +% \boldsymbol{...} +% to typeset parts of a math formula (e.g. a greek sign (\alpha)) in the +% bold cmmib10-font for the plain tex format. It's not for use under +% any other format, because it will not work (I think). +% +% The 10pt-font cmmib10 is hard-coded, so that you get the design size +% 10 pt. Magnification with \magnification=???? will work, but this macro +% will not provide good results, if you want to use it with (e.g.) cmr17... +% +% For the latex format the command \boldsymbol is provided in the amstex +% package (written by the AMS, not me), with similar functionality, but +% much stronger font selection (NFSS2). +% +%% +\font\bfsymbtext=cmmib10 +\font\bfsymbscript=cmmib10 at 7pt +\font\bfsymbscriptscript=cmmib10 at 5 pt +\def\boldsymbol#1{{\mathchoice% + {\hbox{$\displaystyle\textfont1=\bfsymbtext\scriptfont1=% + \bfsymbscript\scriptscriptfont1=\bfsymbscriptscript #1$}}% + {\hbox{$\textstyle\textfont1=\bfsymbtext\scriptfont1=% + \bfsymbscript\scriptscriptfont1=\bfsymbscriptscript #1$}}% + {\hbox{$\scriptstyle\scriptfont1=\bfsymbscript% + \scriptscriptfont1=\bfsymbscriptscript #1$}}% + {\hbox{$\scriptscriptstyle% + \scriptscriptfont1=\bfsymbscriptscript {#1}$}}}} +\endinput diff --git a/macros/plain/contrib/misc/bibplain.tex b/macros/plain/contrib/misc/bibplain.tex new file mode 100644 index 0000000000..49f9284f66 --- /dev/null +++ b/macros/plain/contrib/misc/bibplain.tex @@ -0,0 +1,49 @@ +% Pseudo-BIB.TEX +% +% These commands are examples of how to use BibTeX with plain TeX. +% Syntax is similar to LaTeX, but can be changed to suit the user. +% +% Example: +% .... Blah, blah \citer(Keyword) blah, blah.... +% \bibliography{gunk} %<-- the *.BIB file +% \bibliographystyle{plain} %<-- the *.BST file (style) +% +% \citer Puts nothing in the text, it only enters something in the *.AUX +% file (which is now generated). This allows citing of entries in the +% bibliography, but not the text. +% +% Anthony J. Ferro +% Physics Dept. -- Astronomy Group +% Arizona State University +% Tempe, AZ 85287 +% FERRO@ASUCPS.BITNET +\newcount\citeon +\citeon=0 + +\def\citer#1{\ifnum\citeon<1\citeon=1\openout1\jobname.aux + \write1{\string\relax}\fi % + \write1{\string\citation{#1}}} % Put your favorite method of citing here! + +\def\bibliography#1{\openin2\jobname.bbl + \ifeof2 + \message{No \jobname.BBL file. } + \write1{\string\bibdata{#1}} + \closein2 + \else + { %important, lets \end be redefined TEMPORARILY + \def\begin##1##2{\references} + \def\bibitem##1{} + \def\newblock{} + \def\end##1{\endreferences} + \input\jobname.bbl + } + \write1{\string\bibdata{#1}} + \closein2 + \fi } + +\def\bibliographystyle#1{\write1{\string\bibstyle{#1}}} + +\def\references{\bf This is the beginning of MY REFERENCES} + +\def\endreferences{\bf This is the end of MY REFERENCES} +%%%-------------------- Un-Rip here --------------------------------- diff --git a/macros/plain/contrib/misc/border.tex b/macros/plain/contrib/misc/border.tex new file mode 100644 index 0000000000..6821339ec5 --- /dev/null +++ b/macros/plain/contrib/misc/border.tex @@ -0,0 +1,96 @@ +% border.tex +% Author: James A. Brister +% Mon Jan 28 19:43:19 1991 +% +% Macros to put black borders around a page in PLAIN TeX. The border is +% laid over the top of the page as it would normally be. Changes to +% \hoffset and \voffset do not affect where the border goes. +% +% To turn borders on use the command \borderson, to turn them off use +% \bordersoff. +% +% Interesting dimensions are: +% +% \borderindent the distance from the outside edge of the border to +% the paper edge. Default is 10 pts +% \borderwidth the width of the border. Default is 5pt +% \borderspace the (minimum) space between the inside edge of the +% border and the outside edge of the box containing +% all the page material. Default is 10pt. Not really +% useful in this context though, because it implies the +% internal box will be shifted, but the size +% of the internal box is adjusted to allow for this +% dimension. The macro that uses it (boxit) is +% useful, and borderspace can really be set to +% anything inside a group .e.g. +% {\borderwidth=5pt +% \borderspace=5pt +% \boxit{\hbox{fubar}}} +% won't (ok, shouldn't) affect the output routine. +% \paperheight the height of the paper, default is 11 inches +% \paperwidth the width of the paper, default is 8.5 inches +% +% NOTE: If you change these dimensions you can get +% overfull box errors. To avoid this adjust \vsize, \hsize, \hoffset, and +% \voffset accordingly. +% +% + \newdimen\borderspace \borderspace=10pt +\newdimen\borderwidth \borderwidth=5pt +\newdimen\borderindent \borderindent=10pt +\newdimen\paperheight \paperheight=11in +\newdimen\paperwidth \paperwidth=8.5in + \newdimen\bigboxheight % height of final box inside border +\newdimen\bigboxwidth % width of same box +\newdimen\leftsidekern % distance between inside of border and left of page box +\newdimen\topsidekern % distance between inside of border and top of pagebox +\newdimen\boxadjust % distance from paper edge to inside edge of border space. + % +% put a border around a box. Taken from the TeX book. Border width is +% defined by \borderwidth. Distance out from box is \borderspace. +% +% This macro can be called in a page like so: +% {\borderwidth=5pt \borderspace=5pt \boxit{\hbox{fubar}}} +% + \def\boxit#1{\vbox{\hrule height \borderwidth depth 0pt + \hbox{\vrule width \borderwidth\kern\borderspace +\vbox{\kern\borderspace#1\kern\borderspace}\kern\borderspace \vrule width +\borderwidth}\hrule height \borderwidth depth 0pt}} + % +% Wrap up the page in a border and ship it out. +% + \def\borderoutput{ + \setbox255=\vbox{\makeheadline + \pagebody + \makefootline}% + \setbox255=\vbox{\makebigbox{\box255}} + \begingroup + \hoffset= -1in \advance\hoffset by \borderindent + \voffset= -1in \advance\voffset by \borderindent + \shipout\boxit{\box255} + \endgroup + \advancepageno + \ifnum\outputpenalty>-20000\else\dosupereject\fi} + % +% make a big box to hold the page, that's big enough to wrap the border +% around. +% + \def\makebigbox#1{% + \boxadjust=\borderindent + \advance\boxadjust by \borderwidth + \advance\boxadjust by \borderspace + \bigboxheight=\paperheight + \bigboxwidth=\paperwidth + \advance\bigboxheight by -\boxadjust + \advance\bigboxheight by -\boxadjust + \advance\bigboxwidth by -\boxadjust + \advance\bigboxwidth by -\boxadjust + \leftsidekern=\hoffset \advance\leftsidekern by 1in + \advance\leftsidekern by -\boxadjust + \topsidekern=\voffset \advance\topsidekern by 1in + \advance\topsidekern by -\boxadjust + \hbox to \bigboxwidth{\kern\leftsidekern + \vbox to \bigboxheight{\kern\topsidekern#1\vfil} + \hfil}} + \def\borderson{\output={\borderoutput}} +\def\bordersoff{\output={\plainoutput}} % reset to TeX's standard output diff --git a/macros/plain/contrib/misc/boxit.tex b/macros/plain/contrib/misc/boxit.tex new file mode 100644 index 0000000000..57956219c1 --- /dev/null +++ b/macros/plain/contrib/misc/boxit.tex @@ -0,0 +1,13 @@ +% +% BOXIT +% +% Use \boxit{ text } to surround text / paragraphs / anything in a +% box. For example, typing \boxit{the} would produce +% +---+ +% |the| +% +---+ +% (you may want to use \strut inside the argument if the +% boxit is on a line by itself). +% +\def\boxit#1{\leavevmode\hbox{\vrule\vtop{\vbox{\kern.33333pt\hrule + \kern1pt\hbox{\kern1pt\vbox{#1}\kern1pt}}\kern1pt\hrule}\vrule}} diff --git a/macros/plain/contrib/misc/btable.sty b/macros/plain/contrib/misc/btable.sty new file mode 100644 index 0000000000..a11bdb7a05 --- /dev/null +++ b/macros/plain/contrib/misc/btable.sty @@ -0,0 +1,134 @@ +%From: mathas_a@maths.su.oz.au ( Andrew ) +%Newsgroups: comp.text.tex,aus.tex +%Subject: large table macros for TeX - btable.sty +%Message-ID: <1990Jul6.052546.5887@metro.ucc.su.OZ.AU> +%Date: 6 Jul 90 05:25:46 GMT +%Sender: news@metro.ucc.su.OZ.AU (news) +%Organization: Mathematics, University of Sydney +%Lines: 123 +%Xref: jarthur comp.text.tex:1959 +%Replies-To: comp.text.tex + +%Several people have expressed an interest in the table macros which +%I purported to have. They appear below. They do *not* work in LaTeX; +%however after looking at the supertab macros for LaTeX (which several +%people told me about), I think that I could modifify them to work +%with LaTeX. Any one who wishes to convert them feel free as I won't +%have the time to do this until the end of August. + +%The basic macros were written primarily by Bob Howlett +%(howlett_r@maths.su.oz.au), with me watching and making the odd +%suggestion and modification. Consequently I have called the macros +%the "btable.sty" macros. All credit should go to Bob. + +%The macros were written to typeset large character tables and +%consequently everything is put into math mode. To take them out of +%math mode the definitions of \tableline and \nextbit need to be +%changed in the obvious way (ie. remove the "$"s). + +%The reason why I wanted these macros was that TeX and LaTeX both +%spat the dummy and gave a memory overflow when I asked them to +%do my tables by conventional methods. I also tried using the +%tabular environment in LaTeX; butm for reasons which I can't +%comprehend (or through ill-use?), there seems to be a limit of +%approximately 15 columns in this evironment - I needed up to +%31 columns. Given this limit, the supertab environment written for LaTeX +%has the same restriction (it uses the tabular environment), and +%so it would be worthwhile to convert these macros to LaTeX (they +%don't work in LaTeX at the moment because \plainoutput is not +%defined in LaTeX). + +%These macros do not appear to have any memory restrictions: I ran +%what turned out to be 22 pages of 31 column tables through TeX in +%one hit without any complaints. As such they meet my specifications - +%I hope that they also met yours. + +%Andrew Mathas. + +% - smile at a stranger today and help make the world a better +% place; while you're, at it, why not hug a friend! + +%______________________________________________________________________ +%% Written by Bob Howlett with modifications by Andrew Mathas 1990. +%%% Table Format: +%% All entries are formatted in math mode. A horizontal line +%% is placed under the table header, and a vertical line +%% separates the first and second columns. The first column +%% is left justified and all other columns are right justified. +%% Any row can have an arbitrary number of columns. The macros were +%% designed for TeXing character tables. +%%% Table Syntax: +% - table begun with \starttable +% - columns separated by & +% - each row ended by &! +% - last row of table ended by &* and followed by \endtable +% - table header specified by \tableheader ...&! +% - if a blank line is wanted in the table put !\gap at the +% end of the row +% - to force a page break put !\pagegap at end of row +% - pages are broken naturally if \pagegap is not used, and the +% table header is put at the top of the following page. +%%% Column spacing +% - nameskip: width of the title column +% - colSkip: width of the columns +% - colsep: separation between columns +% - firstcol: extra space to the left of the first column (in my +% character tables the the first column (as distinct from the +% left-most column which "labels" each row), contains the +% degrees of the characters which are often very large numbers +% and so I needed more space: eg. psi | xxxxxxx xxxx xxxx ...). +\def\nameskip{\kern30pt} +\def\colskip{\kern20pt} +\def\colsep{\kern3pt} +\def\firstcol{\kern10pt} +%%% Known bug +% If the row ends with ...& &! then the next row may be +% added to the end of this row. This can be avoided +% by typing ...&\relax&! instead. +%% Useful note: +% set \hsize=\wd0 to make the page width equal the table width + +%_________________________btable.sty____________________________________ +%% Written by Bob Howlett with modifications by Andrew Mathas 1990. +\let\gap\relax +\newif\ifpagegap +\let\pagegap\pagegaptrue +\def\spacing{height8.5ptdepth4.5pt}% +\def\normalspacing{height8.5pt depth3.5pt} +\def\moreheight{height9.5pt depth4.5pt\let\spacing\normalspacing} +\def\muchmoreheight{height15pt depth4.5pt\let\spacing\normalspacing} +\def\tableheader#1!{\setbox0\hbox{\def\spacing{height8.5ptdepth4.5pt} + \tableline#1*}% + \global\def\TableHeader{\copy0\hrule width\wd0\let\spacing\moreheight}} +\def\starttable{\begingroup\offinterlineskip + \parskip=0pt\parindent=0pt% + \output={\plainoutput\TableHeader} + \TableHeader\startnewline} +\def\startnewline{\hfil\par\futurelet\next\continue} +\def\continue{\ifx\gap\next\message{III}\let\spacing\muchmoreheight\fi% + \ifx\pagegaptrue\next\vfill\eject\tableline\message{XXX}\pagegapfalse + \else\message{CCC}\tableline\fi} +\def\tableline#1&{\noindent% + \rlap{$#1$}\nameskip\colsep\vrule\spacing\firstcol\nextbit} +\def\nextbit#1&{\colskip\llap{$#1$}\colsep\check} +\def\check#1{\if!#1\expandafter\startnewline\else\if*#1\hfil + \else\nextbit#1\relax\fi\fi} +\def\endtable{\endgroup\vskip20pt} +%------------------------------------------------------------------------------- +\endinput +%A small example: larger examples available upon request +%(mathas_a@maths.su.oz.au). +\tableheader C_1&C_2&C_3&! +\starttable +\chi&1&0&0&-1&! +\chi&1&0&0&-1&! +\chi&1&0&0&-1&! +\chi&&0&0&-1&!\gap +\chi&1&0&&-1&! +\chi&1&0&&-1&! +\chi&1&0&0&-1&! +\phi&5&8&-1&2&!\pagegap +\psi&1&2&&&! +\alpha&59&0&* +\endtable +\bye diff --git a/macros/plain/contrib/misc/capparmode.tex b/macros/plain/contrib/misc/capparmode.tex new file mode 100644 index 0000000000..7fb62043a7 --- /dev/null +++ b/macros/plain/contrib/misc/capparmode.tex @@ -0,0 +1,33 @@ +% Copyright (c) 1986 David J. Braunegg. All rights reserved. +% Distribution of this file is unrestricted provided that this notice +% is not removed. + +%%% CAPPARMODE + +%%% Macros to typeset paragraphs with the first letter of the paragraph in +%%% a large font with the first few lines of the paragraph indented to +%%% make room for this first large letter + +\font\big=cmr10 scaled\magstep5 + +\newdimen\saveparindent + +%%% This macro gets you into capparmode mode. Get back out with \endcapparmode +\def\capparmode{\saveparindent=\parindent + \parindent=0pt + \everypar={\futurelet\cap\bigcap}} + +\def\bigcap{\setbox0=\vbox to 1.5ex{\hbox{\big\cap}}% + \dimen0=\wd0% + \advance\dimen0 by 0.5em + \hangindent=\dimen0% + \hangafter=-2% + \hbox to0pt{\hskip-\hangindent\box0}% + \let\discard=} + +\def\endcapparmode{\parindent=\saveparindent + \everypar={}} + +%%% This macro causes the next paragraph only to be set in capparmode. +\def\cappar{\noindent + \futurelet\cap\bigcap} diff --git a/macros/plain/contrib/misc/cassette.tex b/macros/plain/contrib/misc/cassette.tex new file mode 100644 index 0000000000..56ae700781 --- /dev/null +++ b/macros/plain/contrib/misc/cassette.tex @@ -0,0 +1,200 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% cassette.tex (C) Copyright 1991 by David Strip. +% Permission is granted for non-commercial use. +% Please send corrections, refinements, etc to drstrip@cs.sandia.gov +% Flames to \dev\null +% +% These macros are designed to lay out a label for a standard +% phillips audio cassette box. See the pictorial layout below. +% +% In general you will begin with a \artist command. This command +% takes a single argument and prints it in large boldface on the +% spine of the cassette. Within this argument the \\ command will +% create spacing between words. The total blank space on the line +% is divided equally between the left margin, the right margin, and +% each occurance of \\. The most typical use of \\ is to separate the +% names of different artists appearing on the tape. The \artist command +% does not need to be repeated if several labels are being made with +% the same artist. +% +% The next command is the \title command. This is very similar to the +% \artist command. It takes a single argument, which is printed on the +% cassette spine. The \\ command and spacing are the same as in the +% title command. +% +% Commands \sideA and \sideB are nearly indentical. They layout the +% left and right columns, repectively of the face of the cassette. +% (These columns are twice the length of the cassette box face, and are +% intended to be folded in half. These commands also take a single arguement +% which is then formatted as a paragraph in the appropriate column. The +% paragraph formatting has reverse indenting - the first line starts at the +% margin, subsequent lines are indented. In these commands you can use \\ to +% end lines (e.g., song titles). +% For the daring, the arguments to the commands can contain any TeX code +% (within reason). A few useful tricks for the uninitiated: You can call +% \centerline{...} to center some text. You can use {\bf ...} to put text in +% bold face. \blankline (defined in this file, will leave a blank line. +% (See the example.) +% +% The \NR and \noNR switches turn on or off the dolby logo on the spine. +% +% The \CD command within a \sideA or \sideB command will center the +% compact audio disk logo at the point that the command occurs. +% +% After you have filled in these fields, you actually cause the casette +% label to be processed with the \cassette-label command, which takes +% no arguements. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% _______________________________________________ +% | | +% | | +% |_______________________________________________| +% | \artist | +% | \title | +% |_______________________________________________| +% | | | +% | \sideA | \sideB | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% | | | +% |______________________|________________________| +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Example +% +% \artist{Dylan\\Kooper, Bloomfield, Stills} +% \title{Highway 61 Revisited\\Super Session} +% \sideA{ +% Like A Rolling Stone\\ +% Tombstone Blues\\ +% It Takes a Lot to Laugh, It Takes a Train to Cry\\ +% From a Buick 6\\ +% Queen Jane Approximately\\ +% Highway 61 Revisited\\ +% Just Like Tom Thumb's Blues\\ +% Desolation Row\\ +% \CD} %original was on CD +% \sideB{ +% Ballad of a Thin Man\\ +% \blankline %leave a blank line +% \centerline{\bf Bloomfield and Kooper} %center and bold for subhead +% Albert's Shuffle\\ +% Stop\\ +% Man's Temptation\\ +% His Holy Modal Majesty\\ +% \blankline +% \centerline{\bf Stills and Kooper} +% It Takes a Lot to Laugh, It Takes a Train to Cry\\ +% Season of the Witch\\ +% \CD} +% \cassette-label %Print the label +% +%\end +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%FONTS Substitute freely to get what you want. These are Nini Billawala's +% pandora family, which lends a slightly informal touch. + +\font\ftnbf=pnb10 scaled \magstep2 +\font\rm=pnr10 +\font\bf=pnb10 + +%These are two specialty fonts. I hope that you can find them. +\font\dolby=dolby +\font\cdlogo=cdlogo + +\tolerance=10000 %Allow very sloppy line breaking. +\nopagenumbers + +%setup the indentation the way I want it. +\parindent=0.pt +\def\\{\par\hangindent 2em \hangafter 1} + +%Now grab a few boxes to build the stuff in +\newbox\ART \newbox\TITLE \newbox\ASIDE \newbox\BSIDE \newbox\NRmark + +\def\sideA#1{\setbox\ASIDE=\vbox to 4.98in{\hsize 1.875in \raggedright +\vskip \baselineskip \\ \rm #1\vfil}} + +\def\sideB#1{\setbox\BSIDE=\vbox to 4.98in{\hsize 1.875in \raggedright +\vskip \baselineskip \\ \rm #1\vfil}} + +\def\artist#1{ +\setbox\ART=\vbox {\def\\{\hfil}\hsize 4.0in \ftnbf \hfil #1\hfil}} + +\def\title#1{\setbox\TITLE=\vbox { + \def\\{\hfil} + \hsize 4.0in \hfil \rm #1 \hfil}} + + +%These next two may very likely need some munging with, since there obviously +%no such thing as a standard font for the logos. In each case there is a +%single letter right after the font change command that specifies the mapping +%of the character in the font. Change that if you need. + + +\def\NR{\setbox\NRmark=\vbox {\hbox to 4in {\hfil \dolby E\hskip 2pt} \vskip 2pt}} +\def\noNR{\setbox\NRmark=\vbox to 10pt{}} + +\def\CD{\vfill\centerline{{\cdlogo C}}\vskip 1pc} + +\def\blankline{\vskip\baselineskip} + +%Noise reduction logo is enabled by default. +\NR + +\def\cassette-label{% + +%My driver does not do landscape, so I can only do one label per page. +%If you can do landscape, you might want to remove this centerline, and +%adjust the page size parameters to do two-up. I just cut a sheet of +%paper in half and print one at a time. + +\centerline{ +\hbox{ + \vrule height6.0in width.01in + \vbox to 6.0in{\vfil %this seems to be necessary to pick + \hrule width4in height.01in % for round-off in the decimals. + \vskip .49in + \hrule width4.0in height.01in + \vbox to .49in {\vfil + \copy\ART %artist name + \vfil + \box\TITLE %album titles + \vfil + \vskip -\ht\NRmark + \box\NRmark + } + \hrule width4.0in height.01in + \hbox to 4.0in{ + \hskip .06in + \box\ASIDE %side A + \hfil + \vrule height4.98in width.01in + \hfil + \box\BSIDE %side B + \hskip .06in + } + \hrule width4.0in height.01in + }\vrule height 6.0in width.01in + } +}} + diff --git a/macros/plain/contrib/misc/comment.tex b/macros/plain/contrib/misc/comment.tex new file mode 100644 index 0000000000..e8606bfad2 --- /dev/null +++ b/macros/plain/contrib/misc/comment.tex @@ -0,0 +1,42 @@ +% Comment.tex +% Macro to allow block comments in TeX +% +% Usage: Text between \begincomment and \endcomment is ignored; i.e. +% +% text +% \begincomment +% this text is ignored +% \endcomment +% more text +% +% Notes: Do NOT nest. +% The \endcomment MUST appear at the end of a line. +% TeX processes each line of ignored text, so the macro +% is not particularly fast. Use sparingly. The main use +% is to cause TeX to pass over small blocks of text. +% +% J.C. Alexander, May, 1986 +% +\edef\Saveatcatcode{\the\catcode`\@} +\catcode`\@=11 +\def\newcodes@{\edef\S@veslashcatcode{\the\catcode`\\} + \edef\S@velbraccatcode{\the\catcode`\{} + \edef\S@verbraccatcode{\the\catcode`\}} + \edef\S@venumsgcatcode{\the\catcode`\#} + \edef\S@veperctcatcode{\the\catcode`\%} + \catcode`\\=12 \catcode`\{=12 \catcode`\}=12 \catcode`\#=12 + \catcode`\%=12\relax} +\def\oldcodes@{\catcode`\\=\S@veslashcatcode + \catcode`\{=\S@velbraccatcode + \catcode`\}=\S@verbraccatcode + \catcode`\#=\S@venumsgcatcode + \catcode`\%=\S@veperctcatcode + \relax} +\def\begincomment{\newcodes@\endlinechar=10 \comment@} +{\lccode`\!=`\\ +\lowercase{\gdef\comment@#1^^J{\comment@@#1!endcomment\comment@@@}% +\gdef\comment@@#1!endcomment{\futurelet\next\comment@@@}% +\gdef\comment@@@#1\comment@@@{\ifx\next\comment@@@\let +\next=\comment@\else\def\next{\oldcodes@\endlinechar=`\^^M\relax}% + \fi\next}}} +\catcode`\@=\Saveatcatcode diff --git a/macros/plain/contrib/misc/cropmrks.tex b/macros/plain/contrib/misc/cropmrks.tex new file mode 100644 index 0000000000..d3d065775b --- /dev/null +++ b/macros/plain/contrib/misc/cropmrks.tex @@ -0,0 +1,352 @@ +%%% Usage: + +%%% \input cropmarks +%%% \topcropmark = <dimen> [plus <dimen>] [minus <dimen>] +%%% \bottomcropmark = <dimen> [plus <dimen>] [minus <dimen>] +%%% \leftcropmark = <dimen> [plus <dimen>] [minus <dimen>] +%%% \rightcropmark = <dimen> [plus <dimen>] [minus <dimen>] +%%% \lrcropmarkstrue ;;; iff you want alternating left and right cropmarks only +%%% \rvcropmarkstrue ;;; iff you want recto and verso specified independently +%%% (in which case the first four variables are two-valued +%%% as \recto<var> and \verso<var>). + +%%% Square brackets indicate optional items, and the <dimen>s are +%%% respectively (and all measured w.r.t. the origin, which is the +%%% top left corner of the notional, rather than physical page; the +%%% exact origin will need to be determined by inspection) + +%%% The distance to the centre of the cross; +%%% The distance which the cross extends beyond the page limits; +%%% The distance which the cross extends within the page limits. + +%%% Any or all can be zero <unit>s. For conventional (exo-) cropmarks, the +%%% `plus' component indicates the length of the mark, and the `minus' component +%%% should be omitted or zero. For inverted (endo-) cropmarks, the `plus' +%%% component should be omitted or zero, and the `minus' component indicates the +%%% length of the mark. If `plus' or `minus' components are negative, this +%%% has the effect of a `white cropmark' extending in the reverse direction +%%% for the specified distance; this may be used to achieve non-touching marks. +%%% The first and only mandatory component may be also negative, to cope with +%%% pathological origins. + +% +%%% A test which will allow us to be read regardless of the \catcode of `@' +% + +\newif \ifatletter +\ifcat @A\atlettertrue \else \catcode `\@ = 11 \atletterfalse \fi + +\ifx \c@tcodeminus \undefined +\else \message {Warning: previous meaning of \string \c@tcodeminus \space lost} +\fi +\edef \c@tcodeminus {\the \catcode `\-} +\catcode `\- = 12 + +% +\message {CROPMARKS.TEX V1.5 Copyright (C) 14-JUL-1994 14:52:34 Philip Taylor} +% + +% +%%% Miscellaneous variables +% + +\newif \iflrcropmarks \lrcropmarksfalse +\newif \ifrvcropmarks \rvcropmarksfalse +\newdimen \cropmarkwidth \cropmarkwidth = 0.4 pt +\newdimen \t@pshift +\newdimen \b@ttomshift +\newdimen \l@ftshift +\newskip \topcropmark +\newskip \leftcropmark +\newskip \rightcropmark +\newskip \bottomcropmark +\newskip \rectotopcropmark +\newskip \rectoleftcropmark +\newskip \rectorightcropmark +\newskip \rectobottomcropmark +\newskip \versotopcropmark +\newskip \versoleftcropmark +\newskip \versorightcropmark +\newskip \versobottomcropmark +\newskip \m@rkskip +\newskip \m@rkplus +\newskip \m@rkminus +\newbox \p@gebox +\newbox \cr@pmarkbox +\newbox \topcr@pmarkbox +\newbox \bottomcr@pmarkbox +% +%%% Extraordinary arcanery, to parse <skip>s into <dimen>s; any better ways ? +% +\begingroup +\catcode `\P = 12 \catcode `\L = 12 \catcode `\U = 12 \catcode `\S = 12 +\catcode `\M = 12 \catcode `\I = 12 \catcode `\N = 12 \catcode `\T = 12 +\globaldefs = 1 +\lowercase +{% +\def \p@rseskip #1% + {\expandafter \p@rs@skip \the #1 PLUS 0.0PT MINUS 0.0PT \@ndparse #1 } +\def \p@rs@skip #1 PLUS #2 MINUS #3\@ndparse #4 + {% + \m@rkskip = #1% + \m@rkplus = #2% + \m@rkminus = #3% + \ifdim \m@rkminus = 0.0 pt + \expandafter \p@rs@sk@p \the \m@rkskip MINUS 0.0PT \@ndparse + \fi + }% +\def \p@rs@sk@p #1MINUS #2\@ndparse {\m@rkskip = #1 \m@rkminus = #2 } +} +\endgroup +% +%%% Take control of \shipout, to force it to add cropmarks +% +\let \ship@ut = \shipout +\def \shipout {\futurelet \b@x \whichb@x} +\def \whichb@x + {% + \ifx \b@x \vbox + \def \n@xt {\setbox \p@gebox = }% + \afterassignment \Shipout + \else \ifx \b@x \hbox + \def \n@xt {\setbox \p@gebox = }% + \afterassignment \Shipout + \else \ifx \b@x \box + \def \n@xt {\setbox \p@gebox = }% + \afterassignment \Ship@ut + \else \ifx \b@x \copy + \def \n@xt {\setbox \p@gebox = }% + \afterassignment \Ship@ut + \else + \def \n@xt {\ship@ut}% + \message {Sorry, can't understand + what follows \shipout}% + \fi + \fi + \fi + \fi + \n@xt + } +\def \Shipout {\aftergroup \Ship@ut} +\def \Ship@ut + {% + \ifrvcropmarks + \ifodd \pageno + \topcropmark = \rectotopcropmark + \bottomcropmark = \rectobottomcropmark + \leftcropmark = \rectoleftcropmark + \rightcropmark = \rectorightcropmark + \else + \topcropmark = \versotopcropmark + \bottomcropmark = \versobottomcropmark + \leftcropmark = \versoleftcropmark + \rightcropmark = \versorightcropmark + \fi + \fi + \hoffset = \leftcropmark + \setbox \topcr@pmarkbox = + \hbox \bgroup + \p@rseskip \leftcropmark + \iflrcropmarks + \ifodd \count 0 + \let \next = \phantom + \else + \let \next = \relax + \fi + \else + \let \next = \relax + \fi + \next {\ifdim \m@rkminus < 0 pt + \begingroup + \advance \m@rkplus by \m@rkminus + \vrule height \cropmarkwidth + depth 0 pt width \m@rkplus + \kern -\m@rkminus + \endgroup + \else + \vrule height \cropmarkwidth + depth 0 pt width \m@rkplus + \fi + \begingroup + \p@rseskip \topcropmark + \vrule height \m@rkplus + depth \m@rkminus + width \cropmarkwidth + \endgroup + \ifdim \m@rkplus < 0 pt + \begingroup + \advance \m@rkminus by \m@rkplus + \rlap {\kern -\m@rkplus + \vrule height \cropmarkwidth + depth 0 pt width \m@rkminus}% + \endgroup + \else + \rlap {\vrule height \cropmarkwidth + depth 0 pt width \m@rkminus}% + \fi + }% + \hskip \m@rkskip + \p@rseskip \rightcropmark + \hskip \m@rkskip + \iflrcropmarks + \ifodd \count 0 + \let \next = \relax + \else + \let \next = \phantom + \fi + \else + \let \next = \relax + \fi + \next {\ifdim \m@rkplus < 0 pt + \begingroup + \advance \m@rkminus by \m@rkplus + \llap {\vrule height \cropmarkwidth + depth 0 pt width \m@rkminus + \kern -\m@rkplus + }% + \endgroup + \else + \llap {\vrule height \cropmarkwidth + depth 0 pt width \m@rkminus + }% + \fi + \begingroup + \p@rseskip \topcropmark + \vrule height \m@rkplus + depth \m@rkminus + width \cropmarkwidth + \endgroup + \ifdim \m@rkminus < 0 pt + \begingroup + \advance \m@rkplus by \m@rkminus + \kern -\m@rkminus + \vrule height \cropmarkwidth + depth 0 pt width \m@rkplus + \endgroup + \else + \vrule height \cropmarkwidth + depth 0 pt width \m@rkplus + \fi + }%%%%%%%% end of parameter to \next + \egroup%%%%%%%% end of \bgroup ... \egroup to \setbox ... + \ht \topcr@pmarkbox = 0 pt + \dp \topcr@pmarkbox = 0 pt + \wd \topcr@pmarkbox = \wd \p@gebox + \setbox \bottomcr@pmarkbox = + \hbox \bgroup + \p@rseskip \leftcropmark + \iflrcropmarks + \ifodd \count 0 + \let \next = \phantom + \else + \let \next = \relax + \fi + \else + \let \next = \relax + \fi + \next {\ifdim \m@rkminus < 0 pt + \begingroup + \advance \m@rkplus by \m@rkminus + \vrule height \cropmarkwidth + depth 0 pt width \m@rkplus + \kern -\m@rkminus + \endgroup + \else + \vrule height \cropmarkwidth + depth 0 pt width \m@rkplus + \fi + \begingroup + \p@rseskip \bottomcropmark + \vrule height \m@rkminus + depth \m@rkplus + width \cropmarkwidth + \endgroup + \ifdim \m@rkplus < 0 pt + \begingroup + \advance \m@rkminus by \m@rkplus + \rlap {\kern -\m@rkplus + \vrule height \cropmarkwidth + depth 0 pt width \m@rkminus}% + \endgroup + \else + \rlap {\vrule height \cropmarkwidth + depth 0 pt width \m@rkminus}% + \fi + }% + \hskip \m@rkskip + \p@rseskip \rightcropmark + \hskip \m@rkskip + \iflrcropmarks + \ifodd \count 0 + \let \next = \relax + \else + \let \next = \phantom + \fi + \else + \let \next = \relax + \fi + \next {\ifdim \m@rkplus < 0 pt + \begingroup + \advance \m@rkminus by \m@rkplus + \llap {\vrule height \cropmarkwidth + depth 0 pt width \m@rkminus + \kern -\m@rkplus + }% + \endgroup + \else + \llap {\vrule height \cropmarkwidth + depth 0 pt width \m@rkminus + }% + \fi + \begingroup + \p@rseskip \bottomcropmark + \vrule height \m@rkminus + depth \m@rkplus + width \cropmarkwidth + \endgroup + \ifdim \m@rkminus < 0 pt + \begingroup + \advance \m@rkplus by \m@rkminus + \kern -\m@rkminus + \vrule height \cropmarkwidth + depth 0 pt width \m@rkplus + \endgroup + \else + \vrule height \cropmarkwidth + depth 0 pt width \m@rkplus + \fi + }%%%%%%%% end of parameter to \next + \egroup%%%%%%%% end of \bgroup ... \egroup to \setbox ... + \ht \bottomcr@pmarkbox = 0 pt + \dp \bottomcr@pmarkbox = 0 pt + \wd \bottomcr@pmarkbox = \wd \p@gebox + \setbox \cr@pmarkbox = \vbox + \bgroup + \offinterlineskip + \p@rseskip \leftcropmark \l@ftshift = \m@rkskip + \advance \l@ftshift by \m@rkplus + \advance \l@ftshift by \cropmarkwidth + \p@rseskip \topcropmark \t@pshift = \m@rkskip + \p@rseskip \bottomcropmark \b@ttomshift = \m@rkskip + \vskip -\t@pshift + \moveleft \l@ftshift \box \topcr@pmarkbox + \vskip +\t@pshift + \vskip +\b@ttomshift + \moveleft \l@ftshift \box \bottomcr@pmarkbox + \vskip -\b@ttomshift + \egroup + \setbox \p@gebox = \vbox + {\offinterlineskip + \box \cr@pmarkbox + \box \p@gebox}% + \ship@ut \box \p@gebox + } +% +%%% Restore \catcode of `-' & `@' +% + +\catcode `\- = \c@tcodeminus +\let \c@tcodeminus = \undefined +\ifatletter \else \catcode `\@ = 12 \fi + +%%% All done diff --git a/macros/plain/contrib/misc/declare.tex b/macros/plain/contrib/misc/declare.tex new file mode 100644 index 0000000000..b97e704bdf --- /dev/null +++ b/macros/plain/contrib/misc/declare.tex @@ -0,0 +1,32 @@ +% File: TeX Inputs declare.tex +% Author: J E Pittman +% Date: September 29, 1988 +% +% Revision 01-Jun-1990 +% Changed count19 to count20 to conform to TeX 3.0 +% - Neil Burleson (NABTEXM@TAMVENUS) +% +% These macros provide a method of locally allocating registers +% without interference with previously allocated registers. The +% method is the same as on pages 346--347 of the \TeX book, however, +% the declare macros are intended for local use only. It is a logical +% error to use a new macro between a declare macro and the end of the +% appropriate enclosing group. +% +\def\declarecount {\allocate0\countdef}% +\def\declaredimen {\allocate1\dimendef}% +\def\declareskip {\allocate2\skipdef}% +\def\declaremuskip{\allocate3\muskipdef}% +\def\declarebox {\allocate4\chardef}% +\def\declaretoks {\allocate5\toksdef}% +% +\def\allocate#1#2#3{\relax + \advance\count1#1 by 1 + \ifnum\count1#1<\count20 + \else + \errmessage{No room for \string#3!}% + \fi + #2#3=\count1#1 + }% +% +\endinput diff --git a/macros/plain/contrib/misc/defstring.tex b/macros/plain/contrib/misc/defstring.tex new file mode 100644 index 0000000000..25feae9ead --- /dev/null +++ b/macros/plain/contrib/misc/defstring.tex @@ -0,0 +1,34 @@ +% -*- Mode: TeX -*- + +\ifx\thisfileis\anUndefinedMacro\input maybeload \fi + +\thisfileis{<eb.tex.texlocal>defstring} % abort loading if we're already loaded + +\input redefine + +% This file defines the top-level construction +% +% \defstring\foo "this is a string with \$% special characters" +% +% which defines the control sequence \foo so that it expands into +% a "{" begin-group symbol, a sequence of plain characters as given +% by the string, and a "}" end-group symbol. \foo will then be +% suitable for \expandafter\index\foo within a footnote, and similar +% uses. + +% \defstring won't work right inside \footnote or any other +% construction that reads its argument before \defstring gets +% to expand, because it works by changing reader syntax. + +\makeatletter + +\newtoks\defstring@toks + +\def\defstring#1{\def\@defstringdef{\edef#1{\the\defstring@toks}}\begingroup + \let\do\@makeother \dospecials \defstring@read} + +\def\defstring@read#1{\def\@tempa##1#1{\global\defstring@toks{{##1}}\endgroup + \@defstringdef}\@tempa} + +\makeatother + diff --git a/macros/plain/contrib/misc/dmhgener.tex b/macros/plain/contrib/misc/dmhgener.tex new file mode 100644 index 0000000000..3415713881 --- /dev/null +++ b/macros/plain/contrib/misc/dmhgener.tex @@ -0,0 +1,216 @@ +% +% Automatic numberer: \EQ for regular equations, \EQQ for several +% numbered equations in \eqalign sequence. +% Format of the equation label is (c.e), right justified, +% where 'c' is the chapter number \Chapno +% and 'e' the equation number \Eqno. You should set \Chapno at the +% beginning of the file. +% +\newcount\Eqno +\Eqno=0 +\def \EQ {\global\advance\Eqno by 1\eqno{(\number\Chapno .\number\Eqno)}} +\def \EQQ {\global\advance\Eqno by 1 &{ (\number\Chapno.\number\Eqno)}} +% +% Examples: +% +% $$ x = 3 + i \EQ$$ +% $$ \eqalign {x & = 30 \EQQ \cr +% y & = 50 \EQQ \cr} $$ +% +% +% Retrieval of an equation number: save it in a box. +% After display mode, say "\key `number' `space'". Then to retrieve +% the words "Eq. c.e" do "\copy `number'" or "\box `number'" if you +% only need to remember it once. The dummy `number' can be any number +% from 0 to 150, it is not the same as \Eqno. YOU must remember how +% you keyed a particular equation. The key remains the same, even if +% you change the order of the equations. +% +\def \key #1 {\setbox#1=\hbox{Eq. \number\Chapno .\number\Eqno}} +% +% Example: $$ x = y + z \EQ$$ \key71 +% \par As seen above in \copy71, this is a very blah, ... +% +% +% FIGURES +% +\newcount\Figno +\newcount\FIGNO +\newcount\Figpgno +% +% Make a numbered page that is blank except for "Figure c.f" at the bottom. +% +\def \figpage {\par \null \vfill \par \centerline {Figure \number \Chapno + \global \advance \Figpgno by1.\number\Figpgno}\eject} +% +% Refer to a new figure in the text for the first time. +% +\def \Fig {\global \advance \Figno by1 Figure~\number + \Chapno .\number\Figno} +% +% The figure caption always follows \FIG. +% +\def \FIG {\par \noindent \global \advance \FIGNO by1 {\bf FIG. \number + \Chapno .\number \FIGNO}: } +% +% Refer to more than one figure in the text for the first time. +% ... as seen in Figures 5.3-6 ... +% (I am not sure this works.) +% +\def \Figs #1{{\advance\Figno by1 Figures \number\Chapno + .\number\Figno}$-$ \global\advance\Figno by#1\number\Figno} +% +% TABLES +% +\newcount\Tablno +\newcount\rno +% +% Start each single table out with \Table. +% +\def \Table {\global \advance \Tablno by1\par \noindent + {\bf Table \number\Chapno-\number\Tablno}: } +% +% Tables a, b, c: There is a separate macro for the first one, +% \Tablea. For all subsequent tables use \Tableb. It uses the +% same table number as the previous table. +% +\def \Tablea {\global \advance \Tablno by1\par \noindent + {\bf Table \number\Chapno-\number\Tablno a}: } +\def \Tableb #1:{\par \noindent + {\bf Table \number\Chapno-\number\Tablno #1}: } +% +% Refer to a table for the first time in the text. \TABLE +% ... Table c--n ... +% +\def \TABLE {\global \advance \Tablno by1Table~\number \Chapno --\number + \Tablno} +% +% Use \skiptable to skip over a sideways table, but keep numbering correct. +% It also leaves a single blank, numbered page. +% +\def \skiptable {\global \advance \Tablno by1\null \eject} +% +% Make two lines across, slightly separated. +% +\def \linet {\smallskip \hrule \nobreak \smallskip \hrule \smallskip} +% +% CHAPTERS +% +\newcount\Chapno +\Chapno=0 +% +% To start a new chapter: \Chapno should be set at zero for the first +% chapter, one for chapter 2, etc. because \Chap increments \Chapno. +% It also initializes the figure, table, and reference counters. +% +\def \Chap #1{\global \Eqno=0\global \rno=0 + \global \Figno=0 + \global \FIGNO=0 + \global \Figpgno=0 + \global \Tablno=0 + \global \advance \Chapno by1\null \vskip 1in + \global \Tablno=0\global \Figno=0\global \rno=0 + \line {\bf CHAPTER \number \Chapno \hfil} + \bigskip + \line {\bf #1\hfil} \vskip2pc} +% +% SECTIONS +% +% Follow \sect with the section label and title. These macros are NOT +% automatic numberers. +% +\def \sect #1{\vskip20pt \par\noindent{\bf #1}\vskip10pt\nobreak\par\nobreak} +\def \subsect #1{\vskip10pt \par\noindent{\bf #1}\vskip10pt\nobreak\par\nobreak} +% +% REFERENCES +% +% \genref +% General references - for cases that don't fit into the special macros +% defined below, there is always this one. +% +% Note the format of the argument list. This is very important. The argument +% comes after a left parenthesis, and before a right parenthesis that is +% immediately followed by a blank space. A right parenthesis followed by +% a carriage return will not do. +% +\def \genref (#1) {{\global\advance\rno by1{}$^{\number\rno}$ + \advance\rno by 150\global \setbox\number\rno =\vtop + {\advance\rno by -150\item{\number\rno. }{\rm #1}.}}} +% +% \ref +% Regular references. (Multiple authors; one journal; volume; page; year) +% +\def \ref (#1;#2;#3;#4;#5) {\genref ({{\rm #1}, {\sl #2}, {\bf #3}, +{\rm #4 (#5)}}) } +% +% book references - underlines the title +% \refb (author; title; publisher; city(optionally, state); year; misc) +% +% The title is in math mode so one has to put the spaces between words +% in with "\ " or smaller ones with "\," +\def \refb (#1;#2;#3;#4;#5;#6) {{\global\advance\rno by1{}$^{\number\rno}$ + \advance\rno by 150\global \setbox\number\rno =\vtop + {\advance\rno by -150\item{\number\rno. }{\rm #1}, + $\underline{\rm #2}$, (#3, #4, #5) \rm #6.}}} +% +% In a book references - underlined +% This is for when the person quoted only wrote a part of a book. +% +\def \refi (#1;#2;#3;#4;#5;#6;#7;#8) {{\global\advance\rno by1{}$^{\number\rno}$ + \advance\rno by 150\global \setbox\number\rno =\vtop + {\advance\rno by -150\item{\number\rno. }{\rm #1, in:} + $\underline{\rm #2}$, Vol. #3, ed. #4 (#5, #6, #7), #8.}}} +% +% in a book references - italicized. It is easier to italicize than underline, +% especially when the title is very long. +% +\def \refit(#1;#2;#3;#4;#5;#6;#7;#8){{\global\advance\rno by1{}$^{\number\rno}$ + \advance\rno by 150\global \setbox\number\rno =\vtop + {\advance\rno by -150\item{\number\rno. }{\rm #1, in:} + {\it #2}, Vol. #3, ed. #4 (#5, #6, #7), #8.}}} +% +% comma references - When two papers are referenced at the same time, this +% will put a comma before the second number in the superscript. +% +\def \refc (#1;#2;#3;#4;#5) {{\global\advance\rno by1$\! \!^{,\number\rno}$ + \advance\rno by 150\global \setbox\number\rno =\vtop + {\advance\rno by -150\item{\number\rno. }{\rm #1}, {\sl + #2}, {\bf #3}, {\rm #4 (#5)}.}}} +% +% Several references, a, b, c. Use with \genref. +% Example (using _ to point out the required space bars): +% "\genref (\refabc (a)(author1;journal1;vol1;page1;year1)_;_ +% \refabc (b)(author2;journal2;vol2;page2;year2)_)_" +% +% It is good to put the semicolon in between reference (a) and (b). +% This can't be part of the macro because then the reference would +% end with a semicolon. +% +\def \refabc (#1)(#2;#3;#4;#5;#6) {{\rm #1) #2}, {\sl #3}, {\bf #4}, + {\rm #5 (#6)}} +% +% 2 part Multi-referencer +% +% Refer to a group of papers in the text, with a hyphen in between, +% as in 18-22. \multiref does not store the references at the end. +% One needs to use \genrefnoi, in general, or \refbox, for simple +% cases, for that. +% +\def\multiref #1{{\advance \rno by1{}$^{\number \rno + -{\advance \rno by#1\number\rno}}$}} +% +% \refbox +% This will put a reference in the list at the end without having +% to refer to it in the text. This is useful if you have references in +% tables. +% +\def \refbox (#1;#2;#3;#4;#5) {\genrefnoi ({{\rm #1}, {\sl #2}, {\bf #3}, + {\rm #4 (#5)}}) } +% +% \genrefnoi does not put a superscript in the text. This is useful if +% you need references in the list, but you refer to them in some outside +% part, such as a table. +% +\def\genrefnoi (#1) {{\global \advance \rno by 1 \advance \rno by + 150\global \setbox \number \rno=\vtop {\advance + \rno by -150\item {\number \rno. }{\rm #1}.}}} diff --git a/macros/plain/contrib/misc/doublecol.tex b/macros/plain/contrib/misc/doublecol.tex new file mode 100644 index 0000000000..ef05057bda --- /dev/null +++ b/macros/plain/contrib/misc/doublecol.tex @@ -0,0 +1,57 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Generic double column output. +% +% Modified from a routine written by Donald Knuth (The TeXBook, App. E) +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The user may modify the following to his tastes: +% +% \pagewidth vertical length of page. +% \pageheight horizontal width of page. +% \colwidth column width +% \separator macro to generate column separator. Default is nothing. +% \rulesep sets it to \vrule. \norulesep doesn't. +% \makepage default is what is contained in plain. +\catcode`@=11 % from plain.tex +% Create and initialize new dimensions. +\newdimen\pagewidth \newdimen\pageheight \newdimen\colwidth +\pagewidth=\hsize \pageheight=\vsize \colwidth=3.2truein + +% This routine is used by \output ; this is different from +% the one found in App. E. +\def\onepageout#1{\shipout\vbox{\offinterlineskip + \vbox to \pageheight {\makepage{#1}% + \boxmaxdepth=\maxdepth}} + \advancepageno} +\def\makepage#1{\makeheadline + #1 % Page contents + \makefootline} + +\output{\onepageout{\unvbox255}} +\newbox\partialpage +\def\begindoublecolumns{\begingroup + \output={\global\setbox\partialpage=\vbox{\unvbox255\bigskip}}\eject + \output={\doublecolumnout} \hsize=\colwidth \vsize=2\pageheight} +\def\enddoublecolumns{\output={\balancecolumns}\eject + \endgroup \pagegoal=\vsize} +\def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 \penalty\outputpenalty} +\def\pagesofar{\unvbox\partialpage + \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\separator\hfil\box2}} +\def\norulesep{\let\separator=\relax} +\def\rulesep{\let\separator=\vrule} +\let\separator=\relax +\def\balancecolumns{\setbox0=\vbox{\unvbox255} \dimen@=\ht0 + \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip + \divide\dimen@ by2 \splittopskip=\topskip + {\vbadness=10000 \loop \global\setbox3=\copy0 + \global\setbox1=\vsplit3 to\dimen@ + \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat} + \setbox0=\vbox to\dimen@{\unvbox1} + \setbox2=\vbox to\dimen@{\dimen2=\dp3 \unvbox3\kern-\dimen2 \vfil} + \pagesofar} diff --git a/macros/plain/contrib/misc/epsf.tex b/macros/plain/contrib/misc/epsf.tex new file mode 120000 index 0000000000..e3f1076b64 --- /dev/null +++ b/macros/plain/contrib/misc/epsf.tex @@ -0,0 +1 @@ +../../../generic/epsf/epsf.tex
\ No newline at end of file diff --git a/macros/plain/contrib/misc/figplace.tex b/macros/plain/contrib/misc/figplace.tex new file mode 100644 index 0000000000..f7036fc181 --- /dev/null +++ b/macros/plain/contrib/misc/figplace.tex @@ -0,0 +1,197 @@ +% +%Date: Tue, 25 Oct 88 14:11:06 +0100 +%From: Joost Zalmstra <mcvax!nat.vu.nl!jjaz@uunet.UU.NET> +%Subject: Re:Page Make-up Challenge +% +%Maybe the following set of macros can contribute to the solution of +%the problem posed by David Rogers in TeXhax #86. It implements a floating +%insertion with the following properties: +% - Every insertion must be put in a \vbox. Customised macros can then +% be used to place the white space for the figure and the figure caption +% in this box. +% - The order in which these \vbox-es are inserted is maintained. +% - No more than two boxes are placed on one page: the first on the top +% and the second on the bottom of the page. +% +%The proposed macro \figplace should create a \vbox with the correct layout +%of the figure and then call \addfigure to put it in the insertionlist: +% +%\def\figplace#1#2#3#4{setbox0=\vbox{% +%% here call macros to place figure and caption +%} +%\addfigure0} +% +%Note that the space separating the figure from the text should not +%be included in the \vbox. The skipregister \figureskip is used for this +%purpose. +% +%The macros are written in plain TeX, in fact the output routine given +%here is an extension of the plain output routine (TeX-book page 364). +% +%The basic idea is that figures that won't fit on the current page +%are kept on a list (the \box \figlist). This list is checked after +%a \shipout and if not empty a maximum of two \vboxes is inserted +%(using plains \topins) for the next page. As the insertions are \vboxes +%it is easy to split the insertion and put one at the top and one at +%the bottom of the page. +% +%Two further refinements should be mentioned here. +%1) If the figures on a page take so much room that less than a specified +%amount of space (given in dimen register \minpagesize) is left for +%the text, this text is shifted through to the next page. +%2) By inserting a \vbox with height \vsize (created by \vbox to \vsize..) +%a page insert is created. No extra \figureskip will be include in this case. +% +%I have tested these macros with real input (16 pages with on the first +%page the insertion of several figures) and it seems to work on the moment. +%However, I'm not a TeX guru and I would expect that these macros can be +%improved. One of the problems left is te fact that \addfigures must +%be called in horizontal mode ( \vadjust won't work). I would therefore +%apreciate comments, both on the macros as they stand and on how this +%contributes to the Challenge. +% +%Joost Zalmstra. +% +%jjaz%nat.vu.nl@hearn.bitnet +\newbox\figlist +\newcount\figuresonpage \figuresonpage=0 +\newcount\figuresonlist \figuresonlist=0 +\newskip\figureskip \figureskip=1.2 pc plus 1 pc +\newdimen\pagesize +\newdimen\minpagesize \minpagesize=5 pc +\newdimen\figuresizeonpage + +\def\addfigure#1{% add figure in box #1 to the document + \ifnum\figuresonpage>1 % allready two figures on this page + \addtolist{#1}% % so save for later + \else + \ifnum\figuresonlist>0 % figlist is not empty + \addtolist{#1} % so save for later + \else % no figures left over, so try to fit this one + \dimen0=\ht#1 + \ifdim\dimen0<\vsize% not a pagesize figure + \advance\dimen0 by \dp#1 % size of the box + \advance\dimen0 by \figureskip % extra space below or above + \fi + \advance\dimen0 by \pagetotal + \ifdim\dimen0>\pagegoal % no space on this page + \addtolist{#1} % so save for later + \else + \advance\dimen0 by \figuresizeonpage + \ifdim\dimen0>\dimen\topins % exceding maximum insertion size + \addtolist{#1} % so save for later + \else + \figureinsert{#1} % insert the figure + \fi + \fi + \fi + \fi +} + +\def\addtolist#1{% add box #1 to figlist + \global\setbox\figlist=\vbox{% + \nointerlineskip + \box#1 + \unvbox\figlist} + \global\advance\figuresonlist by 1 +} + +\def\figureinsert#1{% insert figure on this page + \ifdim\ht#1<\vsize + \insert\topins{\vbox{% + \ifnum\figuresonpage=0 + \unvbox#1\vskip\figureskip % skip below the figure + \else + \vskip\figureskip\unvbox#1 % skip above the figure + \fi + }} + \else + \pageinsert + \unvbox#1 + \endinsert + \fi + \global\advance\figuresonpage by 1 + \global\advance\figuresizeonpage by \ht#1 + \global\advance\figuresizeonpage by \dp#1 + \global\advance\figuresizeonpage by \figureskip +} +\def\checkfiglist{% see if there is a figure in the list that will + % fit on the next page + \ifnum\figuresonlist>0 + \global\setbox\figlist=\vbox{% + \unvbox\figlist + \setbox0=\lastbox + \global\advance\dimen0\ht0 + \ifdim\ht0<\vsize + \global\advance\dimen0 by \dp0 + \global\advance\dimen0 by \figureskip + \fi + \ifdim\dimen0>\vsize + \vbox{\box0} % no room ; replace the figure + \else + \ifdim\dimen0>\dimen\topins + \vbox{\box0} + \else + \global\advance\figuresonlist by -1 + \fi + \fi + \global\setbox0=\box0 + } + \else + {\setbox1=\box0 % make box0 void + \global\setbox0=\box0} + \fi +} +% Borrowing the macros from plain TeX + +\catcode`@=11 +\output{\myoutput} +\def\myoutput{\shipout\vbox{\makeheadline\pagebody\makefootline}% + \advancepageno + \global\figuresonpage=0 + \dimen0=0pt + \global\figuresizeonpage = 0pt + \checkfiglist % check if there is figure waiting and return it in box 0 + \ifvoid0 % nothing left + \else + \figureinsert0% insert this figure + \checkfiglist % check for a second figure + \ifvoid0\else + \figureinsert0 + \fi + \fi + \ifvoid255\else\unvbox255\penalty\outputpenalty\fi % unused page back on list + \ifnum\outputpenalty>-\@MM \else\dosupereject\fi} + +\def\pagecontents{% + \ifnum\figuresonpage>0 % check for insertion of figures + \unvbox\topins % place the figure(s) on top + \ifnum\figuresonpage=2 + \setbox0=\lastbox % remove the second figure + \fi + \setbox1=\lastbox + \unvbox1 + \fi +% Check box 255 + \pagesize=\ht255 + \advance\pagesize by \dp255 % determine size of box 255 + \ifdim\pagesize>\minpagesize + \dimen@=\dp255 \unvbox255 % the real page contents + \else + \message{tekstsize = \the\ht255, \the\dp255} + \ifdim\ht255=0pt % box is empty + \else + \vfil % to small so leave for next page + \fi + \fi +% + \ifnum\figuresonpage=2 + \box0 % the second figure + \fi + \ifvoid\footins\else % footnote info is present + \vskip\skip\footins + \footnoterule + \unvbox\footins\fi + \ifr@ggedbottom \kern-\dimen@ \vfil \fi} + +\catcode`@=12 % at signs no longer letters diff --git a/macros/plain/contrib/misc/fixpdfmag.tex b/macros/plain/contrib/misc/fixpdfmag.tex new file mode 100644 index 0000000000..04e25b7a9c --- /dev/null +++ b/macros/plain/contrib/misc/fixpdfmag.tex @@ -0,0 +1,36 @@ +% fixpdfmag.tex
+% Author: Javier Bezos, 2007
+%
+% This is Public Domain. You are free to use, copy, modify,
+% distribute or whatever you want without restrictions. It is
+% unsupported, so please, do not contact the author, just
+% modify the file.
+%
+% Unfortunately, pdftex has changed recently its behaviour and
+% now the page size is affected by \magnification, usually not a
+% wanted effect. It has been proposed to modify Plain TeX when
+% used with pdftex, by making a few changes in the pdftex.ini
+% file, but many people do not know or simply do not want to
+% modify Plain TeX or a custom made format. This file provides
+% an alternative which requires to modify the documents, as
+% the following example illustrates:
+%
+% \magnification3000
+% \input fixpdfmag % <- after \magnification
+%
+% Hello
+% \bye
+%
+% If you are using a custom page size, it is preserved,
+% as it just converts pt units to truept ones.
+
+\ifx\pdfpageheight\undefined\else
+ \begingroup
+ \catcode`\@=11
+ \global\pdfpageheight\expandafter\getf@ctor\the\pdfpageheight truept
+ \global\pdfpagewidth\expandafter\getf@ctor\the\pdfpagewidth truept
+ \global\pdfhorigin\expandafter\getf@ctor\the\pdfhorigin truept
+ \global\pdfvorigin\expandafter\getf@ctor\the\pdfvorigin truept
+ \endgroup
+\fi
+\endinput
\ No newline at end of file diff --git a/macros/plain/contrib/misc/fnote.tex b/macros/plain/contrib/misc/fnote.tex new file mode 100644 index 0000000000..6591cfc1e9 --- /dev/null +++ b/macros/plain/contrib/misc/fnote.tex @@ -0,0 +1,20 @@ +%%% fnote.tex ----------------cut here------------------------------------------ +\catcode`\@=11 +\def\vfootnote#1{\insert\footins\bgroup + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \baselineskip=\normalbaselineskip % necessary for single space + % footnotes with double space + % text + \splitmaxdepth\dp\strutbox \floatingpenalty\@MM + \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip + \textindent{#1}\footstrut\futurelet\next\fo@t}% Change \textindent for + % different footnote styles +\newcount\footnum + \footnum=0 +\def\fnote{\advancefootnum + \footnote\fn@m} +\def\advancefootnum{\advance\footnum by 1} +\def\fn@m{{$^{\number\footnum}$}} +\catcode`\@=12 +%%%---------------------Cut here------------------------------------------------ diff --git a/macros/plain/contrib/misc/fnpara.tex b/macros/plain/contrib/misc/fnpara.tex new file mode 100644 index 0000000000..735671e4d4 --- /dev/null +++ b/macros/plain/contrib/misc/fnpara.tex @@ -0,0 +1,116 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% FNPARA.TEX based on D. E. Knuth's "Dirty Tricks" macros from pages +% 398--400 of The TeXbook. +% Dominik Wujastyk, September 15, 1988. +% +% Set the footnote text font here: +% +\font\footnotesize=cmr8 +% +% Set the font for the footnote numbers at the bottom of the page here +% +\font\footnumberfont=cmbx8 +% +% Set any text to follow each footnote here: +% +\def\endnotetext,$\parallel$\hskip.5em- +% +% Switch off above endnote text, for comparison: +% +\let\endnotetext=\relax +% +% Normal @-character macro lock: +% +\catcode`\@=11 +% +% Initialize counters: +% +\newcount\footno +\footno=0 +% +% Clever code for \getfactor (The TeXbook, p.375): +% +,\catcode`p=12 \catcode`t=12 \gdef\\#1pt,#1-- +\let\getfactor=\\ +% +% Set space to follow footnote text: +% +\newskip\footglue \footglue=1em plus.3em minus.3em +% +% Set leading of footnotes: +% +\newdimen\footnotebaselineskip \footnotebaselineskip=10pt +% +% Calculate \fudgefactor (ratio of \baselineskip to \hsize): +% +\dimen0=\footnotebaselineskip \multiply\dimen0 by 1024 +\divide \dimen0 by \hsize \multiply\dimen0 by 64 +\xdef\fudgefactor,\expandafter\getfactor\the\dimen0 - +% +% Redefine footnotes to be automatically numbered: +% +\def\footnote,\global\advance\footno by 1 + \let\@sf=\empty% + \ifhmode\edef\@sf,\spacefactor=\the\spacefactor-\/\fi% +$N,\the\footno-$\@sf\vfootnote- +\def\vfootnote#1,\insert\footins,\floatingpenalty=20000 + \footnotesize \setbox0=\hbox,% + ,\footnumberfont \the\footno\penalty10000\hskip.5em-#1% +\penalty-10\hskip\footglue\endnotetext- + \dp0=0pt \ht0=\fudgefactor\wd0 \box0-- +% +% Assume \plainoutput routine, but change \pagecontents: +% +\def\pagecontents,\ifvoid\topins\else\unvbox\topins\fi + \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255 + \ifvoid\footins\else % footnote info is present + \vskip\skip\footins + \footnoterule + \global\setbox1=\vbox,\makefootnoteparagraph-\unvbox1\fi + \ifr@ggedbottom \kern-\dimen@ \vfil \fi- +\def\footnoterule,\kern-3\p@ + \hrule width 2truein \kern 2.6\p@- % the \hrule is .4pt high +% +% Box manipulation code from The TeXbook, p.399: +% +\def\makefootnoteparagraph,\unvbox\footins \makehboxofhboxes + \setbox0=\hbox,\unhbox0 \removehboxes- + \baselineskip=\footnotebaselineskip\noindent\unhbox0\par - +\def\makehboxofhboxes,\setbox0=\hbox,- + \loop\setbox2=\lastbox + \ifhbox2 \setbox0=\hbox,\box2\unhbox0-\repeat- +\def\removehboxes,\setbox0=\lastbox + \ifhbox0,\removehboxes-\unhbox0 \fi- +% +% Reimpose @-lock. +% +\catcode`\@=12 +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%Sample text: +% +\vsize 6in +\voffset 2in +\hsize 4in +\hoffset 1in + +The entire set of footnotes could be combined into a single paragraph, with +generous spacing between the individual items. For example, the ten footnotes +we have been considering might appear as follows:\footnote,First footnote.- +And some more.\footnote,Second footnote. (Every once in a~while a long + footnote might occur, just to make things difficult.)- +And some more. +And some more.\footnote,Third footnote.-$N,$\footnote,Fourth footnote.- +And some more. +And some more.\footnote,Fifth footnote. + (This is incredibly boring, but it's just an +example.)-$N,$\footnote,Another.- +And some more. +And some more. +And some more.\footnote,And another.-$N,$\footnote,Ho +hum.-$N,$\footnote,Umpteenth +footnote.-$N,$\footnote,Oodles of them.- + +\bye +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/macros/plain/contrib/misc/fontbl.tex b/macros/plain/contrib/misc/fontbl.tex new file mode 100644 index 0000000000..8582a6b0e8 --- /dev/null +++ b/macros/plain/contrib/misc/fontbl.tex @@ -0,0 +1,173 @@ + +% The essential parts of this macro appeared in {\it TUGboat, Volume 3, No. 1} +% in the note: "DISPLAY OF A FONT IN TABLE FORM." by Roger L. Beeman. +% This version was rewritten by Pierre A. MacKay to take advantage of +% the new features of \TeX82. It is now interactive, and prompts the +% user for a font name. If the font is a text font, a sample paragraph +% is set, which is justified to three times the lower-case alphabet length +% if that will fit in the overall \hsize. (If the font is a fixed-width +% font such as "amtt", the sample is set with a ragged right margin.) +% The sample is leaded 20% over the stated point-size, so that a +% 10-point font is set 10 on 12. The length of both upper and lower +% case alphabets is given, along with the height and depth of the +% lower case alphabet and the height of the upper case alphabet. These +% last dimensions can be very useful for calculating the size of +% close-fitting boxes and struts. +% +% Non-text fonts are displayed in table form only. +% +% If you have \TeX\ running with "plain.tex" loaded, +% you can start this macro by typing "tex fontbl" and you will be prompted +% for the rest +% +\baselineskip 0pt \lineskip 0pt +\vsize 8.5truein +\let\sl=\tensl +\newcount\bighand\newcount\littlehand +\bighand=\time\divide\bighand by 60 +\littlehand=\bighand\multiply\littlehand by -60 +\advance\littlehand by\time +\def\makedateline{\line{{\sl \fontname scaled \\magstep\step\hfil + \the\bighand:\ifnum\littlehand<10{0}\fi + \the\littlehand\ - \the\month/\the\day/\the\year}}} + +\output{\shipout\vbox{\hrule width1em\vskip 1ex +\makedateline\vskip1em\box255\vskip1em +\hrule width1em}\global\advance\count0 by 1} + +\newdimen\maxwide +\dimendef\vu=\maxwide +\setbox 9\hbox{\sl 0} + +\def\spike{\hbox to 0pt{\vbox to 1\ht9{}}} +\def\cell#1{\hbox to \vu{\hfill\char'#1\hfill}\vrule} +\def\label#1{\vbox to 1\ht8{\vfill + \hbox to 35pt{\hfill\sl '#10\hskip1em}\vfill}\vrule} + +\def\seprow{\def\m{\hskip \vu{}\vrule height 2pt}\hbox{\m\m\m\m\m\m\m\m}} +\def\cellrow#1{\setbox 8\vbox{\seprow\hbox{\spike\ignorespaces + \cell{#10}\cell{#11}\cell{#12}\cell{#13}\ignorespaces + \cell{#14}\cell{#15}\cell{#16}\cell{#17}\ignorespaces + \hfill}\seprow\hrule}\hbox{\label{#1}\box8}} + +\def\lcol#1{\hbox to \vu{\hfill{\sl #1}\hfill}\hskip .4pt} +\def\chw#1{\hbox{\char'#1}} + +\def\colw#1{\vbox{\chw{#10} + \chw{#11} + \chw{#12} + \chw{#13} + \chw{#14} + \chw{#15} + \chw{#16} + \chw{#17}}} + +\def\setw#1{\vbox{\colw{#10} + \colw{#11} + \colw{#12} + \colw{#13} + \colw{#14} + \colw{#15} + \colw{#16} + \colw{#17}}} +\def\getw{\setbox 0\vbox{\setw0\setw1\hbox to 1\wd9{} + \hbox to 1em{}}\vu=1.625\wd0} + +\def\table#1{\font\tablefont=#1 scaled \scale +\tablefont\getw\null\vfil +\hbox to 6in{\hfil\ignorespaces +\vbox{\ifdim\fontdimen2\tablefont>0pt \hbox{\hskip35pt \fontname \hfil} \fi + \vskip10pt + \hbox{\hskip35pt\lcol0\lcol1\lcol2\lcol3\lcol4\lcol5\lcol6\lcol7} + \vskip 4 pt + \hbox{\hskip35pt\vbox{\hrule width 8\vu}\vbox{\hrule width 3.6pt}} + \cellrow{00}\cellrow{01}\cellrow{02}\cellrow{03} + \cellrow{04}\cellrow{05}\cellrow{06}\cellrow{07} + \cellrow{10}\cellrow{11}\cellrow{12}\cellrow{13} + \cellrow{14}\cellrow{15}\cellrow{16}\cellrow{17}}\ignorespaces +\hss}} +\def\tblraggedright{\rightskip0pt plus5em} + +\global\def\test{} +\global\def\fin{END } +\global\def\lcfin{end } +\global\def\halfstep{half } +\def\\{$\backslash$} +\def\doit{ +\baselineskip 0pt \lineskip 0pt +\message{Type a valid font name, or type END to quit :} +\read16 to\fontname +\ifx\fontname\lcfin\let\test=\fin\else\global\let\test=\fontname\fi +\ifx \fin\test \relax +\else \message{Scaled to what magstep? (half, or 0..5):} +\read16 to\step +\ifx \halfstep\step \global\def\scale{1095 } \else + \global\def\scale{\ifcase\step 1000\or + 1200\or 1440\or 1728\or 2074\or 2488\fi\relax} + \fi +\message{Graphing font \fontname} + \table{\fontname} +\rightskip 0pt % So that one ragged right font doesn't affect all +% following fonts +\vskip 1em +\ifdim\fontdimen2\tablefont>0pt + \setbox8=\hbox{abcdefghijklmnopqrstuvwxyz} + \setbox7=\hbox{ABCDEFGHIJKLMNOPQRSTUVWXYZ} + \global\dimen8=1\wd8\global\dimen7=.5\hsize + \global\dimen5=1\ht8\global\dimen4=1\dp8\global\dimen3=1\ht7 + \edef\length{\the\dimen8} + \global\dimen6=\dimen8\global\multiply\dimen6 by 3 + \ifdim\dimen6>\hsize \global\dimen6=\hsize \fi + \ifdim\fontdimen3\tablefont=0pt \tblraggedright + \global\advance\dimen6 by -40pt \fi + \vskip 1em + \noindent + \ifdim\dimen8<\dimen6 + \line{\unhbox8\hfil } + \vskip 1ex \fi + \centerline{{\rm Alphabet length \length. Quad is \the\fontdimen6\tablefont}} + \vskip .25em + \centerline{{\rm Lower case height is \the\dimen5 ; depth is \the\dimen4}} + \vskip 1em + \global\dimen8=1\wd7 \edef\length{\the\dimen8} + \noindent + \ifdim\dimen8<\dimen6 + \line{\unhbox7 \hfil} + \vskip 1ex \fi + \centerline{{\rm Alphabet length \length ; height \the\dimen3}} + \vskip 1em \vfil + \vbox{\hsize \dimen6 + \baselineskip 1.2em + \parskip .15em + \lineskip .2em + +The design of low-resolution typefaces is complicated by the need +to achieve two different and rather incompatible ends. A font which is +exclusively intended for Office Automation equipment should be designed +to make the very best use of that environment. Its proportions, balance, +shading and letter-spacing can and indeed must be fitted to exact +pixel-bound\-aries, whe\-ther or not the refinements of anti-aliasing are +used. + +A low-resolution font which was created primarily as the proof-copy +imitation of an associated high-resolu\-tion font will never be quite +so precisely matched to its environment. Its contours will necessarily be +determined by exact pixel-boundaries, but often not in the way we might +prefer. It need not be sloppy, but it can never be so well tuned as +a font of the first variety. It is a poor Platonic reflection of an +idea that cannot be fully known except in the dazzling light +of high-resolution typesetting. The vast majority of fonts produced +with METAFONT belong to this second variety. A low-resolution +METAFONT character should be judged for what it is, and not for what +it has never claimed to be. +} +\fi + +\vfill\penalty-10000 + +\doit +\fi +} + +\doit +\bye diff --git a/macros/plain/contrib/misc/fontchart.tex b/macros/plain/contrib/misc/fontchart.tex new file mode 100644 index 0000000000..d598631118 --- /dev/null +++ b/macros/plain/contrib/misc/fontchart.tex @@ -0,0 +1,108 @@ +% fontchart.tex +% +% make a (fairly large) font chart +% +% +% 1990-01-06 ??? +% +% First version? +% +% 2001-07-18 Werner Lemberg <wl@gnu.org> +% +% Suppress boundary ligatures. + +\newlinechar=`@ +\message{@Name of the font to chart = } +\read-1 to \fontname + +\font\f=\fontname at .75in +\f + +% Here's the best way I know to discover character height and depth +% when they are possibly negative. +\fontdimen5\f=-10000pt % a new (rather small) xheight +\textfont0=\f +\newdimen\h \newdimen\d % will be set to the character's height, depth +\def\htdp#1{\setbox0=\hbox{\noboundary\char#1\noboundary}\h=-\ht0 + \setbox0=\hbox{\noboundary\accent#1\char#1\noboundary}\advance\h\ht0 \advance\h-10000pt + \setbox0=\null \wd0=-10000pt % in case the character has a charlist! + \setbox0=\hbox{$\mathaccent#1{\box0}$}% + \d=\ht0 \advance\d-10000pt \advance\d-\h} + +% (By the way, my previous best was this: +% \textfont15=\f % use family "F +% \fontdimen8\tenex=0pt % set defaultrulethickness zero +% \setbox1=\null \ht1=-10000pt \setbox2=\null \dp3=-10000pt +% \newdimen\d \newdimen\h \newcount\n +% \n=#1 \advance\n"F00 +% \setbox0=\hbox{$\radical\n{\copy1}$} +% \d=\dp0 \advance\d-5000pt \advance\d\d %\showthe\d +% \setbox0=\hbox{$\radical\n{\copy2}$} +% \h=\ht0 \advance\h-5000pt \advance\h-.5\d +% \ifdim\h>0pt \h=.5\h \fi +% ....very tricky! But it works only when height+depth is positive.) + +\tracinglostchars=0 +\nopagenumbers + +\def\testrow#1#2{\setbox0=\hbox{\penalty1\def\\{\char'#1#2}% + \hbox{\noboundary\\0\noboundary}% + \hbox{\noboundary\\1\noboundary}% + \hbox{\noboundary\\2\noboundary}% + \hbox{\noboundary\\3\noboundary}% + \hbox{\noboundary\\4\noboundary}% + \hbox{\noboundary\\5\noboundary}% + \hbox{\noboundary\\6\noboundary}% + \hbox{\noboundary\\7\noboundary}% + \global\chardef\p=\lastpenalty}} % p=1 if none there + +\raggedbottom +\baselineskip=1in +\topskip=.75in +\newdimen\w \w=.75in +\headline={\vtop{\hbox{\tt\fontname\unskip, page \folio\hfil} + \kern-.75in\unitsdigits}\hss} +\footline={\unitsdigits\hss} +\def\unitsdigits{\hbox{\kern.3in \tt + \hbox to\w{\ \ 0\hss}% + \hbox to\w{\ \ 1\hss}% + \hbox to\w{\ \ 2\hss}% + \hbox to\w{\ \ 3\hss}% + \hbox to\w{\ \ 4\hss}% + \hbox to\w{\ \ 5\hss}% + \hbox to\w{\ \ 6\hss}% + \hbox to\w{\ \ 7\hss}}} + +\def\row#1#2{\testrow#1#2% +\ifnum\p=0\hbox{\hbox to.3in{\tt#1#2\hfil}% + \mod#1#20\mod#1#21\mod#1#22\mod#1#23\mod#1#24\mod#1#25\mod#1#26\mod#1#27% + \hbox to.3in{\tt\hfil#1#2}}\fi} + +\newdimen\pixel \pixel=.00333333in +\def\mod#1#2#3{\chardef\c='#1#2#3 \htdp\c + \setbox0=\hbox{\penalty1\noboundary\c\noboundary\global\chardef\p=\lastpenalty}% + \ifnum\p=1 \hbox to\w{}\else + \setbox2=\hbox{\noboundary\c\noboundary\/}% + \hbox to\w{\kern-\pixel \vrule width\pixel height\h depth\d + \copy\leftbox\copy0\copy\rightbox + \vrule width\pixel height\h depth\d \kern-\pixel \kern-\wd0 + \raise\h\vbox{\hrule height\pixel width\wd0}\kern-\wd0 + \lower\d\vbox{\hrule height0pt depth\pixel width\wd0}\kern-\wd0 + \ifdim\wd2>\wd0 \kern\wd2\raise\h\copy\icbox \fi + \hss}\fi} + +\newbox\leftbox % marking the baseline at the left +\setbox\leftbox=\hbox{\kern-\pixel\vrule width\pixel height4pt + \vrule height0pt depth\pixel width4pt \kern-4pt} +\newbox\rightbox % marking the baseline at the right +\setbox\rightbox=\hbox{\kern-4pt\vrule height0pt depth\pixel width4pt + \vrule width\pixel height4pt \kern-\pixel} +\newbox\icbox % the mark of an italic correction +\setbox\icbox=\hbox{\kern-4pt\vrule height\pixel width4pt depth0pt + \vrule width\pixel depth4pt} + +\row00 \row01 \row02 \row03 \row04 \row05 \row06 \row07 +\row10 \row11 \row12 \row13 \row14 \row15 \row16 \row17 +\row20 \row21 \row22 \row23 \row24 \row25 \row26 \row27 +\row30 \row31 \row32 \row33 \row34 \row35 \row36 \row37 +\bye diff --git a/macros/plain/contrib/misc/fortran.tex b/macros/plain/contrib/misc/fortran.tex new file mode 100644 index 0000000000..93aa198de9 --- /dev/null +++ b/macros/plain/contrib/misc/fortran.tex @@ -0,0 +1,42 @@ +%%%---Cut Here-------------------------------------------------------- +%%% File: Fortran.TeX +% This is a file of commands for printing out programs using TeX +% -- see DIRTY TRICKS in TeXbook +% +% This version is designed to print source code at 9 point +% fitting an 80 column line into a 6 true inch width with +% 8 point line numbers before each line. +% It handles TAB (^I) characters almost the same as DEC +% +% usage: +% \input fortran % put this early in the file +% \listing{file.ext} % use dev:[dir] if you wish +% +% B.H. Toby 8/86 +% +\newcount\lineno +\font\Alisttt=cmtt9 at 9 truept +\font\Alistrm=cmr8 at 8 truept +\def\uncatcodespecials{\def\do##1{\catcode`##1=12 }\dospecials} +\def\listing#1{\par\begingroup\setupverbatim\input#1 \endgroup} +\def\setupverbatim{ + \Alisttt\baselineskip= 8.5truept\lineskip=1truept + \lineskiplimit=1truept\topskip=0pt + \lineno=0 + \def\par{\leavevmode\egroup\box0\endgraf} + \obeylines \uncatcodespecials \obeyspaces + \catcode`\`=\active \catcode`\^^I=\active + \everypar{\advance\lineno by1 + \llap{\Alistrm\the\lineno\ \ }\startbox}} +\newdimen\w \setbox0=\hbox{\Alisttt\space} \w=8\wd0 +\def\startbox{\setbox0=\hbox\bgroup} +{\catcode`\^^I=\active + \gdef^^I{\leavevmode\egroup + \dimen0=\wd0 + \divide\dimen0 by\w + \multiply\dimen0 by\w + \advance\dimen0 by\w + \wd0=\dimen0 \box0 \startbox}} +{\obeyspaces\global\let =\ } +{\catcode`\`=\active \gdef`{\relax\lq}} +%%%---Cut Here-------------------------------------------------------- diff --git a/macros/plain/contrib/misc/gkpmac.tex b/macros/plain/contrib/misc/gkpmac.tex new file mode 100644 index 0000000000..cdcd7b9c08 --- /dev/null +++ b/macros/plain/contrib/misc/gkpmac.tex @@ -0,0 +1,859 @@ +\tracingpages=1 % TEMPORARY! +% Macros for `Concrete Mathematics' +\ifx\gkpmac\fmtversion\endinput\else\let\gkpmac=\fmtversion\fi + +% Fonts for regular text + +\font\textrm=ccr10 % roman +\font\textit=ccti10 % italic (emphasis) +\font\textsl=ccsl10 % slanted (titles) +\font\textbf=cmbx10 % bold +\font\textcsc=cccsc10 % caps and small caps +\font\oldsty=ccmi10 % equation numbers + +% Fonts for regular math +% I'm setting \fontdimen2 to zero because AMS forgot to do it; +% they may have fixed the problem in the meantime, but no harm is done + +\font\mathtext=ccr10 + \font\mathsubtext=ccr7 + \font\mathsubsubtext=ccr5 +\font\mathlet=eurm10 \fontdimen2\mathlet=0pt + \font\mathsublet=eurm7 \fontdimen2\mathsublet=0pt + \font\mathsubsublet=eurm5 \fontdimen2\mathsubsublet=0pt + \skewchar\mathlet='177 \skewchar\mathsublet='177 \skewchar\mathsubsublet='177 +\font\mathsym=cmsy10 + \font\mathsubsym=cmsy7 + \font\mathsubsubsym=cmsy5 + \skewchar\mathsym='60 \skewchar\mathsubsym='60 \skewchar\mathsubsubsym='60 +\font\mathext=cmex10 + \font\mathsubext=cmex10 + \font\mathsubsubext=cmex10 +\font\mathscr=euxm10\fontdimen2\mathscr=0pt + \font\mathsubscr=euxm7 \fontdimen2\mathsubscr=0pt + \font\mathsubsubscr=euxm5 \fontdimen2\mathsubsubscr=0pt + \skewchar\mathscr='60 \skewchar\mathsubscr='60 \skewchar\mathsubsubscr='60 +\font\mathfr=eufm10\fontdimen2\mathfr=0pt + \font\mathsubfr=eufm7 \fontdimen2\mathsubfr=0pt + \font\mathsubsubfr=eufm5 \fontdimen2\mathsubsubfr=0pt +\font\matheuex=euex10\fontdimen2\matheuex=0pt + +\font\eulerbf=eurb10 \fontdimen2\eulerbf=0pt % not hooked in to these macros + +% Fonts for graffiti + +\font\gtext=ccslc9 +\font\goldstyle=ccmic9 + \fontdimen3\gtext=0pt \fontdimen4\gtext=0pt % no stretch or shrink +\font\gmathtext=ccr9 + \font\gmathsubtext=ccr6 + \font\gmathsubsubtext=ccr5 +\font\gmathlet=eurm10 scaled 900 \fontdimen2\gmathlet=0pt + \font\gmathsublet=eurm7 scaled 857 \fontdimen2\gmathsublet=0pt + \font\gmathsubsublet=eurm5 \fontdimen2\gmathsubsublet=0pt + \skewchar\gmathlet='177 \skewchar\gmathsublet='177 + \skewchar\gmathsubsublet='177 +\font\gmathsym=cmsy9 + \font\gmathsubsym=cmsy6 + \font\gmathsubsubsym=cmsy5 + \skewchar\gmathsym='60 \skewchar\gmathsubsym='60 \skewchar\gmathsubsubsym='60 +\font\gmathext=cmex9 + \font\gmathsubext=cmex9 + \font\gmathsubsubext=cmex9 +\font\gmathscr=euxm10 scaled 900 \fontdimen2\gmathscr=0pt + \font\gmathsubscr=euxm7 scaled 857 \fontdimen2\gmathsubscr=0pt + \font\gmathsubsubscr=euxm5 \fontdimen2\gmathsubsubscr=0pt + \skewchar\gmathscr='60 \skewchar\gmathsubscr='60 \skewchar\gmathsubsubscr='60 +\font\gmathfr=eufm10 scaled 900 \fontdimen2\gmathfr=0pt + \font\gmathsubfr=eufm7 scaled 857 \fontdimen2\gmathsubfr=0pt + \font\gmathsubsubfr=eufm5 \fontdimen2\gmathsubsubfr=0pt +\font\gmatheuex=euex9 \fontdimen2\gmatheuex=0pt + +% Fonts for headings, etc. + +\font\chapfont=cmbxcd10 scaled 8000 +\font\title=cmbx10 scaled \magstep5 +\font\subtitle=cmbx10 scaled 1315 % that's magstep 1.5 +\font\subsubtitle=cmbxsl10 +\font\runhead=cmbx9 +\font\foliofont=cmr9 +\font\gtfont=cmmi9 % for the \t accent +\font\ninesl=ccsl9 % used in the index only + +% Normal text conventions + +\catcode`@=11 % borrow the private macros of PLAIN (with care) +\def\wlog#1{} % don't put allocation info into the log + +\hsize=28pc +\vsize=45.25pc +\parindent=20pt +\baselineskip=13pt + +\let\sc=\textcsc +\let\bf=\textbf +\def\textindent#1{\noindent\hbox to\parindent{\bf#1\hfil}\ignorespaces} +\def\exitem{\hangindent2\parindent \textindent} + +\textfont0=\mathtext + \scriptfont0=\mathsubtext + \scriptscriptfont0=\mathsubsubtext +\textfont1=\mathlet \let\tfont=\teni + \scriptfont1=\mathsublet + \scriptscriptfont1=\mathsubsublet +\textfont2=\mathsym + \scriptfont2=\mathsubsym + \scriptscriptfont2=\mathsubsubsym +\textfont3=\mathext + \scriptfont3=\mathsubext + \scriptscriptfont3=\mathsubsubext +\def\rm{\fam\z@\textrm} +\def\it{\fam\itfam\textit} % \it is family 4, defined in PLAIN +\def\sl{\textsl} +\textfont\itfam=\textit +\newfam\scrfam \ifnum\scrfam=8\relax\else\error\fi % family 8, script +\textfont\scrfam=\mathscr + \scriptfont\scrfam=\mathsubscr + \scriptscriptfont\scrfam=\mathsubsubscr +\def\scr{\fam8 } +\mathcode`0="7130 +\mathcode`1="7131 +\mathcode`2="7132 +\mathcode`3="7133 +\mathcode`4="7134 +\mathcode`5="7135 +\mathcode`6="7136 +\mathcode`7="7137 +\mathcode`8="7138 +\mathcode`9="7139 +\newfam\frfam % family 9, fraktur +\textfont\frfam=\mathfr + \scriptfont\frfam=\mathsubfr + \scriptscriptfont\frfam=\mathsubsubfr +\def\frak{\fam9 } +\newfam\euexfam % family 10, substitions for euler symbols +\newfam\eqfam % family 11, cmr equal signs for Relbar (!) +\font\teneq=cmr10 \textfont\eqfam=\teneq +\font\nineeq=cmr9 +% I'm not using Relbar except in 9&10pt, so this family is very incomplete... + +\mathchardef\intop="1A52 +\mathchardef\ointop="1A48 +\mathchardef\coprod="1A60 +\mathchardef\prod="1A51 +\mathchardef\sum="1A50 +\mathchardef\braceld="A7A \mathchardef\bracerd="A7B +\mathchardef\bracelu="A7C \mathchardef\braceru="A7D +\mathchardef\infty="0A31 + +\mathchardef\nearrow="3A25 +\mathchardef\searrow="3A26 +\mathchardef\nwarrow="3A2D +\mathchardef\swarrow="3A2E +\mathchardef\Leftrightarrow="3A2C +\mathchardef\Leftarrow="3A28 +\mathchardef\Rightarrow="3A29 +\mathchardef\leftrightarrow="3A24 \mathcode`\^^W="3A24 +\mathchardef\leftarrow="3A20 \let\gets=\leftarrow \mathcode`\^^X="3A20 +\mathchardef\rightarrow="3A21 \let\to=\rightarrow \mathcode`\^^Y="3A21 +\def\uparrow{\delimiter"3A22378 } \mathcode`\^^K="3A22 +\def\downarrow{\delimiter"3A23379 } \mathcode`\^^A="3A23 +\def\updownarrow{\delimiter"3A6C33F } +\def\Uparrow{\delimiter"3A2A37E } +\def\Downarrow{\delimiter"3A2B37F } +\def\Updownarrow{\delimiter"3A6D377 } +\mathchardef\leftharpoonup="3A18 +\mathchardef\leftharpoondown="3A19 +\mathchardef\rightharpoonup="3A1A +\mathchardef\rightharpoondown="3A1B + +\textfont\euexfam=\matheuex +\scriptfont\euexfam=\mathsubsym % this is OK since I don't use all characters +% of euex in subscripts/superscripts; otherwise I'd have to make euex7 and euex6 +\scriptscriptfont\euexfam=\mathsubsym % only for \mathchoice, not really chosen +\mathcode`+="292B +\mathcode`-="292D +\mathcode`!="0921 +\mathcode`(="4928 \delcode`(="928300 +\mathcode`)="5929 \delcode`)="929301 +\mathcode`[="495B \delcode`[="95B302 +\mathcode`]="595D \delcode`]="95D303 +\mathcode`=="393D +\mathchardef\Relbar="3B3D % we need the old = to match \Arrows +\mathchardef\Gamma="7100 +\mathchardef\Delta="7101 +\mathchardef\Theta="7102 +\mathchardef\Lambda="7103 +\mathchardef\Xi="7104 +\mathchardef\Pi="7105 +\mathchardef\Sigma="7106 +\mathchardef\Upsilon="7107 +\mathchardef\Phi="7108 +\mathchardef\Psi="7109 +\mathchardef\Omega="710A +\let\varsigma=\sigma \let\varrho=\rho % Euler doesn't have these +\mathchardef\aleph="0840 +\def\rbrace{\delimiter"5867A09 } \let\}=\rbrace +\def\lbrace{\delimiter"4866A08 } \let\{=\lbrace +%\mathchardef\equiv="3811 \let\cong=\equiv % lowres bars weren't spaced right +\mathchardef\leq="3814 \let\le=\leq +\mathchardef\geq="3815 \let\ge=\geq +\mathchardef\Re="083C +\mathchardef\Im="083D +\def\vert{\delimiter"86A30C } +\def\backslash{\delimiter"86E30F } + +\setbox\strutbox=\hbox{\vrule height9pt depth4pt width\z@}% +\newbox\bigstrutbox \newbox\biggstrutbox +\setbox\bigstrutbox=\hbox{\vrule height11pt depth4pt width\z@}% +\def\bigstrut{\relax\ifmmode\copy\bigstrutbox\else\unhcopy\bigstrutbox\fi} +\setbox\biggstrutbox=\hbox{\vrule height17pt depth10pt width\z@}% +\def\biggstrut{\relax\ifmmode\copy\biggstrutbox\else\unhcopy\biggstrutbox\fi} +\rm + +\newmuskip\normalthick \normalthick=5mu plus 5mu +\newmuskip\normalmedmu \normalmedmu=\medmuskip +\newmuskip\displaythick \displaythick=10mu minus 3mu +\everymath{\thickmuskip=\normalthick} + +\abovedisplayskip=8pt plus 3pt minus 2pt % there's 2pt more (opened up) +\belowdisplayskip=10pt plus 3pt minus 2pt + +% displays not centered; all have capability of \eqalign +\outer\def\begindisplay{\obeylines\startdisplay} +{\obeylines\gdef\startdisplay#1 + {\catcode`\^^M=5$$% + \advance\displayindent\parindent\advance\displaywidth-\parindent% + \openup2pt #1\halign\bgroup\span\preamble\cr}} +\outer\def\enddisplay{\crcr\egroup$$} +\jot=\z@ % we do our own opening up + +\def\displaymath{$\thickmuskip=\displaythick\displaystyle} +\def\preamble{\hfil\displaymath{##}$&&\displaymath{{}##}$\hfil} +\def\tablepreamble{\bigstrut\hfil$##$\hfil\ &\vrule##&&\quad\hfil$##$\hfil} +\def\xbox{\qquad\hbox} % for third column of explanation + +\newcount\eqcount +\def\equ(#1.#2){{\rm({\oldsty#1}.{\oldsty#2})}} +\def\eq(#1){\equ(\chapno.#1)} +\def\thiseq{\xdef\next{(\chapno.\number\eqcount)}\expandafter\equ\next} +\def\eqno{\global\advance\eqcount 1 \global\everycr{\makeeqno\thiseq}} +\newdimen\backup +\def\makeeqno#1{\noalign{\global\everycr{}% + \advance\displaywidth\displayindent + \setbox0=\hbox to\displaywidth{\hfil#1}% + \backup=\prevdepth \advance\backup\ht0 + \setbox0=\vbox{\kern-\backup\box0}\ht0=\z@ \dp0=\z@ + \setbox0=\vbox{\box0}\unvbox0}} % that puts equation number on prev line! + +\newif\iftitle +\newskip\chaptopspace \chaptopspace=1in minus 5pt +\def\beginchapter#1 #2 \par{ % we should be at top of a page + \titletrue \eqcount=0 + \ifodd\pageno + \rightline{\chapfont#1\kern-.05em} + \vskip\chaptopspace + \rightline{\title#2} + \moveleft7pc % this applies to the \vbox after the \fi + \else % left-hand page + \leftline{\kern-.05em\chapfont#1} + \vskip\chaptopspace + \leftline{\title#2} \fi + \vbox{\hrule width 35pc} + \def\chapno{#1} \edef\chaptitle{#2} + \mark{#1\enspace #2} + \smallskip\noindent} + +\def\beginsection#1 #2 \par{ % should not be first in the chapter + \backup=\lastskip % but should come on first or second page of chapter + \mark{#1\enspace #2} % because the mark gives running head on right page + \nobreak\vskip-\backup\penalty-200 + {\subtitle\baselineskip=34pt + \noindent\hbox to2\parindent{#1\hfil}\uppercase{\kern-.05em#2}\par} + \nobreak\vskip5pt\noindent\hbox to2\parindent{}} + +\newcount\excount +\def\beginexercises{\backup=\lastskip \excount=0 + \mark{\chapno\enspace Exercises} + \nobreak\vskip-\backup\penalty-200 + {\subtitle\baselineskip=34pt\noindent Exercises\par}\nobreak} + +{\catcode`\|=\active +\gdef\table#1\tabref|#2|{\hrule height1pt width\hsize \kern2pt + \noindent\strut{\bf Table |#2|\enspace}#1\par + \hrule height.5pt width\hsize\tabref|#2|}} + +\def\medbr{\ifnum\lastpenalty>9999 \medskip \else\medbreak\fi} +\def\subhead#1\par{\medbr + {\subsubtitle\noindent#1\par}\nobreak} +\def\ex:{\par{\advance\medskipamount-1pt\medbr}% + \advance\excount 1 \item{\number\excount}} + +\def\dash---{\thinspace---\hskip.16667em\relax} +\def\qback{\kern-.15em} % between , or . and '' +\def\undertext#1{$\underline{\smash{\hbox{#1}}}$} +\def\newline{\hfil\break} +\def\Hint:{{\it Hint:\/}} +\let\macron=\= % we will use \= for congruence relation +\def\t#1{{\edef\next{\the\font}\tfont\accent"7F\next#1}} + +% Here's a definition that was corrected in plain.tex version 3.14159; +% I'm keeping the old version here, because I had already been compensating +% for its deficiencies in script and scriptscript styles; without this +% buggy version, it would be hard for me to match the old pages precisely +\def\bmod{\mskip-\medmuskip\mkern5mu + \mathbin{\rm mod}\penalty900\mkern5mu\mskip-\medmuskip} + +% Graffiti macros +\chardef\other=12 +\newread\grfi \openin\grfi=\jobname.grf +%\newwrite\grfo \immediate\openout\grfo=\jobname.grf % let's hope no conflict +%% Hmmm...; that doesn't work on Unix. +%% Here's my first solution, a kludge where I alternated between .grf and .gr +%\newif\ifgrf \newwrite\grfo \newwrite\grfempty +%\ifeof\grfi \grffalse +%\else\read\grfi to\grfitest \ifeof\grfi \grffalse \else \grftrue \fi\fi +%\ifgrf\else \openin\grfi=\jobname.gr +% \ifeof\grfi\else\read\grfi to\grfitest \fi\fi +%\immediate\openout\grfo=\jobname.gr\ifgrf\else f\fi +%\immediate\write\grfo{} % an empty line will start a nonempty file (Unix only) +%% and then at the end I said +% \immediate\openout\grfempty=\jobname.gr\ifgrf f\fi % clear the input file +%% That solution worked with the following original macros +%\def\testnextgrf{{\def\do##1{\catcode`##1=\other}\dospecials +% \global\read\grfi to\next}\expandafter\testgrf\meaning\next\testgrf} +%\expandafter\def\expandafter\testgrf\meaning\empty#1 #2\testgrf{% +% \setup#2!!!!!$\ifx\thisone\thatone\if#1R\Rtrue\else\Rfalse\fi\else\Rguess\fi} +%% Anyway, here's my second approach to Unix: (order n^2 algorithm) +\def\\{{\def\do##1{\catcode`##1=\other}\dospecials \endlinechar=-1 \let\eol=0 + \gdef\grfmem{} + \expandafter\def\expandafter\gbbl\meaning\empty{} + \def\appgrf{\read\grfi to\g + \ifx\g\empty\else\xdef\grfmem{\grfmem\expandafter\gbbl\meaning\g\eol}\fi} + \def\next{\ifeof\grfi\let\next\relax\else\appgrf\fi\next}\next}} +\\ % now \grfmem is "L aaaaa\eol R bbbbb\eol ... R zzzzz\eol". +\def\testnextgrf#1 #2\eol#3\\{\gdef\grfmem{#3}\setup#2!!!!!$% + \ifx\thisone\thatone\if#1R\Rtrue\else\Rfalse\fi\else\Rguess\fi} +\newwrite\grfo \immediate\openout\grfo=\jobname.grf % no conflict now + +\def\graffiti{% set up graffiti style + \hsize=6pc + \baselineskip=10pt \lineskip=0pt \lineskiplimit=0pt + \parindent=0pt + \mathsurround=1pt + \textfont0=\gmathtext + \scriptfont0=\gmathsubtext + \scriptscriptfont0=\gmathsubsubtext + \textfont1=\gmathlet \let\tfont=\gtfont + \scriptfont1=\gmathsublet + \scriptscriptfont1=\gmathsubsublet + \textfont2=\gmathsym + \scriptfont2=\gmathsubsym + \scriptscriptfont2=\gmathsubsubsym + \textfont3=\gmathext + \scriptfont3=\gmathsubext + \scriptscriptfont3=\gmathsubsubext +\textfont\scrfam=\gmathscr + \scriptfont\scrfam=\gmathsubscr + \scriptscriptfont\scrfam=\gmathsubsubscr +\textfont\frfam=\gmathfr + \scriptfont\frfam=\gmathsubfr + \scriptscriptfont\frfam=\gmathsubsubfr +\textfont\euexfam=\gmatheuex +\scriptfont\euexfam=\gmathsubsym % OK since I don't use all chars in this size +\textfont\eqfam=\nineeq + \def\rm{\fam\z@\gtext}% + \let\oldsty=\goldstyle + \let\big=\ninebig + \setbox\strutbox=\hbox{\vrule height7.25pt depth2.75pt width\z@}% + \gtext + \rightskip=\z@ plus2em % ragged right + \tolerance=2000 + \hyphenpenalty=300 + \exhyphenpenalty=300 + \doublehyphendemerits=100000 + \finalhyphendemerits=\doublehyphendemerits + } +\def\ninebig#1{{\hbox{$\textfont0=\tenrm\textfont2=\tensy + \left#1\vbox to7.25pt{}\right.\n@space$}}} +\def\grafctr{\hbox to4.5pc{\hfil##\hfil}} + +\newif\ifR % does this entry go on a right-hand page? +\def\Rguess{\def\ifR{\ifodd\pageno}} +\long\def\g#1\g{\def\next{#1!!!!!}\expandafter\writegrf\meaning\next$% + \ifx\grfmem\empty\Rguess\else\expandafter\testnextgrf\grfmem\\\fi +% pre-Unix, that line was \ifeof\grfi\Rguess\else\testnextgrf\fi + \setbox0=\vtop{\graffiti#1% + \write\m@ne\ifR{\Rcheck}\else{\Lcheck}\fi}% log file records successes + \ifvmode\kern-\prevdepth\kern-\ht0\dp0=\z@\nointerlineskip\bgroup + \else\dp0=\dp\strutbox\strut\vadjust{\kern-\dp\strutbox\kern-\ht0\fi + \ifR\moveleft7\else\moveright29\fi pc\box0}} +\expandafter\def\expandafter\writegrf\meaning\empty#1#2#3#4#5#6${% + \write\grfo{\LorR #1#2#3#4#5}\def\thisone{#1#2#3#4#5}} +\def\setup#1#2#3#4#5#6${\def\thatone{#1#2#3#4#5}} +\def\LorR{\ifodd\pageno R \else L \fi} +\def\Lcheck{\ifodd\pageno Bad guess!\fi} +\def\Rcheck{\ifodd\pageno\else Bad guess!\fi} + +% Page layout +\newif\ifpreprint \preprinttrue % should be false when making the final copy +\newdimen\pageheight \pageheight=\vsize +\newdimen\totheight \totheight=49.5pc +\newdimen\folioht \setbox0=\hbox{\foliofont0} \folioht=\ht0 +\def\leftheadline{\hbox to35pc{\vbox to 10pt{}% strut to position the baseline + \llap{\kern-2pc\iftitle\leftcorner\else\foliofont\folio\fi\hfil}% + \iftitle\hfil\copyrite\else\runhead\uppercase\expandafter{\chaptitle}\hfil\fi}} +\def\rightheadline{\hbox to35pc{\iftitle\copyrite\fi\hfil + \vbox to 10pt{}% strut to position the baseline + \runhead\uppercase\expandafter{\topmark}% + \rlap{\hfil\iftitle\rightcorner\else\foliofont\folio\fi\kern-2pc}}} +\def\leftcorner{\vrule\vbox to\folioht{\hrule width9pt\vfil}} +\def\rightcorner{\vbox to\folioht{\hrule width9pt\vfil}\vrule} +\def\copyrite{\ifpreprint{\textfont2=\sevensy\sevenrm\copyright\ 1988 + Addison-Wesley Publishing Company; all rights reserved}\fi} + +\def\onepageout#1{\escapechar=-1 % for writing \tabrefs + \shipout\vbox to\totheight{ % here we define one page of output + \offinterlineskip % butt the boxes together + \vbox to 2pc{ % this part goes on top of the regular pages + \ifodd\pageno \rightheadline\else\leftheadline\fi + \vfill} % this completes the \vbox to 2pc + \ifodd\pageno\moveright7pc\fi #1 + \vfill + \iftitle \global\titlefalse % reset the titlepage switch + \ifodd\pageno \hbox to35pc{\hfil\foliofont\folio} + \else\hbox{\foliofont\folio}\fi\fi + \ifpreprint\ifinxmode\makeinxfooter\fi\fi + } + \advancepageno} + +\output{\onepageout{\pagebody}} + +\newbox\inxfootbanner +\def\hours{\count0=\time \divide\count0 by60 % find the o'clock + \multiply\count0 by40 \advance\count0\time % convert to hhmm + \advance\count0 10000 \expandafter\gobbleone\number\count0\relax} +\def\gobbleone1{} +\setbox\inxfootbanner=\rlap{\hbox to 6.5in{\hrulefill\sevenrm\quad + Author's page proof produced by \TeX\ at + \hours\space on \ifcase\month\or + January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or December\fi + \space\number\day}} +\def\makeinxfooter{\vbox to0pt{\kern10pt\copy\inxfootbanner\kern4pt + \rlap{\vbadness=\maxdimen \inxcolumns}\vss}} +\def\inxcolumns{\ifvoid\inxbox\let\next\relax\else\let\next\contribcol\fi\next} +\def\contribcol{\setbox0=\vsplit\inxbox to54pt + \vtop{\unvbox0}\kern20pt \inxcolumns} +\def\inxstyle{\vrule height6pt depth2pt width\z@ \sevenrm} +\splittopskip=6pt + +% Cross references + +% \ref{value}|name| gives value to |name| +% \eqref|name| gives \eqcount to |name| +% \exref|name| gives \excount to |name| +% \tabref|name| gives appropriate page number to |name| +% \refin foo inputs references from job foo (other than this job) +% \showmissestrue if you want to see missing references + +\newif\ifshowmisses +\def\vertical{|} +\def\inref#1 #{\expandafter\def\csname\vertical#1\endcsname} + +\catcode`\|=\active +\expandafter\def\expandafter\dospecials\expandafter{\dospecials\do\|} +\newcount\defcount % number of old definitions not yet repeated +\newcount\changecount % number of new definitions that are changed +\newcount\miscount % number of unknown references + +\newread\tempin +\def\refin#1 {\openin\tempin=#1.ref + \ifeof\tempin\closein\tempin + \else\closein\tempin \let|\inref \input#1.ref \let|\crossref \fi} + +{\let\|=\jobname + \def\def{\global\advance\defcount1 \gdef}\expandafter\refin\| } +\newwrite\refo \immediate\openout\refo=\jobname.ref + +\def\ref#1|#2|{\xdef\temp{#1}\expandafter\dordef\csname\vertical#2\endcsname} +\def\dordef#1{\ifx#1\temp \global\advance\defcount-1 + \else\global\advance\changecount1 \global\let#1\temp\fi + {\escapechar=-1\immediate\write\refo{\noexpand#1{\temp}}}} +\def\eqref{\ref{\number\eqcount}} +\def\exref{\ref{\number\excount}} +\def\tabref|#1|{\expandafter\pageref\csname\vertical#1\endcsname} +\def\pageref#1{\ifx#1\relax\else\global\advance\defcount-1 \fi + \write\refo{\noexpand#1{\number\pageno}}% + \write\m@ne{\ifx#1\relax New Pageref!\else + \ifnum#1=\pageno\else Changed Pageref!\fi\fi}} +\def\crossref#1|{\expandafter\usedef\csname\vertical#1\endcsname} +\def\usedef#1{\ifx#1\relax + \ifshowmisses\showmiss#1\fi\global\advance\miscount1 ??\else #1\fi} +\let|=\crossref +\def\showmiss#1{{\escapechar=-1% + \message{***** WARNING: Undefined reference #1\string|! *****}}} + +\def\cite#1.{\ifinxmode\write\bnx{[#1] \number\pageno.}\fi#1} +{\catcode`\@=\active +\gdef\newcite#1.{\ifinxmode\write\bnx{[#1'] \number\pageno.}\fi#1$'@$}} + +\outer\def\bye{ + \ifnum\miscount>0 + \message{(\the\miscount\space undefined references were present)}\fi + \ifnum\changecount>0 + \message{(\the\changecount\space new references written on \jobname.ref)}\fi + \ifnum\defcount>0 + \message{(\the\defcount\space old references dropped from \jobname.ref)}\fi + \par\vfill\supereject + \end} + +% Exercises + +\newwrite\ans +\immediate\openout\ans=\jobname.ans + +\outer\def\answer{\par + \immediate\write\ans{} + \immediate\write\ans{\string\ansno\chapno.\the\excount:} + \copytoblankline} +\def\copytoblankline{\begingroup\setupcopy\copyans} +\def\setupcopy{\def\do##1{\catcode`##1=\other}\dospecials \obeylines} +{\obeylines \gdef\copyans#1 + {\def\next{#1}% + \ifx\next\empty\let\next=\endgroup % + \else\immediate\write\ans{\next} \let\next=\copyans\fi\next}} + +\def\ansno#1:{\par\medbreak\def\thisansno{\source#1}% + \noindent\hbox to\parindent{\bf #1\hfil}\ignorespaces} + +% Pictures (a subset of \LaTeX's conventions) +\newskip\hsssglue \hsssglue=0pt plus 1fill minus 1fill \def\hsss{\hskip\hsssglue} + +\newdimen\unitlength \newdimen\linethickness +\newdimen\@picheight \newdimen\@xdim \newdimen\@ydim \newdimen\@len \newdimen\@save +\newcount\@multicount \newcount\@xarg \newcount\@yarg +\newbox\@picbox \newbox\@mpbox + +\font\tenln=line10 \font\tenlnw=linew10 +\font\tencirc=lcircle10 \font\tencircw=lcirclew10 +\font\smallln=linew10 scaled 483 % that's magstep-4 + +\def\thinlines{\let\linefont=\tenln \let\circlefont=\tencirc + \linethickness=\fontdimen8\linefont} +\def\thicklines{\let\linefont=\tenlnw \let\circlefont=\tencircw + \linethickness=\fontdimen8\linefont} +\thinlines + +\def\beginpicture(#1,#2)(#3,#4){\@picheight=#2\unitlength \let\line=\@line + \setbox\@picbox=\hbox to#1\unitlength\bgroup + \kern-#3\unitlength \lower#4\unitlength\hbox\bgroup\ignorespaces} +\def\endpicture{\egroup\hss\egroup + \ht\@picbox=\@picheight \dp\@picbox=\z@ + \leavevmode\box\@picbox} + +\def\put(#1,#2)#3{\raise#2\unitlength\rlap{\kern#1\unitlength #3}\ignorespaces} + +\def\multiput(#1,#2)(#3,#4)#5#6{\@multicount=#5 + \@xdim=#1\unitlength \@ydim=#2\unitlength \setbox\@mpbox=\hbox{#6}% + \loop\ifnum\@multicount>0 + \raise\@ydim\rlap{\kern\@xdim \unhcopy\@mpbox}% + \advance\@xdim#3\unitlength \advance\@ydim#4\unitlength + \advance\@multicount\m@ne \repeat\ignorespaces} + +\def\makebox(#1,#2)#3{\setbox\@picbox=\hbox to#1\unitlength{\hss#3\hss}% + \@ydim=\ht\@picbox \advance\@ydim-\dp\@picbox + \ht\@picbox=#2\unitlength \dp\@picbox=\z@ + \leavevmode\lower.5\@ydim\box\@picbox} + +\newif\ifneg +\def\@line(#1,#2)#3{\@xarg=#1 \@yarg=#2 \@len=#3\unitlength \leavevmode + \ifnum\@xarg<0 \reverseline \else \negfalse \@ydim=\z@\fi + \ifnum\@xarg=0 \@vline + \else\ifnum\@yarg=0 \@hline \else\@sline\fi\fi + \ifneg\kern-\@len\else\@save=\@ydim\fi} +\def\reverseline{\negtrue \kern-\@len \@xarg=-\@xarg + \@ydim=\@len \multiply\@ydim\@yarg \divide\@ydim\@xarg \@yarg=-\@yarg} + +\def\@hline{\vrule height.5\linethickness depth.5\linethickness width\@len} +\def\@vline{\kern-.5\linethickness\vrule width\linethickness + \ifnum\@yarg<0 height\z@ depth\else depth\z@ height\fi\@len + \kern-.5\linethickness} + +\def\@sline{\setbox\@picbox=\hbox{\linefont \count@=\@xarg \multiply\count@ 8 + \ifnum\@yarg>0 \advance\count@\@yarg \advance\count@-9 + \else \advance\count@-\@yarg \advance\count@ 55 \fi \char\count@}% + \ifnum\@yarg<0 \@picheight=-\ht\@picbox \advance\@ydim\@picheight + \else \@picheight=\ht\@picbox \fi + \@xdim=\wd\@picbox \@save=\@ydim + \loop\ifdim\@xdim<\@len \raise\@ydim\copy\@picbox + \advance\@xdim\wd\@picbox \advance\@ydim\@picheight \repeat + \advance\@xdim-\@len \kern-\@xdim + \multiply\@xdim\@yarg \divide\@xdim\@xarg \advance\@ydim-\@xdim + \raise\@ydim\box\@picbox} + +\def\vector(#1,#2)#3{\@line(#1,#2){#3}% + \ifnum\@xarg=0 \@vvector \else\ifnum\@yarg=0 \@hvector \else\@svector\fi\fi} +\def\@hvector{\ifneg\rlap{\linefont\char27}\else + \smash{\llap{\linefont\char45}}\fi} % we have to smash because of font bug +\def\@vvector{\ifnum\@yarg<0 \raise-\@len\rlap{\linefont\char63}% + \else\setbox\@picbox=\rlap{\linefont\char54}\advance\@len-\ht\@picbox + \raise\@len\box\@picbox\fi} + +\def\@svector{\setbox\@picbox=\hbox to\z@{\linefont + \ifnum\@yarg<0 \count@=55 \@yarg=-\@yarg \else\count@=-9 \fi + \ifneg\multiply\@xarg16 \multiply\@yarg2 + \else\hss % \llap + \ifnum\@xarg>2 \multiply\@xarg9 \multiply\@yarg2 \advance\count@29 + \else\ifnum\@yarg>2 \multiply\@xarg16 \multiply\@yarg9 \advance\count@-20 + \else\multiply\@xarg24 \multiply\@yarg3 \fi\fi\fi + \advance\count@\@xarg \advance\count@\@yarg \char\count@ + \ifneg\hss\fi}% \rlap + \raise\@save\box\@picbox} + +\def\disk#1{\@len=#1\unitlength \count@='160 \@diskcirc} +\def\circle#1{\@len=#1\unitlength \count@='140 \@diskcirc} +\def\@diskcirc{\setbox\@picbox=\hbox{\circlefont\char\count@}\@xdim=\wd\@picbox + \leavevmode \ifdim\@len>15.499\@xdim \@bigdc \else \@smalldc\fi} +\def\@bigdc{\ifnum\count@<'160 \@bigcirc + \else \@len=15\@xdim \@diskcirc\fi} +\def\@smalldc{{\advance\@len-.5\@xdim + \loop\ifdim\@xdim<\@len \advance\count@\@ne \advance\@xdim\wd\@picbox\repeat + \hbox{\circlefont\char\count@}}} +\def\@bigcirc{{\circlefont\count@=15 + \setbox\@picbox=\hbox{\char\count@}\@xdim=\wd\@picbox + \ifdim\@len>2.5\@xdim \@len=2.5\@xdim\fi + \advance\@len-.125\wd\@picbox + \loop\ifdim\@xdim<\@len \advance\count@ 4 \advance\@xdim.25\wd\@picbox\repeat + \@ydim=.5\@xdim \advance\@ydim.5\linethickness + \setbox\@picbox=\vbox{\hbox{\char\count@\advance\count@-3\char\count@}% + \nointerlineskip + \hbox{\advance\count@\m@ne\char\count@\advance\count@\m@ne\char\count@}}% + \kern-\@ydim\lower\@ydim\box\@picbox}} + +\newif\ifovaltl \newif\ifovaltr \newif\ifovalbl \newif\ifovalbr +\ovaltltrue \ovaltrtrue \ovalbltrue \ovalbrtrue +\def\oval(#1,#2){\@xdim=#1\unitlength \@ydim=#2\unitlength + {\circlefont \setbox\@picbox=\hbox{\char0} + \ifdim\@xdim<\wd\@picbox \@xdim=\wd\@picbox\fi + \ifdim\@ydim<\wd\@picbox \@ydim=\wd\@picbox\fi + \@save=\@xdim \ifdim\@ydim<\@save \@save=\@ydim \fi + \count@=39 + \loop \setbox\@picbox=\hbox{\char\count@}\ifdim\@save<\wd\@picbox + \advance\count@-4 \repeat + \setbox\strutbox=\hbox{\vrule height\ht\@picbox depth\dp\@picbox width\z@ + \kern\wd\@picbox}% + \@save=.5\wd\@picbox \advance\@save-.5\linethickness + \setbox0=\hbox to\@xdim{\ifovaltl\char\count@\else\strut\fi + \kern-\@save\leaders\hrule height\ifovaltl\linethickness\else\z@\fi\hfil + \leaders\hrule height\ifovaltr\linethickness\else\z@\fi\hfil\kern\@save + \ifovaltr\advance\count@-3\char\count@\else\strut\fi\kern-\wd\@picbox}% + \advance\count@\m@ne + \setbox2=\hbox to\@xdim{\ifovalbl\char\count@\else\strut\fi + \kern-\@save\leaders\hrule height\ifovalbl\linethickness\else\z@\fi\hfil + \leaders\hrule height\ifovalbr\linethickness\else\z@\fi\hfil\kern\@save + \ifovalbr\advance\count@\m@ne\char\count@\else\strut\fi\kern-\wd\@picbox}% + \@save=\@ydim \advance\@save-\wd\@picbox \divide\@save 2 + \setbox\@picbox=\vbox{\box0\nointerlineskip + \hbox to\@xdim{\vrule height\@save width\ifovaltl\linethickness\else\z@\fi + \hfil\ifovaltr\vrule width\linethickness\kern-\linethickness\fi}% + \nointerlineskip + \hbox to\@xdim{\vrule height\@save width\ifovalbl\linethickness\else\z@\fi + \hfil\ifovalbr\vrule width\linethickness\kern-\linethickness\fi}% + \nointerlineskip\box2}% + \@save=.5\@ydim \advance\@save.5\linethickness \leavevmode + \kern-.5\@xdim \kern-.5\linethickness \lower\@save\box\@picbox}} + +\def\cpic#1\endcpic{\vcenter{\hbox{\beginpicture#1\endpicture}}} + +% Squines (quadratic splines) +% example of use: to plot f(x) between x0 and x1, you can say +% \put(0,0){\squine(x0,xm,x1,y0,ym,y1)}, where y0=f(x0), y1=f(x1) +% xm=(y0-y1+s1x1-s0x0)/(s1-s0), ym=(s0(s1x1-y1)-s1(s0x0-y0))/(s1-s0), +% s0=f'(x0), and s1=f'(x1). + +\newdimen\@xi \newdimen\@xii \newdimen\@xiii \newdimen\@xiv +\newdimen\@xpt \newdimen\@xoldpt +\newdimen\@yi \newdimen\@yii \newdimen\@yiii \newdimen\@yiv +\newdimen\@ypt \newdimen\@yoldpt +\def\squine(#1,#2,#3,#4,#5,#6){\setbox\@picbox\hbox{\tencirc q}% + \global\@xoldpt=#1\unitlength \global\@yoldpt=#4\unitlength \kern\@xoldpt + \@xi=\@xoldpt \@xii=#2\unitlength \@xiii=#3\unitlength + \@yi=\@yoldpt \@yii=#5\unitlength \@yiii=#6\unitlength + \squinerec + \@xpt=#3\unitlength \@ypt=#6\unitlength \@addpoint + \raise\@ypt\copy\@picbox} +\newif\iffar +\def\squinerec{\farfalse \testnear\@xi\@xiii \testnear\@yi\@yiii + \iffar \decast \fi} +\def\testnear#1#2{\@save=#1\advance\@save-#2% + \ifdim\@save<\z@ \@save=-\@save\fi \ifdim\@save>\p@ \fartrue \fi} +\def\decast{\@xpt=\@xi \advance\@xpt\@xii \divide\@xpt2 + \advance\@xii\@xiii \divide\@xii2 + \@xiv=\@xpt \advance\@xiv\@xii \divide\@xiv2 + \@ypt=\@yi \advance\@ypt\@yii \divide\@ypt2 + \advance\@yii\@yiii \divide\@yii2 + \@yiv=\@ypt \advance\@yiv\@yii \divide\@yiv2 + \begingroup\@xii=\@xpt \@xiii=\@xiv + \@yii=\@ypt \@yiii=\@yiv \squinerec\endgroup + \@xpt=\@xiv \@ypt=\@yiv \@addpoint + \@xi=\@xiv \@yi=\@yiv \squinerec} +\def\@addpoint{%\message{(\the\@xpt,\the\@ypt)}% + \global\advance\@xoldpt-\@xpt \wd\@picbox=-\@xoldpt + \raise\@yoldpt\copy\@picbox \global\@xoldpt=\@xpt \global\@yoldpt=\@ypt} + +% Math operators +\def\2{\mskip-.5mu2\mskip.5mu} +\newmuskip\lessfortimes \lessfortimes=-2mu minus -2mu +\def\cdt{\mskip\lessfortimes\cdot\mskip\lessfortimes} +\def\nullnum{\phantom{0}} +\def\twonullnum{\phantom{00}} +\def\bex{\mskip-2mu} +\def\twoconditions#1#2{_{\scriptstyle#1\atop\scriptstyle#2}} +\def\tworestrictions#1#2{\vcenter{\offinterlineskip + \halign{\strut\hfil##\hfil\cr#1\cr#2\cr}}} +\def\dts{\mathinner{\ldotp\ldotp}} +\def\[#1]{[\hbox{$\mskip1mu\thickmuskip=\thinmuskip#1\mskip1mu$}]} +\def\bigi[#1\bigr]{\bigl[\hbox{$\thickmuskip=\thinmuskip#1$}\bigr]} +\def\Bigi[#1\Bigr]{\Bigl[\hbox{$\thickmuskip=\thinmuskip#1$}\Bigr]} +\def\prp(#1){(\hbox{$\thickmuskip=\thinmuskip#1$})} +\def\pbigi(#1\bigr){\bigl(\hbox{$\thickmuskip=\thinmuskip#1$}\bigr)} +\def\_#1{\def\next{#1}% + \ifx\next\risingsign\expandafter\rising\else^{\underline{#1}}\fi} +\def\risingsign{^} +\def\rising#1{^{\overline{#1}}} +\def\dotminus{\mathbin{\buildrel{\hbox{\runhead.}}\over{\smash{-}\vphantom{_2}}}} +\let\divides=\backslash +\def\edivides{\divides\mskip-4mu\divides} +\def\ndivides{\mathpalette\notdiv\relax} +\def\notdiv#1#2{\setbox0=\hbox{$#1\divides$}% + \vcenter{\hbox to\wd0{$\hss\scriptscriptstyle/\hss$}}\kern-\wd0 + \vcenter{\hbox to\wd0{$\hss\kern.5pt\scriptscriptstyle/\hss$}}\kern-\wd0 + \box0\relax} +\def\spec{\mathop{\rm Spec}} +\def\half{{1\over2}} +\def\rp{\mathchar"323F } % relatively prime +\def\lcm{\mathop{\rm lcm}} +\def\And{\quad{\rm and}\quad} +\let\==\equiv +\def\tmod#1{(mod~$#1$)} +\let\implies=\Longrightarrow +\def\?{\hbox{!`}} % subfactorial +\def\hyp{\mathop{F{}}\nolimits\hyper} +\def\tightplus{\medmuskip=1.5mu\relax} +\def\hyper#1#2#3{\mathchoice{\tightplus + \hbox{$\displaystyle\biggl({#1\atop#2}\Big\vert\,{#3}\!\biggr)$}}% + {\bigl({#1\atop#2}\vert\mskip2mu#3\bigr)}% + {}{}} % used only in D and T styles +%\def\hypk_#1{\mathop{F{}}_{#1}\nolimits\hyper} % confl with mFn convention +\def\hypk_#1#2#3#4{\mathop{F{}}\mathchoice{\tightplus + \hbox{$\displaystyle\biggl({#2\atop#3}\Big\vert\,{#4}\!\biggr)$}% + \lower\fontdimen11\mathsym\hbox{$\scriptstyle\!#1$}}% + {\bigl({#2\atop#3}\vert\mskip2mu#4\bigr)\lower\fontdimen12\mathsym + \hbox{$\scriptstyle\!#1$}}% + {}{}} % used only in D and T styles +\def\double(#1\choose#2){\mathchoice{\biggl(\!\!{#1\choose#2}\!\!\biggr)} + {\bigl(\!{#1\choose#2}\!\bigr)}{}{}} % only D and T styles +\def\hypstrut{\vphantom{_1\_^k}} % if there's another denominator with \_^k +\def\deg{\mathop{\rm deg}} +\def\Bscr{{\scr B}} +\def\Escr{{\scr E}} +\def\Fscr{{\scr F}} +\def\Pscr{{\scr P}} +\def\Sscr{{\scr S}} +\def\adj{\relbar\joinrel\relbar} % adjacent in a graph +\let\<=\langle \let \>=\rangle +\def\Pr{\mathop{\rm Pr}\nolimits} +\def\Mean{\mathop{\rm Mean}\nolimits} +\def\Var{\mathop{\rm Var}\nolimits} +\def\between{\big\vert\hbox{\vphantom)}} % \between_a^b +{\catcode`\'=\active \gdef'{^\bgroup\mskip2mu\prim@s}} % more space before ' +\def\array#1[#2]{\hbox{\tt#1[$#2$]}} +\def\given{\mskip1mu\vert\mskip1mu} +\def\euler{\atopwithdelims<>} +\def\Euler#1#2{\mathchoice{\biggl<\mskip-7mu{#1\euler#2}\mskip-7mu\biggr>}% + {\bigl<\!{#1\euler#2}\!\bigr>}{}{}} + +\newbox\phihatbox \newbox\scrphihatbox +\setbox\phihatbox=\hbox{$\phi$} \ht\phihatbox=1ex +\setbox\scrphihatbox=\hbox{$\scriptstyle\phi$} + \ht\scrphihatbox=\fontdimen5\mathsublet +\setbox\phihatbox=\hbox{$\widehat{\box\phihatbox}$} +\setbox\scrphihatbox=\hbox{$\hat{\box\scrphihatbox}$} +\def\phihat{\mathchoice{\copy\phihatbox}{\copy\phihatbox}% + {\copy\scrphihatbox}{{\hat\phi}}} + +\newbox\mathsizebox +\def\setmathsize#1{\global\setbox\mathsizebox=\hbox{\displaymath#1$}} +\def\mathsize#1{\hbox to\wd\mathsizebox{\displaymath#1$\hss}} + +\newbox\sqrtstrutbox +\setbox\sqrtstrutbox=\hbox{\vrule height10.5pt width\z@} +\def\strutsqrt#1{\copy\sqrtstrutbox\sqrt{{}^{\mathstrut}#1}} + +\newbox\Sqbox % for sum of squares +\setbox\Sqbox=\vbox{\tenrm\hrule height.6pt\kern-.6pt + \hbox to1.5ex{\vrule height1.5ex width.6pt\hss\vrule width.6pt}\kern-.6pt + \hrule height.3pt depth.3pt} +\def\Sq{\mskip1.5mu\copy\Sqbox\mskip1.5mu} + +% primitive index macros +% "stuff for index" will go into a file for sorting and into normal text +% "!stuff for index" will go into the file only +\expandafter\def\expandafter\dospecials\expandafter{\dospecials\do\"} +\def\hexcode{"} \catcode`\"=\active + +\newif\ifinxmode +\newwrite\inx \newwrite\bnx +\newbox\inxbox + +\newif\ifsilent +\def\beginxref{\futurelet\next\beginxrefswitch} +\def\beginxrefswitch{\ifx\next!\let\next=\silentxref + \else\silentfalse\let\next=\xref\fi \next} +\def\silentxref!{\silenttrue\xref} +\let"=\beginxref + +\def\xref#1"{\ifinxmode\edef\text{#1}\makexref\fi + \ifsilent\ignorespaces\else#1\fi} +\def\makexref{\global\setbox\inxbox=% + \vbox{\unvbox\inxbox\allowbreak\hbox{\inxstyle\text}}% + \xdef\writeit{\write\inx{\text\space!\space + \noexpand\number\pageno.}}\writeit} + +% Final considerations +\catcode`\@=\active \def@{\mskip1mu\relax} +\expandafter\def\expandafter\dospecials\expandafter{\dospecials\do\@} + +\hyphenation{logical Mac-Mahon hyper-geo-metric hyper-geo-met-rics Ber-noulli} + +\preprintfalse % WE ARE MAKING THE REAL BOOK! +\inxmodetrue % WE ARE PREPARING A ROUGH INDEX +\showmissestrue % THE REFERENCES SHOULD ALL BE READY NOW + +\ifinxmode\immediate\openout\inx=\jobname.inx \fi % file for index reminders +\ifinxmode\immediate\openout\bnx=\jobname.bnx \fi % file for bib reminders + +% To make the book: +% First TeX BIB, to get BIB.REF correct. (Must have \cite entries.) +% Then TeX CHAP1..CHAP9, PREF, ANS, CRED, FRONT, CONT. +% Then make BNX file from individual *.BNX files including BIB.BNX. +% Then reTeX BIB. +% *.INX files are raw data only. Index and Contents are prepared by hand. + +% To produce only a subset of pages, put the page numbers on separate +% lines in a file called pages.tex, ended by 999 +% WARNING: This will screw up the .grf file! Save it, then restore it. +% WARNING: This may screw up the .ref file (if there are \tabrefs). Ditto. +\let\Shipout=\shipout +\newread\pages \newcount\nxtpg \openin\pages=pages +\def\getnxtpg{\ifeof\pages\else + {\endlinechar=-1\read\pages to\next + \ifx\next\empty % in this case we should have eof now + \else\global\nxtpg=\next\fi}\fi} +\ifeof\pages\else\message{OK, I'll ship only the requested pages!} + \getnxtpg\fi +\def\shipout{\ifeof\pages\let\next=\Shipout + \else\ifnum\pageno=\nxtpg\getnxtpg\let\next=\Shipout + \else\let\next=\Tosspage\fi\fi \next} +\newbox\garbage \def\Tosspage{\deadcycles=0\setbox\garbage=} diff --git a/macros/plain/contrib/misc/headlinerule.tex b/macros/plain/contrib/misc/headlinerule.tex new file mode 100644 index 0000000000..6e2fc1d029 --- /dev/null +++ b/macros/plain/contrib/misc/headlinerule.tex @@ -0,0 +1,8 @@ +%%%---Cut Here------------------------------------------------------------- +\def\makeheadline{\vbox to0pt{\vskip-22.6pt + \line{\vbox to8.5pt{}\vphantom{pqj}\the\headline} + \vskip1pt + \hrule + \vss} + \nointerlineskip} +%%%---Cut Here------------------------------------------------------------- diff --git a/macros/plain/contrib/misc/label.tex b/macros/plain/contrib/misc/label.tex new file mode 100644 index 0000000000..7e21962e0a --- /dev/null +++ b/macros/plain/contrib/misc/label.tex @@ -0,0 +1,137 @@ +% +% Either: +% \address 3 +% +% then enter three addresses, blank lines between them, or +% +% \faddress foo.tex +% +% where foo.tex contains a bunch of labels, with blank lines between them. +% +% Make sure to use \done to exit, rather than \bye. +% +\hsize=8.25truein\hoffset=-0.875truein +\vsize=11truein\voffset=-1.0truein +\nopagenumbers\raggedbottom\offinterlineskip +% +\newdimen\vlsize\newdimen\hlsize +\vlsize=1.56truein +\hlsize=2.75truein +% +\font\huge=cmbx12 scaled\magstep 4 +\font\notsohuge=cmbx10 scaled\magstep3 +\font\bigtt=cmtt10 scaled 1200 +\font\lbls=cmbx10 scaled\magstephalf +\font\hugelogo=logobf10 scaled\magstep 5 +\def\hugeMF{{\hugelogo METAFONT}} +% +\def\prompt{\immediate\write0{\noexpand\address\noexpand\faddress\noexpand\done} + \immediate\write0{<\number\labcount> Total Labels}} +% +\newcount\n +\def\dotimes #1 #2{\n=#1 + \loop + #2 + \advance\n by -1 + \ifnum\n>0\repeat} +% +\let\LMR=L +\newbox\leftbox +\newbox\midbox +\newcount\labcount +\labcount=0 +\def\ship#1{\if L\LMR + \global\setbox\leftbox=#1 \global\let\LMR=M + \else\if M\LMR + \global\setbox\midbox=#1 \global\let\LMR=R + \else + \line{\box\leftbox\hss\box\midbox\hss #1} \global\let\LMR=L + \fi\fi + \global\advance\labcount by1} +% +\def\emptybox{\vbox to \vlsize{\hsize=\hlsize\vfill\centerline{\strut}}} +\def\done{\if M\LMR \ship\emptybox\ship\emptybox + \else\if R\LMR \ship\emptybox + \fi\fi\vfill\eject\end} +% +\def\oninterlineskip{\baselineskip=12pt\lineskip=1pt\lineskiplimit=0pt} +% +\newif\ifok +\def\blankline{\par} +\newif\ifcont +% +\newdimen\maxadsize +\maxadsize=2.6truein +\newbox\addbox +\def\makeadd{\vbox{\oninterlineskip + \loop + \read0 to\add + \ifx\add\blankline + \global\contfalse + \else + \global\conttrue + \fi + \ifcont + \setbox\addbox=\hbox{\add} + \ifdim\maxadsize<\wd\addbox + \message{Line too wide!} + \else + \box\addbox + \fi + \repeat}} +% +\def\address #1 {\dotimes #1 + {\ship{\vbox to \vlsize{\hsize=\hlsize + \oninterlineskip + \lbls + \vss\hbox to\hlsize{\hss + \makeadd + \hss}\vss}}} + \prompt} +% +\newread\filein +\def\fakeadd{\vbox{\oninterlineskip + \loop + \read\filein to\add + \ifx\add\blankline + \global\contfalse + \else + \global\conttrue + \fi + \ifcont + \setbox\addbox=\hbox{\add} + \ifdim\maxadsize<\wd\addbox + \message{\add: } + \message{Line too wide!} + \else + \box\addbox + \fi + \repeat}} +% +\newif\ifstillokay +\def\dofadds{ + \loop + \ship{\vbox to \vlsize{\hsize=\hlsize + \oninterlineskip + \lbls + \vss\hbox to\hlsize{\hss\fakeadd\hss} + \vss}} + \ifeof\filein + \stillokayfalse + \else + \stillokaytrue + \fi + \ifstillokay + \repeat + \closein\filein} +% +\def\faddress #1 { + \openin\filein=#1 + \ifeof\filein + \message{#1: File not found} + \else + \dofadds + \fi + \prompt} +% +\prompt diff --git a/macros/plain/contrib/misc/labeldefs.tex b/macros/plain/contrib/misc/labeldefs.tex new file mode 120000 index 0000000000..53776e5522 --- /dev/null +++ b/macros/plain/contrib/misc/labeldefs.tex @@ -0,0 +1 @@ +threecol.tex
\ No newline at end of file diff --git a/macros/plain/contrib/misc/labelmac3.tex b/macros/plain/contrib/misc/labelmac3.tex new file mode 100644 index 0000000000..17c68a7a42 --- /dev/null +++ b/macros/plain/contrib/misc/labelmac3.tex @@ -0,0 +1,59 @@ +%% Save file as: LABELMAC3.TEX Source: FILESERV@SHSU.BITNET +%% Posted by bharat@herodotus.cs.uiuc.edu (R. Bharat Rao) +%% to comp.text.tex on 11 Oct 91 03:16:48 GMT +%% THIS IS A PLAIN TeX FILE +%% To use ... +%% +%% \input labelmac3 +%% \address{ +%% address 1 +%% +%% } +%% .... (repeat 29 more times) + +% This is set up to use Avery 5160 labels for laser printers. +% The label size is 1 inch by 2 and five eights inches. +\newif\ifcentyorn +\centyorntrue +\newdimen\fullhsize +\fullhsize=8.20in \hsize=2.625in +\vsize=11.0in +\def\fullline{\hbox to\fullhsize} +\hoffset=-.68in +\voffset=-.365in +\let\lr=L \newbox\leftcolumn \newbox\midcolumn +\output{\if L\lr + \global\setbox\leftcolumn=\columnbox \global\let\lr=M + \else\if M\lr + \global\setbox\midcolumn=\columnbox \global\let\lr=R + \else \tripleformat \global\let\lr=L\fi\fi + \ifnum\outputpenalty>-20000 \else\dosupereject\fi} +\def\tripleformat{\shipout\vbox{\makeheadline + \fullline{\box\leftcolumn\hfil\box\midcolumn\hfil\columnbox} + \makefootline} + \advancepageno} +\def\columnbox{\leftline{\pagebody}} +\def\makeheadline{\vbox to 0pt{\vskip-22.5pt + \fullline{\vbox to8.5pt{}\the\headline}\vss}\nointerlineskip} +\def\makefootline{\baselineskip=24pt \fullline{\the\footline}} + +\def\endoflabels{\supereject + \if L\lr \else\null\vfill\eject\fi + \if L\lr \else\null\vfill\eject\fi + \end} +\obeylines\gdef\address#1{\setbox0\vbox{#1} + \vbox to 71.90pt{\ifcentyorn\vss\fi \box0 \vss}} + +%\obeylines\gdef\address#1{\setbox0\vbox{#1} \vbox to 71.90pt{ \box0 \vss}} + +%\font\labelfont=cmbx7 +%\font\labelfont=cmtt8 +\font\labelfont=cmss9 +\parindent=0pt +\raggedright +\raggedbottom +%\nopagenumbers +\interlinepenalty=1000 +\labelfont +% + diff --git a/macros/plain/contrib/misc/letter.tex b/macros/plain/contrib/misc/letter.tex new file mode 100644 index 0000000000..531a8b520d --- /dev/null +++ b/macros/plain/contrib/misc/letter.tex @@ -0,0 +1,119 @@ +% This macro file is for business letters + +\def\today{\ifcase\month\or + January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or December\fi + \space\number\day, \number\year} +\def\narrower{\advance\leftskip by 20pt \advance\rightskip by 20pt } + +\raggedbottom +\interlinepenalty=1000 +\hsize=6.25truein \voffset=24pt \advance\vsize by-\voffset +\parindent=0pt \parskip=0pt +\nopagenumbers +\headline={\ifnum\pageno>1 + \tenrm To \addressee\hfil\today\hfil Page \folio + \else\hfil\fi} + +\def\beginlinemode{\endmode + \begingroup\obeylines\def\endmode{\par\endgroup}} +\def\beginparmode{\endmode + \begingroup\parskip=\medskipamount \def\endmode{\par\endgroup}} +\let\endmode=\par +\def\endletter{\endmode\vfill\supereject \pageno=1 } + +\newdimen\longindentation \longindentation=4truein +\newbox\theaddress +\def\address{\beginlinemode\getaddress} +{\obeylines\gdef\getaddress#1 + #2 + {\gdef\addressee{#2\unskip}% + \global\setbox\theaddress=\vbox\bgroup\raggedright% + \hsize=\longindentation \everypar{\hangindent2em}#2 + \def\endmode{\egroup\endgroup \copy\theaddress \bigskip}}} + +\def\body{\beginparmode} +\def\closing{\beginlinemode\getclosing} +{\obeylines\gdef\getclosing #1 + #2 + {\nobreak\bigskip \leftskip=\longindentation #2 + \nobreak\bigskip\bigskip\bigskip % space for signature + \def + {\endgraf\nobreak}}} +\def\annotations{\beginlinemode\def\par{\endgraf\nobreak}\obeylines\par} +\def\ps{\beginparmode\nobreak + \interlinepenalty5000\def\par{\endgraf\penalty5000}} +\def\cc{\beginparmode\nobreak + \interlinepenalty5000\def\par{\endgraf\penalty5000}} + +\def\up#1{\leavevmode \raise.16ex\hbox{#1}} +\font\smallheadfont=cmr8 at 8truept +\font\largeheadfont=cmbx10 at 14.4truept +\font\logofont=stan70 at 70truept +\def\stanfordseal{\vbox{\kern-3truept\hbox{\logofont A}\kern-3truept}} + +\def\csdreturn{Computer Science Department\par \stanfordreturn} +\def\stanfordreturn{Stanford University\par + Stanford, CA 94305\kern.5pt-21\kern-.5pt40 USA\par} +\def\letterhead{\pageno=1 \univletterhead + {\leftskip=\longindentation + {\baselineskip9truept\smallheadfont\sendingaddress} + \bigskip\bigskip\rm\today\bigskip}} +\def\specrule#1{\nointerlineskip + \line{\hbox to 60truept{\hrulefill + \hphantom{\stanfordseal\kern-#1truept}% + \hrulefill}\hrulefill}\nointerlineskip} +\def\univletterhead{\vglue-34pt + \specrule{11}\vskip8truept + \hbox{\hbox to\longindentation{\smash{\hbox to60truept{\hfil\kern2.5truept + \lower10truept\stanfordseal\hfil}}% + \largeheadfont STANFORD UNIVERSITY\hfil}% + \smallheadfont STANFORD, CALIFORNIA 94305\kern.5pt-21\kern-.5pt40} + \vskip6truept\specrule{17}\vskip13truept } + +\def\deklet{ + \def\sendingaddress{DONALD E. KNUTH\par + Professor Emeritus of The Art of\par + \qquad Computer Programming\par + Department of Computer Science\par + Telephone \up[415\up]\thinspace 723-4367\par} + \def\returnaddress{Prof.~D. E. Knuth\par \csdreturn} + \letterhead} + +\def\memoto{\beginlinemode\parindent=60truept + \everypar{\hangindent70truept}\startmemo} +\def\bigmemoto{\beginlinemode\parindent=60pt % use this for magstep>1! + \everypar{\hangindent70pt}\startmemo} +\def\textin#1{\noindent\hbox to\parindent{#1\hss}\ignorespaces} +{\obeylines\gdef\startmemo #1 + {\gdef\addressee{#1}% + \global\pageno=1 \vglue-34pt\specrule{11}\vskip8truept + \leftline{\smash{\hbox to60truept{\hfil\kern2.5truept + \lower10truept\stanfordseal\hfil}}% + \largeheadfont Stanford Computer Science Department % + \rm\today}% + \vskip6truept\specrule{20}\bigskip\bigskip\bigskip% + \textin{Memo to:}#1 + \def\endmode{\par\endgroup\bigskip}} + \gdef\from #1 + {\smallskip\textin{From:}#1 + } + \gdef\subject #1 + {\smallskip\textin{Subject:}#1 + } +} + +\def\makelabel{\endletter\hbox{\vrule + \vbox{\hrule \kern6truept + \hbox{\kern6truept\stanfordseal\kern3pt + \vbox{\smallheadfont\baselineskip9truept\hsize=2truein\returnaddress} + \kern6truept}\kern6truept\hrule}\vrule} + \kern.1truein + \hbox{\vrule + \vbox{\hrule \kern12truept + \hbox{\kern12truept\copy\theaddress + \kern12truept}\kern12truept\hrule}\vrule} + \pageno=0\vfill\eject} + +\def\frac#1/#2{\leavemode\kern.1em\raise.5ex\hbox{\the\scriptfont0 + #1}\kern-.1em/\kern-.15em\lower.25ex\hbox{\the\scriptfont0 #2}} diff --git a/macros/plain/contrib/misc/lettermac.tex b/macros/plain/contrib/misc/lettermac.tex new file mode 100644 index 0000000000..5f7be9fe91 --- /dev/null +++ b/macros/plain/contrib/misc/lettermac.tex @@ -0,0 +1,111 @@ +% lettermac.tex +% +% J. Daniel Smith +% 8 November 1989 +% +% Simple macros for writing letters +% +% Last Updated: +% JDS 23 May 90 +% +% don't indent paragraphs +\newdimen\oldparindent \oldparindent=\parindent +\parindent=0pt +% +% don't do so much complaining +\tolerance=10000 \hbadness=9999 \vbadness=9999 +% +% make \narrower work correctly with \parindent +\def\narrower{\advance\leftskip by\oldparindent + \advance\rightskip by\oldparindent} +% +% leave a blank line between paragraphs +\parskip=10pt plus 1pt minus 0.5pt +% +% page breaks between paragraphs when possible +\interlinepenalty=1000 +% +% skip over a bit on the page +\def\info#1{\hskip.6\hsize#1\par\par} +% +% of course, we don't want page numbers +\nopagenumbers +% +% turn off hyphenation +\pretolerance=10000\hyphenpenalty=10000 +% +% get the name of the address file from the user +\def\getaddress#1{\begingroup + \newlinechar=`@ \def\\{@} + \message{@#1} + \message{@Enter the name of the address file: } + \endlinechar=-1 + \read-1 to\AddressFileName + \global\edef\InputAddressFileName{\AddressFileName.adr} + \endgroup + \obeyspaces % keep spaces in address + % Make it easier to type '#' and '&' in addresses + \catcode`\#=12\catcode`\&=12 + \input\InputAddressFileName + \catcode`\#=6\catcode`\&=4 + \let\getaddress\relax} +% +% address at top of letter +\def\setaddress#1{\gdef\Xaddress{#1}} + \setaddress{\hbox{\bf * ADDRESS *}} +\def\address{\par{\vskip\parskip\parskip=0pt\def\\{\par} + \frenchspacing\Xaddress} + \par\let\address\relax} +% +% Various items that might be used throughout the letter. Defaults +% are set to something obnoxious so that if they are used without +% being set it will be obvious +\def\settitle#1{\gdef\Xtitle{#1}} + \settitle{\hbox{\bf * TITLE *}} +\def\title{\Xtitle} +% +\def\setfirstname#1{\gdef\Xfirstname{#1}} + \setfirstname{\hbox{\bf * FIRSTNAME *}} +\def\firstname{\Xfirstname} +% +\def\setlastname#1{\gdef\Xlastname{#1}} + \setlastname{\hbox{\bf * LASTNAME *}} +\def\lastname{\Xlastname} +% +\def\setcompany#1{\global\def\Xcompany{#1}} + \setcompany{\hbox{\bf * COMPANY *}} +\def\company{\Xcompany} +% +% addressee +\def\addressee{Dear \Xtitle\ \Xlastname,\par} +% +% attn for envelopes +\def\attn#1{\gdef\Xattn{Attn: #1}} +% \gdef\attn{\par\vfill\line\bgroup\hbox{Attn: \Xattn}\hfil}} +\let\Xattn=\relax % don't do anything unless its \attn is used +% +% ZIP code. For compatability with envelope macros. +\let\zipbar=\relax +% closings +\def\signature#1#2{\vskip\parskip{\vbox{\info{#1,}\vskip.35true in\info{#2}} + \let\signature\relax}} +\def\sincerely#1{\signature{Sincerely}{#1}\let\sincerely\relax} +\def\love#1{\signature{Love}{#1}\let\love\relax} +% +% cc: +\def\cc#1{\par{\vskip\parskip\parskip=0pt\def\\{\par} + {\rm cc: }\everypar={\phantom{\rm cc: }}#1} + \let\cc\relax} +% RE: +\def\re#1{\par{\vskip\parskip\parskip=0pt\def\\{\par} + {\rm RE: }\everypar={\phantom{\rm RE: }}#1} + \let\re\relax} +% +% The date at the top of the letter +% If a date is not set, then the current date is used. +\def\Xtoday{\number\day\space\ifcase\month\or + January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or December\fi + \space\number\year} +\def\today#1{\gdef\Xtoday{#1}} +\def\date{\info{\Xtoday}\let\date\relax} diff --git a/macros/plain/contrib/misc/list.tex b/macros/plain/contrib/misc/list.tex new file mode 100644 index 0000000000..1daeba2bbe --- /dev/null +++ b/macros/plain/contrib/misc/list.tex @@ -0,0 +1,47 @@ +% Makes a listing of one or more files +% Typical usage: +% tex list *.c \\end + +\def\grabfile#1 {\setbox0=\lastbox\endgraf\doit{#1}} +\everypar{\grabfile} + +\font\filenamefont= cmtt8 scaled\magstep3 +\font\headlinefont= cmr8 +\font\listingfont= cmtex10 +\font\eoffont= cmti8 + +\def\today{\ifcase\month\or + January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or December\fi + \space\number\day, \number\year} +\newcount\m \newcount\n +\n=\time \divide\n 60 \m=-\n \multiply\m 60 \advance\m \time +\def\hours{\twodigits\n\twodigits\m} +\def\twodigits#1{\ifnum #1<10 0\fi \number#1} + +\newlinechar=`@ +\message{@\today\space at \hours} + +\raggedbottom +\nopagenumbers + +\chardef\other=12 +\def\doit#1{\message{@Listing #1@} + \begingroup \everypar{} \frenchspacing + \headline{\filenamefont#1\quad\headlinefont \today\ at \hours + \hfill Page \folio} + \def\do##1{\catcode`##1=\other}\dospecials + \catcode127=\other \catcode9=\other \catcode12=\other + \parindent 0pt \parfillskip=0pt plus 1fil minus 1in + \everypar{\hangindent 1in} \rightskip=0pt plus 2in + \def\par{\ifvmode\penalty-500\medskip\else\endgraf\fi} + \listingfont \obeylines \obeyspaces \global\pageno=1 + \input #1 {\eoffont(end of\/ file)}\endgraf\vfill\eject\endgroup} +{\obeyspaces\global\let =\ } +\catcode`\_=\other % allow _ in file names + +% A tab (^^I) prints as lowercase gamma. +% Character ^^M could be made visible, with a bit of work; +% at present, it's indistinguishable from newline (^^J). + +% You can get up to 103 characters on a line without an overfull box. diff --git a/macros/plain/contrib/misc/listing.mac b/macros/plain/contrib/misc/listing.mac new file mode 100644 index 0000000000..6be5e4ab04 --- /dev/null +++ b/macros/plain/contrib/misc/listing.mac @@ -0,0 +1,63 @@ +\input 17Point.TeX +\input 14Point.TeX +\input 12Point.TeX +\tenpoint +% This is a file of commands for printing out programs using TeX +% -- see DIRTY TRICKS in TeXbook +% +% This version is designed to print source code at 9 point +% fitting an 80 column line into a 6 true inch width with +% 8 point line numbers before each line. +% It handles TAB (^I) characters almost the same as DEC +% +% usage: +% \input fortran % put this early in the file +% \listing{file.ext} % use dev:[dir] if you wish +% +% B.H. Toby 8/86 +% +\newcount\lineno +\font\Alisttt=cmtt9 at 9 truept +\font\Alistrm=cmr8 at 8 truept +\font\fourteentt=cmtt10 at 14.4 truept +\font\titlefont=cmbx12 scaled 1440 +\newcount\partpageno +\def\uncatcodespecials{\def\do##1{\catcode`##1=12 }\dospecials} +\def\listing#1{\mark{\currentsection \noexpand\else #1} + \penalty-200\vskip18pt plus4pt minus6pt + \leftline{\fourteentt #1} + \mark{#1\noexpand\else #1} \def\currentsection{#1} + \nobreak\smallskip + \par\begingroup\setupverbatim\input#1 \endgroup} +\def\setupverbatim{ + \Alisttt\baselineskip= 8.5truept\lineskip=1truept + \lineskiplimit=1truept\topskip=0pt + \lineno=0 + \def\par{\leavevmode\egroup\box0\endgraf} + \obeylines \uncatcodespecials \obeyspaces + \catcode`\`=\active \catcode`\^^I=\active + \everypar{\startbox}} +\newdimen\w \setbox0=\hbox{\Alisttt\space} \w=8\wd0 +\def\startbox{\setbox0=\hbox\bgroup} +{\catcode`\^^I=\active + \gdef^^I{\leavevmode\egroup + \dimen0=\wd0 + \divide\dimen0 by\w + \multiply\dimen0 by\w + \advance\dimen0 by\w + \wd0=\dimen0 \box0 \startbox}} +{\obeyspaces\global\let =\ } +{\catcode`\`=\active \gdef`{\relax\lq}} + +\def\header#1{\vfill\eject\null\medskip\centerline{\fourteenpoint\bf #1}\bigskip + \message{\noexpand#1}\def\part{#1}\partpageno=\count0} + +\def\title#1{\pageno=0\null\vfill\centerline{\seventeenpoint\bf#1}} + +\def\currentsection{} + +\headline{\ifnum\pageno=\partpageno\hfill\else + \ifodd\pageno{\bf\part}\hss{\tt\iftrue\botmark\fi} + \else{\tt\expandafter\iffalse\topmark\fi}\hss{\bf\part}\fi\fi} +\footline{\ifnum\pageno=0\hfil\else\hfil\tenbf\folio\hfil\fi} + diff --git a/macros/plain/contrib/misc/listmac.tex b/macros/plain/contrib/misc/listmac.tex new file mode 100644 index 0000000000..43a1c31674 --- /dev/null +++ b/macros/plain/contrib/misc/listmac.tex @@ -0,0 +1,157 @@ +% -*- Mode: TeX; Syntax: Common-lisp; Package: LISTEX; -*- +%% macros for the LISTEX system by DCB + +% setup +\catcode`\@=11 + +% fonts +\def\LTnormalfont {\rm} +\def\LTcommentfont {\it} +\def\LTpuncfont {\tt} +\def\LTcodefont {\rm} +\def\LTcodepuncfont {\tt} +\def\LTslantedcode {% + \font\sltt=cmsltt10 + \def\LTcodefont{\sl}% + \def\LTcodepuncfont{\sltt}} +\def\slantedcode{\LTslantedcode} +\def\LTboldcode {% + \def\LTcodefont{\bf}% + \def\LTcodepuncfont{\tt}} +\def\boldcode{\LTboldcode} +\def\LTtypewritercode {% + \def\LTcodefont{\tt}} +\def\typewritercode{\LTtypewritercode} + +% delimiters +\newdimen\LTparenkern \LTparenkern=.1pt +\newdimen\LTcommentkern \LTcommentkern=1pt +\newdimen\LTspacewidth \LTspacewidth=.45em +\def\LTop/{{\rm(\kern\LTparenkern}} +\def\LTcp/{\/{\rm\kern\LTparenkern)}} +\def\LTobrace/{{$\{$\kern\LTparenkern}} +\def\LTcbrace/{\/{\kern\LTparenkern$\}$}} +\def\LTquot/{\raise.3ex\hbox{\LTpuncfont\char`\"}} +\def\LTstar/{\lower.05ex\hbox{\LTpuncfont\char`\*}} +\def\LTchr {\LTpuncfont\char} +\def\LTsetpwidth {\setbox\z@=\hbox{\LTop/}\LTpwidth=\wd\z@} +\newdimen\LTpwidth \LTsetpwidth + +% indentations +\def\LTpi/{\kern\LTpwidth} % increment for plus1 +\def\LTpii/{\kern 2\LTspacewidth} % increment for plus2 +\def\LTpiv/{\kern 4\LTspacewidth} % increment for plus4 +\def\LTks #1{\kern #1\LTspacewidth} % kern a number of space widths + +% boxes +\newbox\LTbox +\newdimen\LTboxw +\def\LTsb {\setbox\LTbox=\hbox} % start a box +\def\LTdb/{\box\LTbox} % dump out a box +\def\LTbb {\LTboxw=\wd\LTbox % output a box and backspace over it + \box\LTbox + \kern-\LTboxw} + +% markers +\def\LTsm #1{\xdef#1{\the\wd\LTbox}% % set a mark register + \box\LTbox} +\def\LTkr #1{\kern #1\relax} % kern a register +\def\LTkm {\LTbb\LTkr} % kern to a marked position + +% modules + +% output modules in boxes? +\newif\ifLTboxmodules + +% keep track of position in file: top, after module, before module +\newif\iffirstmodule \firstmoduletrue +\newif\ifmodule + +% incrementally number modules +\newcount\modulecount + +% normal modules +\def\LTbeginmodule/{% + \iffirstmodule \firstmodulefalse + \else \LTfilbreak \bigskip \fi + \advance\modulecount\@ne + \LTmarkmodule + \ifLTboxmodules \vbox\bgroup \else \begingroup \fi + \LTmoduledefs + \noindent {\bf \number\modulecount.}\enspace \ignorespaces} + +\def\LTendmodule/{% + \endgraf + \ifLTboxmodules \egroup \else \endgroup \fi + \moduletrue} + +\def\LTmarkmodule {} + +\def\LTmoduledefs {% + \LTmodulehook + \LTsetpwidth} + +\def\LTmodulehook {} + +% star modules +\def\LTbeginstarmodule #1{% + \iffirstmodule \firstmodulefalse + \else \vfil \eject \fi + \advance\modulecount\@ne + \LTmarkstarmodule{#1}% + \ifLTboxmodules \vbox\bgroup \else \begingroup \fi + \LTmoduledefs + \noindent {\bf \number\modulecount. \ignorespaces #1\par} + \nobreak \smallskip \noindent \ignorespaces} + +\def\LTmarkstarmodule {\message{*\number\modulecount}\mark} + +% spacing and layout +\def\LTfilbreak {\vfil\penalty-200\vfilneg} +\def\LTfilnobreak {\vfil\penalty9999\vfilneg} +\parindent=2em +\interlinepenalty=10000 % forbid breaks in paragraphs + +% code in module text +\def\LTbcode/{\begingroup \let\LTpuncfont=\LTcodepuncfont + \LTcodedefs \LTcodefont \LTsetpwidth} +\def\LTecode/{\/\endgroup} + +% code +\def\LTbeginlisp/{% + \iffirstmodule \beginmodule \endmodule \fi + \ifmodule \modulefalse \LTfilnobreak \bigskip + \else \LTfilnobreak \medskip \fi + \vbox\bgroup \LTcodedefs \LTnormalfont \LTsetpwidth} + +\def\LTendlisp/{% + \egroup} + +\def\LTcodedefs {% + \spaceskip=\LTspacewidth + \xspaceskip=\LTspacewidth + \LTcodehook} + +\def\LTcodehook {} + +% module text in code +\def\LTcommentdefs {\spaceskip=\z@ \xspaceskip=\z@ \LTcommentfont \LTsetpwidth} +\def\LTbcom/{\begingroup \LTcommentdefs {\rm;\kern\LTcommentkern}} +\def\LTecom/{\endgroup} + +% miscellany +\ifx\lisp\undefined + \def\lisp {Lisp} + \let\LISP=\lisp + \let\Lisp=\lisp +\fi +\def\listex {Lis\kern-.1667em\TeX} +\let\LISTEX=\listex +\let\Listex=\listex + +\hsize=30pc +\vsize=50pc +\LTboxmodulesfalse + +% cleanup +\catcode`\@=12 diff --git a/macros/plain/contrib/misc/llist.tex b/macros/plain/contrib/misc/llist.tex new file mode 100644 index 0000000000..f107169e24 --- /dev/null +++ b/macros/plain/contrib/misc/llist.tex @@ -0,0 +1,67 @@ +% Makes a landscape listing of one or more files +% Typical usage: +% tex llist *.c \\end + +\def\grabfile#1 {\setbox0=\lastbox\endgraf\doit{#1}} +\everypar{\grabfile} + +\font\filenamefont= cmtt8 scaled\magstep3 +\font\headlinefont= cmr8 +\font\listingfont= cmtex8 +\font\eoffont= cmti8 + +\def\today{\ifcase\month\or + January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or December\fi + \space\number\day, \number\year} +\newcount\m \newcount\n +\n=\time \divide\n 60 \m=-\n \multiply\m 60 \advance\m \time +\def\hours{\twodigits\n\twodigits\m} +\def\twodigits#1{\ifnum #1<10 0\fi \number#1} + +\newlinechar=`@ +\message{@\today\space at \hours} + +\baselineskip=9pt +\medskipamount=4pt minus 1pt +\raggedbottom +\nopagenumbers + +\chardef\other=12 +\def\doit#1{\message{@Listing #1@} + \begingroup \everypar{} \frenchspacing + \headline{\ifright \headlinefont \hfill Page \folio + \else\filenamefont#1\quad\headlinefont \today\ at \hours\hfill \fi} + \def\do##1{\catcode`##1=\other}\dospecials + \catcode127=\other \catcode9=\other \catcode12=\other + \parindent 0pt \parfillskip=0pt plus 1fil minus .8in + \everypar{\hangindent 1in} \rightskip=0pt plus 2in + \def\par{\ifvmode\penalty-50\medskip\else\endgraf\fi} + \listingfont \obeylines \obeyspaces \global\pageno=1 + \input #1 {\eoffont(end of\/ file)}\endgraf\vfill\eject + \ifright\null\vfill\eject\fi\endgroup} +{\obeyspaces\global\let =\ } +\catcode`\_=\other % allow _ in file names + +\hsize=4.6truein +\vsize=7truein +\hoffset=-.5truein +\voffset=-.2truein +\newif\ifright +\newbox\lefthalf +\output{\ifright + \shipout\hbox{\hbox to5.5in{\box\lefthalf\hss}% + \vbox{\makeheadline\pagebody\makefootline}} + \advancepageno\global\rightfalse + \else\global\setbox\lefthalf\vbox{\makeheadline\pagebody\makefootline} + \global\righttrue\fi} + +\special{landscape} + +% A tab (^^I) prints as lowercase gamma. +% Character ^^M could be made visible, with a bit of work; +% at present, it's indistinguishable from newline (^^J). + +% You can get up to 91 characters on a line without an overfull box. +% (But lines with more than 84 characters will be clipped, if they +% appear on a righthand halfpage.) diff --git a/macros/plain/contrib/misc/longtocline.tex b/macros/plain/contrib/misc/longtocline.tex new file mode 100644 index 0000000000..22766763e3 --- /dev/null +++ b/macros/plain/contrib/misc/longtocline.tex @@ -0,0 +1,26 @@ +%%%------------- tear neatly -------------------------------------%%%% +\def\leaderfill{\kern0.5em\leaders\hbox to 0.5em{\hss.\hss}\hfill\kern +0.5em}% right out of the 'bible' +\newcount\nmbroflines \newbox\scratch \newbox\rule \newdimen\myindent +%caution! \myindent needs to be set first, say e.g. +\myindent=1.5true cm +\def\hugeheader#1#2#3{\bgroup\parskip=0pt +\setbox\scratch=\vbox{{\advance\hsize by-\myindent +\advance\hsize by-3true cm\noindent#2\par}% to prevent blanks +\global\nmbroflines=\prevgraf}% 'you never know' +\unvbox\scratch \setbox\rule=\lastbox +\loop\ifnum\nmbroflines>1 +\unskip\unpenalty\setbox\scratch=\lastbox +\advance\nmbroflines by-1\repeat +\setbox\scratch=\hbox{\unhbox\rule\unskip\unskip\unpenalty}% +{\par\advance\hsize by-3true cm\hangindent\myindent +\noindent\hbox to\myindent{#1\hss}#2\par}% +\vskip-\baselineskip +\line{\kern\myindent\kern\wd\scratch\leaderfill#3}\egroup} +\endinput +% usage: +\line{\hbox to\myindent{1.0\hfil}Normal Heading\leaderfill 66} +\hugeheader{1.1}{Abnormal heading of a chapter about giant holes all +over Australia caused by elephants interbreeded with local kangaroos}% +{77} +%%%------------- cut along this line ----------------------------%%%%% diff --git a/macros/plain/contrib/misc/lwebmac.tex b/macros/plain/contrib/misc/lwebmac.tex new file mode 100644 index 0000000000..23cf864ff8 --- /dev/null +++ b/macros/plain/contrib/misc/lwebmac.tex @@ -0,0 +1,135 @@ +% macros for the LWEB system by DCB -*- Mode: TeX; Syntax: Common-lisp; Package: LWEB -*- + +% setup +\catcode`\@=11 + +% fonts +\def\LWnormalfont {\rm} +\def\LWcommentfont {\it} +\def\LWpuncfont {\tt} +\def\LWcodefont {\rm} +\def\LWcodepuncfont {\tt} +\def\slantedcode {% + \font\sltt=amsltt10 + \def\LWcodefont{\sl}% + \def\LWcodepuncfont{\sltt}} +\def\boldcode {% + \def\LWcodefont{\bf}% + \def\LWcodepuncfont{\tt}} + +% delimiters +\newdimen\LWparenkern \LWparenkern=.1pt +\newdimen\LWcommentkern \LWcommentkern=1pt +\newdimen\LWspacewidth \LWspacewidth=.45em +\def\LWop/{{\rm(\kern\LWparenkern}} +\def\LWcp/{\/{\rm\kern\LWparenkern)}} +\def\LWobrace/{{$\{$\kern\LWparenkern}} +\def\LWcbrace/{\/{\kern\LWparenkern$\}$}} +\def\LWquot/{\raise.3ex\hbox{\LWpuncfont\char`\"}} +\def\LWstar/{\lower.05ex\hbox{\LWpuncfont\char`\*}} +\def\LWchr {\LWpuncfont\char} +\def\LWsetpwidth {\setbox\z@=\hbox{\LWop/}\LWpwidth=\wd\z@} +\newdimen\LWpwidth \LWsetpwidth + +% indentations +\def\LWpi/{\kern\LWpwidth} % increment for plus1 +\def\LWpii/{\kern 2\LWspacewidth} % increment for plus2 +\def\LWpiv/{\kern 4\LWspacewidth} % increment for plus4 +\def\LWks #1{\kern #1\LWspacewidth} % kern a number of space widths + + +% boxes +\newbox\LWbox +\newdimen\LWboxw +\def\LWsb {\setbox\LWbox=\hbox} % start a box +\def\LWdb/{\box\LWbox} % dump out a box +\def\LWbb {\LWboxw=\wd\LWbox % output a box and backspace over it + \box\LWbox + \kern-\LWboxw} + +% markers +\def\LWsm #1{\xdef#1{\the\wd\LWbox}% % set a mark register + \box\LWbox} +\def\LWkr #1{\kern #1\relax} % kern a register +\def\LWkm {\LWbb\LWkr} % kern to a marked position + +% modules + +% keep track of position in file: top, after module, before module +\newif\iffirstmodule \firstmoduletrue +\newif\ifmodule + +% incrementally number modules +\newcount\modulecount + +% normal modules +\def\LWbeginmodule/{% + \iffirstmodule \firstmodulefalse + \else \LWfilbreak \bigskip \fi + \advance\modulecount\@ne + \LWmarkmodule + \begingroup \LWmoduledefs + \noindent {\bf \number\modulecount.}\enspace \ignorespaces} + +\def\LWendmodule/{% + \endgraf + \endgroup + \moduletrue} + +\def\LWmarkmodule {} + +\def\LWmoduledefs {\def\par{\endgraf\nobreak}\LWsetpwidth} + +% star modules +\def\LWbeginstarmodule #1{% + \iffirstmodule \firstmodulefalse + \else \vfil \eject \fi + \advance\modulecount\@ne + \LWmarkstarmodule{#1}% + \begingroup \LWmoduledefs + \noindent {\bf \number\modulecount. \ignorespaces #1\par} + \nobreak \smallskip \noindent \ignorespaces} + +\def\LWmarkstarmodule {\message{*\number\modulecount}\mark} + +% spacing and layout +\def\LWfilbreak {\vfil\penalty-200\vfilneg} +\def\LWfilnobreak {\vfil\penalty9999\vfilneg} +\parindent=2em +\interlinepenalty=10000 % forbid page breaks in modules + +% code in module text +\def\LWbcode/{\begingroup \LWcodefont \LWcodedefs \let\LWpuncfont=\LWcodepuncfont} +\def\LWecode/{\/\endgroup} + +% code +\def\LWbeginlisp/{% + \iffirstmodule \beginmodule \endmodule \fi + \ifmodule \modulefalse \LWfilnobreak \bigskip + \else \LWfilnobreak \medskip \fi + \vbox\bgroup \LWnormalfont \LWcodedefs} + +\def\LWendlisp/{% + \egroup} + +\def\LWcodedefs {% + \spaceskip=\LWspacewidth + \xspaceskip=\LWspacewidth + \LWsetpwidth} + +% module text in code +\def\LWcommentdefs {\spaceskip=\z@ \xspaceskip=\z@ \LWcommentfont \LWsetpwidth} +\def\LWbcom/{\begingroup \LWcommentdefs {\rm;\kern\LWcommentkern}} +\def\LWecom/{\endgroup} + +% miscellany +\ifx\lisp\undefined + \def\lisp {Lisp} + \let\LISP=\lisp + \let\Lisp=\lisp +\fi +\def\lweb {LWEB} +\let\LWEB=\lweb + +% cleanup +\catcode`\@=12 diff --git a/macros/plain/contrib/misc/maybeload.tex b/macros/plain/contrib/misc/maybeload.tex new file mode 100644 index 0000000000..0c8a088de5 --- /dev/null +++ b/macros/plain/contrib/misc/maybeload.tex @@ -0,0 +1,13 @@ +% A small macro for Tex82 or Latex. You can prevent a file of +% macros from being loaded twice by putting +% \input maybeload +% \thisfileis{<dirname>filename} +% in the macro file. -- eb@oz 6/27/86 +\global\def\thisfileis#1{\if T\csname #1=loaded\endcsname \endinput + \else \global\expandafter\def\csname #1=loaded\endcsname{T}\fi} +% +% If you like, you can conditionalize the \input maybeload with the +% incantation +% \ifx\thisfileis\anUndefinedMacro\input maybeload \fi +% instead of just \input maybeload. +% diff --git a/macros/plain/contrib/misc/memo.tex b/macros/plain/contrib/misc/memo.tex new file mode 100644 index 0000000000..dcdcc622f3 --- /dev/null +++ b/macros/plain/contrib/misc/memo.tex @@ -0,0 +1,40 @@ +% +% Memo -- Generate a memo banner +% +% Use \memodept{ text } to define the department text. +% Use \memocirc{ text } to define the to field. +% Use \memodate{ text } to define the date the memo will be sent (default is +% the current date that TeX processes the file). +% Use \memofrom{ text } to define the from field. +% Use \memophone{ text } to define the phone number of the sender. +% Use \memomail{ text } to define the mail code of the sender. +% Use \memosubj{ text } to define the subject of the memo. +% +% Use \memohdr to print the memo banner once the fields above have been defined +% +\nopagenumbers +\def\today{\ifcase\month\or January\or February\or March\or April\or + May\or June\or July\or August\or September\or October\or November\or + December\fi\space\number\day, \number\year} +\def\memotwobx#1#2{\line{{To}\hskip 10pt #1\hfill{Date}\hskip 10pt #2}} +\def\memothrbx#1#2#3{\line{{From}\hskip 10pt #1\hfill\hfill\hfill + {Extension}\hskip 10pt #2\hfill{Mail Code}\hskip 10pt #3}} +\def\memoltbx#1{\line{{Subject}\hskip 10pt #1\hfill}} +\def\memoya{Chemistry} \def\memoyb{You} +\def\memoyc{\today} \def\memoyd{Me} +\def\memoye{6532} \def\memoyf{Misc.} +\def\memoyg{127-72} +\def\memodept#1{\def\memoya{#1}}\def\memocirc#1{\def\memoyb{#1}} +\def\memodate#1{\def\memoyc{#1}}\def\memofrom#1{\def\memoyd{#1}} +\def\memophone#1{\def\memoye{#1}}\def\memosubj#1{\def\memoyf{#1}} +\def\memomail#1{\def\memoyg{#1}} +\font\fiverm=ambx5 % Change to CMBX5 if you use new TeX 2.0 +\def\memohdr{\centerline{\fiverm interoffice memorandum}\par + \null\par + \centerline{\bf CALIFORNIA INSTITUTE OF TECHNOLOGY} % Change this line + \centerline{\bf {\memoya}} + \null\par + \memotwobx{\memoyb}{\memoyc} + \memothrbx{\memoyd}{\memoye}{\memoyg} + \memoltbx{\memoyf} + \vskip 10pt} diff --git a/macros/plain/contrib/misc/mhack.tex b/macros/plain/contrib/misc/mhack.tex new file mode 100644 index 0000000000..6f0546a19d --- /dev/null +++ b/macros/plain/contrib/misc/mhack.tex @@ -0,0 +1,102 @@ +%% Save file as: MHACK.TEX Source: FILESERV@SHSU.BITNET +%% Original author: Norman Walsh <walsh@cs.umass.edu> +%% Original source: Posted to INFO-TeX@SHSU.edu by +%% RAY BROHINSKY <RAYBRO%HOLON@utrcgw.utc.com> on Fri, 27 Sep 1991 16:29 EDT +%% +%Here are two solutions for marginal hacks. \ihack is based upon +%the marginal hacks notes in the book and requires the section that +%redefines \pagecontents. It has the defect that marginal hacks +%start at the top of the page rather than where you put them in the +%text. + +%\vhack doesn't use inserts and has the advantage that you don't +%need to redefine part of the output routine (\pagecontents) but if +%you put several hacks very close to each other, they may overlap.% + +%Let me know what you think. If you have try to integrate them into +%your notes and you have trouble, just let me know. + +% mhack.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\font\marginhackfont=cmr7 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newinsert\margin +\dimen\margin=\maxdimen +\count\margin=0 \skip\margin=0pt +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newdimen\marginhackwidth +\newdimen\marginhackshift +\newdimen\marginhacknudge +\marginhackwidth=.8in +\marginhackshift=\hsize +\advance\marginhackshift by .1in +\marginhacknudge=.1in +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\ihack#1{\marginhacknudge=0pt\insert\margin{\hbox{\marginhackpara{#1}}}} +\def\vhack#1{\vadjust{\vbox to 0pt{% + \marginhacknudge=.1in% + \vskip-8.5pt% move it back up the page + \hskip6.2in\rlap{% + \marginhackpara{#1}}\vss}}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% this is a modified version of \para that I got +% from ... somewhere +% +\long\def\marginhackpara#1{% % + \hskip\marginhacknudge % + \vtop{\leftskip=0pt\rightskip=0pt % Make width ok + \hsize=\marginhackwidth % + \marginhackfont % select font + \parindent=0pt % + \baselineskip=6pt % + \everypar={} % + \lineskip=1pt % + \lineskiplimit=1pt % + \raggedright % + \hbadness=10000 % I don't care about underfull boxes + \tolerance=10000 % I don't care about overfull ones + \noindent % don't indent + \vrule width0pt height8.5pt % line up top of hack and text + #1\relax % add the text + \vrule width 0pt depth 7pt}% % pad bottom of box +}% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Include the marginal hacks in the plain output routine +% (only needed for \ihack) +\catcode`@=11 +\def\pagecontents{\ifvoid\topins\else\unvbox\topins\fi + \ifvoid\margin\else % + \rlap{\kern\marginhackshift\vbox to 0pt{\box\margin\vss}}\fi + \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255 + \ifvoid\footins\else % footnote info is present + \vskip\skip\footins + \footnoterule + \unvbox\footins\fi + \ifr@ggedbottom \kern-\dimen@ \vfil \fi} +\catcode`@=12 % at signs are no longer letters + +\endinput +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +Here is some text followed by more text and more text and more text and +more text and more text and more text and more text and more text and +more text and more text and more text and more text and more text and +more text and more text and more text and more text and more text and +more text and more text and more text and more text and more text and +more text and more text and more text and more text and more text and +more text and more text and more text and more text and more text and +more text and more text and more text and more text and more text and +more text and more text and more text and more text and more text and +more text and more text and VHACK\vhack{this is a vhack, it starts +here and goes on for several lines} more text and more text and +more text and more text and more text and more text and more text and +more VHACK\vhack{this is another vhack, which collides} +and more text and more text and more text and more text and +more text and more IHACK\ihack{this is an ihack, it starts at the top} +and more text and more text and more +IHACK\ihack{this is a second ihack, but it doesn't collide} +and more text and more text and more text and more text and more text and +more text and more text and more text and more text and more text and +more text and more text and more text and more text and more text and +more text and more text and more text and more text and more text and +more text and more text and more text and more text and more text. +\bye +% end of mhack.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/macros/plain/contrib/misc/model.tex b/macros/plain/contrib/misc/model.tex new file mode 100644 index 0000000000..d983917210 --- /dev/null +++ b/macros/plain/contrib/misc/model.tex @@ -0,0 +1,98 @@ +%%%%%% example of use: +% \input model +% \totalpages=5 % if you want the total number of pages to appear in the heading +% \centerline{title} +% \centerline{authors names} +% \endoftitle +% rest of paper +% \endofpaper\end + + +\newdimen\fullhsize \fullhsize=42truepc +\newdimen\fullvsize \fullvsize=52truepc +\newdimen\colhsize \colhsize=20truepc +\newdimen\topvsize \topvsize=10truepc % this number can be changed +\newdimen\shortvsize +\newif\iftitlepage \titlepagetrue +\newbox\leftcolumn \newbox\rightcolumn \newbox\topcolumn +\newcount\totalpages \totalpages=0 % specify this if you want page numbers +\output{ +\iftitlepage + \if T\column + \global\shortvsize=\fullvsize + \global\advance\shortvsize by -\topvsize + \global\hsize\colhsize \global\vsize\shortvsize + \global\setbox\topcolumn=\columnbox + \global\let\column=L + \else \if L\column + \global\setbox\leftcolumn=\columnbox + \global\let\column=R + \else \shipout\vbox to \fullvsize{\pagenumberbox + \box\topcolumn + \vss + \hbox to \fullhsize{\box\leftcolumn + \hfill\columnbox}} + \advancepageno + \global\let\column=L + \global\titlepagefalse + \global\vsize=\fullvsize + \fi + \fi +\else \if L\column + \global\setbox\leftcolumn=\columnbox + \global\let\column=R + \else \shipout\vbox to \fullvsize{\pagenumberbox + \hbox to\fullhsize{\box\leftcolumn + \hfill\columnbox}} + \advancepageno + \global\let\column=L + \fi +\fi} + +\def\columnbox{\leftline{\pagebody}} + +\def\pagenumberbox{\baselineskip0pt\lineskip0pt + \vbox to 0pt{\vss\hbox to \fullhsize{\hfil\tenrm + Page \folio\ifnum\totalpages>0\ of \number\totalpages.\fi\hfil} + \vskip1pc}} + +\let\column=T +\vsize=\topvsize \hsize=\fullhsize + +\def\endoftitle{\par\vfill\eject} + +\def\endofpaper{\par\vfill\supereject\if R\column \null\vfill\eject\fi} + +% 8 point footnotes +\catcode`@=11 % allow at signs in following entry +\def\vfootnote#1{\insert\footins\bgroup + \eightpoint + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox \floatingpenalty\@MM + \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip + \textindent{#1}\footstrut\futurelet\next\fo@t} +\catcode`@=12 % at signs are no longer letters + +\def\eightpoint{\let\rm=\eightrm +\setbox\strutbox=\hbox{\vrule height7pt depth2pt width0pt}% +\rm\baselineskip=9pt} +\font\eightrm=cmr8 + +\def\eatone#1{} + +% \unnumberedfootnote{...text...} gives an unnumbered footnote +% \footnote{symbol/number}{...text...} gives a labelled footnote +\def\unnumberedfootnote{\footnote{\eatone}} + + +% \acmpermission puts the ACM permission text in a unnumbered footnote +\def\acmpermission{\unnumberedfootnote{Permission to copy without fee all or + part of this material is granted provided that the copies are not made + or distributed for direct commercial advantage, the ACM copyright notice + and the title of the publication and its date appear, and notice is + given that copying is by permission of the Association of Computing + Machinery. +To copy otherwise, or to republish, requires a fee and/or + specific permission.}} + diff --git a/macros/plain/contrib/misc/mrecog.tex b/macros/plain/contrib/misc/mrecog.tex new file mode 100644 index 0000000000..15fca10eb2 --- /dev/null +++ b/macros/plain/contrib/misc/mrecog.tex @@ -0,0 +1,365 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%% mrecog.tex %%%%% mrecog.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Mathmode control-sequence recognition for TeX/LaTeX +% +% Version 0.1 (Beta test version) +% Last revised: June 26, 1990 +% +% Author: Robert H. Wentworth (rhw@hoh-1.att.com) +% +% (C) Copyright 1990 Robert H. Wentworth +% +% Description: +% When this file is included in a TeX or LaTeX file, +% (via \input or as a *.sty file) "command sequence recognition" +% is activated for all text appearing in math mode. +% What this means is that any consecutive sequence of two or more +% letters delimited by nonletters will be checked to see if it is +% the name of a currently-defined control sequence, and if it is +% then the sequence of letters will be replaced by the corresponding +% control sequence. The intent is to render equations more +% readable by eliminating the need for explicit escape characters +% (usually backslashes). +% +% Examples: +% The following samples expand as if backslashes were inserted +% in appropriate spots: +% +% It is obvious that +% $$ f(x) = (a times b) +% int_0^{infty} g(x) cos(pi log phi)\,d phi $$ +% +% Note that ``theta'' is not recognized but $theta$ is. +% +% \def\cis(#1){cos(#1) + i{}sin(#1)} +% $$e^{i theta} = cis(theta) qquad \hbox{for $theta$ real}$$ +% +% Details: +% Command sequences with explicit escapes (backslashes) will +% continue to be recognized in the normal way. +% +% Single letters are not recognized as command sequences; to type +% a command sequence whose name is a single letter an explicit +% escape (backslash) should be used (e.g., $\j$ yields a j without +% a dot, but $j$ does not). +% +% Whitespace (spaces, tabs, returns) may delimit letter-sequences. +% Thus if a sequence of letters which should be interpreted literally +% is in danger of being recognized as a control sequence, this can +% be avoided by inserting a space (or {}) into the sequence +% (e.g., $div$ yields a division sign, but $d i v$ or $di{}v$ does not). +% +% If the count variable \tracingrecognition is set to a positive number +% then information regarding what command sequences have been +% recognized will be printed to the terminal and the log file. +% This is useful for debugging. +% +% There should be no effect outside mathmode (unless a symbolic +% name is used which conflicts with names used in this file; +% an attempt has been made to minimize the likelihood of this.) +% Active letters cannot be used without conflicting with the +% workings of this file, and whitespace must be defined in the +% usual way within mathmode. +% +% Recognition can be turned off/on by either of two mechanisms: +% +% \dorecognition=0 \dorecognition=1 +% This turns recognition off/on very quickly, +% but some processing overhead continues to +% be present even when recognition is off; +% some complicated mathmode macros which object to +% the use of active letters might be interfered +% with even when recognition is off. +% This mechanisim affects only the current +% group unless a \global assignment is used. +% +% \deactivatemathletters \activatemathletters +% These require somewhat more processing to +% turn recognition off or on, but when +% recognition is off mathmode is more +% nearly in its native state, so that even +% most complicated mathmode macros should +% function properly. This mechanism has +% global effects. +% +% Recognition is initially on. +% +% Recognition is recursive. Thus text generated by macros inside +% mathmode will itself be scanned for recognizable control sequence +% names. +% +% The use of the recognition feature will slow down the processing +% of equations somewhat, but the additional computations done are +% linear in the amount of mathmode letter-text scanned, and the +% memory used is more-or-less constant, so pathological slowdowns +% or memory overflows are not expected. +% +% Known limitations: +% +% Command sequences whose names are followed by spaces which +% precede arguments or syntactically significant tokens will +% not work properly unless explicitly escaped. Typically +% these macros are not part of the natural flow of the +% equation anyway, so the use of explicit escapes (backslashes) +% is not particularly objectionable. +% (This was a design tradeoff. These could have been made to +% work, but with the unpleasant side-effect that the sequence +% \def\cat{dog}\def\dogflea{mouse} $cat flea$ would expand +% to $mouse$; i.e., the space would only act as a delimiter +% during the first evaluation.) +% Examples: use $\hbox to 1in{...}$ rather than $hbox to 1in{...}$; +% or use $hskip1in etc.$ or $\hskip 1in etc.$ rather than +% $hskip 1in etc.$. +% +% The recursive nature of the recognition can cause problems +% unless one is careful to prevent them. For example, +% \def\dog{{\it dog}} $dog$ causes an infinite recursion. +% Special macros are defined in this file that can be used +% to prevent such recursion in simple macros: +% +% \norecogwithin{\dog} will turn off recognition within future +% expansions of \dog; note that \dog expands in a group, and +% hence some side-effects will only be local; macro should only +% be used for macros without arguments. +% +% \norecogafter{\it} will turn off recognition prior to any +% subsequent expansion of \it; note that recognition will +% continue to stay off until local group containing \it +% ends or \dorecognition=1 occurs. Recognition is turned +% off only when \it occurs in mathmode. +% +% To prevent infinite recursion in common command sequences like +% \sin, \cos, etc., this file declares \norecogafter{\rm}. +% This redefines \rm (in a relatively minor way). The original +% definition of \rm can be restored using \let\rm=\originalrm. +% +% In general recursive recognition is awkward to make practical +% use of. (Recursive evaluation is a side-effect of the implementation +% and isn't a priori desirable.) There are various hazards having to do +% with differences between the state of letters and spaces under various +% circumstances. In a typical problem, the sequence +% \def\dog#1{sin #1} $dog{theta}$ +% expands to $sintheta$ rather than $\sin\theta$ because the space in +% the definition of \dog is an ordinary space which does not serve as +% a recognition-delimiter. Moving the definition inside mathmode +% doesn't work either, because the letters of space gets scanned as +% an ordinary space. (Spaces are modified only when they are first +% scanned as a token following a letter-sequence which is a +% candidate for recognition.) The example works for \dog defined by +% \def\dog#1{sin{}#1} or \def\dog{\sin#1}. +% +% Improvements/comments: +% The author would appreciate hearing about any positive or negative +% experiences people may experience in using this feature, and also +% about any improvements others may make. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% allow private names using @ in such a way that prior state can be restored. +% this should permit file to be used either as a *.sty file or as a simple +% \input file. +\newif\ifatsignwasaletter +\ifcat @a + \atsignwasalettertrue +\else + \atsignwasaletterfalse + \catcode`\@=11 +\fi + +% change mathcodes to activate letters in mathmode +\def\activatemathletters{% +\begingroup +\def\doallletters{\do{a}\do{b}\do{c}\do{d}\do{e}\do{f}\do{g}\do{h}\do{i}\do{j} +\do{k}\do{l}\do{m}\do{n}\do{o}\do{p}\do{q}\do{r}\do{s}\do{t}\do{u}\do{v} +\do{w}\do{x}\do{y}\do{z}\do{A}\do{B}\do{C}\do{D}\do{E}\do{F}\do{G}\do{H} +\do{I}\do{J}\do{K}\do{L}\do{M}\do{N}\do{O}\do{P}\do{Q}\do{R}\do{S}\do{T} +\do{U}\do{V}\do{W}\do{X}\do{Y}\do{Z}\relax} +\def\do##1{\global\mathcode`##1="8000} +\doallletters +\endgroup} +\activatemathletters + +% set up command to permit deactivation +\def\deactivatemathletters{% +\global\mathcode`A="7141\global\mathcode`B="7142\global\mathcode`C="7143 +\global\mathcode`D="7144\global\mathcode`E="7145\global\mathcode`F="7146 +\global\mathcode`G="7147\global\mathcode`H="7148\global\mathcode`I="7149 +\global\mathcode`J="714A\global\mathcode`K="714B\global\mathcode`L="714C +\global\mathcode`M="714D\global\mathcode`N="714E\global\mathcode`O="714F +\global\mathcode`P="7150\global\mathcode`Q="7151\global\mathcode`R="7152 +\global\mathcode`S="7153\global\mathcode`T="7154\global\mathcode`U="7155 +\global\mathcode`V="7156\global\mathcode`W="7157\global\mathcode`X="7158 +\global\mathcode`Y="7159\global\mathcode`Z="715A\global\mathcode`a="7161 +\global\mathcode`b="7162\global\mathcode`c="7163\global\mathcode`d="7164 +\global\mathcode`e="7165\global\mathcode`f="7166\global\mathcode`g="7167 +\global\mathcode`h="7168\global\mathcode`i="7169\global\mathcode`j="716A +\global\mathcode`k="716B\global\mathcode`l="716C\global\mathcode`m="716D +\global\mathcode`n="716E\global\mathcode`o="716F\global\mathcode`p="7170 +\global\mathcode`q="7171\global\mathcode`r="7172\global\mathcode`s="7173 +\global\mathcode`t="7174\global\mathcode`u="7175\global\mathcode`v="7176 +\global\mathcode`w="7177\global\mathcode`x="7178\global\mathcode`y="7179 +\global\mathcode`z="717A\relax} + +% set up definitions for active uppercase characters +{\def\\{A}\catcode`A=\active\xdefA{\noexpand\dolett@r{\\}{\mathchar"7141}}} +{\def\\{B}\catcode`B=\active\xdefB{\noexpand\dolett@r{\\}{\mathchar"7142}}} +{\def\\{C}\catcode`C=\active\xdefC{\noexpand\dolett@r{\\}{\mathchar"7143}}} +{\def\\{D}\catcode`D=\active\xdefD{\noexpand\dolett@r{\\}{\mathchar"7144}}} +{\def\\{E}\catcode`E=\active\xdefE{\noexpand\dolett@r{\\}{\mathchar"7145}}} +{\def\\{F}\catcode`F=\active\xdefF{\noexpand\dolett@r{\\}{\mathchar"7146}}} +{\def\\{G}\catcode`G=\active\xdefG{\noexpand\dolett@r{\\}{\mathchar"7147}}} +{\def\\{H}\catcode`H=\active\xdefH{\noexpand\dolett@r{\\}{\mathchar"7148}}} +{\def\\{I}\catcode`I=\active\xdefI{\noexpand\dolett@r{\\}{\mathchar"7149}}} +{\def\\{J}\catcode`J=\active\xdefJ{\noexpand\dolett@r{\\}{\mathchar"714A}}} +{\def\\{K}\catcode`K=\active\xdefK{\noexpand\dolett@r{\\}{\mathchar"714B}}} +{\def\\{L}\catcode`L=\active\xdefL{\noexpand\dolett@r{\\}{\mathchar"714C}}} +{\def\\{M}\catcode`M=\active\xdefM{\noexpand\dolett@r{\\}{\mathchar"714D}}} +{\def\\{N}\catcode`N=\active\xdefN{\noexpand\dolett@r{\\}{\mathchar"714E}}} +{\def\\{O}\catcode`O=\active\xdefO{\noexpand\dolett@r{\\}{\mathchar"714F}}} +{\def\\{P}\catcode`P=\active\xdefP{\noexpand\dolett@r{\\}{\mathchar"7150}}} +{\def\\{Q}\catcode`Q=\active\xdefQ{\noexpand\dolett@r{\\}{\mathchar"7151}}} +{\def\\{R}\catcode`R=\active\xdefR{\noexpand\dolett@r{\\}{\mathchar"7152}}} +{\def\\{S}\catcode`S=\active\xdefS{\noexpand\dolett@r{\\}{\mathchar"7153}}} +{\def\\{T}\catcode`T=\active\xdefT{\noexpand\dolett@r{\\}{\mathchar"7154}}} +{\def\\{U}\catcode`U=\active\xdefU{\noexpand\dolett@r{\\}{\mathchar"7155}}} +{\def\\{V}\catcode`V=\active\xdefV{\noexpand\dolett@r{\\}{\mathchar"7156}}} +{\def\\{W}\catcode`W=\active\xdefW{\noexpand\dolett@r{\\}{\mathchar"7157}}} +{\def\\{X}\catcode`X=\active\xdefX{\noexpand\dolett@r{\\}{\mathchar"7158}}} +{\def\\{Y}\catcode`Y=\active\xdefY{\noexpand\dolett@r{\\}{\mathchar"7159}}} +{\def\\{Z}\catcode`Z=\active\xdefZ{\noexpand\dolett@r{\\}{\mathchar"715A}}} + +% set up definitions for active uppercase characters +\begingroup +\let\CATCODE=\catcode \let\GDEF=\gdef \def\DOLETT@R{\noexpand\dolett@r} +\def\MATHCHAR{\mathchar} \let\ACTIVE=\active +\let\XDEF=\xdef \let\DEF=\def +{\DEF\\{a}\CATCODE`a=\ACTIVE\XDEFa{\DOLETT@R{\\}{\MATHCHAR"7161}}} +{\DEF\\{b}\CATCODE`b=\ACTIVE\XDEFb{\DOLETT@R{\\}{\MATHCHAR"7162}}} +{\DEF\\{c}\CATCODE`c=\ACTIVE\XDEFc{\DOLETT@R{\\}{\MATHCHAR"7163}}} +{\DEF\\{d}\CATCODE`d=\ACTIVE\XDEFd{\DOLETT@R{\\}{\MATHCHAR"7164}}} +{\DEF\\{e}\CATCODE`e=\ACTIVE\XDEFe{\DOLETT@R{\\}{\MATHCHAR"7165}}} +{\DEF\\{f}\CATCODE`f=\ACTIVE\XDEFf{\DOLETT@R{\\}{\MATHCHAR"7166}}} +{\DEF\\{g}\CATCODE`g=\ACTIVE\XDEFg{\DOLETT@R{\\}{\MATHCHAR"7167}}} +{\DEF\\{h}\CATCODE`h=\ACTIVE\XDEFh{\DOLETT@R{\\}{\MATHCHAR"7168}}} +{\DEF\\{i}\CATCODE`i=\ACTIVE\XDEFi{\DOLETT@R{\\}{\MATHCHAR"7169}}} +{\DEF\\{j}\CATCODE`j=\ACTIVE\XDEFj{\DOLETT@R{\\}{\MATHCHAR"716A}}} +{\DEF\\{k}\CATCODE`k=\ACTIVE\XDEFk{\DOLETT@R{\\}{\MATHCHAR"716B}}} +{\DEF\\{l}\CATCODE`l=\ACTIVE\XDEFl{\DOLETT@R{\\}{\MATHCHAR"716C}}} +{\DEF\\{m}\CATCODE`m=\ACTIVE\XDEFm{\DOLETT@R{\\}{\MATHCHAR"716D}}} +{\DEF\\{n}\CATCODE`n=\ACTIVE\XDEFn{\DOLETT@R{\\}{\MATHCHAR"716E}}} +{\DEF\\{o}\CATCODE`o=\ACTIVE\XDEFo{\DOLETT@R{\\}{\MATHCHAR"716F}}} +{\DEF\\{p}\CATCODE`p=\ACTIVE\XDEFp{\DOLETT@R{\\}{\MATHCHAR"7170}}} +{\DEF\\{q}\CATCODE`q=\ACTIVE\XDEFq{\DOLETT@R{\\}{\MATHCHAR"7171}}} +{\DEF\\{r}\CATCODE`r=\ACTIVE\XDEFr{\DOLETT@R{\\}{\MATHCHAR"7172}}} +{\DEF\\{s}\CATCODE`s=\ACTIVE\XDEFs{\DOLETT@R{\\}{\MATHCHAR"7173}}} +{\DEF\\{t}\CATCODE`t=\ACTIVE\XDEFt{\DOLETT@R{\\}{\MATHCHAR"7174}}} +{\DEF\\{u}\CATCODE`u=\ACTIVE\XDEFu{\DOLETT@R{\\}{\MATHCHAR"7175}}} +{\DEF\\{v}\CATCODE`v=\ACTIVE\XDEFv{\DOLETT@R{\\}{\MATHCHAR"7176}}} +{\DEF\\{w}\CATCODE`w=\ACTIVE\XDEFw{\DOLETT@R{\\}{\MATHCHAR"7177}}} +{\DEF\\{x}\CATCODE`x=\ACTIVE\XDEFx{\DOLETT@R{\\}{\MATHCHAR"7178}}} +{\DEF\\{y}\CATCODE`y=\ACTIVE\XDEFy{\DOLETT@R{\\}{\MATHCHAR"7179}}} +{\DEF\\{z}\CATCODE`z=\ACTIVE\XDEFz{\DOLETT@R{\\}{\MATHCHAR"717A}}} +\endgroup + +% allocate registers and initialize +\newtoks\cod@toks +\newtoks\lett@rtoks +\newcount\tracingrecognition +\newcount\dorecognition +\newcount\readyneww@rd +\newcount\charsinw@rd +\tracingrecognition=0 +\dorecognition=1 +\readyneww@rd=1 + +% set up spaces so that if \mak@spacesordin@ry is declared the next whitespace +% character (space, tab, return) will be an ordinary nonletter character. +% effect is undone by \restor@regularspaces + +\def\mak@spacesordin@ry{% +\catcode`\ =12\catcode`\^^I=12\catcode`\^^M=12\relax} + +\def\restor@regularspaces{\catcode`\ =10\catcode`\^^I=10\catcode`\^^M=5\relax} + +% macro to process a letter in mathmode: save forms of letter on +% appropriate token lists, and take appropriate action if letter +% is the first or last in a word +\def\dolett@r#1#2{\ifodd\dorecognition + \ifodd\readyneww@rd\beginmathw@rd\fi + \edef\worddef##1{##1={\the\cod@toks#2}}\worddef\cod@toks + \edef\worddef##1{##1={\the\lett@rtoks\noexpand#1}}\worddef\lett@rtoks + \advance\charsinw@rd by 1 + \let\enddolett@r=\rec@gnitionenddolett@r + \else + \def\enddolett@r{#2}\fi + \enddolett@r} +\def\rec@gnitionenddolett@r{\futurelet\n@xttok@n\ch@ckn@xttok@n} + +% macro to decide whether or not next token is special case: +% if open-brace or close-brace follows, simply terminate word; +% otherwise do more extensive processing which involves +% slightly more "destructive" processing on the next token (in that it +% becomes a macro argument). +\def\ch@ckn@xttok@n{\def\trailing@cs{}\ifx\n@xttok@n\bgroup + \simpl@endw@rd\else + \ifx\n@xttok@n\egroup + \simpl@endw@rd\else + \def\fin@l@cs{\ch@ckn@xtargum@nt}\fi + \fi + \fin@l@cs} + +% macro to terminate word without messing with subsequent tokens +\def\simpl@endw@rd{\def\fin@l@cs{\endmathw@rd\trailing@cs}} + +% macro to see if next token is a letter; if not, terminates word +\def\ch@ckn@xtargum@nt#1{\ifcat\noexpand#1a\else + \endmathw@rd\fi + \trailing@cs#1} + +% macro to do initialization needed at the beggining of a new word +\def\beginmathw@rd{\readyneww@rd=0 + \charsinw@rd=0 + \cod@toks={}\lett@rtoks={}\mak@spacesordin@ry} + +% macro to do appropriate processing at the end of a word +\def\endmathw@rd{\restor@regularspaces + \readyneww@rd=1 + % ready to start new word (new word could be generated by control sequence) + \ifnum\charsinw@rd=1 + \the\cod@toks % don't recognize single letters as control sequences + \else + \expandafter\ifx\csname\the\lett@rtoks\endcsname\relax + \the\cod@toks + \else \expandafter\def\expandafter\trailing@cs\expandafter + {\csname\the\lett@rtoks\endcsname}\ifnum + \tracingrecognition>0 + \immediate\write16{{Recognized math sequence: \expandafter + \string\csname\the\lett@rtoks\endcsname}}\fi + \fi + \fi} + +% macros to block excessive recognition + +% redefine macro to turn off recognition, then expand +\def\norecogafter#1{{\let\t@mp@@@=#1% +\xdef#1{\noexpand\ifmmode\dorecognition=0\noexpand\fi\t@mp@@@}}} + +% redefine argumentless macro to turn off recognition only while it expands +% expansion is done within a group (so side-effects are only local unless +% explicitly global) +\def\norecogwithin#1{{\let\t@mp@@@=#1% +\xdef#1{\begingroup\dorecognition=0\t@mp@@@\endgroup}}} + +% set up \rm so that it disables subsequent recognition +\let\originalrm=\rm +\norecogafter{\rm} + +% attempt to restore prior catcode for @ +\ifatsignwasaletter +\else + % hide private names + \catcode`@=12 +\fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/macros/plain/contrib/misc/mssymb.tex b/macros/plain/contrib/misc/mssymb.tex new file mode 100644 index 0000000000..79bd496853 --- /dev/null +++ b/macros/plain/contrib/misc/mssymb.tex @@ -0,0 +1,279 @@ +% ***** MSSYMB.TeX ***** 31 Mar 88 +% +% This file contains the definitions for the symbols in the two +% "extra symbols" fonts created at the American Math. Society. + +\catcode`\@=11 + +\font\tenmsx=msxm10 +\font\sevenmsx=msxm7 +\font\fivemsx=msxm5 +\font\tenmsy=msym10 +\font\sevenmsy=msym7 +\font\fivemsy=msym5 +\newfam\msxfam +\newfam\msyfam +\textfont\msxfam=\tenmsx \scriptfont\msxfam=\sevenmsx + \scriptscriptfont\msxfam=\fivemsx +\textfont\msyfam=\tenmsy \scriptfont\msyfam=\sevenmsy + \scriptscriptfont\msyfam=\fivemsy + +\def\hexnumber@#1{\ifcase#1 0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or + A\or B\or C\or D\or E\or F\fi } + +\def\relaxnext@{\let\next\relax} +\def\noaccents@{\def\accentfam@{0}} + +% The following 13 lines establish the use of the Euler Fraktur font. +% To use this font, remove % from beginning of these lines. +%\font\teneuf=eufm10 +%\font\seveneuf=eufm7 +%\font\fiveeuf=eufm5 +%\newfam\euffam +%\textfont\euffam=\teneuf +%\scriptfont\euffam=\seveneuf +%\scriptscriptfont\euffam=\fiveeuf +%\def\frak{\relaxnext@\ifmmode\let\next\frak@\else +% \def\next{\Err@{Use \string\frak\space only in math mode}}\fi\next} +%\def\goth{\relaxnext@\ifmmode\let\next\frak@\else +% \def\next{\Err@{Use \string\goth\space only in math mode}}\fi\next} +%\def\frak@#1{{\frak@@{#1}}} +%\def\frak@@#1{\noaccents@\fam\euffam#1} +% End definition of Euler Fraktur font. + +\edef\msx@{\hexnumber@\msxfam} +\edef\msy@{\hexnumber@\msyfam} + +\mathchardef\boxdot="2\msx@00 +\mathchardef\boxplus="2\msx@01 +\mathchardef\boxtimes="2\msx@02 +\mathchardef\square="0\msx@03 +\mathchardef\blacksquare="0\msx@04 +\mathchardef\centerdot="2\msx@05 +\mathchardef\lozenge="0\msx@06 +\mathchardef\blacklozenge="0\msx@07 +\mathchardef\circlearrowright="3\msx@08 +\mathchardef\circlearrowleft="3\msx@09 +\mathchardef\rightleftharpoons="3\msx@0A +\mathchardef\leftrightharpoons="3\msx@0B +\mathchardef\boxminus="2\msx@0C +\mathchardef\Vdash="3\msx@0D +\mathchardef\Vvdash="3\msx@0E +\mathchardef\vDash="3\msx@0F +\mathchardef\twoheadrightarrow="3\msx@10 +\mathchardef\twoheadleftarrow="3\msx@11 +\mathchardef\leftleftarrows="3\msx@12 +\mathchardef\rightrightarrows="3\msx@13 +\mathchardef\upuparrows="3\msx@14 +\mathchardef\downdownarrows="3\msx@15 +\mathchardef\upharpoonright="3\msx@16 +\let\restriction=\upharpoonright +\mathchardef\downharpoonright="3\msx@17 +\mathchardef\upharpoonleft="3\msx@18 +\mathchardef\downharpoonleft="3\msx@19 +\mathchardef\rightarrowtail="3\msx@1A +\mathchardef\leftarrowtail="3\msx@1B +\mathchardef\leftrightarrows="3\msx@1C +\mathchardef\rightleftarrows="3\msx@1D +\mathchardef\Lsh="3\msx@1E +\mathchardef\Rsh="3\msx@1F +\mathchardef\rightsquigarrow="3\msx@20 +\mathchardef\leftrightsquigarrow="3\msx@21 +\mathchardef\looparrowleft="3\msx@22 +\mathchardef\looparrowright="3\msx@23 +\mathchardef\circeq="3\msx@24 +\mathchardef\succsim="3\msx@25 +\mathchardef\gtrsim="3\msx@26 +\mathchardef\gtrapprox="3\msx@27 +\mathchardef\multimap="3\msx@28 +\mathchardef\therefore="3\msx@29 +\mathchardef\because="3\msx@2A +\mathchardef\doteqdot="3\msx@2B +\let\Doteq=\doteqdot +\mathchardef\triangleq="3\msx@2C +\mathchardef\precsim="3\msx@2D +\mathchardef\lesssim="3\msx@2E +\mathchardef\lessapprox="3\msx@2F +\mathchardef\eqslantless="3\msx@30 +\mathchardef\eqslantgtr="3\msx@31 +\mathchardef\curlyeqprec="3\msx@32 +\mathchardef\curlyeqsucc="3\msx@33 +\mathchardef\preccurlyeq="3\msx@34 +\mathchardef\leqq="3\msx@35 +\mathchardef\leqslant="3\msx@36 +\mathchardef\lessgtr="3\msx@37 +\mathchardef\backprime="0\msx@38 +\mathchardef\risingdotseq="3\msx@3A +\mathchardef\fallingdotseq="3\msx@3B +\mathchardef\succcurlyeq="3\msx@3C +\mathchardef\geqq="3\msx@3D +\mathchardef\geqslant="3\msx@3E +\mathchardef\gtrless="3\msx@3F +\mathchardef\sqsubset="3\msx@40 +\mathchardef\sqsupset="3\msx@41 +\mathchardef\vartriangleright="3\msx@42 +\mathchardef\vartriangleleft="3\msx@43 +\mathchardef\trianglerighteq="3\msx@44 +\mathchardef\trianglelefteq="3\msx@45 +\mathchardef\bigstar="0\msx@46 +\mathchardef\between="3\msx@47 +\mathchardef\blacktriangledown="0\msx@48 +\mathchardef\blacktriangleright="3\msx@49 +\mathchardef\blacktriangleleft="3\msx@4A +\mathchardef\vartriangle="0\msx@4D +\mathchardef\blacktriangle="0\msx@4E +\mathchardef\triangledown="0\msx@4F +\mathchardef\eqcirc="3\msx@50 +\mathchardef\lesseqgtr="3\msx@51 +\mathchardef\gtreqless="3\msx@52 +\mathchardef\lesseqqgtr="3\msx@53 +\mathchardef\gtreqqless="3\msx@54 +\mathchardef\Rrightarrow="3\msx@56 +\mathchardef\Lleftarrow="3\msx@57 +\mathchardef\veebar="2\msx@59 +\mathchardef\barwedge="2\msx@5A +\mathchardef\doublebarwedge="2\msx@5B +\mathchardef\angle="0\msx@5C +\mathchardef\measuredangle="0\msx@5D +\mathchardef\sphericalangle="0\msx@5E +\mathchardef\varpropto="3\msx@5F +\mathchardef\smallsmile="3\msx@60 +\mathchardef\smallfrown="3\msx@61 +\mathchardef\Subset="3\msx@62 +\mathchardef\Supset="3\msx@63 +\mathchardef\Cup="2\msx@64 +\let\doublecup=\Cup +\mathchardef\Cap="2\msx@65 +\let\doublecap=\Cap +\mathchardef\curlywedge="2\msx@66 +\mathchardef\curlyvee="2\msx@67 +\mathchardef\leftthreetimes="2\msx@68 +\mathchardef\rightthreetimes="2\msx@69 +\mathchardef\subseteqq="3\msx@6A +\mathchardef\supseteqq="3\msx@6B +\mathchardef\bumpeq="3\msx@6C +\mathchardef\Bumpeq="3\msx@6D +\mathchardef\lll="3\msx@6E +\let\llless=\lll +\mathchardef\ggg="3\msx@6F +\let\gggtr=\ggg +\mathchardef\circledS="0\msx@73 +\mathchardef\pitchfork="3\msx@74 +\mathchardef\dotplus="2\msx@75 +\mathchardef\backsim="3\msx@76 +\mathchardef\backsimeq="3\msx@77 +\mathchardef\complement="0\msx@7B +\mathchardef\intercal="2\msx@7C +\mathchardef\circledcirc="2\msx@7D +\mathchardef\circledast="2\msx@7E +\mathchardef\circleddash="2\msx@7F +\def\ulcorner{\delimiter"4\msx@70\msx@70 } +\def\urcorner{\delimiter"5\msx@71\msx@71 } +\def\llcorner{\delimiter"4\msx@78\msx@78 } +\def\lrcorner{\delimiter"5\msx@79\msx@79 } +\def\yen{\mathhexbox\msx@55 } +\def\checkmark{\mathhexbox\msx@58 } +\def\circledR{\mathhexbox\msx@72 } +\def\maltese{\mathhexbox\msx@7A } +\mathchardef\lvertneqq="3\msy@00 +\mathchardef\gvertneqq="3\msy@01 +\mathchardef\nleq="3\msy@02 +\mathchardef\ngeq="3\msy@03 +\mathchardef\nless="3\msy@04 +\mathchardef\ngtr="3\msy@05 +\mathchardef\nprec="3\msy@06 +\mathchardef\nsucc="3\msy@07 +\mathchardef\lneqq="3\msy@08 +\mathchardef\gneqq="3\msy@09 +\mathchardef\nleqslant="3\msy@0A +\mathchardef\ngeqslant="3\msy@0B +\mathchardef\lneq="3\msy@0C +\mathchardef\gneq="3\msy@0D +\mathchardef\npreceq="3\msy@0E +\mathchardef\nsucceq="3\msy@0F +\mathchardef\precnsim="3\msy@10 +\mathchardef\succnsim="3\msy@11 +\mathchardef\lnsim="3\msy@12 +\mathchardef\gnsim="3\msy@13 +\mathchardef\nleqq="3\msy@14 +\mathchardef\ngeqq="3\msy@15 +\mathchardef\precneqq="3\msy@16 +\mathchardef\succneqq="3\msy@17 +\mathchardef\precnapprox="3\msy@18 +\mathchardef\succnapprox="3\msy@19 +\mathchardef\lnapprox="3\msy@1A +\mathchardef\gnapprox="3\msy@1B +\mathchardef\nsim="3\msy@1C +%\mathchardef\napprox="3\msy@1D +\mathchardef\ncong="3\msy@1D +\def\napprox{\not\approx} +\mathchardef\varsubsetneq="3\msy@20 +\mathchardef\varsupsetneq="3\msy@21 +\mathchardef\nsubseteqq="3\msy@22 +\mathchardef\nsupseteqq="3\msy@23 +\mathchardef\subsetneqq="3\msy@24 +\mathchardef\supsetneqq="3\msy@25 +\mathchardef\varsubsetneqq="3\msy@26 +\mathchardef\varsupsetneqq="3\msy@27 +\mathchardef\subsetneq="3\msy@28 +\mathchardef\supsetneq="3\msy@29 +\mathchardef\nsubseteq="3\msy@2A +\mathchardef\nsupseteq="3\msy@2B +\mathchardef\nparallel="3\msy@2C +\mathchardef\nmid="3\msy@2D +\mathchardef\nshortmid="3\msy@2E +\mathchardef\nshortparallel="3\msy@2F +\mathchardef\nvdash="3\msy@30 +\mathchardef\nVdash="3\msy@31 +\mathchardef\nvDash="3\msy@32 +\mathchardef\nVDash="3\msy@33 +\mathchardef\ntrianglerighteq="3\msy@34 +\mathchardef\ntrianglelefteq="3\msy@35 +\mathchardef\ntriangleleft="3\msy@36 +\mathchardef\ntriangleright="3\msy@37 +\mathchardef\nleftarrow="3\msy@38 +\mathchardef\nrightarrow="3\msy@39 +\mathchardef\nLeftarrow="3\msy@3A +\mathchardef\nRightarrow="3\msy@3B +\mathchardef\nLeftrightarrow="3\msy@3C +\mathchardef\nleftrightarrow="3\msy@3D +\mathchardef\divideontimes="2\msy@3E +\mathchardef\varnothing="0\msy@3F +\mathchardef\nexists="0\msy@40 +\mathchardef\mho="0\msy@66 +\mathchardef\eth="0\msy@67 +\mathchardef\eqsim="3\msy@68 +\mathchardef\beth="0\msy@69 +\mathchardef\gimel="0\msy@6A +\mathchardef\daleth="0\msy@6B +\mathchardef\lessdot="3\msy@6C +\mathchardef\gtrdot="3\msy@6D +\mathchardef\ltimes="2\msy@6E +\mathchardef\rtimes="2\msy@6F +\mathchardef\shortmid="3\msy@70 +\mathchardef\shortparallel="3\msy@71 +\mathchardef\smallsetminus="2\msy@72 +\mathchardef\thicksim="3\msy@73 +\mathchardef\thickapprox="3\msy@74 +\mathchardef\approxeq="3\msy@75 +\mathchardef\succapprox="3\msy@76 +\mathchardef\precapprox="3\msy@77 +\mathchardef\curvearrowleft="3\msy@78 +\mathchardef\curvearrowright="3\msy@79 +\mathchardef\digamma="0\msy@7A +\mathchardef\varkappa="0\msy@7B +\mathchardef\hslash="0\msy@7D +\mathchardef\hbar="0\msy@7E +\mathchardef\backepsilon="3\msy@7F +% Use the next 4 lines with AMS-TeX: +%\def\Bbb{\relaxnext@\ifmmode\let\next\Bbb@\else +% \def\next{\Err@{Use \string\Bbb\space only in math mode}}\fi\next} +%\def\Bbb@#1{{\Bbb@@{#1}}} +%\def\Bbb@@#1{\noaccents@\fam\msyfam#1} +% Use the next 4 lines if NOT using AMS-TeX: +\def\Bbb{\ifmmode\let\next\Bbb@\else + \def\next{\errmessage{Use \string\Bbb\space only in math mode}}\fi\next} +\def\Bbb@#1{{\Bbb@@{#1}}} +\def\Bbb@@#1{\fam\msyfam#1} + +\catcode`\@=12 diff --git a/macros/plain/contrib/misc/multihead.tex b/macros/plain/contrib/misc/multihead.tex new file mode 100644 index 0000000000..93697be5b8 --- /dev/null +++ b/macros/plain/contrib/misc/multihead.tex @@ -0,0 +1,11 @@ +%%%--------------Cut along perforation-------------------------------- +% Macro for multiple line header. +% By Don Hosek <DHOSEK@HMCVAX.BITNET> +% To use: +% \multihead{...} +% If the header has more than one line, separate the lines with \\ +\newtoks\multihead +\headline{\vtop{\let\\=\cr\halign{\line{#}\cr + \the\multihead\crcr}}} +\multihead{\hss} +%%%--------------Tear neatly------------------------------------------ diff --git a/macros/plain/contrib/misc/newinsert.tex b/macros/plain/contrib/misc/newinsert.tex new file mode 100644 index 0000000000..bb37c41c76 --- /dev/null +++ b/macros/plain/contrib/misc/newinsert.tex @@ -0,0 +1,140 @@ + + +%%% ==================================================================== +%%% @TeX-file{ +%%% author = "Walter D. Neumann", +%%% version = "1.2", +%%% date = "22 July 1992", +%%% time = "15:57:20 EDT", +%%% filename = "newinsert.tex", +%%% address = "Department of Mathematics +%%% Ohio State University +%%% Columbus, OH 43201 +%%% USA", +%%% email = "neumann@mps.ohio-state.edu (Internet)", +%%% codetable = "ISO/ASCII", +%%% keywords = "plain TeX, AMS-TeX, inserts, figures", +%%% supported = "yes", +%%% abstract = "Bug fixes to plain TeX macros \midinsert and +%%% \topinsert", +%%% } +%%% ==================================================================== + +% Include with "\input newinsert.tex" to fix following problems +% with plain TeX's handling of \midinsert and \topinsert: +% +% 1. An insert that falls at the top of the page is too high: its +% top is at top-of-page rather than top-of-ink. +% 2. Plain uses \bigskip for space around inserts and assumes \bigskip +% is 12pt plus stretch, so \midinsert misbehaves if \bigskipamount +% is changed. This space should be an independent quantity. +% 3. Consecutive midinserts that did not float are spaced twice +% as far apart as consecutive topinserts or floated midinserts. +% 4. Midinserts can get out of order (see Exercise 15.5 of TeXbook). +% 5. A midinsert can incorrectly convert to a topinsert if TeX is +% reading ahead (see top of page 116 of TeXbook). +% 6. \removelastskip fails after a floated insert. This is relevant for +% an insertion before any construction (such as a proclamation in +% plain TeX) that does an explicit or implicit \removelastskip. +% 7. The routine to split an insertion in the program TeX fails if +% the insertion would fit on the current page after subtracting +% shrink. To avoid this, INSERTIONS SHOULD NOT CONTAIN SHRINK. +% +% Remaining problem: With the default values of 10pt and 12pt for +% \topskip and \baselineskip, TeX puts 2pt less space between a +% topinsert or floated midinsert and following text than between a +% middle insertion and following text. To avoid this without rewriting +% the plain output routine use: +% +% \topskip=\baselineskip +% +% PARAMETERS: +% Plain.tex puts \bigskipamount of space before and after inserts. As +% described above, this should be an independent parameter with no shrink. +% We provide \insertskipamount for this purpose (default 6pt plus 2pt; +% this makes \insertskip behave like an unshrinkable \medskip). +% In addition, \inserthardskipamount of glue is added at the top of EVERY +% insert; it remains even at top of page (default 6pt; it should be at +% least \topskipamount-(text height)). +% These defaults give good balance for figure insertions of the form: +% \midinsert +% [Commands to include a graphics file] +% \insertskip \centerline{Figure Title} +% \endinsert. +% Note use of \insertskip instead of \medskip to avoid shrink. +% +\chardef\newinsCatAt\the\catcode `\@ +\catcode `\@=11 +% +%%%%%%%%%%%% Corrected insert macros for plain.tex %%%%%%%%%%%%%%%%% +% +% New skipamounts: +% +\newskip\insertskipamount\newskip\inserthardskipamount +\insertskipamount 6pt plus2pt % Redefine as desired, but with no +\inserthardskipamount 6pt % shrink (see above). +\def\insertskip{\vskip\insertskipamount} +% +% Save and restore \lastskip: +% +\newskip\LastSkip +\def\SaveLastSkip{\LastSkip\lastskip} +\def\RestoreLastSkip{\nobreak\vskip-\LastSkip\vskip\LastSkip} +% +% Larry Siebenmann's test for split topinserts: +% +\newcount\SplitTest% will be set to -1 if a topinsert has split +\def\SetSplitTest{\SplitTest\insertpenalties + \insert\topins{\floatingpenalty1}% + \advance\SplitTest-\insertpenalties} +% +% From here on we modify definitions in plain.tex. +% +% Redefine \midinsert to convert to \topinsert if a topinsert has been +% split, to prevent midinserts getting out of order (cf. TeXbook Exercise +% 15.5). As in plain.tex, a \midinsert still converts to a \topinsert +% (which then splits) if the insert is too big for current page. +% Was: \def\midinsert{\@midtrue\@ins} +\def\midinsert{\par + \SaveLastSkip\penalty-150\SetSplitTest\RestoreLastSkip + \ifnum\SplitTest=-1 + \@midfalse\else\@midtrue\fi\@ins} +% Redefine \@ins to add \inserthardskipamount of glue above. +% Was: \def\@ins{\par\begingroup\setbox\z@\vbox\bgroup} +\def\@ins{\par\begingroup\setbox\z@\vbox\bgroup% + \vglue\inserthardskipamount} +% Changes to \endinsert of plain.tex 3.0: +% - Use \insertskipamount instead of \bigskipamount throughout. +% - Use larger of previous skip and insertskip before middle insert. +% - Add \nointerlineskip to avoid unwanted extra 1pt skip. +% - Save and restore lastskip when an insert floats. +\def\endinsert{\egroup % finish the \vbox + \if@mid \dimen@\ht\z@ \advance\dimen@\dp\z@ + \advance\dimen@\insertskipamount% was 12pt (wn) + \advance\dimen@\pagetotal\advance\dimen@-\pageshrink + \ifdim\dimen@>\pagegoal\@midfalse\p@gefalse\fi\fi +% Next 3 lines replace: \if@mid \bigskip\box\z@\bigbreak (wn) + \if@mid% + \ifdim\lastskip<\insertskipamount\removelastskip\insertskip\fi + \nointerlineskip\box\z@\penalty-200\insertskip + \else% + \SaveLastSkip% added (wn) + \insert\topins{\penalty100 % floating insertion + \splittopskip\z@skip + \splitmaxdepth\maxdimen \floatingpenalty\z@ + \ifp@ge \dimen@\dp\z@ + \vbox to\vsize{\unvbox\z@\kern-\dimen@}% depth is zero + \else \box\z@\nobreak\insertskip\fi}% was \bigskip\fi (wn) + \RestoreLastSkip% added (wn) + \fi\endgroup} +%%%%%%%%%%%%%%%%%% Done correcting insert macros %%%%%%%%%%%%%%%%%%% +% +\catcode `\@=\newinsCatAt +\endinput +%% end newinsert.tex +%% Revision history: +%% Version 1.2, 21 July 1992: midinserts still occasionally converted +%% wrongly to topinsert if Tex is scanning ahead. Added \penalty-150 +%% to fix this. +% Changed \medskipamount to 6pt plus2pt to avoid shrink in inserts. +%% Version 1.1, 02 April 1990: used L.Siebenmann's split test diff --git a/macros/plain/contrib/misc/nofill.tex b/macros/plain/contrib/misc/nofill.tex new file mode 100644 index 0000000000..38ec3b0d0a --- /dev/null +++ b/macros/plain/contrib/misc/nofill.tex @@ -0,0 +1,53 @@ +% macros for no-fill, built on Plain + +\catcode`\@=11\relax % allow @ in macro names + +% a simple no-fill, used as +% +% \nofill +% Here is some no-fill text. +% This line starts with three spaces. +% This is the last line. It has embedded spaces which will appear. +% \endnofill +% +% You might want to switch to a fixed-width font when you use +% these macros. + +\def\nofill {% + \begingroup + % spaces made active so they can be tested for at start of lines + % and so multiple spaces aren't collapsed to one. + \obeyspaces + % nofill via every line a par; if spaces start next line + % we do a \noindent to make sure a par gets started. + \parskip=\z@ + \parindent=\z@ + \let\p@r=\par + \def\par{\p@r \ifspacenext{\noindent}{}}% + \obeylines} + +\def\endnofill {% + \p@r % in case user forgot last carriage return + \endgroup} + +% \ifspacenext is used as: +% \ifspacenext {<true tokens>}{<false tokens>} +% It executes the true tokens if +% the next character is an active space, the false tokens +% otherwise. The same technique can be used to check for any +% character, not just active space. + +% You can NOT nest uses of \ifspacenext! + +% get a token which is \ifx-equal to active space, so we can test +% for it +{\obeyspaces\global\let\sp@ce= \relax} + +\def\ifspacenext #1#2{% + \def\truet@ks{#1}% + \def\falset@ks{#2}% + \futurelet\next\ifsp@cenext} +\def\ifsp@cenext {% + \ifx\next\sp@ce \truet@ks \else \falset@ks \fi} + +\catcode`\@=12\relax % make @ inaccessible again diff --git a/macros/plain/contrib/misc/oubraces.sty b/macros/plain/contrib/misc/oubraces.sty new file mode 120000 index 0000000000..25aa2015ce --- /dev/null +++ b/macros/plain/contrib/misc/oubraces.sty @@ -0,0 +1 @@ +../../../latex/contrib/oubraces/oubraces.sty
\ No newline at end of file diff --git a/macros/plain/contrib/misc/outline.sty b/macros/plain/contrib/misc/outline.sty new file mode 100644 index 0000000000..77c82f0779 --- /dev/null +++ b/macros/plain/contrib/misc/outline.sty @@ -0,0 +1,79 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% outline.sty -- Outline Style +% Hal R. Varian +% September, 1987 +% +% Reads structured files generated by PC-OUTLINE and formats them +% in TeX. Before using you must use a global search and replace command +% to change all strings of ".HEAD" to "\HEAD". Then load outline.sty +% and TeX the outline file. +% +% Notes +% 1. To generate the outline, choose "Send to structured file" from the +% device menu in the print routine of PC-OUTLINE. +% 2. The title must be indicated manually using \title. It is usually +% indicated by a .HEAD 1 +% 3. Sometimes the structured file ends with a spurious .HEAD 1 which should +% be removed. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%for title +\def\title#1{\centerline{\bf #1}\medskip} + +%use \count11 thru \count18 for counters for levels 1 thru 8 + +\count11=0 +\count12=0 +\count13=0 +\count14=0 +\count15=0 +\count16=0 +\count17=0 +\count18=0 + +%create registers for levels, etc. + +\newcount\CurrentLevel\CurrentLevel=0 +\newcount\LastLevel\LastLevel=0 +\newcount\CurrentCounter\CurrentCounter=1 +\newcount\CharCode\CharCode=96 + +%\Indentation measures the amount of indentation +\newdimen\Indentation\Indentation=3ex + +%skip between level 1 headings +\def\AdjustSpace{\vskip -.5pc} + +\parindent=0pt +\parskip=0pt + +\def\HEAD #1 {% +\par +\CurrentLevel=#1 +\CurrentCounter=#1 +\advance\CurrentCounter by 10 %level 1 is assigned to register 11, etc. +\ifnum\CurrentLevel>\LastLevel %if sublevel, + \count\CurrentCounter=1 %reset \CurrentCounter, + \else\advance\count\CurrentCounter by 1\fi %otherwise, increment +\LastLevel=\CurrentLevel +\filbreak %helps prevent entries from being split between pages +\hskip\CurrentLevel\Indentation +\CharCode=\number\count\CurrentCounter %for lettered levels +\let\NumCode=\CharCode %for numbered levels +\ifcase#1% +\relax\or %there is no level zero + \AdjustSpace\advance\CharCode by 64 +\Item\char\CharCode.\space\or %level 1: A. +\Item\llap{\number\NumCode.\space}\or %level 2: 1. + \advance\CharCode by 96 +\Item\llap{\char\CharCode)\space}\or %level 3: a) +\Item\llap{\number\NumCode)\space}\or %level 4: 1) + \advance\CharCode by 96 +\Item\llap{\char\CharCode$>$\space}\or %level 5: a> +\Item\llap{\number\NumCode$>$\space}\or %level 6: 1> + \advance\CharCode by 96 +\Item\llap{\char\CharCode:\space}\or %level 7: a: +\Item\llap{\number\NumCode:\space}\fi} %level 8: 1: + +\def\Item{\hangindent\CurrentLevel\Indentation} +%%%-Incise---------------------------------------------------------- diff --git a/macros/plain/contrib/misc/paragraphs.tex b/macros/plain/contrib/misc/paragraphs.tex new file mode 100644 index 0000000000..c618c54cfb --- /dev/null +++ b/macros/plain/contrib/misc/paragraphs.tex @@ -0,0 +1,91 @@ +% +% some of the old Tbase paragraphing macros (built on Plain TeX) +% +% These macros demonstrate common uses for the +% \hangindent, \hangafter, \indent, \noindent, \everypar, +% \lastbox, and \the commands. +% + +\catcode`\@=11\relax % make @ a letter for use in macro names + +% +% N.B. These macros do not set a ``paragraphing mode,'' as +% they used to in Tbase; they apply only to the immediately +% following paragraph. +% +% The right way to use one of the macros is, e.g., +% +% \ivp This is an inverted paragraph... +% and so on, and so on... +% +\def\ivp {% inverted paragraph, all but 1st line indented + \hangindent \parindent + \hangafter \@ne + \noindent} + +\def\ip {% indented paragraph, all lines indented + \hangindent \parindent + \hangafter \@ne + \indent} + +\def\ftp #1{% flush-tagged paragraph, like \ip but with tag on left margin + \hangindent \parindent + \hangafter \@ne + \noindent \hbox to\parindent{#1\hfil}\ignorespaces} + +\def\atp #1{% adjoint-tagged par, like \ftp but tag is next to first line + \hangindent \parindent + \hangafter \@ne + \indent \llap{#1\enspace}\ignorespaces} + +\def\bpar {% bullet-tagged paragraph + \ftp{$\bullet$}} + + +% +% vest paragraphs: +% After an interruption in the running text (such as a section +% title or in-line illustration), it is customary not to indent +% the first line of the next paragraph. The macro \vp arranges +% for this to be the case by making sure that \unindent gets +% called as soon as the paragraph starts. \unindent simply +% removes the \indent box that TeX automatically puts at the +% start of every paragraph (except those which start with +% \noindent). +% +\def\unindent {% + \setbox0=\lastbox} % get the indent box and discard it + +\def\vp {% + \everypar{\unindent\everypar{}}} + + +% +% the \heading macro puts out a bold-faced unindented heading, +% and then calls \vp to insure that the next paragraph does not +% start with an indentation. +% No break is allowed between the heading and the paragraph. +% +\def\heading #1{% + \vskip 1ex + {\bf\noindent #1\par} + \nobreak + \vskip.5ex + \vp} + + +% +% These next two macros are a convenient way of turning +% indentation off and then on again. The macro \fp +% sets \parindent to 0, but not before defining the macro \pp so +% that it restores \parindent to what it was. The \edef command +% in conjunction with the \the command actually put the +% value of \parindent into the text of the \pp command. +% Do \fp\show\pp to see what this means. +% +\def\fp {\edef\pp{\parindent=\the\parindent}\parindent=\z@} +\let\pp=\relax + + +% make @ back into a non-letter +\catcode`\@=12\relax diff --git a/macros/plain/contrib/misc/phoncard.tex b/macros/plain/contrib/misc/phoncard.tex new file mode 100644 index 0000000000..2d9b2fa365 --- /dev/null +++ b/macros/plain/contrib/misc/phoncard.tex @@ -0,0 +1,342 @@ +% +% Copyright 1990, Daniel R. Greening. Copying is permitted for any +% non-commercial purpose as long as this copyright and the +% documentation are retained on copies and derivative works. No +% warrantee is expressed or implied, and the author makes no claims +% about the usefulness, applicability, or correctness of the program. +% +% Greening Phonelist TeX Format. +% +% This thing is pretty cool, if I do say so myself. I've used it for +% several years. It formats phone numbers into a 9x9 block that looks +% like the picture that follows. The picture is simplified. There is +% enough room for decent sized names, long phone numbers (with area +% or country-codes and extensions), and addresses with 9-digit +% zipcodes. Print out the phone list example included and you'll +% see. +% +% ------------------+------------------+------------------ +% | sally W 784-7861 | dan W 784-7861 | zeke W 784-7861 | +% | H 271-2629 | H 271-2629 | H 271-2629 | +% | 12 Foster Ct | 12 Foster Ct | 12 Foster Ct | +% | New York,NY 10 | New York,NY 10 | Topeka,KS 1054 | +% | georgeW 444-adff | | clem W 444-adff | +% | schoolW 277-2222 | KANSAS | jethroW 277-2222 | +% | abe W 331-3333 | | abigaiH 331-3333 | +% | ron W 231-2341 | jeb W 231-2341 | emmy W 231-2341 | +% | | | | +% ------------------+------------------+------------------ +% | MICHIGAN | dan W 784-7861 | | +% | dan H 463-5788 | H 271-2629 | WASHINGTON | +% | 5582 Golfridge | 12 Foster Ct | | +% | Alma, MI,48801 | Lansing,MI 432 | nancy W 234-2223 | +% | W 623-3330 | georgeW 444-adff | georgeW 444-adff | +% | schoolW 277-2222 | schoolW 277-2222 | schoolW 277-2222 | +% | abe W 331-3333 | abe W 331-3333 | abe W 331-3333 | +% | ron W 231-2341 | ron W 231-2341 | ron W 231-2341 | +% | | | | +% ------------------+------------------+------------------ +% | jeff W 784-7861 | W 784-7861 | jack W 784-7861 | +% | H 271-2629 | H 271-2629 | H 271-2629 | +% | 12 Foster Ct | 12 Foster Ct | 12 Foster Ct | +% | New York,NY 10 | New York,NY 10 | New York,NY 10 | +% | georgeW 444-adff | georgeW 444-adff | georgeW 444-adff | +% | schoolW 277-2222 | schoolW 277-2222 | schoolW 277-2222 | +% | abe W 331-3333 | abe W 331-3333 | abe W 331-3333 | +% | ron W 231-2341 | ron W 231-2341 | ron W 231-2341 | +% | | | | +% ------------------+------------------+------------------ +% +% I typically take the output and cut it along the horizontal dividing +% lines, then staple the thing together on the left. If you fold it +% in half, it fits in a pocket or a largish wallet. If you want to +% stick it in a smaller wallet (and you are patient), you can tape the +% horizontal strips end-to-end and fan-fold it. It then occupies the +% space of a credit-card. +% +% HOW TO USE: +% +% Precede lines that contain a country, state or province header with +% ``$''. This is an example header for the sovereign state of California: +% +% $ CALIFORNIA +% +% Lines which contain a phone number work like this: +% +% person-name ; cat ; phone-number +% +% The ``cat'' is typically a one or two letter abbreviation, as in +% ``W'' for work, ``H'' for home, ``FX'' for FAX, ``P'' for parents, +% etc. The phone-number field defined in this macro package is large +% enough to accommodate the number ``999-999-9999x9999''. Here is an +% example: +% +% Alan Turing ; W ; 213-825-2266 +% ; H ; 914-784-7861 +% +% Finally, you indicate an address with the prefix ``>''. This simply +% indents the text which follows by one \quad. Here's a bigger +% example: +% +% $ CALIFORNIA +% +% Alan Turing ; W ; 213-825-2266 +% > UCLA Computer Science Dept. +% > Los Angeles, CA 90024-1647 +% +% ; H ; 914-784-7861 +% > 1243 Blenheim Lane +% > Los Angeles, CA 90025 +% +% Blank lines essentially mean nothing when the occur between these +% three constructs. +% +% If you want to include formatted paragraphs, you can do so, but you +% must terminate them with ``\par'' or with a blank line. +% +% Enjoy. If you make any interesting modifications, let me know. +% +% Dan Greening / dgreen@cs.ucla.edu +% +\font\rm=cmr5 +\font\bf=cmbx5 +% The following produces 3 column, 3 row output. +\hsize=2.0in +\vsize=3.0in +\voffset=-0.75in +\hoffset=-0.5in +\newdimen\fullhsize\global\fullhsize=7.5in +\newdimen\fullvsize\global\fullvsize=10.5in +\newdimen\hboxsize\global\hboxsize=\hsize\advance\hboxsize by 0.5in +\newdimen\vboxsize\global\vboxsize=\vsize\advance\vboxsize by 0.5in +\def\fullhbox{\hbox to\fullhsize} +\def\fullvbox{\vbox to\fullvsize} +\newcount\colcount \global\colcount=11 +\newcount\rowcount \global\rowcount=5 +\baselineskip=6 pt plus 1pt +\parindent 0pt +\newcount\boxnum +% +% Define argument to accept ^^M as a terminator for a macro (such as +% ;, $, and >. +% +\def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx} +\def\parseargx{% +\ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else% +\aftergroup \parseargline % +\fi \endgroup} +{\obeyspaces % +\gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}} +\gdef\obeyedspace{\ } +\def\parseargline{\begingroup \obeylines \parsearglinex} +{\obeylines % +\gdef\parsearglinex #1^^M{\endgroup \next {#1}}} +% +\def\initcolbox#1 {\global\setbox#1=\vbox to\vboxsize{\hrule\vss\hbox % +to\hboxsize{\vrule height\vboxsize\hfil\vrule height\vboxsize}\vss\hrule}} +\def\initcolboxes{ \initcolbox11 \initcolbox12 \initcolbox13 \initcolbox14 + \initcolbox15 \initcolbox16 \initcolbox17 + \initcolbox18 \initcolbox19 } +\def\outputpage{\shipout\fullhbox{\fullvbox{\box11\vss\box14\vss\box17}\hss + \fullvbox{\box12\vss\box15\vss\box18}\hss + \fullvbox{\box13\vss\box16\vss\box19}}} +\initcolboxes +\output={ + \global\setbox\colcount=\vbox to \vboxsize + {\hrule width\hboxsize\vss\hbox to \hboxsize + {\vrule height\vboxsize\hss\columnbox\hss\vrule height\vboxsize} + \vss\hrule width\hboxsize} +% Current column is now saved. + \message{(\the\colcount)} + \ifnum\colcount=19 + \global\colcount=11 + \outputpage + \advancepageno + \initcolboxes + \else + \global\advance\colcount by 1 + \fi +% For the very end. + \ifnum\outputpenalty>-100000 \else + \supereject\outputpage\fi +} +\def\columnbox{\vbox to\vboxsize{\vfill\hbox{\vbox to\vsize{\unvbox255\vfill}}\vfill}} +% +% Here we define ``$'' ``>'' and ``;'' as active macro +% characters. They serve as separators for fields in our phone list. +% +\rm + \newdimen\widthb + \global\setbox0=\hbox{WE} + \widthb=\wd0 + \newdimen\widthc + \global\setbox0=\hbox{999-999-9999x9999} + \widthc=\wd0 +% +\catcode`\;=\active +{ + \catcode`\;=11 + \gdef\phonelineyyy #1;#2;#3\finish{ + \catcode`\;=\active\hfill + \hbox to\widthb{\hfil\ignorespaces #1\hfil} + \hbox to 0.05in{\hfil} + \hbox to\widthc{\ignorespaces #2\hfil} + \par} + \gdef\phoneline #1{\catcode`\;=11\phonelineyyy #1;;;\finish} +} +\outer\def;{\catcode`\;=11\parsearg\phoneline} +% +\catcode`\>=\active +\def\addressline#1{\hbox to\hsize{\quad\ignorespaces #1\hfil}\par} +\def>{\parsearg\addressline} +% +\catcode`\$=\active +\def\arealine#1{\vbox to 1pt{\vfil}\hbox to\hsize{\hfil{\bf\ignorespaces #1}\hfil}\vbox to 1pt{\vfil}} +\def${\parsearg\arealine} + +$ SOUTHERN CALIFORNIA + +Daniel R. Greening ; W ; 213-825-2266 + ; H ; 213-829-7726 +> 3436 Boelter Hall +> Los Angeles, CA 90024-1596 +ISI ; W ; 213-822-1511 + +$ NORTHERN CALIFORNIA + +Avalon Ventures ; W ; 415-960-1879 +Sierra Club ; W ; 415-776-2211 +UC Student Assn ; W ; 916-447-8272 + +$ WASHINGTON, DC + +Rep. Barney Frank ; W ; 202-225-5931 +NGLTF ; W ; 202-332-6483 +House of Reps ; W ; 202-225-3121 +National Park Service ; W ; 202-343-4747 +US Student Assn ; W ; 202-775-8943 + +$ GEORGIA + +Georgia Inst. Tech. ; W ; 404-894-2300 + +$ LOUISIANA + +Bruce D. Shriver ; W ; 318-231-5811 +> Editor-in-Chief, IEEE Computer +> U. of Southwestern Louisiana +> Drawer 42730 +> Lafayette, LA 70504-2730 +> shriver@usl.edu + +$ MARYLAND + +Ober Travel ; W ; 301-496-6676 + +$ MASSACHUSETTS + +Appalachian Mt.Club ; ; 617-523-0636 +ATHENA ; W ; 617-253-1300 +Kluwer Acad. Pub.; W ; 617-871-6600 +MIT LCS ; W ; 617-253-5851 +REI ; W ; 617-944-5103 +> 279 SalemSt. +> Boston,MA +> (exit 40 off Rt128) + +$ NEW HAMPSHIRE + +AMC Hut Reservations ; ; 603-466-2727 +Warren Rudman ; W ; 603-666-7591 + +$ NEW MEXICO + +LANL ; W ; 505-667-5061 +LANL Library ; W ; 505-667-4175 +> 8am-4.30pm m-f +LANL CNLS ; W ; 505-667-1444 +Santa Fe Institute ; W ; 505-984-8800 +> 1120 Canyon Road +> Santa Fe, NM 87501 + +$ NEW YORK + +AAA ; W ; 212-586-1166 +AAA autoTripMaps ; W ; 914-997-7744 +ACM ; W ; 212-869-7440 +B\&H Photo ; W ; 212-807-7474 +Bee Line ; W ; 682-2020 +> 14 N +Bee Line/lost+found ; W ; 376-6361 +Carey Bus ; W ; 212-286-9766 +> lost/found 718-632-0529 +Conran's Habitat ; W ; 914-683-5858 +> I 287 E to exit 5. take 2nd left +Cornell University ; W ; 607-255-2000 +Daniel R. Greening ; W ; 914-784-7861 + ; H ; 914-271-2629 +> IBM T.J. Watson Research Center +> P.O.Box 704 +> Yorktown Heights, NY 10598-0704 +IBM Hawthorne ; W ; 914-784-7000 + ; FX; 914-784-7455 +> 30 Saw Mill River Road +> Hawthorne, NY 10532 +> mail: +> P.O.Box 704 +> Yorktown Heights, NY 10598 +Kayson Jeep ; W ; 914-271-5105 + ; FX; 914-271-5581 +NYNEX ; W ; 914-964-6500 +Oliva Car Service ; W ; 914-769-8881 +Ossining Pub Lib ; W ; 914-941-2416 +> 9a n to 133 millwood. +> bear right. thru underpass +> 53 Croton Avenue. +> m-th9.30-9 +> f,sa9.30-5.30,su1-5 +REI ; W ; 914-632-9222 +> 500 Main St. +> New Rochelle, NY +French Consulate ; W ; 212-606-3600 +Hertz ; W ; x23789 + ; W ; 914-948-3024 +MetroNorth Commuter ; ; 800-522-5624 +New York Tax Board ; W ; 800-462-8100 + ; W ; 518-438-1073 +New York Times ; W ; 800-631-2500 +NYU Info ; W ; 212-998-4636 +NYU Bookstore ; W ; 212-998-4656 +NYU Book orders ; W ; 212-998-4678 +> +Oscar Wilde Books ; W ; 212-255-8097 +Sailing Info ; W ; 914-271-6868 +Courtsports ; W ; 914-592-3005 + +$ NORTH CAROLINA + +MCNC ; W ; 919-248-1800 +> 3021 Cornwallis Road +> P.O. Box 12889 +> Research Triangle Park, NC 27709-2889 + +$ OHIO + +> The Ohio Supercomputer Center +> 1224 Kinnear Road +> Columbus, OH 43212-1154 +$ TEXAS + +SEMATECH ; W ; 512-356-3500 +> SEMATECH +> 2706 MontopolisDr. +> Austin,TX 78741 + +$ WASHINGTON + +Lake Chelan Nat.Rec. ; W ; 509-682-4711 + +\end +% Local Variables +% tab-width:25 +% End diff --git a/macros/plain/contrib/misc/pi.tex b/macros/plain/contrib/misc/pi.tex new file mode 100644 index 0000000000..ac7f060134 --- /dev/null +++ b/macros/plain/contrib/misc/pi.tex @@ -0,0 +1,385 @@ +% file pi.tex version 0.993 +% +% **** Compute Pi in TeX! **** +% +% +% Author: D. Roegel (roegel@loria.fr) +% +% Version 0.96: 22 July 1996 +% First release +% +% Version 0.97: 22 July 1996 +% Modified by J. Gelinas (jacquesg@clic.net.ca) +% Added one term to get correct last digits +% Added a second optional argument: +% 100 prints decimals 0..100 +% -2 100 prints only decimals 100..101 +% Print exact number of decimals +% +% Version 0.98: 23 July 1996 +% Modified by D. Roegel, so that the input -3 1 gives 141 +% and not 3.141. Also, some unnecessary braces inside \loop...\repeat +% were removed. \ShowResult shortened by introduction of \NextDigit. +% +% Version 0.99: 23 July 1996 +% Modified by D. Roegel. +% Improvements following suggestions by J. Gelinas (jacquesg@clic.net.ca). +% Bug corrected, which made some digits false (\fontdimen\firstpos\xb=0pt +% added in \updatefirstpos). +% \N replaced by \count2 in \ShowResult, this enabling calls +% such as \ShowResult{1/\the\N...}{...}. +% +% Version 0.991: 23 July 1996 +% Modified by D. Roegel. +% Two \UpdateFirstPos were removed. +% +% Version 0.992: 24 July 1996 +% Modified by D. Roegel, following several simplifications suggested +% by J. Gelinas (jacquesg@clic.net.ca). +% \Multiply removed, \Add and \Sub merged. +% \ComputeArcTan shortened. +% +% Version 0.993: 24 July 1996 +% Modified by D. Roegel, following several simplifications suggested +% by J. Gelinas (jacquesg@clic.net.ca). +% \ComputeArcTan1/n computes now completely arctan(1/n). +% +%------------------------------------------------------------------------ +% This programs uses the formula by John Machin: +% +% Pi=16*arctan(1/5)-4*arctan(1/239) +% +% For arctan(x), we use the development +% +% arctan(x)=\sum_{i=0}^\infty [{x^{2i+1}\over 2i+1} - {x^{2i+3}\over 2i+3}] +% +% One array (\xc) is used to store the partial sum up to {x^{2i+1}\over 2i+1}. +% A second array (\xa) us used to store the value of x^{2i+1}. +% A third array (\xb) is used to store {x^{2i+1}\over 2i+1}. +% +% The result is put in the array \xr. +% +% The implementation of arrays uses a trick shown by Tom Rokicki +% in his game of life program (life.tex). +% +% The number of digits you can compute depends on your implementation +% of TeX. I had no trouble computing 5000 digits. +% +% The last digit can be wrong. And if it is a 0 or a 9, this decimal +% and previous ones can be wrong too. However, the absolute error is +% no greater than one unit of the last digit. +% +% If you want to know more about Pi, check the file sci.math.faq. +% See also http://www.primus.com/staff/paulp/useless/pi.html +% and http://www.tu-chemnitz.de/~arndt/joerg.html. +% +%------------------------------------------------------------------------ +% +\newlinechar=`\^^J +\message{^^J***** Computation of Pi with John Machin's formula *****} +\message{^^J** i.e.: pi=16*arctan(1/5)-4*arctan(1/239)} +\message{^^JHow many decimals of pi do you want ? } + +\read16to\nbdigits +\newcount\n +\n\nbdigits +\ifnum\n<0 + \multiply\n-1 + \message{^^JFirst decimal to output ? } + \read16to\firstdigit +\else + \advance\n1 + \def\firstdigit{0} +\fi +\newcount\lastdigit +\lastdigit\firstdigit +\advance\lastdigit\n +\advance\lastdigit-1 + +\newcount\index +\index\lastdigit +\advance\index11 +\divide\index4 +\def\base{10000} +\def\basesp{10000sp} + +\newcount\lastplusone +\lastplusone\index +\advance\lastplusone1 + +% \index is now the index for the last slot in the arrays + +% slot 1 -> integer digits +% slot 2 -> digits 1 to 4 +% slot 3 -> digits 5 to 8 +% ... +% slot \index -> digits (\index-2) * 4 +1 to (\index-1) * 4 +% + +\font\xa=cmr10 at 11truept % array for current values of (1/5)^{2n+1} + % and (1/239)^{2n+1} +\fontdimen\lastplusone\xa=0sp % this creates room +\font\xb=cmr10 at 13truept % array for current values of (1/5)^{2n+1}/(2n+1) + % and (1/239)^{2n+1}/(2n+1) +\fontdimen\lastplusone\xb=0sp % this creates room +\font\xc=cmr10 at 15truept % array for current sums of arctan(1/5) + % and arctan(1/239) +\fontdimen\lastplusone\xc=0sp % this creates room +\font\xr=cmr10 at 17truept % array for the result +\fontdimen\lastplusone\xr=0sp % this creates room + +% (we have each time allocated one more slot than strictly necessary; +% this avoids a test on \lastplusone in \updatefirstpos) + +% \xa, \xb, \xc and \xr are now equal to 0 + +% Some variables (some of them are not strictly necessary, and might be +% replaced by \count's): + +\newcount\dv % will hold dividers +\newcount\firstpos % first non empty slot +\newcount\I % scratch register for loops +\newdimen\carry % for carry (in additions) and borrows (in subtractions) +\newdimen\x % a scratch variable +\newcount\N % counts the terms +\newif\ifcont % flag used to find when an operation on bignums is not done +\newcount\Sdv % value of one digit (used in \ShowResult) +\newcount\dir % toggle for alternating sums + +% Initialization of working arrays + +\def\InitializeArrays{ + { + \I=1 + \loop + \fontdimen\I\xa=0sp + \fontdimen\I\xb=0sp + \fontdimen\I\xc=0sp + \advance\I1 + \ifnum\I<\lastplusone + \repeat + } + } + +% Initialization of the result + +\newcount\I +\I=1 +\loop + \fontdimen\I\xr=0sp + \advance\I1 + \ifnum\I<\lastplusone +\repeat + + +% divide array #1 by #2 beginning at slot \firstpos and up to \index; +% result is in array #3 +% Maximum carry is 9999, so we need to be able to store 99999999. +% \dimen's can hold up to +/- 2,147,483,647 sp and +% \count's up to +/- 2,147,483,647, so it fits. + +\def\Divide#1#2into#3{% + \carry0sp + \I\firstpos + { + \loop + \x=\fontdimen\I#1 + \multiply\carry\base + \advance\x\carry + \carry\x + \divide\x#2 + \fontdimen\I#3=\x + \multiply\x#2 + \advance\carry-\x + \advance\I1 + \ifnum\I<\lastplusone + \repeat + } + } + +% Add or Subtract #2 to #3, depending on #1. array #2 is not modified. + +\def\Add#1#2to#3{% + \carry0sp + \I\index + { + \loop + \x=\fontdimen\I#3 + \advance\x by #1\fontdimen\I#2 + \advance\x by #1\carry + \fontdimen\I#3=\x + \carry\x + \divide\carry\base + \multiply\carry\base + \advance\x-\carry + \divide\carry\base + \ifdim\x<0sp + \advance\x\basesp + \advance\carry1sp + \fi + \fontdimen\I#3=\x + \advance\I-1 + \ifnum\I<\firstpos \ifnum\carry=0 \contfalse + \else \conttrue \fi + \else \conttrue + \fi + \ifcont + \repeat + } + } + + +% Multiply array #1 by #2. Result is in #1. +% This macro is not used in this program, and only remains +% here for didactic and historical reasons. + +\def\Multiply#1#2{% + \carry0sp + \I\index + \loop + \x=\fontdimen\I#1 + \multiply\x by #2 + \advance\x by \carry + \fontdimen\I#1=\x + \carry\x + \divide\carry\base + \multiply\carry\base + \advance\x-\carry + \fontdimen\I#1=\x + \divide\carry\base + \advance\I-1 + \ifnum\I<\firstpos \ifnum\carry=0 \contfalse + \else \conttrue \fi + \else \conttrue + \fi + \ifcont + \repeat + } + +% update value of \firstpos; in the worst case, \firstpos +% gets increased by 2. + +\def\updatefirstpos{ + \ifdim\fontdimen\firstpos\xa=0sp + \ifnum\firstpos<\lastplusone + \fontdimen\firstpos\xb=0sp + \advance\firstpos1 + \fi + \fi + } + +\def\UpdateFirstPos{\updatefirstpos\updatefirstpos} + +% Compute arctan(1/#1). Arrays \xa and \xb are used. Result is in \xc. + +\def\ComputeArcTan1/#1{% + \firstpos1 + \InitializeArrays + % initialize \xa with 1: + \fontdimen1\xa=1sp + \Divide\xa{#1}into\xa + % now, \xa contains 1/#1 + \Add1\xa to\xb + % \xb contains 1/#1 + \firstpos=2 + \dv=#1 + \multiply\dv\dv + \N1 + \dir-1 + \message{^^JI am now computing the following sum: arctan(1/#1)=1/#1} + \Add1\xb to\xc % first term + \loop + \Divide\xa\dv into\xa + \UpdateFirstPos + \ifnum\firstpos<\lastplusone + \advance\N2 + \Divide\xa\N into\xb + \ifnum\dir>0 + \message{+1/\the\N*1/#1^\the\N} + \else + \message{-1/\the\N*1/#1^\the\N} + \fi + \Add\dir\xb to\xc + \multiply\dir-1 + \repeat + } + +% Extract the next digit from \count1 + +\def\NextDigit#1{ + \ifnum\count2<\lastdigit + \Sdv\count1 + \divide\Sdv#1 + \advance\count2 1 + \ifnum\count2>\firstdigit + \edef\res{\res\number\Sdv} + \fi + \multiply\Sdv#1 + \advance\count1-\Sdv + \fi + } + +% Display the result; the digits are scanned one at a time, +% and those between \firstdigit and \lastdigit are extracted +% and saved in \res. + +\def\ShowResult#1#2{{ + \count0=2 + \count2=1 + \advance\lastdigit1 + \def\res{} + \loop + \count1=\fontdimen\count0#2 + \NextDigit{1000} + \NextDigit{100} + \NextDigit{10} + \NextDigit{1} + \advance\count0by 1 + \ifnum\count2<\lastdigit + \repeat + \advance\lastdigit-1 % for correct display in next line + \message{^^J#1\res} + } +} + +\ComputeArcTan1/5 + +%\ShowResult{arctan(1/5)=0.}\xc + +\message{^^JI multiply it by 4...} +\firstpos2 +\Add1\xc to\xc % alternative method is to write \Multiply\xc4 + % or to change \ComputeArcTan so that the initial value is 4 +\Add1\xc to\xc +\message{done} + +% add 4*arctan(1/5) to \xr +\Add1\xc to\xr + +%\ShowResult{4*arctan(1/5)=0.}\xr + +\ComputeArcTan1/{239} + +%\ShowResult{arctan(1/239)=0.}\xc + + +%\ShowResult{4*arctan(1/239)=0.}\xc + +\message{^^JI subtract arctan(1/239) to 4*arctan(1/5)...} + +\firstpos2 +\Add{-1}\xc to\xr +\message{done} + +\message{^^JAnd finally, I multiply it by 4 giving:} +\Add1\xr to\xr +\Add1\xr to\xr + +\ifnum\firstdigit=0 + \ShowResult{pi[0 .. \number\lastdigit]=3.}\xr +\else + \ShowResult{pi[\firstdigit.. \number\lastdigit]=}\xr +\fi + +\bye + diff --git a/macros/plain/contrib/misc/placeins.tex b/macros/plain/contrib/misc/placeins.tex new file mode 100644 index 0000000000..11ed486e7b --- /dev/null +++ b/macros/plain/contrib/misc/placeins.tex @@ -0,0 +1,137 @@ +% P L A C E I N S . T E X ver 2.0 Mar 3, 1995 +% +% Insertions that keep their place. +% +% Copyright 1995 Donald Arseneau <asnd@triumf.ca> +% These macros may be freely used, transmitted, reproduced, or modified +% provided that this notice is left intact. +% +% This TeX file provides various mechanisms (for plain TeX and close +% relatives) to let insertions (footnotes, topins, pageins, etc.) float +% within their appropriate section, but to prevent them from intruding +% into the following section, even when sections do not normally begin +% a new page. (If your sections normally begin a new page, just use +% \supereject to flush out insertions.) +% +% Different combinations of insertions can be controlled with different +% commands: +% +% \par\penalty-20029 +% If there are any insertions that will not fit on the current page, +% a \supereject is performed and the following text will continue at +% the top of a page after all insertions. If all insertions do fit +% on the current page, then the following text will continue +% immediately on this page. +% \par\penalty-20030 +% Like above, except that if there are any footnotes at all on the +% current page, the section must begin on the next page. (This is so +% no footnote text from section 1 will appear beneath the beginning +% of section 2.) +% \par\penalty-10029 +% If any insertions cannot fit on the current page, eject them, and +% then allow the following section to begin immediately on the same +% page as the last insert. If all insertions do fit on the current +% page, then the following text will continue immediately on this +% page. +% \barrier{\eject}{\topins} +% If there are any pageinserts or topinserts that do not fit on the +% current page, eject them, and then allow the following section to +% begin immediately on the same page as the last insert. Split +% footnotes or other insertions are allowed to intrude into the next +% section. +% \barrier{\supereject}{\topins} +% Like the \barrier command above, but if any inserts are ejected +% the following section will begin at the top of a new page (like +% \supereject). +% \barrier{...}{\footins} +% *** NOT ALLOWED *** You will get spurious space and footnote-rules +% at the bottom of pages! +% \barrier{...}{\margins} +% If you define other insertion classes, such as marginal notes, you +% can use \barrier for them too. But only if \skip\margins=0pt. +% You must also add any new insertion classes to the definition of +% \placerestoreoutput +% +% How to use: First, \input this file (of course!). Then, at the beginning +% of a new section, or at any boundary that insertions should not cross, put +% one of the commands listed above. Presumably, you will actually put these +% commands at the start of your own \section or \startsection macro; that is +% why they are non mnemonic! +% +% There is a slight chance that a footnote may be separated from its reference +% in the text after \penalty-xxxxx when there are no split insertions. (LaTeX +% has the same possibility at every float!) + +\chardef\noplaceoutput\catcode`\@ +\catcode`\@=11 + +\edef\zero@skip{\the\z@skip} + +\def\barrier#1#2{\par\begingroup + \ifdim\skip#2>\z@{\newlinechar10\errhelp{\barrier#2may produce some spurious + extra material on the page, ^^J but I will try anyway.}\errmessage{Bad use + of \string\barrier}}% + \fi + \skip@\lastskip \edef\next{\the\skip@}\ifx\next\zero@skip\else\vskip-\skip@\fi + \penalty\z@ % update page parameters + \fam-\insertpenalties + \insert#2{\floatingpenalty\@ne}% + \ifx\next\zero@skip\else\vskip\skip@\fi + \advance\fam\insertpenalties % 0: no held; 1: held over + \expandafter\endgroup + \ifnum\fam=\@ne % then do eject +% \message{There are held-over \string#2 inserts; performing \string#1. }% + \ifdim\pagetotal<\topskip \leftline{}\kern-\topskip\fi % avoid empty list + {\dimen@\pagetotal \advance\dimen@\pagedepth + \ifdim\dimen@<\pagegoal\vfill\fi}% + #1\@barrier{#1}{#2}\else +% \message{There are no held-over \string#2 inserts. \space}% +\fi +} + +\def\placeinsoutput{% +\ifnum\outputpenalty=-20030\relax % eject if any footnotes + \ifvoid\footins\else + \fam\insertpenalties \advance\fam\@ne \insertpenalties\fam + \fi \outputpenalty=-20029\relax +\fi +\ifnum\outputpenalty=-20029\relax % Check for `supereject' flag + \ifnum\insertpenalties>\z@ % something is being held over, must get it out +% \message{Forcing insertions on their own pages. \space}% + \ifvoid\footins \r@ggedbottomtrue \else \advance\skip\footins 0ptplus1fil\fi + \noplaceoutput % performs \supereject + \else % must rejoin seamlessly: + \placerestoreoutput + \fi +\else % check for other flag... + \ifnum\outputpenalty=-10028 % in the middle of ejecting + \ifnum\insertpenalties=\z@ \global\setbox\@cclv\vbox{}\fi + \outputpenalty=-10029 + \fi + \ifnum\outputpenalty=-10029\relax % section start + \ifnum\insertpenalties>\z@ % something is being held over, must get it out +% \message{Forcing insertions. \space}% + \ifvoid\footins \r@ggedbottomtrue \else \advance\skip\footins 0ptplus1fil\fi + \noplaceoutput % performs \eject, perhaps repeatedly: + \leftline{}\kern-\topskip \penalty-10028\relax % (like \dosupereject) + \else % must rejoin seamlessly: + \placerestoreoutput + \fi + \else % just a regular page break + \noplaceoutput + \fi +\fi +} + +% there is a slim chance that footnotes may lose their place. +\def\placerestoreoutput{% + \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi + \ifvoid\topins\else\insert\topins{\unvbox\topins}\fi +% If you have other floating insertion classes, do the same here. + \unvbox\@cclv +} + +\catcode`\@=\noplaceoutput + +\edef\noplaceoutput{\the\output} +\output{\placeinsoutput} diff --git a/macros/plain/contrib/misc/plain-cm.tex b/macros/plain/contrib/misc/plain-cm.tex new file mode 100644 index 0000000000..3f6d9ed75f --- /dev/null +++ b/macros/plain/contrib/misc/plain-cm.tex @@ -0,0 +1,371 @@ +% This is a MODIFIED and EXTENDED version of the Plain format described +% in the TeXbook. It's modularized so that Plain is read in first +% (to allow easy inclusion of new versions) and then appropriate macros +% are modified here. +% +% N.B.: A version number is defined at the very end of this file; +% please change that number whenever the file is modified! + +% Modified 17 Jul 86 by RAY +% to use CM instead of AM fonts. The new twelve point fonts +% replace their magnified ten point counterparts. A version +% of plain without preloaded fonts is not needed for the CM +% format and we no longer update the AM, TR, or HE formats. + +% Modified 26 Aug 85 by DCB +% to first read in Plain and then make modifications. Actually, +% we have to make a version of Plain that has no preloaded fonts +% or the fonts loaded here won't fit, but this is a lot easier +% than integrating massive changes. + +% Modified 14 Dec 84 by BKPH +% to have magnified math extension fonts (for 10, 11, 12, 14, & 18 pt) +% and to allow \big et al to work in sizes other than ten point. +% All changes are in definitions of \font\tenex, \font\elevenex etc. +% and \def\eightpoint, \def\ninepoint, \def\tenpoint etc. + +% Created 6 Mar 84 by DCB +% to have point sizes 8,9,10,11,12,14,16,18 (e.g., \ninepoint) +% to define the \pointsize, \user###point (e.g., \userninepoint) +% and \setnormalsp@cing macros +% All the changes except these header lines and the last +% 5 lines of the file are in the FONTS and MORE FONTS sections. + +\input plain + +% We make @ signs act like letters, temporarily, to avoid conflict +% between user names and internal control sequences of plain format. +\catcode`@=11 + +\message{Loading the plain-augmented-CM format: different fonts,} + +% roman text +\font\eighteenrm=cmr10 scaled\magstep3 % 17.28 pt +\font\fourteenrm=cmr10 scaled\magstep2 % 14.4 pt +%\font\twelverm=cmr10 scaled\magstep1 % 12 pt +\font\twelverm=cmr12 % 12 pt +\font\elevenrm=cmr10 scaled\magstephalf % 11 pt (almost) +\font\tenrm=cmr10 +\font\ninerm=cmr9 +\font\eightrm=cmr8 +\font\sevenrm=cmr7 +\font\sixrm=cmr6 +\font\fiverm=cmr5 + +% math italic +\font\eighteeni=cmmi10 scaled\magstep3 % 17.28 pt +\font\fourteeni=cmmi10 scaled\magstep2 % 14.4 pt +%\font\twelvei=cmmi10 scaled\magstep1 % 12 pt +\font\twelvei=cmmi12 % 12 pt +\font\eleveni=cmmi10 scaled\magstephalf % 11 pt (almost) +\font\teni=cmmi10 +\font\ninei=cmmi9 +\font\eighti=cmmi8 +\font\seveni=cmmi7 +\font\sixi=cmmi6 +\font\fivei=cmmi5 + +% math symbols +\font\eighteensy=cmsy10 scaled\magstep3 % 17.28 pt +\font\fourteensy=cmsy10 scaled\magstep2 % 14.4 pt +\font\twelvesy=cmsy10 scaled\magstep1 % 12 pt (no cmsy12) +\font\elevensy=cmsy10 scaled\magstephalf % 11 pt (almost) +\font\tensy=cmsy10 +\font\ninesy=cmsy9 +\font\eightsy=cmsy8 +\font\sevensy=cmsy7 +\font\sixsy=cmsy6 +\font\fivesy=cmsy5 + +% math extension +\font\eighteenex=cmex10 scaled\magstep3 % 17.28 pt +\font\fourteenex=cmex10 scaled\magstep2 % 14.4 pt +\font\twelveex=cmex10 scaled\magstep1 % 12 pt (no cmex12) +\font\elevenex=cmex10 scaled\magstephalf % 11 pt (almost) +\font\tenex=cmex10 + +%% NOTE: cmex comes only in ten point size, but magnified 1/2, 1, 2, 3, 4, 5 + +% boldface extended +\font\eighteenbf=cmbx10 scaled\magstep3 % 17.28 pt +\font\fourteenbf=cmbx10 scaled\magstep2 % 14.4 pt +%\font\twelvebf=cmbx10 scaled\magstep1 % 12 pt +\font\twelvebf=cmbx12 % 12 pt +\font\elevenbf=cmbx10 scaled\magstephalf % 11 pt (almost) +\font\tenbf=cmbx10 +\font\ninebf=cmbx9 +\font\eightbf=cmbx8 +\font\sevenbf=cmbx7 +\font\sixbf=cmbx6 +\font\fivebf=cmbx5 + +% typewriter +\font\eighteentt=cmtt10 scaled\magstep3 % 17.28 pt +\font\fourteentt=cmtt10 scaled\magstep2 % 14.4 pt +%\font\twelvett=cmtt10 scaled \magstep1 % 12pt +\font\twelvett=cmtt12 % 12pt +\font\eleventt=cmtt10 scaled \magstephalf % 11pt (almost) +\font\tentt=cmtt10 +\font\ninett=cmtt9 +\font\eighttt=cmtt8 + +\font\preloaded=cmsltt10 % slanted typewriter + +% slanted roman +\font\eighteensl=cmsl10 scaled\magstep3 % 17.28 pt +\font\fourteensl=cmsl10 scaled\magstep2 % 14.4 pt +%\font\twelvesl=cmsl10 scaled \magstep1 % 12pt +\font\twelvesl=cmsl12 % 12pt +\font\elevensl=cmsl10 scaled \magstephalf % 11pt (almost) +\font\tensl=cmsl10 +\font\ninesl=cmsl9 +\font\eightsl=cmsl8 + +% text italic +\font\eighteenit=cmti10 scaled\magstep3 % 17.28 pt +\font\fourteenit=cmti10 scaled\magstep2 % 14.4 pt +%\font\twelveit=cmti10 scaled \magstep1 % 12pt +\font\twelveit=cmti12 % 12pt +\font\elevenit=cmti10 scaled \magstephalf % 11pt (almost) +\font\tenit=cmti10 +\font\nineit=cmti9 +\font\eightit=cmti8 + +\message{more different fonts,} + +\font\preloaded=cmmib10 % bold math italic +\font\preloaded=cmbsy10 % bold math symbols + +%\font\preloaded=manfnt % METAFONT logo and dragon curve and special symbols + +% Additional \preloaded fonts can be specified here. +% (And those that were \preloaded above can be eliminated.) + +\let\preloaded=\undefined % preloaded fonts must be declared anew later. + +\skewchar\eighteeni='177 \skewchar\fourteeni='177 \skewchar\twelvei='177 +\skewchar\eleveni='177 \skewchar\teni='177 \skewchar\ninei='177 +\skewchar\eighti='177 \skewchar\seveni='177 \skewchar\sixi='177 +\skewchar\fivei='177 +\skewchar\eighteensy='60 \skewchar\fourteensy='60 \skewchar\twelvesy='60 +\skewchar\elevensy='60 \skewchar\tensy='60 \skewchar\ninesy='60 +\skewchar\eightsy='60 \skewchar\sevensy='60 \skewchar\sixsy='60 +\skewchar\fivesy='60 + +\let\usereighteenpointmacro=\relax +\def\eighteenpoint{\let\pointsize=\eighteenpoint + \textfont0=\eighteenrm \scriptfont0=\twelverm \scriptscriptfont0=\ninerm + \def\rm{\fam\z@\eighteenrm}% + \textfont1=\eighteeni \scriptfont1=\twelvei \scriptscriptfont1=\ninei + \def\mit{\fam\@ne}\def\oldstyle{\fam\@ne\eighteeni}% + \textfont2=\eighteensy \scriptfont2=\twelvesy \scriptscriptfont2=\ninesy + \def\cal{\fam\tw@}% + \textfont3=\eighteenex \scriptfont3=\eighteenex \scriptscriptfont3=\eighteenex%NEW + \textfont\itfam=\eighteenit + \def\it{\fam\itfam\eighteenit}% + \textfont\slfam=\eighteensl + \def\sl{\fam\slfam\eighteensl}% + \textfont\bffam=\eighteenbf \scriptfont\bffam=\twelvebf + \scriptscriptfont\bffam=\ninebf + \def\bf{\fam\bffam\eighteenbf}% + \textfont\ttfam=\eighteentt + \def\tt{\fam\ttfam\eighteentt}% + \def\big##1{{\hbox{$\left##1\vbox to15.3\p@{}\right.\n@space$}}}%NEW + \def\Big##1{{\hbox{$\left##1\vbox to20.7\p@{}\right.\n@space$}}}%NEW + \def\bigg##1{{\hbox{$\left##1\vbox to26.1\p@{}\right.\n@space$}}}%NEW + \def\Bigg##1{{\hbox{$\left##1\vbox to31.5\p@{}\right.\n@space$}}}%NEW + \setnormalsp@cing + \usereighteenpointmacro + } + +\let\usersixteenpointmacro=\relax +\def\sixteenpoint{% + \message{You have asked for 16pt, but you are getting 14pt fonts. + There are no 16pt CM fonts in the local font library.}% + \fourteenpoint \let\pointsize=\sixteenpoint + \usersixteenpointmacro + } + +\let\userfourteenpointmacro=\relax +\def\fourteenpoint{\let\pointsize=\fourteenpoint + \textfont0=\fourteenrm \scriptfont0=\tenrm \scriptscriptfont0=\sevenrm + \def\rm{\fam\z@\fourteenrm}% + \textfont1=\fourteeni \scriptfont1=\teni \scriptscriptfont1=\seveni + \def\mit{\fam\@ne}\def\oldstyle{\fam\@ne\fourteeni}% + \textfont2=\fourteensy \scriptfont2=\tensy \scriptscriptfont2=\sevensy + \def\cal{\fam\tw@}% + \textfont3=\fourteenex \scriptfont3=\fourteenex \scriptscriptfont3=\fourteenex%NEW + \textfont\itfam=\fourteenit + \def\it{\fam\itfam\fourteenit}% + \textfont\slfam=\fourteensl + \def\sl{\fam\slfam\fourteensl}% + \textfont\bffam=\fourteenbf \scriptfont\bffam=\tenbf + \scriptscriptfont\bffam=\sixbf + \def\bf{\fam\bffam\fourteenbf}% + \textfont\ttfam=\fourteentt + \def\tt{\fam\ttfam\fourteentt}% + \def\big##1{{\hbox{$\left##1\vbox to11.9\p@{}\right.\n@space$}}}%NEW + \def\Big##1{{\hbox{$\left##1\vbox to16.1\p@{}\right.\n@space$}}}%NEW + \def\bigg##1{{\hbox{$\left##1\vbox to20.3\p@{}\right.\n@space$}}}%NEW + \def\Bigg##1{{\hbox{$\left##1\vbox to24.5\p@{}\right.\n@space$}}}%NEW + \setnormalsp@cing + \userfourteenpointmacro + } + +\let\usertwelvepointmacro=\relax +\def\twelvepoint{\let\pointsize=\twelvepoint + \textfont0=\twelverm \scriptfont0=\ninerm \scriptscriptfont0=\sixrm + \def\rm{\fam\z@\twelverm}% + \textfont1=\twelvei \scriptfont1=\ninei \scriptscriptfont1=\sixi + \def\mit{\fam\@ne}\def\oldstyle{\fam\@ne\twelvei}% + \textfont2=\twelvesy \scriptfont2=\ninesy \scriptscriptfont2=\sixsy + \def\cal{\fam\tw@}% + \textfont3=\twelveex \scriptfont3=\twelveex \scriptscriptfont3=\twelveex%NEW + \textfont\itfam=\twelveit + \def\it{\fam\itfam\twelveit}% + \textfont\slfam=\twelvesl + \def\sl{\fam\slfam\twelvesl}% + \textfont\bffam=\twelvebf \scriptfont\bffam=\ninebf + \scriptscriptfont\bffam=\sixbf + \def\bf{\fam\bffam\twelvebf}% + \textfont\ttfam=\twelvett + \def\tt{\fam\ttfam\twelvett}% + \def\big##1{{\hbox{$\left##1\vbox to10.2\p@{}\right.\n@space$}}}%NEW + \def\Big##1{{\hbox{$\left##1\vbox to13.8\p@{}\right.\n@space$}}}%NEW + \def\bigg##1{{\hbox{$\left##1\vbox to17.4\p@{}\right.\n@space$}}}%NEW + \def\Bigg##1{{\hbox{$\left##1\vbox to21\p@{}\right.\n@space$}}}%NEW + \setnormalsp@cing + \usertwelvepointmacro + } + +\let\userelevenpointmacro=\relax +\def\elevenpoint{\let\pointsize=\elevenpoint + \textfont0=\elevenrm \scriptfont0=\eightrm \scriptscriptfont0=\fiverm + \def\rm{\fam\z@\elevenrm}% + \textfont1=\eleveni \scriptfont1=\eighti \scriptscriptfont1=\fivei + \def\mit{\fam\@ne}\def\oldstyle{\fam\@ne\eleveni}% + \textfont2=\elevensy \scriptfont2=\eightsy \scriptscriptfont2=\fivesy + \def\cal{\fam\tw@}% + \textfont3=\elevenex \scriptfont3=\elevenex \scriptscriptfont3=\elevenex%NEW + \textfont\itfam=\elevenit + \def\it{\fam\itfam\elevenit}% + \textfont\slfam=\elevensl + \def\sl{\fam\slfam\elevensl}% + \textfont\bffam=\elevenbf \scriptfont\bffam=\eightbf + \scriptscriptfont\bffam=\fivebf + \def\bf{\fam\bffam\elevenbf}% + \textfont\ttfam=\eleventt + \def\tt{\fam\ttfam\eleventt}% + \def\big##1{{\hbox{$\left##1\vbox to9.3\p@{}\right.\n@space$}}}%NEW + \def\Big##1{{\hbox{$\left##1\vbox to12.6\p@{}\right.\n@space$}}}%NEW + \def\bigg##1{{\hbox{$\left##1\vbox to16\p@{}\right.\n@space$}}}%NEW + \def\Bigg##1{{\hbox{$\left##1\vbox to19.2\p@{}\right.\n@space$}}}%NEW + \setnormalsp@cing + \userelevenpointmacro + } + +\let\usertenpointmacro=\relax +\def\tenpoint{\let\pointsize=\tenpoint + \textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm + \def\rm{\fam\z@\tenrm}% + \textfont1=\teni \scriptfont1=\seveni \scriptscriptfont1=\fivei + \def\mit{\fam\@ne}\def\oldstyle{\fam\@ne\teni}% + \textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy + \def\cal{\fam\tw@}% + \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex + \textfont\itfam=\tenit + \def\it{\fam\itfam\tenit}% + \textfont\slfam=\tensl + \def\sl{\fam\slfam\tensl}% + \textfont\bffam=\tenbf \scriptfont\bffam=\sevenbf + \scriptscriptfont\bffam=\fivebf + \def\bf{\fam\bffam\tenbf}% + \textfont\ttfam=\tentt + \def\tt{\fam\ttfam\tentt}% + \def\big##1{{\hbox{$\left##1\vbox to8.5\p@{}\right.\n@space$}}}%NEW + \def\Big##1{{\hbox{$\left##1\vbox to11.5\p@{}\right.\n@space$}}}%NEW + \def\bigg##1{{\hbox{$\left##1\vbox to14.5\p@{}\right.\n@space$}}}%NEW + \def\Bigg##1{{\hbox{$\left##1\vbox to17.5\p@{}\right.\n@space$}}}%NEW + \setnormalsp@cing + \usertenpointmacro + } + +\let\userninepointmacro=\relax +\def\ninepoint{\let\pointsize=\ninepoint + \textfont0=\ninerm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm + \def\rm{\fam\z@\ninerm}% + \textfont1=\ninei \scriptfont1=\seveni \scriptscriptfont1=\fivei + \def\mit{\fam\@ne}\def\oldstyle{\fam\@ne\ninei}% + \textfont2=\ninesy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy + \def\cal{\fam\tw@}% + \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex + \textfont\itfam=\nineit + \def\it{\fam\itfam\nineit}% + \textfont\slfam=\ninesl + \def\sl{\fam\slfam\ninesl}% + \textfont\bffam=\ninebf \scriptfont\bffam=\sevenbf + \scriptscriptfont\bffam=\fivebf + \def\bf{\fam\bffam\ninebf}% + \textfont\ttfam=\ninett + \def\tt{\fam\ttfam\ninett}% + \def\big##1{{\hbox{$\left##1\vbox to8.5\p@{}\right.\n@space$}}}%NEW + \def\Big##1{{\hbox{$\left##1\vbox to11.5\p@{}\right.\n@space$}}}%NEW + \def\bigg##1{{\hbox{$\left##1\vbox to14.5\p@{}\right.\n@space$}}}%NEW + \def\Bigg##1{{\hbox{$\left##1\vbox to17.5\p@{}\right.\n@space$}}}%NEW + \setnormalsp@cing + \userninepointmacro + } + +\let\usereightpointmacro=\relax +\def\eightpoint{\let\pointsize=\eightpoint + \textfont0=\eightrm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm + \def\rm{\fam\z@\eightrm}% + \textfont1=\eighti \scriptfont1=\sixi \scriptscriptfont1=\fivei + \def\mit{\fam\@ne}\def\oldstyle{\fam\@ne\eighti}% + \textfont2=\eightsy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy + \def\cal{\fam\tw@}% + \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex + \textfont\itfam=\eightit + \def\it{\fam\itfam\eightit}% + \textfont\slfam=\eightsl + \def\sl{\fam\slfam\eightsl}% + \textfont\bffam=\eightbf \scriptfont\bffam=\sixbf + \scriptscriptfont\bffam=\fivebf + \def\bf{\fam\bffam\eightbf}% + \textfont\ttfam=\eighttt + \def\tt{\fam\ttfam\eighttt}% + \def\big##1{{\hbox{$\left##1\vbox to8.5\p@{}\right.\n@space$}}}%NEW + \def\Big##1{{\hbox{$\left##1\vbox to11.5\p@{}\right.\n@space$}}}%NEW + \def\bigg##1{{\hbox{$\left##1\vbox to14.5\p@{}\right.\n@space$}}}%NEW + \def\Bigg##1{{\hbox{$\left##1\vbox to17.5\p@{}\right.\n@space$}}}%NEW + \setnormalsp@cing + \usereightpointmacro + } + +%% NOTE: had to stick 10 point definitions of \big in 8, 9, and 10 point. + +\newtoks\baselinefactor \baselinefactor={1.2} +\def\setnormalbaselines {% + \normalbaselineskip=\the\baselinefactor em\relax +% \normallineskip=\p@ % these don't change with point size +% \normallineskiplimit=0\p@ + } + +\def\setnormalsp@cing{% SIDE EFFECT is to go into \rm + \rm % set the em properly + \setnormalbaselines + \normalbaselines + \abovedisplayskip=1.2em plus .3em minus .9em% + \abovedisplayshortskip=0em plus .3em% + \belowdisplayskip=1.2em plus .3em minus .9em% + \belowdisplayshortskip=.7em plus .3em minus .4em% + \setbox\strutbox=\hbox{\vrule height .7\baselineskip + depth .3\baselineskip width\z@}% + } + +\message{format id.} + +\catcode`@=12 % at signs are no longer letters + +\edef\fmtname{\fmtname-augmented} % include Plain name +\edef\fmtversion{\fmtversion-CM861707} % include Plain version diff --git a/macros/plain/contrib/misc/plotting.tex b/macros/plain/contrib/misc/plotting.tex new file mode 100644 index 0000000000..ab3c59d0ac --- /dev/null +++ b/macros/plain/contrib/misc/plotting.tex @@ -0,0 +1,369 @@ +% +% plotting.tex - TeX Plotting Macros +% +% author: Laurence G. Yaffe (lgy@newton.phys.washington.edu) 1987 +% +\setbox0 = \hbox{$0$}% +\newdimen \digitheight \digitheight = \ht0 +\newdimen \titlespacing \titlespacing = 1.5 ex +\newdimen \labelspacing \labelspacing = 0.9 ex +\newdimen \labelwidth \labelwidth = 0.0 pt +\newdimen \ticklength \ticklength = 0.7 em +\newdimen \plotheight \plotheight = 5.0 in +\newdimen \plotwidth \plotwidth = 5.0 in +\newdimen \linewidth \linewidth = 0.241 pt +\newskip \padding \padding = 0pt plus 1fil +% +\newbox \xAxis +\newbox \XAxis +\newbox \yAxis +\newbox \YAxis +\newbox \PlotData +\newbox \PlotBox +% +\def\ratio #1:#2% adjust padding for log scale plotting + {% + \count255 = #1#2 + \ifnum \count255=11 \global\padding = 0pt plus 1.00000 fil \else + \ifnum \count255=12 \global\padding = 0pt plus 0.30103 fil \else + \ifnum \count255=23 \global\padding = 0pt plus 0.17609 fil \else + \ifnum \count255=34 \global\padding = 0pt plus 0.12494 fil \else + \ifnum \count255=45 \global\padding = 0pt plus 0.09691 fil \else + \ifnum \count255=56 \global\padding = 0pt plus 0.07918 fil \else + \ifnum \count255=67 \global\padding = 0pt plus 0.06695 fil \else + \ifnum \count255=78 \global\padding = 0pt plus 0.05799 fil \else + \ifnum \count255=89 \global\padding = 0pt plus 0.05115 fil \else + \ifnum \count255=91 \global\padding = 0pt plus 0.04576 fil \else + \ifnum \count255=13 \global\padding = 0pt plus 0.47712 fil \else + \ifnum \count255=14 \global\padding = 0pt plus 0.60206 fil \else + \ifnum \count255=24 \global\padding = 0pt plus 0.30103 fil \else + \ifnum \count255=25 \global\padding = 0pt plus 0.39794 fil \else + \ifnum \count255=26 \global\padding = 0pt plus 0.47712 fil \else + \ifnum \count255=36 \global\padding = 0pt plus 0.30103 fil \else + \ifnum \count255=46 \global\padding = 0pt plus 0.17609 fil \else + \ifnum \count255=61 \global\padding = 0pt plus 0.22185 fil \else + \ifnum \count255=51 \global\padding = 0pt plus 0.30103 fil \else + \ifnum \count255=41 \global\padding = 0pt plus 0.39794 fil \else + \ifnum \count255=31 \global\padding = 0pt plus 0.52288 fil \else + \ifnum \count255=21 \global\padding = 0pt plus 0.69897 fil \else + \global\padding = 0pt + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + }% +% +\def\centered #1{\vbox to 0pt {\vss \hbox to 0pt {\hss #1\hss}\vss}}% +% +\def\dash #1% + {% + \vbox {\hrule height 0.5 \linewidth depth 0.5 \linewidth width #1}% + }% +% +\def\yaxis #1#2% + {% + \global\setbox \yAxis = \hbox + {% + \def \temp {#1}% + \ifx \temp\empty \else + \vbox to \plotheight {\vss \hbox {#1}\vss}% + \kern 0.7 \titlespacing + \fi + \def \temp {#2}% + \ifx \temp\empty \else + \labelwidth = 0pt + \setbox1=\box0\ytic #2,\cr,% + \ifnum \labelwidth = 0 \kern -\labelspacing \fi + \hbox to \labelwidth {\hfil}\box0% + \fi + \hbox to 0pt + {\hss \vrule height \plotheight depth 0pt width \linewidth \hss}% + }% + }% +\def\ytic #1,% + {% + \def \temp {#1}% + \def \quit {\cr}% + \ifx \temp\quit + \let\next=\relax + \setbox0 = \vbox to \plotheight {\unvbox0 \unskip}% + \else + \let\next=\ytic \skip0 = \padding + \setbox1 = \hbox {\tenpoint $#1$}% + \ifnum \labelwidth < \wd1 + \labelwidth = \wd1 + \fi + \setbox1 = \hbox + {% + \smash + {% + \ifnum \wd1 = 0 + \kern \labelspacing + \hbox to 0pt {\dash {0.67 \ticklength}\hss}% + \else + \lower 0.42 \digitheight \hbox to 0pt {\hss \unhbox1}% + \kern \labelspacing + \hbox to 0pt {\dash \ticklength \hss}% + \fi + }% + }% + \setbox0 = \vbox to \plotheight {\box1 \vskip \skip0 \unvbox0}% + \fi + \next + }% +% +\def\Yaxis #1#2% + {% + \global\setbox \YAxis = \hbox + {% + \hbox to 0pt + {\hss \vrule height \plotheight depth 0pt width \linewidth \hss}% + \def \temp {#2}% + \ifx \temp\empty \else \setbox1=\box0 \Ytic #2,\cr,\box0 \fi + \def \temp {#1}% + \ifx \temp\empty \else + \kern 0.7 \titlespacing + \vbox to \plotheight {\vss \hbox {#1}\vss}% + \fi + }% + }% +\def\Ytic #1,% + {% + \def \temp {#1}% + \def \quit {\cr}% + \ifx \temp\quit + \let\next=\relax + \setbox0 = \vbox to \plotheight {\unvbox0 \unskip}% + \else + \let\next=\Ytic \skip0=\padding + \setbox1 = \hbox {\tenpoint $#1$}% + \setbox1 = \hbox + {% + \smash + {% + \ifnum \wd1=0 + \hbox to 0pt {\hss \dash {0.67 \ticklength}}% + \else + \hbox to 0pt {\hss \dash \ticklength}% + \kern \labelspacing + \lower 0.42 \digitheight \box1% + \fi + }% + }% + \setbox0 = \vbox to \plotheight {\box1 \vskip \skip0 \unvbox0}% + \fi + \next + }% +% +\def\xaxis #1#2% + {% + \global\setbox \xAxis = \vtop + {% + \smash {\dash \plotwidth}% + \nointerlineskip + \def \temp {#2}% + \ifx \temp\empty \else \hbox to \plotwidth {\xtic #2,\cr,}\fi + \nointerlineskip + \def \temp {#1}% + \ifx \temp\empty \else + \kern 0.7 \titlespacing + \hbox to \plotwidth {\hss #1\hss}% + \fi + }% + }% +\def\xtic #1,% + {% + \def \temp {#1}% + \def \quit {\cr}% + \ifx \temp\quit + \let\next=\unskip + \else + \let\next=\xtic + \vtop + {% + \setbox1 = \hbox to 0pt {\hss \tenpoint $#1$\hss}% + \ifnum \ht1=0 + \smash + {\hbox to 0pt + {\hss \vrule height 0.67 \ticklength width \linewidth \hss}% + }% + \else + \smash + {\hbox to 0pt + {\hss \vrule height \ticklength width \linewidth \hss}% + }% + \nointerlineskip + \kern \labelspacing + \box1% + \fi + }% + \hskip \padding + \fi + \next + }% +% +\def\Xaxis #1#2% + {% + \global\setbox \XAxis = \vbox + {% + \def \temp {#1}% + \ifx \temp\empty \else + \hbox to \plotwidth {\hss #1\hss}% + \kern \titlespacing + \fi + \nointerlineskip + \def \temp {#2}% + \ifx \temp\empty \else \hbox to \plotwidth {\Xtic #2,\cr,}\fi + \nointerlineskip + \smash {\dash \plotwidth}% + }% + }% +\def\Xtic #1,% + {% + \def \temp {#1}% + \def \quit {\cr}% + \ifx \temp\quit + \let\next=\unskip + \else + \let\next=\Xtic + \vbox + {% + \setbox1 = \hbox to 0pt {\hss \tenpoint $#1$\hss}% + \ifnum \ht1=0 + \smash + {\hbox to 0pt + {\hss \vrule depth 0.67 \ticklength width \linewidth \hss}% + }% + \else + \box1% + \kern \labelspacing + \nointerlineskip + \smash + {\hbox to 0pt + {\hss \vrule depth \ticklength width \linewidth \hss}% + }% + \fi + }% + \hskip \padding + \fi + \next + }% +% +\def\plotbox (#1,#2)% + {% + \global\setbox \PlotData = \hbox to 0pt + {% + \unhbox \PlotData + \rlap {\kern #1\plotwidth \raise #2\plotheight \copy\PlotBox}% + }% + }% +\def\plottext (#1,#2)#3% + {% + \setbox \PlotBox = \hbox {#3}% + \plotbox (#1,#2)% + }% +\def\plotpoint (#1,#2)% + {% + \setbox \PlotBox = \centered.% + \plotbox (#1,#2)% + }% +\def\plotsymbol (#1,#2)#3% + {% + \setbox \PlotBox = \centered {#3}% + \plotbox (#1,#2)% + }% +\def\xrange #1]{\def\XRange {#1]}}% +\def\yrange #1]{\def\YRange {#1]}}% +% +\def\makeplot #1#2#3% + {% + \plotwidth = #1 \plotheight = #2 + \setbox \xAxis = \hbox to \plotwidth {\hfil}% + \setbox \XAxis = \hbox to \plotwidth {\hfil}% + \setbox \yAxis = \vbox to \plotheight {\vfil}% + \setbox \YAxis = \vbox to \plotheight {\vfil}% + \setbox \PlotData = \hbox {}% + {#3}% + \hbox + {% + \box \yAxis + \box \PlotData + \vbox + {% + \box \XAxis + \nointerlineskip \kern \plotheight \nointerlineskip + \box \xAxis + }% + \box \YAxis + }% + }% +% +\def\psfile #1% --- deferred input of postscript file --- + {% + \global\setbox \PlotData = \hbox to 0pt + {% + \unhbox \PlotData \special {psfile=#1}% + }% + }% +% +\def\addPS #1% --- immediate input of postscript commands --- + {% + \global\setbox \PlotData = \hbox to 0pt + {% + \unhbox \PlotData \special {"#1}% + }% + }% +% +\def\plotdatafile #1#2% --- deferred input of data file --- + {% + \global\setbox \PlotData = \hbox to 0pt + {% + \unhbox \PlotData + \special + {% + datafile="#1" + dash="[#2]" + xrange="\XRange" + yrange="\YRange" + hsize=\the\plotwidth\space + vsize=\the\plotheight\space + linewidth=\the\linewidth + }% + }% + }% +% +\def\plotdata #1#2% --- immediate input of data points --- + {% + \global\setbox \PlotData = \hbox to 0pt + {% + \unhbox \PlotData + \special + {% + datalist="#1" + dash="[#2]" + xrange="\XRange" + yrange="\YRange" + hsize=\the\plotwidth\space + vsize=\the\plotheight\space + linewidth=\the\linewidth + }% + }% + }% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Trivial Plotting Example +% +%\makeplot {5 in}{4.5 in}% +% {% +% \linewidth = 0.3 pt +% \Xaxis {Title}{} +% \Yaxis {\kern -5pt $Y$}{,2,4,6,8,10} +% \yaxis {$y$}{0.0,,0.2,,0.4,,0.6,,0.8,,1.0} +% \xaxis {$x$}{10^0 \ratio 1:2,\ratio 2:3,\ratio 3:4,\ratio 4:5,\ratio 5:6, +% \ratio 6:7,\ratio 7:8,\ratio 8:9,\ratio 9:1, +% 10^1 \ratio 1:2,\ratio 2:3,\ratio 3:4,\ratio 4:5,\ratio 5:6, +% \ratio 6:7,\ratio 7:8,\ratio 8:9,\ratio 9:1, +% 10^2 \ratio 1:1} +% \plotsymbol (.9,.9)a +% \plottext (.2,.4){some text} +% \plottext (.25,.7){more text} +% }% +%\bye diff --git a/macros/plain/contrib/misc/rcs.tex b/macros/plain/contrib/misc/rcs.tex new file mode 100644 index 0000000000..da6e55769d --- /dev/null +++ b/macros/plain/contrib/misc/rcs.tex @@ -0,0 +1,47 @@ +\catcode`\@=11 +%% +%% REVISION CONTROL [by kris@diku.dk]. +%% +%% \thedate +%% \therevision +%% These contain the date and revision of this paper, set by the +%% following revision control commands. Default to the current date and +%% to nothing. +%% +%% \RCSdate$...$ +%% \RCSrevision$...$ +%% Modify the date and revision of the paper as given by the RCS +%% variables Date and Revision (not inserted above because then RCS +%% would interfere with this comment). Use before \Draft. +%% +%% \Draft +%% \ifdraft...\else...\fi +%% \Draft prepends ``Draft'' to \therevision and sets \drafttrue. +%% +\edef\today{\ifcase\month\or January\or February\or March\or April\or + May\or June\or July\or August\or September\or October\or November\or + December\fi\space\number\day, \number\year} +\def\eat@#1{} +%% +\def\thedate{\today} +\def\therevision{} +%% +\def\RCSdate$Date{% + \def\next@{% + \ifx\next$\let\nextii@=\eat@\else\let\nextii@=\RCSdate@\fi\nextii@}% + \futurelet\next\next@} +\def\RCSdate@: #1/#2/#3 #4 ${\xdef\thedate{% + \ifcase#2\or January\or February\or March\or April\or + May\or June\or July\or August\or September\or October\or November\or + December\fi\space\ignorespaces#3, \ifnum#1<100\relax19\fi#1}} +%% +\def\RCSrevision$Revision{% + \def\next@{% + \ifx\next$\let\nextii@=\eat@\else\let\nextii@=\RCSrevision@\fi\nextii@}% + \futurelet\next\next@} +\def\RCSrevision@: #1 ${\xdef\therevision{[#1]}} +%% +\newif\ifdraft +\def\Draft{\xdef\therevision{Draft \therevision}\drafttrue} +%% +\catcode`\@=\active diff --git a/macros/plain/contrib/misc/redefine.tex b/macros/plain/contrib/misc/redefine.tex new file mode 100644 index 0000000000..9b24b024e7 --- /dev/null +++ b/macros/plain/contrib/misc/redefine.tex @@ -0,0 +1,83 @@ +% -*- Mode: TeX -*- + +\ifx\thisfileis\anUndefinedMacro\input maybeload \fi + +\thisfileis{<eb.tex.texlocal>redefine} % abort loading if we're already loaded + +% The LaTex macros in this file provide redefinition warnings. +% Also, the LaTex \newcommand facility is changed so that using +% \newcommand to redefine a function produces only a warning +% message, not an error. + +% A control sequence equivalent to \relax is considered +% undefined, as in LaTex. + +% However, allocation commands such as \newtoks are changed so +% that no redefinition takes place if their arguments are already +% defined. + +\makeatletter + +\edef\@backslash{\expandafter\@car\string\relax\@nil} + +\def\@warnredef#1{\typeout{WARNING: The `#1' control sequence is being redefined.}} + +\def\@warnnoredef#1{\typeout{WARNING: Aborting redefinition of the `#1' control sequence.}} + +\def\@ifcsundefined#1#2#3{\ifx #1\anUndefinedMacro + \def\@@temp{#2}\else\ifx #1\relax\def\@@temp{#2}\else + \def\@@temp{#3}\fi\fi\@@temp} + +% Change LaTex behavior. + +\def\@notdefinable{\@warnredef{\@backslash\@tempa}} + +% Define \redefcheck{\ctlseq} that just checks the sequence +% and ignores it. + +\def\redefcheck#1{\@ifcsundefined#1{}{\@warnredef{\string#1}}} + +% \redefabort{\oneargdefiner}{\ctlseq} puts out \oneargdefiner\ctlseq, +% except that if \ctlseq is already defined, it just gobbles both +% of them. + +\def\redefabort#1#2{\@ifcsundefined#2{#1#2}{\@warnnoredef{\string#2}}} + +% Define \newdef = \def with \redefcheck, and similarly for \gdef and \let. + +\def\newdef#1{\redefcheck{#1}\def#1} +\def\newgdef#1{\redefcheck{#1}\gdef#1} +\def\newlet#1{\redefcheck{#1}\let#1} + +% Add redefinition checking to \newif. +% \newif is declared as \outer, so we need to delay the definition +% of \latexnewif until we've scanned the definition of the new +% \newif. + +\let\@tempa\newif +\def\newif#1{\redefcheck{#1}\latexnewif#1} +\let\latexnewif\@tempa + +% Now for the allocation commands, which I'm setting up to skip the +% redefinition if their target control sequences are already defined. +% These are also declared \outer, but the above \@tempa trick won't work +% here; it's necessary to use another level of macros. + +\def\latexnewbox{\latexouternewbox} +\let\latexouternewbox\newbox +\def\newbox#1{\redefabort\latexnewbox{#1}} + +\def\latexnewcount{\latexouternewcount} +\let\latexouternewcount\newcount +\def\newcount#1{\redefabort\latexnewcount{#1}} + +\def\latexnewdimen{\latexouternewdimen} +\let\latexouternewdimen\newdimen +\def\newdimen#1{\redefabort\latexnewdimen{#1}} + +\def\latexnewtoks{\latexouternewtoks} +\let\latexouternewtoks\newtoks +\def\newtoks#1{\redefabort\latexnewtoks{#1}} + +\makeatother + diff --git a/macros/plain/contrib/misc/reference.tex b/macros/plain/contrib/misc/reference.tex new file mode 100644 index 0000000000..965b31577f --- /dev/null +++ b/macros/plain/contrib/misc/reference.tex @@ -0,0 +1,166 @@ +%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +% Version 2.1 +% 6/27/86 +% Written by: B.A. Leland (XHEMIA:BAL) +% Calif Inst of Technology +% Recognizes only ascending sequential footnote numbers, prints +% everything else as read in the list +% Required defs: +% dash : defined as $^{-}$ +% checkref#1 : to determine if the reference has yet been +% cited --- calls quickcnt +% note#1 : initializes flags, counters, calls refext +% refext#1 : does all the work, calls checkref, then prints +% the footnote numbers. If newref=true write the +% reference to the output file with its footnote +% number, and redefine the def of the reference to +% equal the current footnote number. If the +% references are anything but ascending sequential +% numbers, print the numbers separated by commas. +% quickcnt#1 : based on Knuth's length macro (TeXbook, p.219) +% counts the no. of non-blank characters in the +% reference. If > or = 4, set the newref flag to +% true. +% Required misc: +% counters +% ftnum: previous footnote number of a newly cited ref +% prev: previous PRINTED footnote number +% flags +% dsh : true = enable dash printing for no. ranges +% newref : true = a reference that has not been cited +% +%\immediate\openout1=reflist % open the ouput file 'reflist.tex' +%\newcount\ftnum % footnote number counter +%\newcount\prev % previous footnote number +%\newif\ifdsh % dsh=true: enable "dash" printing for ranges of #s +%\def\dash{$^{-}$} % a dash for ranges of numbers +%--------------------------------------------------------------------- +%\def\note#1{{ +%\dshtrue % toggle dsh flag to enable range printing +%\prev=0 % initialize prev counter +%\count0=0 % initialize cycle counter +%\refext#1\end}} % call refext with list of references as argument +%--------------------------------------------------------------------- +%\def\refext#1{ +%\ifx#1\end % \end is appended at end of reference list +% \ifdsh % dsh=true do nothing +% \else $^{\number\prev}$\fi\let\next=\relax % finish the range, quit +%\else\checkref#1 % see if the reference has been cited previously +% \ifnewref\global\advance\ftnum by1 % new reference, +% % inc ftnum counter +% \immediate\write1{\noexpand\item{$^{\the\ftnum}$}#1} +% \xdef#1{\the\ftnum} % write the reference to the output file, +% % and redefine the reference to be +% % the current footnote number +% \fi +% \ifnum\count0=0 $^{#1}$ % first cycle, print the first no. +% \else \ifnum\prev=#1 % duplicate reference, ignore +% \else\advance\prev by1 % increment the prev counter +% \ifnum\prev=#1 % if true, sequence is sequential +% \ifdsh % if dsh enabled, +% \dash % print a dash for the range +% \dshfalse % and disable the dsh flag +% \fi +% \else\ifdsh $^{,\,#1}$ % if dsh enabled, print ", #" +% \else % a dash was printed previously +% \advance\prev by-1 % restore prev counter +% $^{\number\prev ,\,#1}$ % finish the range, and +% % print the new (non-sequential) no. +% \dshtrue % toggle the dsh flag +% \fi +% \fi +% \fi +% \fi +% \prev=#1 % save current footnote number in prev counter +% \advance\count0 by1 % increment cycle counter +% \let\next=\refext % recursive call +%\fi +%\next} +%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +%\newcount\qckcntr +%\newif\ifnewref % newref=true: 1st occurance of a given reference +%--------------------------------------------------------------------- +%\def\checkref#1{{ +%\global\newreffalse % toggle the newref flag +%\qckcntr=0 % initialize cycle "register" +%\expandafter\quickcnt#1\end % expand the passed reference appending \end +%\relax}} +%--------------------------------------------------------------------- +%\def\quickcnt#1{ +%\ifx#1\end \let\next=\relax % relax and quit +%\else\advance\qckcntr by1 % increment cycle register +% \ifnum\qckcntr<4 % <4 cycles means nothing, so do nothing +% \else\global\newreftrue % >= 4 means the reference has not been +% % previously cited, toggle the newref flag +% \fi +% \let\next=\quickcnt % recursive call +%\fi +%\next} +%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +%________________________BEGIN__DEFS__________________________________ +% +\immediate\openout1=reflist % open the ouput file 'reflist.tex' +\newcount\ftnum % footnote number counter +\newcount\prev % previous footnote number +\newif\ifdsh % dsh=true: enable dash printing +\def\dash{$^{-}$} +\def\note#1{{\dshtrue \prev=0 \count0=0 \refext#1\end}} +\def\refext#1{\ifx#1\end +\ifdsh\else $^{\number\prev}$\fi\let\next=\relax +\else\checkref#1\ifnewref\global\advance\ftnum by1 \immediate +\write1{\noexpand\item{$^{\the\ftnum}$}#1}\xdef#1{\the\ftnum}\fi +\ifnum\count0=0 $^{#1}$\else \ifnum\prev=#1 \else +\advance\prev by1 \ifnum\prev=#1 \ifdsh \dash\dshfalse\fi\else +\ifdsh $^{,\,#1}$\else +\advance\prev by-1 $^{\number\prev ,\,#1}$\dshtrue \fi\fi\fi\fi +\prev=#1 \advance\count0 by1 \let\next=\refext\fi \next} +% +\newcount\qckcntr +\newif\ifnewref % newref=true: 1st occurance of a given reference +\def\checkref#1{{\global\newreffalse\qckcntr=0 +\expandafter\quickcnt#1\end \relax}} +\def\quickcnt#1{\ifx#1\end \let\next=\relax +\else\advance\qckcntr by1 \ifnum\qckcntr<4 \else\global\newreftrue\fi +\let\next=\quickcnt\fi \next} +% +%__________________________END__DEFS__________________________________ +%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +% +% S A M P L E U S A G E +% +% \def\a{this is reference a} +% \def\aaa{aaaaa} +% \def\b{this is reference b which has \reff } +% \def\c{this is reference c which has \reff } +% \def\d{this is reference d which has \reff } +% \def\e{this is reference e which has \reff } +% \def\g{this is reference e which has \reff } +% \def\reff{reference f} +% +% {\rm +% \ftnum=9 +% This is the example\note{\a} of +% a\note{\b} paragraph +% which contains footnotes that will ultimately end up on +% a reference page. +% This is the +% second\note{\a} which +% is supposed to be the same as the first reference. +% If we continue, we\note{\c\b} should get another +% one\note{\d} and\note{\a} so\note{\e} on. +% If one needs to recall a couple of references\note{\aaa} one +% uses a the same macro\note{\a\b\c\d\e} as before. +% It is supposed to handle\note{\a\b\d\e} most any situation +% up to and almost including\note{\e\d\c\b\a} except +% this\note{\b\a\d\e} or this.\note{\a\b\c\d\d} One +% must be cautioned that this has not been fully tested as yet.......... +% \vskip0.5truein +% \immediate\closeout1 +% \vfill\eject +% \baselineskip=14pt +% \parindent=0pt +% \parskip=0.1truein +% \input reflist.tex +% } +% \vfill\end +% diff --git a/macros/plain/contrib/misc/resume.tex b/macros/plain/contrib/misc/resume.tex new file mode 100644 index 0000000000..31f7d4645d --- /dev/null +++ b/macros/plain/contrib/misc/resume.tex @@ -0,0 +1,352 @@ +%%% RESUME Library Created by KMP@MC -- Feb/Mar 1980 +%%% Converted for TEX from TEX80 by PARKER@OZ and MARC@OZ -- June 1985 +%%% Extended with NEWSECTION by MARKUS@OZ and PARKER@OZ -- Jan 1986 +%%% +%%% Please notify PARKER@OZ of any changes to this file. +%%% +%%% This is a library for creating cookbook resumes. Everything is here. +%%% All you add are the lies about yourself. +%%% +%%% For a sample usage, see the file TEXLOCAL:RESUME-SAMPLE.TEX +%%% See the file TEXLOCAL:RESUME.CONVERSION for information on +%%% converting your old TeX resume to run under the new system. +%%% +%%% Note: Currently you must run TeX using this package by doing: +%%% @TEXTR <resume filename> +%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% If things go wrong using this file, here are some common problems. +%%% If all else fails, send me (PARKER@OZ) mail and maybe we can fix it. +%%% +%%% Debugging help: +%%% ******THIS IS CRITICAL******* +%%% -- look at arglist, esp. for twocol, split, and newsection. If there is a +%%% space between the args (such as #1 and #2), then there must be +%%% one in the source. +%%% ******END CRITICAL SECTION**** +%%% -- if you get black vertical bars on your output, that means that +%%% a line was overfull. Often the reason for this is the +%%% width of the page (pagewidth) is not big enough to contain +%%% both the section label and the value you specified for +%%% textwidth. Adjust these numbers and all should work. +%%% Be sure that if you have a big label name, you use twoline +%%% to split it to two lines. +%%% -- if you get a vertical overfull box problem and you have a one-line +%%% objective, you will need to put \vskip .125in +%%% in the format section at the end of your resume just after the +%%% line \objective and just before the next one. You may still +%%% get a warning from TeX about this box, but you will not have +%%% any crowding on your output. +%%% A possibly easier way of doing this is to make your objective +%%% look like this: +%%% \defsection{\objective}{\twoline {Employment}{Objective}} +%%% {\text {This is my short objective.} +%%% \text { }} +%%% This blank text box will fake TeX into giving you the space you +%%% need AND you won't get any warnings. +%%% -- If you get font problems, try using the defaults and running +%%% TeX using TEXTR, which uses the Times Roman font family. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%% System implementor's message. +\message{Please read the file TEXLOCAL:RESUME.TEX if you have problems.} +\message{Note: Currently there are bugs w.r.t. output to QMS.} + +%%% Define system parameters + +\rm % Roman character set default type face +\hsize=36pc % Page width = 36 picas ( 6 in ) +\vsize=45pc % Page height = 45 picas ( 7-1/2 in ) +\nopagenumbers % Flush page nos. +\parindent=0pt % Flush indenting of paragraphs. + % Can be turned on locally if psyched to use it. + +%% Used in old TeX, but not needed here. +%% \output{\page} % Just output page with no special headings, etc + +%% For now, at least as best I can tell from the point macros in TEXTR, +%% small capitals aren't going to work, so just make them do something safe. +\def\sc #1{\rm #1} + + +%%% Define macros used internally + + +\newdimen\rwid %% Width of the right box (text) is 28pc ( 4-2/3 in ) +\rwid=28pc + +%%% These commands may be used to enter a given typeface. +%%% +%%% \roman{... stuff to put in roman ...} +%%% \bold{... stuff to put in bold ...} +%%% \italic{... stuff to put in italic ...} + +\def\roman#1{{\rm #1}} +\def\bold#1{{\bf #1}} +\def\italic#1{{\it #1}} + + +%%% These macros are provided for users who wish to change the various +%%% width and height parameters used by this package. +%%% +%%% \textwidth size +%%% \pagewidth size +%%% \pagelength size + +\def\textwidth #1{\rwid=#1} +\def\pagewidth #1{\hsize#1} +\def\pagelength #1{\vsize#1} + + +%%% Added by PARKER 6/85 to facilitate columnarizing of courses. +%%% +%%% Usage: \twocol{Foo Chemistry}{Bar Mathematics} +%%% + +\def\twocol#1#2{\hbox to \rwid{\ourtextfont\hbox to 13.5pc{#1\hfill} + \hfill\hbox to 13.5pc{#2\hfill}}} + +%%% Commands for setting fonts. 'fontcmd' refers to a normal TeX font +%%% affecting command such as \bf or \tenpoint. +%%% +%%% The font of text defined with \defname +%%% \defnamefont{fontcmd} sets the font to be used for your name +%%% \namefont changes to that font +%%% +%%% For varying the font of text in a \defsection +%%% \defheaderfont{fontcmd} sets the font to be used for section headers +%%% \headerfont changes to that font +%%% +%%% For varying the font of text in a \defaddress +%%% \defaddressfont{fontcmd} sets the font to be used in the address +%%% \addressfont changes to that font +%%% +%%% For varying the font of text in a \split +%%% \deflsplitfont{fontcmd} sets the font to be used on the left of a split +%%% \rsplitfont changes to that font +%%% \defrsplitfont{fontcmd} sets the font to be used on the right of a split +%%% \lsplitfont changes to that font +%%% +%%% For varying the font of text in a \text +%%% \defourtextfont{fontcmd} is the font to be used in the main text area +%%% \ourtextfont changes to that font + +\def\namefont{\twelvepoint\bf} % used to be HV14B +\def\defnamefont#1{\def\namefont{#1}} + +\def\headerfont{\twelvepoint\bf} % used to be HV12B +\def\defheaderfont#1{\def\headerfont{#1}} + +\def\labelfont{\tenpoint\bf} +\def\deflabelfont#1{\def\labelfont{#1}} + +\def\lsplitfont{\tenpoint\bf} +\def\deflsplitfont#1{\def\lsplitfont{#1}} + +\def\rsplitfont{\ninepoint\rm} +\def\defrsplitfont#1{\def\rsplitfont{#1}} + +\def\ourtextfont{\tenpoint\rm} % was 9pt, but was losing...RP 6/30/85 17:58:20 +\def\deftextfont#1{\def\ourtextfont{#1}} + +\def\addressfont{\ninepoint\rm} +\def\defaddressfont#1{\def\addressfont{#1}} + + +%%% \skip -- inserts a gap between lines +%%% \space -- inserts whitespace between horizontal text blocks + +\def\skip{\par\vskip 6pt} +\def\space{\hfill} + +%%% \defname{yournamegoeshere} +%%% +%%% You must declare the name to go at the top of the form using this +%%% macro. + +\def\defname#1{\gdef\name{\hbox to \hsize{\namefont\hfill #1\hfill}\par + \vskip 8pt}} + +%%% \defaddress{\macroname}{addressname}{...specs...} +%%% specs may include +%%% \street{...street address...} %% Required +%%% \apt{apartment or room info} %% Optional +%%% \city{cityname, statename} %% Required +%%% \zip{02139} %% Optional +%%% \phone{(617) 253-6765} %% Optional +%%% +%%% This defines an address box. They must appear in the specified order. +%%% If required specs are not given, results may be unpredictable. +%%% Any number of addressses may be defined---if you think they'll fit. +%%% The format for how they get laid out is specified in the \format +%%% command farther down. + +\def\defaddress#1#2#3{ + \gdef#1{{\def\stext{} \def\ctext{} \def\ztext{} \def\atext{} + \def\qtext{\hbox{ }} \def\ptext{\hbox{ }} + \def\street####1{\def\stext{####1}} + \def\apt####1{\def\atext{\hbox{####1} \def\qtext{}}} + \def\city####1{\def\ctext{####1}} + \def\zip####1{\def\ztext{####1}} + \def\phone####1{\def\ptext{####1}} + #3 + \addressfont\vbox{\hbox{\bf #2 Address} %%% used to have $\!$ + %% + %% These next two lines used to be in the + %% other order [street then apt] but, as + %% pointed out by SR.WILSON@SPEECH, the + %% US Postal Service recommend an ordering + %% of information based on specificness. + %% If this change upsets you, simply + %% copy this \def into the beginning + %% of your resume file (after the \input) + %% and reverse them there. --RP 4/86 + \atext + \hbox{\stext} + \hbox{\ctext\quad \ztext} + \hbox{\ptext} + \qtext}}}} + + +%%% \defsection{macroname}{sectionname} +%%% {main text of section} +%%% +%%% This macro allows you to define a macro named macroname which can be +%%% called later and which will produce a box which looks like +%%% +%%% sectionname ... text ........ +%%% ... more text ... +%%% ... etc ......... +%%% +%%% The text of section must be constructed in turn by the use of either +%%% of two special operators. +%%% +%%% \text{...} means that the text in the box is to be set as a +%%% normal paragraph +%%% +%%% \split{...} {...} means that the two boxes are to be set on a single +%%% line separated by whitespace. The first box is in +%%% 9pt bold by default, the second is 8pt roman. +%%% +%%% A sample section definition looks like: +%%% +%%% \defsection{\education} {Education} +%%% {\split{Massachusetts Institute of Technology} {Cambridge, MA} +%%% \text {Got a Bachelor of Science in Humanities. Didn't learn much.} +%%% \space +%%% \split{Foo High School} {NoWhere, USA} +%%% \text {I didn't really graduate from high school. I just kinda +%%% gave up after a while and took up kollidge.}} +%%% + +\def\defsection#1#2 #3 + {\gdef#1{\headerfont + \setbox1=\hbox{\hsize \rwid\vbox{#3\par\vskip 10pt}} + \hbox to \hsize{\vbox to 1\ht1{\hbox{#2}\vfil} + \hfil + \box1}}} + +%%% NEWSECTION -- allows you to produce output with year labels, for instance, +%%% to the right of each of your jobs. An alternative to putting the +%%% year information inside the job description. +%%% +%%% This NEWSECTION by Markus Toth (MARKUS@OZ). +%%% +%%% Example of what the source code should look like: +%%% +%%%\defnewsection{\work}{Experience} +%%% {\skip +%%% \seclayer{\twoline {1985 to} {Present}} +%%% {\split{Company A, Inc.} {Nowhere, MA} +%%% \text {As director of food consumption....}} +%%% \skip +%%% \seclayer{\twoline {1982 to} {1985}} +%%% {\split{Company B, Ltd.} {Somewhere, MA} +%%% \text {Associate Research Scientist. ....}} +%%% \vskip 0pt}} %% THIS MUST BE HERE +%%% +%%% And here is the output produced by that: +%%% +%%% Experience +%%% +%%% 1985 to Company A, Inc Nowhere, MA +%%% Present As director of food consumption... +%%% +%%% 1982 to Company B, Ltd. Somewhere, MA +%%% 1985 Associate Research Scientist. .... +%%% +%%% Note that the \vskip 0pt at the end of \defnewsection is CRITICAL. +%%% Yes, this is a bug, and no we aren't going to fix it now. +%%% And, yes, you are welcome to fix it iff you know how. + +\def\defnewsection#1#2 #3 + {\gdef#1{\headerfont + \hbox to \hsize{#2 \hfil} + #3}} + +%%% SECLAYER -- each layer (i.e. each job) needs to be in one of these. +%%% +%%% Note that it uses LABELFONT for the labels. You can define labelfont +%%% with \deflabelfont{\tenpoint\bf} or whatever. + +\def\seclayer#1 #2 + {\labelfont + \setbox1=\hbox{\hsize \rwid\vbox{#2\par\vskip 10pt}} + \hbox to \hsize{\vbox to 1\ht1{\hbox{#1}\vfil} + \hfil + \box1}} + + +%%% \oneline{text} - a no-op +%%% \twoline{text}{text} - creates a two-line box +%%% \threeline{text}{text}{text} - creates a three-line box +%%% +%%% These are for trivially creating one, two, or three line boxes for the +%%% label field in the main body. + +\def\oneline#1{#1} +\def\twoline#1#2{\vbox{\hbox{#1}\hbox{#2}}} +\def\threeline#1#2#3{\vbox{\hbox{#1}\hbox{#2}\hbox{#3}}} + + + +%%% \format{addresslist} +%%% {bodylist} +%%% +%%% This is what defines how things get laid out. Just list out your +%%% address names (separate them with a \space) and your section names +%%% in the order you want them to appear. eg, +%%% +%%% \format{\home\space\work\space\permanent} +%%% {\objective\skip\education\skip\background} +%%% +%%% This will define a \copy and that will make it get output. You may +%%% change fonts, etc, between doing \copy's and the changes will affect +%%% subsequent \copy commands. You'll need to supply your own \bye at +%%% the end of the file. + +\def\format #1 #2{ + \count0=0 + \gdef\copy{\global\advance\count0 by 1 + {\def\split####1 ####2{\hbox to\rwid{\lsplitfont ####1\hfill\rsplitfont ####2}} + \def\text####1{\hbox {\hsize \rwid \vbox{\ourtextfont ####1}}} + \hbox{$ $}\par\vfill\name\vfill\hbox to \hsize{#1}\par\vfill + #2\par\vfill\eject}}} + +%% \def\format #1 #2{ +%% \setcount0 0 +%% \gdef\copy{\advcount0 +%% {\def\split####1 ####2{\hbox to \rwid{\lsplitfont ####1\hfill\rsplitfont ####2}} +%% \def\text####1{\hbox par \rwid{\textfont ####1}} +%% \hbox{$ $}\par\vfill\name\vfill\hbox to size {#1}\par\vfill +%% #2\par\vfill\eject}}} + + +% Local Modes: +% MM AutoTeX Mode:1,m.mTex Mode"e m(m.m Load Library)TeX'w +% Mode:AutoTeX +% Comment Column:40 +% Comment Start:% +% Atom Word Mode:0 +% Auto Fill Mode:0 +% End: diff --git a/macros/plain/contrib/misc/rightfig.mac b/macros/plain/contrib/misc/rightfig.mac new file mode 100644 index 0000000000..25fa72efb5 --- /dev/null +++ b/macros/plain/contrib/misc/rightfig.mac @@ -0,0 +1,103 @@ +\newif\ifoutput +\newtoks\outputpretest + +\edef\oldoutput{\the\output} % copy old output routine +\output={\the\outputpretest \ifoutput \oldoutput \fi} + +\outputpretest={\outputtrue}% default "outputpretest" routine + + +% Define an alternate "outputpretest" routine -------------------------------- + +\newbox\pagebox +\newdimen\pageht + +\newif\iftryingfig \tryingfigfalse +\newif\ifdoingfig \doingfigfalse +\newif\ifpageafterfig \pageafterfigfalse + +\def\dofigtest{% + \ifnum\outputpenalty=-10001 + \setbox\pagebox=\vbox{\unvbox255}% + \global\pageht=\ht\pagebox + \outputfalse + \unvbox\pagebox + \else + \outputtrue + \ifdoingfig + \pageafterfigtrue + \fi + \fi +} + + +% Define the "tryfig" macro for testing figure placement --------------------- + +\newdimen\startpageht +\newdimen\htdone \htdone=0pt + +\edef\oldeverypar{\the\everypar} +\everypar={\tryfig \oldeverypar} + +\def\tryfig{% "\global" is used in case user does any grouping + \iftryingfig + {\everypar={\relax}\setbox0=\lastbox + \parindent=\wd0 \parskip=0pt \par + \penalty-10001 \leavevmode}% + \dimen0=\vsize \advance\dimen0 by -\pageht + \advance\dimen0 by -2\baselineskip + \ifdim\dimen0>\ht\figbox + \dimen0=0.3\baselineskip \vrule depth \dimen0 width 0pt + \vadjust{\kern -\dimen0 \vtop to \dimen0{\baselineskip=\dimen0 + \vss \vbox to 1ex{\hbox to \hsize{% + \hss \copy\figbox}\vss}\null}}% + \global\tryingfigfalse + \global\doingfigtrue + \global\startpageht=\pageht + \global\htdone=0pt + \dohang + \fi + \else + \ifdoingfig + {\everypar={\relax}\setbox0=\lastbox + \parindent=\wd0 \parskip=0pt \par + \penalty-10001 \leavevmode}% + \global\htdone=\pageht + \global\advance\htdone by -\startpageht + \ifpageafterfig + \global\doingfigfalse + \else + \ifdim\htdone<\ht\figbox + \dohang + \else + \global\doingfigfalse + \fi + \fi + \else + \global\outputpretest={\outputtrue}% + \fi + \fi +} + + +% Define macro to activate the figure insertion macros ----------------------- + +\def\rightinsert{% + \outputpretest={\dofigtest} + \tryingfigtrue \doingfigfalse \pageafterfigfalse +} + + +% Define macro to calculate and set hanging indent values -------------------- + +\newcount\hangcount +\newdimen\figgutter % gap between text and figure + +\def\dohang{% + \dimen0=\ht\figbox \advance\dimen0 by -\htdone + \advance\dimen0 by 1.49\baselineskip \hangcount=\dimen0 + \divide\hangcount by \baselineskip + \dimen0=\wd\figbox \advance\dimen0 by \figgutter + \global\hangafter=-\hangcount \global\hangindent=-\dimen0 +} + diff --git a/macros/plain/contrib/misc/rotate.tex b/macros/plain/contrib/misc/rotate.tex new file mode 100644 index 0000000000..27891ee95e --- /dev/null +++ b/macros/plain/contrib/misc/rotate.tex @@ -0,0 +1,43 @@ +% +% These macros allow you to rotate or flip a \TeX\ box. Very useful for +% sideways tables or upsidedown answers. +% +% To use, create a box containing the information you want to rotate. +% (An hbox or vbox will do.) Now call \rotr\boxnum to rotate the +% material and create a new box with the appropriate (flipped) dimensions. +% \rotr rotates right, \rotl rotates left, \rotu turns upside down, and +% \rotf flips. These boxes may contain other rotated boxes. +% +\newdimen\rotdimen +\def\vspec#1{\special{ps:#1}}% passes #1 verbatim to the output +\def\rotstart#1{\vspec{gsave currentpoint currentpoint translate + #1 neg exch neg exch translate}}% #1 can be any origin-fixing transformation +\def\rotfinish{\vspec{currentpoint grestore moveto}}% gets back in synch +% +% First, the rotation right. The reference point of the rotated box +% is the lower right corner of the original box. +% +\def\rotr#1{\rotdimen=\ht#1\advance\rotdimen by\dp#1% + \hbox to\rotdimen{\hskip\ht#1\vbox to\wd#1{\rotstart{90 rotate}% + \box#1\vss}\hss}\rotfinish} +% +% Next, the rotation left. The reference point of the rotated box +% is the upper left corner of the original box. +% +\def\rotl#1{\rotdimen=\ht#1\advance\rotdimen by\dp#1% + \hbox to\rotdimen{\vbox to\wd#1{\vskip\wd#1\rotstart{270 rotate}% + \box#1\vss}\hss}\rotfinish}% +% +% Upside down is simple. The reference point of the rotated box +% is the upper right corner of the original box. (The box's height +% should be the current font's xheight, \fontdimen5\font, +% if you want that xheight to be at the baseline after rotation.) +% +\def\rotu#1{\rotdimen=\ht#1\advance\rotdimen by\dp#1% + \hbox to\wd#1{\hskip\wd#1\vbox to\rotdimen{\vskip\rotdimen + \rotstart{-1 dup scale}\box#1\vss}\hss}\rotfinish}% +% +% And flipped end for end is pretty ysae too. We retain the baseline. +% +\def\rotf#1{\hbox to\wd#1{\hskip\wd#1\rotstart{-1 1 scale}% + \box#1\hss}\rotfinish}% diff --git a/macros/plain/contrib/misc/scmac.tex b/macros/plain/contrib/misc/scmac.tex new file mode 100644 index 0000000000..e1b641465a --- /dev/null +++ b/macros/plain/contrib/misc/scmac.tex @@ -0,0 +1,137 @@ + +%% scmac.tex +%% TeX macros for typesetting scripts version 2.00 +%% Copyright (C) 1989 by Na Choon Piaw +%% This file may be freely used, distributed, and modified provided +%% credit is given to the original author. You can even try to sell it, +%% assuming someone's willing to pay for this, of course. + +%% This is a major rewrite --- hence, no change update is given. +%% For more information see the user's documentation. + +%% tell user what version + +\immediate\write16{Loading scmac version 2.00 Beta release ...} + +%% fonts --- Use Computer Modern. Substitute these with local +%% equivalents if no Computer Modern. +\font\bigtenrm=cmr10 scaled\magstep2 %% big font for title +\font\rm=cmr10 %% standard roman text +\font\bf=cmbx10 %% for bold +\font\sl=cmsl10 %% slanted text +\font\it=cmti10 %% italics + +%% variable declarations +\newcount\fnotecnt +\newcount\FootNoteStyle +\newcount\Style +\newwrite\auxfile +\fnotecnt=1 +\FootNoteStyle=1 %% "true" footnotes +\Style=1 + +%% preamble handling +\def\Title{} +\def\transl{} +\def\oth{} +\def\cpmessage{} +\def\heading#1{\global\headline={\bf #1 \hfil Page \folio}} +\def\translator#1{\edef\transl{\noindent\it Translation by #1.\hfil}} +\def\others#1{\edef\oth{\noindent\it #1.\hfil}} +\footline={\hfil} + +%% open auxilary file. +\immediate\openout\auxfile=\jobname.aux + +%% Environments +\def\beginscript{ + \Title + \cpmessage + \transl + \oth + %% Open output file for footnotes + %% Can your wordprocessor do this? +} + +\def\endscript{ +\immediate\closeout\auxfile +\ifnum\FootNoteStyle=1 + \relax +\else + %% read in from aux file. + \bigskip + \filbreak + \line{\bf Footnotes\hfil} + \openin 1 = \jobname.aux + \readfootnotes +\fi +} + +%% songs +\def\beginsong{\bigskip\begingroup\obeylines\narrower} +\def\endsong{\par\endgroup\bigskip} + +\def\readfootnotes{ +%% recursive TeX macro! Can WordPerfect do this? +\def\temp{} +\ifeof 1 + \relax +\else + \read 1 to \temp + \ifeof 1 + \relax + \else + \item{[\temp]} + \read 1 to \temp + \temp + \readfootnotes + \fi +\fi +} + +%% describe and desc are unchanged. +\def\describe#1{\sl #1 \medskip\goodbreak} +\def\desc#1{\it (#1\/)\rm} + +%% footnoting +\def\fnote#1{\ifnum\FootNoteStyle=1 +%% footnotes at bottom of page + \footnote{$^{\the\fnotecnt}$}{\rm #1} +\else +%% new-style typeinto aux file for readback +%% remember to change the \hskip value for different fonts! + $^{\the\fnotecnt}$ \hskip -0.15in + \immediate\write\auxfile{\the\fnotecnt} + \immediate\write\auxfile{#1} +\fi +\global\advance\fnotecnt by 1 +} + +%% unavoidable processing +\ifnum\Style=1 + %% old style: version 1.xx + \gdef\say#1#2{ + \centerline{\bf #1} + { + \parindent=1in + \rm\narrower\raggedright\noindent + #2 + \par + } + \bigskip\goodbreak + } +\else + %% version 2.xx + \gdef\say#1:#2\par{ + \centerline{\bf #1} + { + \parindent=1in + \rm\narrower\raggedright\noindent + #2 + \par + } + \bigskip\goodbreak + } +\fi + + diff --git a/macros/plain/contrib/misc/scmac202.tex b/macros/plain/contrib/misc/scmac202.tex new file mode 100644 index 0000000000..cf838a320e --- /dev/null +++ b/macros/plain/contrib/misc/scmac202.tex @@ -0,0 +1,205 @@ +%% scmac.tex +%% TeX macros for typesetting scripts version 2.02 +%% Copyright (C) 1989 by Na Choon Piaw +%% This file may be freely used, distributed, and modified provided +%% credit is given to the original author. You can even try to sell it, +%% assuming someone's willing to pay for this, of course. + +%% \begin documentation + +%% 2.02 Alpha +%% There never was a 2.00 release. +%% Changes from the documentation are found here: + +%% Syntax change: +%% From the beginning of the file we have: +%% \input scmac.tex +%% \Style= +%% \FootNoteStyle= + +%% For the \Style, you may choose from: +%% \OldStyle (pre 2.00) +%% \NewStyle (post 2.00) + +%% \OldStyle is fully compatible with version 1.xx +%% \NewStyle is fully compatible with version 2.00 + +%% For \FootNoteStyle, you may choose from: +%% \EndNotes (Put footnotes at the end) +%% \FootNotes (Put footnotes at the bottom) + +%% Note that these are now the ONLY supported ways of specifying styles. +%% If you put in numbers directly, they might work in this version, but +%% if I change the macros in anyway in the next, they will no longer +%% work. + +%% \end documentation + +%% macros proper + +%% tell user what version +\message{Loading scmac version 2.01 Alpha ...} + +%% fonts --- Use Computer Modern. Substitute these with local +%% equivalents if no Computer Modern. +\message{fonts.} +\font\bigtenrm=cmr10 scaled\magstep2 %% big font for title +\font\rm=cmr10 %% standard roman text +\font\bf=cmbx10 %% for bold +\font\sl=cmsl10 %% slanted text +\font\it=cmti10 %% italics + +%% variable declarations +\message{counters.} +\newcount\fnotecnt +\newcount\FootNoteStyle +\newcount\EndNotes +\newcount\FootNotes +\EndNotes=0 +\FootNotes=1 +\newcount\Style +\newcount\OldStyle +\newcount\NewStyle +\OldStyle=1 +\NewStyle=2 +\newwrite\auxfile +\newread\auxrfile +\fnotecnt=1 +\FootNoteStyle=\FootNotes %% "true" footnotes +\Style=\NewStyle + +%% preamble handling +\message{preamble.} +\def\Title{} +\def\transl{} +\def\oth{} +\def\cpmessage{} +\def\heading#1{\global\headline={\bf #1 \hfil Page \folio}} +\def\translator#1{\edef\transl{\noindent\it Translation by #1.\hfil}} +\def\others#1{\edef\oth{\noindent\it #1.\hfil}} +\footline={\hfil} + +%% open auxilary file. +\message{output files.} +\immediate\openout\auxfile=\jobname.aux + +%% little patch to let me do the \let in side \beginscript +%% now, when i rewrite this, i'd better use @s in them just like +%% in plain.tex +\message{macros.} +\gdef\Styleone#1#2{ + \centerline{\bf \noexpand#1} + { + \parindent=1in + \rm\narrower\raggedright\noindent + \noexpand#2 + \par + } + \bigskip\goodbreak + } +\gdef\Styletwo#1:#2\par{ + \centerline{\bf #1} + { + \parindent=1in + \rm\narrower\raggedright\noindent + \noexpand + \hskip -1em\relax #2 + %% horizontal skip to combat the speech-offset + %% problem. Remove it if the problem + %% disappears. + \par + } + \bigskip\goodbreak + } + +%% global \say --- in standard old style --- to warn people that +%% the \style is not set + +\def\say#1#2{\message{! scmac Fatal Error: You must start the script with \string\beginscript and +end it with \string\endscript!} \end} + +% Environments +\def\beginscript{ + \Title + \cpmessage + \transl + \oth +%% Remember to recode in case format after I get the TeXbook back from +%% Case. (Yech! Just realized the horrible pun) + \ifnum\Style=\OldStyle + %% old style: version 1.xx + \let\say=\Styleone + \let\errcheck=\relax + \else + \ifnum\Style=\NewStyle + %% version 2.xx + \let\say=\Styletwo + \let\errcheck=\relax + \else + \message{!Scmac Fatal Error: Style \the\Style is not supported!} + \let\errcheck=\end + \fi + \fi + \errcheck +} + +\def\endscript{ +\immediate\closeout\auxfile +\ifnum\FootNoteStyle=\FootNotes + \relax +\else + \ifnum\FootNoteStyle=\EndNotes + %% read in from aux file. + \bigskip + \filbreak + \line{\bf Footnotes\hfil} + \openin\auxrfile = \jobname.aux + \readfootnotes + \else + \message{scmac Warning: \the\FootNoteStyle is not supported} + \fi +\fi +} + +%% songs +\def\beginsong{\bigskip\begingroup\obeylines\narrower} +\def\endsong{\par\endgroup\bigskip} + +\def\readfootnotes{ +%% recursive TeX macro! Can WordPerfect do this? +\def\temp{} +\ifeof 1 + \relax +\else + \read \auxrfile to \temp + \ifeof \auxrfile + \relax + \else + \item{[\temp]} + \read \auxrfile to \temp + \temp + \readfootnotes + \fi +\fi +} + +%% describe and desc are unchanged. +\def\describe#1{\sl #1 \medskip\goodbreak} +\def\desc#1{\it (#1\/)\rm} + +%% footnoting +\def\fnote#1{\ifnum\FootNoteStyle=1 +%% footnotes at bottom of page + \footnote{$^{\the\fnotecnt}$}{\rm #1} +\else +%% new-style typeinto aux file for readback +%% remember to change the \hskip value for different fonts! + $^{\the\fnotecnt}$ \hskip -0.15in + \immediate\write\auxfile{\the\fnotecnt} + \immediate\write\auxfile{#1} +\fi +\global\advance\fnotecnt by 1 +} +\message{done.} + + diff --git a/macros/plain/contrib/misc/scorecard.tex b/macros/plain/contrib/misc/scorecard.tex new file mode 100644 index 0000000000..5a8f560605 --- /dev/null +++ b/macros/plain/contrib/misc/scorecard.tex @@ -0,0 +1,173 @@ +% Scorecard.tex v 1.1 +% +% prints a baseball scorecard for one team; +% also prints summary statistics boxes (Pitcher's stats, Offense, +% Defense, and Pitching miscellanea, a Notes section, and a line score). +% +% This is currently intended to make a blank scorecard with which +% to score a baseball game, and additional space to record information +% with which to submit a Box Score with the information required by +% newspapers, league offices, etc. +% +% Margins are set for landscape printing, be sure to DVI it with +% the appropriate qualifiers. +% +% Shortly (ha ha) to come: scorecard.sty to allow full typesetting of +% a baseball game. If anyone is actually writing a book/article that +% could benefit from this, please let me know, as it may give me incentive +% to finish. +% +% Dedicated to my wife who thinks the rules are the best part of baseball. +% +% Matthew Wall 4/89 revised 4/28/89 - looks much better, added space +% to keep defensive stats +% +% WALL@BRANDEIS.Bitnet -or- matt%cs.brandeis.edu@relay.cs.net +% c/o Research and Academic Computing, Brandeis University, +% Waltham, MA, 02254 +% +% (c) 1989 +% Free for the world to enjoy. Let no one gain commercial benefit +% from this, lest ye be pushed into the pits of hell and the courts. +% +% May be freely modified and copied; please send neat changes/suggestions +% to me in the email. +% +% God Bless the Designated Hitter; +% To Lucifer with Astroturf; +% Domes for the needy; +% Smog for the undeserving; +% May baseball return to Washington, D.C. +% +% +\documentstyle[12pt]{article} +\pagestyle{empty} + + \setlength{\textwidth}{10.48in} + \setlength{\oddsidemargin}{-.95in} + \setlength{\evensidemargin}{-.95in} + + \setlength{\textheight}{7.7in} + \setlength{\topmargin}{-.95in} + + +\begin{document} +\noindent ~~~~Date: ~\hrulefill~ + At: ~\hrulefill~ + Team: ~\hrulefill~ + Vs: ~\hrulefill~\\ + + Start time: ~\hrulefill~ + End time: ~\hrulefill~ + Attendance: ~\hrulefill~ + Temperature: ~\hrulefill~\\ +\LARGE + +\begin{tabular}{||l|c||c|c|c|c|c|c|c|c|c|c||c|c|c|c||c|c|c||} \hline \hline +Player~~~~~& {\normalsize Pos}&~1~ & ~2~ & ~3~ & ~4~ & ~5~ & ~6~ & ~7~ & ~8~ & + ~9~ & ~10 & AB & ~H~ & ~R~ & BI + & P & A & E \\ \hline +{\tt\small - - - - - - - - - - - } & {\tt\small - - } +& & & & & & & & & & & & & & & & & \\ \hline +{\tt\small - - - - - - - - - - - } & {\tt\small - - } +& & & & & & & & & & & & & & & & & \\ \hline +{\tt\small - - - - - - - - - - - } & {\tt\small - - } +& & & & & & & & & & & & & & & & & \\ \hline +{\tt\small - - - - - - - - - - - } & {\tt\small - - } +& & & & & & & & & & & & & & & & & \\ \hline +{\tt\small - - - - - - - - - - - } & {\tt\small - - } +& & & & & & & & & & & & & & & & & \\ \hline +{\tt\small - - - - - - - - - - - } & {\tt\small - - } +& & & & & & & & & & & & & & & & & \\ \hline +{\tt\small - - - - - - - - - - - } & {\tt\small - - } +& & & & & & & & & & & & & & & & & \\ \hline +{\tt\small - - - - - - - - - - - } & {\tt\small - - } +& & & & & & & & & & & & & & & & & \\ \hline +{\tt\small - - - - - - - - - - - } & {\tt\small - - } +& & & & & & & & & & & & & & & & & \\ \hline +{\tt\small - - - - - - - - - - - } & {\tt\small - - } +& & & & & & & & & & & & & & & & & \\ \hline +{\tt\small - - - - - - - - - - - } & {\tt\small - - } +& & & & & & & & & & & & & & & & & \\ \hline \hline +Totals &{\normalsize H/R} & / & / & / & / & / & / & / & / & / & / & & & & +& & & \\ \hline \hline +\end{tabular} \\ + +\normalsize +% WP, LP, 2B, 3B, HR, SB, SF, S, HBP, BB, E, SO, WP, ER, R, H, IP,DP, PB, B, PO? + {\bf Notes:} \\ +\pagebreak + +\noindent ~~~~Date: ~\hrulefill~ + At: ~\hrulefill~ + Team: ~\hrulefill~ + Vs: ~\hrulefill~ \\ + +\LARGE + +\begin{tabular}{||l|r|r|r|r|r|r||r} \cline{1- 7} \cline{1- 7} +Pitcher~~~~~ & IP & ~H~ & ~R~ & ER & BB & SO &~~~{\bf\normalsize + Notes:} \\ \cline{1- 7} + & & & & & & & \\ \cline{1- 7} + & & & & & & & \\ \cline{1- 7} + & & & & & & & \\ \cline{1- 7} + & & & & & & & \\ \cline{1- 7} + & & & & & & & \\ \cline{1- 7} \cline{2- 7} +Totals & & & & & & & \\ \cline{1- 7} \cline{2- 7} +\end{tabular} \\ +\normalsize + +\medskip +% I apologize for all the unbreakable spaces to follow. \fill commands +% and tabular were just a bit too even to be useful, though they do look +% better. + +\framebox{ +\parbox{9.2in}{ +{\bf Offense} \\ +\noindent 2B:~~~~~~~~~~~~~~~~~~~~ \\ +3B:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +HR:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\\ +\noindent BB:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + SB:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~CS: +\\ +\noindent SF:~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + S:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + HBP:~~~~~~~~~~~~~~~~~~~~~~~~~~ + LOB:~~~~~~~~ +} +} \\ +\medskip + +\framebox{ +\parbox{9.2in}{ +{\bf Defense} \\ +\noindent PB:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +E:~~~~~\\ +\noindent DP:~~~~~~~~~~~~ +} +} \\ +\medskip + +\framebox{ +\parbox{9.2in}{ +{\bf Pitching} \\ +HB:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +WP:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Balk:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +IW:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \\ +Win/Loss: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Save: ~~~~~~~~~~~~~~~~~~~~~~ +} +} +\LARGE +\bigskip +\bigskip + +\begin{tabular}{||l||r|r|r|r|r|r|r|r|r||r|r|r|r||} \hline\hline +~~~~~~~~~~~~~~~~&~ &~ &~ &~ &~ &~ &~ &~ &~ &~ &~ &~ &~ \\ \hline +~~~~~~~~~~~~~~~~&~ &~ &~ &~ &~ &~ &~ &~ &~ &~ &~ &~ &~ \\ \hline\hline +\end{tabular} \\ +\end{document} diff --git a/macros/plain/contrib/misc/selectp.tex b/macros/plain/contrib/misc/selectp.tex new file mode 120000 index 0000000000..a1595df5d9 --- /dev/null +++ b/macros/plain/contrib/misc/selectp.tex @@ -0,0 +1 @@ +../../../latex/contrib/selectp/selectp.sty
\ No newline at end of file diff --git a/macros/plain/contrib/misc/setstrut.tex b/macros/plain/contrib/misc/setstrut.tex new file mode 100644 index 0000000000..a6be78688d --- /dev/null +++ b/macros/plain/contrib/misc/setstrut.tex @@ -0,0 +1,58 @@ +% SETSTRUT.TEX Automatic strut computation +% by Stephan v.\ Bechtolsheim 1987 +% Save the current value of \baselineskip here for strut handling +\newdimen\strutskip + +% \setstrut +% ========= +% Compute \strut as a \vrule of +% width: 0 +% height: 70% of the current value of \baselinekip +% depth: the remaining 30% of \baselineskip. +\def\setstrut {% + \strutskip = \baselineskip + \ifdim\baselineskip < 0pt + \errhelp = {You probably called \string\offinterlineskip + before \string\setstrut} + \errmessage{\string\setstrut: negative + \string\baselineskip (\the\baselineskip)}% + \fi +} + +% \strut +% ====== +% The strut +\def\strut {% + \vrule height 0.7\strutskip + depth 0.3\strutskip + width 0pt +} + +% \higherstrut +% ============ +% Generate a strut, which is higher by #1 than the usual strut. +% The depth is the depth of \strut. +% #1: dimension, by which the strut is made higher +\def\higherstrut #1{% + {% + \dimen0 = 0.7\strutskip + \advance\dimen0 by #1% + \vrule height \dimen0 depth 0.3\strutskip width 0pt + }% +} + +% \deeperstrut +% ============ +% Generate a strut, which is deeper by #1 than the usual strut. +% the height is the height of \strut. +% #1: dimension, by wghich the strut is made deeper. +\def\deeperstrut #1{% + {% + \dimen0 = 0.3\strutskip + \advance\dimen0 by #1% + \vrule height 0.7\strutskip depth \dimen0 width 0pt + }% +} + +% Initialize in case the user forgets to set up a strut +\setstrut diff --git a/macros/plain/contrib/misc/settosize.tex b/macros/plain/contrib/misc/settosize.tex new file mode 100644 index 0000000000..c75cc2ff7c --- /dev/null +++ b/macros/plain/contrib/misc/settosize.tex @@ -0,0 +1,103 @@ + +%%% I need to be able to specify the width for text. I would like to +%%% use the largest size (subject to a user specified maximum and +%%% minimum). If the constraints mean that I cannot fill the width +%%% then the text should be centered at the largest specified size. +%%% +%%% Phil Taylor January 1993 + +\catcode `\@ = 11 + +\newcount \r@mainder +\newcount \m@gstepcount +\newcount \m@gsteplimit +\newcount \m@gstepvalue +\newdimen \m@gstepdimen + +\def \magsteps {\afterassignment \m@gsteps \m@gsteplimit = } + +\def \m@gsteps + {\let \@r = \or + \def \or {\noexpand \or}% + \m@gstepdimen = 0.166667 \maxdimen + \m@gstepvalue = 1000 + \m@gstepcount = 0 + \def \magstep {}% + \loop + \ifnum \m@gstepcount < \m@gsteplimit + \advance \m@gstepcount by 1 + \ifnum \m@gstepvalue > \m@gstepdimen + \advance \m@gstepcount by -1 + \message {Sorry --- integer overflow would occur if + I went any further; stopped at + \the \m@gstepcount.} + \m@gsteplimit = \m@gstepcount + \else + \multiply \m@gstepvalue by 12 + \multiply \r@mainder by 12 + \divide \r@mainder by 10 + \advance \m@gstepvalue by \r@mainder + \r@mainder = \m@gstepvalue + \divide \m@gstepvalue by 10 + \multiply \m@gstepvalue by 10 + \advance \r@mainder by -\m@gstepvalue + \divide \m@gstepvalue by 10 + \ifnum \r@mainder < 5 + \edef \magstep {\magstep \or \the \m@gstepvalue}% + \else + \advance \m@gstepvalue by 1 + \edef \magstep {\magstep \or \the \m@gstepvalue}% + \advance \m@gstepvalue by -1 + \fi + \fi + \repeat + \edef \magstep ##1% + {\noexpand \ifcase ##1 + 1000\magstep + \noexpand \else 0% + \noexpand \message + {Sorry --- \string \magstep \space ##1 + is not in range 0 .. \the \m@gsteplimit}% + \noexpand \fi + \noexpand \relax + }% + \let \or = \@r + } + +\catcode `\@ = 12 + +\magsteps 63 +\newcount \loopcount +\newdimen \thewidth + +\def \set #1 \in #2 \to %%% see example at end + {\def \thetext {#1}% + \def \thefont {#2 }% + \afterassignment \settowidth + \thewidth = + } + +\def \settowidth + {\loopcount = 0 + \loop + \message {Trying \noexpand \magstep \the \loopcount...}% + \setbox 0 = \hbox + {\font \tempfont = \thefont scaled \magstep \loopcount + \tempfont \thetext + }% + \ifdim \wd 0 < \thewidth + \advance \loopcount by 1 + \repeat + \advance \loopcount by -1 + \message {The calculated font is \thefont \space + scaled \noexpand \magstep \the \loopcount}% + + \hbox to \thewidth {\font \tempfont = \thefont scaled \magstep \loopcount + \hss \tempfont \thetext \hss}% + } + +\set Now is the time for \in cmr10 \to 50 cm + + + + diff --git a/macros/plain/contrib/misc/split.tex b/macros/plain/contrib/misc/split.tex new file mode 100644 index 0000000000..11d5708376 --- /dev/null +++ b/macros/plain/contrib/misc/split.tex @@ -0,0 +1,48 @@ +%%%------------------------rrrrrrrrrrrrrrip!-------------------------- +% Macro: \xsplit +% By: Eric Skinner <ERS2F@UOTTAWA> +% Function: Takes two pieces of text, and boxes them side by side. +% Column widths and inter-column gap are set by user. +% Parameters: +% #1: Width of first column, including unit specification +% #2: Width of space between columns, including units +% #3: Width of second column, including units +% ** Warning: Don't exceed page dimensions! +% #4: First column text. +% #5: Second column text. +% Registers: \box1,\box2 +\def\xsplit#1#2#3#4#5{{ + \setbox1=\vbox{\hsize= #1 #4} % First column + \setbox2=\vbox{\hsize= #3 #5} % Second column + % If the boxes are output side by side at this point, they + % will be aligned at the bottom instead of the top. + \ifdim\ht2>\ht1 % Column two is longer than column one + % Fill bottom of column one with glue + \setbox1=\vbox to \ht2{\hsize= #1 #4 \vfill} + \else + \ifdim\ht1>\ht2 % Column one is longer than column two + % Fill bottom of column two with glue + \setbox2=\vbox to \ht1{\hsize= #3 #5 \vfill} + \fi + \fi + \hbox{\box1\hskip#2\box2}}} +%%%------Cut some more------------------------------------------------ +% Macro: \split +% By: Eric Skinner <ERS2F@UOTTAWA> +% Function: Takes two pieces of text, and boxes them side by side. +% Column widths are set by user. Inter-column gap is +% automatically adjusted to make the first column flush +% with the left margin, and the second flush with the right. +% Parameters: +% #1: Width of first column, including unit specification +% #2: Width of second column, including units +% ** Sum of #1 and #2 should not exceed current \hsize! +% #3: First column text. Don't do anything REALLY weird. +% #4: Second column text. +% Registers: \dimen1 +\def\split#1#2#3#4{ + \dimen1=\hsize + \advance\dimen1 by -#1 + \advance\dimen1 by -#2 + \xsplit{#1}{\dimen1}{#2}{#3}{#4}} +%%%------------Tear---------------------------------------------------- diff --git a/macros/plain/contrib/misc/tabledoc.tex b/macros/plain/contrib/misc/tabledoc.tex new file mode 100644 index 0000000000..2ff9fe6deb --- /dev/null +++ b/macros/plain/contrib/misc/tabledoc.tex @@ -0,0 +1,678 @@ +% file: tabledoc.tex +% :: $Header: /usr2/myers/texsis/RCS/tabledoc.tex,v 1.1 90/05/24 13:39:32 myers Rel $ +% +--------------------------------------------------------------------+ +% | | +% | This file contains documentation for the macro set TABLES.TEX. | +% | | +% | To make a copy, say "TEX1 TABLEDOC". | +% | | +% | | +% | Ray F. Cowan, 22-February-85. | +% | | +% | Princeton University | +% | | +% | | +% | Major Revision History: | +% | ----------------------- | +% | | +% | 22-Oct-85 RFC Temporary fixes for \& added. | +% | | +% | 27-Feb-86 RFC Removed call to PHYZZX macro package. | +% | Fixes for \& no longer needed and were removed. | +% | | +% +--------------------------------------------------------------------+ +% +% Note to myself: add info on \tablelet +% put \tstrut in table +% \vctr +% \ifhmode test in centeredtables +% \header +% \spreadwidth +% new def of \tstrut +% put spaces around entries +% last revision ( 2 places ) +% notes on use of spaces +% +%%%\input TABLES.TEX +\input ruled.tex % use E. Myers' ruled table macros instead +% +% +--------------------------------------------------------------------+ +% | | +% | Definitions of font families and spacing parameters. | +% | | +% +--------------------------------------------------------------------+ +% +\catcode`\@=11% Enable use of `@' in macro names. +% +\font\fourteenrm=cmr10 scaled\magstep2 +% +\font\twelverm=cmr10 scaled\magstep1 +\font\twelvebf=cmbx10 scaled\magstep1 +\font\twelvei=cmmi10 scaled\magstep1 \skewchar\twelvei='177 +\font\twelvesy=cmsy10 scaled\magstep1 \skewchar\twelvesy='60 +\font\twelveex=cmex10 scaled\magstep1 +\font\twelvesl=cmsl10 scaled\magstep1 +\font\twelveit=cmti10 scaled\magstep1 +\font\twelvett=cmtt10 scaled\magstep1 +\font\twelvecp=cmcsc10 scaled\magstep1 +% +\font\ninerm=cmr9 \font\sixrm=cmr6 +\font\ninebf=cmbx9 \font\sixbf=cmbx6 +\font\ninei=cmmi9 \skewchar\ninei='177 +\font\ninesy=cmsy9 \skewchar\ninesy='60 +\font\ninesl=cmsl9 +% +\font\sixi=cmmi6 \skewchar\sixi='177 +\font\sixsy=cmsy6 \skewchar\sixsy='60 +% +\font\tencp=cmcsc10 +\newfam\cpfam +% +\newcount\f@ntkey \f@ntkey=0 +\def\samef@nt{\relax \ifcase\f@ntkey \rm \or\oldstyle \or\or + \or\it \or\sl \or\bf \or\tt \or\caps \fi } +% +\def\twelvepoint{\relax + \textfont0=\twelverm \scriptfont0=\ninerm + \scriptscriptfont0=\sixrm + \def\rm{\fam0 \twelverm \f@ntkey=0 }\relax + \textfont1=\twelvei \scriptfont1=\ninei + \scriptscriptfont1=\sixi + \def\oldstyle{\fam1 \twelvei\f@ntkey=1 }\relax + \textfont2=\twelvesy \scriptfont2=\ninesy + \scriptscriptfont2=\sixsy + \textfont3=\twelveex \scriptfont3=\twelveex + \scriptscriptfont3=\twelveex + \def\it{\fam\itfam \twelveit \f@ntkey=4 }\textfont\itfam=\twelveit + \def\sl{\fam\slfam \twelvesl \f@ntkey=5 }\textfont\slfam=\twelvesl + \scriptfont\slfam=\ninesl + \def\bf{\fam\bffam \twelvebf \f@ntkey=6 }\textfont\bffam=\twelvebf + \scriptfont\bffam=\ninebf \scriptscriptfont\bffam=\sixbf + \def\tt{\fam\ttfam \twelvett \f@ntkey=7 }\textfont\ttfam=\twelvett + \h@big=10.2\p@{} + \h@Big=13.8\p@{} + \h@bigg=17.4\p@{} + \h@Bigg=21.0\p@{} + \def\caps{\fam\cpfam \twelvecp \f@ntkey=8 }\textfont\cpfam=\twelvecp + \setbox\strutbox=\hbox{\vrule height 10pt depth 4pt width\z@} + \samef@nt} +% +\def\tenpoint{\relax + \textfont0=\tenrm \scriptfont0=\sevenrm + \scriptscriptfont0=\fiverm + \def\rm{\fam0 \tenrm \f@ntkey=0 }\relax + \textfont1=\teni \scriptfont1=\seveni + \scriptscriptfont1=\fivei + \def\oldstyle{\fam1 \teni \f@ntkey=1 }\relax + \textfont2=\tensy \scriptfont2=\sevensy + \scriptscriptfont2=\fivesy + \textfont3=\tenex \scriptfont3=\tenex + \scriptscriptfont3=\tenex + \def\it{\fam\itfam \tenit \f@ntkey=4 }\textfont\itfam=\tenit + \def\sl{\fam\slfam \tensl \f@ntkey=5 }\textfont\slfam=\tensl + \def\bf{\fam\bffam \tenbf \f@ntkey=6 }\textfont\bffam=\tenbf + \scriptfont\bffam=\sevenbf \scriptscriptfont\bffam=\fivebf + \def\tt{\fam\ttfam \tentt \f@ntkey=7 }\textfont\ttfam=\tentt + \def\caps{\fam\cpfam \tencp \f@ntkey=8 }\textfont\cpfam=\tencp + \setbox\strutbox=\hbox{\vrule height 8.5pt depth 3.5pt width\z@} + \samef@nt} +% +\newdimen\h@big \h@big=8.5\p@ +\newdimen\h@Big \h@Big=11.5\p@ +\newdimen\h@bigg \h@bigg=14.5\p@ +\newdimen\h@Bigg \h@Bigg=17.5\p@ +% +\def\big#1{{\hbox{$\left#1\vbox to\h@big{}\right.\n@space$}}} +\def\Big#1{{\hbox{$\left#1\vbox to\h@Big{}\right.\n@space$}}} +\def\bigg#1{{\hbox{$\left#1\vbox to\h@bigg{}\right.\n@space$}}} +\def\Bigg#1{{\hbox{$\left#1\vbox to\h@Bigg{}\right.\n@space$}}} +% +\normalbaselineskip = 20pt plus 0.2pt minus 0.1pt +\normallineskip = 1.5pt plus 0.1pt minus 0.1pt +\normallineskiplimit = 1.5pt +\newskip\normaldisplayskip +\normaldisplayskip = 20pt plus 5pt minus 10pt +\newskip\normaldispshortskip +\normaldispshortskip = 6pt plus 5pt +\newskip\normalparskip +\normalparskip = 6pt plus 2pt minus 1pt +\newskip\skipregister +\skipregister = 5pt plus 2pt minus 1.5pt +% +\newif\ifsingl@ \newif\ifdoubl@ +\newif\iftwelv@ \twelv@true +% +\def\singlespace{\singl@true\doubl@false\spaces@t} +\def\doublespace{\singl@false\doubl@true\spaces@t} +\def\normalspace{\singl@false\doubl@false\spaces@t} +\def\Tenpoint{\tenpoint\twelv@false\spaces@t} +\def\Twelvepoint{\twelvepoint\twelv@true\spaces@t} +% +\def\spaces@t{\relax% + \iftwelv@ \ifsingl@\subspaces@t3:4;\else\subspaces@t1:1;\fi% + \else \ifsingl@\subspaces@t3:5;\else\subspaces@t4:5;\fi \fi% + \ifdoubl@ \multiply\baselineskip by 5% + \divide\baselineskip by 4 \fi \unskip} +% +\def\subspaces@t#1:#2;{ + \baselineskip = \normalbaselineskip + \multiply\baselineskip by #1 \divide\baselineskip by #2 + \lineskip = \normallineskip + \multiply\lineskip by #1 \divide\lineskip by #2 + \lineskiplimit = \normallineskiplimit + \multiply\lineskiplimit by #1 \divide\lineskiplimit by #2 + \parskip = \normalparskip + \multiply\parskip by #1 \divide\parskip by #2 + \abovedisplayskip = \normaldisplayskip + \multiply\abovedisplayskip by #1 \divide\abovedisplayskip by #2 + \belowdisplayskip = \abovedisplayskip + \abovedisplayshortskip = \normaldispshortskip + \multiply\abovedisplayshortskip by #1 + \divide\abovedisplayshortskip by #2 + \belowdisplayshortskip = \abovedisplayshortskip + \advance\belowdisplayshortskip by \belowdisplayskip + \divide\belowdisplayshortskip by 2 + \smallskipamount = \skipregister + \multiply\smallskipamount by #1 \divide\smallskipamount by #2 + \medskipamount = \smallskipamount \multiply\medskipamount by 2 + \bigskipamount = \smallskipamount \multiply\bigskipamount by 4 } +% +\def\normalbaselines{ \baselineskip=\normalbaselineskip + \lineskip=\normallineskip \lineskiplimit=\normallineskip + \iftwelv@\else \multiply\baselineskip by 4 \divide\baselineskip by 5 + \multiply\lineskiplimit by 4 \divide\lineskiplimit by 5 + \multiply\lineskip by 4 \divide\lineskip by 5 \fi } +% +\Twelvepoint % That's the default +% +\interlinepenalty=50 +\interfootnotelinepenalty=5000 +\predisplaypenalty=9000 +\postdisplaypenalty=500 +\hfuzz=1pt +\vfuzz=0.2pt +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Next, I define output routines, footnotes & related stuff. +% +\def\pagecontents{ + \ifvoid\topins\else\unvbox\topins\vskip\skip\topins\fi + \dimen@ = \dp255 \unvbox255 + \ifvoid\footins\else\vskip\skip\footins\footrule\unvbox\footins\fi + \ifr@ggedbottom \kern-\dimen@ \vfil \fi } +% +\def\makeheadline{\vbox to 0pt{ \skip@=\topskip + \advance\skip@ by -12pt \advance\skip@ by -2\normalbaselineskip + \vskip\skip@ \line{\vbox to 12pt{}\the\headline} \vss + }\nointerlineskip} +\def\makefootline{\baselineskip = 1.5\normalbaselineskip + \line{\the\footline}} +% +\newif\iffrontpage +% +% +--------------------------------------------------------------------+ +% | | +% | Footnote definitions. | +% | | +% +--------------------------------------------------------------------+ +% +\def\footrule{\dimen@=\prevdepth\nointerlineskip + \vbox to 0pt{\vskip -0.25\baselineskip \hrule width 0.35\hsize \vss} + \prevdepth=\dimen@ } +% +\newtoks\foottokens +\foottokens={\Tenpoint\singlespace} +\newdimen\footindent +\footindent=24pt +% +\def\vfootnote#1{\insert\footins\bgroup \the\foottokens + \interlinepenalty=\interfootnotelinepenalty \floatingpenalty=20000 + \splittopskip=\ht\strutbox \boxmaxdepth=\dp\strutbox + \leftskip=\footindent \rightskip=\z@skip + \parindent=0.5\footindent \parfillskip=0pt plus 1fil + \spaceskip=\z@skip \xspaceskip=\z@skip + \Textindent{$ #1 $}\footstrut\futurelet\next\fo@t} +% +\def\Textindent#1{\noindent\llap{#1\enspace}\ignorespaces} +\def\footnote#1{\attach{#1}\vfootnote{#1}} +\def\footattach{\attach\footsymbol} +\def\foot{\attach\footsymbolgen\vfootnote{\footsymbol}} +\let\footsymbol=\star +% +\newcount\lastf@@t \lastf@@t=-1 +\newcount\footsymbolcount \footsymbolcount=0 +\newif\ifPhysRev +% +\def\footsymbolgen{\relax \ifPhysRev \iffrontpage \NPsymbolgen\else + \PRsymbolgen\fi \else \NPsymbolgen\fi + \global\lastf@@t=\pageno \footsymbol } +% +\def\NPsymbolgen{\ifnum\footsymbolcount<0 \global\footsymbolcount=0\fi + {\iffrontpage \else \advance\lastf@@t by 1 \fi + \ifnum\lastf@@t<\pageno \global\footsymbolcount=0 + \else \global\advance\footsymbolcount by 1 \fi } + \ifcase\footsymbolcount \fd@f\star\or \fd@f\dagger\or \fd@f\ast\or + \fd@f\ddagger\or \fd@f\natural\or \fd@f\diamond\or \fd@f\bullet\or + \fd@f\nabla\else \fd@f\dagger\global\footsymbolcount=0 \fi } +\def\fd@f#1{\xdef\footsymbol{#1}} +% +\def\PRsymbolgen{\ifnum\footsymbolcount>0 \global\footsymbolcount=0\fi + \global\advance\footsymbolcount by -1 + \xdef\footsymbol{\sharp\number-\footsymbolcount} } +% +\def\space@ver#1{\let\@sf=\empty \ifmmode #1\else \ifhmode + \edef\@sf{\spacefactor=\the\spacefactor}\unskip${}#1$\relax\fi\fi} +\def\attach#1{\space@ver{\strut:{\mkern 2mu #1} }\@sf\ } +% +% +\def\alphabetic#1{\count255='140 \advance\count255 by #1\char\count255} +\def\Alphabetic#1{\count255='100 \advance\count255 by #1\char\count255} +\def\Roman#1{\uppercase\expandafter{\romannumeral #1}} +\def\roman#1{\romannumeral #1} +\def\Number#1{\number #1} +% +\def\GENITEM#1;#2{\par \hangafter=0 \hangindent=#1 + \Textindent{$ #2 $}\ignorespaces} +\outer\def\newitem#1=#2;{\gdef#1{\GENITEM #2;}} +% +\newdimen\itemsize \itemsize=30pt +\newitem\item=1\itemsize; +\newitem\sitem=1.75\itemsize; \let\subitem=\sitem +\newitem\ssitem=2.5\itemsize; \let\subsubitem\ssitem +% +\outer\def\newlist#1=#2{\toks0={#2}\toks1={#3}% + \count255=\escapechar \escapechar=-1 + \alloc@0\list\countdef\insc@unt\listcount \listcount=0 + \edef#1{\par + \countdef\listcount=\the\allocationnumber + \advance\listcount by 1 + \hangafter=0 \hangindent=#4 + \Textindent{\the\toks0{\listcount}\the\toks1}} + \expandafter\expandafter\expandafter + \edef\c@t#1{begin}{\par + \countdef\listcount=\the\allocationnumber \listcount=1 + \hangafter=0 \hangindent=#4 + \Textindent{\the\toks0{\listcount}\the\toks1}} + \expandafter\expandafter\expandafter + \edef\c@t#1{con}{\par \hangafter=0 \hangindent=#4 \noindent} + \escapechar=\count255} +\def\c@t#1#2{\csname\string#1#2\endcsname} +% +\newlist\point=\Number&.&1.0\itemsize; +\newlist\subpoint=(\alphabetic&)&1.75\itemsize; +\newlist\subsubpoint=(\roman&)&2.5\itemsize; +% +\let\spoint=\subpoint \let\sspoint=\subsubpoint +\let\spointbegin=\subpointbegin \let\sspointbegin=\subsubpointbegin +\let\spointcon=\subpointcon \let\sspointcon=\subsubpointcon +% +\def\endpage{\vfil\break} +% +\hsize=6.5in +\vsize=8.9in +\voffset=0.5in +% +% +\catcode`\@=12% Return `@' to normal use. +% +% +% +--------------------------------------------------------------------+ +% | | +% | Verbatim listing macros. | +% | | +% +--------------------------------------------------------------------+ +% +\newif\ifverbatimmode% +\verbatimmodefalse% +\def\|{|}% +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=12 }% + \dospecials% +}% +% +\def\startverbatim{\catcode`\|=13}% +\def\endverbatim{\catcode`\|=12}% +\def\setupverbatim{% + \tt% + \def\par{\leavevmode\endgraf}% + \catcode`\`=13% + \obeylines% + \uncatcodespecials% + \obeyspaces% +}% +% +{\obeyspaces\global\let =\ }% Let active space=control space. +{\catcode`\`=13\gdef`{\relax\lq}}% Fix for Spanish punctuation in \tt. +% +{\catcode`\|=13% +\gdef|{% + \relax% + \ifverbatimmode % + \endgroup% + \verbatimmodefalse% + \begingroup% + \else% + \verbatimmodetrue% + \begingroup% + \setupverbatim% + \parindent=1in% Set the indentation of verbatim lines. + \parskip=0pt% Don't put so much space between the lines. + \begingroup\aftergroup\relax% This makes \relax the first token +% scanned after the |; prevents +% premature association of catcodes. + \fi% +\endgroup}% +}% Return | to its normal use. +\def\beginverbatimlisting{\par\begingroup\setupverbatim\doverbatim} +{\catcode`\|=0 \catcode`\\=12 % | is temporary escape character + |obeylines|gdef|doverbatim^^M#1\endverbatimlisting{#1|endgroup}} +% +% Macro for verbatim listing of a file. +% +\def\inputverbatimlisting#1{% + \par% + \begingroup% + \parskip0pt% + \parindent0pt% + \setupverbatim% + \input#1 % + \endgroup% +}% +% +\def\Table#1#2{% + \setbox0=\hbox to 1.5in{\hfil\it Table~#1.\quad}% + \par\hangindent1.5in\hangafter1% + \noindent\box0 #2% +}% +\def\\{\char`\\} +\def\{{\char`\{} +\def\}{\char`\}} +\def\vbar{\char`\|} +\def\Psizzl{% + P% + \kern-.30em\lower.70ex\hbox{s}% + \kern-.08em\lower.0 ex\hbox{i}% + \kern-.05em\lower.0 ex\hbox{z}% + \kern-.17em\lower.5 ex\hbox{z}% + \kern-.09em\lower.2 ex\hbox{l}% + }% +% +\font\tensltt=cmsltt10% +\footline={\ifnum\count0=1 +\rlap{\tensl[From file {\tensltt TABLEDOC.TEX}]}% +\hfil\it\number\count0\hfil\llap{\tensl[Last revision 27--Feb--86]}% +\else\hfil\fi} +\headline={\ifnum\count0=1 \hfil\else\vbox{\baselineskip0pt + \line{\tenit Page~\number\count0\hfil Making Tables with Macros} + \line{\leaders\hrule\hfill}}\fi} +\startverbatim +{\thicksize=0.8pt\def\tstrut{\vrule width0pt height18pt depth7pt} +\begintable +\quad\fourteenrm Making Tables with Macros\quad\endtable} +\vskip 0.4in +\centerline{Ray F.~Cowan} +\vskip 0.1in +\centerline{22 February 1985} +\vskip 0.3in +\par +Tables have traditionally been difficult to make using \TeX---especially +ruled tables. The file |TABLES.TEX| contains macros designed +to prepare both ruled and unruled tables with considerably less effort. +Note that |TABLES.TEX| can be +used with any macro set; +it does not depend upon prior loading of |PHYZZX| +or \Psizzl, for example. +One of the main advantages of this macro set is +that you no longer need to +design a +preamble for the table; the macros will scan your table entries and +construct a suitable preamble for you. +To access the macros, say \hbox{`|\input TABLES|'} in your \TeX\ +file, somewhere before the first time you use them. +The macros available are listed in Table~1 and Table~2. + +\endverbatim +\midinsert +\smallskip +\tablewidth=\hsize +\begintable +\sl Macro name\hfill | \sl Description \hfill \crthick + \tt\\begintable\hfill | \para{Indicates the start of a new table.} \cr + \tt\\endtable\hfill | \para{Ends the current table. Must be used + in place of the last {\tt\\cr}.}\cr + \tt\\cr \hfill | \para{Ends the current row, and starts the next + one. The completed row will be + separated from the next with a thin + horizontal rule.} \cr + \tt\\crthick\hfill | \para{Similar to {\tt\\cr}, but the rows will be + separated with a thick horizontal rule.}\cr +\tt\\crnorule \rm or \tt \\nr \hfill | \para{Similar +to {\tt\\cr}, but the rows will not + be separated by any rule.}\cr + \vtop{\noindent\hsize=1.4in\tt\vbar\qquad \rm (vertical bar)\hfil\break + or \tt\\vb} \hfill + | \para{Separates one column from the next, and + puts a vertical rule between them.} \cr + \tt\&\ \rm or\tt\ \\novb \hfill + | \para{Same as {\tt\vbar}, but does not put in the + vertical rule between the columns.}\cr + \tt \\\vbar \hfill | \para{Same as {\tt\vbar}, but puts in a + thick vertical rule.} +\endtable +\Table{1}{Description of simple table macros.} +\endinsert +\startverbatim +\par +The general idea is that you start your table with the command +|\begintable|, type your entries in one row at a time, then finish +with the command |\endtable|. +To specify a row, enter the individual entries into your \TeX\ file, +separating each column entry with a {\tt \vbar}, an {\tt \&}, or +a {\tt \\\vbar}. A {\tt \vbar} will separate the adjoining columns +with a thin vertical rule, an {\tt \&} will leave out the vertical rule, +and +a {\tt \\\vbar} will separate the columns with a thick vertical rule. +To end one row and start another, use either a |\cr|, a |\crnorule|, or +a |\crthick|. A |\cr| separates the rows with a thin +horizontal rule; a |\crnorule| leaves out the horizontal +rule, while |\crthick| inserts a thick horizontal rule. +Then end the last row with an |\endtable|. +\par +Each row of the table must contain exactly the same number of columns, +otherwise unpredictable things will happen. Again, the {\it last row} + must {\it not} end +with |\cr|$\ldots\,$, but +{\it must} end with an |\endtable|. If you put a |\cr| +and an |\endtable| both on the last row, you won't like what happens. +\endverbatim +\pageinsert +\smallskip +\tablewidth=\hsize +\begintable +\sl Macro name\hfill | \sl Description \hfill \crthick + \tt\\thicksize={\it dimen} \hfill | \para{This + dimension specifies the thickness + of the thick rules in the table. The default size + is 1.5 points.} \cr + \tt\\thinsize={\it dimen} \hfill | \para{This dimension specifies the + thickness of thin rules in the table. The default + size is 0.8 points.} \cr + \tt\\tablewidth={\it dimen} \hfill | \para{Specifies how wide to make + the next table. If not specified, the table is made to + its natural width. This value is reset following + the construction of each table.} \cr + \tt\\multispan\{$n$\}\hfill | \para{Makes + the next entry span the next $n$ + columns, where $n$ is an integer, $n>0$. + See other notes on {\tt\\multispan} below.}\cr + \tt\\omit \hfill | \para{This \TeX\ primitive causes the normal + template for its entry to be omitted, allowing the + user to do something else with this entry.} \cr + \tt\\para\{{\it text}\}\ \hfill | \para{Formats {\it text} into + a neat little paragraph like this one. The width of + the paragraph produced is determined by the dimension + {\tt \\parasize}. The default is 4 inches. } \cr + \tt\\parasize={\it dimen} \hfill | \para{Sets the width of paragraphs + produced with the {\tt\\para} macro. } \cr + \tt\\ctr\{\#\} \hfill | \para{Used in the standard template, this + macro centers its argument in the column. The + user can redefine it for special effects. + The default definition is + \par \tt \\def\\ctr\#1\{\\hfil\\\ \#1\\\ \\hfil\} } \cr + \tt\\vctr\{\#\}\hfill | \para{Centers an entry vertically. The + vertical center of the entry is placed on + the baseline of the row containing it. The + intended use is to center an entry between + two rows.} \cr + \tt\\centeredtables\hfill | \para{Turns table centering on. Each table + will be centered + left-to-right on the page. This is the + default.} \cr + \tt\\noncenteredtables\hfill | \para{Turns table centering off. Each + table is returned as an {\tt\\hbox}, and it + is up to the user to place it as desired.} +\endtable +\smallskip\rightline{\it continued$\ldots$} +\vfill +\endinsert +\topinsert\leftline{\it continued$\ldots$}\smallskip +\tablewidth=\hsize +\begintable +\sl Macro name\hfill | \sl Description \hfill \crthick +\tt\\tableinfotrue\hfill | \para{Turns on the diagnostic message telling + you how many rows and colums were found in the + table. This is the default.} \cr +\tt\\tableinfofalse\hfill\ | \para{Turns off the diagnostic messages + concerning rows and columns.} +\endtable +\Table{2}{Description of extended table macros.} +\endinsert +\startverbatim +\par +Each +entry will be centered in its column (unless you use |\omit|, a \TeX\ +primitive, or |\multispan|. See notes below). +The table will be centered in an |\hbox| of width the |\hsize|, unless +you have turned table centering off (see the commands |\centeredtables| +and |\noncenteredtables|). +\par +Each time a new table is encountered, a message similar to +`|[Nrows=|$xx$|, Ncols=|$yy$|]|' is +printed on your terminal, where $xx$ is the number of rows +and $yy$ the number of columns discovered in your table. If you think +they are incorrect, you may have left out some {\tt\|}'s or +{\tt\&}'s or {\tt\\cr}'s. +This diagnostic feature can be disabled by saying |\tableinfofalse| +(and restarted by saying |\tableinfotrue|). +\bigskip +\leftline{\it An example} +\par + A simple 3-row, 2-column table with a header spanning two + columns could be specified as (see notes 3 and 4 + below on + the use of |\multispan|\foot{Note to experienced \TeX\ % + users: these macros locally (within the {\tt \\begintable}$\,\ldots% +\,${\tt \\endtable} grouping) redefine {\tt \\multispan} to take as its % +argument % +the number of user entries $n$ to be spanned, and not the total number % +of columns including rules, which would be $2n-1$.}): +\endverbatim +\par\noindent +\line{\vbox{\parskip0pt\baselineskip15pt +\beginverbatimlisting + \begintable + \multispan{2}\tstrut\hfil The Top Line\hfil\crthick + Entry 1 | Entry 2 \cr + Entry 3 | Entry 4 \endtable +\endverbatimlisting}\hfil} +\par\noindent +These commands produce Table~3. +\midinsert +\medskip + \begintable + \multispan{2}\tstrut\hfil The Top Line\hfil\crthick + Entry 1 | Entry 2 \cr + Entry 3 | Entry 4 \endtable +\smallskip +\Table{3}{A sample table.} +\medskip\endinsert +\startverbatim +\bigskip +\leftline{\it An example of non-centered tables} +\par +Two or more tables can be placed side-by-side by using the +|\noncenteredtables| command. Consider the two tables here: +\midinsert +\medskip +\noncenteredtables +\line{ +\begintable +Item ABC | Item DEF \cr +Item GHI | Item JKL \endtable +\hfil +\begintable +Data 111 | Data 222 \cr +Data 333 | Data 444 \cr +Data 555 | Data 666 \endtable +} % This `}' ends the \line we started above. +\smallskip +\Table{4}{Two non-centered tables aligned side-by-side.} +\medskip +\endinsert +These were produced by saying: +\par\noindent +\endverbatim +\line{\vbox{\parskip0pt\baselineskip15pt +\beginverbatimlisting + \noncenteredtables + \line{ + \begintable + Item ABC | Item DEF \cr + Item GHI | Item JKL \endtable + \hfil + \begintable + Data 111 | Data 222 \cr + Data 333 | Data 444 \cr + Data 555 | Data 666 \endtable + } % This `}' ends the \line we started above. +\endverbatimlisting}\hfil} +\centeredtables +\startverbatim +\par\noindent +Notice that tables of unequal height are aligned at the bottom. +\bigbreak +\par\noindent +\leftline{$\underline{\hbox{\bf Usage notes:}}$} +\pointbegin + Vertical spacing is done with a strut, called |\tstrut|, which is + initially defined as 3.1ex high and 1.2ex deep. + If you don't like the way it looks, you can redefine |\tstrut| to + your own + liking:| +\def\tstrut{\vrule height |$hh$| depth |$dd$| width 0pt} +|\pointcon where you + specify your desired height $hh$ and depth $dd$. +\point You can control the thickness of the thin and thick rules + through the use of |\thicksize| and |\thinsize|. You can even + turn off the rules entirely by saying | +\thinsize=0pt +\thicksize=0pt +|\pointcon for example. + \point If you use a |\multispan| + or an |\omit| in the first column of a row, you will + lose the effect of the |\tstrut| within that row and + must specify it yourself. See + the example above. + \point Use of |\multispan| and |\omit| will + cause the default centering of + the entry to be lost; if you want it centered, put an |\hfil| on + each side of the entry, as in the example above. + \point To override the default centering action, include an |\hfill| on + the left or right as desired; the |\hfill| will + override the default + |\hfil|. +% +\endverbatim +\endpage +\bye diff --git a/macros/plain/contrib/misc/tables.tex b/macros/plain/contrib/misc/tables.tex new file mode 100644 index 0000000000..f7fea87806 --- /dev/null +++ b/macros/plain/contrib/misc/tables.tex @@ -0,0 +1,316 @@ +%-*-tex-*- +% Copyright Michael J. Ferguson, INRS-Telecommunications (1985,1986) +% All rights reserved. +\catcode`\@=11 + +%======= Additional active Characters =========== +% ALL ACTIVE CHARACTERS MUST BE DECLARED AND DEFINED AT THE VERY +% BEGINNING OR THERE IS A DANGER OF INCORRECT TOKENIZATION +% ======== THESE ARE USED IN THE TABLE MACROS ========= +\message{<< Additional Active Characters >>} +\catcode`\|= \active +\def|{\ifmmode \vert\else \char`\|\fi} % effectively undoes activeness +\def\q@m{\string"} +\catcode`\"=\active \def"{\char`\"} +% update \dospecials +\toksdef\toks@@=2 +\toks@{\do \"}% +\toks@@ =\expandafter{\dospecials}\xdef\dospecials{\the\toks@@\the\toks@} +\toks@{\do \|}% +\toks@@ =\expandafter{\dospecials}\xdef\dospecials{\the\toks@@\the\toks@} +%=== these are redefined inside the table macros ===== + + +%============= Table making macros ============ +% the basic format is +% \begintable +% <special definitions for this table> +% \begintableformat +% format as in halign except it needs ## instead of # +% in tableformat, " means strut column +% spacing controlled by \left, \center, \right +% can use \math or \displaymath in conjuction with spacing +% \endtableformat +% \br{<struts>} .... | .... | .... " ..... | .... \er{<stuff>} (rows) +% \- (horizontal rules) +% ....etc +% \endtable +% +% each row has format +% \br{<..>} <item> | <item} " .... | <item> \er{<..>} +% \br, \er mean beginning of row, end of row +% in table | means rule, " means no rule in strut column +% \: is standard strut, | is standard vrule +% +% \tablespread {to <dimen>} width of table +% \tr=width of rules (default .4pt) +% \midtabglue sets glue in table (default 0pt plus 1fill) +% also can set explicit hrules and vrules +% tokens (e.g. \tablespread, \tr, \midtabglue, etc.) can be set in \everytable + +% these macros require that | and " be active during the entire +% document to work correctly. ... although some definitions specifically +% set them active +\newcount\a@lignstate \a@lignstate=0 %0 -- between lines after \cr + %1 -- beginning of line in \bl + %2 -- midline + %3 -- endline in \el +\def\hssf{\hskip 0pt plus 1fill minus 1fill} +\def\n@ewaligndefs{\def\center##1{\hssf ##1\hssf\null} + \def\left##1{##1\hssf\null} + \def\right##1{\hssf ##1\null}} +\newdimen\trulesize +\let\tr=\trulesize +\trulesize = .4pt +\def\zerocenteredbox#1{\ifmmode \ifinner \setbox2 =\hbox{$#1$}\else + \setbox2 =\hbox{$\displaystyle#1$}\fi + \else \setbox2 =\hbox{#1}\fi + \setbox0=\hbox{\lower.5ex\hbox{$\vcenter{\box2}$}}\ht0=0pt\dp0 =0pt\box0} +\let\zb=\zerocenteredbox + +%this macro creates a strut with the that is higher by #2 and deeper than #3 +% than the natural size of #1 ... the sizes may be negative +\def\modifystrut#1#2#3{\setbox4=\hbox{#1}\dimen0=\ht4 + \advance \dimen0 by #2 \dimen2 = \dp4 + \advance \dimen2 by #3 + \vrule width 0pt height \dimen0 depth \dimen2} +\let\mst=\modifystrut +%general math form +\def\math#1{\relax $\relax#1\relax$} +\def\displaymath #1{\relax$\displaystyle #1\relax$} + + +% +\newskip\tcs +\newtoks\tablespread +\newskip\midtabglue \midtabglue = 0pt plus 1fill +\newtoks\everytable \everytable = {\relax} + +{\catcode`\|=\active \catcode`\" = \active + \gdef\begintable{\vbox\bgroup \tcs=.5em % uses font in force when entering + \catcode`\|=\active + \catcode`\"=\active + \def\:{\relax \vrule height 2.5ex depth .9ex width 0pt} + \def\-{\ifcase\a@lignstate \fulltablerule{\tr} + \else + \thrule{\tr}\fi} + \let\t@xx =\relax % for premature expansions + \everycr={\noalign{\global\a@lignstate=0}} + \def\fulltablerule##1{\noalign{\hrule height + ##1}} + \def\thrule##1{\omit\leaders\hrule height ##1\hfill} + \def\center{\hskip\tcs\hss ########\hss\hskip\tcs} + \def\left{\hskip\tcs ########\hss\hskip\tcs} + \def\right{\hskip\tcs\hss ########\hskip\tcs} + \def\sprule{\tvrule{2.5\tr}} + \def|{\ifcase\a@lignstate \def\t@xx{\tvrule{\tr}}\or + \def\t@xx{\tvrule{\tr}}\or + \def\t@xx{\unskip&\tvrule{\tr}&}\else + \def\t@xx{\tvrule{\tr}}\fi\t@xx} + \def\|{\ifcase\a@lignstate \def\t@xx{\sprule}\or + \def\t@xx{\sprule}\or + \def\t@xx{\unskip&\sprule&}\else + \def\t@xx{\sprule}\fi\t@xx} + \def"{&########&} % for table format + \def\br##1{\global\a@lignstate=1 ##1\unskip\global\a@lignstate=2&} + \def\er##1{\global\a@lignstate=3\unskip&##1\unskip + \global\a@lignstate=0\cr} + \def\tvrule##1{\hss\vrule width ##1\hss} + \def~{\penalty\@M \hphantom{0}} +% % changes ~ to be phantom of width .5em + \tablespread = {} + \the\everytable + } + \gdef\begintableformat #1\endtableformat{\offinterlineskip \tabskip = 0pt + \edef\t@blform{####\tabskip =\midtabglue &####\tabskip=0pt\cr} +% % adds rules front and back + \n@ewaligndefs + \def"{\ifcase\a@lignstate \def\t@xx{\relax}\or + \def\t@xx{\relax}\or + \def\t@xx{\unskip&&}\else + \def\t@xx{\relax}\fi\t@xx} + \edef\h@align{\halign \the\tablespread} + \h@align\bgroup\span\t@blform} + }% " and | are always active in INRSTEX + +\def\use#1{\omit\mscount=#1 \advance\mscount by -1\multiply\mscount by2 + \loop\ifnum\mscount>1 \sp@n\repeat + \ifnum\mscount>0 \span \else \relax \fi} +\let\sp=\span +\let\om = \omit +\def\sa#1{\setbox0=\hbox{#1}\hbox to \wd0{}} +\def\endtable{\crcr\egroup\egroup} + +\catcode`\@=12 + +****************************************** +\def\uncatcodespecials{\catcode`@=12\def\do##1{\catcode`##1=12}\dospecials} +\def\setupverbatim{\tt\obeylines\uncatcodespecials\obeyspaces} +{\obeyspaces\global\let =\ } +\def\beginshowoff{\par\begingroup\setupverbatim\doverbatim} +{\catcode`\!=0 \catcode`\\=12 +!obeylines!gdef!doverbatim^^M#1\endshowoff{#1!endgroup!medbreak!filbreak% +!smallskip}} + +\input table + +\centerline{\bf Table} +\bigskip +The following illustrate the procedure for using the {\it INRStable\/} +macros. See {\it The TUGboat}, vol.~7, no.~2, June, 1986, pp.~106--109. +The characters {\tt "} and {\tt |} are active throughout the document, +but this does not affect their use, except that following spaces are +ignored. From the macro: +\vskip.5truein + +\beginshowoff +%============= Table making macros ============ +% the basic format is +% \begintable +% <special definitions for this table> +% \begintableformat +% format as in halign except it needs ## instead of # +% in tableformat, " means strut column +% spacing controlled by \left, \center, \right +% can use \math or \displaymath in conjuction with spacing +% \endtableformat +% \br{<struts>} .... | .... | .... " ..... | .... \er{<stuff>} (rows) +% \- (horizontal rules) +% ....etc +% \endtable +% +% each row has format +% \br{<..>} <item> | <item} " .... | <item> \er{<..>} +% \br, \er mean beginning of row, end of row +% in table | means rule, " means no rule in strut column +% \: is standard strut, | is standard vrule +% +% \tablespread {to <dimen>} width of table +% \tr=width of rules (default .4pt) +% \midtabglue sets glue in table (default 0pt plus 1fill) +% also can set explicit hrules and vrules +% tokens (e.g. \tablespread, \tr, \midtabglue, etc.) can be set in \everytable +\endshowoff + +{}\vskip.5truein +\centerline{ % see The TeXbook, p. 247 +\begintable +\begintableformat +\center " \center " \center % 3 centered columns, separated by struts +\endtableformat +\br{} \sa{Dividend} "\sa{Dividend} "\sa{Dividend} \er{} %optional sample row + %\sa means sample column (for width) +\- % horizontal rule +\br{\:|} \use{3} AT\&T Common Stock \er{|} %\use{3} means use 3 columns +\- +\br{\:|} Year | Price | Dividend \er{|} +\- +\br{\:|} 1971 | 41--54 | \$2.60 \er{|} +\- +\br{\:|} ~~~2 | 41--54 | ~2.70 \er{|} +\- +\br{\:|} ~~~3 | 46--55 | ~2.87 \er{|} +\- +\br{\:|} ~~~4 | 40--53 | ~3.24 \er{|} +\- +\br{\:|} ~~~5 | 45--52 | ~3.40 \er{|} +\- +\br{\:|} ~~~6 | 41--54 | ~~.95\rlap* \er{|} +\- +\br{\:}\use{3} \left{* (first quarter only)} +\endtable } + +\vskip.5truein +\beginshowoff +\input table +\centerline{ % see The TeXbook, p. 247 +\begintable +\begintableformat +\center " \center " \center % 3 centered columns, separated by struts +\endtableformat +\br{} \sa{Dividend} "\sa{Dividend} "\sa{Dividend} \er{} %optional sample row + %\sa means sample column (for width) +\- % horizontal rule +\br{\:|} \use{3} AT\&T Common Stock \er{|} %\use{3} means use 3 columns +\- +\br{\:|} Year | Price | Dividend \er{|} +\- +\br{\:|} 1971 | 41--54 | \$2.60 \er{|} +\- +\br{\:|} ~~~2 | 41--54 | ~2.70 \er{|} +\- +\br{\:|} ~~~3 | 46--55 | ~2.87 \er{|} +\- +\br{\:|} ~~~4 | 40--53 | ~3.24 \er{|} +\- +\br{\:|} ~~~5 | 45--52 | ~3.40 \er{|} +\- +\br{\:|} ~~~6 | 41--54 | ~~.95\rlap* \er{|} +\- +\br{\:}\use{3} \left{* (first quarter only)} +\endtable } +\endshowoff +\vfill\eject + +{}\vskip.5truein +\centerline{ +\begintable +\def\sprule{\tvrule{5\tr}} % special rule defines \| + % \tr = .4pt +\begintableformat&\center\endtableformat % repeating columns +\- +\br{\:|} \use{6} XYZABC \er{|\mst{\:}{3pt}{3pt}\rlap{\it ** i}} + % \mst{<token>}{<dimen1>}{<dimen2>} means modified strut derived from token + % with dimen1 extra height and dimen2 extra depth +\- +\br{\:|} \use{3} XYZ | \use{3} ABC \er{|\mst{\:}{2pt}{2pt}} +\fulltablerule{5\tr} %explicit horizontal rule + %can also use \use\tvrule{<dimen>} for partial rules +\br{\:|} X | Y | Z \| A | B | C \er{|} +\- +\br{\:|} 372.466 | 493.7 " 45 \| 124 | 489 | 280 \er{|} +\- +\br{\:|} 372.40~ | 493.7 | 45 \| 124 | 489 | 280 \er{|} +\br{|} " " \| \use{3}\- \er{|} +\br{\:|} 372.~~~ | 493.7 | 45 \| 124 | 489 | 280 \er{|\rlap{ \it ** ii}} +\- +\br{\:|} \use{2} | 832 \| abc | 774 |$\int$\er{|\mst{$\int$}{0pt} +{3pt}} +\br{|} \use{2}\zb{XY/A} |\use{4}\- \er{|} + % \zb{<item>} means zero centered box (with no height or depth) +\br{\:|} \use{2} |qrr \| aaa | 799 | \er{|\rlap{ \it ** iii}} +\- +\endtable} + +\vskip.5truein +\beginshowoff +\centerline{ +\begintable +\def\sprule{\tvrule{5\tr}} % special rule defines \| + % \tr = .4pt +\begintableformat&\center\endtableformat % repeating columns +\- +\br{\:|} \use{6} XYZABC \er{|\mst{\:}{3pt}{3pt}\rlap{\it ** i}} + % \mst{<token>}{<dimen1>}{<dimen2>} means modified strut derived from token + % with dimen1 extra height and dimen2 extra depth +\- +\br{\:|} \use{3} XYZ | \use{3} ABC \er{|\mst{\:}{2pt}{2pt}} +\fulltablerule{5\tr} %explicit horizontal rule + %can also use \use\tvrule{<dimen>} for partial rules +\br{\:|} X | Y | Z \| A | B | C \er{|} +\- +\br{\:|} 372.466 | 493.7 " 45 \| 124 | 489 | 280 \er{|} +\- +\br{\:|} 372.40~ | 493.7 | 45 \| 124 | 489 | 280 \er{|} +\br{|} " " \| \use{3}\- \er{|} +\br{\:|} 372.~~~ | 493.7 | 45 \| 124 | 489 | 280 \er{|\rlap{ \it ** ii}} +\- +\br{\:|} \use{2} | 832 \| abc | 774 |$\int$\er{|\mst{$\int$}{0pt} +{3pt}} +\br{|} \use{2}\zb{XY/A} |\use{4}\- \er{|} + % \zb{<item>} means zero centered box (with no height or depth) +\br{\:|} \use{2} |qrr \| aaa | 799 | \er{|\rlap{ \it ** iii}} +\- +\endtable} +\endshowoff +\bye diff --git a/macros/plain/contrib/misc/tb0tree.tex b/macros/plain/contrib/misc/tb0tree.tex new file mode 100644 index 0000000000..4b0c230819 --- /dev/null +++ b/macros/plain/contrib/misc/tb0tree.tex @@ -0,0 +1,423 @@ +% tb11eppstein.tex + +\Title Trees in \TeX +\\David Eppstein +\endx + +% This paper was published in TUGboat 6#1, March 1985. +% David Eppstein's address (as of 15 June 1988) is +% Computer Science Department +% Columbia University +% New York, NY 10027 +% Eppstein@cs.Columbia.edu + +% First the tree macro definitions. + +\input trees + +% Now the paper itself + +{\obeyspaces\gdef {\ifvmode\indent\fi\space}} +{\catcode `|=0 \catcode`\\=12 |gdef|vbarg#1\endvb{#1|endgroup|medskip}} +\def\makeother#1{\catcode`#112\relax} +\def\vb{\medskip \begingroup \verb \obeylines \obeyspaces \tt \vbarg} +\def\verb{\let\do\makeother \dospecials} +\catcode`\*=\active +\def*{\begingroup\verb\tt\dostar} +\def\dostar#1*{#1\endgroup} + +% \centerline{\bf Trees in \TeX} +% \centerline{David Eppstein; February 6, 1985} + +\beginsection Introduction + +There are many possible uses for trees in typeset text. The following +taxonomy illustrates some of them. + +\tree + Tree + Uses + + \subtree + Computer + Science + + \subtree + Data + Structures + + \leaf{Search Tree} + \leaf{Priority Queue} + \endsubtree + + \subtree + Parsing + + \leaf{Parse Tree} + \leaf{Symbol Table} + \endsubtree + + \subtree + Structured + Programming + \endsubtree + \endsubtree + + \subtree + Genealogy + \leaf{Ancestors} + \leaf{Descendants} + \endsubtree + + \subtree + Taxonomies + \leaf{Tree Uses} + \endsubtree +\endtree + +Unfortunately \TeX\ provides no easy way to typeset such trees. +One possible method is given in exercise 22.14 of the \TeX book: using +\TeX's alignment primitives by hand. This method becomes very clumsy as the +trees grow, however. A more general technique is to write a set of tree +construction macros; that is the approach taken in this paper. The +taxonomy above was typeset with the following input: + +\vb +\tree + Tree + Uses + + \subtree + Computer + Science + + \subtree + Data + Structures + + \leaf{Search Tree} + \leaf{Priority Queue} + \endsubtree + ... + \endsubtree + ... +\endtree +\endvb + +It turns out that \TeX's alignment primitives are not very well suited to +automatic generation of trees. The left edges of the trees at each +level can easily be made to line up, but it is difficult to center +lines of text for the root of a tree in vertical relation to its subtrees. +Instead, the macros described here construct trees from boxes and +glue, doing the alignment themselves. This is not quite as simple as +it sounds---it would be incorrect to set subtrees independently of +each other, because then the edges would not line up. For instance, +in the taxonomy above, the text ``Search Tree'' should line up +with ``Parse Tree''. A one-pass algorithm would set the former +somewhat to the right of the latter. + +To solve this problem, the macros described here set a tree using +three passes. First, a data structure is built up from the tree +definition. Second, that data structure is used to calculate the +width of each level of the tree, so that the subtrees can be aligned with each +other. Finally, the data structure and the calculated list of widths +are used to set the system of boxes, glue, and rules that make up the tree. + +\beginsection Pass 1: Internal storage of the tree structure + +There are several possible ways to store the structure defined by the +tree macros. Since we want to remember already-set text (the words at +the roots of each tree of subtree) we will use a nested structure of boxes. +Each subtree is stored in an *\hbox*, so that pieces of it can be pulled +off easily using *\lastbox* and *\unskip*. To distinguish it from +another subtree, the text at the root of a subtree is stored in a *\vbox*. +To make this clearer, let us return to our original taxonomy. +We shall ignore for the moment +the details inside the text *\vbox*es, and the glue between boxes. +After the first pass, the tree as a whole would look like the +following set of boxes: + +\vb +\hbox{\vbox{Tree Uses} + \hbox{\vbox{Computer Science} + \hbox{\vbox{Data Structures} + \hbox{\vbox{Search Tree}} + \hbox{\vbox{Priority Queue}}} + ...} + ...} +\endvb + +Now we can begin defining the tree macros. We start defining a tree +with the *\tree* macro; this merely sets up the assignment of the +boxed tree structure into a box called *\treebox*. Starting a subtree +is similar, but there is no assignment; also, if it is the first +*\subtree* of its tree or subtree, we must stop making the *\vbox* +containing the root text. A leaf is merely a subtree without any +sub-subtrees. + +\vb +\newbox\treebox +\def\tree{\global\setbox\treebox=\boxtree} +\def\subtree{\ettext \boxtree} +\def\leaf#1{\subtree#1\endsubtree} +\endvb + +Finishing a subtree merely involves first making sure the root text is +complete, and second +completing the box that was started in the expansion of *\subtree*. +Finishing a whole tree involves both of those steps, but then after the +box is completed the remaining two passes must be run. + +\vb +\def\endsubtree{\ettext \egroup} +\def\endtree{\endsubtree \settreesizes \typesettree} +\endvb + + +Now all that remains to be defined of the first pass is the construction +of the *\vbox* containing the root text. The difficulty here is +convincing \TeX\ to make the *\vbox* only as wide as the widest line +of text, rather than the width of the entire page. One solution is to +put the text in an *\halign*, with *\crcr* implicit at the end of each line. +The *\iftreetext* test is used to tell whether we are still inside the +*\halign* and *\vbox*, so that *\ettext* can tell whether it should do +anything. It is globally false, but within the *\vbox* it gets set to true. + +\vb +\newif\iftreetext\treetextfalse % Whether still aligning text +\def\boxtree{\hbox\bgroup % Start outer box of tree or subtree + \baselineskip 2.5ex % Narrow line spacing slightly + \tabskip 0pt % No spurious glue in alignment + \vbox\bgroup % Start inner text \vbox + \treetexttrue % Remember for \ettext + \let\par\crcr \obeylines % New line breaks without explicit \cr + \halign\bgroup##\hfil\cr} % Start alignment with simple template +\def\ettext{\iftreetext % Are we still in inner text \vbox? + \crcr\egroup \egroup \fi} % Yes, end alignment and box +\endvb + +\beginsection Pass 2: Calculation of widths at each level + +Here we calculate a list of the dimensions of each level of the tree; +that is, the widths of the widest *\vbox* at each level. +To do this, we need to be able to maintain lists of things. Since these +are dimensions rather than boxes of text it will be most convenient to +use macros like the ones given on page 378 of the \TeX book. However, +it turns out that we need to set our lists both locally to some +grouping and also globally. Therefore, we will use a stripped down +version of those list macros that can handle the *\global* flag. +To implement this feature, we have to lose some others; the chief losses +are that the contents of the lists will be macro-expanded by various of +the list manipulation macros, and that we can't use redefinitions of *\\* +to perform some operation on the whole list. + +To initialize a control sequence to the empty list, we do *\let\csname\nil*. +Then to add an element to the start of the list we do *\cons{tokens}\csname*, +and to remove that element we do *\cdr\csname*. Both *\cons* and *\cdr* +can be prefixed with *\global*. The first element on the list can be +expanded into the token stream by doing *\car\csname*. There is no +error checking, so giving *\car* or *\cdr* the empty list will cause +mysterious errors later on. Because of the macro expansion performed +by *\cons* and *\cdr*, the token used to separate list elements +expands to itself, and unlike the \TeX book macros cannot be redefined +to do anything useful. + +\vb +\def\cons#1#2{\edef#2{\xmark #1#2}} % Add something to start of list. +\def\car#1{\expandafter\docar#1\docar} % Take first element of list +\def\docar\xmark#1\xmark#2\docar{#1} % ..by ignoring rest in expansion. +\def\cdr#1{\expandafter\docdr#1\docdr#1}% Similarly, drop first element. +\def\docdr\xmark#1\xmark#2\docdr#3{\def#3{\xmark #2}} +\def\xmark{\noexpand\xmark} % List separator expands to self. +\def\nil{\xmark} % Empty list is just a separator. +\endvb + +We calculate the level widths by calling *\setsizes* on the tree; it +will in turn call itself recursively for each of its subtrees. The +tree being sized will be in *\box0*, which is used as scratch in this +macro, and the list of widths already found for this level and below +will be in *\treesizes* (initially *\nil*). When the macro exits, +*\treesizes* will be updated with the widths found in the various +levels of the given tree or subtree. A new *\dimen*, *\treewidth*, is +used within the macro to remember the previous maximum width at the +level of the tree's root. + +\vb +\def\settreesizes{\setbox0=\copy\treebox \global\let\treesizes\nil \setsizes} +\newdimen\treewidth % Width of this part of the tree. +\def\setsizes{\setbox0=\hbox\bgroup % Get a horiz list as a workspace. + \unhbox0\unskip % Take tree, unpack it into horiz list. + \inittreewidth % Get old width at this level. + \sizesubtrees % Recurse through all subtrees. + \sizelevel % Now set width from remaining \vbox. + \egroup} % All done, finish our \hbox. +\endvb + +The first thing *\setsizes* does is to find out what the previous +maximum at this level was, and store it in *\treewidth*. If +*\treesizes* is *\nil*, we haven't seen anything this deep in the tree +before, so the previous size is zero. Otherwise, it is *\car\treesizes*, +and we also do *\cdr\treesizes* to prepare for later recursive calls +to *\setsizes*. + +\vb +\def\inittreewidth{\ifx\treesizes\nil % If this is the first at this level + \treewidth=0pt % ..then we have no previous max width. + \else \treewidth=\car\treesizes % Otherwise take old max level width + \global\cdr\treesizes % ..and advance level width storage + \fi} % ..in preparation for next level. +\endvb + +At this point, we have a horizontal list (the *\hbox* in *\setsizes*) +containing the *\vbox* for the text at the root of this subtree, +followed by the *\hbox*es for all of its sub-subtrees. We loop pulling boxes +from the end of the list with *\lastbox* until we find the text *\vbox*, +calling *\setsizes* recursively for each *\hbox* we come across. + +\vb +\def\sizesubtrees{\loop % For each box in horiz list (subtree) + \setbox0=\lastbox \unskip % ..pull it off list and flush glue. + \ifhbox0 \setsizes % If hbox, it's a subtree - recurse + \repeat} % ..and loop; end loop on tree text. +\endvb + +Now all that remains to do in this call to *\setsizes* is to update +*\treewidth* if the text box, which can be found in *\box0*, is wider +than the previous maximum. Then we add the (possibly updated) value +of *\treewidth* as a text string back onto the head of *\treesizes*. + +\vb +\def\sizelevel{\ifdim\treewidth<\wd0 % If greater than previous maximum + \treewidth=\wd0 \fi % Then set max to new high + \global\cons{\the\treewidth}\treesizes}% In either case, put back on list +\endvb + +\beginsection Pass 3: Typesetting the tree + +We are now ready to begin actual construction of the tree. This is +done by calling *\maketree*, which like *\setsizes* calls itself +recursively for all subtrees. It adds an *\hbox* containing the given +subtree (which it finds in *\treebox*) to the current horizontal list; +thus the outer call to *\maketree* sends the whole tree into \TeX's +output stream. + +\vb +\newdimen\treeheight % Height of this part of the tree. +\newif\ifleaf % Tree has no subtrees (is a leaf). +\newif\ifbotsub % Bottom subtree of parent. +\newif\iftopsub % Top subtree of parent. +\def\typesettree{\medskip \maketree \medskip} % Make whole tree with spacing. +\def\maketree{\hbox{\treewidth=\car\treesizes % Get width at this level. + \cdr\treesizes % Set up width list for recursion. + \makesubtreebox\unskip % Set \treebox to text, make subtrees. + \ifleaf \makeleaf % No subtrees, add glue. + \else \makeparent \fi}} % Have subtrees, stick them at right. +\endvb + +After *\maketree* sets *\treewidth* from *\treesizes*, it calls +*\makesubtreebox*. This opens up the horizontal list describing this +level of the tree, and checks whether it has subtrees. If not, +*\ifleaf* is set to true; otherwise it is set to false, and *\box0* +is set to contain a *\vbox* of them with their connecting rules, +except for the horizontal rule leading from the tree text to the +subtrees. In any case *\treebox* is set to the *\vbox* containing the +tree text. + +\vb + +{\catcode`@=11 % Be able to use \voidb@x. +\gdef\makesubtreebox{\unhbox\treebox % Open up tree or subtree. + \unskip\global\setbox\treebox\lastbox % Pick up very last box. + \ifvbox\treebox % If we're already at the \vbox + \global\leaftrue \let\next\relax % ..then this is a leaf. + \else \botsubtrue % Otherwise, we have subtrees. + \setbox0\box\voidb@x % Init stack of processed subs + \botsubtrue \let\next\makesubtree % ..and call \maketree on them. + \fi \next}} % Finish up for whichever it was. +\endvb + +If this tree or subtree itself has subtrees, we need to put them and +their connections in *\box0* for *\makesubtreebox*. We come here with +the bottom subtree in *\treebox*, the remaining list of subtrees in +the current horizontal list, and the already processed subtrees +stacked in *\box0*. The *\ifbotsub* test will be true for the first +call, that is, the bottom subtree. Here we process the subtree in +*\treebox*. If this is the top subtree, we return; otherwise we tail +recurse to process the remaining subtrees. We use *\box1* as +another scratch variable; this is safe because the *\hbox* in *\maketree* +puts us inside a group, and also because we are not changing the output list. + +\penalty-200 %%%%%%%%%%%%%%%%%%%% added for TUGboat + +\vb + +\def\makesubtree{\setbox1\maketree % Call \maketree on this subtree. + \unskip\global\setbox\treebox\lastbox % Pick up box before it. + \treeheight=\ht1 % Get height of subtree we made + \advance\treeheight 2ex % Add some room around the edges + \ifhbox\treebox \topsubfalse % If picked up box is a \vbox, + \else \topsubtrue \fi % ..this is the top, otherwise not. + \addsubtreebox % Stack subtree with the rest. + \iftopsub \global\leaffalse % If top, remember not a leaf + \let\next\relax \else % ..(after recursion), set return. + \botsubfalse \let\next\makesubtree % Otherwise, we have more subtrees. + \fi \next} % Do tail recursion or return. +\endvb + +Each subtree in the list is processed and stacked in *\box0*; this is +done by *\addsubtreebox*, which calls *\subtreebox* to add connecting +rules to the subtree in *\box1*, and appends to that the old contents +of *\box0*. The vertical connecting rules in the tree are made with +tall narrow *\hrule*s rather than a more simple calls to *\vrule*, +because they are made inside a *\vbox*. + +\vb +\def\addsubtreebox{\setbox0=\vbox{\subtreebox\unvbox0}} +\def\subtreebox{\hbox\bgroup % Start \hbox of tree and lines + \vbox to \treeheight\bgroup % Start \vbox for vertical rules. + \ifbotsub \iftopsub \vfil % If both bottom and top subtree + \hrule width 0.4pt % ..vertical rule is just a dot. + \else \treehalfrule \fi \vfil % Bottom gets half-height rule. + \else \iftopsub \vfil \treehalfrule % Top gets half-height the other way. + \else \hrule width 0.4pt height \treeheight \fi\fi % Middle, full height. + \egroup % Finish vertical rule \vbox. + \treectrbox{\hrule width 1em}\hskip 0.2em\treectrbox{\box1}\egroup} +\endvb + +The last line of the definition of *\subtreebox* calls *\treectrbox* +twice: once for the horizontal connecting rule, and once for the +subtree box itself. This macro centers its argument in a *\vbox* the +height of this subtree and surrounding space. We also define here +*\treehalfrule*, the macro called to make an *\hrule* half the height +of the subtree (with half the height of the horizontal connection +added to make the corners come out square). + +\vb +\def\treectrbox#1{\vbox to \treeheight{\vfil #1\vfil}} +\def\treehalfrule{\dimen0=\treeheight % Get total height. + \divide\dimen0 2\advance\dimen0 0.2pt % Divide by two, add half horiz height. + \hrule width 0.4pt height \dimen0} % Make a vertical rule that high. +\endvb + +That completes *\makesubtree*. If this subtree has no sub-subtrees +under it, *\maketree* will now run *\makeleaf*; this merely adds the +tree text to the *\hbox* opened in *\maketree*. Otherwise we call +*\makeparent* to attach the sub-subtrees and connecting rules to the +text at the root of the subtree. + +\vb +\def\makeleaf{\box\treebox} % Add leaf box to horiz list. +\def\makeparent{\ifdim\ht\treebox>\ht0 % If text is higher than subtrees + \treeheight=\ht\treebox % ..use that height. + \else \treeheight=\ht0 \fi % Otherwise use height of subtrees. + \advance\treewidth-\wd\treebox % Take remainder of level width + \advance\treewidth 1em % ..after accounting for text and glue. + \treectrbox{\box\treebox}\hskip 0.2em % Add text, space before connection. + \treectrbox{\hrule width \treewidth}\treectrbox{\box0}} % Add \hrule, subs. +\endvb + +% restore * to type ordinary +\catcode`\*=12 + +\endinput +%\bye diff --git a/macros/plain/contrib/misc/texinfo.tex b/macros/plain/contrib/misc/texinfo.tex new file mode 120000 index 0000000000..193031bb7c --- /dev/null +++ b/macros/plain/contrib/misc/texinfo.tex @@ -0,0 +1 @@ +../../../texinfo/latest/texinfo.tex
\ No newline at end of file diff --git a/macros/plain/contrib/misc/texpictex.tex b/macros/plain/contrib/misc/texpictex.tex new file mode 100644 index 0000000000..fa979d4b70 --- /dev/null +++ b/macros/plain/contrib/misc/texpictex.tex @@ -0,0 +1,244 @@ +% +% texpictex.tex -- The following macros over-ride certain definitions in the +% PiCTeX macro package. The net effect is that line-drawing is done using +% the \special's used by texpic (tpic). Several DVI printers understand +% and handle these specials. +% +% Currently, only straight lines are translated. Recently, I added a +% clipping routine to clip to the bounding box. +% +% If people extend this to included elliptic circles and quadratics, +% please forward the extensions to me (quads are used in the \arrow +% macro, making them very slow). +% +% Dirk Grunwald +% Univ. of Illinois +% grunwald@m.cs.uiuc.edu +% +\def\makebangletter{\catcode`\!=11\relax} +\def\makebangother{\catcode`\!=12\relax} +% +\makebangletter +% +% The units that texpic deals in. You should define it this way instead +% of simply saying ``0.001in'' because the difference in resolution +% actually makes a big difference +% +\newdimen\!tpu +\!tpu=1in +\divide\!tpu by 1000 +%%% +%% \!maptpus -- map a PiCTeX dimension to a TeXPiC dimension +%% using the \!tpu conversion factor. +%% +%% uses: dimen0 +%% +\def\!maptpus#1#2 {\dimen0=#1\divide \dimen0 by \!tpu #2=\dimen0} +% +% ** \setplotsymbol ({PLOTSYMBOL} [ ] < , >) +% ** Save PLOTSYMBOL away in an hbox for use with curve plotting routines +% ** See Subsection 5.2 of the manual. +\def\setplotsymbol(#1#2){% + \!setputobject{#1}{#2} + \setbox\!plotsymbol=\box\!putobject% + \!plotsymbolxshift=\!xshift + \!plotsymbolyshift=\!yshift +% +% Additions: compute size of dot, convert to TPUs and issue a pensize +% + \!dimenB=\wd\!plotsymbol + \!dimenC=\ht\!plotsymbol + \advance\!dimenC by \dp\!plotsymbol + \ifdim\!dimenB<\!dimenC \!dimenF=\!dimenC \else \!dimenF=\!dimenB\fi + \!maptpus{\!dimenF}{\!countC} + \special{pn \the\!countC} + \ignorespaces} + +\setplotsymbol({\fiverm .})% ** initialize plotsymbol + +% ** The following routine is used to draw a "solid" line between (xS,yS) +% ** and (xE,yE). Points are spaced nearly every \plotsymbolspacing length +% ** along the line. +% +% Note: this is a replacement for PicTeX \!linearsolid. +% If line clipping is enabled, the line to be drawn is +% clipped using \!clipline. If there's anything left +% to draw after clipping, it's drawn. If clipping is off, +% the line is simply drawn. In either case, line drawing +% is done by \!texpicline. +% +\def\!linearsolid{% + \let\!nextLinearAct=\!texpicline + \expandafter\ifx \!initinboundscheck \relax + \else \!clipline \if!InBounds \else \let\!nextLinearAct=\relax \fi \fi% + \!nextLinearAct% +} +% +% Texpic has increasing origin in the upper left corner, while +% pictex has origin in bottom left corner. Ergo, we flip the signs +% for y-coordinates. +% +\def\!texpicline{% +\advance\!xS by -\!xorigin +\advance\!xE by -\!xorigin +\advance\!yS by -\!yorigin +\advance\!yE by -\!yorigin +\!maptpus{\!xS}{\!countC} \!maptpus{\!yS}{\!countD} \!countD=-\!countD% +\special{pa \the\!countC \space \the\!countD}% +\!maptpus{\!xE}{\!countC} \!maptpus{\!yE}{\!countD} \!countD=-\!countD% +\special{pa \the\!countC \space \the\!countD}\special{fp}% +\ignorespaces} +% +%%% +% Code to support line clipping +% +% Line clipping routine. Clips to bounding box specified +% by (!checkleft, !checkbot) and (!checkright, !checktop). +% Note that this box is only defined if \initboundscheckon +% has been called. +% +% The clipping algorithm was published in ACM TOG Vol 3 No 1 +% by people at Berkeley, but I've forgotten the complete reference. +% This was translated from a version I wrote in C. +% +%% +% After calling \!cliplines, !InBounds tells you if the line contains +% any points within the clipping window. +% +\newif\if!InBounds +% +%% +% \!clipt -- this corresponds to the routine by the same name +% in the published algorithm. +% +% Dimens used are descibed below. All are grouped and know that +% PiCTeX doesn't use dimen0..9. Variable names are taken from +% the TOG article. The junk on the r.h.s. is indenting information +% +% Globals: dimen8 corresponds to t0 +% dimen9 corresponds to t1 +% +% clipt dimen0 corresponds to p +% dimen1 corresponds to q +% dimen2 corresponds to r +% +% !fastclip Uses bounding boxes +% +% !clipline passes dimen3 to clipt as p +% passes dimen4 to clipt as q +% uses dimen0, dimen2 +% +% +\def\!clipt#1#2{% + \dimen0=#1 \relax \dimen1=#2 \relax + \ifdim \dimen0 < \!zpt% >0 + \!divide{\dimen1}{\dimen0}{\dimen2}% + \ifdim \dimen2 > \dimen9% >1 + \global\!InBoundsfalse + \else% =1 + \ifdim \dimen2 > \dimen8 \dimen8=\dimen2 \fi + \fi% <1 + \else \ifdim \dimen0 > \!zpt% =0>1 + \!divide{\dimen1}{\dimen0}{\dimen2}% + \ifdim \dimen2 < \dimen8% >2 + \global\!InBoundsfalse + \else% =2 + \ifdim \dimen2 < \dimen9 \dimen9=\dimen2 \fi + \fi% <2 + \else% =1 + \ifdim \dimen1 < \!zpt \global\!InBoundsfalse \fi + \fi% <1 + \fi% <0 +} +% +% fastclipcheck +% +\def\!fastclip#1#2{% + \ifdim #1<\!checkleft \global\!InBoundsfalse \else + \ifdim #1>\!checkright \global\!InBoundsfalse \else + \ifdim #2<\!checkbot \global\!InBoundsfalse \else + \ifdim #2>\!checktop \global\!InBoundsfalse \else + \fi + \fi + \fi + \fi} +% +% clipline - clip a line to the current bounding box. +% assumes line is in (!xS, !yS) and extends to (!xE,!yE) and that +% \!xdiff and \!ydiff has been set up. This is normally done +% in \!lstart. +% +% \!clipline first checks to see if the start & end points are +% conainted in the clipping box. If the simple compare works, +% then no clipping is done, else \!doclip is called to +% do the actually clipping computations. +% +\def\!clipline{% + \!!initinboundscheck + \!InBoundstrue + \!fastclip{\!xS}{\!yS}% + \!fastclip{\!xE}{\!yE}% + \if!InBounds\else\!doclip\fi} +% +\def\!doclip{% +\begingroup% + \global\!InBoundstrue% + \dimen8=0pt + \dimen9=1pt + % + \dimen3=-\!xdiff + \dimen4=\!xS \advance\dimen4 by -\!checkleft% fromX-minX + \!clipt{\dimen3}{\dimen4}% +% + \if!InBounds% 0 + \dimen3=\!xdiff + \dimen4=\!checkright \advance\dimen4 by -\!xS% maxX - fromX + \!clipt{\dimen3}{\dimen4}% +% + \if!InBounds% 1 +% + \dimen3=-\!ydiff + \dimen4=\!yS \advance\dimen4 by -\!checkbot% fromY-minY + \!clipt{\dimen3}{\dimen4}% +% + \if!InBounds% 2 +% + \dimen3=\!ydiff + \dimen4=\!checktop \advance\dimen4 by -\!yS% maxY-fromY + \!clipt{\dimen3}{\dimen4}% +% + \if!InBounds% 3 + \dimen0=1pt +% +% The following \if's truncate the line based on the solution +% to the parametric solution to the bounding box. +% +% Note that we don't have a \!multiply, the equivilent to \!divide. +% The code below compute X * Y as (x / ( 1/ Y)), which is far +% from optimal. +% + \ifdim\dimen9 < \dimen0% 4 + \!divide{\dimen0}{\dimen9}{\dimen2}% +% + \dimen3=\!xdiff \!divide{\dimen3}{\dimen2}{\dimen4}% + \global\!xE=\dimen4 \global\advance\!xE by \!xS +% + \dimen3=\!ydiff \!divide{\dimen3}{\dimen2}{\dimen4}% + \global\!yE=\dimen4 \global\advance\!yE by \!yS + \fi% 4 + \ifdim\dimen8 > \!zpt% 4 + \!divide{\dimen0}{\dimen8}{\dimen2}% +% + \dimen3=\!xdiff \!divide{\dimen3}{\dimen2}{\dimen4}% + \global\advance\!xS by \dimen4 +% + \dimen3=\!ydiff \!divide{\dimen3}{\dimen2}{\dimen4}% + \global\advance\!yS by \dimen4 + \fi% 4 + \fi% 3 + \fi% 2 + \fi% 1 + \fi% 0 +\endgroup} +% +\makebangother diff --git a/macros/plain/contrib/misc/thirteen.tex b/macros/plain/contrib/misc/thirteen.tex new file mode 100644 index 0000000000..034723dc4d --- /dev/null +++ b/macros/plain/contrib/misc/thirteen.tex @@ -0,0 +1,202 @@ + \parindent=0pt + \font\big=cmb10 scaled\magstep3 + \centerline{\big FRIDAY THE THIRTEEN} + \normalbaselineskip=12pt + \noindent + \newcount\dw % Gets day of the week + \newcount\leap % Leap year fingaler + \newcount\m % Temp register + \newcount\y % Another temp register + \newcount\a + \newcount\b + \newcount\x + \newcount\jd + \newcount\aantal + \newcount\kalmaand + \newcount\alfa + \newcount\eindjaar + \newcount\tempjaar + \newcount\firstyear + \newcount\lastyear + \newcount\c + \newcount\d + \newcount\e + \newcount\f + \newcount\z + \newcount\jda + \newcount\jdb + \newcount\difference + \newcount\jaar + \newcount\maand + \newcount\dag + \newcount\jr + \newcount\mnd + \newcount\dg +% +\parskip=1.5cm +% +\def\daydifference +{ +\message{date 1: } +\datjul +\jda=\jd +\message{date 2: } +\datjul +\jdb=\jd +\advance\jdb by-\jda +\difference=\jdb +\ifnum\difference<0 +\multiply\difference by -1 +\fi +\hbox{\number\difference}\hfill\break +} +\def\dayafter +{ +\message{date 1: } +\datjul +\message{day difference :} +\read16 to\difference +\advance\jd by\difference +\number\difference\hfill\break +\z=\jd +\juldat +\hbox{\number\jr\ \number\mnd\ \number\dg}\hfill\break +} + +\def\datjul{ +% +% +% +% +\jaar=1991 +%\read16 to\maand +%\read16 to\dag +%\hbox{\number\jaar\ \number\maand\ \number\dag}\hfill\break +\global\eindjaar=\jaar +\global\advance\eindjaar by15 +\maand=1 +\dag=1 +\ifnum\maand>2 + \y=\jaar + \m=\maand +\else + \y=\jaar \advance\y by-1 + \m=\maand \advance\m by12 +\fi +\a=\y +\divide\a by100 +\b=2 +\advance\b by-\a +\x=\a +\divide\x by4 +\advance\b by\x +% +\jd=\y +\multiply\jd by36525 +\divide\jd by100 +% +\x=\m +\advance\x by1 +\multiply\x by306001 +\divide\x by10000 +\advance\jd by\x +\advance\jd by\dag +\advance\jd by1720995 +\advance\jd by\b +} +% +\def\dayofweek{ +\x=\jd +\advance\x by 1 +\dw=\x \divide\x by 7 \multiply\x by 7 \advance\dw by -\x +} + +% +% +\def\juldat{ +\ifnum\z<2299161 + \a=\z +\else + \alfa=\z + \multiply\alfa by100 + \advance\alfa by-186721625 + \divide\alfa by3652425 + \a=\z + \advance\a by1 + \advance\a by\alfa + \divide\alfa by4 + \advance\a by-\alfa +\fi +% +\b=\a +\advance\b by1524 +% +\c=\b +\multiply\c by100 +\advance\c by-12210 +\divide\c by36525 +% +\d=\c +\multiply\d by36525 +\divide\d by100 +% +\e=\b +\advance\e by-\d +\multiply\e by10000 +\divide\e by306001 +% +% +\x=\b +\advance\x by-\d +\dg=\x +\x=\e +\multiply\x by306001 +\divide\x by10000 +\advance\dg by-\x +% +\mnd=\e +\advance\mnd by-1 +\ifnum\e>13 + \advance\mnd by-12 +\fi +% +\jr=\c +\advance\jr by-4715 +\ifnum\mnd>2 + \advance\jr by-1 +\fi +} +% +\def\leesjul{ +\relax +\read16 to \z +} +\newdimen\cf +\setbox0=\hbox{\rm0} +\cf=\wd0 +\def\breedte{\kern\cf} +\def\dertien{ +\datjul +\kalmaand=\maand +\dayofweek +\z=\jd +\juldat +\loop\ifnum\jr<\eindjaar + \dayofweek + \ifnum\dg=13 + \ifnum\dw=5 + \hbox{\number\jr\ \number\dg\ \number\mnd} + \fi + \fi + \advance\z by1 + \jd=\z + \juldat +\repeat +} +% +\dertien +\bye + + + + diff --git a/macros/plain/contrib/misc/threecol.tex b/macros/plain/contrib/misc/threecol.tex new file mode 100644 index 0000000000..bc8dde3523 --- /dev/null +++ b/macros/plain/contrib/misc/threecol.tex @@ -0,0 +1,47 @@ +% Definitions to produce threecolumn output in TeX from +% the TeXbook. +% + % this is threecolumn for a newsletter. All of the pages have + % an 8 inch form size, the first page is offset 1.5 inches from + % the top, the rest are offset one inch from the top. The first + % page has an extra-high, two line headline. + +\tenrm +\hoffset=-.5in +\voffset=-.02in +\parindent=0pt +\tolerance=10000 +\vsize=9.04in +\nopagenumbers + +\newbox\midcolumn +\newbox\leftcolumn +\newdimen\fullhsize +\newdimen\partialhsize +\fullhsize=8.5in \hsize=2.8in +\def\fullline{\hbox to\fullhsize} +\def\columnbox{\leftline{\pagebody}} + +\let\lr=L +\let\nextvskip=N + +\def\tripleformat + {\shipout\vbox + {\fullline{\box\leftcolumn\hfil\box\midcolumn\hfil\columnbox} + } + \advancepageno + } + +\output={\if L\lr + \global\setbox\leftcolumn=\columnbox \global\let\lr=M + \else\if M\lr + \global\setbox\midcolumn=\columnbox \global\let\lr=R + \else \tripleformat \global\let\lr=L\fi\fi + + \ifnum\outputpenalty>-20000 \else\dosupereject\fi} +\font\bigrm=CMSS10 at 10pt +\bigrm + +\obeylines +\def\label#1{\vbox to .98in{\vfill #1}} +\def\zip#1{\line{\hfill #1\hfill}} diff --git a/macros/plain/contrib/misc/toc.mac b/macros/plain/contrib/misc/toc.mac new file mode 100644 index 0000000000..d1b1db7f44 --- /dev/null +++ b/macros/plain/contrib/misc/toc.mac @@ -0,0 +1,37 @@ +% TOC +% +% This macro can be used for Table Of Contents portion of a paper +% or book. To use this macro package, put the line +% \input toc +% at the top of your file. The following are the symbols that may be +% used with this macro: +% +% \tocindent{ SIZE } +% This is used to indent the table of contents +% entries by "SIZE". "SIZE" is something like +% `50pt', `1.0truein' or something similar. +% (default=0pt) +% \tochead{ HEAD } +% This is essentially the same as the definition +% `\leftline'. The table of cantents headers are +% not indented by `\tocindent'. +% \tocline{ SECTION }{ PAGE } +% This is the standard table of contents line +% containing a section and page number separated +% with either dots or a line. This entry is in- +% dented by `\tocindent'. +% \filldot +% This will make the filling between the `\tocline' +% section and page be `\dotfill'. (default) +% \filline +% This will make the filling between the `\tocline' +% section and page be `\hrulefil' (a solid horizon- +% tal line). +% +\def\xyztocind{\hskip 0pt} +\def\xyztocfil{\dotfill} +\def\tocindent#1{\def\xyztocind{\hskip #1}} +\def\filldot{\def\xyztocfil{\dotfill}} +\def\filline{\def\xyztocfil{\hrulefill}} +\def\tocline#1#2{\hbox to \hsize{\xyztocind #1\ \xyztocfil\ #2}} +\def\tochead#1{\hbox to \hsize{#1\hfill}} diff --git a/macros/plain/contrib/misc/toc.tex b/macros/plain/contrib/misc/toc.tex new file mode 100644 index 0000000000..ab1c665fd9 --- /dev/null +++ b/macros/plain/contrib/misc/toc.tex @@ -0,0 +1,59 @@ +%%%--- Cut here ----------------------------------------------------------- +%%% File toc.tex +% +% Automatically generate a Table Of Contents (TOC) while the +% document is being processed by PLAIN TeX +% +% Use \tocref{ texta }{ textb } to insert TOC entries. `texta' +% will be typeset in the TOC and at the current location, +% for example `\centerline{\tocref{Chapter 1}{}}' inserts +% `Chapter 1' at the current location in your document +% centered, and enters it in the TOC (not centered). +% `textb' is a prefix text/TeX commands to precede `texta' +% in the TOC only (it will not appear in the current loc- +% ation of your document -- {{`textb'`texta'}.....\folio}). +% Use \tocline to add info only intended for the TOC (no page number or +% dotfill is used for tocline entries). +% Use \tocgen to force the last TOC page to be printed (last command +% before \end?) +% To specialize, look at the below comments in the right +% +% Uses variable names +% tocnew, tocopage, tocbox, tocsize, tocstrut, tocref, +% tocbanner, tocsuffix, tocline, tocstart, tocont, tocgen +% +% Created by Dan Zirin. Copyright (c) 1987 Zar Limited. +% Permission given for inclusion in TeXMaG. +% +\newcount\tocnew\tocnew=1\newcount\tocopage +\newbox\tocbox\newdimen\tocsize +\def\tocstrut{{\vrule height8.5pt depth3.5pt width0pt}} % TOC baselineskip -1pt +\def\tocref#1#2{\tocbanner#1 % Where `texta' is duplicated + \global\setbox\tocbox=\vbox{ + \box\tocbox\vbox{ + \line{\tocstrut{#2#1}~\dotfill~\folio} % Where the TOC line is made + }}\tocsuffix} +\def\tocline#1{\tocbanner + \global\setbox\tocbox=\vbox{ + \box\tocbox\vbox{ + \line{\tocstrut{#1}} + }}\tocsuffix} +\def\tocbanner{\ifnum\tocnew=1\tocstart\fi + \ifnum\tocnew=3\tocont\fi} +\def\tocsuffix{\ifdim\tocsize<\ht\tocbox\tocgen + \global\tocnew=3\fi} +% Do not change tocsize = 1.0 (TeX may go into an infinite loop) +\def\tocstart{\global\tocsize=.95\vsize % TOC page >95% full, print it + \global\setbox\tocbox=\vbox{ + \centerline{\tocstrut\bf Table Of Contents} % TOC page 1 banner line 1 + \line{\tocstrut\hfil} % TOC page 1 banner line 2 blank line + }\global\tocnew=2} +\def\tocont{\global\setbox\tocbox=\vbox{ + \centerline{\tocstrut Table Of Contents (Continued)} % TOC page <> 1 banner + }\global\tocnew=2} +\def\tocgen{\ifnum\tocnew=1 + \message{No TOC entries found.}\else + \tocopage=\pageno\pageno=0\message{(TOC} + \shipout\box\tocbox\message{)} + \pageno=\tocopage\global\tocnew=1\fi} +%%%--- Cut here ----------------------------------------------------------- diff --git a/macros/plain/contrib/misc/ulem.sty b/macros/plain/contrib/misc/ulem.sty new file mode 120000 index 0000000000..fb341fbf56 --- /dev/null +++ b/macros/plain/contrib/misc/ulem.sty @@ -0,0 +1 @@ +../../../latex/contrib/ulem/ulem.sty
\ No newline at end of file diff --git a/macros/plain/contrib/misc/unouter.tex b/macros/plain/contrib/misc/unouter.tex new file mode 100644 index 0000000000..8b640aaf1f --- /dev/null +++ b/macros/plain/contrib/misc/unouter.tex @@ -0,0 +1,36 @@ +% unouter.tex - remove the concept of \outer from plain TeX +% By Eamonn McManus Nov 88. This file is not copyrighted. + +% This macro removes the outerness of the control sequence \csname#1\endcsname +% by copying it to \csname un*#1\endcsname and then defining +% \csname#1\endcsname to be a macro that expands to that. For example, +% after \unouter{proclaim}, we have: \proclaim=macro:->\un*proclaim . +% and \un*proclaim=\outer macro:->[original definition of \proclaim] . +% It would be nice if we could avoid this extra level, but I know of no way +% of doing that short of writing the \meaning to a file and reading that in +% again (yeuch). +\def\unouter#1{\toks0=\expandafter{\csname un*#1\endcsname}% + \edef\next{\let\the\toks0=}\expandafter\next\csname#1\endcsname + \expandafter\edef\csname#1\endcsname{\the\toks0}} + +% In the case where the macro has no parameter text, we can unouter it +% directly by putting its expansion into a token list and redefining it +% in terms of that expansion. +\def\simpunouter#1{% + \toks0=\expandafter\expandafter\expandafter{\csname#1\endcsname}% + \expandafter\edef\csname#1\endcsname{\the\toks0}} + +% ^^L is defined as \outer\par +\let^^L=\par + +% Change everything else defined as \outer. +\simpunouter{newcount} \simpunouter{newdimen} \simpunouter{newskip} +\simpunouter{newmuskip} \simpunouter{newbox} \simpunouter{newtoks} +\simpunouter{newread} \simpunouter{newwrite} \simpunouter{newfam} +\simpunouter{+} \simpunouter{bye} +\unouter{newhelp} \unouter{newif} \unouter{beginsection} \unouter{proclaim} + +% \unouter no longer needed, and remove the offending primitive! +\let\unouter=\undefined \let\simpunouter=\undefined \let\outer=\relax + +\endinput diff --git a/macros/plain/contrib/misc/varindent.tex b/macros/plain/contrib/misc/varindent.tex new file mode 100644 index 0000000000..117eb00c0c --- /dev/null +++ b/macros/plain/contrib/misc/varindent.tex @@ -0,0 +1,60 @@ +%From: Donald Arseneau <ASND@TRIUMFCL.BITNET> +%Subject: Variable indentation puzzle +% +%The puzzle in TeXmag V4N1 about making indentation match the length of +%the line above is interesting because there are (at least) two very different +%approaches. One is to set every paragraph in a \vbox in order to measure the +%width of its last line. I hope someone sends in a solution using that method +%because I chose the method suggested by the question: "(as per what is done +%with displayed equations)." +% The width of the line above a displayed equation +%is given with the parameter \predisplaysize, so it would seem trivial to use +%a displayed equation to measure the line width. However, there are some +%details to keep things interesting: The vertical spacing must be the same +%as for an ordinary paragraph, including the \parskip; Likewise for the +%penalties; The depths must be preserved, especially if a pagebreak occurs; +%If the indentation gets too wide something must be done to prevent a bad +%linebreak. The unboxing method has this last problem too, but there it may +%be possible to reset the final line to the full textwidth. Here I use +%ordinary indentation when the line gets too long. The advantage the display +%method has over reboxing is that there are things that cannot be pulled +%of a vertical list, so reboxing won't always work. + +\newdimen \normalparindent +\newdimen \longlinelen +\newdimen \gscratch % used globally + +% useful little macro: gives absolute value of a number or a dimension (if in +% a dimension register). Note that this makes use of TeX's confusing habit of +% expanding \if's within a number + +\def\abs#1{\ifnum#1<0 -\fi#1} + +% \usevarindent turns on variable indentation. Use grouping to turn it off. +% (It would be easy to convert this to a LaTeX environment.) +% It is necessary to say \usevarindent before ending the paragraph +% above the first variable indentation. + +\def\usevarindent{% +% don't try indenting to within 2\parindent of the right margin + \normalparindent=\parindent + \longlinelen=\hsize \advance\longlinelen-2\normalparindent + \displaywidowpenalty=\widowpenalty + \let\par=\varindent} + +% \varindent is used to end each paragraph during variable indentation. + +\def\varindent{\ifhmode\ifinner\else $$ % test for unrestricted horizontal mode + \lineskiplimit=-999pt % so we get a baselineskip that we can cancel with: + \abovedisplayskip=-\baselineskip \abovedisplayshortskip=-\baselineskip + \belowdisplayskip=0pt \belowdisplayshortskip=0pt + \halign{##\cr\noalign{\global\gscratch=\prevdepth}% get depth of line above + \hbox{\vrule width0pt depth \gscratch }\cr}% preserve its depth +% now get the width of the last line of the paragraph that just ended, +% If it is too long just use normal indentation: + \ifdim\abs\predisplaysize>\longlinelen \global\gscratch=\normalparindent +% otherwise, use the width of the line above (\predisplaysize-2em): + \else\global\gscratch=\predisplaysize \global\advance\gscratch -2em\fi +$$\parindent=\gscratch +\fi\fi \endgraf}% Plain TeX sets \endgraf=\par; use \@@par in LaTeX + diff --git a/macros/plain/contrib/misc/verbatim.mac b/macros/plain/contrib/misc/verbatim.mac new file mode 100644 index 0000000000..b0c5d1ce6d --- /dev/null +++ b/macros/plain/contrib/misc/verbatim.mac @@ -0,0 +1,56 @@ +% ttbar.tex + + +% Lifted from TUGBOT.STY. +% +% Support verbatim listing of TeX source, as defined in TeXbook, p. 421; +% lifted from MANMAC.TEX, and modified slightly for narrower columns. + +\chardef\other=12 +\def\ttverbatim{\begingroup \catcode`\\=\other + \catcode`\{=\other \catcode`\}=\other \catcode`\$=\other + \catcode`\&=\other \catcode`\#=\other \catcode`\%=\other + \catcode`\~=\other \catcode`\_=\other \catcode`\^=\other + \catcode`\"=\other + \obeyspaces \obeylines \tt} + +\newskip\ttglue +{\tenpoint\tt \global\ttglue=.5em plus .25em minus .15em} +% this should be installed in each font + +% From David Eppstein's ``Trees'' paper (6#1), preserve initial spaces. +{\obeyspaces\gdef {\ifvmode\indent\fi\space}} + +\newdimen\ttrightskip +\ttrightskip=5pc + +\newif\ifttVertChar \ttVertCharfalse +{\catcode`\|=\active \gdef\VertChar{\def|{\char"7C }}} + +%\outer\def\begintt{$$\let\par=\endgraf \ttverbatim \parskip=\z@ +\outer\def\begintt{$$\def\par{\leavevmode\null\endgraf}\ttverbatim \parskip=\z@ + \ifttVertChar \VertChar \global\ttVertCharfalse \else \catcode`\|=0 \fi + \catcode`\|=0 \rightskip=-\ttrightskip \ttfinish} +{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character + |obeylines % end of line is active + |gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}} + +% Other non-tt elements that may be embedded within \begintt...\endtt . +\def\MTH{$} +\def\sb{_} +\def\sp{^} +\def\SP{{\tt\char"20 }} % "visible" space +\chardef\bs=`\\ +\def\vrt{{\tt\char`\|}} + +\catcode`\|=\active +%{\obeylines \gdef|{\ttverbatim \spaceskip\ttglue \let^^M=\ \let|=\endgroup}} +{\obeylines \gdef\activatettbar{\global\catcode`\|=\active % + \gdef|{\ttverbatim \spaceskip\ttglue \xspaceskip\ttglue % + \let^^M=\ \let|=\endgroup}}} +\activatettbar + +% The active | (which here implements verbatim mode) is redefined in +% such headers as TABLES.TeX and must be able to be reinstated. +% \activatettbar been tested with TABLES.TeX, and the two uses are +% mutually operable (TUGboat 7#2, "Tables in INRSTeX"). diff --git a/macros/plain/contrib/misc/verbatim.tex b/macros/plain/contrib/misc/verbatim.tex new file mode 100644 index 0000000000..e4b0b0fe7a --- /dev/null +++ b/macros/plain/contrib/misc/verbatim.tex @@ -0,0 +1,44 @@ +% -*- Mode: TeX -*- + +\ifx\thisfileis\anUndefinedMacro\input maybeload \fi + +\thisfileis{<eb.tex.texlocal>verbatim} % abort loading if we're already loaded + +\input redefine + +% This file provides a way of defining new verbatim environments, which is +% otherwise difficult. The '\newverbatimenvironment' declaration is just like +% the '\newenvironment' declaration except that the stuff in between \begin{foo} +% and \end{foo} is read with the special syntax of verbatim mode. +% + +\makeatletter + +% First, dispatch depending on whether there is an optional argument. + +\def\newverbatimenvironment#1{\@ifnextchar + [{\@new@v@env{#1}}{\@new@v@env{#1}[0]}} + +% In the definition of \@new@v@env, the easy part (definition of \endFOO) comes +% first. The definition of \FOOVERBATIM is harder, and finally \FOO is defined +% to have \verb@syntax\FOOVERBATIM at the end of its expansion. + +\def\@new@v@env#1[#2]#3#4{\expandafter\def\csname end#1\endcsname{#4}\relax + \expandafter\def@verbatim\csname #1VERBATIM\endcsname{#1}{##1\end{#1}}\relax + \expandafter\newcommand\csname #1\endcsname + [#2]{#3\verb@syntax\csname #1VERBATIM\endcsname}} + +% Define verbatim syntax. + +\def\verb@syntax{\obeylines\tt\let\do\@makeother\dospecials\frenchspacing\@vobeyspaces} + +% Finally, an auxiliary function to define a macro whose argument is delimited +% by \end{foo} in special syntax, \def@verbatim{\CS}{foo}{...body...}. + +\begingroup \catcode `|=0 \catcode `[= 1 +\catcode`]=2 \catcode `\{=12 \catcode `\}=12 +\catcode`\\=12 |gdef|def@verbatim#1#2#3[|def#1##1\end{#2}[#3]] +|endgroup + +\makeatletter + diff --git a/macros/plain/contrib/misc/verbtim2.tex b/macros/plain/contrib/misc/verbtim2.tex new file mode 100644 index 0000000000..1265fce8f1 --- /dev/null +++ b/macros/plain/contrib/misc/verbtim2.tex @@ -0,0 +1,36 @@ +% From: Tim Morgan <morgan@uci-icsa> +% Produce verbatim listings of various sorts + +\def\uncatcodespecials{\def\do##1{\catcode`##1=12 } \dospecials} + +\def\setupverbatim{% + \par \tt \spaceskip=0pt % Make sure we get fixed tt spacing + \obeylines\uncatcodespecials\obeyspaces\verbatimdefs +} + +% This macro turns on verbatim mode until ?endverbatim is seen. +\def\verbatim{\begingroup \setupverbatim + \parskip=0pt plus .05\baselineskip \parindent=0pt + \catcode`\ =13 \catcode`\^^M=13 \catcode`\?=0 + \verbatimgobble} +{\catcode`\^^M=13{\catcode`\ =13\gdef\verbatimdefs{\def^^M{\ \par}\let =\ }} + \gdef\verbatimgobble#1^^M{}} + +% This defines ?endverbatim to end the group which begins with \verbatim +\let\endverbatim=\endgroup + +% Input a file in verbatim mode. Sometimes useful for including +% real-life examples into a paper. +\def\verbfile#1{\begingroup\setupverbatim + \parskip=0pt plus .05\baselineskip \parindent=0pt + \input#1 \endgroup +} + +% This is the same as the above, but it adds line numbers to each +% line of the file printed. +\newcount\lineno +\def\listing#1{\lineno=0\begingroup\setupverbatim + \parskip=0pt plus .05\baselineskip \parindent=20pt + \everypar{\advance\lineno by 1 \llap{\the\lineno\ \ }}\input#1 + \endgroup +} diff --git a/macros/plain/contrib/misc/web9pt.tex b/macros/plain/contrib/misc/web9pt.tex new file mode 100644 index 0000000000..f00df7b744 --- /dev/null +++ b/macros/plain/contrib/misc/web9pt.tex @@ -0,0 +1,5 @@ +\xdef\fmtversion{\fmtversion+WEB9PT1.0} +\input 9point.tex +\ninepoint +\let\sc=\sevenrm \let\mainfont=\ninerm +\font\tentex=cmtex9 diff --git a/macros/plain/contrib/misc/webmacss.tex b/macros/plain/contrib/misc/webmacss.tex new file mode 100644 index 0000000000..3596a10394 --- /dev/null +++ b/macros/plain/contrib/misc/webmacss.tex @@ -0,0 +1,15 @@ +%%%-This is the unkindest cut here of all---------------------------- +% This is WEBMACss.TEX in text format, as of Aug 27, 1987. +% modification to standard macros for WEB listings (in addition to +% PLAIN.TEX) +% Prints Pascal text in sans-serif type. +% To use, include the line \input WEBMACss.TeX in the ``limbo'' +% section of your WEB program +\font\pit=cmss10 % type for identifiers +\font\pbf=cmssbx10 % type for reserved words. + +\def\\#1{\hbox{\pit#1\/\kern.05em}} % italic type for identifiers +%\def\|#1{\hbox{$#1$}} % one-letter identifiers look a bit better this way +\let\|=\\ % We aren't using \mit anymore. +\def\{\hbox{\pbf#1\/}} % boldface type for reserved words +%%%-Julius Caeser never really said that----------------------------- diff --git a/macros/plain/contrib/misc/weirdtitle.tex b/macros/plain/contrib/misc/weirdtitle.tex new file mode 100644 index 0000000000..a1573361d0 --- /dev/null +++ b/macros/plain/contrib/misc/weirdtitle.tex @@ -0,0 +1,11 @@ +%%%----------Remove and admire---------------------------------------- + \def\weirdtitle#1{% + \setbox0=\vbox{\noindent #1}% + \setbox1=\vbox{% + \unvbox0 + \setbox2=\lastbox + \line{\hfill\unhbox2 \hfill}% + }% + \unvbox1 + }% +%%%---------Neat, isn't it?------------------------------------------- diff --git a/macros/plain/contrib/misc/wochtag.tex b/macros/plain/contrib/misc/wochtag.tex new file mode 100644 index 0000000000..5c2d610320 --- /dev/null +++ b/macros/plain/contrib/misc/wochtag.tex @@ -0,0 +1,54 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Wochentag zu einem Datum ermitteln % +% von Andreas Schrell % +% Windhoevel 2 % +% 5600 Wuppertal 2 % +% Tel. 0202/666889 % +% E-Mail: ma107 at dhafeu11.bitnet % +% Version 1.0 vom 9.10.1991 % +% % +% Aufruf: % +% \Wochentag dd.mm.jjjj. % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +{\catcode`\@=11 +\newcount\@tag +\newcount\@monat +\newcount\@jahr +\newcount\@ja +\newcount\@jb +\newcount\@ha +\newcount\@hb +\newcount\@hc +\newcount\@b +\newcount\@f +\gdef\Wochentag #1.#2.#3.{\@tag=#1\@monat=#2\@jahr=#3 +\ifnum\@jahr<100\advance\@jahr by 1900\else\fi +\ifnum\@monat<3 % if monat<3 + \advance\@monat by 10 % monat:=monat+10 + \advance\@jahr by -1 % jahr:=jahr-1 +\else % else + \advance\@monat by -2 % monat:=monat-2 +\fi % fi +\@ja=\@jahr\divide\@ja by 100 % ja:=jahr/100 +\@jb=-\@ja\multiply\@jb by 100 +\advance \@jb by \@jahr % jb:=jahr-ja*100 +\@ha=\@monat\multiply\@ha by 13 +\advance\@ha by -1 % ha:=13*monat-1 +\divide\@ha by 5 % ha:=ha/5 +\@hb=\@jb\divide\@hb by 4 % hb:=jb/4 +\@hc=\@ja\divide\@hc by 4 % hc:=ja/4 +\@b=\@ha\advance\@b by \@hb +\advance\@b by \@hc % b:=ha+hb+hc +\@f=\@b\advance\@f by \@jb +\advance\@f by \@tag % f:=b+jb+tag +\multiply \@ja by 2 +\advance\@f by -\@ja % f:=f-2*ja +\@ha=\@f +\divide\@ha by 7 +\multiply\@ha by 7 +\advance\@f by -\@ha % f:= f mod 7 +\ifcase\@f Sonntag\or Montag\or Dienstag\or Mittwoch\or Donnerstag\or + Freitag\or Samstag\else ????????\fi} +} + diff --git a/macros/plain/contrib/misc/xii.tex b/macros/plain/contrib/misc/xii.tex new file mode 120000 index 0000000000..5452572ef0 --- /dev/null +++ b/macros/plain/contrib/misc/xii.tex @@ -0,0 +1 @@ +../xii/xii.tex
\ No newline at end of file |