I wish to understand how the amsart class managed to store the content of abstract for the later \maketitle, and why they demand the abstract environment to precede \maketitle (i.e. is there any advantage for this?). The definition looks like:

    \ClassWarning{\@classname}{Abstract should precede
      \protect\maketitle\space in AMS document classes; reported}%
  \global\setbox\abstractbox=\vtop \bgroup
      \leftmargin3pc \rightmargin\leftmargin
      \listparindent\normalparindent \itemindent\z@
      \parsep\z@ \@plus\p@
  \ifx\@setabstract\relax \@setabstracta \fi

I can't understand most of the code. The most attractive point for me is that: how does this code allow the presence of \verb in the abstract? (To create my own abstract environment, I tried to store the content in a macro, which fails to allow \verb in it; and at last I have no choice but to save the content in a file and input it later, which to me is undoubtedly a clumsy method)

  • They don't store it in a macro, which would have problems with \verb. Instead they store it in typeset form in a \box. – Pieter van Oostrum May 19 at 13:05

The AMS requires the abstract environment to precede \maketitle because they want it to be part of the title block. This allows processing it in ways that depend on the final in-house document class that will be used.

It uses the TeX facility of storing typeset material in a vertical box, in this case \vtop (so the reference point will be at the first baseline in the material).

The syntax is

\setbox<box number>=\vtop{...}

where { and } need not be explicit braces, but can also be \bgroup and \egroup (implicit braces). Thus it's possible to start the \vtop in the \begin part of the environment, ending it in the \end part.

If \begin{abstract} is found after \maketitle an error is raised. In any case the \vtop is started, with storage bin \abstractbox. A list is started with appropriate settings. At \end{abstract} the \endlist\egroup tokens will finish the typesetting and store the typeset material in the bin.

The assignment is \global because the surrounding environment forms a group.

The disadvantages are that the material cannot be reprocessed (well, some form of reprocessing would be possible), but this is not of a concern, because the material has already been typeset in the desired format.

Afterwards, \maketitle can do \box\abstractbox to deliver the material in the current vertical list.

  • Thank you for your detailed explanation! – Jinwen May 19 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.