summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/tools/ftnright.dtx
blob: 7f6306aa3c442476ed3fe5eb2ac9e06e1b9629e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
% \iffalse meta-comment
%
% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
% 2006 2008 2009
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file. 
% 
% This file is part of the Standard LaTeX `Tools Bundle'.
% -------------------------------------------------------
% 
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX 
% version 2005/12/01 or later.
% 
% The list of all files belonging to the LaTeX `Tools Bundle' is
% given in the file `manifest.txt'.
% 
% \fi
%\iffalse   % this is a METACOMMENT !
%
%% Package `ftnright' to use with LaTeX 2e
%% Copyright (C) 1989-2004 Frank Mittelbach, all rights reserved.
%<+package>\NeedsTeXFormat{LaTeX2e}[1995/06/01]
%<+package>\ProvidesPackage{ftnright}
%<+package>         [2004/01/16 v1.1e footnote layout package (FMi)]
%
% \fi
%%
%% \CheckSum{426}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
% 
%
%  \DoNotIndex{\;}
%^^A  \DoNotIndex{\@cclv}
%^^A  \DoNotIndex{\@colht}
%^^A  \DoNotIndex{\@colroom}
%  \DoNotIndex{\@combinedblfloats}
%  \DoNotIndex{\@combinefloats}
%  \DoNotIndex{\@dblfloatplacement}
%  \DoNotIndex{\@deferlist}
%  \DoNotIndex{\@empty}
%^^A  \DoNotIndex{\@fcolmadefalse}
%^^A  \DoNotIndex{\@firstcolumnfalse}
%^^A  \DoNotIndex{\@firstcolumntrue}
%  \DoNotIndex{\@freelist}
%  \DoNotIndex{\@ixpt}
%^^A  \DoNotIndex{\@leftcolumn}
%^^A  \DoNotIndex{\@m}
%^^A  \DoNotIndex{\@makecol}
%^^A  \DoNotIndex{\@makefntext}
%^^A  \DoNotIndex{\@maxdepth}
%  \DoNotIndex{\@midlist}
%^^A  \DoNotIndex{\@outputbox}
%^^A  \DoNotIndex{\@outputdblcol}
%^^A  \DoNotIndex{\@outputpage}
%  \DoNotIndex{\@ptsize}
%^^A  \DoNotIndex{\@setsize}
%  \DoNotIndex{\@spaces}
%^^A  \DoNotIndex{\@startcolumn}
%^^A  \DoNotIndex{\@startdblcolumn}
%  \DoNotIndex{\@tempdima}
%  \DoNotIndex{\@textbottom}
%  \DoNotIndex{\@texttop}
%^^A  \DoNotIndex{\@thefnmark}
%  \DoNotIndex{\@viiipt}
%  \DoNotIndex{\@whilesw}
%  \DoNotIndex{\@width}
%^^A  \DoNotIndex{\@xstartcol}
%  \DoNotIndex{\@xpt}
%  \DoNotIndex{\advance}
%  \DoNotIndex{\begingroup}
%  \DoNotIndex{\box}
%^^A  \DoNotIndex{\boxmaxdepth}
%^^A  \DoNotIndex{\columnseprule}
%^^A  \DoNotIndex{\columnwidth}
%  \DoNotIndex{\count}
%  \DoNotIndex{\def}
%  \DoNotIndex{\dimen}
%  \DoNotIndex{\dp}
%  \DoNotIndex{\else}
%  \DoNotIndex{\endgroup}
%  \DoNotIndex{\fi}
%  \DoNotIndex{\filedate}
%  \DoNotIndex{\filename}
%  \DoNotIndex{\fileversion}
%^^A  \DoNotIndex{\footins}
%^^A  \DoNotIndex{\footnoterule}
%^^A  \DoNotIndex{\footnotesep}
%^^A  \DoNotIndex{\footnotesize}
%^^A  \DoNotIndex{\ftn@amount}
%  \DoNotIndex{\gdef}
%  \DoNotIndex{\global}
%  \DoNotIndex{\hbox}
%  \DoNotIndex{\hfil}
%  \DoNotIndex{\hss}
%  \DoNotIndex{\ht}
%^^A  \DoNotIndex{\if@fcolmade}
%^^A  \DoNotIndex{\if@firstcolumn}
%  \DoNotIndex{\ifcase}
%^^A  \DoNotIndex{\ifvoid}
%  \DoNotIndex{\ifx}
%^^A  \DoNotIndex{\insert}
%  \DoNotIndex{\ixpt}
%  \DoNotIndex{\let}
%  \DoNotIndex{\llap}
%  \DoNotIndex{\long}
%^^A  \DoNotIndex{\maxdepth}
%^^A  \DoNotIndex{\newdimen}
%^^A  \DoNotIndex{\newskip}
%  \DoNotIndex{\noindent}
%  \DoNotIndex{\normalsize}
%  \DoNotIndex{\or}
%^^A  \DoNotIndex{\parindent}
%^^A  \DoNotIndex{\preparefootins}
%^^A  \DoNotIndex{\rcol@footinsskip}
%^^A  \DoNotIndex{\saved@footinsskip}
%  \DoNotIndex{\setbox}
%  \DoNotIndex{\skip}
%  \DoNotIndex{\space}
%^^A  \DoNotIndex{\strutbox}
%^^A  \DoNotIndex{\textheight}
%^^A  \DoNotIndex{\textwidth}
%  \DoNotIndex{\unvbox}
%  \DoNotIndex{\vbox}
%  \DoNotIndex{\viiipt}
%  \DoNotIndex{\vrule}
%  \DoNotIndex{\vskip}
%^^A  \DoNotIndex{\wlog}
%  \DoNotIndex{\xdef}
%  \DoNotIndex{\xpt}
%  \DoNotIndex{\z@}
%
% \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e}
% \changes{v1.1b}{1994/01/24}{Driver moved in front}
% \changes{v1.1c}{1996/01/01}{Use article.cls for documentation}
%
% \renewcommand{\.}{\penalty500} %^^A for certain breaks
%
% \setlength{\hfuzz}{2pt} ^^A allow small overshot in verbatim
%
% \GetFileInfo{ftnright.sty}
% 
% \title{Footnotes in a multi-column layout\thanks
%   {The \LaTeX{} package {\tt \filename} which is described
%    in this article has the version number \fileversion{} dated
%    \filedate.}}
% \author{Frank Mittelbach\\
%         Electronic Data Systems (Deutschland) GmbH\\
%          Eisenstra\ss e 58 \\
%          65428 R\"usselsheim}
%
% 
% \maketitle
% 
% \pageshrink 1pt  %^^A compensate for the \thanks marker
% 
%
% \section{Preface to version 1.1}
%
% The new release is a basically unchanged version of the original. I
% upgraded the macros so that they work with \LaTeXe{} and used some
% of the additional flexibility introduced therein. For example, the
% command |\preparefootins| is now automatically called at
% |\begin{document}|, thus allowing the user to adjust the
% |\textheight| in the preamble.
%
% It is not surprisingly that I was forced to change some of the
% macros because they dig deep into \LaTeX{}'s output routines.
% Fortunately this is something normally not necessary when upgrading
% other \LaTeX~2.09 styles to \LaTeXe{} packages.
%
% I also upgraded the documentation to conform to the \LaTeXe{}
% terminology, e.g., this is a package since document classes will not
% know about it. However it is very likely that i have missed some
% necessary corrections.
%
% \section{Introduction}
% 
% 
% The placement of footnotes in a multicolumn layout always bothered
% me. The approach taken by \LaTeX{} (i.e., placing the footnotes
% separately under each column) might be all right if nearly no
% footnotes are present. But it looks clumsy when both columns contain
% footnotes, especially when they occupy different amounts of space.
% 
% In the multicolumn package~\cite{art:FMi89b}, I used page-wide
% footnotes at the bottom of the page, but again the result doesn't
% look very pleasant since short footnotes produce undesired gaps of
% white space. Of course, the main goal of this package was a
% balancing algorithm for columns which would allow switching between
% different numbers of columns on the same page. With this feature,
% the natural place for footnotes seems to be the bottom of the
% page\footnote{You cannot use column footnotes at the bottom, since
% the number of columns can differ on one page.} but looking at some
% of the results it seems best to avoid footnotes in such a layout
% entirely.
%
% 
% Another possibility is to turn footnotes into endnotes, i.e.,
% printing them at the end of every chapter or the end of the entire
% document.  But I assume everyone who has ever read a book using such
% a layout will agree with me, that it is a pain to search back and
% forth, so that the reader is tempted to ignore the endnotes
% entirely.
% 
% When I wrote the article about ``Future extensions of
% \TeX{}''~\cite{inproc:FMi90} I was again dissatisfied with the
% outcome of the footnotes, and since this article should show certain
% aspects of high quality typesetting, I decided to give the footnote
% problem a try and modified the \LaTeX{} output routine for this
% purpose.  The layout I used was inspired by the yearbook of the
% Gutenberg Gesellschaft Mainz \cite{book:GG}.  Later on, I found that
% it is also recommended by Jan White \cite{book:JWh88}. On the layout
% of footnotes I also consulted books by Jan Tschichold
% \cite{book:JTs87} and Manfred Simoneit \cite{book:MSi89}, books I
% would recommend to everyone being able to read German texts.
% 
% 
% \subsection{Description of the new layout}
% 
% The result of this effort is presented in this paper and the reader
% can judge for himself whether it was successful or
% not.\footnote{Please note, that this option only changed the
% placement of footnotes. Since this article also makes use of the
% {\tt doc} package \cite{bk:GMS94}, that assigns tiny numbers to
% code lines sprinkled throughout the text, the resulting design is
% not perfect. This package is now a standard part of \LaTeXe.} 
% The main idea for this layout is to assemble the
% footnotes of all columns on a page and place them all together at
% the bottom of the right column. Allowing for enough space between
% footnotes and text, and in addition, setting the footnotes in
% smaller type\footnote{The standard layout in \TUB{} uses the same
% size for footnotes and text, giving the footnotes, in my opinion,
% much too much prominence.} I decided that one could omit the
% footnote separator rule which is used in most publications prepared
% with \TeX{}.\footnote{People who prefer the rule can add it by
% redefining the command {\tt\bslash footnoterule}
% \cite[p.~156]{book:LLa86}. Please, note, that this command should
% occupy no space, so that a negative space should be used to
% compensate for the width of the rule used.} Furthermore, I decided
% to place the footnote markers\footnote{\label{thisftn}The tiny
% numbers or symbols, e.g., the `\ref{thisftn}' in front of this
% footnote.} at the baseline instead of raising them as
% superscripts.\footnote{Of course, this is done only for the mark
% preceding the footnote text and not the one used within the main
% text where a raised number or symbol set in smaller type will help
% to keep the flow of thoughts, uninterrupted.}
% 
% All in all, I think this generates a neat layout, and surprisingly
% enough, the necessary changes to the \LaTeX{} output routine are
% nevertheless astonishingly simple.
% 
% \subsection{The use of the package}
% 
% This package might be used together with any other  package
% for \LaTeX{} which does not change the three internals changed by
% {\tt \filename}.\footnote{These are the macros {\tt\bslash
% @startcolumn}, {\tt\bslash @makecol}, and {\tt\bslash @outputdblcol},
% as we will see below.  Of course, the package will take only effect
% with a document class using a two-column layout (like {\tt ltugboat})
% or when the user additionally specifies {\tt twocolumn} as a
% document class option in the {\tt\bslash documentclass} command.} In
% most cases, it is best to use this  package as the very last
% package in the preamble to make sure that its
% settings are not overwritten by other packages.
%
% It is unfortunate that the current \LaTeX{} has nearly no provisions
% to make such changes without overwriting the internal routines. In
% the \LaTeX3 implementation, we will certainly add some hooks that
% will make such changes more easy.
%
% 
%
% \StopEventually{
% 
% \begin{small}
% \begin{thebibliography}{1}
% 
% \bibitem{bk:GMS94} \textsc{M.~Goossens}, \textsc{F.~Mittelbach}
%       and \textsc{A.~Samarin}.
%       \newblock The \LaTeX{} Companion.
%       \newblock
%       Addison-Wesley, Reading, Massachusetts, 1994.
%
% \bibitem{book:GG}
% Hans-Joachim Koppitz, editor.
% \newblock {\em {Gutenberg Jahrbuch}}.
% \newblock Gutenberg-Gesellschaft, Mainz.
% 
% \bibitem{book:LLa86}
% Leslie Lamport.
% \newblock {\em {\LaTeX:} A Document Preparation System}.
% \newblock Addison-Wesley, Reading, Massachusetts, 1986.
% 
% \bibitem{src:ltxiii94}
% \LaTeX3 project.
% \newblock \LaTeXe distribution, 1994.
% \newblock Souces for {\LaTeXe} the successor to \LaTeX~2.09.
% 
% \bibitem{art:FMi89b}
% Frank Mittelbach
% \newblock An environment for multi-column output.
% \newblock {\em TUGboat}, 10(3):407--415, November 1989.
% 
% \bibitem{inproc:FMi90}
% Frank Mittelbach
% \newblock E-{\TeX}: Guidelines to future {\TeX} extensions.
% \newblock In Lincoln K. Durst, editor, {\em \TUB}, 11(3):
%   {\em 1990 TUG Annual Meeting Proceedings}, pages
%   337--345, September 1990.
% 
% \bibitem{book:MSi89}
% Manfred Siemoneit.
% \newblock {\em Typographisches {G}estalten}.
% \newblock Polygraph Verlag, Frankfurt am Main, second edition, 1989.
% 
% \bibitem{book:JTs87}
% Jan Tschichold.
% \newblock {\em {Ausgew\"ahlte Aufs\"atze \"uber Fragen der Gestalt des
%   Buches}}.
% \newblock Birkh\"auser Verlag, Basel, 1987.
% \newblock Second printing.
% 
% \bibitem{book:JWh88}
% Jan White.
% \newblock {\em Graphic Design for the Electronic Age}.
% \newblock Watson Guptill, Xerox Press, New York, 1988.
% 
% \end{thebibliography}
% \end{small}
%
%      \onecolumn
%      \PrintIndex
%      \PrintChanges
%   }
% 
%
%
% \section{The documentation driver}
%
% The first bit of code contains the documentation driver file for
% \TeX{}, i.e., the file that will produce the documentation you are
% currently reading. It will be extracted from this file by the {\tt
% docstrip} program. If you don't want to make any changes to the
% presentation you can alternatively process the \texttt{.dtx} file
% directly with \LaTeXe{} to obtain the documentation.
% \changes{v1.0d}{1992/04/19}{Added driver file to source}
% \changes{v1.0e}{1993/05/13}{Added history generation}
%    \begin{macrocode}
%<*driver>
\documentclass[twocolumn]{article}

\usepackage{ftnright}
\usepackage{doc}
\AtBeginDocument{\MakeShortVerb{\|}}

\newcommand{\TUB}{{\sl TUGboat\/}}
\renewcommand\DescribeMacro[1]{\fbox
          {\PrintDescribeMacro{#1}}}
\renewcommand\DescribeEnv[1]{\fbox
          {\PrintDescribeEnv{#1}}}
\renewcommand\PrintMacroName[1]{}

\setlength{\parindent}{1em}
\setlength{\parskip}
          {2pt plus1pt minus1pt}
\setlength{\headsep}{20pt}
\setlength{\columnsep}{1.5pc} 
\renewcommand{\bottomfraction}{.4}

\flushbottom
\CodelineIndex
\RecordChanges      % produce history
\EnableCrossrefs

\setcounter{IndexColumns}{2}
\IndexPrologue{\section{Index}
 All numbers denote code lines where
 the corresponding entry is used,
 underlined entries point to the
 definition.}

\begin{document}
  \DocInput{ftnright.dtx}
\end{document}
%</driver>
%    \end{macrocode}
%
% \section{The Implementation}
% 
%
% As usual, we start by identifying the current version of this package
% file in the transcript file.\footnote{Nico Poppelier suggested
% omitting the {\tt\bslash typeout} statements in the production
% version of the files to avoid showing all that unnecessary
% information to the user. While I accept his criticism as valid, I
% decided that this information should at least be placed into the
% transcript file to make it easier to detect problems arising from
% the use of older versions. This happens now automatically as the command
% \texttt{\string\ProvidesPackage} will only write to the transcript file.}
% This actually happens at the very top of this file so it is commented out
% here.
%\begin{verbatim}
%\ProvidesPackage{ftnright}[\filedate\space 
%               LaTeX2e package \fileversion]
%\end{verbatim}
%
% To implement the layout described, above we have to distinguish
% between the left and the right column on a page. For this purpose
% \LaTeX{} maintains the switch |\if@firstcolumn|. When assembling
% material for the left (i.e., the first) column, footnotes should
% take up no space, since they are held over for the second column. In
% the second column these footnotes are combined with the ones found
% there and placed a suitable distance from the main text at the
% bottom of this column.
%
% This means that we have to change certain parameters for the
% insertion |\footins| when we construct the second column. The right
% place to do this is in the \LaTeX{} macro |\@outputdblcol| which we
% are going to change later on.  What settings for the insertion
% parameters are appropriate? For setting the first column
% |\count|\.|\footins| and |\skip|\.|\footins| should both be zero
% since footnotes are held over while for the second column
% |\count|\.|\footins| should be $1000$ and the |\skip|\.|\footins|
% has to be set to the desired separation between main text and
% footnotes.\footnote{A value of $1000$ means that there is a
% one-to-one relationship between the real size of the footnote and
% the size finally occupied by the footnote on the current page.}
%
%
% We will allow one column of footnotes (i.e., the right column) at
% most, so that |\dimen|\.|\footins| has to equal |\textheight|. In
% principle, it would be possible to allow for even more footnotes,
% but this would complicate matters enormously.\footnote{It is not
% possible to make {\tt\bslash dimen\bslash footins} larger than
% {\tt\bslash textheight} directly, because this would result in a
% full left column (with text) and more than one column of footnotes.
% Instead, one has to make footnotes visible to the page generation
% algorithm again at the moment when a full column of footnotes is
% assembled, but we still have some space left in the first column. It
% is a nice enhancement, and, I suppose, it is of some value for
% preparing publications in certain disciplines, so here is the
% challenge~\ldots}
% 
%
% \begin{macro}{\preparefootins}
% \begin{macro}{\saved@footinsskip}
%    Since a document usually starts with a left column, we have to
%    set |\count| and |\skip|\.|\footins| on top-level to zero. For
%    this purpose, we define a macro |\preparefootins| which will
%    first save the current value of |\skip|\.|\footins| in a safe
%    place. This saved value will be used later for the second column.
%    In this way, it is possible for the user or a designer of a
%    document class to adjust this parameter without fiddling with the
%    code of this package file.
%    \begin{macrocode}
%<*package>
\def\preparefootins{%
  \global\rcol@footinsskip\skip\footins
  \global\skip\footins\z@
  \global\count\footins\z@
%    \end{macrocode}
%    We will also assign |\textheight| to |\dimen|\.|\footins| to
%    allow the user to change this parameter in the preamble.
%    \begin{macrocode}
  \global\dimen\footins\textheight}
%    \end{macrocode}
%    It is necessary to make the assignments above |\global| because
%    we are going to use this macro in the output routine which has an
%    implicit grouping level to keep the changes made by it local.
%  \end{macro}
%    Of course, we have to allocate the {\sf skip} register that we
%    used above:
%    \begin{macrocode}
\newskip\rcol@footinsskip
%    \end{macrocode}
%    \end{macro}
%
%
% \begin{macro}{\@outputdblcol}
%    Now we have all the necessary tools available to tackle
%    |\@outputdblcol|.  We have to remember that when
%    |\if@firstcolumn| equals |\iftrue|, we are currently starting to
%    build the second column, i.e., that the first column is already
%    assembled. Therefore, the macro will start with the following
%    code:
%    \begin{macrocode}
\def\@outputdblcol{\if@firstcolumn 
  \global\@firstcolumnfalse
%    \end{macrocode}
%    After changing the switch, we save the first column (which was
%    placed by preceeding macros in |\@outputbox|) in the box register
%    |\@leftcolumn|. Since we are inside the output routine, all those
%    assignments have to be |\global| to take any effect.
%    \begin{macrocode}
  \global\setbox\@leftcolumn\box\@outputbox
%    \end{macrocode}
%    Then, we make the footnotes visible to the page generation
%    algorithm by setting |\count\footins| to $1000$ (|\@m| is an
%    abbreviation for this number) and |\skip\footins| to its saved
%    value (i.e., |\rcol@footinsskip|).
%    \begin{macrocode}
  \global\count\footins\@m
  \global\skip\footins\rcol@footinsskip
%    \end{macrocode}
%    We also have to reinsert all footnotes left over from the first
%    column to make sure that they are reconsidered by the page
%    generation algorithm of \TeX{} using the new values for |\count|
%    and |\skip|\.|\footins|. But this will be done later in the
%    macro |\@startcolumn|.
%
%    If we have just finished the right column, i.e., when
%    |\if@firstcolumn| equals |\iffalse|, we will reset the |\footins|
%    parameters as explained above using the utitlity macro
%    |\preparefootins|.
%    \begin{macrocode}
 \else \preparefootins
%    \end{macrocode}
%    Then, we compose both columns in |\@outputbox|, combine them with
%    all page-wide floats for this page (|\@combinedblfloats|), attach
%    header and footer, and ship out the result (|\@outputpage|).
%    Finally we look to see whether it is possible to generate
%    following pages consisting only of page-wide
%    floats.\footnote{This part is copied directly from the original
%    \LaTeX{} macro. Details about the used macros, their interfaces
%    and meanings can be found in the \LaTeXe{} source
%    code~\cite{src:ltxiii94}.}
%    \begin{macrocode}
  \global\@firstcolumntrue
  \setbox\@outputbox\vbox{\hbox to\textwidth
    {\hbox to\columnwidth
                  {\box\@leftcolumn\hss}%
     \hfil\vrule\@width\columnseprule\hfil
     \hbox to\columnwidth
                  {\box\@outputbox\hss}}}%
  \@combinedblfloats\@outputpage
  \begingroup
   \@dblfloatplacement\@startdblcolumn
   \@whilesw\if@fcolmade\fi
    {\@outputpage\@startdblcolumn}%
  \endgroup
 \fi}
%    \end{macrocode}
% \end{macro}
%
% 
% \begin{macro}{\@startcolumn}
% \changes{v1.0b}{1990/08/11}{Macro added to correct float problems}
%    There is a fundamental flaw in \LaTeX's output routine for float
%    columns and float pages: split footnotes, i.e., footnotes which
%    are only partly typeset on the preceding page are not resolved.
%    They are held over until \LaTeX{} starts a page (or column)
%    containing text besides floats again. For our current layout,
%    this would mean, that if \LaTeX{} decided to make the right
%    column of a page a float column, footnotes from the left column
%    would appear on a later page. A real cure for this problem would
%    be to rewrite two-thirds of \LaTeX{}'s output routine, so I am
%    leaving this open for the interested reader.
%
% \begin{figure}[b] 
%   \fbox{%^^A
% \newlength{\puzzlewd}%^^A 
% \setlength{\puzzlewd}{\columnwidth}%^^A 
% \addtolength{\puzzlewd}{-2.1\fboxsep}%^^A 
% \begin{minipage}{\puzzlewd}
%    \vspace{17pt}
%    \begin{center}
%      \bf Puzzle:
%    \end{center}
%    \vspace{-3pt}
%    \small
%    \begin{quote}
% \rightskip \leftmargini plus 2.5em   
% Given a simple \TeX{} document containing only straight text, is
% it possible for the editor,  after
% deleting one sentence, to end up with a document
% producing an extra page?
%
% We assume that the deleted text contains no \TeX{} macros and
% that the document was prepared
% with a standard macro package like the one used for \TUB\/ production.
%    \end{quote}   
%    \vspace{7pt}
%    \begin{flushright}
%       The answer will be given in the next issue.
%    \end{flushright}
%    \vspace{7pt}
% \end{minipage}}
% \end{figure}
%
%    But the problem shows up even if only one float is contributed to
%    the right column since \LaTeX{} assumes that the whole column is
%    usable, whereas some of it might actually be already devoted to
%    footnotes from the left column. So we have to change the output
%    routine at least in the part that contributes floats to the next
%    column. The macro involved is called |\@startcolumn|. The first
%    thing we do is to check and see whether any deferred floats
%    exists.
%    \begin{macrocode}
\def\@startcolumn{%
 \ifx\@deferlist\@empty
%    \end{macrocode}
%    If not, we set the switch |\if@fcolmade| to {\tt false} which
%    says that we did not succeed in making a float column. Then, we
%    set |\@colroom| to |\@colht|. The register |\@colht| holds the
%    amount of space that is available for floats, text, and footnotes
%    in one column, i.e., it equals |\textheight| minus the space
%    devoted to page-wide floats. |\@colroom| is a similar register
%    which holds the value |\@colht| minus space for column floats
%    that are already contributed to the current column. Of course,
%    both values should be equal when we start a new column.
%    \begin{macrocode}
   \global\@fcolmadefalse
   \global\@colroom\@colht
 \else
%    \end{macrocode}
%    If there are floats waiting for a change to be processed, the
%    situation is more difficult. In this case, we have to reduce both
%    |\@colht| and |\@colroom| by the amount of space that will be
%    needed for the footnotes from the left column. So we must check
%    whether such footnotes are present. As we have not reinserted
%    them in |\@outputdblcol|, we can check the |\footins| box.
%    \begin{macrocode}
   \ifvoid\footins\else 
%    \end{macrocode}
%    If there are some, we measure the space that will be occupied by
%    them. This measurement is not really exact. If  we have a full
%    column of footnotes, it will be too high, but this does matter
%    since we need it only for an upper bound on the free space
%    available for floats.
%    \begin{macrocode}
     \ftn@amount\ht\footins
     \advance\ftn@amount\dp\footins
     \advance\ftn@amount\skip\footins
   \fi
%    \end{macrocode}
%    We then reduce the |\@colht| by this amount and again assign
%    |\@colroom| the value of |\@colht|. If no footnotes are present,
%    we substract zero, so there is no harm in doing this operation
%    all the time.
%    \begin{macrocode}
   \global\advance\@colht-\ftn@amount
   \global\@colroom\@colht
%    \end{macrocode}
%    Now, we call another internal \LaTeX{} macro that will try to
%    contribute floats to the next column. It will use the register
%    |\@colht| when trying to build up a float column, which is the
%    reason for reducing this register. If it succeeds, it will set the
%    switch |\if@fcolmade| to {\tt true}, otherwise, to {\tt false}. If
%    no float column is possible, it will try to place some or all of
%    the deferred floats to the top or the bottom of the next column,
%    thereby, using and reducing the value of the register |\@colroom|.
%    \begin{macrocode}
   \@xstartcol
%    \end{macrocode}
%    Afterwards, we have to restore the correct values for |\@colht|
%    and |\@colroom| again, but this time, they may differ, so that we
%    have to |\advance| both registers separately by |\ftn@amount|.
%    \begin{macrocode}
   \global\advance\@colht\ftn@amount
   \global\advance\@colroom\ftn@amount
 \fi
%    \end{macrocode}
%    Now, after doing the things depending on the status of the
%    |\@deferlist|, we have to incorporate the left over footnotes in
%    the new column. First we check whether a float column was
%    produced by |\@xstartcol| or not.
%    \begin{macrocode}
 \if@fcolmade
%    \end{macrocode}
%    If so, we do something awful. To make use of the |\@makecol|
%    macro, which attaches footnotes to |\box| $255$ and places the
%    result in the box register |\@outputbox|, we have to assign
%    |\@outputbox| (i.e., the result of |\@xstartcol|) to |\box|
%    $255$.\footnote{In German, we call this ``from the back through
%    the chest into the eyes''.}
%    \begin{macrocode}
  \setbox\@cclv\box\@outputbox
  \@makecol
 \else
%    \end{macrocode}
%    If no float column was produced, we reinsert the held over
%    footnotes so that they can be reconsidered by the page generation
%    algorithm of \TeX.  But it is necessary to ensure that this
%    operation is done only when footnotes are actually
%    present.\footnote{Otherwise, we might get an undesired extra
%    vertical space coming from {\tt\bslash skip\bslash footins}, even
%    if there are no footnotes on the page.}
%    \begin{macrocode}
   \ifvoid\footins\else
     \insert\footins{\unvbox\footins}\fi
 \fi}
%    \end{macrocode}
% \begin{macro}{\ftn@amount}
%    Of course, we also have to allocate the {\sf dimen} register. It
%    will be automatically initialized to zero.
%    \begin{macrocode}
\newdimen\ftn@amount
%    \end{macrocode}
% \end{macro}
% \end{macro}


%  \begin{macro}{\@xstartcol}
% \changes{v1.1a}{1994/01/24}{Macro reintroduced}
%    The macro |\@xtsartcol| was removed in \LaTeXe{} but we introduce
%    it here again for the moment.
%    \begin{macrocode}
\def\@xstartcol{%
  \@tryfcolumn \@deferlist
  \if@fcolmade
  \else
    \begingroup
      \let \@tempb \@deferlist
      \global \let \@deferlist \@empty
      \let \@elt \@scolelt
      \@tempb
    \endgroup
  \fi
}
%    \end{macrocode}
%  \end{macro}
% 
% \begin{macro}{\@makecol}
%    The other internal macro that we have to change is |\@makecol|, a
%    macro that is called whenever one column of material is assembled
%    and column floats and footnotes have to be added. Again, we have
%    to distinguish between actions for the first and the second
%    column.
%    \begin{macrocode}
\def\@makecol{\if@firstcolumn
%    \end{macrocode}
%    For the first column, we leave the footnotes in their box and
%    simply save the contents of box $255$ in the |\box| register
%    |\@outputbox|.
%    \begin{macrocode}
  \setbox\@outputbox\box\@cclv
%    \end{macrocode}
% 
%    But if the user errously forgot to specify a twocolumn layout, we
%    will always typeset the first column, so that the footnotes are
%    never printed.  Therefore we better check for this special case
%    and output the footnotes on a separate page in an
%    emergency.\footnote{Otherwise, the footnotes are held over for
%    ever, preventing \TeX{} from finishing the document successfully.
%    Instead, \TeX{} will produce infinity many empty pages at the end
%    of the document, trying in vain to output the held over
%    footnotes.  This problem was found by Rainer Sch\"opf when we
%    prepared the paper for the Cork conference.}
% \changes{v1.0c}{1990/08/24}{Introduced crude recovery if
%                           twocolumn false.}
% \changes{v1.0d}{1992/06/19}{Better help message}
%    \begin{macrocode}
  \if@twocolumn \else
    \ifvoid\footins \else
      \@latexerr{ftnright package 
                 used in one-column mode}%
   {The ftnright package was designed to
    work with LaTeX's standard^^Jtwocolumn
    option. It does *not* work with the
    multicol package.^^JSo please specify
    `twocolumn' in the 
    \noexpand\documentclass command.}%
      \shipout\box\footins \fi\fi
 \else
%    \end{macrocode}
%    When we construct the second column, we must first check whether
%    footnotes are actually present. If not, we perform the same
%    actions as before.
%    \begin{macrocode}
  \ifvoid\footins
    \setbox\@outputbox\box\@cclv
  \else
%    \end{macrocode}
%    But, if footnotes are present, it may be possible that the whole
%    column consists of footnotes, i.e., |\box| $255$ is empty. In
%    this case, there is no use in placing any glue (|\skip\footins|)
%    in front,\footnote{In fact, it would be a mistake since this glue
%    was not taken into account when the footnotes where assembled, so
%    it would produce an overfull box.} so we have to check for this
%    possibility.
%    \begin{macrocode}
    \setbox\@outputbox\vbox
      {\ifvoid\@cclv \else 
         \unvbox\@cclv
         \vskip\skip\footins\fi
%    \end{macrocode}
%    But in any case, we place the |\footnoterule| in front of the
%    footnotes even if this macro is not used by this 
%    package.\footnote{This decision is certainly open to criticism,
%    since there is nothing to separate. On the other hand, a rule or
%    some other ornament in front of the footnotes is part of the
%    design which should be used concistently throughout a document.
%    As a last argument in favor of the rule, consider the situation
%    where \LaTeX{} decided to place only floats and footnotes into
%    the right hand column. In this case a separator again seems
%    adequate. In this situation one can even argue that it is
%    necessary to put in the {\tt \bslash skip\.\bslash footins}.}
%    This ends the if-statement testing whether footnotes are present
%    or not. It also ends the code which differs depending on the
%    column number.
% \changes{v1.1d}{1998/12/02}{Added the color@group macros and
%    \texttt{\protect\bslash normalcolor} to make this colorsafe} 
%    \begin{macrocode}
         \color@begingroup
         \normalcolor
         \footnoterule\unvbox\footins
         \color@endgroup}\fi
  \fi
%    \end{macrocode}
%    Now the column floats are added at the top and the bottom, and
%    the |\@outputbox| is adjusted to the full column height so that
%    the glue inside will stretch in certain situations.\footnote{It
%    is an interesting question as to whether the current layout works
%    well with bottom floats or not. Actually, I would prefer to place
%    the footnotes below the bottom floats instead of above, as it is
%    done here. At least when the floats are part of the document and
%    not puzzles thrown in.  But I was too lazy to implement it
%    because I seldom use floats. If somebody implements this layout
%    (some parts of this macro have to be changed) I would be
%    interested in seeing the code and some sample results.} Again,
%    this code is copied verbatim from the original source, so I won't
%    dwell on details.\footnote{I only changed {\tt\bslash dimen128}
%    into {\tt\bslash @tempdima} which is, besides being faster and
%    shorter, only a cosmetic change. The use of this hardwired {\sf
%    dimen} register seems to indicate that this part of \LaTeX{} was
%    written very early and left unchanged since then: an interesting
%    fact for software archeologists.}\footnote{For the \LaTeXe{}
%    upgrade I had to add the support for the
%    {\tt\string\enlargethispage} command---let's hope I did it in the
%    correct way.}
% \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e}
%    \begin{macrocode}
  \xdef\@freelist{\@freelist\@midlist}%
  \global \let \@midlist \@empty
  \@combinefloats
  \ifvbox\@kludgeins
    \@makespecialcolbox
  \else
   \setbox\@outputbox\vbox to\@colht
     {\boxmaxdepth\maxdepth
      \@texttop
      \@tempdima\dp\@outputbox
      \unvbox\@outputbox
      \vskip-\@tempdima
      \@textbottom}%
  \fi
  \global\maxdepth\@maxdepth}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\footnotesize}
