[latex3-commits] [git/LaTeX3-latex3-latex2e] OR-lab: minor cleanup (8dca65d0)

Frank Mittelbach frank.mittelbach at latex-project.org
Sun Feb 27 22:54:01 CET 2022


Repository : https://github.com/latex3/latex2e
On branch  : OR-lab
Link       : https://github.com/latex3/latex2e/commit/8dca65d039f1657d47fcfdfcc179ae5ff854b4c0

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

commit 8dca65d039f1657d47fcfdfcc179ae5ff854b4c0
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sun Feb 27 22:54:01 2022 +0100

    minor cleanup


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

8dca65d039f1657d47fcfdfcc179ae5ff854b4c0
 required/latex-lab/latex-lab-footnotes.dtx    | 165 ++++++++++++--------------
 required/latex-lab/usage-of- at footnotetext.txt | 114 ++++++++++++++++--
 2 files changed, 186 insertions(+), 93 deletions(-)

diff --git a/required/latex-lab/latex-lab-footnotes.dtx b/required/latex-lab/latex-lab-footnotes.dtx
index 10f218a8..72249af0 100644
--- a/required/latex-lab/latex-lab-footnotes.dtx
+++ b/required/latex-lab/latex-lab-footnotes.dtx
@@ -67,6 +67,8 @@
 
 % latex.ltx
 
