[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/bigfoot: firstaid for bigfoot (bug exists at least since 2015 but is now more likely) (8f471af5)

Frank Mittelbach frank.mittelbach at latex-project.org
Mon Mar 15 22:56:26 CET 2021


Repository : https://github.com/latex3/latex2e
On branch  : hotfix/bigfoot
Link       : https://github.com/latex3/latex2e/commit/8f471af5f15fe4063b3766b8060ceecd2596d775

>---------------------------------------------------------------

commit 8f471af5f15fe4063b3766b8060ceecd2596d775
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Mon Mar 15 22:56:26 2021 +0100

    firstaid for bigfoot (bug exists at least since 2015 but is now more likely)


>---------------------------------------------------------------

8f471af5f15fe4063b3766b8060ceecd2596d775
 required/firstaid/changes.txt                      |  8 ++++
 .../latex2e-first-aid-for-external-files.dtx       | 43 +++++++++++++++++++++-
 required/firstaid/testfiles/firstaid-bigfoot.lvt   | 38 +++++++++++++++++++
 .../firstaid/testfiles/firstaid-bigfoot.tlg        | 22 +++++++----
 support/texlive.sh                                 |  2 +
 5 files changed, 103 insertions(+), 10 deletions(-)

diff --git a/required/firstaid/changes.txt b/required/firstaid/changes.txt
index 5d70ebc2..c97129e3 100644
--- a/required/firstaid/changes.txt
+++ b/required/firstaid/changes.txt
@@ -1,3 +1,11 @@
+2021-03-15  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* latex2e-first-aid-for-external-files.dtx:
+	bigfoot incorrectly assumes insertions being ordered, so this is
+	enforced for now.
+	We also fix \FN at allmarks which can blow as it loops using the
+	wrong counter (so the loops runs a random number of times)
+
 2020-12-14  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* latex2e-first-aid-for-external-files.dtx:
diff --git a/required/firstaid/latex2e-first-aid-for-external-files.dtx b/required/firstaid/latex2e-first-aid-for-external-files.dtx
index 9dcedaf4..dd844590 100644
--- a/required/firstaid/latex2e-first-aid-for-external-files.dtx
+++ b/required/firstaid/latex2e-first-aid-for-external-files.dtx
@@ -110,8 +110,8 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\def\LaTeXFirstAidDate{2020/12/14}
-\def\LaTeXFirstAidVersion{v1.0i}
+\def\LaTeXFirstAidDate{2021/03/15}
+\def\LaTeXFirstAidVersion{v1.0j}
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -397,6 +397,45 @@
 %    \end{macrocode}
 %
 %
+% \subsection{The \pkg{bigfoot} first aid}
+%
+%    The \pkg{bigfoot} packages makes the assumption that two
+%    \cs{newinsert} allocations have a recognisable order in their
+%    numbers, the second one has a lower number. This was correct in
+%    the classic \TeX{} implementation but with the extended
+%    allocation possibilities of all modern engines is no longer the
+%    case and there is a point where the allocations take a ``jump''
+%    breaking the odering assumption. These days we are fairly close
+%    to that point and depending on how many packages are loaded
+%    before \pkg{bigfoot} the package breaks.
+%
+%    This firstaid therefore jumps over the problematical point by
+%    pushing the count allocation to a safe value if necessary.
+%    \begin{macrocode}
+\AddToHook{file/before/bigfoot.sty}{%
+   \ifnum\count10>188 %
+   \else
+     \global\count10=189 %
+   \fi
+%    \end{macrocode}
+%    We also correct a bug that \pkg{bigfoot} tries to shift mark
+%    registers, but in \LaTeX{} (at least since 2015) the allocation
+%    number is not 266, so it does that to a random number of mark
+%    registers (which sometimes blows up depending on the value in 266).
+%    \begin{macrocode}
+  \AtEndOfPackage{%
+    \def\FN at allmarks#1{\@elt{#1}%
+      \ifnum#1<\count256 %<--- problem: 266 isn't the counter for marks
+        \expandafter\FN at allmarks\expandafter{\number\numexpr#1+\@ne}%
+        \fi}%
+    }%
+}
+%    \end{macrocode}
+%
+%
+%
+%
+%
 % \subsection[Temporary fixes for the kernel (until the next
 %             patch-level release)]
 %    {Temporary fixes for the kernel \\
diff --git a/required/firstaid/testfiles/firstaid-bigfoot.lvt b/required/firstaid/testfiles/firstaid-bigfoot.lvt
new file mode 100644
index 00000000..0c099526
--- /dev/null
+++ b/required/firstaid/testfiles/firstaid-bigfoot.lvt
@@ -0,0 +1,38 @@
+\documentclass{article}
+
+\usepackage{expl3}  % make sure the backend files are loaded early
+
+\input{regression-test}
+
+\usepackage[ruled]{bigfoot}
+
+\START
+
+\DeclareNewFootnote[para]{default}
+\DeclareNewFootnote[para]{B}[alph]
+\DeclareNewFootnote[para]{C}[fnsymbol]
+\DeclareNewFootnote[para]{D}[fnsymbol]
+\DeclareNewFootnote[para]{E}[fnsymbol]
+\MakePerPage{footnoteB}\MakePerPage{footnoteC}
+
+\OMIT
+\begin{document}
+\TIMO
+
+Test
+Some text\footnote{A first.} with a
+footnote. Another sentence\footnote{Second
+  with a note.\footnoteB{A sub-note.}} with a
+footnote. Some text\footnote{A further sample.}
+with two footnotes here.\footnote{Another
+  sample\footnoteB{A controversial\footnoteC{A
+    C-level commentary on the commentary.}
+     and lengthly sub-note going on for a
+    number\footnoteC{Another commentary.} of
+    lines.\footnoteC{Final commentary.}}}
+Some more text. More text to fill up the
+pages in the example. A last note with
+notes.\footnote{Again.\footnoteB{A B-level
+ comment.\footnoteC{Being scrutinized!}}}
+
+\end{document}
diff --git a/base/testfiles/tlb0435.luatex.tlg b/required/firstaid/testfiles/firstaid-bigfoot.tlg
similarity index 54%
copy from base/testfiles/tlb0435.luatex.tlg
copy to required/firstaid/testfiles/firstaid-bigfoot.tlg
index 77a92b65..b089d867 100644
--- a/base/testfiles/tlb0435.luatex.tlg
+++ b/required/firstaid/testfiles/firstaid-bigfoot.tlg
@@ -1,11 +1,17 @@
-This is a generated file for the LaTeX2e validation system.
+This is a generated file for the l3build validation system.
 Don't change this file in any respect.
-Author: Alan Jeffrey
-Format: LaTeX2e<1994/12/01>
-Main Class: article
-hello
-hello
-hello
+\footinsdefault=\insert...
+\c at footnotedefault=\count...
+\footinsB=\insert...
+\c at footnoteB=\count...
+\footinsC=\insert...
+\c at footnoteC=\count...
+\footinsD=\insert...
+\c at footnoteD=\count...
+\footinsE=\insert...
+\c at footnoteE=\count...
+\c at pp@a at footnoteB=\count...
+\c at pp@a at footnoteC=\count...
 LaTeX Font Info:    External font `cmex10' loaded for size
 (Font)              <7> on input line ....
 LaTeX Font Info:    External font `cmex10' loaded for size
@@ -15,4 +21,4 @@ LaTeX Font Info:    External font `cmex10' loaded for size
 LaTeX Font Info:    External font `cmex10' loaded for size
 (Font)              <6> on input line ....
 [1
-] (tlb0435.aux)
+] (firstaid-bigfoot.aux)
diff --git a/support/texlive.sh b/support/texlive.sh
index a6cef68d..2bf9f0c7 100644
--- a/support/texlive.sh
+++ b/support/texlive.sh
@@ -60,6 +60,8 @@ tlmgr install   \
 # special testing
 tlmgr install   \
   bidi          \
+  bigfoot       \
+  ncctools      \
   dinbrief      \
   pgfmorepages  \
   pgf           \





More information about the latex3-commits mailing list.