% \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e}
%    Now we can tackle the remaining small changes to the standard
%    layout.  I decided to use a smaller size for footnotes but with a
%    slightly larger leading than usual. This means that we have to
%    redefine the |\footnotesize| macro which depends on options like
%    {\tt 11pt} etc. Fortunately, there is a simple way to find out
%    the main size of the document: the macro |\@ptsize| contains $0$,
%    $1$, or $2$ standing for $10$, $11$, or $12$ points document text
%    size.\footnote{In the new release I used the definitions from the
%    class option files \texttt{size1?.clo} and modified them
%    slightly. In the previous release there was no correction for the
%    list parameters etc., thus giving you incorrect spacing if
%    somebody used display lists in footnotes.}
%    \begin{macrocode}
\ifcase \@ptsize
\renewcommand\footnotesize{%
 \@setfontsize\footnotesize\@viiipt{9.9}%
 \abovedisplayskip 6\p@\@plus2\p@\@minus4\p@
 \abovedisplayshortskip \z@ \@plus\p@
 \belowdisplayshortskip 
                    3\p@\@plus\p@\@minus2\p@
 \def\@listi{\leftmargin\leftmargini
           \topsep 3\p@ \@plus\p@ \@minus\p@
           \parsep 2\p@ \@plus\p@ \@minus\p@
           \itemsep \parsep}%
 \belowdisplayskip \abovedisplayskip
}
\or
\renewcommand\footnotesize{%
 \@setfontsize\footnotesize\@ixpt{11.1}%
 \abovedisplayskip 8\p@\@plus2\p@\@minus4\p@
 \abovedisplayshortskip \z@ \@plus\p@
 \belowdisplayshortskip
                 4\p@ \@plus2\p@ \@minus2\p@
 \def\@listi{\leftmargin\leftmargini
          \topsep 4\p@ \@plus2\p@\@minus2\p@
          \parsep 2\p@ \@plus\p@ \@minus\p@
          \itemsep \parsep}%
 \belowdisplayskip \abovedisplayskip
}
\or
\renewcommand\footnotesize{%
 \@setfontsize\footnotesize\@xpt{12.3}%
 \abovedisplayskip10\p@\@plus2\p@\@minus5\p@
 \abovedisplayshortskip \z@ \@plus3\p@
 \belowdisplayshortskip 
                 6\p@ \@plus3\p@ \@minus3\p@
 \def\@listi{\leftmargin\leftmargini
         \topsep 6\p@ \@plus2\p@ \@minus2\p@
         \parsep 3\p@ \@plus2\p@ \@minus\p@
         \itemsep \parsep}%
 \belowdisplayskip \abovedisplayskip
}
\fi
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\footnoterule}
%    Setting footnotes in smaller type and separating them with
%    sufficiant space from the main text allow us to omit the
%    |\footnoterule| normally used.
%    \begin{macrocode}
\let\footnoterule\@empty
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\footnotesep}
% \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e}
%    Individual footnotes are separated from each other by a more or
%    less baseline skip of the text size. This can be specified with
%    the following code:
%    \begin{macrocode}
\AtBeginDocument
  {\global\footnotesep\ht\strutbox}
