1 % \iffalse meta-comment
5 % The LaTeX3 Project and any individual authors listed elsewhere
8 % This file is part of the Standard LaTeX `Tools Bundle'.
9 % -------------------------------------------------------
11 % It may be distributed and/or modified under the
12 % conditions of the LaTeX Project Public License, either version 1.3c
13 % of this license or (at your option) any later version.
14 % The latest version of this license is in
15 % http://www.latex-project.org/lppl.txt
16 % and version 1.3c or later is part of all distributions of LaTeX
17 % version 2005/12/01 or later.
19 % The list of all files belonging to the LaTeX `Tools Bundle' is
20 % given in the file `manifest.txt'.
23 %\iffalse % this is a METACOMMENT !
25 %% Package `ftnright' to use with LaTeX 2e
26 %% Copyright (C) 1989-2004 Frank Mittelbach, all rights reserved.
27 %<+package>\NeedsTeXFormat{LaTeX2e}[1995/06/01]
28 %<+package>\ProvidesPackage{ftnright}
29 %<+package> [2014/10/28 v1.1f footnote layout package (FMi)]
37 %^^A \DoNotIndex{\@cclv}
38 %^^A \DoNotIndex{\@colht}
39 %^^A \DoNotIndex{\@colroom}
40 % \DoNotIndex{\@combinedblfloats}
41 % \DoNotIndex{\@combinefloats}
42 % \DoNotIndex{\@dblfloatplacement}
43 % \DoNotIndex{\@deferlist}
44 % \DoNotIndex{\@empty}
45 %^^A \DoNotIndex{\@fcolmadefalse}
46 %^^A \DoNotIndex{\@firstcolumnfalse}
47 %^^A \DoNotIndex{\@firstcolumntrue}
48 % \DoNotIndex{\@freelist}
50 %^^A \DoNotIndex{\@leftcolumn}
52 %^^A \DoNotIndex{\@makecol}
53 %^^A \DoNotIndex{\@makefntext}
54 %^^A \DoNotIndex{\@maxdepth}
55 % \DoNotIndex{\@midlist}
56 %^^A \DoNotIndex{\@outputbox}
57 %^^A \DoNotIndex{\@outputdblcol}
58 %^^A \DoNotIndex{\@outputpage}
59 % \DoNotIndex{\@ptsize}
60 %^^A \DoNotIndex{\@setsize}
61 % \DoNotIndex{\@spaces}
62 %^^A \DoNotIndex{\@startcolumn}
63 %^^A \DoNotIndex{\@startdblcolumn}
64 % \DoNotIndex{\@tempdima}
65 % \DoNotIndex{\@textbottom}
66 % \DoNotIndex{\@texttop}
67 %^^A \DoNotIndex{\@thefnmark}
68 % \DoNotIndex{\@viiipt}
69 % \DoNotIndex{\@whilesw}
70 % \DoNotIndex{\@width}
71 %^^A \DoNotIndex{\@xstartcol}
73 % \DoNotIndex{\advance}
74 % \DoNotIndex{\begingroup}
76 %^^A \DoNotIndex{\boxmaxdepth}
77 %^^A \DoNotIndex{\columnseprule}
78 %^^A \DoNotIndex{\columnwidth}
84 % \DoNotIndex{\endgroup}
86 % \DoNotIndex{\filedate}
87 % \DoNotIndex{\filename}
88 % \DoNotIndex{\fileversion}
89 %^^A \DoNotIndex{\footins}
90 %^^A \DoNotIndex{\footnoterule}
91 %^^A \DoNotIndex{\footnotesep}
92 %^^A \DoNotIndex{\footnotesize}
93 %^^A \DoNotIndex{\ftn@amount}
95 % \DoNotIndex{\global}
100 %^^A \DoNotIndex{\if@fcolmade}
101 %^^A \DoNotIndex{\if@firstcolumn}
102 % \DoNotIndex{\ifcase}
103 %^^A \DoNotIndex{\ifvoid}
105 %^^A \DoNotIndex{\insert}
110 %^^A \DoNotIndex{\maxdepth}
111 %^^A \DoNotIndex{\newdimen}
112 %^^A \DoNotIndex{\newskip}
113 % \DoNotIndex{\noindent}
114 % \DoNotIndex{\normalsize}
116 %^^A \DoNotIndex{\parindent}
117 %^^A \DoNotIndex{\preparefootins}
118 %^^A \DoNotIndex{\rcol@footinsskip}
119 %^^A \DoNotIndex{\saved@footinsskip}
120 % \DoNotIndex{\setbox}
122 % \DoNotIndex{\space}
123 %^^A \DoNotIndex{\strutbox}
124 %^^A \DoNotIndex{\textheight}
125 %^^A \DoNotIndex{\textwidth}
126 % \DoNotIndex{\unvbox}
128 % \DoNotIndex{\viiipt}
129 % \DoNotIndex{\vrule}
130 % \DoNotIndex{\vskip}
131 %^^A \DoNotIndex{\wlog}
136 % \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e}
137 % \changes{v1.1b}{1994/01/24}{Driver moved in front}
138 % \changes{v1.1c}{1996/01/01}{Use article.cls for documentation}
140 % \renewcommand{\.}{\penalty500} %^^A for certain breaks
142 % \setlength{\hfuzz}{2pt} ^^A allow small overshot in verbatim
144 % \GetFileInfo{ftnright.sty}
146 % \title{Footnotes in a multi-column layout\thanks
147 % {The \LaTeX{} package {\tt \filename} which is described
148 % in this article has the version number \fileversion{} dated
150 % \author{Frank Mittelbach}
155 % \pageshrink 1pt %^^A compensate for the \thanks marker
158 % \section{Preface to version 1.1}
160 % The new release is a basically unchanged version of the original. I
161 % upgraded the macros so that they work with \LaTeXe{} and used some
162 % of the additional flexibility introduced therein. For example, the
163 % command |\preparefootins| is now automatically called at
164 % |\begin{document}|, thus allowing the user to adjust the
165 % |\textheight| in the preamble.
167 % It is not surprisingly that I was forced to change some of the
168 % macros because they dig deep into \LaTeX{}'s output routines.
169 % Fortunately this is something normally not necessary when upgrading
170 % other \LaTeX~2.09 styles to \LaTeXe{} packages.
172 % I also upgraded the documentation to conform to the \LaTeXe{}
173 % terminology, e.g., this is a package since document classes will not
174 % know about it. However it is very likely that i have missed some
175 % necessary corrections.
177 % \section{Introduction}
180 % The placement of footnotes in a multicolumn layout always bothered
181 % me. The approach taken by \LaTeX{} (i.e., placing the footnotes
182 % separately under each column) might be all right if nearly no
183 % footnotes are present. But it looks clumsy when both columns contain
184 % footnotes, especially when they occupy different amounts of space.
186 % In the multicolumn package~\cite{art:FMi89b}, I used page-wide
187 % footnotes at the bottom of the page, but again the result doesn't
188 % look very pleasant since short footnotes produce undesired gaps of
189 % white space. Of course, the main goal of this package was a
190 % balancing algorithm for columns which would allow switching between
191 % different numbers of columns on the same page. With this feature,
192 % the natural place for footnotes seems to be the bottom of the
193 % page\footnote{You cannot use column footnotes at the bottom, since
194 % the number of columns can differ on one page.} but looking at some
195 % of the results it seems best to avoid footnotes in such a layout
199 % Another possibility is to turn footnotes into endnotes, i.e.,
200 % printing them at the end of every chapter or the end of the entire
201 % document. But I assume everyone who has ever read a book using such
202 % a layout will agree with me, that it is a pain to search back and
203 % forth, so that the reader is tempted to ignore the endnotes
206 % When I wrote the article about ``Future extensions of
207 % \TeX{}''~\cite{inproc:FMi90} I was again dissatisfied with the
208 % outcome of the footnotes, and since this article should show certain
209 % aspects of high quality typesetting, I decided to give the footnote
210 % problem a try and modified the \LaTeX{} output routine for this
211 % purpose. The layout I used was inspired by the yearbook of the
212 % Gutenberg Gesellschaft Mainz \cite{book:GG}. Later on, I found that
213 % it is also recommended by Jan White \cite{book:JWh88}. On the layout
214 % of footnotes I also consulted books by Jan Tschichold
215 % \cite{book:JTs87} and Manfred Simoneit \cite{book:MSi89}, books I
216 % would recommend to everyone being able to read German texts.
219 % \subsection{Description of the new layout}
221 % The result of this effort is presented in this paper and the reader
222 % can judge for himself whether it was successful or
223 % not.\footnote{Please note, that this option only changed the
224 % placement of footnotes. Since this article also makes use of the
225 % {\tt doc} package \cite{bk:GMS94}, that assigns tiny numbers to
226 % code lines sprinkled throughout the text, the resulting design is
227 % not perfect. This package is now a standard part of \LaTeXe.}
228 % The main idea for this layout is to assemble the
229 % footnotes of all columns on a page and place them all together at
230 % the bottom of the right column. Allowing for enough space between
231 % footnotes and text, and in addition, setting the footnotes in
232 % smaller type\footnote{The standard layout in \TUB{} uses the same
233 % size for footnotes and text, giving the footnotes, in my opinion,
234 % much too much prominence.} I decided that one could omit the
235 % footnote separator rule which is used in most publications prepared
236 % with \TeX{}.\footnote{People who prefer the rule can add it by
237 % redefining the command {\tt\bslash footnoterule}
238 % \cite[p.~156]{book:LLa86}. Please, note, that this command should
239 % occupy no space, so that a negative space should be used to
240 % compensate for the width of the rule used.} Furthermore, I decided
241 % to place the footnote markers\footnote{\label{thisftn}The tiny
242 % numbers or symbols, e.g., the `\ref{thisftn}' in front of this
243 % footnote.} at the baseline instead of raising them as
244 % superscripts.\footnote{Of course, this is done only for the mark
245 % preceding the footnote text and not the one used within the main
246 % text where a raised number or symbol set in smaller type will help
247 % to keep the flow of thoughts, uninterrupted.}
249 % All in all, I think this generates a neat layout, and surprisingly
250 % enough, the necessary changes to the \LaTeX{} output routine are
251 % nevertheless astonishingly simple.
253 % \subsection{The use of the package}
255 % This package might be used together with any other package
256 % for \LaTeX{} which does not change the three internals changed by
257 % {\tt \filename}.\footnote{These are the macros {\tt\bslash
258 % @startcolumn}, {\tt\bslash @makecol}, and {\tt\bslash @outputdblcol},
259 % as we will see below. Of course, the package will take only effect
260 % with a document class using a two-column layout (like {\tt ltugboat})
261 % or when the user additionally specifies {\tt twocolumn} as a
262 % document class option in the {\tt\bslash documentclass} command.} In
263 % most cases, it is best to use this package as the very last
264 % package in the preamble to make sure that its
265 % settings are not overwritten by other packages.
267 % It is unfortunate that the current \LaTeX{} has nearly no provisions
268 % to make such changes without overwriting the internal routines. In
269 % the \LaTeX3 implementation, we will certainly add some hooks that
270 % will make such changes more easy.
273 % \subsection{Limitations}
275 % If in the first column there is more than a full column worth of footnote
276 % material the material will be split resulting in footnotes out of
277 % order. This issue is now detected and generates an error but the package is
278 % unable to gracefully handle it. This gives you two options: either rearrange
279 % your input so that it will use less footnotes in the first column (or add
280 % some pagebreaks at suitable places) or allow explicitly for more material to
281 % be gathered. The latter can be achieved by adding
284 %\def\preparefootins{%
285 % \global\rcol@footinsskip\skip\footins
286 % \global\skip\footins\z@
287 % \global\count\footins\z@
288 % \global\dimen\footins2\textheight}
291 % to the preamble of your document. However, with this you allow two columns
292 % worth of footnote material and that means that some of your footnotes are
293 % likely to be detached from their reference and show up on a later page!
298 % \begin{thebibliography}{1}
300 % \bibitem{bk:GMS94} \textsc{M.~Goossens}, \textsc{F.~Mittelbach}
301 % and \textsc{A.~Samarin}.
302 % \newblock The \LaTeX{} Companion.
304 % Addison-Wesley, Reading, Massachusetts, 1994.
307 % Hans-Joachim Koppitz, editor.
308 % \newblock {\em {Gutenberg Jahrbuch}}.
309 % \newblock Gutenberg-Gesellschaft, Mainz.
311 % \bibitem{book:LLa86}
313 % \newblock {\em {\LaTeX:} A Document Preparation System}.
314 % \newblock Addison-Wesley, Reading, Massachusetts, 1986.
316 % \bibitem{src:ltxiii94}
318 % \newblock \LaTeXe distribution, 1994.
319 % \newblock Sources for {\LaTeXe} the successor to \LaTeX~2.09.
321 % \bibitem{art:FMi89b}
323 % \newblock An environment for multi-column output.
324 % \newblock {\em TUGboat}, 10(3):407--415, November 1989.
326 % \bibitem{inproc:FMi90}
328 % \newblock E-{\TeX}: Guidelines to future {\TeX} extensions.
329 % \newblock In Lincoln K. Durst, editor, {\em \TUB}, 11(3):
330 % {\em 1990 TUG Annual Meeting Proceedings}, pages
331 % 337--345, September 1990.
333 % \bibitem{book:MSi89}
335 % \newblock {\em Typographisches {G}estalten}.
336 % \newblock Polygraph Verlag, Frankfurt am Main, second edition, 1989.
338 % \bibitem{book:JTs87}
340 % \newblock {\em {Ausgew\"ahlte Aufs\"atze \"uber Fragen der Gestalt des
342 % \newblock Birkh\"auser Verlag, Basel, 1987.
343 % \newblock Second printing.
345 % \bibitem{book:JWh88}
347 % \newblock {\em Graphic Design for the Electronic Age}.
348 % \newblock Watson Guptill, Xerox Press, New York, 1988.
350 % \end{thebibliography}
360 % \section{The documentation driver}
362 % The first bit of code contains the documentation driver file for
363 % \TeX{}, i.e., the file that will produce the documentation you are
364 % currently reading. It will be extracted from this file by the {\tt
365 % docstrip} program. If you don't want to make any changes to the
366 % presentation you can alternatively process the \texttt{.dtx} file
367 % directly with \LaTeXe{} to obtain the documentation.
368 % \changes{v1.0d}{1992/04/19}{Added driver file to source}
369 % \changes{v1.0e}{1993/05/13}{Added history generation}
372 \documentclass[twocolumn]{article}
374 \usepackage{ftnright}
376 \AtBeginDocument{\MakeShortVerb{\|}}
378 \newcommand{\TUB}{{\sl TUGboat\/}}
379 \renewcommand\DescribeMacro[1]{\fbox
380 {\PrintDescribeMacro{#1}}}
381 \renewcommand\DescribeEnv[1]{\fbox
382 {\PrintDescribeEnv{#1}}}
383 \renewcommand\PrintMacroName[1]{}
385 \setlength{\parindent}{1em}
387 {2pt plus1pt minus1pt}
388 \setlength{\headsep}{20pt}
389 \setlength{\columnsep}{1.5pc}
390 \renewcommand{\bottomfraction}{.4}
394 \RecordChanges % produce history
397 \setcounter{IndexColumns}{2}
398 \IndexPrologue{\section{Index}
399 All numbers denote code lines where
400 the corresponding entry is used,
401 underlined entries point to the
405 \DocInput{ftnright.dtx}
410 % \section{The Implementation}
413 % As usual, we start by identifying the current version of this package
414 % file in the transcript file.\footnote{Nico Poppelier suggested
415 % omitting the {\tt\bslash typeout} statements in the production
416 % version of the files to avoid showing all that unnecessary
417 % information to the user. While I accept his criticism as valid, I
418 % decided that this information should at least be placed into the
419 % transcript file to make it easier to detect problems arising from
420 % the use of older versions. This happens now automatically as the command
421 % \texttt{\string\ProvidesPackage} will only write to the transcript file.}
422 % This actually happens at the very top of this file so it is commented out
425 %\ProvidesPackage{ftnright}[\filedate\space
426 % LaTeX2e package \fileversion]
429 % To implement the layout described, above we have to distinguish
430 % between the left and the right column on a page. For this purpose
431 % \LaTeX{} maintains the switch |\if@firstcolumn|. When assembling
432 % material for the left (i.e., the first) column, footnotes should
433 % take up no space, since they are held over for the second column. In
434 % the second column these footnotes are combined with the ones found
435 % there and placed a suitable distance from the main text at the
436 % bottom of this column.
438 % This means that we have to change certain parameters for the
439 % insertion |\footins| when we construct the second column. The right
440 % place to do this is in the \LaTeX{} macro |\@outputdblcol| which we
441 % are going to change later on. What settings for the insertion
442 % parameters are appropriate? For setting the first column
443 % |\count|\.|\footins| and |\skip|\.|\footins| should both be zero
444 % since footnotes are held over while for the second column
445 % |\count|\.|\footins| should be $1000$ and the |\skip|\.|\footins|
446 % has to be set to the desired separation between main text and
447 % footnotes.\footnote{A value of $1000$ means that there is a
448 % one-to-one relationship between the real size of the footnote and
449 % the size finally occupied by the footnote on the current page.}
452 % We will allow one column of footnotes (i.e., the right column) at
453 % most, so that |\dimen|\.|\footins| has to equal |\textheight|. In
454 % principle, it would be possible to allow for even more footnotes,
455 % but this would complicate matters enormously.\footnote{It is not
456 % possible to make {\tt\bslash dimen\bslash footins} larger than
457 % {\tt\bslash textheight} directly, because this would result in a
458 % full left column (with text) and more than one column of footnotes.
459 % Instead, one has to make footnotes visible to the page generation
460 % algorithm again at the moment when a full column of footnotes is
461 % assembled, but we still have some space left in the first column. It
462 % is a nice enhancement, and, I suppose, it is of some value for
463 % preparing publications in certain disciplines, so here is the
467 % \begin{macro}{\preparefootins}
468 % \begin{macro}{\saved@footinsskip}
469 % Since a document usually starts with a left column, we have to
470 % set |\count| and |\skip|\.|\footins| on top-level to zero. For
471 % this purpose, we define a macro |\preparefootins| which will
472 % first save the current value of |\skip|\.|\footins| in a safe
473 % place. This saved value will be used later for the second column.
474 % In this way, it is possible for the user or a designer of a
475 % document class to adjust this parameter without fiddling with the
476 % code of this package file.
479 \def\preparefootins{%
480 \global\rcol@footinsskip\skip\footins
481 \global\skip\footins\z@
482 \global\count\footins\z@
484 % We will also assign |\textheight| to |\dimen|\.|\footins| to
485 % allow the user to change this parameter in the preamble.
487 \global\dimen\footins\textheight}
489 % It is necessary to make the assignments above |\global| because
490 % we are going to use this macro in the output routine which has an
491 % implicit grouping level to keep the changes made by it local.
493 % Of course, we have to allocate the {\sf skip} register that we
496 \newskip\rcol@footinsskip
501 % \begin{macro}{\@outputdblcol}
502 % Now we have all the necessary tools available to tackle
503 % |\@outputdblcol|. We have to remember that when
504 % |\if@firstcolumn| equals |\iftrue|, we are currently starting to
505 % build the second column, i.e., that the first column is already
506 % assembled. Therefore, the macro will start with the following
509 \def\@outputdblcol{\if@firstcolumn
510 \global\@firstcolumnfalse
512 % After changing the switch, we save the first column (which was
513 % placed by preceding macros in |\@outputbox|) in the box register
514 % |\@leftcolumn|. Since we are inside the output routine, all those
515 % assignments have to be |\global| to take any effect.
517 \global\setbox\@leftcolumn\box\@outputbox
519 % Then, we make the footnotes visible to the page generation
520 % algorithm by setting |\count\footins| to $1000$ (|\@m| is an
521 % abbreviation for this number) and |\skip\footins| to its saved
522 % value (i.e., |\rcol@footinsskip|).
524 \global\count\footins\@m
525 \global\skip\footins\rcol@footinsskip
527 % We also have to reinsert all footnotes left over from the first
528 % column to make sure that they are reconsidered by the page
529 % generation algorithm of \TeX{} using the new values for |\count|
530 % and |\skip|\.|\footins|. But this will be done later in the
531 % macro |\@startcolumn|.
533 % If we have just finished the right column, i.e., when
534 % |\if@firstcolumn| equals |\iffalse|, we will reset the |\footins|
535 % parameters as explained above using the utility macro
538 \else \preparefootins
540 % Then, we compose both columns in |\@outputbox|, combine them with
541 % all page-wide floats for this page (|\@combinedblfloats|), attach
542 % header and footer, and ship out the result (|\@outputpage|).
543 % Finally we look to see whether it is possible to generate
544 % following pages consisting only of page-wide
545 % floats.\footnote{This part is copied directly from the original
546 % \LaTeX{} macro. Details about the used macros, their interfaces
547 % and meanings can be found in the \LaTeXe{} source
548 % code~\cite{src:ltxiii94}.}
550 \global\@firstcolumntrue
551 \setbox\@outputbox\vbox{\hbox to\textwidth
552 {\hbox to\columnwidth
553 {\box\@leftcolumn\hss}%
554 \hfil\vrule\@width\columnseprule\hfil
556 {\box\@outputbox\hss}}}%
557 \@combinedblfloats\@outputpage
559 \@dblfloatplacement\@startdblcolumn
560 \@whilesw\if@fcolmade\fi
561 {\@outputpage\@startdblcolumn}%
568 % \begin{macro}{\@startcolumn}
569 % \changes{v1.0b}{1990/08/11}{Macro added to correct float problems}
570 % There is a fundamental flaw in \LaTeX's output routine for float
571 % columns and float pages: split footnotes, i.e., footnotes which
572 % are only partly typeset on the preceding page are not resolved.
573 % They are held over until \LaTeX{} starts a page (or column)
574 % containing text besides floats again. For our current layout,
575 % this would mean, that if \LaTeX{} decided to make the right
576 % column of a page a float column, footnotes from the left column
577 % would appear on a later page. A real cure for this problem would
578 % be to rewrite two-thirds of \LaTeX{}'s output routine, so I am
579 % leaving this open for the interested reader.
583 % \newlength{\puzzlewd}%^^A
584 % \setlength{\puzzlewd}{\columnwidth}%^^A
585 % \addtolength{\puzzlewd}{-2.1\fboxsep}%^^A
586 % \begin{minipage}{\puzzlewd}
594 % \rightskip \leftmargini plus 2.5em
595 % Given a simple \TeX{} document containing only straight text, is
596 % it possible for the editor, after
597 % deleting one sentence, to end up with a document
598 % producing an extra page?
600 % We assume that the deleted text contains no \TeX{} macros and
601 % that the document was prepared
602 % with a standard macro package like the one used for \TUB\/ production.
606 % The answer will be given in the next issue.
612 % But the problem shows up even if only one float is contributed to
613 % the right column since \LaTeX{} assumes that the whole column is
614 % usable, whereas some of it might actually be already devoted to
615 % footnotes from the left column. So we have to change the output
616 % routine at least in the part that contributes floats to the next
617 % column. The macro involved is called |\@startcolumn|. The first
618 % thing we do is to check and see whether any deferred floats
622 \ifx\@deferlist\@empty
624 % If not, we set the switch |\if@fcolmade| to {\tt false} which
625 % says that we did not succeed in making a float column. Then, we
626 % set |\@colroom| to |\@colht|. The register |\@colht| holds the
627 % amount of space that is available for floats, text, and footnotes
628 % in one column, i.e., it equals |\textheight| minus the space
629 % devoted to page-wide floats. |\@colroom| is a similar register
630 % which holds the value |\@colht| minus space for column floats
631 % that are already contributed to the current column. Of course,
632 % both values should be equal when we start a new column.
634 \global\@fcolmadefalse
635 \global\@colroom\@colht
638 % If there are floats waiting for a change to be processed, the
639 % situation is more difficult. In this case, we have to reduce both
640 % |\@colht| and |\@colroom| by the amount of space that will be
641 % needed for the footnotes from the left column. So we must check
642 % whether such footnotes are present. As we have not reinserted
643 % them in |\@outputdblcol|, we can check the |\footins| box.
647 % If there are some, we measure the space that will be occupied by
648 % them. This measurement is not really exact. If we have a full
649 % column of footnotes, it will be too high, but this does matter
650 % since we need it only for an upper bound on the free space
651 % available for floats.
653 \ftn@amount\ht\footins
654 \advance\ftn@amount\dp\footins
655 \advance\ftn@amount\skip\footins
658 % We then reduce the |\@colht| by this amount and again assign
659 % |\@colroom| the value of |\@colht|. If no footnotes are present,
660 % we subtract zero, so there is no harm in doing this operation
663 \global\advance\@colht-\ftn@amount
664 \global\@colroom\@colht
666 % Now, we call another internal \LaTeX{} macro that will try to
667 % contribute floats to the next column. It will use the register
668 % |\@colht| when trying to build up a float column, which is the
669 % reason for reducing this register. If it succeeds, it will set the
670 % switch |\if@fcolmade| to {\tt true}, otherwise, to {\tt false}. If
671 % no float column is possible, it will try to place some or all of
672 % the deferred floats to the top or the bottom of the next column,
673 % thereby, using and reducing the value of the register |\@colroom|.
677 % Afterwards, we have to restore the correct values for |\@colht|
678 % and |\@colroom| again, but this time, they may differ, so that we
679 % have to |\advance| both registers separately by |\ftn@amount|.
681 \global\advance\@colht\ftn@amount
682 \global\advance\@colroom\ftn@amount
685 % Now, after doing the things depending on the status of the
686 % |\@deferlist|, we have to incorporate the left over footnotes in
687 % the new column. First we check whether a float column was
688 % produced by |\@xstartcol| or not.
692 % If so, we do something awful. To make use of the |\@makecol|
693 % macro, which attaches footnotes to |\box| $255$ and places the
694 % result in the box register |\@outputbox|, we have to assign
695 % |\@outputbox| (i.e., the result of |\@xstartcol|) to |\box|
696 % $255$.\footnote{In German, we call this ``from the back through
697 % the chest into the eyes''.}
699 \setbox\@cclv\box\@outputbox
703 % If no float column was produced, we reinsert the held over
704 % footnotes so that they can be reconsidered by the page generation
705 % algorithm of \TeX. But it is necessary to ensure that this
706 % operation is done only when footnotes are actually
707 % present.\footnote{Otherwise, we might get an undesired extra
708 % vertical space coming from {\tt\bslash skip\bslash footins}, even
709 % if there are no footnotes on the page.}
712 \insert\footins{\unvbox\footins}\fi
715 % \begin{macro}{\ftn@amount}
716 % Of course, we also have to allocate the {\sf dimen} register. It
717 % will be automatically initialized to zero.
725 % \begin{macro}{\@xstartcol}
726 % \changes{v1.1a}{1994/01/24}{Macro reintroduced}
727 % The macro |\@xtsartcol| was removed in \LaTeXe{} but we introduce
728 % it here again for the moment.
731 \@tryfcolumn \@deferlist
735 \let \@tempb \@deferlist
736 \global \let \@deferlist \@empty
745 % \begin{macro}{\@makecol}
746 % The other internal macro that we have to change is |\@makecol|, a
747 % macro that is called whenever one column of material is assembled
748 % and column floats and footnotes have to be added. Again, we have
749 % to distinguish between actions for the first and the second
752 \def\@makecol{\if@firstcolumn
754 % For the first column, we leave the footnotes in their box and
755 % simply save the contents of box $255$ in the |\box| register
758 \setbox\@outputbox\box\@cclv
761 % But if the user erroneously forgot to specify a twocolumn layout, we
762 % will always typeset the first column, so that the footnotes are
763 % never printed. Therefore we better check for this special case
764 % and output the footnotes on a separate page in an
765 % emergency.\footnote{Otherwise, the footnotes are held over for
766 % ever, preventing \TeX{} from finishing the document successfully.
767 % Instead, \TeX{} will produce infinity many empty pages at the end
768 % of the document, trying in vain to output the held over
769 % footnotes. This problem was found by Rainer Sch\"opf when we
770 % prepared the paper for the Cork conference.}
771 % \changes{v1.0c}{1990/08/24}{Introduced crude recovery if
773 % \changes{v1.0d}{1992/06/19}{Better help message}
776 \ifvoid\footins \else
777 \@latexerr{ftnright package
778 used in one-column mode}%
779 {The ftnright package was designed to
780 work with LaTeX's standard^^Jtwocolumn
781 option. It does *not* work with the
782 multicol package.^^JSo please specify
784 \noexpand\documentclass command.}%
785 \shipout\box\footins \fi\fi
787 % What we also need to check is if there is so much footnote material that
788 % it resulted in a footnote being split. If that happens the whole
789 % algorithm falls apart and the footnotes get out of sync. For the
790 % moment we simply detect it here, perhaps some better scheme can be
791 % implemented. One way to avoid this is to allow more than |\textheight| of
792 % footnotes in |\preparefootins|. However, that isn't such a good idea
793 % either as that means that a footnote from column one, might end up
794 % completely on a later page.
795 % \changes{v1.1f}{2010/02/25}{Check for split footnotes (pr/4099)}
797 \ifnum\insertpenalties>\z@
798 \@latexerr{ftnright package
799 scrambled footnotes}%
800 {There is too much footnote material in
801 the first column and ftnright^^Jis
802 unable to cope with this.^^JYou need
803 to reduce the amount to get a properly
808 % When we construct the second column, we must first check whether
809 % footnotes are actually present. If not, we perform the same
813 \setbox\@outputbox\box\@cclv
816 % But, if footnotes are present, it may be possible that the whole
817 % column consists of footnotes, i.e., |\box| $255$ is empty. In
818 % this case, there is no use in placing any glue (|\skip\footins|)
819 % in front,\footnote{In fact, it would be a mistake since this glue
820 % was not taken into account when the footnotes where assembled, so
821 % it would produce an overfull box.} so we have to check for this
824 \setbox\@outputbox\vbox
827 \vskip\skip\footins\fi
829 % But in any case, we place the |\footnoterule| in front of the
830 % footnotes even if this macro is not used by this
831 % package.\footnote{This decision is certainly open to criticism,
832 % since there is nothing to separate. On the other hand, a rule or
833 % some other ornament in front of the footnotes is part of the
834 % design which should be used consistently throughout a document.
835 % As a last argument in favor of the rule, consider the situation
836 % where \LaTeX{} decided to place only floats and footnotes into
837 % the right hand column. In this case a separator again seems
838 % adequate. In this situation one can even argue that it is
839 % necessary to put in the {\tt \bslash skip\.\bslash footins}.}
840 % This ends the if-statement testing whether footnotes are present
841 % or not. It also ends the code which differs depending on the
843 % \changes{v1.1d}{1998/12/02}{Added the color@group macros and
844 % \texttt{\protect\bslash normalcolor} to make this colorsafe}
848 \footnoterule\unvbox\footins
852 % Now the column floats are added at the top and the bottom, and
853 % the |\@outputbox| is adjusted to the full column height so that
854 % the glue inside will stretch in certain situations.\footnote{It
855 % is an interesting question as to whether the current layout works
856 % well with bottom floats or not. Actually, I would prefer to place
857 % the footnotes below the bottom floats instead of above, as it is
858 % done here. At least when the floats are part of the document and
859 % not puzzles thrown in. But I was too lazy to implement it
860 % because I seldom use floats. If somebody implements this layout
861 % (some parts of this macro have to be changed) I would be
862 % interested in seeing the code and some sample results.} Again,
863 % this code is copied verbatim from the original source, so I won't
864 % dwell on details.\footnote{I only changed {\tt\bslash dimen128}
865 % into {\tt\bslash @tempdima} which is, besides being faster and
866 % shorter, only a cosmetic change. The use of this hardwired {\sf
867 % dimen} register seems to indicate that this part of \LaTeX{} was
868 % written very early and left unchanged since then: an interesting
869 % fact for software archaeologists.}\footnote{For the \LaTeXe{}
870 % upgrade I had to add the support for the
871 % {\tt\string\enlargethispage} command---let's hope I did it in the
873 % \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e}
875 \xdef\@freelist{\@freelist\@midlist}%
876 \global \let \@midlist \@empty
881 \setbox\@outputbox\vbox to\@colht
882 {\boxmaxdepth\maxdepth
884 \@tempdima\dp\@outputbox
889 \global\maxdepth\@maxdepth}
894 % \begin{macro}{\footnotesize}
895 % \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e}
896 % Now we can tackle the remaining small changes to the standard
897 % layout. I decided to use a smaller size for footnotes but with a
898 % slightly larger leading than usual. This means that we have to
899 % redefine the |\footnotesize| macro which depends on options like
900 % {\tt 11pt} etc. Fortunately, there is a simple way to find out
901 % the main size of the document: the macro |\@ptsize| contains $0$,
902 % $1$, or $2$ standing for $10$, $11$, or $12$ points document text
903 % size.\footnote{In the new release I used the definitions from the
904 % class option files \texttt{size1?.clo} and modified them
905 % slightly. In the previous release there was no correction for the
906 % list parameters etc., thus giving you incorrect spacing if
907 % somebody used display lists in footnotes.}
910 \renewcommand\footnotesize{%
911 \@setfontsize\footnotesize\@viiipt{9.9}%
912 \abovedisplayskip 6\p@\@plus2\p@\@minus4\p@
913 \abovedisplayshortskip \z@ \@plus\p@
914 \belowdisplayshortskip
915 3\p@\@plus\p@\@minus2\p@
916 \def\@listi{\leftmargin\leftmargini
917 \topsep 3\p@ \@plus\p@ \@minus\p@
918 \parsep 2\p@ \@plus\p@ \@minus\p@
920 \belowdisplayskip \abovedisplayskip
923 \renewcommand\footnotesize{%
924 \@setfontsize\footnotesize\@ixpt{11.1}%
925 \abovedisplayskip 8\p@\@plus2\p@\@minus4\p@
926 \abovedisplayshortskip \z@ \@plus\p@
927 \belowdisplayshortskip
928 4\p@ \@plus2\p@ \@minus2\p@
929 \def\@listi{\leftmargin\leftmargini
930 \topsep 4\p@ \@plus2\p@\@minus2\p@
931 \parsep 2\p@ \@plus\p@ \@minus\p@
933 \belowdisplayskip \abovedisplayskip
936 \renewcommand\footnotesize{%
937 \@setfontsize\footnotesize\@xpt{12.3}%
938 \abovedisplayskip10\p@\@plus2\p@\@minus5\p@
939 \abovedisplayshortskip \z@ \@plus3\p@
940 \belowdisplayshortskip
941 6\p@ \@plus3\p@ \@minus3\p@
942 \def\@listi{\leftmargin\leftmargini
943 \topsep 6\p@ \@plus2\p@ \@minus2\p@
944 \parsep 3\p@ \@plus2\p@ \@minus\p@
946 \belowdisplayskip \abovedisplayskip
954 % \begin{macro}{\footnoterule}
955 % Setting footnotes in smaller type and separating them with
956 % sufficient space from the main text allow us to omit the
957 % |\footnoterule| normally used.
959 \let\footnoterule\@empty
965 % \begin{macro}{\footnotesep}
966 % \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e}
967 % Individual footnotes are separated from each other by a more or
968 % less baseline skip of the text size. This can be specified with
969 % the following code:
972 {\global\footnotesep\ht\strutbox}
974 % The use of the \LaTeXe{} hook |\AtBeginDocument| is a big help
975 % since it allows us to defer everything that might depend on user
976 % setting inside the preamble to the |\begin{document}| environment
982 % \begin{macro}{\@makefntext}
983 % And finally, a small but nice change, to the mark at the
984 % beginning of the footnote text. We will place it at the baseline
985 % instead of raising it as a superscript. Additionally, it will get
986 % a dot as punctuation.
987 % \changes{v1.0c}{1990/08/24}{Added dot as recommended by Tschichold.}
988 % \changes{v1.1e}{2000/04/14}{Don't use math mode for footnote symbol
991 \long\def\@makefntext#1{\parindent 1em
992 \noindent\hbox to 2em{}%
993 \llap{\@thefnmark.\,\,}#1}
998 % \section{Initialisation}
1000 % We defined the macro |\preparefootins| above, but we also have to use
1001 % it to prepare typesetting the first column. As a default for the
1002 % separation of footnotes and text on the second column, we use the
1005 \setlength{\skip\footins}
1006 {10pt plus 5pt minus 3pt}
1007 \AtBeginDocument{\preparefootins}
1010 % Of course, this value can be changed by the user as
1011 % described in the introduction.