summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ednotes/mfparptc.sty
blob: e2008f199d254e028b00082c66c96120c2988ac3 (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
%% MFParPtc.sty---Uwe L"uck http://www.contact-ednotes.sty.de.vu. 
%% Modifies Alexander Rozhenko's manyfoot.sty. 
%%
%% Copyright (C) 2003--2006 by Uwe L"uck--author-maintained. 
%% 
%% This file can be redistributed and/or modified under 
%% the terms of the LaTeX Project Public License; either 
%% version 1.3c of the License, or any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% We did our best to help you, but there is NO WARRANTY. 
%%
% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mfparptc}[2006/06/26 v0.41 %% TODO 
    ^^J\string"patch\string" for manyfoot.sty's paragraph footnotes 
       (ul)] 
% 
% The paragraphed-footnote style of Alexander Rozhenko's manyfoot.sty 
% derives, like the same style of Dominik Wujastyk's and John 
% Lavagnino's EDMAC.doc, from Donald Knuth's proposal on pp. 
% 398--400 of the TeXbook. However, the two packages improve this 
% proposal in different respects. EDMAC (i) adds to the TeXbook
% macros penalties solving a page breaking problem and (ii) accounts 
% for some problems of line breaking and hyphenation in the 
% footnotes (see EDMAC.doc, Section 
% `Footnotes'--`Paragraphed footnotes'). manyfoot.sty does not deal 
% with these things. 
% 
% The present version of the "patch" rearms the latter with EDMAC's 
% remedies (maybe at the cost of \linebreak and \\, see below). 
%% TODO 
% We aim at manyfoot.sty v1.4 from 1998/12/19. 
% 
% Alex and me could not convince ourselves entirely of these 
% "patches". They are *experimental*. When we have made up our minds, 
% they may become part of other packages.
% 
% Indeed, the present "patches" disable the \SplitNote macro 
% from manyfoot.sty. So you have to choose between \SplitNote 
% (not loading present package) and the EDMAC enhancements 
% (loading the present package). 
% 
% --If you want to use this package for working with ednotes.sty, 
% load the latter with option `edmacpara'--this loads the 
% present file at a suitable time. This is useful only unless 
% only `plain' options of `ednotes.sty' are called. 
% --If you don't work with ednotes.sty and want to use the present 
% file only for modifying manyfoot functionality, load the present 
% file after manyfoot.sty has been loaded. This is useful only if 
% some footnote layer has been declared with option `para' or 
% `para*'. 
% 
% Implementation: 
% 
%% Note: \Requirepackage[...]{manyfoot} would cause option clash. 
% 
% \MFL@fnotepara expected: 
% (Also tests whether manyfoot.sty has been loaded with option 
%  `para' or `para*'.)
\CheckCommand*\MFL@fnotepara[3]{\let\@thefnmark\@empty
  \NCC@makefnmark{#2}%
  \MFL@insert#1{\reset@font\footnotesize
    \ifx\@thefnmark\@empty \@tempswafalse \else
      \@tempswatrue
      \protected@edef\@currentlabel{\@thefnmark}%
    \fi
    \color@begingroup
      \if@tempswa
        \setbox\@tempboxa\hbox{\@makefnmark}%
        \ifMFL@paraindent
          \@tempdima.8em \advance\@tempdima-\wd\@tempboxa
          \ifdim \@tempdima<\z@ \@tempdima\z@ \fi
        \else
          \@tempdima\z@
        \fi
      \fi
      \setbox\@tempboxa\hbox{%
        \if@tempswa
          \hskip\@tempdima\unhbox\@tempboxa\nobreak
        \fi
        \ignorespaces#3\unskip\strut
        \ifMFL@split \penalty\m@ne\space \else
          \penalty-10 \hskip\footglue
        \fi
      }%
      \dp\@tempboxa\z@ \ht\@tempboxa\MFL@fudgefactor\wd\@tempboxa
      \box\@tempboxa
    \color@endgroup
  }%
}
% For splitting footnote paragraphs EDMAC inserts a (low) \penalty 
% after \box\@tempboxa at Wayne Sullivan's suggestion, see 
% EDMAC.doc after \def\para@vfootnote. 
% Another patch is needed to get \language whatsit nodes and 
% \discretionary's---cf. EDMAC.doc's description of \para@vfootnote. 
% This is due to Michael Downes, Wayne Sullivan, and Donald Knuth. 
% The insert text is first typeset in an "infinitely" wide \vbox. 
% Some problems remain as in EDMAC. No \break should occur in the 
% insert text. We locally redefine \@M and \hfil hoping to repair 
% \\ and \linebreak (even \break!) (experimental---please report!) %% TODO 
% (EDMAC.doc refers to Michael Downes, `Line breaking in \unhboxed 
% Text', TUGboat 11 (1990), pp. 605--612.) 
% TODO: Might redefine \hfill and more; cf. Michael Downes' paper. 
\def\MFL@fnotepara#1#2#3{\let\@thefnmark\@empty
  \NCC@makefnmark{#2}%
  \MFL@insert#1{\reset@font\footnotesize
    \ifx\@thefnmark\@empty \@tempswafalse \else
      \@tempswatrue
      \protected@edef\@currentlabel{\@thefnmark}%
    \fi
    \color@begingroup
      \if@tempswa
        \setbox\@tempboxa\hbox{\@makefnmark}%
        \ifMFL@paraindent
          \@tempdima.8em \advance\@tempdima-\wd\@tempboxa
          \ifdim \@tempdima<\z@ \@tempdima\z@ \fi
        \else
          \@tempdima\z@
        \fi
      \fi
      \setbox\@tempboxa\vbox{%      <- PATCH! 
        \@parboxrestore           % <- PATCH 
        \hsize\maxdimen \noindent % <- PATCH! 
%       \setbox\@tempboxa\hbox{%
        \if@tempswa
          \hskip\@tempdima\unhbox\@tempboxa\nobreak
        \fi
        \mathchardef\@M9999 %       <- PATCH! 
        \def\hfil{\hskip\linewidth\@minus\linewidth}% <- PATCH!
        \ignorespaces#3\unskip\strut
%         \ifMFL@split \penalty\m@ne\space \else % PATCH: removed. 
%           \penalty-10 \hskip\footglue % PATCH: reinserted below. 
%         \fi
      }%
      \setbox\@tempboxa\hbox{% <- PATCH! 
% Here is a suitable variant of EDMAC.doc's \unvxh, due to Michael 
% Downes: 
        \setbox\z@\vbox{% 
            \unvbox\@tempboxa \global\setbox\@ne\lastbox}% 
        \unhbox\@ne \unskip \unskip \unpenalty 
        \ifMFL@split % Moved here from above. 
          \penalty\m@ne\space 
        \else 
          \penalty-10 \hskip\footglue 
        \fi
      }% 
      \dp\@tempboxa\z@ \ht\@tempboxa\MFL@fudgefactor\wd\@tempboxa
      \box\@tempboxa
      \penalty\z@ % <- PATCH! 
    \color@endgroup
  }%
} 
% Like in EDMAC.doc, the additional penalty is removed by 
% \MFL@makehhbox which corresponds to \makehboxofhboxes. 
% \MFL@makehhbox differs from \makehboxofhboxes, however, in even 
% \unvbox'ing a note bundle from a minipage. It seems not to be easy 
% to tell a \penalty 0 placed by patched \MFL@fnotepara from another. 
% In this version we just hope that removing such other penalties 
% causes no damage---after all, the bundle was not supposed to be 
% splitted. 
\def\MFL@makehhbox{%
  \loop
    \unpenalty % <- PATCH! 
    \setbox\z@\lastbox 
  \ifhbox\z@
    \setbox\@tempboxa\hbox{\box\z@\unhbox\@tempboxa}%
  \repeat
  \ifvbox\z@ \unvbox\z@ \MFL@makehhbox \fi
}
\endinput 

VERSION HISTORY: 

v0.1  2003/01/19  First. Sent to John Lavagnino + ... 
v0.2  2003/01/23  Corrected \Provides... file name; 
                  supplied \vbox in \unvxh (bug fix!). 
v0.21 2003/02/27  Stressed problem with \linebreak and \\ in doc. 
v0.23 2003/02/28  Further comment on \CheckCommand, 
                  improved explanation mentioning \para@vfootnote. 
v0.3  2003/03/01  Changed \@M and \hfil to enable \\ and \linebreak 
                  in para-style. 
v0.31 2003/03/24  Reminded above that v0.2 was a real bug fix; 
                  added ednotes.sty@web.de. 
v0.32 2003/03/26  Added TODO on Alex' provision. [!?? 2004/04/25]
v0.33 2003/03/28  Added `experimental'; `missing' -> `bad' (hyph.)
      2004/01/29  Corrected, in the explanation for users, allusion 
                  to problems to be solved (line breaking, not only 
                  hyphenation) and added mention of \SplitNote 
                  problem. 
v0.34 2004/04/25  Added copyright etc.; added missing `%' before 
                  `manyfoot.sty does not deal [...]'. Made 
                  `(loading ...)' more clear. 
                  `patch...' -> `"patch..."'. 
v0.35 2004/05/10  Note on \RequirePackage[...]{manyfoot}; enlarged 
                  on loading (Ednotes.sty); manyfoot -> Manyfoot. 
      2004/05/20  Enhanced comment on \CheckCommand. 
      2004/07/26  \string" with \Provides..., ^^J. 
v0.36 2004/08/21  Added \@parboxrestore--as a bug fix for `center' 
                  environment. 
      2004/08/23  LPPL v1.3. 
      2004/08/31  Rearranged preamble concerning maintenance. 
v0.4  2004/10/07  Ednotes -> ednotes etc.; instructions: 
                  ednotes option `edmacpara'. 
v0.4a 2004/11/07  LPPL v1.3a. 
v0.4b 2005/01/10  Contact via http. 
v0.41 2006/06/26  \MFL@makemark -> \MFL@makefnmark for nccfoots v1.2; 
                  LPPL v1.3c.