%    \end{macrocode}
%    The use of the \LaTeXe{} hook |\AtBeginDocument| is a big help
%    since it allows us to defer everything that might depend on user
%    setting inside the preamble to the |\begin{document}| environment
%    start.
% \end{macro}
%
%
%
% \begin{macro}{\@makefntext}
%    And finally, a small but nice change, to the mark at the
%    beginning of the footnote text. We will place it at the baseline
%    instead of raising it as a superscript. Additionally, it will get
%    a dot as punctuation.
% \changes{v1.0c}{1990/08/24}{Added dot as recommended by Tschichold.}
% \changes{v1.1e}{2000/04/14}{Don't use math mode for footnote symbol
%                             (pr/3172)}
%    \begin{macrocode}
\long\def\@makefntext#1{\parindent 1em
   \noindent\hbox to 2em{}%
   \llap{\@thefnmark.\,\,}#1}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Initialisation}
%
% We defined the macro |\preparefootins| above,  but we also have to use
% it to prepare typesetting the first column. As a default for the
% separation of footnotes and text on the second column, we use the
%    following:
%    \begin{macrocode}
\setlength{\skip\footins}
          {10pt plus 5pt minus 3pt}
\AtBeginDocument{\preparefootins}
%</package>
%    \end{macrocode}
% Of course, this value can be changed by the user as
% described in the introduction.
%
% \Finale
%
%
%

\endinput