+        % not looked at yet
+        
 \long\def\@mpfootnotetext#1{%
   \global\setbox\@mpfootins\vbox{%
     \unvbox\@mpfootins
@@ -87,8 +89,6 @@
 
 
 
-
-
 \def\@mpfn{footnote}
 \def\thempfn{\thefootnote}
 
@@ -139,7 +139,7 @@
 \tl_new:N \@kernel at after@fnmark
 \tl_new:N \@kernel at before@fnmark at end
 
-\def\debug at footnotemark{
+\cs_new:Npn \__fnote_debug_footnotemark: {
   \ShowCommand\@kernel at after@fnmark
   \ShowCommand\@kernel at before@fnmark at end
   \LogHook{fnmark/before}
@@ -147,12 +147,12 @@
   \LogHook{fnmark}
   \LogHook{fnmark/end}
   \LogHook{fnmark/after}
-  \global\let\debug at footnotemark\relax
-  }
+  \cs_gset_eq:NN \__fnote_debug_footnotemark: \prg_do_nothing:
+}
 
 
-\def \@footnotemark {
-  \debug at footnotemark
+\cs_new:Npn \fnote_footnotemark: {
+  \__fnote_debug_footnotemark:
 %-------
 % bibarts
 % chextras  --- actually in the wrong place does an \unskip
@@ -198,16 +198,9 @@
 % ./arabtex/afoot.sty  --- too different (and probably too old)
 
 
-% to survive overwrite by hyperref for now
+% Provide the name \LaTeXe{} is used to.
 
-\let \FN at footnotemark \@footnotemark
-
-\AddToHook{package/hyperref/after}{
-  \let\H@@footnotetext\FN at footnotetext
-  \let\H@@footnotemark\FN at footnotemark
-  \let \@footnotetext \FN at footnotetext
-  \let \@footnotemark \FN at footnotemark
-}
+\let \@footnotemark \fnote_footnotemark:
 
 
 
@@ -219,7 +212,7 @@
 \NewHook{fntext/after}
 
 
-\def\debug at footnotetext{
+\cs_new:Npn \__fnote_debug_footnotetext: {
   \ShowCommand\@footnotetext at process
   \ShowCommand\@footnotetext at processii
   \ShowCommand\@footnotetext at processiii
@@ -228,11 +221,11 @@
   \LogHook{fntext}
   \LogHook{fntext/para}
   \LogHook{fntext/after}
-  \global\let\debug at footnotetext\relax
+  \cs_gset_eq:NN \__fnote_debug_footnotetext: \prg_do_nothing:
   }
 
-\long\def\@footnotetext#1{
-  \debug at footnotetext
+\cs_new:Npn \fnote_footnotetext:n #1 {
+  \__fnote_debug_footnotetext:
 %-------
 % ./linguex/linguex.sty
   \UseHook{fntext/before}
@@ -323,26 +316,55 @@
 
 
 
-% to survive overwrite by setspace for now
+% Provide the name \LaTeXe{} is used to
 
-\let \FN at footnotetext \@footnotetext
+\cs_set_eq:NN \@footnotetext \fnote_footnotetext:n
 
 
+% alterations not covered:
+%
+% ./revtex4-1/revtex4-1.cls  ./revtex/ltxutil.sty ./revtex/revtex4-2.cls .. (need analysis)
+% ./bigfoot/bigfoot.sty
 
 
-% firstaid for setspace:
 
+%    \end{macrocode}
+%
+%
+%
+%
+%
+%
+% \subsection{Firstaid vor packages and classes}
+%
+% \subsection{\pkg{setspace}
+%
+%    It should not overwrite it any longer but use a hook, so for now we
+%    do just that here.
+%    \begin{macrocode}
 \AddToHook{package/setspace/after}
-   {\let \@footnotetext \FN at footnotetext % should not overwrite it but use hook
+   {\let \@footnotetext \fnote_footnotetext:n 
     \AddToHook{fntext}[setspace]{\let\baselinestretch\setspace at singlespace}}
+%    \end{macrocode}
+%
+%
+%
+%
+% \subsection{\pkg{hyperref}
+%
+%    Prevent hyperref from redefining footnote stuff --- this is a
+%    temp solution.
+%    \begin{macrocode}
+\AddToHook{package/hyperref/after}{
+  \let\H@@footnotetext\fnote_footnotetext:n
+  \let\H@@footnotemark\fnote_footnotemark:
+  \let \@footnotetext \fnote_footnotetext:n
+  \let \@footnotemark \fnote_footnotemark:
+}
 
 
           
 
-% alterations not covered:
-%
-% ./revtex4-1/revtex4-1.cls  ./revtex/ltxutil.sty ./revtex/revtex4-2.cls .. (need analysis)
-% ./bigfoot/bigfoot.sty
 
 
 %-------------------------------------
@@ -371,14 +393,15 @@
 
 %-------------------------------------
 
-\NewHook{fnnote/after}
+\NewHook{fnote/after}
 
 \DeclareDocumentCommand\footnote {om} {
   \fn_step_fnmark:nn {#1} \@mpfn
   \@footnotemark
   \@footnotetext {#2}
 %-------
-  \UseHook{fnnote/after}
+% for multiple flags mainly
+  \UseHook{fnote/after}
 %-------
 }
 
@@ -406,7 +429,7 @@
 %  Tagging
 %-------------------------------------
 
-% hyperref support only when loaded (improve)
+% hyperref support only when loaded (improve integration)
 
 \newcounter{absfootnote}
 \AddToHook{fnmark}{\stepcounter{absfootnote}}  % too simple (fails with opt args)
@@ -491,32 +514,6 @@
 \ExplSyntaxOff
 
         
-
-%----------- old tagging
-
-\iffalse
-\DeclareDocumentCommand\footnote {om}{%
-  \IfNoValueTF{#1}%
-     {\stepcounter\@mpfn
-       \protected at xdef\@thefnmark{\thempfn}}%
-     {\begingroup
-        \csname c@\@mpfn\endcsname #1\relax
-        \unrestored at protected@xdef\@thefnmark{\thempfn}%
-      \endgroup}%
-     \tagstructbegin{tag=Lbl}%
-     \tagmcbegin{tag=Lbl}%
-     \@footnotemark
-     \tagmcend
-     \tagstructend
-     \@footnotetext
-         {%
-           \tagmcbegin{tag=Note}%
-           #2%
-           \tagmcend
-         }%
-}
-\fi
-        
 %</kernel>
 %    \end{macrocode}
 %
@@ -577,21 +574,32 @@
   \AtEndOfPackage{\setfnsymbol{lamport*-robust}}%
 }
 \newif\ifFN at para  \FN at parafalse
-\DeclareOption{para}{\ifFN at sidefn
-    \PackageError{footmisc}{Option "\CurrentOption" incompatible with
-      option "side"}%
-      {I shall ignore "\CurrentOption"}%
-  \else
-    \FN at paratrue
-  \fi
+\DeclareOption{para}{%  
+%    \end{macrocode}
+%    Options are executed in the orderof declaration, thus no point in
+%    checking for side option as footmisc did in the past
+%    \begin{macrocode}
+%    \PackageError{footmisc}{Option "\CurrentOption" incompatible with
+%                            option "side"}%
+%                 {I shall ignore "\CurrentOption"}%
+  \FN at paratrue
 }
-\newif\ifFN at sidefn  \FN at sidefnfalse
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \DeclareOption{side}{\ifFN at para
     \PackageError{footmisc}{Option "\CurrentOption" incompatible with
-      option "para"}%
-      {I shall ignore "\CurrentOption"}%
+                            option "para"}%
+                 {I shall ignore "\CurrentOption"}%
   \else
-    \FN at sidefntrue
+    \def\@footnotetext at process {\marginpar}
+    \AddToHook{fntext/para}{%
+      \hsize\marginparwidth     % correct the default \hsize
+      \footnotesep\z@           % don't add a default separation
+    }
+    \def\@footnotetext at processii  {\@makefntext}
+    \def\@footnotetext at processiii {}
+    \def\@footnotetext at processiv  {}
   \fi
 }
 \let\footnotelayout\@empty
@@ -803,20 +811,8 @@
   \def\@footnotetext at processiv {% config point
            \strut
            \penalty-10\relax
-            \hskip\footglue
+           \hskip\footglue
   }
-  
-\else
-  \ifFN at sidefn
-    \def\@footnotetext at process {\marginpar}
-    \AddToHook{fntext/para}{%
-      \hsize\marginparwidth     % correct the default \hsize
-      \footnotesep\z@           % don't add a default separation
-    }
-    \def\@footnotetext at processii  {\@makefntext}
-    \def\@footnotetext at processiii {}
-    \def\@footnotetext at processiv  {}
-  \fi
 \fi
 
 
@@ -917,10 +913,8 @@
   \providecommand*{\multiplefootnotemarker}{3sp}
   \providecommand*{\multfootsep}{,}
   \AddToHook{fnmark/begin}{\FN at mf@check}
-  \AddToHook{fnmark/end}{\FN at mf@prepare}
-  \AddToHook{fnnote/after}{\FN at mf@prepare}
-% cleanup and remove FN at footnotemark not needed in the end  
-  \let\FN at footnotemark\@footnotemark
+  \AddToHook{fnmark/end}  {\FN at mf@prepare}
+  \AddToHook{fnote/after} {\FN at mf@prepare}
 %
   \def\FN at mf@prepare{%
     \kern-\multiplefootnotemarker
@@ -939,7 +933,6 @@
   }
 \else
   \let\FN at mf@prepare\relax
-  \let\FN at footnotemark\@footnotemark
 \fi
 \ifFN at stablefootnote
 \let\FN at sf@@footnote\footnote
diff --git a/required/latex-lab/usage-of- at footnotetext.txt b/required/latex-lab/usage-of- at footnotetext.txt
index f9f2549c..6ca443bc 100644
--- a/required/latex-lab/usage-of- at footnotetext.txt
+++ b/required/latex-lab/usage-of- at footnotetext.txt
@@ -252,6 +252,9 @@
 
 
 
+%-------------------------------------
+
+
 % ./footmisc/footmisc.sty (side option)
 
     \long\def\FN at footnotetext#1{%
@@ -274,13 +277,12 @@
 
 
 
+%-------------------------------------
+
+
 
 % ./bxjscls/bxjsarticle.cls ./bxjscls/bxjsbook.cls ...
 
-\renewcommand{\footnoterule}{%
-  \kern-2.6\p@? \kern-.4\p@
-  \hrule width .4\columnwidth
-  \kern 2.6\p@?}
 \long\def\@footnotetext{%
   \insert\footins\bgroup
     \normalfont\footnotesize
@@ -295,13 +297,34 @@
       \@makefntext{%
         \rule\z@\footnotesep\ignorespaces}%
       \futurelet\jsc at next\jsc at fo@t}
+\def\jsc at fo@t{\ifcat\bgroup\noexpand\jsc at next \let\jsc at next\jsc at f@@t
+                                \else \let\jsc at next\jsc at f@t\fi \jsc at next}
+\def\jsc at f@@t{\bgroup\aftergroup\jsc@@foot\let\jsc at next}
+\def\jsc at f@t#1{#1\jsc@@foot}
+\def\jsc@@foot{\@finalstrut\strutbox\color at endgroup\egroup
+  \ifx\pltx at foot@penalty\@undefined\else
+    \ifhmode\null\fi
+    \ifnum\pltx at foot@penalty=\z@\else
+      \penalty\pltx at foot@penalty
+      \pltx at foot@penalty\z@
+    \fi
+  \fi}
+
+
+not covered so far supports \footnote{ catcode changes ...} but also
+\foonote A  --- the latter is questionable I would say
+
+
+%-------------------------------------
 
 
 % ./fn2end/fn2end.sty
 
-obsolete I guess
+obsolete I guess, ignored in evaluation
 
 
+%-------------------------------------
+
 
 % ./hyperref/hyperref.sty
 
@@ -330,6 +353,13 @@ obsolete I guess
   }%
 
 
+Handling of anchors (in nested context) I guess. This needs to be
+married with the anchor setting that the tagging currently does and
+the latter improved/adjusted
+
+
+%-------------------------------------
+
 % ./biblatex-gb7714-2015/gb7714-2015ms.bbx ./biblatex-gb7714-2015/gb7714-2015mx.bbx ...
 
     \long\def\@footnotetext##1{\insert\footins{%
@@ -348,6 +378,9 @@ obsolete I guess
         }%
     \color at endgroup}}%
 
+fits the structure
+%-------------------------------------
+
 
 % ./amscls/amsbook.cls ./amscls/amsproc.cls ./amscls/amsart.cls ...
 
@@ -363,6 +396,9 @@ obsolete I guess
     \@makefntext{%
       \rule\z@\footnotesep\ignorespaces#1\unskip\strut\par}}}
 
+fits the structure
+%-------------------------------------
+
 
 % ./umich-thesis/umich-thesis.cls
 
@@ -386,6 +422,9 @@ obsolete I guess
         \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
     \color at endgroup}}
 
+fits the structure
+%-------------------------------------
+
 
 % ./nostarch/nostarch.cls
 
@@ -403,10 +442,34 @@ obsolete I guess
         \rule\z@{13.5pt}\ignorespaces#1}%
     \color at endgroup}}%
 
+fixed \footsep, probably very old
+fits the structure
+%-------------------------------------
+
+
 
 % ./coursepaper/coursepaper.cls
 
-strange file format  -- needs converting to check
+\long\def\@footnotetext#1{%
+  \insert\footins{%
+    \def\baselinestretch {1}%
+    \reset at font\footnotesize
+    \interlinepenalty\interfootnotelinepenalty
+    \splittopskip\footnotesep
+    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+    \hsize\columnwidth
+    \@parboxrestore
+    \protected at edef\@currentlabel{%
+      \csname p at footnote\endcsname\@thefnmark
+    }%
+    \color at begingroup
+      \@makefntext{%
+        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
+    \color at endgroup}}
+
+fits the structure
+%-------------------------------------
+
 
 
 % ./ucthesis/ucthesis.cls
@@ -421,6 +484,9 @@ strange file format  -- needs converting to check
     {\rule{\z@}{\footnotesep}\ignorespaces
       #1\strut}}}
 
+fits the structure
+%-------------------------------------
+
 
 
 % ./jura/jura.cls
@@ -439,11 +505,16 @@ strange file format  -- needs converting to check
         \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
     \color at endgroup}}%
 
+fits the structure
+%-------------------------------------
+
 
 % ./asaetr/asaesub.sty
 
 2.09
 
+%-------------------------------------
+
 
 % ./lineno/fnlineno.sty
 
@@ -495,6 +566,12 @@ strange file format  -- needs converting to check
 
 
 
+probably continues working but needs separate checking
+
+%-------------------------------------
+
+
+
 % ./jurabib/jurabib.sty
 
       \long\def\@footnotetext#1{%
@@ -515,6 +592,11 @@ strange file format  -- needs converting to check
       }%
 
 
