Article View: comp.text.tex
Article #2523Summary on footnotes within multicolpar
From: Zdenek Wagner
Date: Thu, 20 Aug 1992 16:01
Date: Thu, 20 Aug 1992 16:01
183 lines
6528 bytes
6528 bytes
Hi TeXers,
This is a solution to problems with footnotes in the multicolpar environment.
First I thank to P. Sojka who was the only who answered my question. He
advised me to use "ftn.sty" from Niord.shsu.edu. I downloaded it and found
that there are some bugs which had to be fixed.
The user must be aware that the footnotes are shipped out at the very end of
the environment in which they appear. So if your document is like:
\documentstyle[multicolpar,ftn]{any}
\begin{document}
\begin{multicolpar}{2}
A very long text extending over several pages. Several footnotes appear in
it.
\end{multicolpar}
\end{document}
then all footnotes will be moved to the very end of the document. Thence, if
a paragraph contains a footnote, you must end the multicolpar environment
after the end of the group of paragraphs and then start a new multicolpar.
Example 1:
==========
\begin{multicolpar}{2}
paragraph 1
paragraph 2
paragraph 3\footnote{F1}
paragraph 4\footnote{F2}
\end{multicolpar}
\begin{multicolpar}{2}
paragaph 5 etc.
Example 2:
==========
\begin{multicolpar}{3}
paragraph 1
paragraph 2
paragraph 3
paragraph 4\footnote{something}
paragraph 5
paragraph 6
\end{multicolpar}
\begin{multicolpar}{3}
paragraph 7 etc.
==========================================================
I hope these examples made it clear.
Before the \end{environment} command is detected, ftn.sty stores the
footnotes in \ftn@list. At the end of the environment \ftn@list is output.
However, the command:
\let\ftn@list=\empty
which appear in \exec@ftn is executed INSIDE the environment and thence the
change is local. The result is that once a footnote appears inside an
environment, it is printed again and again at the end of all subsequent
environments. In order to fix it, the erasure must be made global using:
\gdef\ftn@list{}
The next problem arises in case the environment contains more than one
footnote. The marks in the text are incremented correctly but all footnotes
at the bottom of the page are preceded by the highest mark. It is caused by
\footnotemark, which stores the mark glabally in \@thefnmark, and
\footnotetext, which uses \@thefnmark. The \footnotemark command is issued
when \footnote appears in the text and thence the mark in the text is
correct. On the other hand, \footnotetext is delayed till the end of the
environment - after all \footnotemark's have already been processed. Thence
all footnotes are preceded with the same (last) mark. To fix this, we define
new macros \ftnmark, \@xftnmark, and \@ftnmark (similarly as \footnotemark,
\@xfootnotemark, and \@footnotemark in latex.tex), modify macro \in@ftn and
define a new counter ftnt. Also, inside \exec@ft, \@makefnmark must locally
be let to \relax, otherwise the mark(s) will appear again after the end of
the paragraph (just in the air).
To use ftn.sty with the multicolpar environment, one must also place
\ftn{multicolpar}
into the preamble of the document. You may want to use it frequently, so you
would like to place this command to ftn.sty. If you do this, you should
remember that multicolpar must be defined BEFORE you include ftn.sty. So:
\documentstyle[ftn,multicolpar]{any}
will cause lots of error messages and the whole document will be spoiled,
while:
\documentstyle[multicolpar,ftn]{any}
will work.
Finally, I include the modified ftn.sty.
Regards
Zdenek Wagner <wagner@csearn.bitnet>
E. Hala Laboratory of Thermodynamics
Czech Academy of Sciences
Prague, Czechoslovakia
===========================================================================
%% Save file as: FTN.STY Source: FILESERV@SHSU.BITNET
%% Submitted: Thu, 2 Jan 92 08:07:45 +0100
%% Author: Kresten Krab Thorup <krab@iesd.auc.dk>
%% Use: \ftn{Text for footnote} in tabular/array/minipage-type environments
%
% I've made a little hack to allow footnotes inside tabular environments
% (i.e. footnotes in inner vertical mode). This is NOT possible per
% default, as the floats will simply dissapear...
%
% Well, here it is - I'd like to hav any comments on it.
%
% ftn.sty (krab@iesd.auc.dk 13.08.91)
%
% Makes footnotes available in any environment...
% -- it will, however, not work correctly inside floats.
% Following 3 macros defined by Z. Wagner
\def\ftnmark{\@ifnextchar[{\@xftnmark
}{\stepcounter{ftnt}\xdef\@thefnmark{\theftnt}\@ftnmark}}
\def\@xftnmark[#1]{\begingroup \c@ftnt #1\relax
\xdef\@thefnmark{\theftnt}\endgroup \@ftnmark}
\def\@ftnmark{\leavevmode\ifhmode
\edef\@x@sf{\the\spacefactor}\fi \@makefnmark
\ifhmode\spacefactor\@x@sf\fi\relax}
\def\inner@ftn{%
\@ifnextchar[{\in@xftn}{\in@ftn{ }}}
\def\in@xftn[#1]#2{%
\in@ftn{[#1]}{#2}}
\def\in@ftn#1#2{% This macro changed by Z. Wagner
\@temptokena={\footnotemark#1\footnotetext#1{#2}}%
\@temptokenb=\expandafter{\ftn@list}%
\xdef\ftn@list{\the\@temptokenb\the\@temptokena}%
\ftnmark#1\relax}
\def\exec@ftn{%
\let\@makefnmark\relax% This line added by Z. Wagner
\let\@temptokena=\ftn@list
\gdef\ftn@list{}% This line changed by Z. Wagner
\@temptokena}
\def\ftn#1{%
\expandafter\let\csname o@#1\expandafter\endcsname
\expandafter=\csname #1\endcsname
\expandafter\let\csname o@end#1\expandafter\endcsname
\expandafter=\csname end#1\endcsname
\expandafter\def\csname #1\endcsname{\bgroup
\let\footnote\inner@ftn\csname o@#1\endcsname}
\expandafter\def\csname end#1\endcsname{\csname o@end#1\endcsname
\exec@ftn\egroup}}
%
% INITIALIZING
%
\newcounter{ftnt}% New counter added by Z. Wagner
\newtoks\@temptokenb
\def\ftn@list{}
% add more to this list...
\ftn{tabular}
\ftn{array}
\ftn{minipage}
\ftn{eqnarray}
\ftn{multicolpar} % Added by Z. Wagner, may appear in the preamble
\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%% End of ftn.sty %%%%%%%%%%%%%%%%%%%%%%%%%%
Technical Details
Message-ID:
<7846814@MVB.SAIC.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!elroy.jpl.nasa.gov!ames!agate!dog.ee.lbl.gov!network.ucsd.edu!mvb.saic.com!info-texShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!elroy.jpl.nasa.gov!ames!agate!dog.ee.lbl.gov!network.ucsd.edu!mvb.saic.com!info-tex From: Zdenek Wagner <WAGNER%CSEARN.BITNET@SHSU.edu> Newsgroups: comp.text.tex Subject: Summary on footnotes within multicolpar Message-ID: <7846814@MVB.SAIC.COM> Date: Thu, 20 Aug 92 10:01:35 MDT Organization: Info-Tex<==>Comp.Text.Tex Gateway X-Gateway-Source-Info: Mailing List Lines: 183