% pdcfmt2.tex 2.4 1995/04/06 -- macros for formatting %%%@TeX-definition-file { %%% filename = "$texmf/tex/plain/pdcmac/pdcfmt2.tex", %%% version = "2.4", %%% date = "1995/04/06", %%% package = "pdcmac 1.0", %%% author = "P. Damian Cugley", %%% email = "damian.cugley@comlab.ox.ac.uk", %%% address = "Oxford University Computing Laboratory, %%% Parks Road, Oxford OX1 3QD, UK", %%% codetable = "USASCII", %%% keywords = "TeX, plain TeX, macros", %%% supported = "Maybe", %%% abstract = "Formatting macros for plain TeX documents. %%% This file was generated by running %%% plain TeX on pdcfmt2.dtx", %%% copyright = "Copyright (c) 1991-1995 P. Damian Cugley", %%% copying = "DO NOT DISTRIBUTE THIS FILE. %%% Distribute pdcfmt2.dtx only as part of the %%% package it came in.", %%% dependencies = "", %%% } \message{2.4 } \toksdef\toksa=0 \chardef\other=12 \def\declareactivechar#1{% \toksa\expandafter{\verbatimplains\do#1}% \edef\verbatimplains{\the\toksa }% \catcode`#1\active } \def\verbatimplains{\do\\\do\{\do\}\do\_\do\$\do\#\do\&\do\%} \def\verbatimactives{\do\-\do\`\do\'\do\~\do\^\do\ } \chardef\other=12 \newtoks\everyverbatim \bgroup \catcode`\-=13\catcode`\^=13 \catcode`\'=13 \catcode`\`=13 \toksa={\egroup \def\setupverbatim{% \frenchspacing \spaceskip0pt \xspaceskip0pt % use spacing of font \def\do##1{\catcode\lq##112 }\verbatimplains \def\do##1{\catcode\lq##1\active }\verbatimactives \let`\ttlq \let'\ttrq \let~\tttilde \let^\ttcircum \let-\ttminus \the\everyverbatim } }\the\toksa \def\ttlq{\lower0.125ex \hbox{\char18 }} \def\ttrq{\lower0.125ex \hbox{\char19 }} \def\tttilde{\lower0.5ex \hbox{\char`\~ }} \def\ttcircum{\lower0.5ex \hbox{\char`\^ }} \def\ttminus{-} \def\defverbatim#1{% \ifcat\noexpand#1\noexpand~\else \declareactivechar#1 \fi \begingroup \uccode`\~=`#1 \uppercase{\toksa={\endgroup \def~{% \leavevmode \begingroup \tt \setupverbatim \catcode`#1\active \let~\endgroup }% }}\the\toksa } \defverbatim\| \newtoks\everylisting \def\listfile#1{ \medskip \begingroup \parindent=0pt \parskip=0pt \def\par{\null\endgraf}\obeylines \setupverbatim \maketabstab \tt \the\everylisting \input#1 \endgroup \medskip\noindent\ignorespaces } {\catcode`\^^I=\active \gdef\maketabstab{\catcode`\^^I\active \def^^I{\hskip 4em}} } \newif\ifnoindent \newbox\parbox \newdimen\parboxsep \parboxsep=1pc \everypar={% \ifvoid\parbox \ifnoindent {\setbox0=\lastbox}\global\noindentfalse \fi \else {\setbox0=\lastbox}\global\noindentfalse \dp\parbox=0pt \hbox to 0pt{\hss \box\parbox \hskip\parboxsep}% \fi } \def\beginthe#1{% \begingroup\def\PDCFMTblockname{#1}% } \def\endthe#1{% \def\tmp{#1}% \ifx\tmp\PDCFMTblockname \endgroup \else \errmessage{You should have said \string\endthe{\blockname}}% \fi } \def\PDCFMTendenv#1{ \smallskip \endthe{#1} \global\noindenttrue } \newdimen\envindent \envindent=1pc \def\PDCFMTindent{% \ifdim\parindent>0pt \parindent \else \envindent \fi } \newtoks\everyquotation \def\quotation{ \smallskip \beginthe{quotation} \advance\leftskip\PDCFMTindent \noindenttrue \the\everyquotation } \def\endquotation{\PDCFMTendenv{quotation}} \newtoks\everytextlist \newif\ifnumbered \newcount\textlistdepth \textlistdepth=-1 \newcount\textlistcount \def\textlist{% \par \beginthe{textlist} \advance\textlistdepth 1 \textlistcount0 \def\\{ \smallskip\noindent \advance\textlistcount1 \llap{% \ifnumbered \numberfordepth\textlistdepth\textlistcount \else \bulletfordepth\textlistdepth \fi\enspace}% \ignorespaces } \advance\leftskip\PDCFMTindent \the\everytextlist } \def\endtextlist{\PDCFMTendenv{textlist}} \newtoks\everybullets \def\bullets{\textlist \numberedfalse \the\everybullets} \let\endbullets=\endtextlist \def\bulletfordepth#1{% \ifcase#1 $\bullet$\or --\or $\circ$\else $\cdot$\fi } \newtoks\everynumbered \def\numbered{\textlist \numberedtrue \the\everynumbered} \let\endnumbered=\endtextlist \def\numberfordepth#1#2{% \ifcase#1 \n{\number#2}.\or (\n{\number#2})\or ({\it\alphabetletter#2\/})\else (\romannumeral#2)\fi } \let\n\relax \def\alphabetletter#1{% \ifcase#1 ??? \or a\or b\or c\or d\or e\else \xxxalphabetletter#1\fi } \def\xxxalphabetletter#1{% \ifcase#1 \or\or\or\or\or\or f\or g\or h\or i\or j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\else !!!\fi } \newdimen\tagmaxwidth \newtoks\everytagged \def\tagged{% \par \beginthe{tagged} \let\\\TAG \ifdim\leftmargin=0pt \tagmaxwidth\PDCFMTindent \else \tagmaxwidth\leftmargin \fi \the\everytagged \ifdim\tagmaxwidth>\leftmargin \leftskip\tagmaxwidth \advance\leftskip-\leftmargin \fi } \def\endtagged{\PDCFMTendenv{tagged}} \newtoks\everytag \def\TAG{% \smallskip\noindent \setbox0=\hbox\bgroup % matched by \TAGfinish \the\everytag\ignorespaces \futurelet\next\TAGtest } \def\TAGtest{% \ifcat\bgroup\noexpand\next \let\next\TAGgotbrace \else \let\next\TAGnobrace \fi \next } \def\TAGgotbrace{% \bgroup\aftergroup\TAGfinish \let\next } \def\TAGnobrace#1{% #1\TAGfinish } \def\TAGfinish{% \unskip\hskip0.5em\egroup % matches \TAG \ifdim \wd0 < \tagmaxwidth \wd0=\tagmaxwidth \llap{\box0}% \else \hskip-\tagmaxwidth \unhbox0 \unskip\quad \fi \ignorespaces } \newtoks\everylines \def\lines{ \par \beginthe{lines} \nobreak\smallskip\hrule\nobreak\smallskip \obeylines \parindent=0pt \parskip=0pt \parfillskip=0pt plus 1fil \the\everylines \nobreak } \def\endlines{ \nobreak\smallskip \endthe{lines} \hrule\smallskip \global\noindenttrue } \newcount\linenumber \newcount\PDCFMTcount \def\startlinenumbering{% \global\linenumber=0 \global\PDCFMTcount=5 \everypar{\numberthisline}% } \def\continuelinenumbering{% \everypar{\numberthisline}% } \newtoks\everylinenum \everylinenum{\the\scriptfont0 } \def\numberthisline{% \strut \global\advance\linenumber1 \global\advance\PDCFMTcount-1 \ifnum\PDCFMTcount>0 \else \global\advance\PDCFMTcount 5 \rlap{\the\everylinenum \kern\hsize\kern1em \the\linenumber}% \fi }% \def\linesskipped#1{% \strut \hskip20pt $\vdots$ \hskip20pt {\rm(\it #1 lines omitted\rm)}\par \advance\linenumber#1\relax } \outer\def\display{\obeylines\startdisplay} \bgroup\obeylines \toksa={\egroup % \def\startdisplay#1^^M{% \catcode`\^^M=5 $$ #1 % matched by \enddisplay \displayindent\PDCFMTindent % \halign\bgroup##\hfil&&\quad##\hfil\cr % } % }\the\toksa % \def\enddisplay{\crcr\egroup$$} \def\table{% $$ % matching $$ is in \endtable \displayindent\PDCFMTindent \halign \bgroup } \let\endtable=\enddisplay \newtoks\everybnf \def\bnf{ \nobreak\smallskip \beginthe{bnf} \advance\leftskip2\parindent \parindent=-\parindent \parskip0pt plus 1pt \rightskip=1\rightskip plus 3em \def\\{$\mid$} \def\>{\unskip\enspace$::=$\enspace\ignorespaces} \def|{`\begingroup\tt\setupverbatim\catcode`\|=13 \def|{\endgroup'}} \def\{{$\lbrace$} \def\}{$\rbrace$} \the\everybnf } \def\endbnf{ \smallskip \endthe{bnf} \global\noindenttrue } \def\<#1>{\leavevmode\hbox{$\langle${\it#1\/}$\rangle$}} \newdimen\leftmargin \newskip\headingtemp \def\doheading#1#2#3#4{ \ifdim\lastskip<#1\relax \removelastskip \vskip#1\relax \fi \ifdim \leftmargin>0pt \global\setbox\parbox=\vtop{% \hsize=\leftmargin \advance\hsize-\parboxsep \parindent=0pt \leftskip=0pt \rightskip=0pt plus 3em \hyphenpenalty=10000 \exhyphenpenalty=5000 \strut#2#4#3 } \else \begingroup \parindent=0pt \parfillskip=0pt plus 1fil \leftskip=0pt \rightskip=0pt plus0.25\hsize \hyphenpenalty=10000 \exhyphenpenalty=5000 \strut#2#4#3 \global\headingtemp=\baselineskip \par \endgroup \advance\headingtemp-\baselineskip \ifdim\headingtemp>0pt \nobreak \vskip 1.0\headingtemp \fi \smallskip \noindenttrue \fi } \def\newpageheading#1#2#3#4{ \vfill\supereject % ensure no insertions still floating \null\vskip#1\relax \moveleft\leftmargin\vbox{ \advance\hsize\leftmargin \parindent=0pt \parfillskip=0pt plus 1fil \leftskip=0pt \rightskip=0pt plus0.25\hsize \hyphenpenalty=10000 \exhyphenpenalty=5000 #2\strut#4#3 \global\headingtemp=\baselineskip \par } \advance\headingtemp-\baselineskip \advance\headingtemp\smallskipamount \vskip \headingtemp \noindenttrue \def\tmp{#4} \message{*\expandafter\TOCtrim\meaning\tmp. } } \newcount\notecount \def\note{% \global\advance\notecount+1 \footnote{\number\notecount}% } \newdimen\footnoteparindent \footnoteparindent=\parindent \newtoks\everyfootnote \catcode`\@=11 \def\footnote#1{\let\@sf\empty \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi \footnotetextmark{#1}\@sf\vfootnote{#1}} \def\vfootnote#1{\insert\footins\bgroup % matched by \@foot \interlinepenalty=\interfootnotelinepenalty \parindent=\footnoteparindent \leftskip=0pt \the\everyfootnote \splittopskip=\ht\strutbox \splitmaxdepth=\dp\strutbox \floatingpenalty=20000 \indent\footstrut \ifdim\parindent>1em \llap{\footnotenotemark{#1}\enspace}% \else \footnotenotemark{#1}\enspace \fi \futurelet\next\fo@t } \def\@foot{\smallskip\egroup} \catcode`\@=12 \def\footnotetextmark#1{$^{#1}$} \def\footnotenotemark#1{$^{#1}$} \def\today{\n{\number\day} \monthname\month\ \n{\number\year}} \def\monthname#1{% \ifcase#1\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 } \def\isodate{\n{\number\year}--\twodigits\month--\twodigits\day} \def\twodigits#1{% \ifnum#1<10 0\fi \number#1% } \def\flushtop#1{% \leavevmode \begingroup \setbox0\hbox{#1}\setbox2\hbox{X}% \dimen0\ht2 \advance\dimen0-\ht0 \raise\dimen0\box0 \endgroup } \def\La{L\negthinspace\flushtop{a}} \def\LaTeX{\La\TeX} \def\superiorletter#1{% \flushtop{\the\scriptfont\fam \vphantom{x}\smash{#1}}% } \def\Mc{M\flushtop{\the\scriptfont\fam \b{c}}}