+first is table notes, second
+fits the structure
+%-------------------------------------
+
+
 
 % ./york-thesis/york-thesis.cls
 
@@ -534,6 +616,9 @@ strange file format  -- needs converting to check
       \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
   \color at endgroup}}
 
+fits the structure
+%-------------------------------------
+
 
 % ./ucdavisthesis/ucdavisthesis.cls
 
@@ -547,10 +632,14 @@ strange file format  -- needs converting to check
     {\rule{\z@}{\footnotesep}\ignorespaces
       #1\strut}\renewcommand\baselinestretch{\@spacing}}}
 
+looks old ...
+fits the structure
+%-------------------------------------
+
 
 % ./ledmac/afoot.sty
 
-fairly old
+fairly old and buggy in some aspects
 
 %%% Make the LaTeX \cs{footnote} catcode-safe, like in Plain TeX.
 
@@ -568,6 +657,9 @@ fairly old
   \a at fntext }
 
 
+%-------------------------------------
+
+
 % ./toptesi/toptesi.sty
 
 
@@ -580,6 +672,10 @@ fairly old
    \@makefntext{\rule{\z@}{\footnotesep}\ignorespaces#1\strut}}}
 
 
+fits the structure
+%-------------------------------------
+
+
 % ./gb4e/gb4e.sty
 
 \let\@gbsaved at footnotetext=\@footnotetext
@@ -588,6 +684,10 @@ fairly old
     \@gbsaved at footnotetext{#1}%
     \@noftnotetrue}
 
+fits the structure
+%-------------------------------------
+
+
 
 % ./koma-script/scrlttr2.cls ./koma-script/scrextend.sty ./koma-script/scrreprt.cls ...
 





More information about the latex3-commits mailing list.