%\filename{titlemacros.tex}
%\edited{last by stolfi on Sun Aug 16 04:03:02 1987}

\catcode`@=11 \endlinechar=-1

% Title macros for standard paper format

  \message{titles ...}

  % Begin new file

    \def\filename#1{\gdef\filestamp{#1}\gdef\lasteditdate{}\newfiletrue}
    \def\edited#1{\gdef\lasteditdate{ edited #1}}
    
    % Old style, for compatibility:
    \def\begfile#1{\gdef\filestamp{#1}\gdef\lasteditdate{}\newfiletrue}
    \def\editedby#1{\gdef\lasteditdate{ last edited by #1}}
    \def\lastedited#1{\gdef\lasteditdate{ last edited #1}}

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

    %   Usage:
    %   \begintitles
    %     \title{P is equal to NP\brk (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\titlewidth   % Width of titles (to be set by client)

    \newdimen\titleheight  % Height of title box (computed)
   
    \def\begintitles{\begingroup
      \setbox4\vbox\bgroup
        \hsize=\titlewidth \leftglue=0pt \rightglue=0pt
        \normalsize \baselinesep -1pt \linesep 1.2ex
        \null
        \vskip4ex
    }

    \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\headerfont #1}}

    \long\def\institution#1{\vbox{\normalsize\centered\it #1}}

    \def\endtitles{
        \vskip3ex
        \null
      \egroup % close \vbox
      \global\titleheight=\ht4
      \global\advance\titleheight by \dp4
      \hbox to \pagewidth{\hss\box4\hss}
      \endgroup
    }

  % Abstract and keywords

    %   Usage:
    %
    %     \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.}
    %
    %   May appear either inside or outside the \begintitles...\endtitles.

    \newdimen\abstrwidth % width of abstract and keywords

    \long\def\@bstract#1#2{
      \vbox{
        \dimen0=\hsize
        \advance\dimen0 by -\abstrwidth
        \advance\leftglue by 0.5\dimen0
        \advance\rightglue by 0.5\dimen0
        \normalsize\rm\parindent\z@ 
        {#1}#2
      }
    }

    \def\abstract{\vskip 1ex\@bstract{}}
    \def\keywords{\@bstract{\headerfont Keywords: }}

  % 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.}
    %
    %  NOTE: \support must be called OUTSIDE the \begintitles ... \endtitles
    %  in order to have any effect.

    \long\def\support#1{\botinsert{\smallsize\rm #1}}

\catcode`@=12 \endlinechar=`\^^M

% END


