
% TwoColMacros.tex of January 9, 1984 6:25 pm --- Stolfi

% TEX macros for double-column paper format (like STOC, FOCS, etc).

  % General comments

    %	To be used in conjunction with BasicMacros and a Font package.
    %	User also has to define a bunch of
    %	dimensional parameters (\textwidth, \itemindent, etc) required by
    %	those macros, as exemplified in TR10TwoColFormat, etc.

    % Uses counters 0 (page numbers) and 2 (for temporary computations).
    % Uses boxes 1 and 2 (for full-width insertions)
    %	and 3 (for left column).

  % Things to fix

    % invent macros for figures &c. spanning two columns

% TITLES

  % Begin new file

    \def\begfile#1{\gdef\filestamp{#1}\gdef\newfile{T}}

  % Paper title and related stuff (author, institution, abstract, keywords)

    %  Usage:
    %	\pagetitlestuff{
    %	  \title{P is equal to NP\cp (I think)}
    %	  \titlerule % A nice centered \hrule
    %	  \author{I. Newton, {\rm Department of Cyberethics}}
    %	  \author{A. Einstein, {\rm W. C. Fields Laboratory}}
    %	  \institution{Sacred Well Divination Institute,\cp
    %	       Chichen Itza, Yucatan}
    %	  \titlerule
    %	 }
    %	\columntitlestuff{
    %	  \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.}
    %	 }
    %	All items (except \title) are optional.
    %	Any of them can be used inside either
    %	  \columntitlestuff{} or \pagetitlestuff{}. The first option will
    %	  typeset those items left-justified on top of the first column.
    %	  The second option will center them on top of the first page,
    %	  spanning both columns.
    %	Note that \columntitlestuff and \pagetitlestuff must occur before
    %	  any contribution to the first page of the paper.

    \def\pagetitlestuff#1{{

      \def\title##1{\vskip7ex plus1ex
	{\titlefont\baselineskip 2.0ex\lineskip0.1ex\ctrpar\pagewidth pt{##1}}
	\vskip2ex}

      \def\titlerule{\ctrpar\pagewidth pt{
	\vbox{\vskip0.5ex\hrule width 2.5truein\vskip0.5ex}} }

      \def\author##1{\vbox{\standardsize \ctrpar\pagewidth pt{\it ##1}}}

      \def\institution##1{\vbox{\standardsize \ctrpar\pagewidth pt{\rm ##1}}}

      \def\abstract##1{
	\vskip3ex
	\ctrpar \pagewidth pt{\standardsize
	  \lftpar \pageabstrwidth pt{##1}}}

      \def\keywords##1{
	\ctrpar \pagewidth pt{\standardsize
	  \lftpar \pageabstrwidth pt{{\:t KEYWORDS:} ##1}}}

      \def\fixvsize{\setcount2 \textheight
	\convert{1ht1}{pt} \advcount2 by -\count6
	\convert{1dp1}{pt} \advcount2 by -\count6
	\convert{1ht2}{pt} \advcount2 by -\count6
	\ifdimen 1dp2 > 2pt    % crock! - should be \the\maxdepth
	  {\convert{1dp2}{pt} \advcount2 by -\count6 \advcount2 by 2} \else {}
	\vsize \count2 pt}

      \save1\vbox{\baselineskip -1pt \lineskip 1.2ex
	\vskip-7ex\unbox1 #1\vskip7ex}
      \fixvsize

     }}

    \def\columntitlestuff#1{{

      \def\title##1{\vskip2ex plus1ex minus1.5ex
	{\titlefont\baselineskip 2.0ex\lineskip0.1ex
	 \lftpar\textwidth pt{##1}}
	\vskip10pt}

      \def\titlerule{\vskip0.5ex
	\lftpar\textwidth pt{\vbox{\hrule width 2.5truein}}
	\vskip0.5ex}

      \def\author##1{\vbox{\standardsize
	\lftpar\textwidth pt{\hangindent 2em after0\it ##1}}}

      \def\institution##1{\vbox{
	\lftpar\textwidth pt{\hangindent 4em after0\rm ##1}}}

      \def\abstract##1{
	\vskip3ex
	\ctrpar \textwidth pt{\standardsize
	  \lftpar \abstrwidth pt{{\:t ABSTRACT:} ##1}}}

      \def\keywords##1{
	\ctrpar \textwidth pt{\standardsize
	  \hbox par \abstrwidth pt{{\:t KEYWORDS:} ##1}}}

      \gdef\firstsection{F} % force \vskip before first \section too

      {\baselineskip -1pt \lineskip 1.2ex #1 \vskip 3ex}

     }}

  % Support acknowledgement footnote.

    %  Usage:
    %	    \support{The author was partially supported by the kind
    %	       collaboration of a starving army of slaves, by the
    %	       plundering of half a dozen neighboring villages,
    %	       and by lavish gifts from Ramses III.}

    \def\support#1{\botinsert{\small \hbox par \textwidth pt{#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\firstsection{T} % internal - T on first call to \section

    \def\section#1{
      \if T\firstsection{\vskip 0.5ex\gdef\firstsection{F}}
      \else{\vskip 3ex plus 2ex minus 0.5ex\penalty-800}
      \hbox{{\secfont #1}}
      \penalty 1000\vskip 1ex}

    \def\subsection#1{
	\vskip 2ex plus 1.5ex minus 0.5ex\penalty-600
	\hbox{{\subsecfont #1}}
	\penalty 1000\vskip 1ex}

% MISCELLANEOUS OPTIONS AND PARAMETERS

  % (dimensions in points unless otherwise indicated)

  % References

    \def\refindent{3} % indentation of reference body (in em)
    \def\refremindent{4} % indentation of reference remarks (in em)
    \def\refvskip{2} % vskip between references (in ex)

  % Algorithms

    \def\algthickness{0.6} % thickness of block brackets
    \def\alglevelindent{15} % extra indent. per level (incl. \algthickness)
    \def\algstepindent{15} % indent. of \step text rel. to innermost bracket
    \def\algcommindent{15} % indent. of \comm text rel. to innermost bracket
    \def\algcontindent{0} % extra indentation of continuation lines
    \def\algstepnoskip{1.5} % space between step number and step text

  % Programs

    \def\progthickness{0.6} % thickness of block brackets
    \def\proglevelindent{10} % extra indent. per level (incl. \progthickness)
    \def\progstepindent{4} % indent. of \step text rel. to innermost bracket
    \def\progcommindent{4} % indent. of \comm text rel. to innermost bracket
    \def\progcontindent{6} % extra indentation of continuation lines

  % 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

  % File stamp

    \def\printfilestamp{T} % put \filestamp on 1st page

% OUTPUT ROUTINE.

  % Global flags and variables (internal)

    \def\leftc{T}   % (internal) T when outputting left column of page.
    \def\fpage{T}   % (internal) T on first page of output.
    \def\newfile{F} % T on first page of a new file.

    \setcount0 1  % page number

  % Page header and footer formats

    \def\pageheaderbox{
      \if T\fpage {}
      \else{\vbox to 0 pt{
	\vskip 0pt minus 1000pt
	\hbox to \pagewidth pt{\hfil{\:a \count0}\hfil}
	\vskip 25pt}} }

    \def\pagefooterbox{
      \gdef\putfoot{T} % internal flag
      \if T\printfilestamp {}\else{\gdef\putfoot{F}}
      \if T\newfile {}\else{\gdef\putfoot{F}}
      \if T\putfoot{\vbox{
	\vskip 20pt
	\hbox to \pagewidth pt{\hfil\hbox{\small\it \filestamp}} }}
      \else{}}

  % Page format

    \output{
      \if T\leftc
       {\save3\vbox{\page}\gdef\leftc{F}}
      \else
       {\baselineskip 0pt \lineskip 0pt
	\hbox{\hskip \leftskip pt
	  \vbox{
	    \pageheaderbox
	    \hbox to \pagewidth pt {\hss\box1\hss} % page titles
	    \hbox to \pagewidth pt
	     {\hss
	      \hbox to \textwidth pt{\box3} % left column
	      \hskip \intercolumnskip pt
	      \hbox to \textwidth pt{\vbox{\page}} % right column
	      \hss}
	    \hbox to \pagewidth pt {\hss\box2\hss} % bottom page inserts
	    \pagefooterbox}}
	\advcount0
	\if T\fpage {\vsize \textheight pt} \else {}
	\gdef\newfile{F}
	\gdef\fpage{F}
	\gdef\leftc{T}
       }
    }

% INITIALIZATION

  \standardsize
  \hsize\textwidth pt
  \vsize\textheight pt


