Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Plain TeX \vfootnote definition parameters question

21 views
Skip to first unread message

peter_pa

unread,
Dec 14, 2009, 4:53:49 PM12/14/09
to
Excerpt from plain.tex:
\def\vfootnote#1{\insert\footins\bgroup
\interlinepenalty\interfootnotelinepenalty
\splittopskip\ht\strutbox % top baseline for broken footnotes
\splitmaxdepth\dp\strutbox \floatingpenalty\@MM
\leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip
\z@skip
\textindent{#1}\footstrut\futurelet\next\fo@t}
\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
\else\let\next\f@t\fi \next}
\def\f@@t{\bgroup\aftergroup\@foot\let\next}
\def\f@t#1{#1\@foot}
\def\@foot{\strut\egroup}
\def\footstrut{\vbox to\splittopskip{}}

Can someone explain what are all these complexities with input text
reading for? I mean macros \fo@t and \f@@t.

Regards, Peter.

Enrico Gregorio

unread,
Dec 14, 2009, 6:55:48 PM12/14/09
to
peter_pa <peter....@gmail.com> wrote:

The complexity has the benefit that the footnote text is not
read as an argument, so changes in category codes are possible
(for verbatim text, in particular).

\insert\footins is somewhat similar to \vbox, which can be used as

\vbox\bgroup ... \egroup

After \bgroup there are several assignment for the typesetting of
the footnote, they are not relevant for the discussion. Consider
instead the last line in the definition of \vfootnote:

"\textindent{#1}\footstrut" puts the argument to \vfootnote (the
footnote number) in the indentation and sets a strut in order to
give uniform vertical space to the footnotes.

"\futurelet\next\fo@t" peeks at the token following the argument
to \vfootnote; \next becomes equivalent to it and \fo@t is
expanded.

If \next is an open brace, the call was of like "\vfootnote{4}{text}";
in this case \next becomes equivalent to \f@@t; otherwise \next
becomes equivalent to \f@t: somebody might type \vfootnote4x, you
never know what users are capable of. :-)

In the first case the token list is, omitting the assignments,

\insert\footins\bgroup\textindent{4}\footstrut\f@@t{text}

and we are at the expansion of \f@@t (\textindent and \footstrut have
been already expanded, but what results from this expansion are
typesetting commands and I keep the unexpanded form for the sake of
brevity), so we get

\insert\footins\bgroup\textindent{#1}\footstrut
\bgroup\aftergroup\@foot\let\next{text}

Here \let\next gobbles the left brace and \@foot is put aside to
be inserted again after the current group ends. The group ends at
the right brace after the footnote text, so we get

\insert\footins\bgroup\textindent{#1}\footstrut
\bgroup text}\@foot

which becomes

\insert\footins\bgroup\textindent{#1}\footstrut
\bgroup text}\strut\egroup

The \egroup causes the end of \insert\footins: everything is
packed up as if it were a \vbox (almost) and added to the insertion
register \footins.

In the second case we have the equivalent of

\insert\footins\bgroup\textindent{4}\footstrut\f@t x

Here x becomes the argument of \f@t and the list becomes

\insert\footins\bgroup\textindent{4}\footstrut x\strut\egroup

ending the game as before.

Observe that commands in "text" such as "\obeyspaces" or
"\catcode`@=11" would be honored because the tokens in "text"
are never read as an argument.

I guess that Knuth decided to use \f@@t and \f@t to cope with
syntax error such as \vfootnote 12{text}; the assumption that
a left brace follows the argument to \vfootnote would result
in unbalanced braces and, probably, weird errors somewhere later.
In this way the typing error will be catched as soon as the
result is previewed.

Of course the common call is of \footnote, but this macro ends
with \vfootnote{#1} where #1 is the argument to \footnote (again,
only the footnote number).

Ciao
Enrico

peter_pa

unread,
Dec 15, 2009, 6:32:07 AM12/15/09
to
On Dec 15, 2:55 am, Enrico Gregorio <grego...@math.unipd.it> wrote:

Thanks a lot, that's really helpful!
Peter.

0 new messages