summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fnbreak/fnbreak.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-03-21 16:44:53 +0000
committerKarl Berry <karl@freefriends.org>2023-03-21 16:44:53 +0000
commit2265ce5c20cccb0d14ebdf930bd9e62ba5ce04e5 (patch)
tree454364671f9b2c5df56302a0fef09ecd256c0537 /Master/texmf-dist/source/latex/fnbreak/fnbreak.dtx
parent5bb8efa6a6fc727a01dab44dc384c4a14c3dd7f3 (diff)
fnbreak (18mar23)
git-svn-id: svn://tug.org/texlive/trunk@66615 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/fnbreak/fnbreak.dtx')
-rw-r--r--Master/texmf-dist/source/latex/fnbreak/fnbreak.dtx240
1 files changed, 130 insertions, 110 deletions
diff --git a/Master/texmf-dist/source/latex/fnbreak/fnbreak.dtx b/Master/texmf-dist/source/latex/fnbreak/fnbreak.dtx
index 1cc54cdfdad..5306cef84ce 100644
--- a/Master/texmf-dist/source/latex/fnbreak/fnbreak.dtx
+++ b/Master/texmf-dist/source/latex/fnbreak/fnbreak.dtx
@@ -1,5 +1,9 @@
-% \iffalse meta comment
-% File: fnbreak.dtx Copyright (C) 2003, 2004, 2006, 2010, 2012 Harald Harders
+% \iffalse meta-comment
+%
+% File: fnbreak.dtx
+% Copyright © 2003, 2004, 2006, 2010, 2012, 2023 Harald Harders (inactive)
+% (2023-03-18 update done by H.-Martin Münch, Martin.Muench AT Uni-Bonn.de)
+% Info: Warning for pagebreak in footnote (HH)
% \fi
%
% \iffalse
@@ -7,7 +11,7 @@
%<*driver>
\documentclass{ltxdoc}
\title{The \texttt{fnbreak} package}
-\author{Harald Harders\\\texttt{harald.harders@gmx.de}}
+\author{Harald Harders\\\texttt{harald.harders@gmx.de}\\(inactive)}
\date{Version \fileversion, \filedate, Printed \today}
\EnableCrossrefs
\CodelineIndex
@@ -15,13 +19,12 @@
\DoNotIndex{\setcounter,\space,\ifx,\else,\fi}
\CodelineNumbered
\RecordChanges
-\CheckSum{202}
\IfFileExists{fnbreak-v.tex}{%
\input{fnbreak-v.tex}
\GetFileInfo{fnbreak-v.tex}
}{%
\PackageError{fnbreak}{File fnbreak-v.tex not found,
- please\MessageBreak
+ please\MessageBreak
run `latex fnbreak.ins' first}{No additional help}%
\def\fileversion{\textbf{??}}%
\def\filedate{\textbf{??}}%
@@ -43,12 +46,12 @@
% \tableofcontents
%
% \section*{Copyright}
-% Copyright 2003, 2004, 2006, 2010, 2012 Harald Harders.
+% Copyright 2003, 2004, 2006, 2010, 2012, 2023 Harald Harders.
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
-% version 1.3 of the License, or any later version.
+% version 1.3c of the License, or any later version.
%
% \section{The user interface}
%
@@ -68,13 +71,15 @@
%\end{verbatim}
% Sometimes, complicated footnote labels are used (for example, when
% using symbols):
+% \pagebreak
+%
%\begin{verbatim}
%Package fnbreak Warning: Footnote number 1
%(fnbreak) (label `\ensuremath {*}')
%(fnbreak) has been split over different pages:
%(fnbreak) page 1 to page 2.
%\end{verbatim}
-% In some cases may complex footnote labels may prevent |fnbreak| from
+% In some cases complex footnote labels may prevent |fnbreak| from
% functioning.
% \begin{macro}{nolabel}
% \begin{macro}{label}
@@ -84,7 +89,7 @@
%\end{verbatim}
% Then the label is omitted in the warning:
%\begin{verbatim}
-%Package fnbreak Warning: Footnote number 1
+%Package fnbreak Warning: Footnote number 1
%(fnbreak) has been split over different pages:
%(fnbreak) page 1 to page 2.
%\end{verbatim}
@@ -93,7 +98,7 @@
%
% \begin{macro}{\fnbreaknolabel}
% \begin{macro}{\fnbreaklabel}
-% You may switsch on and off printing of the footnote label in the
+% You may switch on and off printing of the footnote label in the
% warnings also by using the macros \cs{fnbreaknolabel} and \cs{fnbreaklabel}.
% \end{macro}
% \end{macro}
@@ -102,13 +107,13 @@
% the footnote spans over a double page or flipsides.
% The result is shown in the warning:
%\begin{verbatim}
-%Package fnbreak Warning: Footnote number 1
+%Package fnbreak Warning: Footnote number 1
%(fnbreak) has been split over different pages (flipsides):
%(fnbreak) page 1 to page 2.
%\end{verbatim}
% or:
%\begin{verbatim}
-%Package fnbreak Warning: Footnote number 1
+%Package fnbreak Warning: Footnote number 1
%(fnbreak) has been split over different pages (double page):
%(fnbreak) page 2 to page 3.
%\end{verbatim}
@@ -124,7 +129,7 @@
% The output looks as follows:
%\begin{verbatim}
%Package fnbreak Note: Footnote number 2
-%(fnbreak) (label `2')
+%(fnbreak) (label `2')
%(fnbreak) completely on page 3.
%\end{verbatim}
% \end{macro}
@@ -132,16 +137,15 @@
%
% \begin{macro}{\fnbreaknonverbose}
% \begin{macro}{\fnbreakverbose}
-% You may switsch on and off printing footnote information for
+% You may switch on and off printing footnote information for
% non-split footnotes using the macros \cs{fnbreaknonverbose} and
% \cs{fnbreakverbose}.
% \end{macro}
% \end{macro}
%
-%
-%
% \StopEventually{\PrintChanges \PrintIndex}
%
+% \pagebreak
% \section{The implementation}
%
% The approach of this package is very simple:
@@ -151,16 +155,19 @@
%
% Heading of the package:
% \begin{macrocode}
+%<package>\NeedsTeXFormat{LaTeX2e}[2017/04/15]
%<package>\ProvidesPackage{fnbreak}
%<version>\ProvidesFile{fnbreak-v.tex}
-%<package|version> [2012/01/01 v1.30 Warning for pagebreak in footnote (HH)]
+%<package|version> [2023-03-18 v1.40 Warning for pagebreak in footnote (HH)]
%<*package>
% \end{macrocode}
% Declare an option to show not only the footnote number but also the
% label.
% \changes{1.11}{2006/05/08}{Allow commands in page number}%
% \begin{macrocode}
+
\RequirePackage{ifthen}
+
% \end{macrocode}
% Declare an option to show not only the footnote number but also the
% label.
@@ -169,12 +176,14 @@
% \begin{macrocode}
\newif\iffnb@showlabel
\newif\iffnb@verbose
+
\DeclareOption{label}{\fnb@showlabeltrue}
\DeclareOption{nolabel}{\fnb@showlabelfalse}
\DeclareOption{verbose}{\fnb@verbosetrue}
\DeclareOption{nonverbose}{\fnb@verbosefalse}
\ExecuteOptions{label,nonverbose}
\ProcessOptions\relax
+
% \end{macrocode}
% \begin{macro}{\fnbreakverbose}
% \begin{macro}{\fnbreaknonverbose}
@@ -191,33 +200,66 @@
% \begin{macrocode}
\newcommand*\fnbreaklabel{\fnb@showlabeltrue}
\newcommand*\fnbreaknolabel{\fnb@showlabelfalse}
+
% \end{macrocode}
% \end{macro}
% \end{macro}
% Define new counter and boolean for determining whether a split
-% footnote spans ofer a double page or flipsides.
+% footnote spans over a double page or flipsides.
% \changes{1.20}{2010/08/09}{Distinguish between split over double
% page or flipsides}%
% \begin{macrocode}
\newcounter{fnb@@numberpages}
+
\newif\iffnb@@isdoublepage
+
% \end{macrocode}
% Define default values in order to avoid possible problems:
% \changes{1.00}{2004/04/01}{Correct some internal macro names}%
% \begin{macrocode}
\xdef\fnb@@footnotestartnum{0}
\xdef\fnb@@footnotestartpage{0}
+\def\fnb@globalwarning{}
% \end{macrocode}
% When the aux file is read the first time (before \cs{begin\{document\}},
% do nothing:
% \begin{macrocode}
\def\fnb@footnotestart#1#2#3{}
\def\fnb@footnoteend#1#2#3{}
+
+% \end{macrocode}
+% Define command that writes the footnote start marker to the aux
+% file:
+% \begin{macrocode}
+\def\fnb@fnstart{\@bsphack
+ \protected@write\@auxout{}{%
+ \string\fnb@footnotestart{\the\c@footnote}{\thefootnote}{\thepage}%
+ }%
+ \@esphack%
+ }
+
+% \end{macrocode}
+% Define command that writes the footnote end marker to the aux file:
+% \begin{macrocode}
+\def\fnb@fnend{\@bsphack
+ \protected@write\@auxout{}{%
+ \string\fnb@footnoteend{\the\c@footnote}{\thefootnote}{\thepage}%
+ }%
+ \@esphack%
+ }
+
+% \end{macrocode}
+% Provide the command \cs{IfFormatAtLeastTF} for old \LaTeX-formats
+% which did not know it yet:
+%
+% \begin{macrocode}
+\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
+
% \end{macrocode}
% Define the working commands at \cs{begin\{document\}} in order to
% activate them when the aux file is read at the end of the document:
% \begin{macrocode}
-\AtBeginDocument{%
+\AtBeginDocument{% = \AddToHook{begindocument}
% \end{macrocode}
% If the start of a footnote has been found, just define commands
% containing the footnote number (only for debugging) and the start page:
@@ -232,8 +274,8 @@
% anymore}%
% \changes{1.00}{2004/04/01}{Use the footnote number instead of the
% label, show both in the warning}%
-% If the end of a footnote has been found, test wheather the footnote
-% numbers fit and wheather the start and end pages are the same. If
+% If the end of a footnote has been found, test whether the footnote
+% numbers fit and whether the start and end pages are the same. If
% one of the tests fails, generate a warning:\footnote{Thanks to
% Bastien Roucaries for pointing at a problem with symbol footnote
% marks.}
@@ -244,7 +286,7 @@
% \end{macrocode}
% Test if start and end refer to the same footnote.
% \begin{macrocode}
- \ifx\fnb@@footnotestartnum\fnb@@footnoteendnum
+ \ifx\fnb@@footnotestartnum\fnb@@footnoteendnum%
% \end{macrocode}
% Test if the footnote ends on the same page it has started.
% \changes{1.11}{2006/05/08}{Allow commands in page number}%
@@ -256,30 +298,31 @@
% Simulate a variant of \cs{PackageInfo} which is also written to the
% output rather than only to the log file.
% \changes{1.30}{2012/01/01}{Fix verbose mode for non-numeric labels}
+% \pagebreak
% \begin{macrocode}
- \iffnb@verbose
- \begingroup
+ \iffnb@verbose%
+ \begingroup%
\def\MessageBreak{^^J(fnbreak)\@spaces\@spaces\@spaces\@spaces}%
- \set@display@protect
+ \set@display@protect%
\immediate\write\@unused{^^JPackage fnbreak Note:%
- \space\space\space\space Footnote number #1
- \iffnb@showlabel\MessageBreak (label `#2') \fi
- \MessageBreak
+ \space\space\space\space Footnote number #1%
+ \iffnb@showlabel\MessageBreak (label `#2') \fi%
+ \MessageBreak%
completely on page #3.^^J}%
- \endgroup
- \fi
+ \endgroup%
+ \fi%
}{%
% \end{macrocode}
% No, the footnote contains a pagebreak.
%
-% If the page labels are plain numbers we can determine whether a
-% footnot spans over a double page or a flipside.\footnote{Thanks to
-% Martin M\"unch for the idea of determining double pages.}
+% If the page labels are plain (arabic) numbers we can determine whether a
+% footnote spans over a double page or a flipside.\footnote{Thanks to
+% H.-Martin Münch for the idea of determining double pages.}
% \changes{1.20}{2010/08/09}{Distinguish between split over double
% page or flipsides}%
% |fnb@@numberpages = 0| is used if the code cannot find out whether a
% footnote spans over a double page (i.\,e., for non-integer page
-% numbers or single-side documents).
+% numbers or single-sided documents).
% \begin{macrocode}
\setcounter{fnb@@numberpages}{0}%
% \end{macrocode}
@@ -288,7 +331,7 @@
% If this is not the case please report to the author including a
% minimal example file.
% \begin{macrocode}
- \if@twoside
+ \if@twoside%
% \end{macrocode}
% We can find double pages only if the start page as well as the end
% page are numbers.
@@ -306,128 +349,105 @@
% If the footnote starts on an odd page, flipside occurs in any case.
% \begin{macrocode}
\ifodd \fnb@@footnotestartpage{}%
- \fnb@@isdoublepagefalse
+ \fnb@@isdoublepagefalse%
% \end{macrocode}
% If the footnote starts on an odd page, a double page is found if the
% number of pages equals two.
% \begin{macrocode}
- \else
+ \else%
\ifnum \thefnb@@numberpages=2{}%
- \fnb@@isdoublepagetrue
+ \fnb@@isdoublepagetrue%
% \end{macrocode}
% If the number of pages is larger, flipside.
% \begin{macrocode}
- \else
- \fnb@@isdoublepagefalse
- \fi
- \fi
- \fi
- \fi
- \fi
+ \else%
+ \fnb@@isdoublepagefalse%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
% \end{macrocode}
% Print a warning.
%
-% If not determined whether a double page occurs:
+% \noindent If not determined whether a double page occurs:
% \begin{macrocode}
- \ifnum\thefnb@@numberpages=0
- \PackageWarningNoLine{fnbreak}{Footnote number #1
- \iffnb@showlabel\MessageBreak (label `#2')\fi
- \MessageBreak
- has been split over different pages:\MessageBreak
+ \ifnum\thefnb@@numberpages=0%
+ \PackageWarningNoLine{fnbreak}{Footnote number #1%
+ \iffnb@showlabel\MessageBreak (label `#2')\fi%
+ \MessageBreak%
+ has been split over different pages:\MessageBreak%
page \fnb@@footnotestartpage\space to page #3}%
% \end{macrocode}
% For a double page:
% \begin{macrocode}
- \else
- \iffnb@@isdoublepage
- \PackageWarningNoLine{fnbreak}{Footnote number #1
- \iffnb@showlabel\MessageBreak (label `#2')\fi
- \MessageBreak
- has been split over different pages (double page):\MessageBreak
+ \else%
+ \iffnb@@isdoublepage%
+ \PackageWarningNoLine{fnbreak}{Footnote number #1%
+ \iffnb@showlabel\MessageBreak (label `#2')\fi%
+ \MessageBreak%
+ has been split over different pages (double page):\MessageBreak%
page \fnb@@footnotestartpage\space to page #3}%
% \end{macrocode}
% For a flipside:
% \begin{macrocode}
- \else
- \PackageWarningNoLine{fnbreak}{Footnote number #1
- \iffnb@showlabel\MessageBreak (label `#2')\fi
- \MessageBreak
- has been split over different pages (flipside):\MessageBreak
+ \else%
+ \PackageWarningNoLine{fnbreak}{Footnote number #1%
+ \iffnb@showlabel\MessageBreak (label `#2')\fi%
+ \MessageBreak%
+ has been split over different pages (flipside):\MessageBreak%
page \fnb@@footnotestartpage\space to page #3}%
- \fi
- \fi
+ \fi%
+ \fi%
% \end{macrocode}
% Redefine the \cs{fnb@globalwarning} to print a warning at the end of
% the log file.
% \begin{macrocode}
\def\fnb@globalwarning{%
- \PackageWarningNoLine{fnbreak}{There are footnotes with a
- pagebreak.\MessageBreak
+ \PackageWarningNoLine{fnbreak}{There are footnotes with a %
+ pagebreak.\MessageBreak%
Check if they are acceptable}%
}%
}%
- \else
+ \else%
% \end{macrocode}
% This macro trys to handle different footnotes.
% This may not happen and is an internal error.
% \begin{macrocode}
- \PackageError{fnbreak}{Internal problem:\MessageBreak
- Start and stop marker of footnote do not fit:\MessageBreak
- start: \fnb@@footnotestartnum, page \fnb@@footnotestartpage,
+ \PackageError{fnbreak}{Internal problem:\MessageBreak%
+ Start and stop marker of footnote do not fit:\MessageBreak%
+ start: \fnb@@footnotestartnum, page \fnb@@footnotestartpage, %
end: #1, page #3}{%
- This error may not happen.
- Please try to make a short example which shows this behaviour
+ This error may not happen. %
+ Please try to make a short example which shows this behaviour %
and send a bug report to harald.harders@gmx.de.}%
- \fi
- }%
- }
-% \end{macrocode}
-% Define command that writes the footnote start marker to the aux
-% file:
-% \begin{macrocode}
- \def\fnb@fnstart{\@bsphack
- \protected@write\@auxout{}{%
- \string\fnb@footnotestart{\the\c@footnote}{\thefootnote}{\thepage}%
- }%
- \@esphack
- }
-% \end{macrocode}
-% Define command that writes the footnote end marker to the aux file:
-% \begin{macrocode}
- \def\fnb@fnend{\@bsphack
- \protected@write\@auxout{}{%
- \string\fnb@footnoteend{\the\c@footnote}{\thefootnote}{\thepage}%
+ \fi%
}%
- \@esphack
- }
% \end{macrocode}
% \changes{1.00}{2004/04/01}{Patch \cs{@footnotetext} instead of
% re-writing it}%
% Redefine \cs{@footnotetext} by patching the calls \cs{fnb@fnstart}
% and \cs{fnb@fnend} after all other packages have been
-% loaded.\footnote{Thanks to Bastien Roucaries for that patch}
+% loaded.\footnote{Thanks to Bastien Roucaries for that patch.}
% \begin{macrocode}
-\AtBeginDocument{%
\newcommand\fnb@orig@footnotetext{}%
- \let\fnb@orig@footnotetext\@footnotetext
+ \let\fnb@orig@footnotetext\@footnotetext%
\long\def\@footnotetext#1{\fnb@orig@footnotetext{\fnb@fnstart#1\fnb@fnend}}%
% \end{macrocode}
-% \changes{1.10}{2004/04/06}{Write a warning at the end of the log
-% file}%
-% Append \cs{fnb@globalwarning} to \cs{@dofilelist} in order to print
-% the global warning \cs{fnb@globalwarning} after all other messages,
-% e.g., the \cs{listfiles} list.
+% \changes{1.10}{2004/04/06}{Write a warning at the end of the log file}%
+% \changes{1.40}{2023-03-18}{Do not mess with \cs{@dofilelist}, use \cs{AddToHook{enddocument/info}}}%
+% Add \cs{fnb@globalwarning} to the info/warning messages
+% printed at the end of the .log file after the \cs{listfiles} list.
% \begin{macrocode}
- \newcommand\fnb@dofilelist{}%
- \let\fnb@dofilelist\@dofilelist
- \def\@dofilelist{\fnb@dofilelist\fnb@globalwarning}%
-}
-% \end{macrocode}
-% Initialise \cs{fnb@globalwarning} to print no warning by default.
-% \begin{macrocode}
-\newcommand\fnb@globalwarning{}%
-\let\fnb@globalwarning\relax
+ \IfFormatAtLeastTF{2021-11-15}{%
+ \AddToHook{enddocument/info}{\fnb@globalwarning}%
+ }{\newcommand\fnb@dofilelist{}%
+ \let\fnb@dofilelist\@dofilelist%
+ \def\@dofilelist{\fnb@dofilelist\fnb@globalwarning}%
+ }%
+ }
%</package>
% \end{macrocode}
%
% \Finale
+\endinput \ No newline at end of file