% PaperMacros.tex --- Stolfi May 8, 1984 10:19:41 pm PDT % TeX 82 macros for single-column paper formats % General comments % To be used in conjunction with KernelMacros and a Font package. % User also has to define a bunch of % dimensional parameters (\textwidth, \itemindent, etc) required by % those macros, as exemplified in TR10WideFormat, etc. % Things to fix % TITLES \message{titles ...} % Begin new file \def\begfile#1{\gdef\filestamp{#1}\newfiletrue} % Paper title and related stuff (author, institution, abstract, keywords) % Usage: % \begintitles % \title{P is equal to NP\cp (I think)} % \shorttitle{P=NP(?)} % optional --- title for page headers % \titlerule % A nice centered \hrule % \author{I. Newton, {\rm Department of Cyberethics}} % \author{A. Einstein, {\rm W. C. Fields Laboratory}} % \institution{Sacred Well Divination School, % Chichen Itza, Yucatan} % \titlerule % \abstract{In this paper we make some general remarks % concerning an algorithm for solving a problem related to an % important application of a well-known theoretical concept.} % \keywords{the, that, of, and, in, is.} % \endtitles \newdimen\pagewidth \def\begintitles{\begingroup \hsize=\pagewidth \leftglue=0pt \rightglue=0pt \normalsize \baselinesep -1pt \linesep 1.2ex \vskip4ex plus 0ex minus 1ex } \long\def\title#1{\vskip0pt plus1ex {\vbox{ \titlefont\baselinesep 2.5ex\linesep.2ex\centered \advance\leftglue by 0.1\hsize \advance\rightglue by 0.1\hsize #1}} \gdef\hdtitle{#1} \vskip2ex} \def\shorttitle#1{\gdef\hdtitle{#1}} \def\titlerule{\centerline{ \vbox{\vskip0.5ex\hrule width 3.0truein\vskip0.5ex}} } \long\def\author#1{\vbox{\normalsize\centered #1}} \long\def\institution#1{\vbox{\normalsize\centered\it #1}} \newdimen\abstrwidth % width of abstract and keywords \long\def\abstract#1{\vskip 1ex plus 0.5ex minus 0.5ex {\dimen0=\hsize \advance\dimen0 by -\abstrwidth \vbox{\advance\leftglue by 0.5\dimen0 \advance\rightglue by 0.5\dimen0 \normalsize\rm\parindent\z@ #1}}} \def\keywords#1{\centerline{\vbox{ \hsize=\abstrwidth\normalsize\rm\parindent\z@ \hmode{\smallsize\rm KEYWORDS:} #1}}} \def\endtitles{\vskip3ex\null\endgroup} % Support acknowledgement footnote % Usage: % \support{The author was partially supported by the kind % collaboration of his starving slaves, by the % plundering of several neighboring villages, % and by lavish gifts from Ramses III.} % \long\def\support#1{\botinsert{\smallsize\rm #1}} % Section and subsection titles % Usage: % \section{1. Acid concepts} % \subsection{1.1A. Annotation and Undefinitions} % \subsection{Appendix A: The letters of the alphabet} \def\section#1{ \bigvbreak \hbox{{\secfont #1}}\message{ #1 ...} \penalty 1000\smallvskip} \def\subsection#1{ \medvbreak \hbox{{\subsecfont #1}}\message{ #1 ...} \penalty 1000\smallvskip} % INDENTATIONS AND ITEMS \message{paragraphs ...} % Indented paragraphs. % Say \indentpar Bla bla bla... to indent a single paragraph by \textindentglue. \newglue\textindentglue \def\indentpar{\hangindent\textindentglue\ignorespaces} % Items % Usage % \begitems % \item{1.} Bla bla bla...\par % \item{2.} Bla bla..\par % \itemitem{2.1.} Ble blu bloo...\par % \itemitem{2.2.} Bli blee blaw...\par % \enditems \newglue\itemindentglue \def\begitems{\par\vskip 0.3\parsep\penalty800 \edef\resetm@rgin{\leftglue=\the\leftglue} \begingroup \parindent\z@ \parsep=1.2\parsep plus 0.1\parsep minus 0.1\parsep } \def\enditems{\par\endgroup\vskip 0.3\parsep} \def\hangit#1#2{\par\vskip 0.2\parsep \resetm@rgin\advance\leftglue by #1\itemindentglue \hmode\llap{#2\enspace}\ignorespaces} \def\item{\par\hangit{1}} \def\itemitem{\par\hangit{2}} % Narrower margins. % Say {\narrower Bla bla bla...} to indent by \textindentglue % on both sides every paragraph between the braces. \def\narrower{\advance\leftglue\textindentglue \advance\rightglue\textindentglue} % Digressions: small print text, indented. % Say \begdigress Bla bla bla...\enddigress for digression in smaller text % indented on both sides. \def\begdigress{\vskip 0.2\parsep \begingroup\narrower\smallsize\rm} \def\enddigress{\par\endgroup\vskip0.3\parsep} % Finalization \outer\def\bye{\par\vfill\supereject\end} % TOP/BOTTOM/MIDDLE/FULL-PAGE INSERTIONS % Non-floating bottom insertions \newglue\botinsertsep % extra glue between footnotes \long\def\botinsert#1{\insert\botins {\floatingpenalty=\@MM\vbreak\forbidden \vbox{#1}\vbreak\forbidden\vskip\botinsertsep}} \newinsert\botins \count\botins=1000 % footnote magnification factor (1 to 1) \dimen\botins=\maxdimen % no limits for now % Insertions at top/mid/full page (floating) \newdimen\topinsertsep % extra glue between topinserts \long\def\topinsert#1{\par {\insert\topins{\floatingpenalty=\@MM\vbreak\forbidden\vbox{#1} \vbreak\forbidden\vskip\topinsertsep}}} \long\def\pageinsert#1{\par {\insert\topins{\flo@tit \vbox to\textheight{#1\kern-\prevdepth}}}} \long\def\midinsert#1{\par{\setbox0\vbox{#1} \dimen@=\ht0 \advance\dimen@\@dp0 \advance\dimen@\abovedisplaysep \advance\dimen@\belowdisplaysep \advance\dimen@\pagetotal\advance\dimen@-\pageshrink \ifdim\dimen@>\pagegoal \insert\topins{\flo@tit\box\z@\vbreak\forbidden \vskip\belowdisplaysep} \else \unvskip \penalty\predisplaypenalty \vskip\abovedisplaysep \box\z@ \penalty\postdisplaypenalty \vskip\belowdisplaysep \fi}} \newinsert\topins \count\topins=1000 % magnification factor (1 to 1) \dimen\topins=\maxdimen % no limit per page \def\flo@tit{\penalty100\splittopsep=\z@glue \splitmaxdepth=\maxdimen\floatingpenalty=\z@} % FIGURES \message{figures ...} % figures with caption at bottom % Use \fig 5cm{\flower}{Figure 1: A Boojum} % for a figure 5 cm high containing {\flower}, followed by a % centered caption with the given text. \newif\ifomitfigures % if true, omits in-line figures (keeps captions) \newdimen\figcapwidth % width of figure captions \long\def\fig#1#{\vf@g{#1}} % figure with caption at bottom \long\def\vf@g#1#2#3{ \setbox2\hbox to \figcapwidth{ \vbox{\hsize=\figcapwidth\leftglue=0pt\rightglue=0pt #3}} \setbox0\vbox{ \hbox to \hsize{\ifomitfigures\else\hss\vbox to #1{#2}\fi\hss} \ifdim 1\ht2>0pt \vskip2ex plus0.5ex \hbox to \hsize{\hss\box2\hss} \vskip 0.5ex \fi} \midinsert{\box0}} % figures with legend on the side % Use \rfig5cm{\flower}{Figure 1: A Boojum}, % Use \lfig5cm{\flower}{Figure 1: A Boojum} % for a figure 5 cm high and \mfigwidth wide on the right/left margin, % with the given legend typeset by its side \newdimen\mfigwidth % width of marginal figures \long\def\rfig#1#{\mf@g{R}{#1}} \long\def\lfig#1#{\mf@g{L}{#1}} \long\def\mf@g#1#2#3#4{\dimen@=\hsize \advance\dimen@ by \if R#1 -\leftglue\else -\rightglue\fi \advance\dimen@ by -\mfigwidth\advance\dimen@ by -2pt \setbox2\vtop{\hsize=\dimen@\leftglue=0pt\rightglue=0pt #4} \setbox0\vtop{\hrule height0pt \ifomitfigures\else\vbox to #2{ \hsize=\mfigwidth\leftglue=0pt\rightglue=0pt #3}\fi} \setbox0\hbox to \hsize{\if R#1\hskip\leftglue \box2\hskip 0pt plus 1000pt\raise1\ht2\box0\else \raise1\ht2\box0\hskip 0pt plus 1000pt\box2\hskip\rightglue\fi} \midinsert{\box0}} % FOOTNOTES \message{footnotes ...} % Non-splitting, non-floating footnotes \newglue\footextraglue % extra glue before first footnote \newdimen\footindent % left indentation of footnotes \long\def\foot#1#2{\s@vesf$^{#1}$\@sf \botinsert{\hsize=\textwidth\f@@ttext{#1}{#2}}} % Footnotes with figures % Usage: \footfig\bullet 3cm{\buu}{Foo Bar Baz} for a footnote % with text "Foo Bar Baz" and a figure 3cm high on its right side % whose contents is \buu. \newdimen\footfigwidth % width of figures in footnotes \long\def\footfig#1#2#{\f@@tfig{#1}{#2}} % Footnote private stuff \long\def\f@@tfig#1#2#3#4{\s@vesf$^{#1}$\@sf \botinsert{\hbox to \textwidth {$\vcenter{ \hsize=\textwidth\advance\hsize by -\footfigwidth \advance\hsize by -2pt \f@@ttext{#1}{#4}}\hss \ifomitfigures\else \vcenter to #2{\hsize=\footfigwidth #3}\fi$}}} \long\def\f@@ttext#1#2{\smallsize\rm \leftglue\footindent\parindent\z@ \noindent\llap{\normalsize\rm$^{#1}$\kern 0.3em}#2} \def\s@vesf{\edef\@sf{\spacefactor\the\spacefactor}} % REFERENCES \message{references ...} % references % Usage: % \ref [Boo] \refauth{Boojum, C. D.} % \reftit{Salting jubjubs in glue.} % \refpub{J. of Beavers and Butchers V. 1 N. 357 (1999).} % \refrem{Charming; reminds me of smiles and soap.} \newglue\refvglue % extra vertical skip between references \newdimen\refindent % indentation of references \newdimen\refremindent % indentation of reference remarks \def\ref [#1]{\par\penalty-400\vskip \refvglue \noindent\hangindent=\refindent \hangafter=1 $\hbox to \refindent{[#1]\hskip0.5em plus1fil}$} \def\refauth#1{\unskip {\rm #1}} % Author (s) \def\reftit#1{\unskip, {\it #1}} % Title \def\refpub#1{\unskip\ {\rm #1}} % Publication \long\def\refrem#1{\par\vskip0.5ex {\advance\leftglue by \refremindent\advance\leftglue by \refindent {$\rpoint$ \smallsize\rm #1\par}}} % Review comments % THEOREMS, DEFINITIONS, PROOFS \message{theorems ...} % Theorems, lemmas, conjectures, and definitions. % Usage: \theorem{3.1}{P=NP.\tp Provided of course that N=1 or P=0.} \newdimen\theostatindent % indentation of theorem statements \def\lemma{\theolemma{\it}{Lemma}} \def\theorem{\theolemma{\it}{Theorem}} \def\corollary{\theolemma{\it}{Corollary}} \def\conjecture{\theolemma{\it}{Conjecture}} \def\definition{\theolemma{\rm}{Definition}} \def\problem{\theolemma{\rm}{Problem}} \long\def\theolemma#1#2#3#4{\par\medvbreak {\advance\leftglue by \theostatindent\parindent 0pt \hmode\hskip-\theostatindent{\bf #2 #3. } {#1 #4\par}} \ifdim\lastglue<\medvglue \unvskip\penalty55\medvskip\fi} % Proofs. % Usage: \proof Bla bla bla.\par More bla bla bla. \qed % (usually, but not necessarily, just after a \theorem or \lemma) \newdimen\proofindent % indentation of proofs \outer\def\proof{\medvbreak\begingroup \advance\leftglue by \proofindent \noindent\begproofmark} \outer\def\qed{\unskip\penalty1000\endproofmark\par\endgroup \vskip 1.0ex plus 1.0ex} % MISCELLANEOUS OPTIONS AND PARAMETERS \message{parameters ...} % (dimensions in points unless otherwise indicated) % Proofs \def\begproofmark{{\bf Proof: }} \def\endproofmark{\penalty1000 \hbox{\hskip0.5em\vrule width 1.0ex height1.3ex depth0.3ex}} % black slug % Figures \def\figmark{} % change to, say, \hbox{>>==>} for PressEdit and such % OUTPUT ROUTINE \message{output ...} % Page format parameters \newdimen\textwidth % width of text on page \newdimen\textheight % height of text on page \newdimen\pagewidth % width of page (incl. headers and footers) % Global flags and variables (internal) \newif\ifprintfilestamp \printfilestamptrue % if T, prints file stamp \newif\iffirstpage \firstpagetrue % T on first page of output. \newif\ifnewfile \newfilefalse % T on first page of a new file. \countdef\pageno=0 \pageno=1 % first page is number 1 % Page header and footer formats \def\makeheadline{\vbox{ \vbox to 0pt{ \vskip0pt minus1000pt \hbox to \pagewidth {\headerfont \iffirstpage \else \hdtitle\hfil\number\pageno \fi} \vskip 4 pt \hrule \vskip 3 pt \hrule} \vskip 20pt}} \newif\ifputf@@t % internal flag \def\makefootline{ \putf@@ttrue \ifprintfilestamp \else \putf@@tfalse\fi \ifnewfile \else \putf@@tfalse \fi \vbox{ \ifputf@@t \vskip 15pt \hbox to \pagewidth{\hfil \smallsize\it \filestamp} \fi} } % Page format \output{\plainoutput} \def\plainoutput{\baselinesep -1pt \linesep 0pt \shipout\vbox{\makeheadline\pagebody\makefootline} \global\advance \pageno by 1 \global\newfilefalse \global\firstpagefalse \ifnum\outputpenalty>-\@MM \else\dosupereject\fi} \def\pagebody{\vbox to\vsize{ \boxmaxdepth\maxdepth \ifvoid\topins\else\unvbox\topins\fi \unvbox\@cclv % open up \box255 \ifvoid\botins\else % footnote info is present \vskip\glue\botins \kern-3\p@ \hrule width 2truein \kern 2.6\p@ \unvbox\botins\fi} } \def\dosupereject {\ifnum\insertpenalties>\z@ % s.thing is being held over \line{}\kern-\topskip\forbidden\vfill\supereject\fi}