From 206f46fee13b7233673f40672f21b29a61c70cd9 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 12 Sep 2020 03:03:44 +0000 Subject: CTAN sync 202009120303 --- macros/latex-dev/base/README.md | 2 +- macros/latex-dev/base/alltt.pdf | Bin 173079 -> 173079 bytes macros/latex-dev/base/cfgguide.pdf | Bin 220217 -> 220217 bytes macros/latex-dev/base/changes.txt | 10 + macros/latex-dev/base/classes.pdf | Bin 520851 -> 520851 bytes macros/latex-dev/base/clsguide.pdf | Bin 372555 -> 372555 bytes macros/latex-dev/base/cmfonts.pdf | Bin 264505 -> 264505 bytes macros/latex-dev/base/cyrguide.pdf | Bin 216997 -> 216997 bytes macros/latex-dev/base/doc.pdf | Bin 631616 -> 631285 bytes macros/latex-dev/base/docstrip.pdf | Bin 479710 -> 479704 bytes macros/latex-dev/base/encguide.pdf | Bin 1532144 -> 1532144 bytes macros/latex-dev/base/exscale.pdf | Bin 195877 -> 195877 bytes macros/latex-dev/base/fix-cm.pdf | Bin 262059 -> 262059 bytes macros/latex-dev/base/fntguide.pdf | Bin 417861 -> 417861 bytes macros/latex-dev/base/graphpap.pdf | Bin 156277 -> 156277 bytes macros/latex-dev/base/ifthen.pdf | Bin 205213 -> 205213 bytes macros/latex-dev/base/inputenc.pdf | Bin 294900 -> 294900 bytes macros/latex-dev/base/latexchanges.pdf | Bin 232390 -> 232390 bytes macros/latex-dev/base/latexrelease.pdf | Bin 246195 -> 246195 bytes macros/latex-dev/base/latexsym.pdf | Bin 192297 -> 192297 bytes macros/latex-dev/base/lb2.pdf | Bin 138219 -> 138219 bytes macros/latex-dev/base/letter.pdf | Bin 306068 -> 305441 bytes macros/latex-dev/base/lgc2.pdf | Bin 101343 -> 101343 bytes macros/latex-dev/base/lppl.pdf | Bin 125830 -> 125830 bytes macros/latex-dev/base/ltclass.dtx | 61 ++- macros/latex-dev/base/ltdefns.dtx | 53 ++- macros/latex-dev/base/ltexpl.dtx | 14 +- macros/latex-dev/base/ltfilehook-code.pdf | Bin 747549 -> 747033 bytes macros/latex-dev/base/ltfilehook-doc.pdf | Bin 517421 -> 516967 bytes macros/latex-dev/base/ltfilehook.dtx | 8 +- macros/latex-dev/base/ltfiles.dtx | 2 +- macros/latex-dev/base/lthooks-code.pdf | Bin 871310 -> 896523 bytes macros/latex-dev/base/lthooks-doc.pdf | Bin 602334 -> 603179 bytes macros/latex-dev/base/lthooks.dtx | 698 +++++++++++++++++++----------- macros/latex-dev/base/ltluatex.pdf | Bin 305256 -> 305256 bytes macros/latex-dev/base/ltnews.pdf | Bin 988811 -> 988811 bytes macros/latex-dev/base/ltnews01.pdf | Bin 150020 -> 150020 bytes macros/latex-dev/base/ltnews02.pdf | Bin 134751 -> 134751 bytes macros/latex-dev/base/ltnews03.pdf | Bin 134742 -> 134742 bytes macros/latex-dev/base/ltnews04.pdf | Bin 128772 -> 128772 bytes macros/latex-dev/base/ltnews05.pdf | Bin 157181 -> 157181 bytes macros/latex-dev/base/ltnews06.pdf | Bin 133138 -> 133138 bytes macros/latex-dev/base/ltnews07.pdf | Bin 124029 -> 124029 bytes macros/latex-dev/base/ltnews08.pdf | Bin 144482 -> 144482 bytes macros/latex-dev/base/ltnews09.pdf | Bin 120222 -> 120222 bytes macros/latex-dev/base/ltnews10.pdf | Bin 147946 -> 147946 bytes macros/latex-dev/base/ltnews11.pdf | Bin 104936 -> 104936 bytes macros/latex-dev/base/ltnews12.pdf | Bin 137919 -> 137919 bytes macros/latex-dev/base/ltnews13.pdf | Bin 161065 -> 161065 bytes macros/latex-dev/base/ltnews14.pdf | Bin 150907 -> 150907 bytes macros/latex-dev/base/ltnews15.pdf | Bin 122092 -> 122092 bytes macros/latex-dev/base/ltnews16.pdf | Bin 130687 -> 130687 bytes macros/latex-dev/base/ltnews17.pdf | Bin 149838 -> 149838 bytes macros/latex-dev/base/ltnews18.pdf | Bin 36005 -> 36005 bytes macros/latex-dev/base/ltnews19.pdf | Bin 235073 -> 235073 bytes macros/latex-dev/base/ltnews20.pdf | Bin 283318 -> 283318 bytes macros/latex-dev/base/ltnews21.pdf | Bin 233492 -> 233492 bytes macros/latex-dev/base/ltnews22.pdf | Bin 302836 -> 302836 bytes macros/latex-dev/base/ltnews23.pdf | Bin 274459 -> 274459 bytes macros/latex-dev/base/ltnews24.pdf | Bin 252645 -> 252645 bytes macros/latex-dev/base/ltnews25.pdf | Bin 196326 -> 196326 bytes macros/latex-dev/base/ltnews26.pdf | Bin 362839 -> 362839 bytes macros/latex-dev/base/ltnews27.pdf | Bin 239758 -> 239758 bytes macros/latex-dev/base/ltnews28.pdf | Bin 368226 -> 368226 bytes macros/latex-dev/base/ltnews29.pdf | Bin 433004 -> 433004 bytes macros/latex-dev/base/ltnews30.pdf | Bin 491246 -> 491246 bytes macros/latex-dev/base/ltnews31.pdf | Bin 500919 -> 500919 bytes macros/latex-dev/base/ltnews32.pdf | Bin 529433 -> 529433 bytes macros/latex-dev/base/ltshipout-code.pdf | Bin 749702 -> 749381 bytes macros/latex-dev/base/ltshipout-doc.pdf | Bin 504786 -> 504055 bytes macros/latex-dev/base/ltshipout.dtx | 23 +- macros/latex-dev/base/ltvers.dtx | 2 +- macros/latex-dev/base/ltx3info.pdf | Bin 191527 -> 191527 bytes macros/latex-dev/base/ltxdoc.pdf | Bin 215134 -> 215134 bytes macros/latex-dev/base/makeindx.pdf | Bin 160667 -> 160667 bytes macros/latex-dev/base/manual.pdf | Bin 151347 -> 151347 bytes macros/latex-dev/base/modguide.pdf | Bin 220388 -> 220388 bytes macros/latex-dev/base/nfssfont.pdf | Bin 202451 -> 202451 bytes macros/latex-dev/base/proc.pdf | Bin 216877 -> 216877 bytes macros/latex-dev/base/slides.pdf | Bin 351586 -> 351586 bytes macros/latex-dev/base/slifonts.pdf | Bin 214710 -> 214710 bytes macros/latex-dev/base/source2e.pdf | Bin 4320779 -> 4353699 bytes macros/latex-dev/base/syntonly.pdf | Bin 181980 -> 181450 bytes macros/latex-dev/base/tlc2.pdf | Bin 164947 -> 164947 bytes macros/latex-dev/base/tulm.pdf | Bin 156546 -> 156546 bytes macros/latex-dev/base/usrguide.pdf | Bin 399035 -> 399035 bytes macros/latex-dev/base/utf8ienc.pdf | Bin 331397 -> 331094 bytes macros/latex-dev/base/webcomp.pdf | Bin 136159 -> 136159 bytes 88 files changed, 580 insertions(+), 293 deletions(-) (limited to 'macros/latex-dev/base') diff --git a/macros/latex-dev/base/README.md b/macros/latex-dev/base/README.md index 0f451408e0..fe45ec06c8 100644 --- a/macros/latex-dev/base/README.md +++ b/macros/latex-dev/base/README.md @@ -1,7 +1,7 @@ The LaTeX kernel ================ -Release 2020-10-01 pre-release 8 +Release 2020-10-01 pre-release 9 Overview -------- diff --git a/macros/latex-dev/base/alltt.pdf b/macros/latex-dev/base/alltt.pdf index 6cd049bbf9..ecaf4094e2 100644 Binary files a/macros/latex-dev/base/alltt.pdf and b/macros/latex-dev/base/alltt.pdf differ diff --git a/macros/latex-dev/base/cfgguide.pdf b/macros/latex-dev/base/cfgguide.pdf index 481b0118f0..a5cc634a01 100644 Binary files a/macros/latex-dev/base/cfgguide.pdf and b/macros/latex-dev/base/cfgguide.pdf differ diff --git a/macros/latex-dev/base/changes.txt b/macros/latex-dev/base/changes.txt index e20ac7dfd5..ef9406cd7d 100644 --- a/macros/latex-dev/base/changes.txt +++ b/macros/latex-dev/base/changes.txt @@ -6,6 +6,16 @@ completeness or accuracy and it contains some references to files that are not part of the distribution. ================================================================================ +2020-09-09 Frank Mittelbach + + * ltshipout.dtx (subsection{Emulating \pkg{atbegshi}}): + Avoid unnecessary overfull box warnings (gh/387) + +2020-09-06 Phelype Oleinik + + * ltclass.dtx: + Correct option passing when a file is replaced + 2020-08-24 Frank Mittelbach * ltfssini.dtx: diff --git a/macros/latex-dev/base/classes.pdf b/macros/latex-dev/base/classes.pdf index a9595955b4..6264b55524 100644 Binary files a/macros/latex-dev/base/classes.pdf and b/macros/latex-dev/base/classes.pdf differ diff --git a/macros/latex-dev/base/clsguide.pdf b/macros/latex-dev/base/clsguide.pdf index 36e252ad1b..9d1176d4a0 100644 Binary files a/macros/latex-dev/base/clsguide.pdf and b/macros/latex-dev/base/clsguide.pdf differ diff --git a/macros/latex-dev/base/cmfonts.pdf b/macros/latex-dev/base/cmfonts.pdf index b1e605544e..6bcb317a11 100644 Binary files a/macros/latex-dev/base/cmfonts.pdf and b/macros/latex-dev/base/cmfonts.pdf differ diff --git a/macros/latex-dev/base/cyrguide.pdf b/macros/latex-dev/base/cyrguide.pdf index a7d11ca8f8..a43d1356ed 100644 Binary files a/macros/latex-dev/base/cyrguide.pdf and b/macros/latex-dev/base/cyrguide.pdf differ diff --git a/macros/latex-dev/base/doc.pdf b/macros/latex-dev/base/doc.pdf index e50c8ce8b2..8dea440f33 100644 Binary files a/macros/latex-dev/base/doc.pdf and b/macros/latex-dev/base/doc.pdf differ diff --git a/macros/latex-dev/base/docstrip.pdf b/macros/latex-dev/base/docstrip.pdf index 71bf27ba33..a85a0091cb 100644 Binary files a/macros/latex-dev/base/docstrip.pdf and b/macros/latex-dev/base/docstrip.pdf differ diff --git a/macros/latex-dev/base/encguide.pdf b/macros/latex-dev/base/encguide.pdf index 5b48fb4ae2..5186a6f248 100644 Binary files a/macros/latex-dev/base/encguide.pdf and b/macros/latex-dev/base/encguide.pdf differ diff --git a/macros/latex-dev/base/exscale.pdf b/macros/latex-dev/base/exscale.pdf index 316da084e6..8f23dd4da8 100644 Binary files a/macros/latex-dev/base/exscale.pdf and b/macros/latex-dev/base/exscale.pdf differ diff --git a/macros/latex-dev/base/fix-cm.pdf b/macros/latex-dev/base/fix-cm.pdf index 08dde0ae9f..b66dba3040 100644 Binary files a/macros/latex-dev/base/fix-cm.pdf and b/macros/latex-dev/base/fix-cm.pdf differ diff --git a/macros/latex-dev/base/fntguide.pdf b/macros/latex-dev/base/fntguide.pdf index 349303e6d4..c3d23a6ca4 100644 Binary files a/macros/latex-dev/base/fntguide.pdf and b/macros/latex-dev/base/fntguide.pdf differ diff --git a/macros/latex-dev/base/graphpap.pdf b/macros/latex-dev/base/graphpap.pdf index 274b50ae08..81caf6f37a 100644 Binary files a/macros/latex-dev/base/graphpap.pdf and b/macros/latex-dev/base/graphpap.pdf differ diff --git a/macros/latex-dev/base/ifthen.pdf b/macros/latex-dev/base/ifthen.pdf index 9e3fc6c42f..cc28e46720 100644 Binary files a/macros/latex-dev/base/ifthen.pdf and b/macros/latex-dev/base/ifthen.pdf differ diff --git a/macros/latex-dev/base/inputenc.pdf b/macros/latex-dev/base/inputenc.pdf index 30351e71e5..7915900cb7 100644 Binary files a/macros/latex-dev/base/inputenc.pdf and b/macros/latex-dev/base/inputenc.pdf differ diff --git a/macros/latex-dev/base/latexchanges.pdf b/macros/latex-dev/base/latexchanges.pdf index 6179a01f11..c64b18bcf2 100644 Binary files a/macros/latex-dev/base/latexchanges.pdf and b/macros/latex-dev/base/latexchanges.pdf differ diff --git a/macros/latex-dev/base/latexrelease.pdf b/macros/latex-dev/base/latexrelease.pdf index becb06fbb4..08cdbd51c2 100644 Binary files a/macros/latex-dev/base/latexrelease.pdf and b/macros/latex-dev/base/latexrelease.pdf differ diff --git a/macros/latex-dev/base/latexsym.pdf b/macros/latex-dev/base/latexsym.pdf index 46dbdde61a..80c5469414 100644 Binary files a/macros/latex-dev/base/latexsym.pdf and b/macros/latex-dev/base/latexsym.pdf differ diff --git a/macros/latex-dev/base/lb2.pdf b/macros/latex-dev/base/lb2.pdf index 7c639fccb2..a80c2ee580 100644 Binary files a/macros/latex-dev/base/lb2.pdf and b/macros/latex-dev/base/lb2.pdf differ diff --git a/macros/latex-dev/base/letter.pdf b/macros/latex-dev/base/letter.pdf index 7670c796fe..54cc1c43b5 100644 Binary files a/macros/latex-dev/base/letter.pdf and b/macros/latex-dev/base/letter.pdf differ diff --git a/macros/latex-dev/base/lgc2.pdf b/macros/latex-dev/base/lgc2.pdf index 9c29edd755..d8e1e6a518 100644 Binary files a/macros/latex-dev/base/lgc2.pdf and b/macros/latex-dev/base/lgc2.pdf differ diff --git a/macros/latex-dev/base/lppl.pdf b/macros/latex-dev/base/lppl.pdf index 1d3697bc5b..86e4515dd4 100644 Binary files a/macros/latex-dev/base/lppl.pdf and b/macros/latex-dev/base/lppl.pdf differ diff --git a/macros/latex-dev/base/ltclass.dtx b/macros/latex-dev/base/ltclass.dtx index 7b1dbc8127..44fe0f8856 100644 --- a/macros/latex-dev/base/ltclass.dtx +++ b/macros/latex-dev/base/ltclass.dtx @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltclass.dtx} - [2020/08/29 v1.3p LaTeX Kernel (Class & Package Interface)] + [2020/09/06 v1.3q LaTeX Kernel (Class & Package Interface)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltclass.dtx} @@ -1021,11 +1021,28 @@ % If the package has been loaded, we check that it was first loaded with % the options. Otherwise we add the option list to that of the package. % \begin{macrocode} +% +%\IncludeInRelease{2020/10/01}{\@pass@ptions} +% {Add file replacement in \@pass@ptions}% +%<*2ekernel|latexrelease> \def\@pass@ptions#1#2#3{% - \expandafter\xdef\csname opt@#3.#1\endcsname{% - \@ifundefined{opt@#3.#1}\@empty - {\csname opt@#3.#1\endcsname,}% + \edef\reserved@a{\@expl@@@filehook@resolve@file@subst@@w #3.#1\@nil}% + \expandafter\xdef\csname opt@\reserved@a\endcsname{% + \@ifundefined{opt@\reserved@a}\@empty + {\csname opt@\reserved@a\endcsname,}% \zap@space#2 \@empty}} +% +%\EndIncludeInRelease +% +%\IncludeInRelease{0000/00/00}{\@pass@ptions} +% {\@pass@ptions}% +%\def\@pass@ptions#1#2#3{% +% \expandafter\xdef\csname opt@#3.#1\endcsname{% +% \@ifundefined{opt@#3.#1}\@empty +% {\csname opt@#3.#1\endcsname,}% +% \zap@space#2 \@empty}} +%\EndIncludeInRelease +%<*2ekernel> \@onlypreamble\@pass@ptions % \end{macrocode} % @@ -1633,8 +1650,6 @@ \@onlypreamble\@fileswith@pti@ns % \end{macrocode} % - - % \begin{macro}{\load@onefilewithoptions} % This macro is used when loading packages or classes. % @@ -1727,6 +1742,29 @@ {\@expl@@@filehook@file@push@@ \set@curr@file{\@currname.\@currext}% \@filehook@set@CurrentFile +% \end{macrocode} +% \changes{v1.3q}{2020/09/06} +% {Save \cs{@currpkg@reqd} so that we don't lose track of +% package substitutions.} +% The \cs{set@curr@file} line above might have replaced the file, so +% \cs{@currname} and \cs{@currext} may no longer hold the actual +% package being loaded, so in that case we need to update these two +% token lists (\cs{@curr@file} holds the file name after replacement, +% so we parse that). +% +% The requested file is saved in \cs{@currpkg@reqd} to be used in +% \cs{InputIfFileExists} later: if the updated \cs{@currname} and +% \cs{@currext} are used we lose track of the substitution, so +% \cs{CurrentFile} and \cs{CurrentFileUsed} will be (incorrectly) +% the same. +% \begin{macrocode} + \edef\@currpkg@reqd{\@currname.\@currext}% + \ifx\CurrentFile\CurrentFileUsed + \else + \filename@parse\@curr@file + \edef\@currname{\string@makeletter\filename@base}% + \edef\@currext{\string@makeletter\filename@ext}% + \fi \load@onefile@withoptions{#2}% % \end{macrocode} % Now just clean up and exit. @@ -1761,11 +1799,10 @@ % % The kernel no longer uses \cs{@unprocessedoptions} % \begin{macrocode} -\let\@unprocessedoptions\@undefined +\let\@unprocessedoptions\@undefined % \end{macrocode} % \end{macro} - - +% % \begin{macro}{\@missing@onefilewithoptions} % Now the action taken when a file is not found. % \begin{macrocode} @@ -1817,7 +1854,9 @@ % Now actually load the file (at this point we are certain it exists, % but use \cs{InputIfFileExists} so that file hooks are executed): % \begin{macrocode} - \InputIfFileExists{\@currname.\@currext}{}{}% + \InputIfFileExists{\@currpkg@reqd}{}% + {\@latex@error + {The \@cls@pkg\space\@currpkg@reqd\space failed to load.}\@ehd}% %----------------------------------------- % \end{macrocode} % In older versions of the code |\@unprocessedoptions| would @@ -1878,7 +1917,7 @@ \fi \fi}% %----------------------------------------- - \reserved@a} + \@ifl@aded\@currext\@currname{}{\reserved@a}} % \end{macrocode} % \end{macro} % diff --git a/macros/latex-dev/base/ltdefns.dtx b/macros/latex-dev/base/ltdefns.dtx index ea6a924f98..476d102ae4 100644 --- a/macros/latex-dev/base/ltdefns.dtx +++ b/macros/latex-dev/base/ltdefns.dtx @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltdefns.dtx} - [2020/08/21 v1.5m LaTeX Kernel (definition commands)] + [2020/09/06 v1.5n LaTeX Kernel (definition commands)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltdefns.dtx} @@ -2194,6 +2194,56 @@ % \end{macro} % % +% \begin{macro}{\string@makeletter} +% \begin{macro}{\@string@makeletter} +% \begin{macro}{\char@if@alph} +% Iterates through a string, turning each alphabetic character into +% a catcode-11 token (partly undoes a \cs{detokenize}). Useful for +% \cs{ifx}-based string comparisons where \cs{detokenize}-ing the +% other string would break too much code. +% +% \changes{v1.5n}{2020/09/06} +% {Macro added} +% +% The macro uses \textsf{expl3}'s \cs{@expl@str@map@function@@NN} to +% iterate on the string (without losing spaces) and applies +% \cs{@string@makeletter} on each character. The latter checks if +% character is between a--z or A--Z, and uses \cs{@alph} or \cs{@Alph} +% to get the corresponding catcode-11 token. Other tokens are passed +% through unchanged. +% \begin{macrocode} +% +%\IncludeInRelease{2020/10/01}{\string@makeletter} +% {Add \string@makeletter}% +%<*2ekernel|latexrelease> +\def\string@makeletter#1{% + \@expl@str@map@function@@NN#1\@string@makeletter} +\def\@string@makeletter#1{% + \char@if@alph{#1}% + {\@expl@char@generate@@nn{`#1}{11}}% + {#1}} +\def\char@if@alph#1{% + \ifnum0\ifnum`#1<`A 1\fi\ifnum`#1>`z 1\fi + \if\ifnum`#1>`Z @\fi\ifnum`#1<`a @\fi01\fi>0 + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi} +% +%\EndIncludeInRelease +% +%\IncludeInRelease{0000/00/00}{\string@makeletter} +% {Undefine \string@makeletter}% +%\let\string@makeletter\@undefined +%\let\@string@makeletter\@undefined +%\let\char@if@alph\@undefined +%\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % % \begin{macro}{\makeatletter} % \begin{macro}{\makeatother} @@ -2207,7 +2257,6 @@ % \end{macro} % \end{macro} % - % % \section{Discretionary Hyphenation} % \begin{macro}{\-} diff --git a/macros/latex-dev/base/ltexpl.dtx b/macros/latex-dev/base/ltexpl.dtx index 16ca26095c..4100da79c2 100644 --- a/macros/latex-dev/base/ltexpl.dtx +++ b/macros/latex-dev/base/ltexpl.dtx @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltexpl.dtx} - [2020/08/21 v1.2e LaTeX Kernel (expl3-dependent code)] + [2020/09/06 v1.2f LaTeX Kernel (expl3-dependent code)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltexpl.dtx} @@ -272,7 +272,7 @@ % \end{macrocode} % % \changes{v1.2e}{2020/08/19} -% {Add \cs{\@expl@cs@\meta{thing}@spec@@N} +% {Add \cs{@expl@cs@\meta{thing}@spec@@N} % for \cs{ShowCommand} (gh/373)} % \begin{macrocode} \cs_gset_eq:NN \@expl@cs@prefix@spec@@N \cs_prefix_spec:N @@ -280,6 +280,15 @@ \cs_gset_eq:NN \@expl@cs@replacement@spec@@N \cs_replacement_spec:N % \end{macrocode} % +% \changes{v1.2f}{2020/09/06} +% {Add \cs{@expl@str@map@function@@NN +% and \cs{@expl@char@generate@@nn}} +% for \cs{string@makeletter} (gh/386)} +% \begin{macrocode} +\cs_gset_eq:NN \@expl@str@map@function@@NN \str_map_function:NN +\cs_gset_eq:NN \@expl@char@generate@@nn \char_generate:nn +% \end{macrocode} +% % \begin{macrocode} %\EndIncludeInRelease %\IncludeInRelease{0000/00/00}{expl3~2020-10-01}% @@ -289,6 +298,7 @@ %\cs_undefine:N \@expl@cs@prefix@spec@@N %\cs_undefine:N \@expl@cs@argument@spec@@N %\cs_undefine:N \@expl@cs@replacement@spec@@N +%\cs_undefine:N \@expl@str@map@function@@NN %\EndIncludeInRelease % % \end{macrocode} diff --git a/macros/latex-dev/base/ltfilehook-code.pdf b/macros/latex-dev/base/ltfilehook-code.pdf index 12d6fbbd3a..b70786fabf 100644 Binary files a/macros/latex-dev/base/ltfilehook-code.pdf and b/macros/latex-dev/base/ltfilehook-code.pdf differ diff --git a/macros/latex-dev/base/ltfilehook-doc.pdf b/macros/latex-dev/base/ltfilehook-doc.pdf index f5d37d4e9b..34ad7a782d 100644 Binary files a/macros/latex-dev/base/ltfilehook-doc.pdf and b/macros/latex-dev/base/ltfilehook-doc.pdf differ diff --git a/macros/latex-dev/base/ltfilehook.dtx b/macros/latex-dev/base/ltfilehook.dtx index 73018c682d..26dba35165 100644 --- a/macros/latex-dev/base/ltfilehook.dtx +++ b/macros/latex-dev/base/ltfilehook.dtx @@ -28,7 +28,7 @@ % % \iffalse % -%%% From File: ltshipout.dtx +%%% From File: ltfilehook.dtx % % \begin{macrocode} \providecommand\ltfilehookversion{v1.0a} @@ -1357,7 +1357,7 @@ % \end{macrocode} % % \begin{macrocode} -\cs_new_eq:NN \@expl@@@filehook@file@push@@ +\cs_new_eq:NN \@expl@@@filehook@file@push@@ \__filehook_file_push: % \end{macrocode} % @@ -1434,7 +1434,7 @@ % If there was a file replacement, show that as well: % \begin{macrocode} \str_if_eq:NNF \CurrentFileUsed \CurrentFile - { ~ ( \CurrentFile \space requested ) } + { ~ ( \CurrentFile \c_space_tl requested ) } \iow_newline: } \str_if_eq:nnT {#1} {STOP} { \int_gdecr:N \g_@@_nesting_level_int } @@ -1485,7 +1485,7 @@ % Here is the package file we point to: % \begin{macrocode} %<*atveryend-ltx> -\ProvidesPackage{atveryend} +\ProvidesPackage{atveryend-ltx} [2020/08/19 v1.0a Emulation of the original atvery package^^Jwith kernel methods] % \end{macrocode} diff --git a/macros/latex-dev/base/ltfiles.dtx b/macros/latex-dev/base/ltfiles.dtx index a5ad754bfd..835f600e32 100644 --- a/macros/latex-dev/base/ltfiles.dtx +++ b/macros/latex-dev/base/ltfiles.dtx @@ -461,7 +461,7 @@ % \begin{macrocode} \edef \@kernel@after@begindocument@before {% \let\expandafter\noexpand\csname - g__hook_env/document/begin_code_tl\endcsname + __hook env/document/begin\endcsname \noexpand\@empty} % \end{macrocode} % diff --git a/macros/latex-dev/base/lthooks-code.pdf b/macros/latex-dev/base/lthooks-code.pdf index 03052d0545..960872ce86 100644 Binary files a/macros/latex-dev/base/lthooks-code.pdf and b/macros/latex-dev/base/lthooks-code.pdf differ diff --git a/macros/latex-dev/base/lthooks-doc.pdf b/macros/latex-dev/base/lthooks-doc.pdf index adc99b3169..ec308ee62d 100644 Binary files a/macros/latex-dev/base/lthooks-doc.pdf and b/macros/latex-dev/base/lthooks-doc.pdf differ diff --git a/macros/latex-dev/base/lthooks.dtx b/macros/latex-dev/base/lthooks.dtx index b1e3985704..17c3262a4c 100644 --- a/macros/latex-dev/base/lthooks.dtx +++ b/macros/latex-dev/base/lthooks.dtx @@ -32,7 +32,7 @@ % % \begin{macrocode} \def\lthooksversion{v1.0a} -\def\lthooksdate{2020/08/31} +\def\lthooksdate{2020/09/10} % \end{macrocode} % %<*driver> @@ -351,6 +351,21 @@ % \meta{label} throughout the sub-packages in order to avoid % that the labels change if you internally reorganize your code. % +% Except for \cs{UseHook}, \cs{UseOneTimeHook}, \cs{IfHookEmptyTF}, and +% \cs{IfHookExistsTF} (and their \pkg{expl3} interfaces \cs{hook_use:n}, +% \cs{hook_use_once:n}, \cs{hook_if_empty:nTF}, and +% \cs{hook_if_exist:nTF}), all \meta{hook} +% and \meta{label} arguments are processed in the same way: first, +% spaces are trimmed around the argument, then it is fully expanded +% until only character tokens remain. If the full expansion of the +% \meta{hook} or \meta{label} contains a non-expandable non-character +% token, a low-level \TeX{} error is raised (namely, the \meta{hook} is +% expanded using \TeX's \cs{csname}\ldots\cs{endcsname}, as such, +% Unicode characters are allowed in \meta{hook} and \meta{label} +% arguments). The arguments of \cs{UseHook} and \cs{UseOneTimeHook} are +% processed much in the same way except that spaces are not trimmed +% around the argument, for better performance. +% % It is not enforced, but highly recommended that the hooks defined by % a package, and the \meta{labels} used to add code to other hooks % contain the package name to easily identify the source of the code @@ -599,6 +614,10 @@ % to adding and removing code from it, so this test should be used % sparingly. % +% Generic hooks are declared at the time code is added to them, so the +% result of \cs{hook_if_exist:n} will change once code is added to +% said hook (unless the hook was previously declared). +% % The \meta{hook} \emph{cannot} be specified using the dot-syntax. % A leading |.| is treated literally. % \end{function} @@ -611,7 +630,7 @@ % rule it is helpful to get some information about the code % associated with a hook, its current order and the existing rules. % -% \begin{function}{\ShowHook} +% \begin{function}{\ShowHook,\LogHook} % \begin{syntax} % \cs{ShowHook} \Arg{hook} % \end{syntax} @@ -627,6 +646,10 @@ % any code executed on the next invocation only. % \end{itemize} % +% \cs{LogHook} prints the information to the |.log| file, and +% \cs{ShowHook} prints them to the terminal/command window and starts +% \TeX's prompt (only if \cs{errorstopmode}) to wait for user action. +% % The \meta{hook} can be specified using the dot-syntax to denote % the current package name. See section~\ref{sec:default-label}. % \end{function} @@ -796,18 +819,43 @@ % branches to either \meta{true code} or \meta{false code} depending % on the result. % -% \fmi{what are the results for generic hooks that do not need to be declared?} -% % The existence of a hook usually doesn't mean much from the viewpoint % of code that tries to add/remove code from that hook, since package % loading order may vary, thus the creation of hooks is asynchronous % to adding and removing code from it, so this test should be used % sparingly. % +% Generic hooks are declared at the time code is added to them, so the +% result of \cs{hook_if_exist:n} will change once code is added to +% said hook (unless the hook was previously declared). +% % The \meta{hook} \emph{cannot} be specified using the dot-syntax. % A leading |.| is treated literally. % \end{function} % +% \begin{function}{\hook_show:n,\hook_log:n} +% \begin{syntax} +% \cs{hook_show:n} \Arg{hook} +% \end{syntax} +% Displays information about the \meta{hook} such as +% \begin{itemize} +% \item +% the code chunks (and their labels) added to it, +% \item +% any rules set up to order them, +% \item +% the computed order in which the chunks are executed, +% \item +% any code executed on the next invocation only. +% \end{itemize} +% +% \cs{hook_log:n} prints the information to the |.log| file, and +% \cs{hook_show:n} prints them to the terminal/command window and starts +% \TeX's prompt (only if \cs{errorstopmode}) to wait for user action. +% +% The \meta{hook} can be specified using the dot-syntax to denote +% the current package name. See section~\ref{sec:default-label}. +% \end{function} % % \begin{function}{\hook_debug_on:,\hook_debug_off:} % \begin{syntax} @@ -1586,6 +1634,20 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\g_@@_execute_immediately_prop} +% List of hooks that from no on should not longer receive code. +% \begin{macrocode} +\prop_new:N \g_@@_execute_immediately_prop +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\g_@@_used_prop} +% All hooks that receive code (for use in debugging display). +% \begin{macrocode} +\prop_new:N \g_@@_used_prop +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\g_@@_hook_curr_name_tl,\g_@@_name_stack_seq} % Default label used for hook commands, and a stack to keep track of % packages within packages. @@ -1602,10 +1664,12 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\tl_gremove_once:Nx} +% \begin{macro}{\tl_gremove_once:Nx,\tl_show:x,\tl_log:x} % Some variants of \pkg{expl3} functions. \fmi{should be moved to expl3} % \begin{macrocode} \cs_generate_variant:Nn \tl_gremove_once:Nn { Nx } +\cs_generate_variant:Nn \tl_show:n { x } +\cs_generate_variant:Nn \tl_log:n { x } % \end{macrocode} % \end{macro} % @@ -1619,7 +1683,7 @@ % % \subsection{Providing new hooks} % -% \begin{macro}{\g_@@_..._code_prop,\g_@@_..._code_tl,\g_@@_..._code_next_tl} +% \begin{macro}{\g_@@_..._code_prop,\@@~...,\@@_next~...} % % Hooks have a \meta{name} and for each hook we have to provide a number of % data structures. These are @@ -1635,10 +1699,14 @@ % (reverse) sorted to ensure that two labels always point to the same % token list. For global rules, the \meta{name} is |??|. % -% \item[\cs{g_@@_\meta{name}_code_tl}] The code that is actually executed +% \item[\cs{@@~\meta{name}}] The code that is actually executed % when the hook is called in the document is stored in this token % list. It is constructed from the code chunks applying the % information. +% This token list is named like that so that in case of an error +% inside the hook, the reported token list in the error is shorter, +% and to make it simpler to normalize hook names in +% \cs{@@_make_name:n}. % % \item[\cs{g_@@_\meta{name}_reversed_tl}] Some hooks are % \enquote{reversed}. This token list stores a |-| for such hook @@ -1646,14 +1714,15 @@ % $\meta{reversed}1$ is $+1$ for normal hooks and $-1$ for reversed % ones. % -% \item[\cs{g_@@_\meta{name}_code_next_tl}] Finally there is extra code +% \item[\cs{@@_next~\meta{name}}] Finally there is extra code % (normally empty) that is used on the next invocation of the hook % (and then deleted). This can be used to define some special % behavior for a single occasion from within the document. This token -% list is called |code_next| rather than |next_code| because otherwise -% a hook called \meta{name}|_next| would have its code-token list -% named \cs[no-index]{g_@@_\meta{name}_code_next_tl}, which would -% clash with the next code-token list of a hook called \meta{name}. +% list follows the same naming scheme than the main \cs{@@~\meta{name}} +% token list. It is called \cs{@@_next~\meta{name}} rather than +% \cs{@@~next_\meta{name}} because otherwise a hook whose name is +% |next_|\meta{name} would clash with the next code-token list of the +% hook called \meta{name}. % % \end{description} % \end{macro} @@ -1667,42 +1736,41 @@ % \hook{begindocument}. % \begin{macrocode} \cs_new_protected:Npn \hook_new:n #1 + { \@@_normalize_hook_args:Nn \@@_new:n {#1} } +\cs_new_protected:Npn \@@_new:n #1 { - \exp_args:Nx \@@_new:n - { \@@_parse_label_default:nn {#1} { top-level } } - } -\cs_new_protected:Npn \@@_new:n #1 { % \end{macrocode} % We check for one of the internal data structures and if it % already exists we complain. % \begin{macrocode} - \hook_if_exist:nTF {#1} - { \msg_error:nnn { hooks } { exists } {#1} } + \hook_if_exist:nTF {#1} + { \msg_error:nnn { hooks } { exists } {#1} } % \end{macrocode} % Otherwise we add the hook name to the list of all hooks and % allocate the necessary data structures for the new hook. % \begin{macrocode} - { \seq_gput_right:Nn \g_@@_all_seq {#1} + { + \seq_gput_right:Nn \g_@@_all_seq {#1} % \end{macrocode} % This is only used by the actual code of the current hook, so % declare it normally: % \begin{macrocode} - \tl_new:c { g_@@_#1_code_tl } + \tl_new:c { @@~#1 } % \end{macrocode} % Now ensure that the base data structure for the hook exists: % \begin{macrocode} - \@@_declare:n {#1} + \@@_declare:n {#1} % \end{macrocode} % The \cs{g_@@_\meta{hook}_labels_clist} holds the sorted list of % labels (once it got sorted). This is used only for debugging. % \begin{macrocode} - \clist_new:c {g_@@_#1_labels_clist} + \clist_new:c {g_@@_#1_labels_clist} % \end{macrocode} % Some hooks should reverse the default order of code chunks. To % signal this we have a token list which is empty for normal hooks % and contains a \verb=-= for reversed hooks. % \begin{macrocode} - \tl_new:c { g_@@_#1_reversed_tl } + \tl_new:c { g_@@_#1_reversed_tl } % \end{macrocode} % The above is all in L3 convention, but we also provide an % interface to legacy \LaTeXe{} hooks of the form \cs{@...hook}, @@ -1717,9 +1785,9 @@ % \end{quote} % % \begin{macrocode} - \@@_include_legacy_code_chunk:n {#1} + \@@_include_legacy_code_chunk:n {#1} } -} + } % \end{macrocode} % \end{macro} % @@ -1737,7 +1805,7 @@ \@@_if_exist:nF {#1} { \prop_new:c { g_@@_#1_code_prop } - \tl_new:c { g_@@_#1_code_next_tl } + \tl_new:c { @@_next~#1 } } } % \end{macrocode} @@ -1745,29 +1813,31 @@ % % % -% \begin{macro}{\hook_new_reversed:n} +% \begin{macro}{\hook_new_reversed:n,\@@_new_reversed:n} % % Declare a new hook. The default ordering of code chunks is % reversed, signaled by setting the token list to a minus sign. % \begin{macrocode} -\cs_new_protected:Npn \hook_new_reversed:n #1 { - \hook_new:n {#1} +\cs_new_protected:Npn \hook_new_reversed:n #1 + { \@@_normalize_hook_args:Nn \@@_new_reversed:n {#1} } +\cs_new_protected:Npn \@@_new_reversed:n #1 + { + \@@_new:n {#1} % \end{macrocode} % If the hook already exists the above will generate an error % message, so the next line should be executed (but it is --- too % bad). % \begin{macrocode} - \tl_gset:cn { g_@@_#1_reversed_tl } { - } -} + \tl_gset:cn { g_@@_#1_reversed_tl } { - } + } % \end{macrocode} % \end{macro} % % \begin{macro}{\hook_new_pair:nn} % A shorthand for declaring a normal and a (matching) reversed hook in one go. % \begin{macrocode} -\cs_new_protected:Npn \hook_new_pair:nn #1#2 { - \hook_new:n {#1} \hook_new_reversed:n {#2} -} +\cs_new_protected:Npn \hook_new_pair:nn #1#2 + { \hook_new:n {#1} \hook_new_reversed:n {#2} } % \end{macrocode} % \end{macro} % @@ -1823,19 +1893,24 @@ % % \subsection{Parsing a label} % -% \begin{macro}[EXP]{\@@_parse_label_default:nn,\@@_parse_label_default:Vn} +% \begin{macro}[EXP]{\@@_parse_label_default:n} % This macro checks if a label was given (not \cs{c_novalue_tl}), and % if so, tries to parse the label looking for a leading \verb|.| to % replace for \cs{@currname}. Otherwise \cs{@@_currname_or_default:n} % is used to pick \cs{@currname} or the fallback value. +% +% The default |top-level| is hard-coded here. It once was an +% argument, but it's no longer needed. \pho{can't remember why} % \begin{macrocode} -\cs_new:Npn \@@_parse_label_default:nn #1 #2 +\cs_new:Npn \@@_parse_label_default:n #1 { \tl_if_novalue:nTF {#1} - { \@@_currname_or_default:n {#2} } - { \tl_trim_spaces_apply:nN {#1} \@@_parse_dot_label:nn {#2} } + { \@@_currname_or_default:n { top-level } } + { + \tl_trim_spaces_apply:nN {#1} + \@@_parse_dot_label:nn { top-level } + } } -\cs_generate_variant:Nn \@@_parse_label_default:nn { V } % \end{macrocode} % \end{macro} % @@ -1862,7 +1937,7 @@ } { \str_if_eq:nnTF {#1} { . } - { \@@_currname_or_default:n {#1} } + { \@@_currname_or_default:n {#2} } { \@@_parse_dot_label:nw {#2} #1 ./ \s_@@_mark } } } @@ -1872,13 +1947,13 @@ { \@@_parse_dot_label_aux:nw {#1} #3 \s_@@_mark } { \tl_if_empty:nTF {#3} - {#2} + { \@@_make_name:n {#2} } { \@@_parse_dot_label_cleanup:w #2 ./ #3 \s_@@_mark } } } \cs_new:Npn \@@_parse_dot_label_cleanup:w #1 ./ \s_@@_mark {#1} \cs_new:Npn \@@_parse_dot_label_aux:nw #1 #2 ./ \s_@@_mark - { \@@_currname_or_default:n {#1} / #2 } + { \@@_currname_or_default:n {#1} / \@@_make_name:n {#2} } % \end{macrocode} % \end{macro} % \end{macro} @@ -1893,7 +1968,7 @@ \tl_if_empty:NTF \g_@@_hook_curr_name_tl { \tl_if_empty:NTF \@currname - {#1} + { \@@_make_name:n {#1} } { \@currname } } { \g_@@_hook_curr_name_tl } @@ -1901,7 +1976,73 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[EXP]{\@@_make_name:n,\@@_make_name:w} +% Provides a standard sanitisation of a hook's name. +% It uses \cs{cs:w} to build a control sequence out of the hook name, +% then uses \cs{cs_to_str:N} to get the string representation of that, +% without the escape character. \cs{cs:w}-based expansion is used +% instead of |e|-based because Unicode characters don't behave well +% inside \cs{expanded}. The macro adds the \cs{@@~} prefix to the +% hook name to reuse the hook's code token list to build the csname +% and avoid leaving \enquote{public} control sequences defined +% (as~\cs{relax}) in TeX's memory. +% \begin{macrocode} +\cs_new:Npn \@@_make_name:n #1 + { + \exp_after:wN \exp_after:wN \exp_after:wN \@@_make_name:w + \exp_after:wN \token_to_str:N \cs:w @@~ #1 \cs_end: + } +\exp_last_unbraced:NNNNo +\cs_new:Npn \@@_make_name:w #1 \tl_to_str:n { @@~ } { } +% \end{macrocode} +% \end{macro} % +% \begin{macro}{\@@_normalize_hook_args:Nn} +% \begin{macro}{\@@_normalize_hook_args:Nnn} +% \begin{macro}{\@@_normalize_hook_rule_args:Nnnnn} +% \begin{macro}{\@@_normalize_hook_args_aux:Nn} +% Standard route for normalising hook and label arguments. The main +% macro does the entire operation within a group so that csnames made +% by \cs{@@_make_name:n} are wiped off before continuing. This means +% that this function cannot be used for \cs{hook_use:n}! +% \begin{macrocode} +\cs_new_protected:Npn \@@_normalize_hook_args_aux:Nn #1 #2 + { + \group_begin: + \use:e + { + \group_end: + \exp_not:N #1 #2 + } + } +\cs_new_protected:Npn \@@_normalize_hook_args:Nn #1 #2 + { + \@@_normalize_hook_args_aux:Nn #1 + { { \@@_parse_label_default:n {#2} } } + } +\cs_new_protected:Npn \@@_normalize_hook_args:Nnn #1 #2 #3 + { + \@@_normalize_hook_args_aux:Nn #1 + { + { \@@_parse_label_default:n {#2} } + { \@@_parse_label_default:n {#3} } + } + } +\cs_new_protected:Npn \@@_normalize_hook_rule_args:Nnnnn #1 #2 #3 #4 #5 + { + \@@_normalize_hook_args_aux:Nn #1 + { + { \@@_parse_label_default:n {#2} } + { \@@_parse_label_default:n {#3} } + { \tl_trim_spaces:n {#4} } + { \@@_parse_label_default:n {#5} } + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % % \begin{macro}{\hook_gput_code:nnn} @@ -1912,50 +2053,53 @@ % with \meta{label}. % \begin{macrocode} \cs_new_protected:Npn \hook_gput_code:nnn #1 #2 - { - \exp_args:Nxx \@@_gput_code:nnn - { \@@_parse_label_default:nn {#1} { top-level } } - { \@@_parse_label_default:nn {#2} { top-level } } - } + { \@@_normalize_hook_args:Nnn \@@_gput_code:nnn {#1} {#2} } \cs_new_protected:Npn \@@_gput_code:nnn #1 #2 #3 { % \end{macrocode} -% First check if the current \meta{hook}/\meta{label} pair was marked +% First check if the hook was used as a one-time hook: +% \begin{macrocode} + \prop_if_in:NnTF \g_@@_execute_immediately_prop {#1} + {#3} + { +% \end{macrocode} +% Then check if the current \meta{hook}/\meta{label} pair was marked % for removal, in which case \cs{@@_unmark_removal:nn} is used to % remove that mark (once). This may happen when a package removes % code from another package which was not yet loaded: the removal % order is stored, and at this stage it is executed by not adding to % the hook. % \begin{macrocode} - \@@_if_marked_removal:nnTF {#1} {#2} - { \@@_unmark_removal:nn {#1} {#2} } - { + \@@_if_marked_removal:nnTF {#1} {#2} + { \@@_unmark_removal:nn {#1} {#2} } + { % \end{macrocode} % If no removal is queued, we are free to add. Start by checking if % the hook exists. % \begin{macrocode} - \hook_if_exist:nTF {#1} + \hook_if_exist:nTF {#1} % \end{macrocode} % If so we simply add (or append) the new code to the property list % holding different chunks for the hook. At \verb=\begin{document}= % this is then sorted into a token list for fast execution. % \begin{macrocode} - { - \@@_hook_gput_code_do:nnn {#1} {#2} {#3} + { + \@@_hook_gput_code_do:nnn {#1} {#2} {#3} % \end{macrocode} % However, if there is an update within the document we need to alter % this execution code which is done by % \cs{@@_update_hook_code:n}. In the preamble this does nothing. % \begin{macrocode} - \@@_update_hook_code:n {#1} - } + \@@_update_hook_code:n {#1} + } % \end{macrocode} % % If the hook does not exist, however, before giving up try to % declare it as a generic hook, if its name matches one of the valid % patterns. % \begin{macrocode} - { \@@_try_declaring_generic_hook:nnn {#1} {#2} {#3} } + { \@@_try_declaring_generic_hook:nnn {#1} {#2} {#3} } + } } } \cs_generate_variant:Nn \@@_gput_code:nnn { nxv } @@ -2187,11 +2331,7 @@ % for \meta{hook} stored under \meta{label} is removed. % \begin{macrocode} \cs_new_protected:Npn \hook_gremove_code:nn #1 #2 - { - \exp_args:Nxx \@@_gremove_code:nn - { \@@_parse_label_default:nn {#1} { top-level } } - { \@@_parse_label_default:nn {#2} { top-level } } - } + { \@@_normalize_hook_args:Nnn \@@_gremove_code:nn {#1} {#2} } \cs_new_protected:Npn \@@_gremove_code:nn #1 #2 { % \end{macrocode} @@ -2250,6 +2390,10 @@ % \cs{tl_gremove_once:Nx} is fairly efficient even for longer token % lists, so we use a single global token list, rather than one for % each hook. +% +% A hand-crafted token list is used here because property lists don't +% hold repeated items, so multiple usages of \cs{@@_mark_removal:nn} +% would be cancelled by a single \cs{@@_unmark_removal:nn}. % \begin{macrocode} \cs_new_protected:Npn \@@_mark_removal:nn #1 #2 { @@ -2300,7 +2444,7 @@ % % \begin{macro}{ % \g_@@_??_code_prop, -% \g_@@_??_code_tl, +% \@@~??, % \g_@@_??_reversed_tl, % } % @@ -2315,11 +2459,11 @@ % lot things should be fast, so this is not done with \texttt{c} % expansion in the code later on. % -% \cs{g_@@_??_code_tl} isn't used, but it has to be defined to trick +% \cs{@@~??} isn't used, but it has to be defined to trick % the code into thinking that \verb=??= is actually a hook. % \begin{macrocode} \prop_new:c {g_@@_??_code_prop} -\prop_new:c {g_@@_??_code_tl} +\prop_new:c {@@~??} % \end{macrocode} % % Default rules are always given in normal ordering (never in @@ -2347,14 +2491,8 @@ % \begin{macrocode} \cs_new_protected:Npn \hook_gset_rule:nnnn #1#2#3#4 { - \use:x - { - \@@_gset_rule:nnnn - { \@@_parse_label_default:nn {#1} { top-level } } - { \@@_parse_label_default:nn {#2} { top-level } } - {#3} - { \@@_parse_label_default:nn {#4} { top-level } } - } + \@@_normalize_hook_rule_args:Nnnnn \@@_gset_rule:nnnn + {#1} {#2} {#3} {#4} } % \end{macrocode} % @@ -2544,7 +2682,7 @@ { \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:} \prop_map_inline:Nn \g_@@_used_prop { \iow_term:x{^^J~ ##1~ ->~ - \exp_not:v {g_@@_##1_code_tl}~ } + \exp_not:v {@@~##1}~ } } } % \end{macrocode} @@ -2566,9 +2704,11 @@ % and at \verb=\begin{document}= this is done for all hooks and % afterwards only if the hook code changes. % \begin{macrocode} -\cs_new_protected:Npn \@@_initialize_hook_code:n #1 { - \@@_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~ - '#1' \on@line :^^J} } +\cs_new_protected:Npn \@@_initialize_hook_code:n #1 + { + \debug_suspend: + \@@_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~ + '#1' \on@line :^^J} } % \end{macrocode} % This does the sorting and the updates. % First thing we do is to check if a legacy hook macro exists and @@ -2576,23 +2716,23 @@ % might make the hook non-empty so we have to do this before % the then following test. % \begin{macrocode} - \@@_include_legacy_code_chunk:n {#1} + \@@_include_legacy_code_chunk:n {#1} % \end{macrocode} % If there aren't any code % chunks for the current hook, there is no point in even starting % the sorting routine so we make a quick test for that and in that -% case just update \cs{g_@@_\meta{hook}_code_tl} to hold the next +% case just update \cs{@@~\meta{hook}} to hold the next % code. If there are code chunks we call % \cs{@@_initialize_single:NNNn} and pass to it ready made csnames % as they are needed several times inside. This way we save a bit % on processing time if we do that up front. % \begin{macrocode} - \hook_if_exist:nT {#1} - { - \prop_if_empty:cTF {g_@@_#1_code_prop} - { \tl_gset:co {g_@@_#1_code_tl} - {\cs:w g_@@_#1_code_next_tl \cs_end: } } - { + \hook_if_exist:nT {#1} + { + \prop_if_empty:cTF {g_@@_#1_code_prop} + { \tl_gset:co { @@~#1 } + { \cs:w @@_next~#1 \cs_end: } } + { % \end{macrocode} % By default the algorithm sorts the code chunks and then saves the % result in a token list for fast execution by adding the code one @@ -2601,11 +2741,11 @@ % the opposite order into the token list. So all we have to do % in preparation is to change two definitions used later on. % \begin{macrocode} - \@@_if_reversed:nTF {#1} - { \cs_set_eq:NN \@@_tl_gput:NV \tl_gput_left:NV - \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_left:NV } - { \cs_set_eq:NN \@@_tl_gput:NV \tl_gput_right:NV - \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_right:NV } + \@@_if_reversed:nTF {#1} + { \cs_set_eq:NN \@@_tl_gput:NV \tl_gput_left:NV + \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_left:NV } + { \cs_set_eq:NN \@@_tl_gput:NV \tl_gput_right:NV + \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_right:NV } % \end{macrocode} % % When sorting, some relations (namely \verb|voids|) need to @@ -2613,10 +2753,10 @@ % shouldn't appear in the sorted hook token list, so we temporarily % save the old code property list so that it can be restored later. % \begin{macrocode} - \prop_set_eq:Nc \l_@@_work_prop { g_@@_#1_code_prop } - \@@_initialize_single:cccn - { g_@@_#1_code_tl } { g_@@_#1_code_next_tl } - { g_@@_#1_labels_clist } {#1} + \prop_set_eq:Nc \l_@@_work_prop { g_@@_#1_code_prop } + \@@_initialize_single:cccn + { @@~#1 } { @@_next~#1 } + { g_@@_#1_labels_clist } {#1} % \end{macrocode} % For debug display we want to keep track of those hooks that % actually got code added to them, so we record that in plist. We @@ -2624,24 +2764,16 @@ % i.e., we are only interested in storing the keys and the value is % arbitrary. % \begin{macrocode} - \@@_debug:n{ \exp_args:NNx \prop_gput:Nnn - \g_@@_used_prop {#1}{} } - } - } -} -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\g_@@_used_prop} -% All hooks that receive code (for use in debugging display). -% \begin{macrocode} -\prop_new:N\g_@@_used_prop + \@@_debug:n{ \exp_args:NNx \prop_gput:Nnn + \g_@@_used_prop {#1}{} } + } + } + \debug_resume: + } % \end{macrocode} % \end{macro} % % -% % \begin{macro}[EXP]{\@@_tl_csname:n,\@@_seq_csname:n} % It is faster to pass a single token and expand it when necessary % than to pass a bunch of character tokens around. @@ -2653,8 +2785,6 @@ % \end{macro} % % -% -% % \begin{macro}{\l_@@_labels_seq,\l_@@_labels_int,\l_@@_front_tl, % \l_@@_rear_tl,\l_@@_label_0_tl} % @@ -2712,21 +2842,18 @@ % the moment: a label can't be equal to the number 0! \fmi{Needs % checking for, just in case} % \begin{macrocode} -\cs_new_protected:Npn \@@_initialize_single:NNNn #1#2#3#4 { -% \end{macrocode} -% -% \begin{macrocode} - \debug_suspend: +\cs_new_protected:Npn \@@_initialize_single:NNNn #1#2#3#4 + { % \end{macrocode} % Step T1: Initialize the data structure \ldots % \begin{macrocode} - \seq_clear:N \l_@@_labels_seq - \int_zero:N \l_@@_labels_int + \seq_clear:N \l_@@_labels_seq + \int_zero:N \l_@@_labels_int % \end{macrocode} % % Store the name of the hook: % \begin{macrocode} - \tl_set:Nn \l_@@_cur_hook_tl {#4} + \tl_set:Nn \l_@@_cur_hook_tl {#4} % \end{macrocode} % % We loop over the property list holding the code and record all @@ -2736,13 +2863,13 @@ % to ensure that labels named |front|, |rear|, |labels|, or |return| % don't interact with our code. % \begin{macrocode} - \prop_map_inline:Nn \l_@@_work_prop - { - \int_incr:N \l_@@_labels_int - \seq_put_right:Nn \l_@@_labels_seq {##1} - \tl_set:cn { \@@_tl_csname:n {##1} }{0} - \seq_clear_new:c { \@@_seq_csname:n {##1} } - } + \prop_map_inline:Nn \l_@@_work_prop + { + \int_incr:N \l_@@_labels_int + \seq_put_right:Nn \l_@@_labels_seq {##1} + \tl_set:cn { \@@_tl_csname:n {##1} }{0} + \seq_clear_new:c { \@@_seq_csname:n {##1} } + } % \end{macrocode} % Steps T2 and T3: Sort the relevant rules into the data structure\ldots % @@ -2758,30 +2885,30 @@ % \cs{@@_apply_label_pair:nnn}, which takes the properly-ordered pair % of labels as argument. % \begin{macrocode} - \prop_map_inline:Nn \l_@@_work_prop - { - \prop_map_inline:Nn \l_@@_work_prop - { - \@@_if_label_case:nnnnn {##1} {####1} - { \prop_map_break: } - { \@@_apply_label_pair:nnn {##1} {####1} } - { \@@_apply_label_pair:nnn {####1} {##1} } - {#4} - } - } + \prop_map_inline:Nn \l_@@_work_prop + { + \prop_map_inline:Nn \l_@@_work_prop + { + \@@_if_label_case:nnnnn {##1} {####1} + { \prop_map_break: } + { \@@_apply_label_pair:nnn {##1} {####1} } + { \@@_apply_label_pair:nnn {####1} {##1} } + {#4} + } + } % \end{macrocode} % Take a breath and take a look at the data structures that have % been set up: % \begin{macrocode} - \@@_debug:n { \@@_debug_label_data:N \l_@@_work_prop } + \@@_debug:n { \@@_debug_label_data:N \l_@@_work_prop } % \end{macrocode} % % % Step T4: % \begin{macrocode} - \tl_set:Nn \l_@@_rear_tl { 0 } - \tl_set:cn { \@@_tl_csname:n { 0 } } { 0 } - \seq_map_inline:Nn \l_@@_labels_seq + \tl_set:Nn \l_@@_rear_tl { 0 } + \tl_set:cn { \@@_tl_csname:n { 0 } } { 0 } + \seq_map_inline:Nn \l_@@_labels_seq { \int_compare:nNnT { \cs:w \@@_tl_csname:n {##1} \cs_end: } = 0 { @@ -2789,61 +2916,61 @@ \tl_set:Nn \l_@@_rear_tl {##1} } } - \tl_set_eq:Nc \l_@@_front_tl { \@@_tl_csname:n { 0 } } + \tl_set_eq:Nc \l_@@_front_tl { \@@_tl_csname:n { 0 } } % \end{macrocode} % % \begin{macrocode} - \tl_gclear:N #1 - \clist_gclear:N #3 + \tl_gclear:N #1 + \clist_gclear:N #3 % \end{macrocode} % % The whole loop combines steps T5--T7: % \begin{macrocode} - \bool_while_do:nn { ! \str_if_eq_p:Vn \l_@@_front_tl { 0 } } - { + \bool_while_do:nn { ! \str_if_eq_p:Vn \l_@@_front_tl { 0 } } + { % \end{macrocode} % This part is step T5: % \begin{macrocode} - \int_decr:N \l_@@_labels_int - \prop_get:NVN \l_@@_work_prop \l_@@_front_tl \l_@@_return_tl - \@@_tl_gput:NV #1 \l_@@_return_tl + \int_decr:N \l_@@_labels_int + \prop_get:NVN \l_@@_work_prop \l_@@_front_tl \l_@@_return_tl + \@@_tl_gput:NV #1 \l_@@_return_tl % \end{macrocode} % % \begin{macrocode} - \@@_clist_gput:NV #3 \l_@@_front_tl - \@@_debug:n{ \iow_term:x{Handled~ code~ for~ \l_@@_front_tl} } + \@@_clist_gput:NV #3 \l_@@_front_tl + \@@_debug:n{ \iow_term:x{Handled~ code~ for~ \l_@@_front_tl} } % \end{macrocode} % % This is step T6 except that we don't use a pointer $P$ to move % through the successors, but instead use \verb=##1= of the mapping % function. % \begin{macrocode} - \seq_map_inline:cn { \@@_seq_csname:n { \l_@@_front_tl } } - { - \tl_set:cx { \@@_tl_csname:n {##1} } - { \int_eval:n - { \cs:w \@@_tl_csname:n {##1} \cs_end: - 1 } - } - \int_compare:nNnT - { \cs:w \@@_tl_csname:n {##1} \cs_end: } = 0 - { - \tl_set:cn { \@@_tl_csname:n { \l_@@_rear_tl } } {##1} - \tl_set:Nn \l_@@_rear_tl {##1} - } - } + \seq_map_inline:cn { \@@_seq_csname:n { \l_@@_front_tl } } + { + \tl_set:cx { \@@_tl_csname:n {##1} } + { \int_eval:n + { \cs:w \@@_tl_csname:n {##1} \cs_end: - 1 } + } + \int_compare:nNnT + { \cs:w \@@_tl_csname:n {##1} \cs_end: } = 0 + { + \tl_set:cn { \@@_tl_csname:n { \l_@@_rear_tl } } {##1} + \tl_set:Nn \l_@@_rear_tl {##1} + } + } % \end{macrocode} % and step T7: % \begin{macrocode} - \tl_set_eq:Nc \l_@@_front_tl - { \@@_tl_csname:n { \l_@@_front_tl } } + \tl_set_eq:Nc \l_@@_front_tl + { \@@_tl_csname:n { \l_@@_front_tl } } % \end{macrocode} % % This is step T8: If we haven't moved the code for all labels % (i.e., if \cs{l_@@_labels_int} is still greater than zero) we % have a loop and our partial order can't be flattened out. % \begin{macrocode} - } - \int_compare:nNnF \l_@@_labels_int = 0 + } + \int_compare:nNnF \l_@@_labels_int = 0 { \iow_term:x{====================} \iow_term:x{Error:~ label~ rules~ are~ incompatible:} @@ -2860,12 +2987,8 @@ % with adding extra code for a one time execution. That is stored % in \verb=#2= but is normally empty. % \begin{macrocode} - \tl_gput_right:Nn #1 {#2} -% \end{macrocode} -% -% \begin{macrocode} - \debug_resume: -} + \tl_gput_right:Nn #1 {#2} + } % \end{macrocode} % % \begin{macrocode} @@ -3099,101 +3222,134 @@ % % % -% \begin{macro}{\hook_log:n} -% This writes out information about the hook given in its argument -% onto the terminal and the \texttt{.log} file. +% \begin{macro}{\hook_show:n,\hook_log:n} +% \begin{macro}{\@@_log_line:x,\@@_log_line_indent:x} +% \begin{macro}{\@@_log:nN} +% This writes out information about the hook given in its argument +% onto the \texttt{.log} file and the terminal, if \cs{show_hook:n} is +% used. Internally both share the same structure, except that at the +% end, \cs{hook_show:n} triggers \TeX's prompt. % \begin{macrocode} \cs_new_protected:Npn \hook_log:n #1 { - \exp_args:Nx \@@_log:n - { \@@_parse_label_default:nn {#1} { top-level } } + \cs_set_eq:NN \@@_log_cmd:x \iow_log:x + \@@_normalize_hook_args:Nn \@@_log:nN {#1} \tl_log:x + } +\cs_new_protected:Npn \hook_show:n #1 + { + \cs_set_eq:NN \@@_log_cmd:x \iow_term:x + \@@_normalize_hook_args:Nn \@@_log:nN {#1} \tl_show:x } -\cs_new_protected:Npn \@@_log:n #1 +\cs_new_protected:Npn \@@_log_line:x #1 + { \@@_log_cmd:x { >~#1 } } +\cs_new_protected:Npn \@@_log_line_indent:x #1 + { \@@_log_cmd:x { >~\@spaces #1 } } +\cs_new_protected:Npn \@@_log:nN #1 #2 { \@@_preamble_hook:n {#1} - \iow_term:x{^^JThe~ hook~ '#1':} + \iow_term:x { ^^J ->~The~hook~'#1': } % \end{macrocode} % % \begin{macrocode} \hook_if_exist:nF {#1} - { \iow_term:x {~Hook~ is~ not~ declared!} } + { \@@_log_line:x { is~not~declared! } } \@@_if_exist:nTF {#1} { - \iow_term:x{~Code~ chunks:} - \prop_if_empty:cTF {g_@@_#1_code_prop} - { \iow_term:x{\@spaces ---} } + \@@_log_line:x { Code~chunks: } + \prop_if_empty:cTF { g_@@_#1_code_prop } + { \@@_log_line_indent:x { --- } } { - \prop_map_inline:cn {g_@@_#1_code_prop} - { \iow_term:x{\@spaces ##1~ ->~ \tl_to_str:n{##2} } } + \prop_map_inline:cn { g_@@_#1_code_prop } + { \@@_log_line_indent:x { ##1~->~\tl_to_str:n {##2} } } } % \end{macrocode} % % \begin{macrocode} - \iow_term:x{~Extra~ code~ next~ invocation:} - \iow_term:x{\@spaces - \tl_if_empty:cTF { g_@@_#1_code_next_tl } - {---} + \@@_log_line:x { Extra~code~for~next~invocation:} + \@@_log_line_indent:x + { + \tl_if_empty:cTF { @@_next~#1 } + { --- } % \end{macrocode} +% % If the token list is not empty we want to display it but without % the first tokens (the code to clear itself) so we call a helper % command to get rid of them. % \begin{macrocode} - {->~ \exp_args:Nv - \@@_log_next_code:n {g_@@_#1_code_next_tl} } } + { ->~ \exp_args:Nv \@@_log_next_code:n { @@_next~#1 } } + } % \end{macrocode} % % Loop through the rules in a hook and for every rule found, print it. % If no rule is there, print |---|. The boolean \cs{l_@@_tmpa_bool} % here indicates if the hook has no rules. % \begin{macrocode} - \iow_term:x { ~Rules: } + \@@_log_line:x { Rules: } \bool_set_true:N \l_@@_tmpa_bool \@@_list_rules:nn {#1} { \bool_set_false:N \l_@@_tmpa_bool - \iow_term:x + \@@_log_line_indent:x { - \@spaces ##2~ with~ + ##2~ with~ \str_if_eq:nnT {##3} {??} { default~ } - relation~ ##1 } + relation~ ##1 + } } \bool_if:NT \l_@@_tmpa_bool - { \iow_term:x { \@spaces --- } } + { \@@_log_line_indent:x { --- } } % \end{macrocode} -% +% +% When the hook is declared (that is, the sorting algorithm is applied +% to that hook) and not empty % \begin{macrocode} - \bool_lazy_and:nnT + \bool_lazy_and:nnTF { \hook_if_exist_p:n {#1} } { ! \hook_if_empty_p:n {#1} } - { \iow_term:x { ~Execution~ order - \bool_if:NTF \l_@@_tmpa_bool - { \@@_if_reversed:nT {#1} - { ~ (after~ reversal) } - } - { ~ (after~ - \@@_if_reversed:nT {#1} {reversal~ and~} - applying~ rules) - } - : + { + \@@_log_line:x + { + Execution~order + \bool_if:NTF \l_@@_tmpa_bool + { \@@_if_reversed:nT {#1} { ~(after~reversal) } } + { ~(after~ + \@@_if_reversed:nT {#1} { reversal~and~ } + applying~rules) + } : + } + #2 % \tl_show:n + { + \@spaces + \clist_if_empty:cTF { g_@@_#1_labels_clist } + { --- } + { \clist_use:cn {g_@@_#1_labels_clist} { ,~ } } + } + } + { + #2 + { + Hook~ \hook_if_exist:nTF {#1} + {code~pool~empty} {not~declared} } - \iow_term:x - { \@spaces \clist_use:cn {g_@@_#1_labels_clist} { ,~ } } } } - { \iow_term:n { ~The~hook~is~empty. } } - \iow_term:n { } + { #2 { The~hook~is~empty. } } } % \end{macrocode} % +% \begin{macro}{\@@_log_next_code:n} % To display the code for next invocation only (i.e., from % \cs{AddToHookNext} we have to remove the first two tokens at the % front which are \cs{tl_gclear:N} and the token list to clear. % \begin{macrocode} -\cs_new:Npn \@@_log_next_code:n #1 { - \exp_args:No \tl_to_str:n {\use_none:nn #1} -} +\cs_new:Npn \@@_log_next_code:n #1 + { \exp_args:No \tl_to_str:n { \use_none:nn #1 } } % \end{macrocode} -% \end{macro} +% \end{macro} +% +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\@@_list_rules:nn} % \begin{macro}{\@@_list_one_rule:nnn,\@@_list_if_rule_exists:nnnF} @@ -3266,25 +3422,29 @@ % % \subsection{Specifying code for next invocation} % -% \begin{macro}{\hook_gput_next_code:nn} -% +% \begin{macro}{\hook_gput_next_code:nn} +% \begin{macro}{% +% \@@_gput_next_code:nn, +% \@@_gput_next_do:nn, +% \@@_gput_next_do:Nnn, +% \@@_clear_next:n +% } % \begin{macrocode} \cs_new_protected:Npn \hook_gput_next_code:nn #1 - { - \exp_args:Nx \@@_gput_next_code:nn - { \@@_parse_label_default:nn {#1} { top-level } } - } + { \@@_normalize_hook_args:Nn \@@_gput_next_code:nn {#1} } \cs_new_protected:Npn \@@_gput_next_code:nn #1 #2 { + \debug_suspend: \@@_declare:n {#1} \hook_if_exist:nTF {#1} { \@@_gput_next_do:nn {#1} {#2} } { \@@_try_declaring_generic_next_hook:nn {#1} {#2} } + \debug_resume: } \cs_new_protected:Npn \@@_gput_next_do:nn #1 { \exp_args:Nc \@@_gput_next_do:Nnn - { g_@@_#1_code_next_tl } {#1} + { @@_next~#1 } {#1} } % \end{macrocode} % First check if the ``next code'' token list is empty: if so we need @@ -3299,20 +3459,24 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_gput_next_do:Nnn #1 #2 { - \tl_if_empty:cT { g_@@_#2_code_tl } + \tl_if_empty:cT { @@~#2 } { \@@_update_hook_code:n {#2} } \tl_if_empty:NT #1 - { \tl_gset:Nn #1 { \tl_gclear:c { g_@@_#2_code_next_tl } } } + { \tl_gset:Nn #1 { \@@_clear_next:n {#2} } } \tl_gput_right:Nn #1 } +\cs_new_protected:Npn \@@_clear_next:n #1 + { \cs_gset_eq:cN { @@_next~#1 } \c_empty_tl } % \end{macrocode} % \end{macro} +% \end{macro} % % % \subsection{Using the hook} % % \begin{macro}{\hook_use:n} % \begin{macro}[EXP]{\@@_use_initialized:n} +% \begin{macro}{\@@_use_undefined:w,\@@_use_end:} % \begin{macro}{\@@_preamble_hook:n} % \cs{hook_use:n} as defined here is used in the preamble, where % hooks aren't initialized by default. \cs{@@_use_initialized:n} is @@ -3340,25 +3504,34 @@ % \begin{macrocode} \cs_new_protected:Npn \hook_use:n #1 { - \tl_if_exist:cTF { g_@@_#1_code_tl } + \tl_if_exist:cTF { @@~#1 } { \@@_preamble_hook:n {#1} - \cs:w g_@@_#1_code_tl \cs_end: + \cs:w @@~#1 \cs_end: } { \@@_use:wn #1 / \s_@@_mark {#1} } } \cs_new:Npn \@@_use_initialized:n #1 { - \tl_if_exist:cTF { g_@@_#1_code_tl } - { \cs:w g_@@_#1_code_tl \cs_end: } - { \@@_use:wn #1 / \s_@@_mark {#1} } + \if_cs_exist:w @@~#1 \cs_end: + \else: + \@@_use_undefined:w + \fi: + \cs:w @@~#1 \@@_use_end: + } +\cs_new:Npn \@@_use_undefined:w #1 #2 @@~#3 \@@_use_end: + { + #1 % fi + \@@_use:wn #3 / \s_@@_mark {#3} } \cs_new_protected:Npn \@@_preamble_hook:n #1 { \@@_initialize_hook_code:n {#1} } +\cs_new_eq:NN \@@_use_end: \cs_end: % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}[EXP]{\@@_use:wn} % \begin{macro}{\@@_try_file_hook:n,\@@_if_exist_use:n} @@ -3391,10 +3564,10 @@ } \cs_new_protected:Npn \@@_if_exist_use:n #1 { - \tl_if_exist:cT { g_@@_#1_code_tl } + \tl_if_exist:cT { @@~#1 } { \@@_preamble_hook:n {#1} - \cs:w g_@@_#1_code_tl \cs_end: + \cs:w @@~#1 \cs_end: } } % \end{macrocode} @@ -3404,18 +3577,28 @@ % \begin{macro}{\hook_use_once:n} % For hooks that can and should be used only once we have a special % use command that remembers the hook name in -% \cs{g_@@_execute_immediately_clist}. This has the effect that any +% \cs{g_@@_execute_immediately_prop}. This has the effect that any % further code added to the hook is executed immediately rather % than stored in the hook. +% +% The code needs some gymnastics to prevent space trimming from the +% hook name, since \cs{hook_use:n} and \cs{hook_use_once:n} are +% documented to not trim spaces. +% +% \pho{Should this raise an error if the hook doesn't exist?} % \begin{macrocode} \cs_new_protected:Npn \hook_use_once:n #1 { - \tl_if_exist:cT { g_@@_#1_code_tl } + \tl_if_exist:cT { @@~#1 } { - \clist_gput_left:Nn \g_@@_execute_immediately_clist {#1} + \tl_set:Nn \l_@@_return_tl {#1} + \@@_normalize_hook_args:Nn \@@_use_once_store:n + { \l_@@_return_tl } \hook_use:n {#1} } } +\cs_new_protected:Npn \@@_use_once_store:n #1 + { \prop_gput:Nnn \g_@@_execute_immediately_prop {#1} { } } % \end{macrocode} % \end{macro} % @@ -3445,7 +3628,7 @@ % Test if a hook is empty (that is, no code was added to that hook). % A hook being empty means that \emph{both} its % \cs[no-index]{g_@@_\meta{hook}_code_prop} and its -% \cs[no-index]{g_@@_\meta{hook}_code_next_tl} are empty. +% \cs[no-index]{@@_next~\meta{hook}} are empty. % \begin{macrocode} \prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF } { @@ -3453,7 +3636,7 @@ { \bool_lazy_and:nnTF { \prop_if_empty_p:c { g_@@_#1_code_prop } } - { \tl_if_empty_p:c { g_@@_#1_code_next_tl } } + { \tl_if_empty_p:c { @@_next~#1 } } { \prg_return_true: } { \prg_return_false: } } @@ -3465,7 +3648,7 @@ % \begin{macro}[pTF]{\hook_if_exist:n} % A canonical way to test if a hook exists. A hook exists if the % token list that stores the sorted code for that hook, -% \cs[no-index]{g_@@_\meta{hook}_code_tl}, exists. The property list +% \cs[no-index]{@@~\meta{hook}}, exists. The property list % \cs[no-index]{g_@@_\meta{hook}_code_prop} cannot be used here % because often it is necessary to add code to a hook without knowing % if such hook was already declared, or even if it will ever be @@ -3473,7 +3656,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \hook_if_exist:n #1 { p , T , F , TF } { - \tl_if_exist:cTF { g_@@_#1_code_tl } + \tl_if_exist:cTF { @@~#1 } { \prg_return_true: } { \prg_return_false: } } @@ -3510,13 +3693,6 @@ % \end{macro} % % -% \begin{macro}{\g_@@_execute_immediately_clist} -% List of hooks that from no on should not longer receive code. -% \begin{macrocode} -\clist_new:N \g_@@_execute_immediately_clist -% \end{macrocode} -% \end{macro} -% % \subsection{Messages} % % \begin{macrocode} @@ -3588,11 +3764,7 @@ % % \begin{macrocode} \NewDocumentCommand \AddToHook { m o +m } - { - \clist_if_in:NnTF \g_@@_execute_immediately_clist {#1} - {#3} - { \hook_gput_code:nnn {#1} {#2} {#3} } - } + { \hook_gput_code:nnn {#1} {#2} {#3} } % \end{macrocode} % \end{macro} % @@ -3685,19 +3857,19 @@ % Avoid the overhead of \pkg{xparse} and its protection that we % don't want here (since the hook should vanish without trace if empty)! % \begin{macrocode} -\newcommand \UseHook { \hook_use:n } -\newcommand \UseOneTimeHook { \hook_use_once:n } +\cs_new:Npn \UseHook { \hook_use:n } +\cs_new:Npn \UseOneTimeHook { \hook_use_once:n } % \end{macrocode} % \end{macro} % % % -% \begin{macro}{\ShowHook} -% +% \begin{macro}{\ShowHook,\LogHook} % \begin{macrocode} -\cs_new_protected:Npn \ShowHook { \hook_log:n } +\cs_new_protected:Npn \ShowHook { \hook_show:n } +\cs_new_protected:Npn \LogHook { \hook_log:n } % \end{macrocode} -% \end{macro} +% \end{macro} % % \begin{macro}{\DebugHooksOn,\DebugHooksOff} % @@ -3722,7 +3894,7 @@ % \begin{macrocode} \NewDocumentCommand \DeclareDefaultHookRule { m m m } { \hook_gset_rule:nnnn {??}{#1}{#2}{#3} } -\@onlypreamble\DeclareDefaultHookRule +\@onlypreamble\DeclareDefaultHookRule % \end{macrocode} % \end{macro} % @@ -3766,12 +3938,12 @@ % % \begin{macrocode} \cs_new_eq:NN \@expl@@@initialize@all@@ - \__hook_initialize_all: + \__hook_initialize_all: % \end{macrocode} % % \begin{macrocode} -\cs_new_eq:NN \@expl@@@hook@curr@name@push@@n - \__hook_curr_name_push:n +\cs_new_eq:NN \@expl@@@hook@curr@name@push@@n + \__hook_curr_name_push:n % \end{macrocode} % % \begin{macrocode} diff --git a/macros/latex-dev/base/ltluatex.pdf b/macros/latex-dev/base/ltluatex.pdf index f6c98b2b9f..3b1e49da26 100644 Binary files a/macros/latex-dev/base/ltluatex.pdf and b/macros/latex-dev/base/ltluatex.pdf differ diff --git a/macros/latex-dev/base/ltnews.pdf b/macros/latex-dev/base/ltnews.pdf index 5fa6b9b855..a890a221d1 100644 Binary files a/macros/latex-dev/base/ltnews.pdf and b/macros/latex-dev/base/ltnews.pdf differ diff --git a/macros/latex-dev/base/ltnews01.pdf b/macros/latex-dev/base/ltnews01.pdf index 132c99241c..0c4cda302e 100644 Binary files a/macros/latex-dev/base/ltnews01.pdf and b/macros/latex-dev/base/ltnews01.pdf differ diff --git a/macros/latex-dev/base/ltnews02.pdf b/macros/latex-dev/base/ltnews02.pdf index 3cb443cacc..7fb62414db 100644 Binary files a/macros/latex-dev/base/ltnews02.pdf and b/macros/latex-dev/base/ltnews02.pdf differ diff --git a/macros/latex-dev/base/ltnews03.pdf b/macros/latex-dev/base/ltnews03.pdf index 489ba8fbfb..d3d6d5104e 100644 Binary files a/macros/latex-dev/base/ltnews03.pdf and b/macros/latex-dev/base/ltnews03.pdf differ diff --git a/macros/latex-dev/base/ltnews04.pdf b/macros/latex-dev/base/ltnews04.pdf index d19579de3e..ed2708170a 100644 Binary files a/macros/latex-dev/base/ltnews04.pdf and b/macros/latex-dev/base/ltnews04.pdf differ diff --git a/macros/latex-dev/base/ltnews05.pdf b/macros/latex-dev/base/ltnews05.pdf index 07cf7ae8a5..55d21d641b 100644 Binary files a/macros/latex-dev/base/ltnews05.pdf and b/macros/latex-dev/base/ltnews05.pdf differ diff --git a/macros/latex-dev/base/ltnews06.pdf b/macros/latex-dev/base/ltnews06.pdf index 526c9dc167..99ab73bba7 100644 Binary files a/macros/latex-dev/base/ltnews06.pdf and b/macros/latex-dev/base/ltnews06.pdf differ diff --git a/macros/latex-dev/base/ltnews07.pdf b/macros/latex-dev/base/ltnews07.pdf index 9bdb3c44fa..dc6913b4d6 100644 Binary files a/macros/latex-dev/base/ltnews07.pdf and b/macros/latex-dev/base/ltnews07.pdf differ diff --git a/macros/latex-dev/base/ltnews08.pdf b/macros/latex-dev/base/ltnews08.pdf index a5305c0439..90d3b71e74 100644 Binary files a/macros/latex-dev/base/ltnews08.pdf and b/macros/latex-dev/base/ltnews08.pdf differ diff --git a/macros/latex-dev/base/ltnews09.pdf b/macros/latex-dev/base/ltnews09.pdf index 25bcf3b22d..8cbf054743 100644 Binary files a/macros/latex-dev/base/ltnews09.pdf and b/macros/latex-dev/base/ltnews09.pdf differ diff --git a/macros/latex-dev/base/ltnews10.pdf b/macros/latex-dev/base/ltnews10.pdf index d0cd783491..bb03c0497a 100644 Binary files a/macros/latex-dev/base/ltnews10.pdf and b/macros/latex-dev/base/ltnews10.pdf differ diff --git a/macros/latex-dev/base/ltnews11.pdf b/macros/latex-dev/base/ltnews11.pdf index c7ba9f8feb..b34534a9e4 100644 Binary files a/macros/latex-dev/base/ltnews11.pdf and b/macros/latex-dev/base/ltnews11.pdf differ diff --git a/macros/latex-dev/base/ltnews12.pdf b/macros/latex-dev/base/ltnews12.pdf index 3899b9d294..3ce0db8cf5 100644 Binary files a/macros/latex-dev/base/ltnews12.pdf and b/macros/latex-dev/base/ltnews12.pdf differ diff --git a/macros/latex-dev/base/ltnews13.pdf b/macros/latex-dev/base/ltnews13.pdf index 9a6656aa30..24e3509509 100644 Binary files a/macros/latex-dev/base/ltnews13.pdf and b/macros/latex-dev/base/ltnews13.pdf differ diff --git a/macros/latex-dev/base/ltnews14.pdf b/macros/latex-dev/base/ltnews14.pdf index 0d3906f63d..9e714d1446 100644 Binary files a/macros/latex-dev/base/ltnews14.pdf and b/macros/latex-dev/base/ltnews14.pdf differ diff --git a/macros/latex-dev/base/ltnews15.pdf b/macros/latex-dev/base/ltnews15.pdf index c94d07f167..bb345d0b9a 100644 Binary files a/macros/latex-dev/base/ltnews15.pdf and b/macros/latex-dev/base/ltnews15.pdf differ diff --git a/macros/latex-dev/base/ltnews16.pdf b/macros/latex-dev/base/ltnews16.pdf index afaa2d49d3..1f05a76075 100644 Binary files a/macros/latex-dev/base/ltnews16.pdf and b/macros/latex-dev/base/ltnews16.pdf differ diff --git a/macros/latex-dev/base/ltnews17.pdf b/macros/latex-dev/base/ltnews17.pdf index 0e5e08732e..8bfb542a8a 100644 Binary files a/macros/latex-dev/base/ltnews17.pdf and b/macros/latex-dev/base/ltnews17.pdf differ diff --git a/macros/latex-dev/base/ltnews18.pdf b/macros/latex-dev/base/ltnews18.pdf index d81914117e..8e17971dc9 100644 Binary files a/macros/latex-dev/base/ltnews18.pdf and b/macros/latex-dev/base/ltnews18.pdf differ diff --git a/macros/latex-dev/base/ltnews19.pdf b/macros/latex-dev/base/ltnews19.pdf index 8a27941114..6b61682b7e 100644 Binary files a/macros/latex-dev/base/ltnews19.pdf and b/macros/latex-dev/base/ltnews19.pdf differ diff --git a/macros/latex-dev/base/ltnews20.pdf b/macros/latex-dev/base/ltnews20.pdf index 9c35861a8b..9655c58045 100644 Binary files a/macros/latex-dev/base/ltnews20.pdf and b/macros/latex-dev/base/ltnews20.pdf differ diff --git a/macros/latex-dev/base/ltnews21.pdf b/macros/latex-dev/base/ltnews21.pdf index a708475e95..97e68f9023 100644 Binary files a/macros/latex-dev/base/ltnews21.pdf and b/macros/latex-dev/base/ltnews21.pdf differ diff --git a/macros/latex-dev/base/ltnews22.pdf b/macros/latex-dev/base/ltnews22.pdf index 96dba3bd9e..280960478d 100644 Binary files a/macros/latex-dev/base/ltnews22.pdf and b/macros/latex-dev/base/ltnews22.pdf differ diff --git a/macros/latex-dev/base/ltnews23.pdf b/macros/latex-dev/base/ltnews23.pdf index 4b60f97a9c..6d28bb490e 100644 Binary files a/macros/latex-dev/base/ltnews23.pdf and b/macros/latex-dev/base/ltnews23.pdf differ diff --git a/macros/latex-dev/base/ltnews24.pdf b/macros/latex-dev/base/ltnews24.pdf index c9f4d83b64..19ab77e716 100644 Binary files a/macros/latex-dev/base/ltnews24.pdf and b/macros/latex-dev/base/ltnews24.pdf differ diff --git a/macros/latex-dev/base/ltnews25.pdf b/macros/latex-dev/base/ltnews25.pdf index 2cd7928a24..f4d721b98d 100644 Binary files a/macros/latex-dev/base/ltnews25.pdf and b/macros/latex-dev/base/ltnews25.pdf differ diff --git a/macros/latex-dev/base/ltnews26.pdf b/macros/latex-dev/base/ltnews26.pdf index d41d1e92a2..0e2c54327b 100644 Binary files a/macros/latex-dev/base/ltnews26.pdf and b/macros/latex-dev/base/ltnews26.pdf differ diff --git a/macros/latex-dev/base/ltnews27.pdf b/macros/latex-dev/base/ltnews27.pdf index d9fdef0d3c..6aabf9663e 100644 Binary files a/macros/latex-dev/base/ltnews27.pdf and b/macros/latex-dev/base/ltnews27.pdf differ diff --git a/macros/latex-dev/base/ltnews28.pdf b/macros/latex-dev/base/ltnews28.pdf index 3b61224d22..116a4e1a6b 100644 Binary files a/macros/latex-dev/base/ltnews28.pdf and b/macros/latex-dev/base/ltnews28.pdf differ diff --git a/macros/latex-dev/base/ltnews29.pdf b/macros/latex-dev/base/ltnews29.pdf index 973a052b7e..72a351406e 100644 Binary files a/macros/latex-dev/base/ltnews29.pdf and b/macros/latex-dev/base/ltnews29.pdf differ diff --git a/macros/latex-dev/base/ltnews30.pdf b/macros/latex-dev/base/ltnews30.pdf index 5d16b19cb0..6d6495a007 100644 Binary files a/macros/latex-dev/base/ltnews30.pdf and b/macros/latex-dev/base/ltnews30.pdf differ diff --git a/macros/latex-dev/base/ltnews31.pdf b/macros/latex-dev/base/ltnews31.pdf index f3219cff44..035d2259c1 100644 Binary files a/macros/latex-dev/base/ltnews31.pdf and b/macros/latex-dev/base/ltnews31.pdf differ diff --git a/macros/latex-dev/base/ltnews32.pdf b/macros/latex-dev/base/ltnews32.pdf index 5e3d9ff899..850d3dbf79 100644 Binary files a/macros/latex-dev/base/ltnews32.pdf and b/macros/latex-dev/base/ltnews32.pdf differ diff --git a/macros/latex-dev/base/ltshipout-code.pdf b/macros/latex-dev/base/ltshipout-code.pdf index 0456d62a50..13d7a72414 100644 Binary files a/macros/latex-dev/base/ltshipout-code.pdf and b/macros/latex-dev/base/ltshipout-code.pdf differ diff --git a/macros/latex-dev/base/ltshipout-doc.pdf b/macros/latex-dev/base/ltshipout-doc.pdf index da5dfd5080..9970447b2b 100644 Binary files a/macros/latex-dev/base/ltshipout-doc.pdf and b/macros/latex-dev/base/ltshipout-doc.pdf differ diff --git a/macros/latex-dev/base/ltshipout.dtx b/macros/latex-dev/base/ltshipout.dtx index 650c46866e..95d740279d 100644 --- a/macros/latex-dev/base/ltshipout.dtx +++ b/macros/latex-dev/base/ltshipout.dtx @@ -31,8 +31,8 @@ %%% From File: ltshipout.dtx % % \begin{macrocode} -\providecommand\ltshipoutversion{v1.0a} -\providecommand\ltshipoutdate{2020/08/31} +\providecommand\ltshipoutversion{v1.0b} +\providecommand\ltshipoutdate{2020/09/09} % \end{macrocode} % %<*driver> @@ -412,7 +412,7 @@ % % \begin{function}{\AtBeginShipoutInit} % By default \pkg{atbegshi} delayed its action until -% \verb=\beg{document}=. This command was forcing it in an earlier +% \verb=\begin{document}=. This command was forcing it in an earlier % place. With the new concept it does nothing. % \end{function} % @@ -1085,7 +1085,7 @@ % Put the argument into a \texttt{picture} environment that doesn't take up % any size and uses \texttt{1pt} for \cs{unitlength}. % \fmi{Could perhaps be generalized as it might be useful elsewhere. For -% not it is not.} +% now it is not.} % \begin{macrocode} \cs_new:Npn \@@_picture_overlay:n #1 { % \end{macrocode} @@ -1100,8 +1100,15 @@ \vbox_to_zero:n { \kern -\c_@@_vorigin_tl \scan_stop: \unitlength 1pt \scan_stop: - \hbox_set_to_wd:Nnn \l_@@_tmp_box \c_zero_dim { \ignorespaces #1 } -% \box_set_wd:Nn \l_@@_tmp_box \c_zero_dim +% \end{macrocode} +% This mimics a simple zero-sized picture environment. The \cs{hss} +% is need in case there is horizontal material (without using +% \cs{put} with a positive width. +% \changes{v1.0b}{2020/09/09} +% {Prevent overfull box warnings (gh/387)} +% \begin{macrocode} + \hbox_set_to_wd:Nnn \l_@@_tmp_box \c_zero_dim + { \ignorespaces #1 \hss } \box_set_ht:Nn \l_@@_tmp_box \c_zero_dim \box_set_dp:Nn \l_@@_tmp_box \c_zero_dim \box_use:N \l_@@_tmp_box @@ -1567,7 +1574,7 @@ % % \begin{macrocode} %<*atbegshi-ltx> -\ProvidesPackage{atbegshi} +\ProvidesPackage{atbegshi-ltx} [2020/08/17 v1.0a Emulation of the original atbegshi package^^Jwith kernel methods] % \end{macrocode} @@ -1673,7 +1680,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesPackage{everyshi} +\ProvidesPackage{everyshi-ltx} [2020/08/17 v1.0a Emulation of the original everyshi package^^Jwith kernel methods] % \end{macrocode} diff --git a/macros/latex-dev/base/ltvers.dtx b/macros/latex-dev/base/ltvers.dtx index f02a9cdc47..83cdf1850d 100644 --- a/macros/latex-dev/base/ltvers.dtx +++ b/macros/latex-dev/base/ltvers.dtx @@ -115,7 +115,7 @@ {2020-10-01} % %<*2ekernel> -\def\patch@level{-8} +\def\patch@level{-9} % \end{macrocode} % % \begin{macro}{\development@branch@name} diff --git a/macros/latex-dev/base/ltx3info.pdf b/macros/latex-dev/base/ltx3info.pdf index 66f3630d67..420058561e 100644 Binary files a/macros/latex-dev/base/ltx3info.pdf and b/macros/latex-dev/base/ltx3info.pdf differ diff --git a/macros/latex-dev/base/ltxdoc.pdf b/macros/latex-dev/base/ltxdoc.pdf index a366dd9d9e..02b74f93ba 100644 Binary files a/macros/latex-dev/base/ltxdoc.pdf and b/macros/latex-dev/base/ltxdoc.pdf differ diff --git a/macros/latex-dev/base/makeindx.pdf b/macros/latex-dev/base/makeindx.pdf index c95d21b584..c1774541c1 100644 Binary files a/macros/latex-dev/base/makeindx.pdf and b/macros/latex-dev/base/makeindx.pdf differ diff --git a/macros/latex-dev/base/manual.pdf b/macros/latex-dev/base/manual.pdf index f18a49e872..cb07d3d20c 100644 Binary files a/macros/latex-dev/base/manual.pdf and b/macros/latex-dev/base/manual.pdf differ diff --git a/macros/latex-dev/base/modguide.pdf b/macros/latex-dev/base/modguide.pdf index f898b44b83..1c0a657082 100644 Binary files a/macros/latex-dev/base/modguide.pdf and b/macros/latex-dev/base/modguide.pdf differ diff --git a/macros/latex-dev/base/nfssfont.pdf b/macros/latex-dev/base/nfssfont.pdf index cb94d382b9..538cf60589 100644 Binary files a/macros/latex-dev/base/nfssfont.pdf and b/macros/latex-dev/base/nfssfont.pdf differ diff --git a/macros/latex-dev/base/proc.pdf b/macros/latex-dev/base/proc.pdf index a2cf1a4b2e..284b07fea0 100644 Binary files a/macros/latex-dev/base/proc.pdf and b/macros/latex-dev/base/proc.pdf differ diff --git a/macros/latex-dev/base/slides.pdf b/macros/latex-dev/base/slides.pdf index 43cd65b902..e7c9c947bf 100644 Binary files a/macros/latex-dev/base/slides.pdf and b/macros/latex-dev/base/slides.pdf differ diff --git a/macros/latex-dev/base/slifonts.pdf b/macros/latex-dev/base/slifonts.pdf index 5343749f64..ebd1eed1d3 100644 Binary files a/macros/latex-dev/base/slifonts.pdf and b/macros/latex-dev/base/slifonts.pdf differ diff --git a/macros/latex-dev/base/source2e.pdf b/macros/latex-dev/base/source2e.pdf index 671b4cf280..f563c90f69 100644 Binary files a/macros/latex-dev/base/source2e.pdf and b/macros/latex-dev/base/source2e.pdf differ diff --git a/macros/latex-dev/base/syntonly.pdf b/macros/latex-dev/base/syntonly.pdf index 7b13311d3e..badd366452 100644 Binary files a/macros/latex-dev/base/syntonly.pdf and b/macros/latex-dev/base/syntonly.pdf differ diff --git a/macros/latex-dev/base/tlc2.pdf b/macros/latex-dev/base/tlc2.pdf index e8d6d2374a..e879e9e7ed 100644 Binary files a/macros/latex-dev/base/tlc2.pdf and b/macros/latex-dev/base/tlc2.pdf differ diff --git a/macros/latex-dev/base/tulm.pdf b/macros/latex-dev/base/tulm.pdf index f1d66d765c..93e4fd65c6 100644 Binary files a/macros/latex-dev/base/tulm.pdf and b/macros/latex-dev/base/tulm.pdf differ diff --git a/macros/latex-dev/base/usrguide.pdf b/macros/latex-dev/base/usrguide.pdf index 6d5beb8320..2dd6844667 100644 Binary files a/macros/latex-dev/base/usrguide.pdf and b/macros/latex-dev/base/usrguide.pdf differ diff --git a/macros/latex-dev/base/utf8ienc.pdf b/macros/latex-dev/base/utf8ienc.pdf index 8e2035df46..cbd563ad22 100644 Binary files a/macros/latex-dev/base/utf8ienc.pdf and b/macros/latex-dev/base/utf8ienc.pdf differ diff --git a/macros/latex-dev/base/webcomp.pdf b/macros/latex-dev/base/webcomp.pdf index 6025350189..0687dc796e 100644 Binary files a/macros/latex-dev/base/webcomp.pdf and b/macros/latex-dev/base/webcomp.pdf differ -- cgit v1.2.3