10

The definition of \footnote is as follows in plain TeX

% all from the Appendix B of The TeXbook
\newinsert\footins
\def\footnote#1{\let\@sf=\empty % parameter #2 (the text) is read later
  \ifhmode\edef\@sf{\spacefactor=\the\spacefactor}\/\fi
  #1\@sf\vfootnote{#1}}

\def\vfootnote#1{\insert\footins\bgroup ... \futurelet\next\fo@t}

All the inserted footnotes will be in \box\footins, but we are in a \vbox

\vbox{footnote\footnote*{you are reading a footnote}} 

the footnote text will not be at the bottom of the current page.

% now we are in vertical mode when encountering the \hbox
\hbox{insert footnote.\footnote*{this is ok.}}

this is ok

another

% after have entered the horizontal mode
the first paragraph \hbox{an hbox.\footnote*{a footnote}}

this also upset me.

Now the question is that why we can't use footnotes macro when we are in an vbox or an hbox in the horizontal mode, even boxes inside boxes? Is the reason that when we enter a box, we will enter a group at the same time?

12

It is not the grouping it is the box level. \footnote puts an insert node into the current list. When the page breaker splits up the main vertical list to make a page, it hands the part of the main vertical list to be used in box255 to the output routine and it hands all the footnote texts related to inserts in that list to the output routine in box footins. Insert nodes that are not on the main vertical list have no effect.

The end result is that insert nodes (and similarly marks) have to be directly inserted onto the main vertical list (outer par mode in latex terminology) or in outer horizontal mode in a paragraph on that list (when they are migrated from horizontal mode to the vertical list being constructed as part of the line breaking algorithm.

  • Wonderful! I have read the \output={\plainoutput}, but not aware of this. – Lucas Li Apr 1 '13 at 12:11
  • By the way, can I save a insert node in other place? – Lucas Li Apr 1 '13 at 13:07
  • 1
    @TimLi yes you can save it as part of the contents of any box register and then if you unbox the contents the node will be added to the current list so may end up in \box\footins in the output routine. – David Carlisle Apr 1 '13 at 13:37

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.