| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
%% File: latex-lab-footnotes.dtx |
| 4 |
% Copyright (C) 2022-2025 The LaTeX Project |
| 5 |
% |
| 6 |
% It may be distributed and/or modified under the conditions of the |
| 7 |
% LaTeX Project Public License (LPPL), either version 1.3c of this |
| 8 |
% license or (at your option) any later version. The latest version |
| 9 |
% of this license is in the file |
| 10 |
% |
| 11 |
% https://www.latex-project.org/lppl.txt |
| 12 |
% |
| 13 |
% |
| 14 |
% The development version of the bundle can be found below |
| 15 |
% |
| 16 |
% https://github.com/latex3/latex2e/required/latex-lab |
| 17 |
% |
| 18 |
% for those people who are interested or want to report an issue. |
| 19 |
% |
| 20 |
\def\ltlabfootnotedate{2025-07-04} |
| 21 |
\def\ltlabfootnoteversion{0.8o} |
| 22 |
|
| 23 |
%<*driver> |
| 24 |
\DocumentMetadata{tagging=on,pdfstandard=ua-2} |
| 25 |
\documentclass{l3doc} |
| 26 |
\usepackage{latex-lab-testphase-l3doc} |
| 27 |
\EnableCrossrefs |
| 28 |
\CodelineIndex |
| 29 |
\begin{document} |
| 30 |
\DocInput{latex-lab-footnotes.dtx} |
| 31 |
\end{document} |
| 32 |
%</driver> |
| 33 |
% |
| 34 |
% \fi |
| 35 |
% |
| 36 |
% |
| 37 |
% \title{The \texttt{latex-lab-footnotes} code\thanks{}} |
| 38 |
% \author{Frank Mittelbach, \LaTeX{} Project} |
| 39 |
% |
| 40 |
% \maketitle |
| 41 |
% |
| 42 |
% \newcommand\fmi[1]{\begin{quote} TODO: \itshape #1\end{quote}} |
| 43 |
% \newcommand\NEW[1]{\marginpar{\mbox{}\hfill\fbox{New: #1}}} |
| 44 |
% \providecommand\class[1]{\texttt{#1.cls}} |
| 45 |
% \providecommand\pkg[1]{\texttt{#1}} |
| 46 |
% |
| 47 |
% \providecommand\hook[1]{\texttt{#1\DescribeHook[noprint]{#1}}} |
| 48 |
% \providecommand\socket[1]{\texttt{#1\DescribeSocket[noprint]{#1}}} |
| 49 |
% \providecommand\plug[1]{\texttt{#1\DescribePlug[noprint]{#1}}} |
| 50 |
% |
| 51 |
% \NewDocElement[printtype=\textit{socket},idxtype=socket,idxgroup=Sockets]{Socket}{socketdecl} |
| 52 |
% \NewDocElement[printtype=\textit{hook},idxtype=hook,idxgroup=Hooks]{Hook}{hookdecl} |
| 53 |
% \NewDocElement[printtype=\textit{plug},idxtype=plug,idxgroup=Plugs]{Plug}{plugdecl} |
| 54 |
% |
| 55 |
% \begin{abstract} |
| 56 |
% \emph{to be written} |
| 57 |
% \end{abstract} |
| 58 |
% |
| 59 |
% \tableofcontents |
| 60 |
% |
| 61 |
% |
| 62 |
% \section{Introduction} |
| 63 |
% |
| 64 |
% This code reimplements the footnote interfaces for \LaTeX{} |
| 65 |
% offering configurable methods for layout and functionality |
| 66 |
% adjustments that avoid overwriting each other when used in |
| 67 |
% classes as well as in packages (as far as possible --- obviously |
| 68 |
% some adjustments are mutually exclusive). This is achieved by |
| 69 |
% providing a larger number of hooks (for areas where different |
| 70 |
% packages/classes can easily coexist with their adjustments) and a |
| 71 |
% number of sockets to which only one class or package |
| 72 |
% can write to successfully (in case of multiple changes the |
| 73 |
% last one wins). The latter are for special functionality, e.g., |
| 74 |
% if footnote text is typeset as a single paragraph, it can't be configured |
| 75 |
% the same time to be typeset vertically with one footnote below |
| 76 |
% each other. |
| 77 |
% |
| 78 |
% The interfaces are set up to support tagged PDF, but in order |
| 79 |
% for this to work, all packages altering the footnote setup should |
| 80 |
% use the interfaces provided here and not do it through the |
| 81 |
% legacy methods (though there is some support for the latter as |
| 82 |
% well, but it will not work in all cases). |
| 83 |
% |
| 84 |
% \subsection{Configuration methods} |
| 85 |
% |
| 86 |
% Historically, the footnote setup in \LaTeX{} was done by |
| 87 |
% providing definitions for \cs{@makefnmark} (format the footnote |
| 88 |
% mark in running text and in front of the footnote text) and |
| 89 |
% \cs{@makefntext} (formatting the footnote text and placing a mark |
| 90 |
% in front of it). |
| 91 |
% |
| 92 |
% There was a default definition for \cs{@makefnmark} in the format |
| 93 |
% that was used by most document classes, |
| 94 |
% but \cs{@makefntext} had to be defined in the class itself because |
| 95 |
% the format didn't provide a default. As a result you will find |
| 96 |
% definitions for the latter in all document classes and definitions |
| 97 |
% for \cs{@makefnmark} only in very few. |
| 98 |
% |
| 99 |
% Furthermore, to enable special footnote layouts or provide |
| 100 |
% additional functionality a few packages (and a few classes) |
| 101 |
% overwrote other internal commands of \LaTeX's footnote |
| 102 |
% mechanism. The commands affected in this way are mainly |
| 103 |
% \cs{@footnotemark} and \cs{@footnotetext}. These overwrites could |
| 104 |
% not be used in combination, so either the packages/classes had to |
| 105 |
% be aware of being loaded together (which they sometimes did or |
| 106 |
% tried to) or they would fail by overwriting each other |
| 107 |
% unconditionally. |
| 108 |
% |
| 109 |
% The present rewrite is an attempt to improve this situation, but |
| 110 |
% of course, it will only work if all packages/classes make use of |
| 111 |
% the new interfaces. Fortunately, the number of problematical |
| 112 |
% packages altering these internal commands are fairly small so |
| 113 |
% arranging for updates is a realistic goal --- to achieve properly |
| 114 |
% tagged PDF it is a requirement. |
| 115 |
% |
| 116 |
% |
| 117 |
% |
| 118 |
% \section{Sockets and hooks} |
| 119 |
% |
| 120 |
% We use sockets for those parts that can be controlled only by one |
| 121 |
% package or by the kernel and hooks for places where it may be |
| 122 |
% possible that several packages or the document class adds code |
| 123 |
% (typically declarations such as font changes, etc.). |
| 124 |
% |
| 125 |
% Note that sockets are of interest only to very |
| 126 |
% few specialized packages, mainly \pkg{footmisc}, and packages |
| 127 |
% providing similar functionality---the current documentation is |
| 128 |
% therefore fairly sketchy. |
| 129 |
% |
| 130 |
% In contrast the hooks are of interest to many classes to provide |
| 131 |
% their layout alterations in a way that it works smoothly with |
| 132 |
% other packages handling aspects of footnote formatting. |
| 133 |
% |
| 134 |
% |
| 135 |
% \subsection{Formatting the mark in the main text} |
| 136 |
% |
| 137 |
% This implements formatting the mark\footnote{Like this one.} and |
| 138 |
% its relation to surrounding text, e.g., if several marks appear |
| 139 |
% in the same place, etc. |
| 140 |
% |
| 141 |
% |
| 142 |
% \subsubsection{Sockets} |
| 143 |
% |
| 144 |
% None: everything is implemented through a single definition for |
| 145 |
% \cs{@footnotemark} that offers a number of hooks that can be used |
| 146 |
% by packages to implement handling of multiple marks and the |
| 147 |
% formatting of marks. |
| 148 |
% |
| 149 |
% |
| 150 |
% \subsubsection{Hooks for formatting the footnote mark in text} |
| 151 |
% |
| 152 |
% The hooks to customize the marks in the text are the following: |
| 153 |
% \begin{description} |
| 154 |
% \item[\hook{fnmark/before}] |
| 155 |
% |
| 156 |
% \DescribeHook[noprint]{fnmark/before} |
| 157 |
% |
| 158 |
% Executed at the very beginning of \cs{footnotemark}. Currently |
| 159 |
% there are two packages (\pkg{bibarts} and \pkg{chextras}) that |
| 160 |
% prepend material at this point (not necessarily correctly, e.g., |
| 161 |
% they do not all check that they are in horizontal mode). |
| 162 |
% |
| 163 |
% This hook is paired with hook \hook{fnmark/after}. |
| 164 |
% |
| 165 |
% \item[\hook{fnmark}] |
| 166 |
% |
| 167 |
% \DescribeHook[noprint]{fnmark} |
| 168 |
% |
| 169 |
% Executed in horizontal mode and after the current space factor |
| 170 |
% has been saved away for reuse. This is where currently code for multiple |
| 171 |
% marks does its preparation (as done by \pkg{footmisc} and |
| 172 |
% others). |
| 173 |
% |
| 174 |
% The hook is only executed in hmode, i.e., not if the mark is |
| 175 |
% generated in math --- maybe that means the multiple handling |
| 176 |
% should happen later? |
| 177 |
% |
| 178 |
% After the hook a \cs{nobreak} is executed, so any |
| 179 |
% ``material'' added in the hook is tied to the following mark |
| 180 |
% unless it contains its own permissible penalty. |
| 181 |
% |
| 182 |
% \item[\hook{fnmark/begin}] |
| 183 |
% |
| 184 |
% \DescribeHook[noprint]{fnmark/begin} |
| 185 |
% |
| 186 |
% This hook is executed directly in front of the typeset mark. |
| 187 |
% This is the place where \pkg{hyperref} would have added |
| 188 |
% part of its code, i.e., after the \cs{nobreak} mentioned above. |
| 189 |
% With the integration of hyperlinks in the tagging code |
| 190 |
% this hook may not be necessary at all. |
| 191 |
% |
| 192 |
% \item[\hook{fnmark/end}] |
| 193 |
% |
| 194 |
% \DescribeHook[noprint]{fnmark/end} |
| 195 |
% |
| 196 |
% This hook is executed directly after the typeset mark. It is |
| 197 |
% used by \pkg{memhfixc}, \pkg{scrlttr2}, and |
| 198 |
% \pkg{footmisc}. Used, for example, to implement support for |
| 199 |
% multiple marks in succession. |
| 200 |
% |
| 201 |
% It is \emph{not} a reversed hook. |
| 202 |
% |
| 203 |
% |
| 204 |
% \item[\hook{fnmark/after}] |
| 205 |
% |
| 206 |
% \DescribeHook[noprint]{fnmark/after} |
| 207 |
% |
| 208 |
% This hook is executed at the very end of the \cs{footnotemark} command. |
| 209 |
% |
| 210 |
% It is a reversed hook to pair with \hook{fnmark/before} |
| 211 |
% \end{description} |
| 212 |
% |
| 213 |
% |
| 214 |
% |
| 215 |
% |
| 216 |
% \subsubsection{Additional configuration possibilities} |
| 217 |
% |
| 218 |
% The actual formatting is done through \cs{@makefnmark} --- no |
| 219 |
% special customization support for now. |
| 220 |
% |
| 221 |
% |
| 222 |
% |
| 223 |
% \subsection{Formatting the footnote text} |
| 224 |
% |
| 225 |
% This implements the formatting of the footnote text the way it |
| 226 |
% appears at the bottom of the page (default case), or possibly |
| 227 |
% elsewhere, e.g. in the margin. |
| 228 |
% |
| 229 |
% \subsubsection{Sockets} |
| 230 |
% |
| 231 |
% To cater for different layout configurations there are four |
| 232 |
% sockets that can be set by a package or |
| 233 |
% class but there should be only one per document setting them, |
| 234 |
% i.e., if two packages/classes set them they are mutually |
| 235 |
% incompatible (or rather the last one wins most likely). |
| 236 |
% These are: |
| 237 |
% \begin{description} |
| 238 |
% \item[\socket{fntext/process} (1 argument)] |
| 239 |
% |
| 240 |
% \DescribeSocket[noprint]{fntext/process} |
| 241 |
% |
| 242 |
% This socket receives all material that is to be processed (or |
| 243 |
% stored) including color protection code and what have you. |
| 244 |
% The \plug{default} executes \cs{insert}\cs{footins}. |
| 245 |
% |
| 246 |
% Available plugs are \plug{default}, \plug{side} (side notes), and \plug{mp} (minipage). |
| 247 |
% |
| 248 |
% |
| 249 |
% \item[\socket{fntext/make} (1 argument)] |
| 250 |
% |
| 251 |
% \DescribeSocket[noprint]{fntext/make} |
| 252 |
% |
| 253 |
% This socket receives the \meta{text} as given in \cs{footnote} |
| 254 |
% or \cs{footnotetext} in the document and adds formatting |
| 255 |
% instructions to it. |
| 256 |
% |
| 257 |
% The \plug{default} plug runs \cs{@makefntext} which contains |
| 258 |
% various hooks for customization. For most scenarios this is |
| 259 |
% sufficient. However, when running all footnotes as a single |
| 260 |
% paragraph at the bottom, then each footnote needs to be |
| 261 |
% prepared prior to storing it with \cs{insert} and this socket |
| 262 |
% allows running extra code to do that. |
| 263 |
% |
| 264 |
% Available plugs are \plug{default} and \plug{para}. |
| 265 |
% |
| 266 |
% \item[\socket{fntext/begin} (no argument)] |
| 267 |
% |
| 268 |
% \DescribeSocket[noprint]{fntext/begin} |
| 269 |
% |
| 270 |
% The socket is executed near the start of the |
| 271 |
% argument for the \socket{fntext/make} socket. |
| 272 |
% By \plug{default} it adds a strut to the footnote |
| 273 |
% material so that consecutive footnotes are properly spaced |
| 274 |
% vertically. In some use cases this is not appropriate (e.g., |
| 275 |
% when running all footnotes as a single paragraph) and so with |
| 276 |
% this socket one can cancel the action or do something else |
| 277 |
% instead. |
| 278 |
% |
| 279 |
% Available plugs are \plug{default} and \plug{noop}. |
| 280 |
% |
| 281 |
% |
| 282 |
% \item[\socket{fntext/end} (no argument)] |
| 283 |
% |
| 284 |
% \DescribeSocket[noprint]{fntext/end} |
| 285 |
% |
| 286 |
% This socket is executed at the very end of the argument passed |
| 287 |
% to socket \socket{fntext/make}. By \plug{default} it |
| 288 |
% adds a final strut as long as we are still in horizontal mode |
| 289 |
% (i.e., processing the footnote text paragraph). When running |
| 290 |
% several footnotes in one paragraph some additional material |
| 291 |
% (some horizontal glue) needs adding at this point which is done |
| 292 |
% with the plug \plug{para}. |
| 293 |
% |
| 294 |
% Available plugs are \plug{default}, \plug{para}, and |
| 295 |
% \plug{noop}. |
| 296 |
% \end{description} |
| 297 |
% |
| 298 |
% |
| 299 |
% All standard plugs for the socket \socket{fntext/make} run |
| 300 |
% \cs{@makefntext} and this command contains two further |
| 301 |
% sockets (unless it is overwritten by a legacy class): |
| 302 |
% \begin{description} |
| 303 |
% \item[\socket{fntext/mark} (0 arguments)] |
| 304 |
% |
| 305 |
% \DescribeSocket[noprint]{fntext/mark} |
| 306 |
% |
| 307 |
% This socket has no input arguments but uses \cs{@makefnmark} to |
| 308 |
% typeset the mark in front of the footnote text. Its |
| 309 |
% \plug{default} uses code that examines the value of |
| 310 |
% \cs{footnotemargin} and based on its setting typeset the mark |
| 311 |
% in different ways: |
| 312 |
% \begin{itemize} |
| 313 |
% \item positive: typeset the mark in a box of that size |
| 314 |
% \item zero: use \cs{llap} around the mark |
| 315 |
% \item negative: use \cs{llap} but with a box of the given size |
| 316 |
% negated inside |
| 317 |
% \item \texttt{-}\cs{maxdimen}: just use \cs{@makefnmark} |
| 318 |
% \end{itemize} |
| 319 |
% For most cases this would be flexible enough, but if not then a |
| 320 |
% class can define its own plug to specify the placement of the mark. |
| 321 |
% |
| 322 |
% Available plugs are \plug{default} and \plug{noop} (no mark is produced). |
| 323 |
% |
| 324 |
% |
| 325 |
% \item[\socket{fntext/text} (1 argument)] |
| 326 |
% |
| 327 |
% \DescribeSocket[noprint]{fntext/text} |
| 328 |
% |
| 329 |
% This socket manages the formatting of the footnote text |
| 330 |
% (presented as an argument) once the mark has been typeset. In |
| 331 |
% all cases we can think of this formatting is better configured |
| 332 |
% via the available hooks described below, so the \plug{default} |
| 333 |
% just grabs the argument and processes it without any other |
| 334 |
% action. It is really only there to allow for some fancy stuff |
| 335 |
% that some design comes up with. |
| 336 |
% |
| 337 |
% Available plugs are \plug{identity} (default) and \plug{noop}. |
| 338 |
% |
| 339 |
% \end{description} |
| 340 |
% |
| 341 |
% |
| 342 |
% The above configuration points are sufficient to implement all |
| 343 |
% commonly used footnote layouts assuming L-R typesetting. For R-L |
| 344 |
% typesetting they or may or may not need some extension (though |
| 345 |
% that is not clear right now). |
| 346 |
% |
| 347 |
% |
| 348 |
% |
| 349 |
% \subsubsection{Hooks for formatting the footnote text} |
| 350 |
% |
| 351 |
% \begin{description} |
| 352 |
% \item[\hook{fntext/before}] |
| 353 |
% |
| 354 |
% \DescribeHook[noprint]{fntext/before} |
| 355 |
% |
| 356 |
% Executed at the very beginning of \cs{footnotetext}. Currently |
| 357 |
% there is one package (\pkg{linguex}) that |
| 358 |
% prepends material at this point. |
| 359 |
% |
| 360 |
% This hook is paired with hook \hook{fnmark/after}. |
| 361 |
% |
| 362 |
% \item[\hook{fntext}] |
| 363 |
% |
| 364 |
% \DescribeHook[noprint]{fntext} |
| 365 |
% |
| 366 |
% Executed at the beginning of the material passed to the first |
| 367 |
% configuration point. Typically used to set any baseline |
| 368 |
% stretch for the footnote text, e.g., by \pkg{setspace}, |
| 369 |
% \pkg{footmisc}, \class{uathesis} and others. Could be done in a |
| 370 |
% later hook but is a bit more efficient here. |
| 371 |
% |
| 372 |
% After the hook has run, the font is established, i.e., it can't |
| 373 |
% be used to set a different font size. |
| 374 |
% |
| 375 |
% \item[\hook{fntext/para}] |
| 376 |
% |
| 377 |
% \DescribeHook[noprint]{fntext/para} |
| 378 |
% |
| 379 |
% After the font is set (after the previous hook), some default |
| 380 |
% paragraph parameters |
| 381 |
% are set up |
| 382 |
% including \cs{interlinepenalty}, \cs{hsize}, \cs{parindent} and |
| 383 |
% a number of others, as some of them depend on the font |
| 384 |
% size. Then the \hook{fntext/para} is run which can overwrite |
| 385 |
% the default. If one wants to |
| 386 |
% change the font size, it is probably necessary to reset these |
| 387 |
% other parameters too, e.g., \cs{parindent}, which can be done |
| 388 |
% here. |
| 389 |
% |
| 390 |
% Note: the socket \socket{fntext/make} normally |
| 391 |
% runs the command \cs{@makefntext} or some code that eventually |
| 392 |
% runs this command, and this then produces the footnote mark in |
| 393 |
% front of the formatted footnote text. In |
| 394 |
% front of both the mark and the footnote text some classes have |
| 395 |
% placed paragraph parameter adjustments in their redefinition of |
| 396 |
% \cs{@makefntext}. However, there is no need to place it there |
| 397 |
% it could equally well go into the \hook{fntext/para} hook. We |
| 398 |
% therefore do not provide another hook at this other point. |
| 399 |
% |
| 400 |
% \item[\hook{fntext/begin} \& \hook{fntext/end}] |
| 401 |
% |
| 402 |
% \DescribeHook[noprint]{fntext/begin} |
| 403 |
% \DescribeHook[noprint]{fntext/end} |
| 404 |
% |
| 405 |
% The footnote text itself is surrounded by the hooks |
| 406 |
% \hook{fntext/begin} and \hook{fntext/end}. The two hooks are |
| 407 |
% not paired as they are typically used independently. |
| 408 |
% |
| 409 |
% \item[\hook{fntext/after}] |
| 410 |
% |
| 411 |
% \DescribeHook[noprint]{fntext/after} |
| 412 |
% |
| 413 |
% At the very end of \cs{footnotetext} we execute the hook |
| 414 |
% \hook{fntext/after} which is a reversed hook paired with |
| 415 |
% \hook{fntext/before}. Some packages, e.g., \pkg{linguex}, have |
| 416 |
% code in that position. |
| 417 |
% |
| 418 |
% \end{description} |
| 419 |
% |
| 420 |
% |
| 421 |
% |
| 422 |
% |
| 423 |
% \subsubsection{Additional configuration possibilities} |
| 424 |
% |
| 425 |
% The formatting of the footnote mark in front of the footnote |
| 426 |
% text is influenced by the setting of the dimen parameter |
| 427 |
% \cs{footnotemargin}. By default its value is 1.8em in the current |
| 428 |
% text font (or \texttt{-}\cs{maxdimen} when the para option is |
| 429 |
% chosen). The following rules apply: |
| 430 |
% \begin{itemize} |
| 431 |
% \item |
| 432 |
% |
| 433 |
% If it has the value \texttt{-}\cs{maxdimen} then the mark is |
| 434 |
% generated by \cs{@makefnmark}. |
| 435 |
% |
| 436 |
% \item |
| 437 |
% |
| 438 |
% Otherwise, if the value is |
| 439 |
% negative then the mark is placed into an \cs{llap} left aligned |
| 440 |
% in a box of size \texttt{-}\cs{footnotemargin}. |
| 441 |
% |
| 442 |
% \item |
| 443 |
% |
| 444 |
% If the value is zero an \cs{llap} is used without an inner box. |
| 445 |
% |
| 446 |
% \item |
| 447 |
% |
| 448 |
% If the value is greater zero (but less than \cs{maxdimen}) the |
| 449 |
% mark is placed right aligned into a box of size |
| 450 |
% \cs{footnotemargin}. |
| 451 |
% |
| 452 |
% \item |
| 453 |
% |
| 454 |
% The value \cs{maxdimen} is used as a marker to indicate that |
| 455 |
% no value was given and that the default should be used, |
| 456 |
% i.e. 1.8em or \texttt{-}\cs{maxdimen} depending on the chosen |
| 457 |
% option. |
| 458 |
% \end{itemize} |
| 459 |
% |
| 460 |
% \subsection{Debugging sockets and hooks} |
| 461 |
% |
| 462 |
% For some rudimentary debugging we currently have \cs{DebugFNotesOn} |
| 463 |
% (and \cs{DebugFNotesOff}). At the moment \cs{DebugFNotesOn} only |
| 464 |
% shows the current settings for hooks and sockets related to the |
| 465 |
% footnote code and then |
| 466 |
% automatically turns itself off again. |
| 467 |
% |
| 468 |
% |
| 469 |
% \section{Tagging and hyperlinking support} |
| 470 |
% |
| 471 |
% \fmi{this section needs work (and probably csname changes)} |
| 472 |
% |
| 473 |
% Footnotes consist of a \emph{footnotemark} (short: mark) that is typically placed in the text |
| 474 |
% as a superscript number like this\footnotemark[1], and a \emph{footnotetext} |
| 475 |
% (short: note) that is placed at the bottom of the page. |
| 476 |
% The \emph{footnotetext} normally repeats at the begin the mark as a visual clue. |
| 477 |
% |
| 478 |
% Tagging (and hyperlinking) has to connect the mark with the note. |
| 479 |
% For the tagging code, we assume that every mark has exactly one associated note, |
| 480 |
% and that every note is associated to at least one mark |
| 481 |
% and can have more associated marks. |
| 482 |
% |
| 483 |
% The mark doesn't need to be visible, e.g. the typesetted |
| 484 |
% mark\textsuperscript{1--3} denotes three marks, where the second is invisible. |
| 485 |
% Tagging should produce here probably three \texttt{Lbl} structures |
| 486 |
% (one without content), and an artifact for the range marker. |
| 487 |
% If such a range is used, links can only point to the notes 1 and 3 and |
| 488 |
% one has to suppress the linking for the second mark. |
| 489 |
% This means that links and tagging are also related |
| 490 |
% to the actual formatting of the footnote mark. |
| 491 |
% In the following this problem is mostly ignored for now, but |
| 492 |
% should not be forgotten and handled later. |
| 493 |
% |
| 494 |
% \subsection{Technical details for the tagging} |
| 495 |
% |
| 496 |
% The following sockets are set up for kernel use, when doing tagging: |
| 497 |
% There name and/or function will probably change as they currently |
| 498 |
% mix tagging with the link support. |
| 499 |
% |
| 500 |
% |
| 501 |
% TODO: review this sockets |
| 502 |
% \begin{description} |
| 503 |
% \item[\socket{tagsupport/fnmark} (2 argument)] |
| 504 |
% |
| 505 |
% \DescribeSocket[noprint]{tagsupport/fnmark} |
| 506 |
% |
| 507 |
% The socket is used in \cs{@footnotemark}/\cs{fnote_footnotemark:} |
| 508 |
% and takes \cs{@makefnmark} or --- if link support is wanted --- |
| 509 |
% \verb+\socket_use:n{fnmark/link}{\@makefnmark}+ as second argument. |
| 510 |
% It prints the mark in the text |
| 511 |
% and surrounds it with a tagging structure. |
| 512 |
% |
| 513 |
% \fmi{describe and decide on names} |
| 514 |
% |
| 515 |
% |
| 516 |
% \item[\socket{tagsupport/fntext/begin} (no argument)] |
| 517 |
% |
| 518 |
% \DescribeSocket[noprint]{tagsupport/fntext/begin} |
| 519 |
% |
| 520 |
% This socket is used before the main processing socket |
| 521 |
% (so before the \cs{insert} command). It opens the FEnote structure. |
| 522 |
% |
| 523 |
% |
| 524 |
% \item[\socket{tagsupport/fntext/end} (no argument)] |
| 525 |
% |
| 526 |
% \DescribeSocket[noprint]{tagsupport/fntext/end} |
| 527 |
% |
| 528 |
% This socket is used after the main processing socket |
| 529 |
% (so after the \cs{insert} command). It closes the FEnote structure. |
| 530 |
% |
| 531 |
% |
| 532 |
% \item[\socket{tagsupport/fntext/mark} (2 argument)] |
| 533 |
% |
| 534 |
% \DescribeSocket[noprint]{tagsupport/fntext/mark} |
| 535 |
% |
| 536 |
% This socket is used around the mark in the footnote text. |
| 537 |
% It adds tagging support. |
| 538 |
% |
| 539 |
% \item[\socket{tagsupport/fntext/text} (2 argument)] |
| 540 |
% |
| 541 |
% \DescribeSocket[noprint]{tagsupport/fntext/text} |
| 542 |
% |
| 543 |
% This socket handles mc-chunks around the text of the footnote. It takes as second |
| 544 |
% argument the text. |
| 545 |
% |
| 546 |
% \end{description} |
| 547 |
% |
| 548 |
% |
| 549 |
% The \emph{footnotemark} should create a \texttt{/Lbl} structure\footnote{to make it easier |
| 550 |
% to identify the role we use \texttt{/footnotemark} which we rolemap to \texttt{/Lbl}} |
| 551 |
% that should contain a \texttt{/Ref} entry pointing |
| 552 |
% to the structure of the \emph{footnotetext}. |
| 553 |
% |
| 554 |
% The \emph{footnotetext} should create a \texttt{/FENote}% |
| 555 |
% \footnote{We tag it as \texttt{/footnote} and role map it.} |
| 556 |
% structure with a \texttt{/Ref} |
| 557 |
% entry pointing to the structures of \emph{all} marks related to the note. |
| 558 |
% The mark at the begin of the |
| 559 |
% note is in a \texttt{/Lbl}\footnote{We tag it as \texttt{/footnotelabel}.} |
| 560 |
% structure but has to fulfil no special requirements. |
| 561 |
% |
| 562 |
% Structure objects and the underlying properties used by the tagging |
| 563 |
% code are initialized when the structure is opened. This means that one can not |
| 564 |
% directly add data to a future structure |
| 565 |
% but as structure objects are written at the end of the document it is |
| 566 |
% possible to update \texttt{/Ref} entries in an end document hook. |
| 567 |
% |
| 568 |
% |
| 569 |
% So tagging has to solve two problems: |
| 570 |
% \begin{itemize} |
| 571 |
% \item the mark and the footnote text must be surrounded by the correct structure |
| 572 |
% and marked content commands. This is not trivial |
| 573 |
% as there are various layouts (bottom, marginpar, minipage) and the tagging |
| 574 |
% from the automatic paratagging must be taken into account if one want to avoid |
| 575 |
% faulty nesting. |
| 576 |
% |
| 577 |
% \item It must detect which marks are related to which notes |
| 578 |
% so that it can setup the \texttt{/Ref} cross-references. |
| 579 |
% \end{itemize} |
| 580 |
% |
| 581 |
% |
| 582 |
% \subsection{Requirements for links} |
| 583 |
% |
| 584 |
% Links should go from the mark to the note. Sometimes it has been requested |
| 585 |
% that links go back too, but as there |
| 586 |
% can be more than one mark connected to a note it is not clear how to decide to which mark it should go. |
| 587 |
% Using the keys from the PDF viewer to go back is normally better. |
| 588 |
% |
| 589 |
% Links are closely related to the references stored in the \texttt{/Ref} |
| 590 |
% entry of a mark and so are handled in the code together with them. |
| 591 |
% But there are subtle technical differences to take care of |
| 592 |
% as links and destinations are whatsits and so must be created at the correct time. |
| 593 |
% |
| 594 |
% It should be possible to suppress the links both globally and locally.\footnote{ |
| 595 |
% Currently hyperref only offers the option to suppress the |
| 596 |
% footnote links globally |
| 597 |
% with the option \texttt{hyperfootnotes=false}. To suppress them locally |
| 598 |
% only the \texttt{NoHyper} environment is provided.} |
| 599 |
% |
| 600 |
% Footnote links should work also if tagging is disabled, either locally (e.g. in an artifact) |
| 601 |
% or if tagging is deactivated globally. They should therefore use their own system |
| 602 |
% to store the relations between mark and note, even if this duplicates some code. |
| 603 |
% |
| 604 |
% \subsection{The algorithmus to connect marks and notes} |
| 605 |
% |
| 606 |
% |
| 607 |
% The connection is made by comparing the value of \cs{@thefnmark}. |
| 608 |
% |
| 609 |
% The standard mark commands (\cs{footnotemark} and \cs{footnote}) |
| 610 |
% store the current value of \cs{@thefnmark} |
| 611 |
% with a combination of their own structure number (for the tagging) and a unique id (for the link) |
| 612 |
% as a key in a property. |
| 613 |
% |
| 614 |
% A following \cs{footnotetext} compares its own \cs{@thefnmark} with the values in |
| 615 |
% the prop. If there is one or more match it stores the keys and removes the entries |
| 616 |
% from the property (so in a normal document the property will never contain more than |
| 617 |
% a few entries). |
| 618 |
% |
| 619 |
% This works well as long as the \cs{footnotemark} commands are issued before the \cs{footnotetext} and |
| 620 |
% as long as nothing unusual is done to \cs{@thefnmark}. |
| 621 |
% It also works if a document uses more than one footnote series as long as they have distinct numbering |
| 622 |
% systems, but in case a distinction is needed it is possible to define |
| 623 |
% a new class with its own data structure and to switch locally to use this |
| 624 |
% class. The following three commands are used for this. |
| 625 |
% |
| 626 |
% The default class uses the name \texttt{default} |
| 627 |
% |
| 628 |
% \begin{variable}{\g_fnote_id_int} |
| 629 |
% This integer is used as unique identifier to store data for a footnote. |
| 630 |
% It should be increase when a footnote mark or a footnote text is created. |
| 631 |
% \end{variable} |
| 632 |
% |
| 633 |
% \begin{function}{\fnote_class_new:nn} |
| 634 |
% \begin{syntax} |
| 635 |
% \cs{fnote_class_new:nn}\Arg{name}\Arg{key/value option} |
| 636 |
% \end{syntax} |
| 637 |
% This declaration sets up the needed data structure. Currently this only |
| 638 |
% consists of a property list which is used to store and manage the mark values. |
| 639 |
% There are no options yet. |
| 640 |
% \end{function} |
| 641 |
% |
| 642 |
% \begin{function}{\fnote_mark_struct_gput:nnn,\fnote_mark_id_gput:nnn} |
| 643 |
% \begin{syntax} |
| 644 |
% \cs{fnote_mark_struct_gput:nnn}\Arg{mark}\Arg{class name} |
| 645 |
% \cs{fnote_mark_id_gput:nnn}\Arg{mark}\Arg{class name} |
| 646 |
% \end{syntax} |
| 647 |
% These commands store either the current structure number or the current id |
| 648 |
% as key and the \meta{mark} as value in the property list |
| 649 |
% associated with the \meta{class name}. |
| 650 |
% \end{function} |
| 651 |
% |
| 652 |
% \begin{function}{\fnote_mark_gpop_all:nnnN} |
| 653 |
% \begin{syntax} |
| 654 |
% \cs{fnote_mark_gpop_all:nnN}\Arg{id or struct}\Arg{mark}\Arg{class name}\meta{sequence} |
| 655 |
% \end{syntax} |
| 656 |
% This command stores all the keys/structure numbers whose value in the |
| 657 |
% property list for \meta{class name} are equal to \meta{mark} |
| 658 |
% into the sequence \meta{sequence} and then removes them from the property list. |
| 659 |
% The content of the sequence can then be |
| 660 |
% used to create link targets and references. |
| 661 |
% \end{function} |
| 662 |
% |
| 663 |
% |
| 664 |
% \subsubsection{\cs{footref}} |
| 665 |
% |
| 666 |
% \cs{footref} uses internally the same command to set the mark as \cs{footnotemark}, it only |
| 667 |
% defines \cs{@thefnmark} differently. This \cs{@thefnmark} is not suitable for the method described |
| 668 |
% above: as it contains a reference command it can't be used to match a note, also \cs{footref} can |
| 669 |
% be used after the note has already been set. \cs{footref} disables therefore the automatic detection. |
| 670 |
% |
| 671 |
% Instead the \cs{label} command is |
| 672 |
% extended in the \cs{footnotetext} command to also store the structure number and \cs{footref} retrieves this |
| 673 |
% number to setup the reference and the link. |
| 674 |
% |
| 675 |
% The structure related to the \cs{footref} is added to the end of the \texttt{/Ref} array of the note and so the |
| 676 |
% \texttt{/Ref} array doesn't necessarily reflect the order of the marks in the document. It would probably |
| 677 |
% be possible to change this, but it is not clear if it actually matters and so it worth the additional coding |
| 678 |
% and processing. |
| 679 |
% |
| 680 |
% \subsubsection{\cs{footnotemark} after \cs{footnotetext}} |
| 681 |
% |
| 682 |
% The automatic detection doesn't work if a \cs{footnotemark} is issued after |
| 683 |
% the \cs{footnotetext} it refers to. There will be no error, but neither the link nor |
| 684 |
% the \texttt{/Ref} will connect both. |
| 685 |
% |
| 686 |
% The simple way to handle this is to use a label and \cs{footref}: |
| 687 |
% |
| 688 |
% \begin{verbatim} |
| 689 |
% \footnotetext{\label{fn:a}text} ... \footref{fn:a} |
| 690 |
% \end{verbatim} |
| 691 |
% |
| 692 |
% An alternative would be to extend the syntax of \cs{footnotemark} and |
| 693 |
% \cs{footnotetext} to allow to add a label which can then be used. |
| 694 |
% For example |
| 695 |
% |
| 696 |
% \begin{verbatim} |
| 697 |
% \footnotetext[label=fn:a]{text} ... \footnotemark[label=fn:a] |
| 698 |
% \end{verbatim} |
| 699 |
% |
| 700 |
% As both have already an optional argument, that requires the optional argument extension. |
| 701 |
% |
| 702 |
% |
| 703 |
% \subsection{Links} |
| 704 |
% |
| 705 |
% The keys containing the structure number/id combination |
| 706 |
% detected for the \texttt{/Ref} are also used for links. For links the second |
| 707 |
% part is used as this id is increased also if tagging is deactivated. |
| 708 |
% |
| 709 |
% A \cs{footnotetext} creates a bunch of destinations (in most cases this sums up to |
| 710 |
% two destinations): one for every structure number in the \texttt{/Ref} (used as target |
| 711 |
% by the mark commands) and one for the structure number of the footnotetext itself |
| 712 |
% (used as target by \cs{footref}s commands). |
| 713 |
% |
| 714 |
% \subsection{Implementation details regarding tagging} |
| 715 |
% |
| 716 |
% \subsection{Handling the mark} |
| 717 |
% |
| 718 |
% The mark in the text is handled by assigning an appropriate |
| 719 |
% plug to the socket \socket{tagsupport/fnmark}. |
| 720 |
% It takes one argument, \cs{@makefnmark}, the |
| 721 |
% command which formats the mark, and surrounds it by link and tagging |
| 722 |
% commands. At the point where the socket is |
| 723 |
% executed, \cs{@thefnmark} has already been defined and can be used to |
| 724 |
% setup the reference detections. |
| 725 |
% |
| 726 |
% |
| 727 |
% \subsection{Handling the footnotetext} |
| 728 |
% |
| 729 |
% The main part is done by assigning a different plug to socket \socket{tagsupport/fntext/begin} |
| 730 |
% and \socket{tagsupport/fntext/end} |
| 731 |
% surrounding the footnote text. |
| 732 |
% These sockets are used to start and end the structure and |
| 733 |
% attempt to detect to which mark the note is related. |
| 734 |
% |
| 735 |
% The actual typesetting of the note text is done by |
| 736 |
% \cs{fnote_makefntext:n} (or its \LaTeXe{} name \cs{@makefntext}). In |
| 737 |
% the new implementation this contains two further kernel sockets for tagging: |
| 738 |
% \socket{tagsupport/fntext/mark} and |
| 739 |
% \socket{tagsupport/fntext/text}. They get plugs assigned that add the |
| 740 |
% tagging commands around note mark and note text. |
| 741 |
% |
| 742 |
% \subsection{Footnotes in minipages} |
| 743 |
% |
| 744 |
% In minipages the \cs{footnote} command uses a special marker |
| 745 |
% (small italic letters by default) and puts the |
| 746 |
% footnote text at the bottom of the box. The \cs{footnotemark} |
| 747 |
% command uses the standard footnote counter and marker (and so typically |
| 748 |
% creates a superscript number). |
| 749 |
% It is meant to be used with a \cs{footnotetext} \emph{outside} |
| 750 |
% the minipage to create a footnote mark which refers to a footnote text |
| 751 |
% at the bottom of the page. |
| 752 |
% This means to repeat a footnote marker in a minipage you should use the \cs{footref} command. |
| 753 |
% |
| 754 |
% Tagging works quite similar to normal footnotes if the new definition is used |
| 755 |
% and if the minipage code is changed to use the new configuration point. |
| 756 |
% The main problem here is currently the tagging of the minipage itself. |
| 757 |
% |
| 758 |
% \section{TODOs} |
| 759 |
% |
| 760 |
% \begin{itemize} |
| 761 |
% |
| 762 |
% \item Special formatting of footnote marks in the text, e.g. if ranges or commas are |
| 763 |
% used require special care as they should normally mark up such text as artifacts and |
| 764 |
% perhaps have to insert empty structures to represent an invisible mark. This must be coordinated |
| 765 |
% with the relevant packages and classes. |
| 766 |
% |
| 767 |
% \item manyfoot doesn't work correctly and must be analyzed. |
| 768 |
% |
| 769 |
% \item \pkg{memoir} is not supported at all and errors when the code tries to patch |
| 770 |
% \cs{@makefntext}. |
| 771 |
% \end{itemize} |
| 772 |
% |
| 773 |
% \emph{To be documented} |
| 774 |
% |
| 775 |
% |
| 776 |
% |
| 777 |
% |
| 778 |
% \MaybeStop{\setlength\IndexMin{200pt} \PrintIndex } |
| 779 |
% |
| 780 |
% |
| 781 |
% \section{The Implementation} |
| 782 |
% |
| 783 |
% All this is very rough and misses a lot of documentation. |
| 784 |
% |
| 785 |
% \begin{macrocode} |
| 786 |
%<*kernel> |
| 787 |
%<@@=fnote> |
| 788 |
% \end{macrocode} |
| 789 |
% |
| 790 |
% \subsection{File declaration} |
| 791 |
% \begin{macrocode} |
| 792 |
\ProvidesFile{latex-lab-footnotes.ltx} |
| 793 |
[\ltlabfootnotedate\space v\ltlabfootnoteversion\space |
| 794 |
changes to the footnote interfaces] |
| 795 |
% \end{macrocode} |
| 796 |
% |
| 797 |
% \subsection{code not fully handled yet} |
| 798 |
% \begin{macrocode} |
| 799 |
% |
| 800 |
% latex.ltx |
| 801 |
% not looked at yet |
| 802 |
% \@mpfootnotetext is probably no longer needed, or only to support other |
| 803 |
% classes and package. See below about the minipage code. |
| 804 |
% |
| 805 |
% \long\def\@mpfootnotetext#1{% |
| 806 |
% \global\setbox\@mpfootins\vbox{% |
| 807 |
% \unvbox\@mpfootins |
| 808 |
% \reset@font\footnotesize |
| 809 |
% \hsize\columnwidth |
| 810 |
% \@parboxrestore |
| 811 |
% \def\@currentcounter{mpfootnote}% |
| 812 |
% \protected@edef\@currentlabel |
| 813 |
% {\csname p@mpfootnote\endcsname\@thefnmark}% |
| 814 |
% \color@begingroup |
| 815 |
% \@makefntext{% |
| 816 |
% \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% |
| 817 |
% \par |
| 818 |
% \color@endgroup}} |
| 819 |
% ======== |
| 820 |
% used by the minipage footnote code. |
| 821 |
% |
| 822 |
% \def\@mpfn{footnote} |
| 823 |
% \def\thempfn{\thefootnote} |
| 824 |
% ========= |
| 825 |
% this perhaps need some configuration options. |
| 826 |
% |
| 827 |
%\def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}} |
| 828 |
% |
| 829 |
% ========= |
| 830 |
%% alterations not covered: |
| 831 |
% |
| 832 |
% ./arabtex/afoot.sty --- too different (and probably too old) |
| 833 |
% |
| 834 |
% ===== |
| 835 |
% alterations of footnotetext not covered: |
| 836 |
% |
| 837 |
% ./revtex4-1/revtex4-1.cls ./revtex/ltxutil.sty ./revtex/revtex4-2.cls ... (need analysis) |
| 838 |
% ./bigfoot/bigfoot.sty |
| 839 |
% |
| 840 |
% memoir needs checking too |
| 841 |
% |
| 842 |
% ===== |
| 843 |
% |
| 844 |
% use of kerns to mark h-mode positions (unit sp) |
| 845 |
% |
| 846 |
% 1 = CJK |
| 847 |
% 2 = CJK |
| 848 |
% 3 = multiple footnotes (footmisc, koma, eledmac, tufte, memoir, |
| 849 |
% parnotes, sidenotes) |
| 850 |
% 3 = outer kern in letter spacing (letterspace) |
| 851 |
% 3 = beginning of list (examdesign.cls) |
| 852 |
% 4 = CJK pigin |
| 853 |
% 5 = CJK ruby |
| 854 |
|
| 855 |
% 1-4 = polyglossia for korean |
| 856 |
% |
| 857 |
% \end{macrocode} |
| 858 |
%------------------------------------- |
| 859 |
% \begin{macrocode} |
| 860 |
\ExplSyntaxOn |
| 861 |
% \end{macrocode} |
| 862 |
% \subsection{Temporary variables} |
| 863 |
% \begin{macrocode} |
| 864 |
\prop_new:N \l_@@_tmpa_prop |
| 865 |
\tl_new:N \l_@@_tmpa_tl |
| 866 |
% \end{macrocode} |
| 867 |
% \subsection{Public variables} |
| 868 |
% |
| 869 |
% A footnote mark will store its structure number (key) and the |
| 870 |
% expanded \cs{@thefnmark} in this prop so |
| 871 |
% that a following note can retrieve this info |
| 872 |
% if needed. It is possible to use more than one footnote series (type) |
| 873 |
% if needed (if different footnotes/note use the same |
| 874 |
% numbering system). |
| 875 |
% If this command is changed an accompanying property must be created |
| 876 |
% \begin{NOTE}{UF} |
| 877 |
% TODO: interface to create the property.\\ |
| 878 |
% TODO: check and decide about the name of the tl |
| 879 |
% \end{NOTE} |
| 880 |
% \begin{macro}[no-user-doc]{\l_fnote_type_tl} |
| 881 |
% \begin{macrocode} |
| 882 |
\tl_new:N \l_fnote_type_tl |
| 883 |
\tl_set:Nn \l_fnote_type_tl {default} |
| 884 |
% \end{macrocode} |
| 885 |
% \end{macro} |
| 886 |
% It must be possible to suppress the hyperlinking, both locally |
| 887 |
% and globally. hyperref's hyperfootnotes option should set the boolean. |
| 888 |
% \begin{macro}[no-user-doc]{\l_fnote_link_bool} |
| 889 |
% \begin{macrocode} |
| 890 |
\bool_new:N \l_fnote_link_bool |
| 891 |
\bool_set_true:N \l_fnote_link_bool |
| 892 |
% \end{macrocode} |
| 893 |
% \end{macro} |
| 894 |
% A hyperlink should have an changeable link type. This can |
| 895 |
% be e.g. used to change the color or the border. |
| 896 |
% \begin{macro}[no-user-doc]{\l_fnote_link_type_tl} |
| 897 |
% \begin{macrocode} |
| 898 |
\tl_new:N \l_fnote_link_type_tl |
| 899 |
\tl_set:Nn \l_fnote_link_type_tl {link} |
| 900 |
% \end{macrocode} |
| 901 |
% \end{macro} |
| 902 |
% |
| 903 |
% \subsection{Internal variables} |
| 904 |
% |
| 905 |
% \begin{macro}{\l_@@_linktarget_tl} |
| 906 |
% This command stores the name of a linktarget/destination |
| 907 |
% when needed |
| 908 |
% \begin{macrocode} |
| 909 |
\tl_new:N \l_@@_linktarget_tl |
| 910 |
% \end{macrocode} |
| 911 |
% \end{macro} |
| 912 |
% \begin{macro}{\l_@@_currentlabel_tl} |
| 913 |
% This command is used to pass a label name around. |
| 914 |
% \begin{macrocode} |
| 915 |
\tl_new:N \l_@@_currentlabel_tl |
| 916 |
% \end{macrocode} |
| 917 |
% \end{macro} |
| 918 |
|
| 919 |
% \begin{macro}{\l_@@_currentrefs_seq} |
| 920 |
% This sequence stores the list of reference of a note |
| 921 |
% \begin{macrocode} |
| 922 |
\seq_new:N \l_@@_currentrefs_seq |
| 923 |
% \end{macrocode} |
| 924 |
% \end{macro} |
| 925 |
% |
| 926 |
% The connection between the mark(s) in the text and the note |
| 927 |
% is either deduced automatically or done through an label. |
| 928 |
% The default is automatic, but we must be able to suppress it. For this we use a boolean. |
| 929 |
% \begin{macro}{\l_@@_autodetect_bool} |
| 930 |
% \begin{macrocode} |
| 931 |
\bool_new:N \l_@@_autodetect_bool |
| 932 |
\bool_set_true:N \l_@@_autodetect_bool |
| 933 |
% \end{macrocode} |
| 934 |
% \end{macro} |
| 935 |
% This is used to pass the structure number of the note around, e.g. |
| 936 |
% to a label inside the note. |
| 937 |
% \begin{macrocode} |
| 938 |
\tl_new:N \l_@@_currentstruct_tl |
| 939 |
\tl_set:Nn \l_@@_currentstruct_tl {2} |
| 940 |
% \end{macrocode} |
| 941 |
% |
| 942 |
% |
| 943 |
% \subsection{Variants} |
| 944 |
% |
| 945 |
% \begin{macrocode} |
| 946 |
\cs_generate_variant:Nn \hook_gput_code:nnn{nne} |
| 947 |
\cs_generate_variant:Nn \tag_struct_use:n {e} |
| 948 |
% \end{macrocode} |
| 949 |
% |
| 950 |
% \subsection{Updating \cs{@thefnmark}} |
| 951 |
% \begin{macro}[no-user-doc]{\fnote_step_fnmark:nn} |
| 952 |
% This command updates \cs{@thefnmark}. The first argument |
| 953 |
% is an optional integer expression, the second a counter name. |
| 954 |
% If the optional argument is not given it steps the counter. |
| 955 |
% \begin{macrocode} |
| 956 |
\cs_new_protected:Npn \fnote_step_fnmark:nn #1#2 { |
| 957 |
\tl_if_novalue:nTF {#1} |
| 958 |
{ |
| 959 |
\stepcounter {#2} |
| 960 |
\protected@xdef \@thefnmark { \use:c { the#2 } } |
| 961 |
} |
| 962 |
{ |
| 963 |
\group_begin: |
| 964 |
% \end{macrocode} |
| 965 |
% Note that this is a local assignment even though \LaTeX{} |
| 966 |
% counters are normally globally changed. This is the way it was in |
| 967 |
% 2e and so far we haven't changed it. The alternative would be to |
| 968 |
% store the current value and restore it after \cs{@thefnmark} is |
| 969 |
% altered. |
| 970 |
% \begin{macrocode} |
| 971 |
\int_set:cn { c@#2 }{ #1 } |
| 972 |
\unrestored@protected@xdef \@thefnmark { \use:c { the#2 } } |
| 973 |
\group_end: |
| 974 |
} |
| 975 |
} |
| 976 |
% \end{macrocode} |
| 977 |
% \end{macro} |
| 978 |
% \begin{macro}[no-user-doc]{\fnote_set_fnmark:nn} |
| 979 |
% This is similar to the previous command, but it doesn't step the |
| 980 |
% counter but use the current value. |
| 981 |
% \begin{macrocode} |
| 982 |
\cs_new_protected:Npn \fnote_set_fnmark:nn #1#2 { |
| 983 |
\tl_if_novalue:nTF {#1} |
| 984 |
{ |
| 985 |
\protected@xdef \@thefnmark { \use:c { the#2 } } |
| 986 |
} |
| 987 |
{ |
| 988 |
\group_begin: |
| 989 |
\int_set:cn { c@#2 }{ #1 } |
| 990 |
\unrestored@protected@xdef \@thefnmark { \use:c { the#2 } } |
| 991 |
\group_end: |
| 992 |
} |
| 993 |
} |
| 994 |
% \end{macrocode} |
| 995 |
% \end{macro} |
| 996 |
% |
| 997 |
% \subsection{Hooks} |
| 998 |
% |
| 999 |
% \begin{hookdecl}{fnmark/before,fnmark/after, |
| 1000 |
% fnmark, |
| 1001 |
% fnmark/begin,fnmark/end} |
| 1002 |
% Hooks in the footnotemark command. |
| 1003 |
% \begin{macrocode} |
| 1004 |
\NewMirroredHookPair{fnmark/before}{fnmark/after} |
| 1005 |
\NewHook{fnmark} |
| 1006 |
\NewHook{fnmark/begin} |
| 1007 |
\NewHook{fnmark/end} |
| 1008 |
% \end{macrocode} |
| 1009 |
% \end{hookdecl} |
| 1010 |
% |
| 1011 |
% \begin{hookdecl}{fntext/before,fntext/after, |
| 1012 |
% fntext, |
| 1013 |
% fntext/begin,fntext/end,fntext/para} |
| 1014 |
% Hooks in the footnotetext command: |
| 1015 |
% \begin{macrocode} |
| 1016 |
\NewMirroredHookPair{fntext/before}{fntext/after} |
| 1017 |
\NewHook{fntext} |
| 1018 |
\NewHook{fntext/para} |
| 1019 |
\NewHook{fntext/begin} |
| 1020 |
\NewHook{fntext/end} |
| 1021 |
% \end{macrocode} |
| 1022 |
% \end{hookdecl} |
| 1023 |
% |
| 1024 |
% \subsection{Debugging code} |
| 1025 |
% The debugging code is just temporary |
| 1026 |
% |
| 1027 |
% \begin{macrocode} |
| 1028 |
\bool_new:N \g_fnote_debug_bool |
| 1029 |
% \end{macrocode} |
| 1030 |
|
| 1031 |
% \begin{macro}[no-user-doc]{\DebugFNotesOn,\DebugFNotesOff} |
| 1032 |
% |
| 1033 |
% \begin{macrocode} |
| 1034 |
\cs_new_protected:Npn \DebugFNotesOn { \bool_gset_true:N \g_fnote_debug_bool } |
| 1035 |
\cs_new_protected:Npn \DebugFNotesOff { \bool_gset_false:N \g_fnote_debug_bool } |
| 1036 |
% \end{macrocode} |
| 1037 |
% \end{macro} |
| 1038 |
% |
| 1039 |
% |
| 1040 |
% |
| 1041 |
% We log the hooks in the footnote mark command, but only once |
| 1042 |
% \begin{macrocode} |
| 1043 |
\cs_new_protected:Npn \@@_debug_footnotemark: |
| 1044 |
{ |
| 1045 |
\bool_if:NT \g_fnote_debug_bool |
| 1046 |
{ |
| 1047 |
\hook_log:n {fnmark/before} |
| 1048 |
\hook_log:n {fnmark} |
| 1049 |
\hook_log:n {fnmark/begin} |
| 1050 |
\hook_log:n {fnmark/end} |
| 1051 |
\hook_log:n {fnmark/after} |
| 1052 |
\cs_gset_eq:NN \@@_debug_footnotemark: \prg_do_nothing: |
| 1053 |
} |
| 1054 |
} |
| 1055 |
% \end{macrocode} |
| 1056 |
% Similar for the footnotetext |
| 1057 |
% \begin{macrocode} |
| 1058 |
\cs_new_protected:Npn \@@_debug_footnotetext: |
| 1059 |
{ |
| 1060 |
\bool_if:NT \g_fnote_debug_bool |
| 1061 |
{ |
| 1062 |
\socket_log:n {fntext/process} |
| 1063 |
\socket_log:n {fntext/make} |
| 1064 |
\socket_log:n {fntext/begin} |
| 1065 |
\socket_log:n {fntext/end} |
| 1066 |
% \end{macrocode} |
| 1067 |
% |
| 1068 |
% \begin{macrocode} |
| 1069 |
\socket_log:n {fntext/mark} |
| 1070 |
\socket_log:n {fntext/text} |
| 1071 |
% \end{macrocode} |
| 1072 |
% |
| 1073 |
% \begin{macrocode} |
| 1074 |
\socket_log:n {tagsupport/fnmark} |
| 1075 |
\socket_log:n {tagsupport/fntext/begin} |
| 1076 |
\socket_log:n {tagsupport/fntext/end} |
| 1077 |
\socket_log:n {tagsupport/fntext/mark} |
| 1078 |
\socket_log:n {tagsupport/fntext/text} |
| 1079 |
% \end{macrocode} |
| 1080 |
% |
| 1081 |
% \begin{macrocode} |
| 1082 |
\hook_log:n {fntext/before} |
| 1083 |
\hook_log:n {fntext} |
| 1084 |
\hook_log:n {fntext/para} |
| 1085 |
\hook_log:n {fntext/begin} |
| 1086 |
\hook_log:n {fntext/end} |
| 1087 |
\hook_log:n {fntext/after} |
| 1088 |
% \end{macrocode} |
| 1089 |
% Show the info only once (if at all). |
| 1090 |
% \begin{macrocode} |
| 1091 |
\cs_gset_eq:NN \@@_debug_footnotetext: \prg_do_nothing: |
| 1092 |
} |
| 1093 |
} |
| 1094 |
% \end{macrocode} |
| 1095 |
% |
| 1096 |
% \subsection{The new \cs{@footnotemark} command} |
| 1097 |
% \begin{macro}[no-user-doc]{\fnote_footnotemark:} |
| 1098 |
% This is the main command which will replace \cs{@footnotemark}. |
| 1099 |
% \begin{macrocode} |
| 1100 |
\cs_new_protected:Npn \fnote_footnotemark: { |
| 1101 |
\@@_debug_footnotemark: |
| 1102 |
%------- |
| 1103 |
% bibarts |
| 1104 |
% chextras --- actually in the wrong place does an \unskip |
| 1105 |
\hook_use:n {fnmark/before} |
| 1106 |
%------- |
| 1107 |
\leavevmode |
| 1108 |
\ifhmode |
| 1109 |
\edef\@x@sf{\the\spacefactor} |
| 1110 |
%------- |
| 1111 |
% bxjsja-minimal.def --- what they do could be done at ``bibarts'' |
| 1112 |
% (a bit less efficient) |
| 1113 |
% memhfixc.sty |
| 1114 |
% footmisc.sty |
| 1115 |
\hook_use:n {fnmark} |
| 1116 |
%------- |
| 1117 |
\nobreak |
| 1118 |
\fi |
| 1119 |
%------- |
| 1120 |
% hyperref.sty |
| 1121 |
\hook_use:n {fnmark/begin} |
| 1122 |
%------- |
| 1123 |
% \end{macrocode} |
| 1124 |
% The kernel socket for tagging. It picks up \cs{@makefnmark} as its |
| 1125 |
% argument. For link support it should surround the argument with the |
| 1126 |
% link socket. |
| 1127 |
% \begin{macrocode} |
| 1128 |
\tag_socket_use:nnn {fnmark}{}{ \socket_use:n{fnmark/link}{\@makefnmark} } |
| 1129 |
%------- |
| 1130 |
% \end{macrocode} |
| 1131 |
% If a footnote mark is placed by its own then it should finish by |
| 1132 |
% executing the hook \hook{fnmark/end}, resetting the space factor, and |
| 1133 |
% finishing with the hook \hook{fnmark/after}. However, in a complete |
| 1134 |
% footnote these actions have to happen only after we have handled |
| 1135 |
% the footnote text (e.g., by placing it into an \cs{insert}). In |
| 1136 |
% such a situation \cs{_@@_footmark_finish:} below does nothing |
| 1137 |
% and the action is carried out later. |
| 1138 |
% \begin{macrocode} |
| 1139 |
\@@_footnotemark_finish: |
| 1140 |
} |
| 1141 |
% \end{macrocode} |
| 1142 |
% \end{macro} |
| 1143 |
% |
| 1144 |
% \begin{macro}{\@@_footnotemark_default_finish:,\@@_footnotemark_finish:} |
| 1145 |
% The default definition for \cs{@@_footnotemark_finish:} is called \cs{@@_footnotemark_default_finish:} |
| 1146 |
% \begin{macrocode} |
| 1147 |
\cs_new_protected:Npn \@@_footnotemark_default_finish: { |
| 1148 |
% hyperref.sty |
| 1149 |
% memhfixc.sty --- could move fnmark/after |
| 1150 |
% scrlttr2.cls --- could vanish if footmisc uses a hook |
| 1151 |
% footmisc.sty |
| 1152 |
\UseHook{fnmark/end} |
| 1153 |
%------- |
| 1154 |
\ifhmode |
| 1155 |
\spacefactor \@x@sf \relax |
| 1156 |
\fi |
| 1157 |
% |
| 1158 |
%------- |
| 1159 |
\UseHook{fnmark/after} |
| 1160 |
%------- |
| 1161 |
} |
| 1162 |
% \end{macrocode} |
| 1163 |
% |
| 1164 |
% \begin{macrocode} |
| 1165 |
\cs_new_eq:NN \@@_footnotemark_finish: \@@_footnotemark_default_finish: |
| 1166 |
% \end{macrocode} |
| 1167 |
% \end{macro} |
| 1168 |
% |
| 1169 |
% \begin{socketdecl}{tagsupport/fnmark} |
| 1170 |
% Not a public socket but reserved for tagging. By |
| 1171 |
% default (without tagging) it uses the transparent plug. |
| 1172 |
% \begin{macrocode} |
| 1173 |
\NewTaggingSocket{fnmark}{2} |
| 1174 |
% \end{macrocode} |
| 1175 |
% \end{socketdecl} |
| 1176 |
% |
| 1177 |
% \begin{macro}[no-user-doc]{\@footnotemark} |
| 1178 |
% Here we provide the traditional \LaTeXe{} name in case it is directly used |
| 1179 |
% in some legacy class. |
| 1180 |
% \begin{macrocode} |
| 1181 |
\cs_set_eq:NN \@footnotemark \fnote_footnotemark: |
| 1182 |
% \end{macrocode} |
| 1183 |
% \end{macro} |
| 1184 |
% |
| 1185 |
% |
| 1186 |
% \subsection{The new \cs{@footnotetext} command} |
| 1187 |
% |
| 1188 |
% |
| 1189 |
% \begin{macro}[no-user-doc]{\fnote_footnotetext:n} |
| 1190 |
% |
| 1191 |
% \begin{macrocode} |
| 1192 |
\cs_new_protected:Npn \fnote_footnotetext:n #1 { |
| 1193 |
\@@_debug_footnotetext: |
| 1194 |
%------- |
| 1195 |
% ./linguex/linguex.sty |
| 1196 |
\hook_use:n {fntext/before} |
| 1197 |
%------- |
| 1198 |
% \end{macrocode} |
| 1199 |
% Execute a kernel socket for tagging. |
| 1200 |
% \begin{macrocode} |
| 1201 |
\tag_socket_use:n {fntext/begin} |
| 1202 |
% \end{macrocode} |
| 1203 |
% |
| 1204 |
% \begin{macrocode} |
| 1205 |
\socket_use:nn {fntext/process} |
| 1206 |
{ |
| 1207 |
%------- |
| 1208 |
% resetting baselinestretch ... (could be done further down) |
| 1209 |
% ./uafthesis/uafthesis.cls |
| 1210 |
% ./setspace/setspace.sty |
| 1211 |
% ./footmisc/footmisc.sty (normal) |
| 1212 |
\hook_use:n {fntext} |
| 1213 |
%------- |
| 1214 |
\reset@font |
| 1215 |
\footnotesize |
| 1216 |
%------- |
| 1217 |
% some classes use a different font size, e.g., |
| 1218 |
% ./nrc/nrc1.cls ./nrc/nrc2.cls |
| 1219 |
% but those could be done in fntext/para instead |
| 1220 |
%------- |
| 1221 |
% \end{macrocode} |
| 1222 |
% In case of sidenotes the next settings are pointless, but as they |
| 1223 |
% do not hurt (except for the \cs{hsize} setting) and are needed |
| 1224 |
% for all other cases we make them here and overwrite them for side notes |
| 1225 |
% \begin{macrocode} |
| 1226 |
\interlinepenalty\interfootnotelinepenalty |
| 1227 |
\splittopskip\footnotesep |
| 1228 |
\splitmaxdepth \dp\strutbox |
| 1229 |
\floatingpenalty \@MM |
| 1230 |
\hsize\columnwidth |
| 1231 |
\@parboxrestore |
| 1232 |
\UseTaggingSocket{para/restore} |
| 1233 |
\parindent 1em % typical default used in \@makefntext moved up here |
| 1234 |
\def\@currentcounter{footnote} |
| 1235 |
\protected@edef \@currentlabel { \p@footnote \@thefnmark } |
| 1236 |
%------- |
| 1237 |
% for altering para parameters ... |
| 1238 |
% code for resphilosophica came earlier but it could go here. |
| 1239 |
% Has the advantage that one can also overwrite \cs{@currentcounter} |
| 1240 |
% and \cs{@currentlabel} is that is necessary. |
| 1241 |
% |
| 1242 |
% ./resphilosophica/resphilosophica.cls |
| 1243 |
\hook_use:n {fntext/para} |
| 1244 |
%------- |
| 1245 |
\color@begingroup |
| 1246 |
%------- |
| 1247 |
% fnpara wants to replace \@makefntext{...} and para and side |
| 1248 |
% option of footmisc etc too ... |
| 1249 |
% so we make this a socket, because only one action can be active: |
| 1250 |
%------- |
| 1251 |
\socket_use:nn {fntext/make} |
| 1252 |
{ |
| 1253 |
%------- |
| 1254 |
% ./resphilosophica/resphilosophica.cls |
| 1255 |
%------- |
| 1256 |
\socket_use:n {fntext/begin}% |
| 1257 |
%------- |
| 1258 |
% bibarts |
| 1259 |
% fnbreak.sty |
| 1260 |
\hook_use:n {fntext/begin} |
| 1261 |
%------- |
| 1262 |
\ignorespaces |
| 1263 |
#1 |
| 1264 |
%------- |
| 1265 |
% bibarts |
| 1266 |
% fnbreak.sty |
| 1267 |
\hook_use:n {fntext/end} |
| 1268 |
%------- |
| 1269 |
% \end{macrocode} |
| 1270 |
% The socket code (by default adding a strut) has to come |
| 1271 |
% \emph{after} everything added into the hook above. |
| 1272 |
% \begin{macrocode} |
| 1273 |
\socket_use:n {fntext/end} |
| 1274 |
} |
| 1275 |
\par |
| 1276 |
\color@endgroup |
| 1277 |
} |
| 1278 |
%------- |
| 1279 |
% \end{macrocode} |
| 1280 |
% The corresponding kernel hook that ends the tagging structure if |
| 1281 |
% tagging is active. |
| 1282 |
% \begin{macrocode} |
| 1283 |
\tag_socket_use:n{fntext/end} |
| 1284 |
%------- |
| 1285 |
% ./linguex/linguex.sty |
| 1286 |
\hook_use:n {fntext/after} |
| 1287 |
%------- |
| 1288 |
} |
| 1289 |
% \end{macrocode} |
| 1290 |
% \end{macro} |
| 1291 |
% |
| 1292 |
% \begin{socketdecl}{fntext/process} |
| 1293 |
% |
| 1294 |
% \begin{macrocode} |
| 1295 |
\NewSocket {fntext/process}{1} |
| 1296 |
\NewSocketPlug{fntext/process}{default}{ \insert\footins {#1} } |
| 1297 |
\NewSocketPlug{fntext/process}{side} { \marginpar {#1} } |
| 1298 |
% \end{macrocode} |
| 1299 |
% |
| 1300 |
% \begin{macrocode} |
| 1301 |
\AssignSocketPlug{fntext/process}{default} |
| 1302 |
% \end{macrocode} |
| 1303 |
% \end{socketdecl} |
| 1304 |
% |
| 1305 |
% |
| 1306 |
% |
| 1307 |
% \begin{socketdecl}{fntext/make} |
| 1308 |
% This socket receives the \meta{text} from the \cs{footnote} or |
| 1309 |
% \cs{footnotetext} and formats it. |
| 1310 |
% \begin{macrocode} |
| 1311 |
\NewSocket {fntext/make}{1} |
| 1312 |
\NewSocketPlug{fntext/make}{default}{ \@makefntext {#1} } |
| 1313 |
% \end{macrocode} |
| 1314 |
% When running several footnotes together as a paragraph some |
| 1315 |
% additional work is necessary to unbox the individual footnotes |
| 1316 |
% recursively (see \TeX{}book algorithm in appendix~D). |
| 1317 |
% \begin{macrocode} |
| 1318 |
\NewSocketPlug{fntext/make}{para} |
| 1319 |
{ |
| 1320 |
\setbox\FN@tempboxa\hbox{\@makefntext{#1}}% |
| 1321 |
\dp\FN@tempboxa\z@ |
| 1322 |
\ht\FN@tempboxa |
| 1323 |
\dimexpr\wd\FN@tempboxa *% |
| 1324 |
\footnotebaselineskip /\columnwidth\relax |
| 1325 |
\box\FN@tempboxa |
| 1326 |
} |
| 1327 |
% \end{macrocode} |
| 1328 |
% |
| 1329 |
% \begin{macrocode} |
| 1330 |
\AssignSocketPlug{fntext/make}{default} |
| 1331 |
% \end{macrocode} |
| 1332 |
% \end{socketdecl} |
| 1333 |
% |
| 1334 |
% \begin{socketdecl}{fntext/begin} |
| 1335 |
% By default adds a strut at the start of the footnote text. |
| 1336 |
% \begin{macrocode} |
| 1337 |
\NewSocket {fntext/begin}{0} |
| 1338 |
\NewSocketPlug{fntext/begin}{default}{ \rule\z@\footnotesep } |
| 1339 |
% \end{macrocode} |
| 1340 |
% |
| 1341 |
% \begin{macrocode} |
| 1342 |
\AssignSocketPlug{fntext/begin}{default} |
| 1343 |
% \end{macrocode} |
| 1344 |
% \end{socketdecl} |
| 1345 |
% |
| 1346 |
% \begin{socketdecl}{fntext/end} |
| 1347 |
% By default adds a strut at the end of the footnote text unless we |
| 1348 |
% are no longer in hmode. |
| 1349 |
% \begin{macrocode} |
| 1350 |
\NewSocket {fntext/end}{0} |
| 1351 |
\NewSocketPlug{fntext/end}{default}{ \@finalstrut\strutbox } |
| 1352 |
% \end{macrocode} |
| 1353 |
% When running several footnotes together as a paragraph some |
| 1354 |
% additional glue has to be added between them. |
| 1355 |
% \begin{macrocode} |
| 1356 |
\NewSocketPlug{fntext/end}{para} |
| 1357 |
{% |
| 1358 |
\strut |
| 1359 |
\penalty-10\relax |
| 1360 |
\hskip\footglue |
| 1361 |
} |
| 1362 |
% \end{macrocode} |
| 1363 |
% |
| 1364 |
% \begin{macrocode} |
| 1365 |
\AssignSocketPlug{fntext/end}{default} |
| 1366 |
% \end{macrocode} |
| 1367 |
% \end{socketdecl} |
| 1368 |
% |
| 1369 |
% \begin{socketdecl}{tagsupport/fntext/begin,tagsupport/fntext/end} |
| 1370 |
% Kernel sockets for tagging. |
| 1371 |
% \begin{macrocode} |
| 1372 |
\NewTaggingSocket{fntext/begin}{0} |
| 1373 |
\NewTaggingSocket{fntext/end}{0} |
| 1374 |
% \end{macrocode} |
| 1375 |
% \end{socketdecl} |
| 1376 |
% |
| 1377 |
% Provide the name \LaTeXe{} is used to and do this unconditionally |
| 1378 |
% (no patching of class code if any). This means that if a class |
| 1379 |
% provides it own definition that gets lost and if necessary needs to |
| 1380 |
% be handled with firstaid (or updating of the class). |
| 1381 |
% \begin{macrocode} |
| 1382 |
\AddToHook{begindocument} |
| 1383 |
{ |
| 1384 |
\cs_set_eq:NN \@footnotetext \fnote_footnotetext:n |
| 1385 |
} |
| 1386 |
% \end{macrocode} |
| 1387 |
% |
| 1388 |
% |
| 1389 |
% |
| 1390 |
% |
| 1391 |
% \subsection{The new \cs{@makefntext} command} |
| 1392 |
% |
| 1393 |
% \cs{footnotemargin} is the logic implemented by footmisc. Perhaps we |
| 1394 |
% don't want to do this like that in the kernel but for now I have |
| 1395 |
% used this interface unchanged. |
| 1396 |
% \begin{macrocode} |
| 1397 |
\newdimen\footnotemargin |
| 1398 |
\footnotemargin\maxdimen % no value given |
| 1399 |
|
| 1400 |
\AtBeginDocument |
| 1401 |
{ |
| 1402 |
\ifdim \footnotemargin=\maxdimen |
| 1403 |
\setlength\footnotemargin{1.8em} |
| 1404 |
\fi |
| 1405 |
} |
| 1406 |
% \end{macrocode} |
| 1407 |
% |
| 1408 |
% |
| 1409 |
% |
| 1410 |
% |
| 1411 |
% \begin{macro}[no-user-doc]{\fnote_makefntext:n} |
| 1412 |
% \begin{macrocode} |
| 1413 |
\cs_new_protected:Npn \fnote_makefntext:n #1 { |
| 1414 |
% \end{macrocode} |
| 1415 |
% Some classes in their redefinition for \cs{@makefntext} have |
| 1416 |
% placed some paragraph parameters at this point, but those can |
| 1417 |
% equally well go into the hook \hook{fntext/para}. We therefore do |
| 1418 |
% not provide a further hook at this point. |
| 1419 |
% \begin{macrocode} |
| 1420 |
\noindent |
| 1421 |
% \end{macrocode} |
| 1422 |
% after leaving the vmode we can set the link targets. |
| 1423 |
% \begin{macrocode} |
| 1424 |
\socket_use:n{fntext/mark/link} |
| 1425 |
% \end{macrocode} |
| 1426 |
% |
| 1427 |
% \begin{macrocode} |
| 1428 |
\tag_socket_use:nnn {fntext/mark} {} { \socket_use:n {fntext/mark} } |
| 1429 |
\tag_socket_use:nnn {fntext/text} {} { \socket_use:nn {fntext/text}{#1} } |
| 1430 |
} |
| 1431 |
% \end{macrocode} |
| 1432 |
% \end{macro} |
| 1433 |
% |
| 1434 |
% \begin{socketdecl}{fntext/mark} |
| 1435 |
% A socket to typeset the mark at the start of a footnote. |
| 1436 |
% \begin{macrocode} |
| 1437 |
\NewSocket {fntext/mark}{0} |
| 1438 |
% \end{macrocode} |
| 1439 |
% The \plug{default} plug implements the logic introduced with the |
| 1440 |
% \pkg{footmisc} package. |
| 1441 |
% \begin{macrocode} |
| 1442 |
\NewSocketPlug{fntext/mark}{default}{ |
| 1443 |
\ifdim\footnotemargin>\z@ |
| 1444 |
\hb@xt@ \footnotemargin{\hss\@makefnmark} |
| 1445 |
\else |
| 1446 |
\ifdim\footnotemargin=\z@ |
| 1447 |
\llap{\@makefnmark} |
| 1448 |
\else |
| 1449 |
\ifdim\footnotemargin=-\maxdimen |
| 1450 |
\@makefnmark |
| 1451 |
\else |
| 1452 |
\llap{\hb@xt@ -\footnotemargin{\@makefnmark\hss}} |
| 1453 |
\fi |
| 1454 |
\fi |
| 1455 |
\fi |
| 1456 |
} |
| 1457 |
% \end{macrocode} |
| 1458 |
% |
| 1459 |
% \begin{macrocode} |
| 1460 |
\AssignSocketPlug{fntext/mark}{default} |
| 1461 |
% \end{macrocode} |
| 1462 |
% \end{socketdecl} |
| 1463 |
% |
| 1464 |
% \begin{socketdecl}{fntext/text} |
| 1465 |
% By default this socket does nothing special and simply processes |
| 1466 |
% its argument as provided. |
| 1467 |
% \begin{macrocode} |
| 1468 |
\NewSocket {fntext/text}{1} |
| 1469 |
% \end{macrocode} |
| 1470 |
% \end{socketdecl} |
| 1471 |
% |
| 1472 |
% |
| 1473 |
% |
| 1474 |
% \begin{socketdecl}{tagsupport/fntext/mark,tagsupport/fntext/text} |
| 1475 |
% Not a public socket but reserved for tagging. By |
| 1476 |
% default they contain the \plug{transparent} and are reassigned if tagging is active. |
| 1477 |
% \begin{macrocode} |
| 1478 |
\NewTaggingSocket{fntext/mark}{2} |
| 1479 |
\NewTaggingSocket{fntext/text}{2} |
| 1480 |
% \end{macrocode} |
| 1481 |
% \end{socketdecl} |
| 1482 |
% |
| 1483 |
% |
| 1484 |
% |
| 1485 |
% \subsubsection{Making documents use the new \cs{@makefntext}} |
| 1486 |
% |
| 1487 |
% If the definition for \cs{@makefntext} is that of the standard |
| 1488 |
% classes then replace it with \cs{fnote_makefntext:n}, otherwise |
| 1489 |
% try to patch the definition used in the class. |
| 1490 |
% |
| 1491 |
% Here is the definition the way it is in |
| 1492 |
% \texttt{classes.dtx}. Notice that (for saving space) there is no |
| 1493 |
% space after \texttt{em} to terminate the assignment. We need to |
| 1494 |
% mimic that, otherwise a test would return false even if the |
| 1495 |
% definition has not been modified. |
| 1496 |
% |
| 1497 |
% |
| 1498 |
% \begin{macro}[no-user-doc]{\old@std@class@makefntext} |
| 1499 |
% \begin{macrocode} |
| 1500 |
\newcommand\old@std@class@makefntext[1]{% |
| 1501 |
\parindent 1em% |
| 1502 |
\noindent |
| 1503 |
\hb@[email protected]{\hss\@makefnmark}#1} |
| 1504 |
% \end{macrocode} |
| 1505 |
% \end{macro} |
| 1506 |
% |
| 1507 |
% Here is the messy code for patching. Note that this is only there |
| 1508 |
% to help classes along that aren't updated yet so it does some |
| 1509 |
% minimal patching to hopefully add kernel configuration hooks in the |
| 1510 |
% right place while otherwise leaving the legacy code alone. An |
| 1511 |
% updated class would not redefine \cs{@makefntext} but simply add |
| 1512 |
% appropriate code to the provided hooks. |
| 1513 |
% |
| 1514 |
% What it does is roughly the |
| 1515 |
% following: It looks for a definition of \cs{@makefntext} of the form |
| 1516 |
%\begin{verbatim} |
| 1517 |
% {AAA \hbox BBB { CCC } DDD #1 EEE } |
| 1518 |
%\end{verbatim} |
| 1519 |
% where ``BBB'' is something like \texttt{to 1em} or similar. It then |
| 1520 |
% replaces that with |
| 1521 |
%\begin{verbatim} |
| 1522 |
% {AAA \UseTaggingSocket{fntext/mark}{}{\hbox BBB { CCC }} DDD |
| 1523 |
% \UseTaggingSocket{fntext/text}{}{#1} EEE } |
| 1524 |
%\end{verbatim} |
| 1525 |
% The patching is not very careful, i.e., it assumes there is only |
| 1526 |
% one \verb=#1= in the replacement text and that the first \cs{hbox} found |
| 1527 |
% is the right one to patch. But that is enough to cater for all |
| 1528 |
% definitions of \cs{@makefntext} out there in the TL distribution. |
| 1529 |
% |
| 1530 |
% If \cs{hbox} is not found it tries the same looking for |
| 1531 |
% \cs{hb@xt@} which is what some classes use and if that is not |
| 1532 |
% found either it assume that this is a version that uses |
| 1533 |
% \cs{@makefnmark} without surrounding it in a box and if that |
| 1534 |
% fails it gives up with an \cs{ERROR} (which needs to get a proper definition). |
| 1535 |
% \begin{macrocode} |
| 1536 |
\tl_new:N \l_@@_patch_tl |
| 1537 |
\cs_new_eq:NN \@@_tmp:w \ERROR |
| 1538 |
|
| 1539 |
\cs_new_protected:Npn \@@_patch: |
| 1540 |
{ |
| 1541 |
\tl_set:No \l_@@_patch_tl { \@makefntext { \UseTaggingSocket{fntext/text}{}{##1} } } |
| 1542 |
\tl_if_in:NnTF \l_@@_patch_tl { \hbox } |
| 1543 |
{ \cs_set_eq:NN \@@_tmp:w \@@_patch_hbox:w } |
| 1544 |
{ |
| 1545 |
\tl_if_in:NnTF \l_@@_patch_tl { \hb@xt@ } |
| 1546 |
{ \cs_set_eq:NN \@@_tmp:w \@@_patch_hb@xt@:w } |
| 1547 |
{ |
| 1548 |
% \end{macrocode} |
| 1549 |
% Some styles/classes use \verb=\makebox[...][...]= instead of \cs{hb@xt@} |
| 1550 |
% so try to patch those too. |
| 1551 |
% \begin{macrocode} |
| 1552 |
\tl_if_in:NnTF \l_@@_patch_tl { \makebox } |
| 1553 |
{ \cs_set_eq:NN \@@_tmp:w \@@_patch_makebox:w } |
| 1554 |
{ |
| 1555 |
\tl_if_in:NnTF \l_@@_patch_tl { \@makefnmark } |
| 1556 |
{ \cs_set_eq:NN \@@_tmp:w \@@_patch_@makefnmark:w } |
| 1557 |
{ \ERROR |
| 1558 |
\cs_set_eq:NN \@@_tmp:w \exp_stop_f: } |
| 1559 |
} |
| 1560 |
} |
| 1561 |
} |
| 1562 |
\tl_set:Nf \l_@@_patch_tl |
| 1563 |
{ \exp_after:wN \@@_tmp:w \l_@@_patch_tl } |
| 1564 |
\cs_set:Npn \@@_tmp:w { \long \def \@makefntext ####1 } |
| 1565 |
\exp_after:wN \@@_tmp:w \exp_after:wN { \l_@@_patch_tl } |
| 1566 |
} |
| 1567 |
% \end{macrocode} |
| 1568 |
% |
| 1569 |
% If \cs{@makefntext} contains \cs{hbox} then grab ``AAA'' as |
| 1570 |
% \verb=#1= and ``BBB'' (up to the open \texttt{\{}) and return it as |
| 1571 |
%\begin{verbatim} |
| 1572 |
% AAA \@makefntext@processX { \hbox BBB } |
| 1573 |
%\end{verbatim} |
| 1574 |
% |
| 1575 |
% \begin{macrocode} |
| 1576 |
\cs_new:Npn \@@_patch_hbox:w #1 \hbox #2 # |
| 1577 |
{ \exp_stop_f: #1 \@makefntext@processX { \hbox #2 } } |
| 1578 |
% \end{macrocode} |
| 1579 |
% Same for the other cases. |
| 1580 |
% \begin{macrocode} |
| 1581 |
\cs_new:Npn \@@_patch_hb@xt@:w #1 \hb@xt@ #2 # |
| 1582 |
{ \exp_stop_f: #1 \@makefntext@processX { \hb@xt@ #2 } } |
| 1583 |
% \end{macrocode} |
| 1584 |
% |
| 1585 |
% \begin{macrocode} |
| 1586 |
\cs_new:Npn \@@_patch_makebox:w #1 \makebox #2 # |
| 1587 |
{ \exp_stop_f: #1 \@makefntext@processX { \makebox #2 } } |
| 1588 |
% \end{macrocode} |
| 1589 |
% |
| 1590 |
% If the definition contains neither \cs{hbox}, \cs{hb@xt@} nor \cs{makebox}, |
| 1591 |
% we see if it contains \cs{@makefnmark} and if so put the socket |
| 1592 |
% before that. |
| 1593 |
% \begin{macrocode} |
| 1594 |
\cs_new:Npn \@@_patch_@makefnmark:w #1 \@makefnmark |
| 1595 |
{ \exp_stop_f: #1 \@makefntext@processX { \use:n } { \@makefnmark } } |
| 1596 |
% \end{macrocode} |
| 1597 |
% |
| 1598 |
% The code provided by Bruno above expects 2 arguments but we need a |
| 1599 |
% different structure so this is a simple reshuffling. Would be |
| 1600 |
% better if we can patch the right structure in directly, but I'm |
| 1601 |
% not a patch person, so this is the simple way out for now: |
| 1602 |
% |
| 1603 |
% \begin{macrocode} |
| 1604 |
\cs_new:Npn \@makefntext@processX #1#2 |
| 1605 |
{ |
| 1606 |
\socket_use:n{fntext/mark/link} |
| 1607 |
\UseTaggingSocket{fntext/mark}{}{#1{#2}} |
| 1608 |
} |
| 1609 |
% \end{macrocode} |
| 1610 |
% |
| 1611 |
% At \verb=\begin{document}= check if the current definition is |
| 1612 |
% that of the standard classes and if so replace it by |
| 1613 |
% \cs{fnote_makefntext:n} otherwise try and patch the definition |
| 1614 |
% made by some class or package using the approach above. |
| 1615 |
% \changes{0.80}{2025-07-04}{Do nothing if is it already \cs{fnote_makefntext:n}} |
| 1616 |
% \begin{macrocode} |
| 1617 |
|
| 1618 |
\AddToHook{begindocument} |
| 1619 |
{ |
| 1620 |
\cs_if_eq:NNF\@makefntext \fnote_makefntext:n |
| 1621 |
{ |
| 1622 |
\cs_if_eq:NNTF \@makefntext \old@std@class@makefntext |
| 1623 |
{ |
| 1624 |
\cs_set_eq:NN \@makefntext \fnote_makefntext:n |
| 1625 |
} |
| 1626 |
{ |
| 1627 |
% \end{macrocode} |
| 1628 |
% If \cs{@makefntext} contains the definition from \pkg{footmisc} |
| 1629 |
% we do nothing, otherwise we try to patch. |
| 1630 |
% \begin{macrocode} |
| 1631 |
\cs_if_eq:NNF \@makefntext \footmisc@hang@makefntext |
| 1632 |
{ \@@_patch: } |
| 1633 |
} |
| 1634 |
} |
| 1635 |
} |
| 1636 |
|
| 1637 |
|
| 1638 |
% possibly add the following to check for multiple \hbox in |
| 1639 |
% the definition: |
| 1640 |
% |
| 1641 |
% \seq_set_split:NnV \l_@@_patch_seq { \hbox } \l_@@_patch_tl |
| 1642 |
% \int_compare:nT { \seq_count:N \l_@@_patch_seq } > 2 \ERROR |
| 1643 |
% |
| 1644 |
% \end{macrocode} |
| 1645 |
% |
| 1646 |
% \subsection{Document-level commands} |
| 1647 |
% |
| 1648 |
% \begin{macro}[no-user-doc]{\footnotetext} |
| 1649 |
% \begin{macrocode} |
| 1650 |
\DeclareDocumentCommand\footnotetext {o+m} |
| 1651 |
{ |
| 1652 |
\fnote_set_fnmark:nn {#1} \@mpfn |
| 1653 |
\@footnotetext {#2} |
| 1654 |
} |
| 1655 |
% \end{macrocode} |
| 1656 |
% \end{macro} |
| 1657 |
% |
| 1658 |
% |
| 1659 |
% \begin{macro}[no-user-doc]{\footnote} |
| 1660 |
% \begin{macrocode} |
| 1661 |
\DeclareDocumentCommand\footnote {o+m} |
| 1662 |
{ |
| 1663 |
\fnote_step_fnmark:nn {#1} \@mpfn |
| 1664 |
\cs_set_eq:NN \@@_footnotemark_finish: \prg_do_nothing: |
| 1665 |
\@footnotemark |
| 1666 |
\cs_set_eq:NN \@@_footnotemark_finish: \@@_footnotemark_default_finish: |
| 1667 |
\@footnotetext {#2} |
| 1668 |
\@@_footnotemark_finish: |
| 1669 |
} |
| 1670 |
% \end{macrocode} |
| 1671 |
% \end{macro} |
| 1672 |
% |
| 1673 |
|
| 1674 |
% \begin{macro}[no-user-doc]{\footnotemark} |
| 1675 |
% \begin{macrocode} |
| 1676 |
\DeclareDocumentCommand\footnotemark {o} |
| 1677 |
{ |
| 1678 |
\fnote_step_fnmark:nn {#1} { footnote } |
| 1679 |
\@footnotemark |
| 1680 |
} |
| 1681 |
% \end{macrocode} |
| 1682 |
% \end{macro} |
| 1683 |
|
| 1684 |
% \begin{macro}[no-user-doc]{\footref} |
| 1685 |
% \cs{footref} used the starred \cs{ref} in \cs{@thefnmark} |
| 1686 |
% as the linking is handled by the tagging code inside |
| 1687 |
% the \cs{@footnotemark}. |
| 1688 |
% \cs{footref} should not try to link to its related |
| 1689 |
% note automatically but should instead use the label. |
| 1690 |
% This is passed to \cs{@footnotemark} through |
| 1691 |
% \cs{l__fnote_currentlabel_tl}. |
| 1692 |
% |
| 1693 |
% \begin{macrocode} |
| 1694 |
\DeclareDocumentCommand\footref {m} |
| 1695 |
{ |
| 1696 |
\begingroup |
| 1697 |
\unrestored@protected@xdef\@thefnmark{\ref*{#1}}% |
| 1698 |
\endgroup |
| 1699 |
\bool_set_false:N \l_@@_autodetect_bool |
| 1700 |
\tl_set:Nn \l_@@_currentlabel_tl {#1} |
| 1701 |
\@footnotemark |
| 1702 |
\bool_set_true:N \l_@@_autodetect_bool |
| 1703 |
} |
| 1704 |
% \end{macrocode} |
| 1705 |
% \end{macro} |
| 1706 |
% |
| 1707 |
% |
| 1708 |
% \subsection{Firstaid for packages and classes} |
| 1709 |
% |
| 1710 |
% \subsection{Kernel patches} |
| 1711 |
% Tagging of footnotes in minipages require a change in the minipage commands |
| 1712 |
% We define at first a local configuration command for minipage footnotes. |
| 1713 |
% |
| 1714 |
% \begin{macrocode} |
| 1715 |
\NewSocketPlug{fntext/process}{mp} |
| 1716 |
{ |
| 1717 |
\global\setbox\@mpfootins\vbox{% |
| 1718 |
\unvbox\@mpfootins |
| 1719 |
#1 |
| 1720 |
} |
| 1721 |
} |
| 1722 |
% \end{macrocode} |
| 1723 |
% |
| 1724 |
% \subsubsection{\pkg{memoir}} |
| 1725 |
% The \pkg{memoir} class redefines various internal commands to inject its |
| 1726 |
% hooks and additional code. The following reinstates the kernel command and |
| 1727 |
% so probably breaks various options of \pkg{memoir}, but without the |
| 1728 |
% changes it errors anyway. The \pkg{footmisc} package should be used to change |
| 1729 |
% for example to para footnotes. |
| 1730 |
% |
| 1731 |
% \begin{macrocode} |
| 1732 |
\AddToHook{class/memoir/before} |
| 1733 |
{ \let\new@std@class@makecol\@makecol } |
| 1734 |
\AddToHook{class/memoir/after} |
| 1735 |
{ |
| 1736 |
\cs_set_eq:NN \@footnotemark \fnote_footnotemark: |
| 1737 |
\cs_set_eq:NN \@makefntext\old@std@class@makefntext |
| 1738 |
\cs_set_eq:NN \@makecol\new@std@class@makecol |
| 1739 |
} |
| 1740 |
% \end{macrocode} |
| 1741 |
% |
| 1742 |
% \subsubsection{\pkg{setspace}} |
| 1743 |
% |
| 1744 |
% It should not overwrite it any longer but use a hook, so for now we |
| 1745 |
% do just that here. |
| 1746 |
% \begin{macrocode} |
| 1747 |
\AddToHook{package/setspace/after} |
| 1748 |
{\let \@footnotetext \fnote_footnotetext:n |
| 1749 |
\AddToHook{fntext}[setspace]{\let\baselinestretch\setspace@singlespace}} |
| 1750 |
% \end{macrocode} |
| 1751 |
% |
| 1752 |
% |
| 1753 |
% \subsubsection{\pkg{hyperref}} |
| 1754 |
% |
| 1755 |
% hyperref has a hook which allows to disable its footnote |
| 1756 |
% related patches. As we will handle links directly in the code |
| 1757 |
% this is used. |
| 1758 |
% |
| 1759 |
% \begin{macrocode} |
| 1760 |
\def\hyper@nopatch@footnote{} |
| 1761 |
% \end{macrocode} |
| 1762 |
% We use the hyperref commands for now for links. To avoid |
| 1763 |
% to have to test for hyperref we provide dummies. |
| 1764 |
% TODO consider to use specials to get similar spacing. |
| 1765 |
% \begin{macrocode} |
| 1766 |
\AtBeginDocument |
| 1767 |
{ |
| 1768 |
\providecommand\hyper@linkstart{\@gobbletwo} |
| 1769 |
\providecommand\hyper@linkend{\@empty} |
| 1770 |
} |
| 1771 |
% \end{macrocode} |
| 1772 |
% |
| 1773 |
% It must be possible to suppress the hyperlinking, both locally |
| 1774 |
% and globally. hyperref should set the boolean \cs{l_fnote_link_bool}. |
| 1775 |
% For now we test for the hyperref boolean (so it can be suppressed only globally). |
| 1776 |
% \begin{macrocode} |
| 1777 |
\AtBeginDocument |
| 1778 |
{ |
| 1779 |
\@ifpackageloaded{hyperref} |
| 1780 |
{ |
| 1781 |
\AssignSocketPlug{fnmark/link}{link} |
| 1782 |
\AssignSocketPlug{fntext/mark/link}{link} |
| 1783 |
\legacy_if:nF{Hy@hyperfootnotes}{\bool_set_false:N \l_fnote_link_bool} |
| 1784 |
} |
| 1785 |
{ |
| 1786 |
\bool_set_false:N \l_fnote_link_bool |
| 1787 |
} |
| 1788 |
} |
| 1789 |
% \end{macrocode} |
| 1790 |
% |
| 1791 |
% \subsection{Tagging and hyperlink code} |
| 1792 |
% |
| 1793 |
% \begin{variable}{\g_fnote_id_int} |
| 1794 |
% For links we need an unique id to identify footnote marks and footnotes. |
| 1795 |
% It is increased both for the mark in the text and the note below |
| 1796 |
% (similar to the structure numbers). |
| 1797 |
% We make it public to allow the implementation of other footnote commands, |
| 1798 |
% see the test-tnote-setup test. |
| 1799 |
% The int is increased in the fntext/before hook, |
| 1800 |
% so that the following tagging socket can pick it up. |
| 1801 |
% TODO: check if the hook is the right place or if this should be static code. |
| 1802 |
% \begin{macrocode} |
| 1803 |
\int_new:N \g_fnote_id_int |
| 1804 |
\AddToHook{fntext/before}{\int_gincr:N\g_fnote_id_int} |
| 1805 |
% \end{macrocode} |
| 1806 |
% \end{variable} |
| 1807 |
% |
| 1808 |
% \begin{macrocode} |
| 1809 |
|
| 1810 |
% \end{macrocode} |
| 1811 |
% \subsubsection{Rolemap for structure tags} |
| 1812 |
% We use role-mapping to get more speaking names |
| 1813 |
% in the PDF and so ease debugging. These names are already |
| 1814 |
% provided by tagpdf directly. |
| 1815 |
% |
| 1816 |
% \subsubsection{Extending the label system} |
| 1817 |
% For \cs{footref} and (perhaps later for labeled footnotes) |
| 1818 |
% we must extend the label system. |
| 1819 |
% Beside the normal values we also need the structure number and id of the note. |
| 1820 |
% We use the in-built label hook to record properties. |
| 1821 |
% We define two suitable properties: the one stores the structure number as stored in |
| 1822 |
% \cs{l_@@_currentstruct_tl}, the other the id. |
| 1823 |
% \begin{macrocode} |
| 1824 |
\property_new:nnnn {fnote/struct}{now}{1}{\l_@@_currentstruct_tl} |
| 1825 |
\property_new:nnnn {fnote/id}{now}{1}{\int_use:N\g_fnote_id_int} |
| 1826 |
% \end{macrocode} |
| 1827 |
% |
| 1828 |
% We add a hook to the label hook. By default it does nothing |
| 1829 |
% \begin{macro}{\@@_label_hook:e} |
| 1830 |
% \begin{macrocode} |
| 1831 |
\cs_new_protected:Npn \@@_label_hook:e #1 {} |
| 1832 |
\AddToHookWithArguments{label}{ \@@_label_hook:e{#1}} |
| 1833 |
% \end{macrocode} |
| 1834 |
% \end{macro} |
| 1835 |
% Inside a footnotetext we change the hook to store the structure number and id too. |
| 1836 |
% The name of label is provided as argument in the label hook. |
| 1837 |
% \begin{macrocode} |
| 1838 |
\AddToHook{fntext/begin} |
| 1839 |
{ |
| 1840 |
\cs_set_protected:Npn \@@_label_hook:e #1 |
| 1841 |
{ |
| 1842 |
\property_record:ee {@@/#1} {fnote/struct,fnote/id} |
| 1843 |
} |
| 1844 |
} |
| 1845 |
% \end{macrocode} |
| 1846 |
% |
| 1847 |
% \subsubsection{Storing and retrieving reference data} |
| 1848 |
% To establish the connection between a mark and a note |
| 1849 |
% the mark has to store its representation, and the |
| 1850 |
% note has to analyse the stored representations to get |
| 1851 |
% the structure numbers of its mark. This is done |
| 1852 |
% with the public function to allow similar systems (e.g. |
| 1853 |
% tabular notes, other footnote series) to make use of this. |
| 1854 |
% |
| 1855 |
% |
| 1856 |
% \begin{macro}{\fnote_class_new:nn} |
| 1857 |
% This sets up a new footnote type, the first argument |
| 1858 |
% is the name, the second is meant for options. Currently |
| 1859 |
% it does nothing at all. |
| 1860 |
% It is not necessary to set up every footnote |
| 1861 |
% command as its own type! |
| 1862 |
% |
| 1863 |
% \begin{macrocode} |
| 1864 |
\cs_new_protected:Npn \fnote_class_new:nn #1 #2 % #1 name, #2 options |
| 1865 |
{ |
| 1866 |
\prop_new:c { g_@@_currentmarks_struct_#1_prop } |
| 1867 |
\prop_new:c { g_@@_currentmarks_id_#1_prop } |
| 1868 |
} |
| 1869 |
|
| 1870 |
\fnote_class_new:nn {default}{} |
| 1871 |
% \end{macrocode} |
| 1872 |
% \end{macro} |
| 1873 |
% |
| 1874 |
% |
| 1875 |
% \begin{macro}{\fnote_mark_id_gput:nn,\fnote_mark_struct_gput:nn} |
| 1876 |
% This commands takes as argument the |
| 1877 |
% representation of the mark, |
| 1878 |
% e.g., \cs{@thefnmark} and the type (typically default should work). |
| 1879 |
% \begin{macrocode} |
| 1880 |
\cs_new_protected:Npn \fnote_mark_struct_gput:nn #1 #2 % #1 the representation of the mark, #2 type |
| 1881 |
{ |
| 1882 |
\prop_gput:cen { g_@@_currentmarks_struct_#2_prop } |
| 1883 |
{ \tag_get:n{struct_num} } |
| 1884 |
{ #1 } |
| 1885 |
} |
| 1886 |
\cs_new_protected:Npn \fnote_mark_id_gput:nn #1 #2 % #1 the representation of the mark, #2 type |
| 1887 |
{ |
| 1888 |
\prop_gput:cen { g_@@_currentmarks_id_#2 _prop } |
| 1889 |
{ \int_use:N\g_fnote_id_int } |
| 1890 |
{ #1 } |
| 1891 |
} |
| 1892 |
\cs_generate_variant:Nn \fnote_mark_struct_gput:nn {no,oo} |
| 1893 |
\cs_generate_variant:Nn \fnote_mark_id_gput:nn {no,oo} |
| 1894 |
% \end{macrocode} |
| 1895 |
% \end{macro} |
| 1896 |
% |
| 1897 |
% |
| 1898 |
% \begin{macro}{\fnote_mark_gpop_all:nnnN} |
| 1899 |
% This command takes as first argument either id or struct, |
| 1900 |
% then representation of the mark |
| 1901 |
% (e.g. the content of\cs{@thefnmark}), the class (typically |default| should work) |
| 1902 |
% and a sequence into which every key in the property |
| 1903 |
% is stored that has the same value as the mark. The sequence is cleared first. |
| 1904 |
% \begin{macrocode} |
| 1905 |
\cs_new_protected:Npn \fnote_mark_gpop_all:nnnN #1 #2 #3 #4 |
| 1906 |
{ |
| 1907 |
\seq_clear:N #4 |
| 1908 |
\prop_set_eq:Nc \l_@@_tmpa_prop { g_@@_currentmarks_#1_#3_prop } |
| 1909 |
\prop_map_inline:Nn \l_@@_tmpa_prop |
| 1910 |
{ |
| 1911 |
\tl_if_eq:nnT {#2} { ##2 } |
| 1912 |
{ |
| 1913 |
% \end{macrocode} |
| 1914 |
% store the key (struct num or id) in the seq |
| 1915 |
% \begin{macrocode} |
| 1916 |
\seq_put_right:Nn #4 { ##1 } |
| 1917 |
% \end{macrocode} |
| 1918 |
% remove entry as used from the global prop |
| 1919 |
% \begin{macrocode} |
| 1920 |
\prop_gremove:cn { g_@@_currentmarks_#1_#3_prop } {##1} |
| 1921 |
} |
| 1922 |
} |
| 1923 |
} |
| 1924 |
\cs_generate_variant:Nn\fnote_mark_gpop_all:nnnN {nooN} |
| 1925 |
% \end{macrocode} |
| 1926 |
% \end{macro} |
| 1927 |
% |
| 1928 |
% |
| 1929 |
% |
| 1930 |
% |
| 1931 |
% \subsubsection{Enabling tagging and links for the mark command} |
| 1932 |
% |
| 1933 |
% \begin{socketdecl}{fnmark/link} |
| 1934 |
% A socket that contains the code to surround the mark in the text with a link. |
| 1935 |
% It should be used in the second argument of the tagging socket as we normally |
| 1936 |
% want the link to be inside the Lbl structure. |
| 1937 |
% |
| 1938 |
% \begin{macrocode} |
| 1939 |
\NewSocket{fnmark/link}{1} |
| 1940 |
% \end{macrocode} |
| 1941 |
% \end{socketdecl} |
| 1942 |
% |
| 1943 |
% \begin{plugdecl}{link} |
| 1944 |
% To handle the link around the mark we define a plug for the socket fnmark/link |
| 1945 |
% \begin{macrocode} |
| 1946 |
\NewSocketPlug{fnmark/link}{link} |
| 1947 |
{ |
| 1948 |
\int_gincr:N\g_fnote_id_int |
| 1949 |
\bool_if:NTF \l_@@_autodetect_bool |
| 1950 |
{ |
| 1951 |
\fnote_mark_id_gput:oo {\@thefnmark}{\l_fnote_type_tl} |
| 1952 |
\tl_set:Ne \l_@@_linktarget_tl {footnote*.\int_use:N\g_fnote_id_int} |
| 1953 |
} |
| 1954 |
{ |
| 1955 |
\tl_set:Ne \l_@@_linktarget_tl |
| 1956 |
{footnote*.\property_ref:ee {@@/\l_@@_currentlabel_tl} {fnote/id}} |
| 1957 |
} |
| 1958 |
\bool_if:NTF \l_fnote_link_bool |
| 1959 |
{ |
| 1960 |
\exp_args:No |
| 1961 |
\hyper@linkstart |
| 1962 |
{ \l_fnote_link_type_tl } |
| 1963 |
{ \l_@@_linktarget_tl } |
| 1964 |
#1 |
| 1965 |
\hyper@linkend |
| 1966 |
} |
| 1967 |
{ #1 } |
| 1968 |
} |
| 1969 |
% \end{macrocode} |
| 1970 |
% \end{plugdecl} |
| 1971 |
% \begin{plugdecl}{FEMark} |
| 1972 |
% |
| 1973 |
% To handle the mark in the text, we define a special plug for |
| 1974 |
% the socket \socket{tagsupport/fnmark} that receives |
| 1975 |
% \cs{@makefntext} as its argument. At this time \cs{@thefnmark} |
| 1976 |
% is already set. |
| 1977 |
% |
| 1978 |
% \begin{macrocode} |
| 1979 |
\NewTaggingSocketPlug{fnmark}{FEMark} |
| 1980 |
{ |
| 1981 |
% \end{macrocode} |
| 1982 |
% End an open mc and start the structure. |
| 1983 |
% \begin{macrocode} |
| 1984 |
\tag_mc_end_push: |
| 1985 |
\tag_struct_begin:n { tag=footnotemark } |
| 1986 |
% \end{macrocode} |
| 1987 |
% The associated note is either auto detected |
| 1988 |
% or given by the user. |
| 1989 |
% If there is no autodetecting we need some id, |
| 1990 |
% currently it is called \cs{l_@@_currentlabel_tl}. |
| 1991 |
% the Ref is set by looking at the label value. |
| 1992 |
% We must also add the current structure number to the \texttt{/Ref} of the FEnote. |
| 1993 |
% Both must be delayed as we don't know if the objects of the FEnote and the mark |
| 1994 |
% have already been created. |
| 1995 |
% \begin{macrocode} |
| 1996 |
\bool_if:NF \l_@@_autodetect_bool |
| 1997 |
{ |
| 1998 |
\hook_gput_code:nne {tagpdf/finish/before} {tagpdf/footnote} |
| 1999 |
{ |
| 2000 |
\exp_not:N\fnote_gput_refs:ee |
| 2001 |
{ \tag_get:n{struct_num} } |
| 2002 |
{ \property_ref:ee{ @@/\l_@@_currentlabel_tl } {fnote/struct} } |
| 2003 |
} |
| 2004 |
} |
| 2005 |
% \end{macrocode} |
| 2006 |
% And now the actual content |
| 2007 |
% \begin{macrocode} |
| 2008 |
\tag_mc_begin:n{tag=Lbl} |
| 2009 |
% \end{macrocode} |
| 2010 |
% For the auto detecting we store the struct num |
| 2011 |
% and \cs{@thefnmark} inside a prop |
| 2012 |
% TODO: this should be usable for other footnote types |
| 2013 |
% which means the name of the prop shouldn't be fix. |
| 2014 |
% \begin{macrocode} |
| 2015 |
\bool_if:NT \l_@@_autodetect_bool |
| 2016 |
{ |
| 2017 |
\fnote_mark_struct_gput:oo {\@thefnmark}{\l_fnote_type_tl} |
| 2018 |
} |
| 2019 |
% \end{macrocode} |
| 2020 |
% The target in the footnote will use the current id. |
| 2021 |
% This part is needed even if tagging is deactivated. |
| 2022 |
% \begin{macrocode} |
| 2023 |
#2 |
| 2024 |
\tag_mc_end: |
| 2025 |
\tag_struct_end: |
| 2026 |
\tag_mc_begin_pop:n{} |
| 2027 |
} |
| 2028 |
% \end{macrocode} |
| 2029 |
% At last assign the plug: |
| 2030 |
% \begin{macrocode} |
| 2031 |
\AssignTaggingSocketPlug{fnmark}{FEMark} |
| 2032 |
% \end{macrocode} |
| 2033 |
% \end{plugdecl} |
| 2034 |
% |
| 2035 |
% |
| 2036 |
% |
| 2037 |
% |
| 2038 |
% \subsubsection{The footnote text} |
| 2039 |
|
| 2040 |
% We need a public command to append values to the Ref keys |
| 2041 |
% \begin{macro}[no-user-doc]{\@@_gput_ref:nn,\fnote_gput_refs:nn,\fnote_gput_refs:ee} |
| 2042 |
% \begin{macrocode} |
| 2043 |
\cs_new_protected:Npn \@@_gput_ref:nn #1 #2 %#1 the structure number receiving the ref #2 |
| 2044 |
{ |
| 2045 |
\tag_struct_gput:nnn {#1}{ref_num}{#2} |
| 2046 |
} |
| 2047 |
\cs_new_protected:Npn \fnote_gput_refs:nn #1 #2 % pair of structure numbers |
| 2048 |
{ |
| 2049 |
\@@_gput_ref:nn {#1}{#2} |
| 2050 |
\@@_gput_ref:nn {#2}{#1} |
| 2051 |
} |
| 2052 |
\cs_generate_variant:Nn \fnote_gput_refs:nn {ee} |
| 2053 |
% \end{macrocode} |
| 2054 |
% \end{macro} |
| 2055 |
% |
| 2056 |
% kernel hooks for tagging |
| 2057 |
% this sets the structure around the whole text |
| 2058 |
% |
| 2059 |
% |
| 2060 |
% \begin{plugdecl}{FENote} |
| 2061 |
% \begin{macrocode} |
| 2062 |
\NewTaggingSocketPlug{fntext/begin}{FENote} |
| 2063 |
{ |
| 2064 |
% \end{macrocode} |
| 2065 |
% The id has been increased in the previous fntext/before hook. |
| 2066 |
% \begin{macrocode} |
| 2067 |
\tag_mc_end_push: |
| 2068 |
% \end{macrocode} |
| 2069 |
% test if a footnote is allowed, if not move up to the next sect or |
| 2070 |
% the document structure. |
| 2071 |
% \begin{macrocode} |
| 2072 |
\tag_check_child:nnTF {FENote}{pdf2} |
| 2073 |
{ |
| 2074 |
\tag_struct_begin:n { tag=footnote } |
| 2075 |
} |
| 2076 |
{ |
| 2077 |
\tag_struct_begin:n |
| 2078 |
{ |
| 2079 |
tag=footnote, |
| 2080 |
% \end{macrocode} |
| 2081 |
% We add 0 for now to ensure to get a number even if the sec code is not loaded |
| 2082 |
% or if the seq is empty (which it shouldn't unless there is an coding error) |
| 2083 |
% \begin{macrocode} |
| 2084 |
parent=\int_max:nn{2}{\tag_get:n{current_Sect}+0} |
| 2085 |
} |
| 2086 |
} |
| 2087 |
% \end{macrocode} |
| 2088 |
% Store the current structure number for labels. |
| 2089 |
% \begin{macrocode} |
| 2090 |
\tl_set:Ne \l_@@_currentstruct_tl { \tag_get:n{struct_num} } |
| 2091 |
% \end{macrocode} |
| 2092 |
% |
| 2093 |
% After we have opened the structure we can use the |struct num| to |
| 2094 |
% try to detect the connected marks. As with the marks we assume that sometimes |
| 2095 |
% no auto detection is done. |
| 2096 |
% \begin{macrocode} |
| 2097 |
\bool_if:NTF \l_@@_autodetect_bool |
| 2098 |
{ |
| 2099 |
% \end{macrocode} |
| 2100 |
% Find open marks with identical \cs{@thefnmark}: |
| 2101 |
% \begin{macrocode} |
| 2102 |
\fnote_mark_gpop_all:nooN {struct}{ \@thefnmark }{ \l_fnote_type_tl } \l_@@_currentrefs_seq |
| 2103 |
% \end{macrocode} |
| 2104 |
% Then we store the object numbers of the marks in the /Ref of the FENote structure |
| 2105 |
% and the number of the FEnote into the marks structure: |
| 2106 |
% \begin{macrocode} |
| 2107 |
\seq_map_inline:Nn \l_@@_currentrefs_seq |
| 2108 |
{ |
| 2109 |
\fnote_gput_refs:ee {##1}{ \l_@@_currentstruct_tl } |
| 2110 |
} |
| 2111 |
} |
| 2112 |
% \end{macrocode} |
| 2113 |
% If no auto detection is done |
| 2114 |
% \begin{NOTE}{UF} |
| 2115 |
% TODO: decide what to do here: some label in the optional argument? |
| 2116 |
% or refer to \cs{footref} |
| 2117 |
% \end{NOTE} |
| 2118 |
% \begin{macrocode} |
| 2119 |
{%no auto |
| 2120 |
|
| 2121 |
} |
| 2122 |
} |
| 2123 |
% \end{macrocode} |
| 2124 |
% This finish the setup of the tagging structure. |
| 2125 |
% \end{plugdecl} |
| 2126 |
% |
| 2127 |
% \begin{plugdecl}{FENote} |
| 2128 |
% This is the plug for the socket at the end of the structure. |
| 2129 |
% \begin{macrocode} |
| 2130 |
\NewTaggingSocketPlug{fntext/end}{FENote} |
| 2131 |
{ |
| 2132 |
\tag_struct_end: |
| 2133 |
\tag_mc_begin_pop:n{} |
| 2134 |
} |
| 2135 |
% \end{macrocode} |
| 2136 |
%\end{plugdecl} |
| 2137 |
% At last assign the plugs: |
| 2138 |
% \begin{macrocode} |
| 2139 |
\AssignTaggingSocketPlug{fntext/begin}{FENote} |
| 2140 |
\AssignTaggingSocketPlug{fntext/end}{FENote} |
| 2141 |
% \end{macrocode} |
| 2142 |
% |
| 2143 |
% |
| 2144 |
% |
| 2145 |
% \begin{socketdecl}{fntext/mark/link} |
| 2146 |
% This socket adds targets for links before the mark of the footnote in the note text. |
| 2147 |
% It should be used in hmode. |
| 2148 |
% \begin{macrocode} |
| 2149 |
\NewSocket{fntext/mark/link}{0} |
| 2150 |
% \end{macrocode} |
| 2151 |
% \end{socketdecl} |
| 2152 |
% \begin{plugdecl}{link} |
| 2153 |
% We create a link target for every related mark. The name is |
| 2154 |
% \texttt{footnote*.}\meta{id}. We also add a link |
| 2155 |
% target for the current id (for \cs{footref}). |
| 2156 |
% TODO: perhaps it should be always active. |
| 2157 |
% \begin{macrocode} |
| 2158 |
\NewSocketPlug{fntext/mark/link}{link} |
| 2159 |
{ |
| 2160 |
\fnote_mark_gpop_all:nooN {id}{ \@thefnmark }{ \l_fnote_type_tl } \l_@@_currentrefs_seq |
| 2161 |
\seq_map_inline:Nn\l_@@_currentrefs_seq {\MakeLinkTarget*{footnote*.##1}} |
| 2162 |
\MakeLinkTarget*{footnote*.\int_use:N\g_fnote_id_int} |
| 2163 |
} |
| 2164 |
% \end{macrocode} |
| 2165 |
% \end{plugdecl} |
| 2166 |
% |
| 2167 |
% The kernel socket \socket{tagsupport/fntext/mark} is responsible for |
| 2168 |
% tagging the mark in the note. We use it to surround |
| 2169 |
% the mark with the needed tagging commands. |
| 2170 |
% |
| 2171 |
% TODO check if additional kernel configuration points are needed. |
| 2172 |
% If yes, what about the paragraph start and the paratagging?? |
| 2173 |
|
| 2174 |
% \begin{plugdecl}{FENoteLbl} |
| 2175 |
% This plug creates the label in the note on the bottom. |
| 2176 |
% It also adds link targets for the hyperlinking. |
| 2177 |
% \begin{macrocode} |
| 2178 |
\NewTaggingSocketPlug{fntext/mark}{FENoteLbl} |
| 2179 |
{ |
| 2180 |
\tag_mc_end_push: |
| 2181 |
% \end{macrocode} |
| 2182 |
% Now we add the tagging commands. We move the structure of the label to |
| 2183 |
% the begin of the footnote structure. |
| 2184 |
% \begin{macrocode} |
| 2185 |
\tag_struct_begin:n { tag=footnotelabel,parent=\l_@@_currentstruct_tl,firstkid } |
| 2186 |
\tag_mc_begin:n { tag=Lbl } |
| 2187 |
#2 |
| 2188 |
\tag_mc_end: |
| 2189 |
\tag_struct_end: |
| 2190 |
\tag_mc_begin_pop:n{} |
| 2191 |
} |
| 2192 |
% \end{macrocode} |
| 2193 |
% |
| 2194 |
% \begin{macrocode} |
| 2195 |
\AssignSocketPlug{tagsupport/fntext/mark}{FENoteLbl} |
| 2196 |
% \end{macrocode} |
| 2197 |
% \end{plugdecl} |
| 2198 |
% |
| 2199 |
% |
| 2200 |
% \begin{plugdecl}{FENotetext} |
| 2201 |
% |
| 2202 |
% This plug is for the kernel socket \socket{tagsupport/fntext/text} |
| 2203 |
% around the actual note text when doing tagging. |
| 2204 |
% Currently it only adds an MC chunk. |
| 2205 |
% |
| 2206 |
% TODO Should it set a mc or could it rely on the content? |
| 2207 |
% \begin{macrocode} |
| 2208 |
\NewTaggingSocketPlug{fntext/text}{FENotetext} |
| 2209 |
{ |
| 2210 |
\tag_mc_end_push: |
| 2211 |
\tag_mc_begin:n{} |
| 2212 |
#2 |
| 2213 |
\tag_mc_end: |
| 2214 |
\tag_mc_begin_pop:n{} |
| 2215 |
} |
| 2216 |
% \end{macrocode} |
| 2217 |
% |
| 2218 |
% \begin{macrocode} |
| 2219 |
\AssignTaggingSocketPlug{fntext/text}{FENotetext} |
| 2220 |
% \end{macrocode} |
| 2221 |
% \end{plugdecl} |
| 2222 |
%------------------------------------- |
| 2223 |
|
| 2224 |
% \begin{macrocode} |
| 2225 |
\ExplSyntaxOff |
| 2226 |
%</kernel> |
| 2227 |
% \end{macrocode} |
| 2228 |
% \begin{macrocode} |
| 2229 |
%<@@=> |
| 2230 |
% \end{macrocode} |
| 2231 |
% |
| 2232 |
% \section{Reimplementing the \pkg{footmisc} package} |
| 2233 |
% |
| 2234 |
% \begin{macrocode} |
| 2235 |
%<*footmisc> |
| 2236 |
%% |
| 2237 |
%% Copyright (c) 1995-2011 Robin Fairbairns |
| 2238 |
%% Copyright (c) 2018-2023 Robin Fairbairns, Frank Mittelbach |
| 2239 |
%% |
| 2240 |
%% This file is part of the `latex-lab Bundle'. |
| 2241 |
%% -------------------------------------------- |
| 2242 |
%% |
| 2243 |
%% It may be distributed and/or modified under the |
| 2244 |
%% conditions of the LaTeX Project Public License, either version 1.3c |
| 2245 |
%% of this license or (at your option) any later version. |
| 2246 |
%% The latest version of this license is in |
| 2247 |
%% https://www.latex-project.org/lppl.txt |
| 2248 |
%% and version 1.3c or later is part of all distributions of LaTeX |
| 2249 |
%% version 2008 or later. |
| 2250 |
%% |
| 2251 |
%% This work has the LPPL maintenance status 'maintained'. |
| 2252 |
%% |
| 2253 |
\NeedsTeXFormat{LaTeX2e} |
| 2254 |
\providecommand\DeclareRelease[3]{} |
| 2255 |
\providecommand\DeclareCurrentRelease[2]{} |
| 2256 |
|
| 2257 |
\DeclareRelease{v5}{2011-06-06}{footmisc-2011-06-06.sty} |
| 2258 |
\DeclareCurrentRelease{}{2022-02-14} |
| 2259 |
\ProvidesPackage{latex-lab-footmisc}% |
| 2260 |
[2025/02/20 v6.0e |
| 2261 |
a miscellany of footnote facilities -- latex-lab version% |
| 2262 |
] |
| 2263 |
|
| 2264 |
\NeedsTeXFormat{LaTeX2e}[2020/10/01] |
| 2265 |
\newtoks\FN@temptoken |
| 2266 |
\providecommand\protected@writeaux{% |
| 2267 |
\protected@write\@auxout |
| 2268 |
} |
| 2269 |
\def\l@advance@macro{\@@dvance@macro\edef} |
| 2270 |
\def\@@dvance@macro#1#2#3{\expandafter\@tempcnta#2\relax |
| 2271 |
\advance\@tempcnta#3\relax |
| 2272 |
#1#2{\the\@tempcnta}% |
| 2273 |
} |
| 2274 |
\let\@advance@macro\l@advance@macro |
| 2275 |
\DeclareOption{symbol}{\renewcommand\thefootnote{\fnsymbol{footnote}}} |
| 2276 |
\newif\ifFN@robust \FN@robustfalse |
| 2277 |
\DeclareOption{symbol*}{% |
| 2278 |
\renewcommand\thefootnote{\@fnsymbol\c@footnote}% |
| 2279 |
\FN@robusttrue |
| 2280 |
\AtEndOfPackage{\setfnsymbol{lamport*-robust}}% |
| 2281 |
} |
| 2282 |
\newif\ifFN@para \FN@parafalse |
| 2283 |
\DeclareOption{para}{% |
| 2284 |
% \end{macrocode} |
| 2285 |
% Options are executed in the order of declaration, thus no point in |
| 2286 |
% checking for side option as footmisc did in the past |
| 2287 |
% \begin{macrocode} |
| 2288 |
% \PackageError{footmisc}{Option "\CurrentOption" incompatible with |
| 2289 |
% option "side"}% |
| 2290 |
% {I shall ignore "\CurrentOption"}% |
| 2291 |
\FN@paratrue |
| 2292 |
\setlength\footnotemargin{-\maxdimen} % default when para is used |
| 2293 |
} |
| 2294 |
% \end{macrocode} |
| 2295 |
% |
| 2296 |
% \begin{macrocode} |
| 2297 |
\DeclareOption{side}{\ifFN@para |
| 2298 |
\PackageError{footmisc}{Option "\CurrentOption" incompatible with |
| 2299 |
option "para"}% |
| 2300 |
{I shall ignore "\CurrentOption"}% |
| 2301 |
\else |
| 2302 |
\AddToHook{fntext/para}{% |
| 2303 |
\hsize\marginparwidth % correct the default \hsize |
| 2304 |
\footnotesep\z@ % don't add a default separation |
| 2305 |
} |
| 2306 |
\AssignSocketPlug{fntext/process}{side} |
| 2307 |
% \AssignSocketPlug{fntext/make}{default} |
| 2308 |
\AssignSocketPlug{fntext/begin}{noop} |
| 2309 |
\AssignSocketPlug{fntext/end}{noop} |
| 2310 |
\fi |
| 2311 |
} |
| 2312 |
\let\footnotelayout\@empty |
| 2313 |
\DeclareOption{ragged}{% |
| 2314 |
\@ifundefined{RaggedRight}% |
| 2315 |
{\renewcommand\footnotelayout{\linepenalty50 \raggedright}}% |
| 2316 |
{\renewcommand\footnotelayout{\linepenalty50 \RaggedRight}}% |
| 2317 |
} |
| 2318 |
\newif\ifFN@perpage |
| 2319 |
\FN@perpagefalse |
| 2320 |
\DeclareOption{perpage}{% |
| 2321 |
\FN@perpagetrue |
| 2322 |
} |
| 2323 |
\newif\ifFN@fixskip \FN@fixskipfalse |
| 2324 |
|
| 2325 |
\let\FN@bottomcases\thr@@ |
| 2326 |
\newif\ifFN@abovefloats \FN@abovefloatstrue |
| 2327 |
\DeclareOption{bottom}{% |
| 2328 |
\let\FN@bottomcases\@ne |
| 2329 |
\FN@abovefloatsfalse |
| 2330 |
\FN@fixskiptrue |
| 2331 |
} |
| 2332 |
\DeclareOption{bottomfloats}{% |
| 2333 |
\let\FN@bottomcases\tw@ |
| 2334 |
\FN@abovefloatstrue \FN@fixskiptrue |
| 2335 |
} |
| 2336 |
\DeclareOption{abovefloats}{\FN@abovefloatstrue \FN@fixskiptrue} |
| 2337 |
\DeclareOption{belowfloats}{\FN@abovefloatsfalse \FN@fixskiptrue} |
| 2338 |
\DeclareOption{marginal}{% |
| 2339 |
\footnotemargin-0.8em\relax |
| 2340 |
} |
| 2341 |
\DeclareOption{flushmargin}{% |
| 2342 |
\footnotemargin0pt\relax |
| 2343 |
} |
| 2344 |
\newif\ifFN@hangfoot \FN@hangfootfalse |
| 2345 |
\DeclareOption{hang}{% |
| 2346 |
\FN@hangfoottrue |
| 2347 |
} |
| 2348 |
\newcommand*\hangfootparskip{0.5\baselineskip} |
| 2349 |
\newcommand*\hangfootparindent{0em}% |
| 2350 |
\DeclareOption{norule}{% |
| 2351 |
\renewcommand\footnoterule{}% |
| 2352 |
\advance\skip\footins 4\p@\@plus2\p@\relax |
| 2353 |
} |
| 2354 |
\DeclareOption{splitrule}{% |
| 2355 |
\gdef\split@prev{0} |
| 2356 |
\let\pagefootnoterule\footnoterule |
| 2357 |
\let\mpfootnoterule\footnoterule |
| 2358 |
\def\splitfootnoterule{\kern-3\p@ \hrule \kern2.6\p@} |
| 2359 |
\def\footnoterule{\relax |
| 2360 |
\ifx \@listdepth\@mplistdepth |
| 2361 |
\mpfootnoterule |
| 2362 |
\else |
| 2363 |
\ifnum\split@prev=\z@ |
| 2364 |
\pagefootnoterule |
| 2365 |
\else |
| 2366 |
\splitfootnoterule |
| 2367 |
\fi |
| 2368 |
\xdef\split@prev{\the\insertpenalties}% |
| 2369 |
\fi |
| 2370 |
}% |
| 2371 |
} |
| 2372 |
\newif\ifFN@stablefootnote \FN@stablefootnotefalse |
| 2373 |
\DeclareOption{stable}{\FN@stablefootnotetrue} |
| 2374 |
\newif\ifFN@multiplefootnote \FN@multiplefootnotefalse |
| 2375 |
\DeclareOption{multiple}{\FN@multiplefootnotetrue} |
| 2376 |
\ProcessOptions |
| 2377 |
% \end{macrocode} |
| 2378 |
% |
| 2379 |
% Footnote box layout for para footnotes; |
| 2380 |
% this would also be the hook to support dblfootnotes (from the |
| 2381 |
% \texttt{dblfnote} package if we integrate that). |
| 2382 |
% \begin{macrocode} |
| 2383 |
\ifFN@para |
| 2384 |
\NewSocketPlug{build/column/footnotes}{para}{% |
| 2385 |
\global\setbox\footins\vbox{\FN@makefootnoteparagraph}% |
| 2386 |
} |
| 2387 |
\AssignSocketPlug{build/column/footnotes}{para} |
| 2388 |
\fi |
| 2389 |
% \end{macrocode} |
| 2390 |
% |
| 2391 |
% \begin{macrocode} |
| 2392 |
\ifFN@fixskip |
| 2393 |
\def\@outputbox@removebskip{% |
| 2394 |
\ifx\@textbottom\relax \else |
| 2395 |
\@outputbox@append{% |
| 2396 |
\@tempskipa\lastskip |
| 2397 |
\ifnum \gluestretchorder\@tempskipa>\z@ |
| 2398 |
\vskip-\@tempskipa |
| 2399 |
\xdef\@outputbox@reinsertbskip |
| 2400 |
{\noexpand\@outputbox@append{\vskip\the\@tempskipa}}% |
| 2401 |
\else |
| 2402 |
\global\let\@outputbox@reinsertbskip\relax |
| 2403 |
\fi |
| 2404 |
}% |
| 2405 |
\fi |
| 2406 |
} |
| 2407 |
\let\@outputbox@reinsertbskip\relax |
| 2408 |
\else |
| 2409 |
\let\@outputbox@removebskip \relax |
| 2410 |
\let\@outputbox@reinsertbskip\relax |
| 2411 |
\fi |
| 2412 |
% \end{macrocode} |
| 2413 |
% |
| 2414 |
% |
| 2415 |
% \begin{macrocode} |
| 2416 |
\ifcase \FN@bottomcases\relax |
| 2417 |
\ERROR |
| 2418 |
\or %1 bottom option |
| 2419 |
\ifFN@abovefloats |
| 2420 |
\AssignSocketPlug {build/column/outputbox}{space-footnotes-floats} |
| 2421 |
\else |
| 2422 |
\AssignSocketPlug {build/column/outputbox}{floats-space-footnotes} |
| 2423 |
\fi |
| 2424 |
\or %2 bottomfloats |
| 2425 |
\ifFN@abovefloats |
| 2426 |
\AssignSocketPlug {build/column/outputbox}{footnotes-space-floats} |
| 2427 |
\else |
| 2428 |
\AssignSocketPlug {build/column/outputbox}{space-floats-footnotes} |
| 2429 |
\fi |
| 2430 |
\or %3 neither bottom nor bottomfloats |
| 2431 |
\ifFN@abovefloats |
| 2432 |
\AssignSocketPlug {build/column/outputbox}{footnotes-floats} |
| 2433 |
\else |
| 2434 |
\AssignSocketPlug {build/column/outputbox}{floats-footnotes} |
| 2435 |
\fi |
| 2436 |
\else |
| 2437 |
\ERROR |
| 2438 |
\fi |
| 2439 |
|
| 2440 |
% next can be dropped when cleaned up |
| 2441 |
\newif\ifFN@setspace |
| 2442 |
\@ifpackageloaded{setspace}% |
| 2443 |
{% |
| 2444 |
\FN@setspacetrue |
| 2445 |
\@ifclassloaded{memoir}% |
| 2446 |
{% |
| 2447 |
\AddToHook{fntext}{\let\baselinestretch\m@m@singlespace}% |
| 2448 |
\let\FN@baselinestretch\m@m@singlespace |
| 2449 |
}% |
| 2450 |
{% |
| 2451 |
% \AddToHook{fntext}{\let\baselinestretch\setspace@singlespace}% |
| 2452 |
\let\FN@baselinestretch\setspace@singlespace |
| 2453 |
}% |
| 2454 |
}% |
| 2455 |
{% |
| 2456 |
\FN@setspacefalse |
| 2457 |
} |
| 2458 |
|
| 2459 |
|
| 2460 |
|
| 2461 |
\ifFN@para |
| 2462 |
|
| 2463 |
% \AssignSocketPlug{fntext/process}{default} |
| 2464 |
\AssignSocketPlug{fntext/make}{para} |
| 2465 |
\AssignSocketPlug{fntext/begin}{noop} |
| 2466 |
\AssignSocketPlug{fntext/end}{para} |
| 2467 |
|
| 2468 |
\fi |
| 2469 |
|
| 2470 |
|
| 2471 |
|
| 2472 |
\ifFN@para |
| 2473 |
\let\FN@tempboxa\@tempboxa |
| 2474 |
\newbox\FN@tempboxb |
| 2475 |
\newbox\FN@tempboxc |
| 2476 |
\newskip\footglue \footglue=1em plus.3em minus.3em |
| 2477 |
|
| 2478 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2479 |
\newdimen\footnotebaselineskip |
| 2480 |
|
| 2481 |
% establish late: |
| 2482 |
|
| 2483 |
\AddToHook{begindocument/before} {% |
| 2484 |
{% |
| 2485 |
\footnotesize |
| 2486 |
\global\footnotebaselineskip=\normalbaselineskip |
| 2487 |
}% |
| 2488 |
} |
| 2489 |
% \end{macrocode} |
| 2490 |
% The coding is based on David Kastrup's improvement to Don Knuth's |
| 2491 |
% original implementation. You find in the \TeX{}book if you own |
| 2492 |
% the latest edition. |
| 2493 |
% \begin{macrocode} |
| 2494 |
|
| 2495 |
\long\def\FN@makefootnoteparagraph{% |
| 2496 |
\FN@setfootnoteparawidth |
| 2497 |
\@parboxrestore |
| 2498 |
\baselineskip=\footnotebaselineskip |
| 2499 |
\unvbox\footins \FN@removehboxes |
| 2500 |
\RawParEnd |
| 2501 |
} |
| 2502 |
\def\FN@removehboxes{\setbox\FN@tempboxa\lastbox |
| 2503 |
\ifhbox\FN@tempboxa{\FN@removehboxes}% |
| 2504 |
\unhbox\FN@tempboxa |
| 2505 |
\else |
| 2506 |
\RawNoindent |
| 2507 |
\rule\z@\footnotesep |
| 2508 |
\fi |
| 2509 |
} |
| 2510 |
\fi |
| 2511 |
|
| 2512 |
|
| 2513 |
\@ifpackageloaded{multicol} |
| 2514 |
{\def\FN@setfootnoteparawidth |
| 2515 |
{\hsize\ifnum\doublecol@number>\@ne |
| 2516 |
\textwidth |
| 2517 |
\else \columnwidth \fi}} |
| 2518 |
{\def\FN@setfootnoteparawidth{\hsize\columnwidth}} |
| 2519 |
|
| 2520 |
\ifFN@perpage |
| 2521 |
\RequirePackage{perpage} |
| 2522 |
\MakePerPage{footnote} |
| 2523 |
% \end{macrocode} |
| 2524 |
% Fix a bug in perpage \ldots |
| 2525 |
% \begin{macrocode} |
| 2526 |
\def\@stpelt#1{\global\csname c@#1\endcsname \m@ne |
| 2527 |
\stepcounter{#1}% |
| 2528 |
\pp@fix@MakePerPage{#1}% |
| 2529 |
} |
| 2530 |
\def\pp@fix@MakePerPage#1{% |
| 2531 |
\ifnum \value{#1}>\z@ |
| 2532 |
\addtocounter{#1}\m@ne\fi |
| 2533 |
} |
| 2534 |
% \end{macrocode} |
| 2535 |
% The above code may look a bit odd: the \cs{stepcounter} sets the |
| 2536 |
% counter to zero and then we alter it if it is not zero. The |
| 2537 |
% reason is that \cs{stepcounter} resets other counters and when |
| 2538 |
% perpage is loaded this results in updating counters on the reset |
| 2539 |
% list to 1 (or to a higher starting value if \cs{MakePerPage} is |
| 2540 |
% used with an optional argument, which is precisely the problem |
| 2541 |
% here). By subtracting 1 in that case we set it back to 1 lower |
| 2542 |
% than the starting value. |
| 2543 |
% |
| 2544 |
% But to make this fully work we also need to update a support |
| 2545 |
% command in \pkg{perpage}: |
| 2546 |
% \begin{macrocode} |
| 2547 |
\def\pp@cl@end@iii\stepcounter#1\pp@fix@MakePerPage#2{} |
| 2548 |
\fi |
| 2549 |
|
| 2550 |
|
| 2551 |
\ifFN@para |
| 2552 |
|
| 2553 |
% This can use the default interface, except that a negative value for |
| 2554 |
% \footnotemargin makes little sense, so we test for this and warn if |
| 2555 |
% necessary. But -\maxdimen is ok again, so would need to be a little bit more elaborate. |
| 2556 |
% |
| 2557 |
|
| 2558 |
%\AddToHook{fntext/para}{ |
| 2559 |
% \ifdim \footnotemargin >\z@ \else |
| 2560 |
% \PackageWarningNoline{footmisc}{Option 'para' needs positive \noexpand\footnotemargin}% |
| 2561 |
% \footnotemargin 1.8em\relax |
| 2562 |
% \fi |
| 2563 |
%} |
| 2564 |
|
| 2565 |
|
| 2566 |
\AddToHook{fntext/begin}{\nobreak \hspace{.2em}} |
| 2567 |
|
| 2568 |
\else |
| 2569 |
|
| 2570 |
\ifFN@hangfoot |
| 2571 |
\long\def\footmisc@hang@makefntext#1{% |
| 2572 |
\bgroup |
| 2573 |
\SuspendTagging{footmisc}% |
| 2574 |
\setbox\@tempboxa\hbox{% |
| 2575 |
\ifdim\footnotemargin>\z@ |
| 2576 |
\hb@xt@\footnotemargin{\@makefnmark\hss}% |
| 2577 |
\else |
| 2578 |
\@makefnmark |
| 2579 |
\fi |
| 2580 |
}% |
| 2581 |
\leftmargin\wd\@tempboxa |
| 2582 |
\rightmargin\z@ |
| 2583 |
\linewidth \columnwidth |
| 2584 |
\advance \linewidth -\leftmargin |
| 2585 |
\parshape \@ne \leftmargin \linewidth |
| 2586 |
\footnotesize |
| 2587 |
\parskip\hangfootparskip\relax |
| 2588 |
% \end{macrocode} |
| 2589 |
% The setting of \cs{parindent} has to happen prior to calling |
| 2590 |
% \cs{leavevmode} (which happens below to support |
| 2591 |
% tagging). Originally, this was done later so was moved here where |
| 2592 |
% we haven't started hmode yet. |
| 2593 |
% \begin{macrocode} |
| 2594 |
\parindent\hangfootparindent\relax |
| 2595 |
\@setpar{{\@@par}}% |
| 2596 |
\ResumeTagging{footmisc}% |
| 2597 |
\leavevmode |
| 2598 |
% \end{macrocode} |
| 2599 |
% after leaving the vmode we can set the link targets. They should |
| 2600 |
% be in the footnote structure. |
| 2601 |
% \begin{macrocode} |
| 2602 |
\UseSocket{fntext/mark/link}% |
| 2603 |
% \end{macrocode} |
| 2604 |
% Typesetting the mark twice means that one can't have any material |
| 2605 |
% inside that gets unhappy in that case. That shouldn't be a |
| 2606 |
% problem, but perhaps we have to come up with a more elaborate |
| 2607 |
% solution in the end. |
| 2608 |
% \begin{macrocode} |
| 2609 |
\UseTaggingSocket{fntext/mark}{}% |
| 2610 |
{\llap{% |
| 2611 |
\ifdim\footnotemargin>\z@ |
| 2612 |
\hb@xt@\footnotemargin{\@makefnmark\hss}% |
| 2613 |
\else |
| 2614 |
\@makefnmark |
| 2615 |
\fi |
| 2616 |
}}% |
| 2617 |
\footnotelayout#1% |
| 2618 |
\par |
| 2619 |
\egroup |
| 2620 |
} |
| 2621 |
% \end{macrocode} |
| 2622 |
% Defined in a roundabout way so that we can test for it when |
| 2623 |
% patching classes that are not updated. |
| 2624 |
% \begin{macrocode} |
| 2625 |
\let \@makefntext \footmisc@hang@makefntext |
| 2626 |
|
| 2627 |
\else |
| 2628 |
|
| 2629 |
% This is now using the default interface: |
| 2630 |
% |
| 2631 |
% \long\def\@makefntext#1{% |
| 2632 |
% \parindent1em |
| 2633 |
% \noindent |
| 2634 |
% \ifdim\footnotemargin>\z@ |
| 2635 |
% \hb@xt@ \footnotemargin{\hss\@makefnmark}% |
| 2636 |
% \else |
| 2637 |
% \ifdim\footnotemargin=\z@ |
| 2638 |
% \llap{\@makefnmark}% |
| 2639 |
% \else |
| 2640 |
% \llap{\hb@xt@ -\footnotemargin{\@makefnmark\hss}}% |
| 2641 |
% \fi |
| 2642 |
% \fi |
| 2643 |
% \footnotelayout#1% |
| 2644 |
% } |
| 2645 |
|
| 2646 |
\fi |
| 2647 |
\fi |
| 2648 |
|
| 2649 |
|
| 2650 |
|
| 2651 |
|
| 2652 |
\ifFN@multiplefootnote |
| 2653 |
\providecommand*{\multiplefootnotemarker}{3sp} |
| 2654 |
% \end{macrocode} |
| 2655 |
% |
| 2656 |
% We tag the separator as artifact |
| 2657 |
% \fmi{why is this done with \cs{providecommand}?} |
| 2658 |
% \begin{macrocode} |
| 2659 |
\ExplSyntaxOn |
| 2660 |
\providecommand*{\multfootsep}{\tag_mc_end_push:\tag_mc_begin:n{artifact},\tag_mc_end:\tag_mc_begin_pop:n{}} |
| 2661 |
\ExplSyntaxOff |
| 2662 |
\AddToHook{fnmark} {\FN@mf@check} |
| 2663 |
\AddToHook{fnmark/end} {\FN@mf@prepare} |
| 2664 |
% |
| 2665 |
\def\FN@mf@prepare{% |
| 2666 |
\kern-\multiplefootnotemarker |
| 2667 |
\kern\multiplefootnotemarker\relax |
| 2668 |
} |
| 2669 |
\def\FN@mf@check{% |
| 2670 |
\ifdim\lastkern=\multiplefootnotemarker\relax |
| 2671 |
%?? is that necessary or even correct ?? |
| 2672 |
\edef\@x@sf{\the\spacefactor}% |
| 2673 |
%?? shouldn't that be 2 unkerns ?? (none would also be ok) |
| 2674 |
\unkern % new |
| 2675 |
\unkern |
| 2676 |
\textsuperscript{\multfootsep}% |
| 2677 |
\spacefactor\@x@sf\relax |
| 2678 |
\fi |
| 2679 |
} |
| 2680 |
\else |
| 2681 |
\let\FN@mf@prepare\relax |
| 2682 |
\fi |
| 2683 |
\ifFN@stablefootnote |
| 2684 |
\let\FN@sf@@footnote\footnote |
| 2685 |
\def\footnote{\ifx\protect\@typeset@protect |
| 2686 |
\expandafter\FN@sf@@footnote |
| 2687 |
\else |
| 2688 |
\expandafter\FN@sf@gobble@opt |
| 2689 |
\fi |
| 2690 |
} |
| 2691 |
\edef\FN@sf@gobble@opt{\noexpand\protect |
| 2692 |
\expandafter\noexpand\csname FN@sf@gobble@opt \endcsname} |
| 2693 |
\expandafter\def\csname FN@sf@gobble@opt \endcsname{% |
| 2694 |
\@ifnextchar[%] |
| 2695 |
\FN@sf@gobble@twobracket |
| 2696 |
\@gobble |
| 2697 |
} |
| 2698 |
\def\FN@sf@gobble@twobracket[#1]#2{} |
| 2699 |
\let\FN@sf@@footnotemark\footnotemark |
| 2700 |
\def\footnotemark{\ifx\protect\@typeset@protect |
| 2701 |
\expandafter\FN@sf@@footnotemark |
| 2702 |
\else |
| 2703 |
\expandafter\FN@sf@gobble@optonly |
| 2704 |
\fi |
| 2705 |
} |
| 2706 |
\edef\FN@sf@gobble@optonly{\noexpand\protect |
| 2707 |
\expandafter\noexpand\csname FN@sf@gobble@optonly \endcsname} |
| 2708 |
\expandafter\def\csname FN@sf@gobble@optonly \endcsname{% |
| 2709 |
\@ifnextchar[%] |
| 2710 |
\FN@sf@gobble@bracket |
| 2711 |
{}% |
| 2712 |
} |
| 2713 |
\def\FN@sf@gobble@bracket[#1]{} |
| 2714 |
\fi |
| 2715 |
\newcommand\setfnsymbol[1]{% |
| 2716 |
\@bsphack |
| 2717 |
\@ifundefined{FN@fnsymbol@#1}% |
| 2718 |
{% |
| 2719 |
\PackageError{footmisc}{Symbol style "#1" not known}% |
| 2720 |
\@eha |
| 2721 |
}{% |
| 2722 |
\expandafter\let\expandafter\@fnsymbol\csname |
| 2723 |
FN@fnsymbol@#1\endcsname |
| 2724 |
}% |
| 2725 |
\@esphack |
| 2726 |
} |
| 2727 |
\let\FN@fnsymbol@lamport\@fnsymbol |
| 2728 |
\newif\if@tempswb |
| 2729 |
\DeclareDocumentCommand\DefineFNsymbols {smO{text}m}{% |
| 2730 |
\expandafter\ifx\csname FN@fnsymbol@#2\endcsname\relax |
| 2731 |
\PackageInfo{footmisc}{Declaring symbol style #2}% |
| 2732 |
\else |
| 2733 |
\PackageWarning{footmisc}{Redeclaring symbol style #2}% |
| 2734 |
\fi |
| 2735 |
\toks@{}% |
| 2736 |
\def\@tempb{\end}% |
| 2737 |
\FN@build@symboldef#4\end |
| 2738 |
\def\@tempc{math}% |
| 2739 |
\def\@tempd{#3}% |
| 2740 |
\expandafter\xdef\csname FN@fnsymbol@#2\endcsname##1{% |
| 2741 |
\ifx\@tempc\@tempd |
| 2742 |
\noexpand\ensuremath |
| 2743 |
\else |
| 2744 |
\noexpand\nfss@text |
| 2745 |
\fi |
| 2746 |
{% |
| 2747 |
\noexpand\ifcase##1% |
| 2748 |
\the\toks@ |
| 2749 |
\noexpand\else |
| 2750 |
\IfBooleanTF#1{\noexpand\@ctrerr}% |
| 2751 |
{\noexpand\FN@orange##1}% |
| 2752 |
\noexpand\fi |
| 2753 |
}% |
| 2754 |
}% |
| 2755 |
} |
| 2756 |
\def\FN@build@symboldef#1{% |
| 2757 |
\def\@tempa{#1}% |
| 2758 |
\ifx\@tempa\@tempb |
| 2759 |
\else |
| 2760 |
\toks@\expandafter{\the\toks@\or#1}% |
| 2761 |
\expandafter\FN@build@symboldef |
| 2762 |
\fi |
| 2763 |
} |
| 2764 |
\DeclareDocumentCommand\DefineFNsymbolsTM {smm}{% |
| 2765 |
\expandafter\ifx\csname FN@fnsymbol@#2\endcsname\relax |
| 2766 |
\PackageInfo{footmisc}{Declaring symbol style #2}% |
| 2767 |
\else |
| 2768 |
\PackageWarning{footmisc}{Redeclaring symbol style #2}% |
| 2769 |
\fi |
| 2770 |
\toks@{}% |
| 2771 |
\def\@tempb{\end}% |
| 2772 |
\FN@build@symboldefTM#3\end\@null |
| 2773 |
\expandafter\xdef\csname FN@fnsymbol@#2\endcsname##1{% |
| 2774 |
\noexpand\ifcase##1% |
| 2775 |
\the\toks@ |
| 2776 |
\noexpand\else |
| 2777 |
\IfBooleanTF#1{\noexpand\@ctrerr}% |
| 2778 |
{\noexpand\FN@orange##1}% |
| 2779 |
\noexpand\fi |
| 2780 |
}% |
| 2781 |
} |
| 2782 |
\def\FN@build@symboldefTM#1#2{% |
| 2783 |
\def\@tempa{#1}% |
| 2784 |
\ifx\@tempa\@tempb |
| 2785 |
\else |
| 2786 |
\toks@\expandafter{\the\toks@\or\TextOrMath{#1}{#2}}% |
| 2787 |
\expandafter\FN@build@symboldefTM |
| 2788 |
\fi |
| 2789 |
} |
| 2790 |
\def\FN@orange#1{% |
| 2791 |
\ifFN@robust |
| 2792 |
\@arabic#1% |
| 2793 |
\@bsphack |
| 2794 |
\PackageInfo{footmisc}{Footnote number \number#1 out of range}% |
| 2795 |
\protect\@fnsymbol@orange |
| 2796 |
\@esphack |
| 2797 |
\else \@ctrerr \fi |
| 2798 |
} |
| 2799 |
\global\let\@diagnose@fnsymbol@orange\relax |
| 2800 |
\AtEndDocument{\@diagnose@fnsymbol@orange} |
| 2801 |
\def\@fnsymbol@orange{% |
| 2802 |
\gdef\@diagnose@fnsymbol@orange{% |
| 2803 |
\PackageWarningNoLine{footmisc}{Some footnote number(s) |
| 2804 |
were out of range |
| 2805 |
\MessageBreak |
| 2806 |
see log for details% |
| 2807 |
}% |
| 2808 |
}% |
| 2809 |
} |
| 2810 |
\DefineFNsymbolsTM{bringhurst}{% |
| 2811 |
\textasteriskcentered *% |
| 2812 |
\textdagger \dagger |
| 2813 |
\textdaggerdbl \ddagger |
| 2814 |
\textsection \mathsection |
| 2815 |
\textbardbl \|% |
| 2816 |
\textparagraph \mathparagraph |
| 2817 |
}% |
| 2818 |
\DefineFNsymbolsTM{chicago}{% |
| 2819 |
\textasteriskcentered *% |
| 2820 |
\textdagger \dagger |
| 2821 |
\textdaggerdbl \ddagger |
| 2822 |
\textsection \mathsection |
| 2823 |
\textbardbl \|% |
| 2824 |
\#\#% |
| 2825 |
}% |
| 2826 |
\DefineFNsymbolsTM{wiley}{% |
| 2827 |
\textasteriskcentered *% |
| 2828 |
{\textasteriskcentered\textasteriskcentered}{**}% |
| 2829 |
\textdagger \dagger |
| 2830 |
\textdaggerdbl \ddagger |
| 2831 |
\textsection \mathsection |
| 2832 |
\textparagraph \mathparagraph |
| 2833 |
\textbardbl \|% |
| 2834 |
}% |
| 2835 |
\DefineFNsymbolsTM{lamport-robust}{% |
| 2836 |
\textasteriskcentered *% |
| 2837 |
\textdagger \dagger |
| 2838 |
\textdaggerdbl \ddagger |
| 2839 |
\textsection \mathsection |
| 2840 |
\textparagraph \mathparagraph |
| 2841 |
\textbardbl \|% |
| 2842 |
{\textasteriskcentered\textasteriskcentered}{**}% |
| 2843 |
{\textdagger\textdagger}{\dagger\dagger}% |
| 2844 |
{\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}% |
| 2845 |
} |
| 2846 |
\DefineFNsymbolsTM*{lamport*}{% |
| 2847 |
\textasteriskcentered *% |
| 2848 |
\textdagger \dagger |
| 2849 |
\textdaggerdbl \ddagger |
| 2850 |
\textsection \mathsection |
| 2851 |
\textparagraph \mathparagraph |
| 2852 |
\textbardbl \|% |
| 2853 |
{\textasteriskcentered\textasteriskcentered}{**}% |
| 2854 |
{\textdagger\textdagger}{\dagger\dagger}% |
| 2855 |
{\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}% |
| 2856 |
{\textsection\textsection}{\mathsection\mathsection}% |
| 2857 |
{\textparagraph\textparagraph}{\mathparagraph\mathparagraph}% |
| 2858 |
{\textasteriskcentered\textasteriskcentered\textasteriskcentered}{***}% |
| 2859 |
{\textdagger\textdagger\textdagger}{\dagger\dagger\dagger}% |
| 2860 |
{\textdaggerdbl\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger\ddagger}% |
| 2861 |
{\textsection\textsection\textsection}%% |
| 2862 |
{\mathsection\mathsection\mathsection}% |
| 2863 |
{\textparagraph\textparagraph\textparagraph}%% |
| 2864 |
{\mathparagraph\mathparagraph\mathparagraph}% |
| 2865 |
} |
| 2866 |
\setfnsymbol{lamport*} |
| 2867 |
\DefineFNsymbolsTM{lamport*-robust}{% |
| 2868 |
\textasteriskcentered *% |
| 2869 |
\textdagger \dagger |
| 2870 |
\textdaggerdbl \ddagger |
| 2871 |
\textsection \mathsection |
| 2872 |
\textparagraph \mathparagraph |
| 2873 |
\textbardbl \|% |
| 2874 |
{\textasteriskcentered\textasteriskcentered}{**}% |
| 2875 |
{\textdagger\textdagger}{\dagger\dagger}% |
| 2876 |
{\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}% |
| 2877 |
{\textsection\textsection}{\mathsection\mathsection}% |
| 2878 |
{\textparagraph\textparagraph}{\mathparagraph\mathparagraph}% |
| 2879 |
{\textasteriskcentered\textasteriskcentered\textasteriskcentered}{***}% |
| 2880 |
{\textdagger\textdagger\textdagger}{\dagger\dagger\dagger}% |
| 2881 |
{\textdaggerdbl\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger\ddagger}% |
| 2882 |
{\textsection\textsection\textsection}%% |
| 2883 |
{\mathsection\mathsection\mathsection}% |
| 2884 |
{\textparagraph\textparagraph\textparagraph}%% |
| 2885 |
{\mathparagraph\mathparagraph\mathparagraph}% |
| 2886 |
} |
| 2887 |
\newcommand\mpfootnotemark{% |
| 2888 |
\@ifnextchar[%] |
| 2889 |
\@xmpfootnotemark |
| 2890 |
{% |
| 2891 |
\stepcounter\@mpfn |
| 2892 |
\protected@xdef\@thefnmark{\thempfn}% |
| 2893 |
\@footnotemark |
| 2894 |
}% |
| 2895 |
} |
| 2896 |
\def\@xmpfootnotemark[#1]{% |
| 2897 |
\begingroup |
| 2898 |
\csname c@\@mpfn\endcsname #1\relax |
| 2899 |
\unrestored@protected@xdef\@thefnmark{\thempfn}% |
| 2900 |
\endgroup |
| 2901 |
\@footnotemark |
| 2902 |
} |
| 2903 |
% \end{macrocode} |
| 2904 |
% |
| 2905 |
% \begin{macrocode} |
| 2906 |
\endinput |
| 2907 |
%</footmisc> |
| 2908 |
% \end{macrocode} |
| 2909 |
% \Finale |
| 2910 |
% |