diff options
author | Karl Berry <karl@freefriends.org> | 2021-02-27 21:53:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-02-27 21:53:07 +0000 |
commit | 3aeabb285aafc636e2ce6657efe30fa08145072d (patch) | |
tree | 619045befb3794f7d490b90a26ca6f333b9ffd05 /Master/texmf-dist/source/latex-dev | |
parent | f4e4089505eb2d3b2b3c7e7576f777981c6b8622 (diff) |
latex-dev (27feb21)
git-svn-id: svn://tug.org/texlive/trunk@57982 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex-dev')
133 files changed, 7056 insertions, 752 deletions
diff --git a/Master/texmf-dist/source/latex-dev/base/alltt.dtx b/Master/texmf-dist/source/latex-dev/base/alltt.dtx index 0810cd73023..350229ab40f 100644 --- a/Master/texmf-dist/source/latex-dev/base/alltt.dtx +++ b/Master/texmf-dist/source/latex-dev/base/alltt.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -30,7 +30,7 @@ %% %% File `alltt.dtx'. %% Copyright (C) 1987 by Leslie Lamport -%% Copyright (C) 1994--2020 LaTeX3 project, Johannes Braams +%% Copyright (C) 1994-2021 LaTeX Project, Johannes Braams %% all rights reserved. %% %<*dtx> @@ -40,10 +40,11 @@ %<package>\ProvidesPackage{alltt} %<driver>\ProvidesFile{alltt.drv} %\ProvidesFile{alltt.dtx} - [2020/11/23 v2.0g defines alltt environment] + [2021/01/29 v2.0g defines alltt environment] % %<*driver> \documentclass{ltxdoc} +\usepackage{alltt} \begin{document} \providecommand{\Lenv}[1]{\textsf{#1}} \providecommand{\pkg}[1]{\texttt{#1}} @@ -55,6 +56,8 @@ % % \changes{v2.0g}{1997/06/16}{A few documentation fixes (PR 2520)} % \changes{v2.0d}{1995/04/02}{A few documentation fixes (PR 1517)} +% \changes{v2.0g}{2021-01-29}{Added a warning about OT1 versus T1 font +% encoding} % % \GetFileInfo{alltt.dtx} % \title{The \texttt{alltt} environment\thanks{This file @@ -88,11 +91,19 @@ % extra blank line if you're not careful. % % \item Insert a math formula. Note that |$| just produces a dollar -% sign, so you'll have to type |\(...\)| or |\[...\]|. Also, |^| -% and |_| just produce their characters; use |\sp| or |\sb| for -% super- and subscripts, as in |\(x\sp{2}\)|. +% sign, so you'll have to type |\(...\)| or |\[...\]|. Also, |^| +% and |_| just produce their characters; use |\sp| or |\sb| for +% super- and subscripts, as in |\(x\sp{2}\)|. % \end{itemize} % +% \textbf{NB} When you are using \textsf{OT1} encoded fonts you might +% be surprsied when you switch to italics, becuase those fonts have +% a different set of glyphs: +% \begin{alltt} +% The glyph at the position of the $ in a slanted font: \textsl{$}. +% The glyph at the position of the $ in an italic font: \textit{$}. +% \end{alltt} +% % \StopEventually{} % % \section{The Implementation} diff --git a/Master/texmf-dist/source/latex-dev/base/alltt.ins b/Master/texmf-dist/source/latex-dev/base/alltt.ins index 817a00f3a68..7ce21032079 100644 --- a/Master/texmf-dist/source/latex-dev/base/alltt.ins +++ b/Master/texmf-dist/source/latex-dev/base/alltt.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/classes.dtx b/Master/texmf-dist/source/latex-dev/base/classes.dtx index c91b3381435..ffe04c620fa 100644 --- a/Master/texmf-dist/source/latex-dev/base/classes.dtx +++ b/Master/texmf-dist/source/latex-dev/base/classes.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -53,7 +53,7 @@ %<*driver> \ProvidesFile{classes.drv} %</driver> - [2020/11/23 v1.4m + [2021/02/12 v1.4n %<article|report|book> Standard LaTeX document class] %<10pt|11pt|12pt> Standard LaTeX file (size option)] % \end{macrocode} @@ -221,9 +221,9 @@ % file has version number \fileversion, last revised \filedate.}} % % \author{% -% Copyright (C) 1992 by Leslie Lamport \and -% Copyright (C) 1994-2020 by Frank Mittelbach \and Johannes Braams \and -% \LaTeX3 Project Team +% Copyright (C) 1992 by Leslie Lamport and +% Copyright (C) 1994-2020 by Frank Mittelbach and Johannes Braams and +% LaTeX Project Team % } % \date{\filedate} % \MaintainedByLaTeXTeam{latex} @@ -2953,11 +2953,12 @@ % the labels of the various itemization levels: the symbols used are % bullet, bold en-dash, centered asterisk and centred dot. % +% \changes{v1.4n}{2021/06/11}{Drop incorrect space in \cs{labelitemiv} (gh/496)} % \begin{macrocode} \newcommand\labelitemi {\labelitemfont \textbullet} \newcommand\labelitemii {\labelitemfont \bfseries \textendash} \newcommand\labelitemiii{\labelitemfont \textasteriskcentered} -\newcommand\labelitemiv{ \labelitemfont \textperiodcentered} +\newcommand\labelitemiv {\labelitemfont \textperiodcentered} % \end{macrocode} % % \begin{macro}{\labelitemfont} @@ -2966,13 +2967,16 @@ % produced regardless of surrounding conditions. % % \changes{v1.4l}{2019/12/20}{Normalize label fonts} -% A possible alternative would be +% Possible alternatives would be, for example, %\begin{verbatim} -%\renewcommand\labelitemfont{% -% \fontseries\seriesdefault -% \fontshape\shapedefault\selectfont} +% \renewcommand\labelitemfont +% {\normalfont\fontfamily{lmss}\selectfont} +% \renewcommand\labelitemfont +% {\rmfamily\normalshape} %\end{verbatim} -% which resets series and shape doesn't touch the family. +% the first would use symbols from Latin Modern Sans, the second +% would only allow changes in the font series so that an +% \texttt{itemize} in a bold context would produce bolder symbols. % \begin{macrocode} \newcommand\labelitemfont{\normalfont} % \end{macrocode} diff --git a/Master/texmf-dist/source/latex-dev/base/classes.ins b/Master/texmf-dist/source/latex-dev/base/classes.ins index b3f3e19fc40..be0dcaf8ff3 100644 --- a/Master/texmf-dist/source/latex-dev/base/classes.ins +++ b/Master/texmf-dist/source/latex-dev/base/classes.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/cmextra.ins b/Master/texmf-dist/source/latex-dev/base/cmextra.ins index f96b04221a7..c530e04d0bb 100644 --- a/Master/texmf-dist/source/latex-dev/base/cmextra.ins +++ b/Master/texmf-dist/source/latex-dev/base/cmextra.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd b/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd index 1eb318b0492..f991ee564ee 100644 --- a/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd +++ b/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright 1993-2019 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/cmfonts.ins b/Master/texmf-dist/source/latex-dev/base/cmfonts.ins index 430abdd5f96..d54a325f42e 100644 --- a/Master/texmf-dist/source/latex-dev/base/cmfonts.ins +++ b/Master/texmf-dist/source/latex-dev/base/cmfonts.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/doc.dtx b/Master/texmf-dist/source/latex-dev/base/doc.dtx index c860a674382..c1a96948a89 100644 --- a/Master/texmf-dist/source/latex-dev/base/doc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/doc.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/docstrip.dtx b/Master/texmf-dist/source/latex-dev/base/docstrip.dtx index ea3a443c395..c7480988b44 100644 --- a/Master/texmf-dist/source/latex-dev/base/docstrip.dtx +++ b/Master/texmf-dist/source/latex-dev/base/docstrip.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -42,7 +42,7 @@ %% Frank Mittelbach %% Copyright (C) 1995 Marcin Woli\'nski %% Copyright (C) 1996-1997 Mark Wooding, Marcin Woli\'nski -%% Copyright (C) 1998-2020 LaTeX3 project and the above authors +%% Copyright (C) 1998-2021 LaTeX Project and the above authors. %% All rights are reserved. %% % @@ -789,7 +789,7 @@ % % \section{Internal functions and variables} % -% An important consideration for \LaTeX3 development is separating +% An important consideration for \LaTeX\ development is separating % out public and internal functions. Functions and variables which % are private to one module should not be used or modified by any % other module. As \TeX{} does not have any formal namespacing diff --git a/Master/texmf-dist/source/latex-dev/base/docstrip.ins b/Master/texmf-dist/source/latex-dev/base/docstrip.ins index edc75d8258c..e34281fc365 100644 --- a/Master/texmf-dist/source/latex-dev/base/docstrip.ins +++ b/Master/texmf-dist/source/latex-dev/base/docstrip.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -53,7 +53,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ec.ins b/Master/texmf-dist/source/latex-dev/base/ec.ins index ce702d8a27f..90b7b2e61f3 100644 --- a/Master/texmf-dist/source/latex-dev/base/ec.ins +++ b/Master/texmf-dist/source/latex-dev/base/ec.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/exscale.dtx b/Master/texmf-dist/source/latex-dev/base/exscale.dtx index b6f465443f5..ea67cb6fb72 100644 --- a/Master/texmf-dist/source/latex-dev/base/exscale.dtx +++ b/Master/texmf-dist/source/latex-dev/base/exscale.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/exscale.ins b/Master/texmf-dist/source/latex-dev/base/exscale.ins index 8a22a7f9385..cfd2c535a77 100644 --- a/Master/texmf-dist/source/latex-dev/base/exscale.ins +++ b/Master/texmf-dist/source/latex-dev/base/exscale.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/fix-cm.dtx b/Master/texmf-dist/source/latex-dev/base/fix-cm.dtx index d844b65aa51..1be2e16cc09 100644 --- a/Master/texmf-dist/source/latex-dev/base/fix-cm.dtx +++ b/Master/texmf-dist/source/latex-dev/base/fix-cm.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/fix-cm.ins b/Master/texmf-dist/source/latex-dev/base/fix-cm.ins index 840d5e408c2..95931970f47 100644 --- a/Master/texmf-dist/source/latex-dev/base/fix-cm.ins +++ b/Master/texmf-dist/source/latex-dev/base/fix-cm.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/fontdef.dtx b/Master/texmf-dist/source/latex-dev/base/fontdef.dtx index 6900a020744..581cfeb7895 100644 --- a/Master/texmf-dist/source/latex-dev/base/fontdef.dtx +++ b/Master/texmf-dist/source/latex-dev/base/fontdef.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -39,7 +39,7 @@ %<driver, >\ProvidesFile{fontdef.drv} % \fi % \ProvidesFile{fontdef.dtx} -%<-latexrelease> [2020/11/24 v3.0i LaTeX Kernel +%<-latexrelease> [2021/01/15 v3.0i LaTeX Kernel % \iftrue (\else %<text, >(Text %<math, >(Math @@ -227,7 +227,7 @@ % described in \texttt{ltoutenc.dtx}. % % By convention, text encoding specific declarations, including the -% declaration |\DeclareFontEncoding|, are kept in separate file of +% |\DeclareFontEncoding| declaration, are kept in separate file of % the form \meta{enc}\texttt{enc.def}, e.g.~\texttt{ot1enc.def}. This % allows other applications to make use of the declarations as % well. diff --git a/Master/texmf-dist/source/latex-dev/base/format.ins b/Master/texmf-dist/source/latex-dev/base/format.ins index f872c31a3e4..9c90555b9f3 100644 --- a/Master/texmf-dist/source/latex-dev/base/format.ins +++ b/Master/texmf-dist/source/latex-dev/base/format.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. @@ -88,8 +88,8 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 2015 -The LaTeX3 Project and any individual authors listed elsewhere +Copyright (C) 2015-2021 +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. @@ -124,7 +124,7 @@ extension .ins) which are part of the distribution. This is a generated file. Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. @@ -166,6 +166,7 @@ the system are in the document `cfgguide.tex'. % we have the extensions as soon as possible. \from{ltexpl.dtx}{2ekernel} % expl3-based extensions \from{ltdefns.dtx}{2ekernel} + \from{ltcmd.dtx}{2ekernel} % Used to be xparse \from{lthooks.dtx}{2ekernel} % L3 layer module \from{ltalloc.dtx}{2ekernel} \from{ltcntrl.dtx}{2ekernel} @@ -233,13 +234,15 @@ the system are in the document `cfgguide.tex'. % hook management support -\generate{\file{everyshi-ltx.sty}{\from{ltshipout.dtx}{everyshi-ltx}}} % emulating everyshi \generate{\file{atbegshi-ltx.sty}{\from{ltshipout.dtx}{atbegshi-ltx}}} % emulating atbegshi \generate{\file{atveryend-ltx.sty}{\from{ltfilehook.dtx}{atveryend-ltx}}} % emulating atveryend \generate{\file{structuredlog.sty}{\from{ltfilehook.dtx}{structuredlog}}} +% hook managed para + +\generate{\file{ltpara.ltx}{\from{ltpara.dtx}{2ekernel}}} % luatex support (TeX part) diff --git a/Master/texmf-dist/source/latex-dev/base/graphpap.dtx b/Master/texmf-dist/source/latex-dev/base/graphpap.dtx index 0a89a25fe11..cc9f4da3cb1 100644 --- a/Master/texmf-dist/source/latex-dev/base/graphpap.dtx +++ b/Master/texmf-dist/source/latex-dev/base/graphpap.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/graphpap.ins b/Master/texmf-dist/source/latex-dev/base/graphpap.ins index 9528f3dcdc5..65156ad9176 100644 --- a/Master/texmf-dist/source/latex-dev/base/graphpap.ins +++ b/Master/texmf-dist/source/latex-dev/base/graphpap.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ifthen.dtx b/Master/texmf-dist/source/latex-dev/base/ifthen.dtx index f07e4aa8f16..acb5cf19670 100644 --- a/Master/texmf-dist/source/latex-dev/base/ifthen.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ifthen.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -30,7 +30,7 @@ %% %% File `ifthen.dtx'. %% Copyright (C) 1991 by Leslie Lamport -%% Copyright (C) 1994-2001 LaTeX3 project, David Carlisle +%% Copyright (C) 1994-2001 LaTeX project, David Carlisle %% all rights reserved. %% % diff --git a/Master/texmf-dist/source/latex-dev/base/ifthen.ins b/Master/texmf-dist/source/latex-dev/base/ifthen.ins index d589deaafca..42e1d3f5d93 100644 --- a/Master/texmf-dist/source/latex-dev/base/ifthen.ins +++ b/Master/texmf-dist/source/latex-dev/base/ifthen.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/inputenc.dtx b/Master/texmf-dist/source/latex-dev/base/inputenc.dtx index d8649c778df..1b8691d30fa 100644 --- a/Master/texmf-dist/source/latex-dev/base/inputenc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/inputenc.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% LaTeX3 Project and any individual authors listed elsewhere +% LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -283,7 +283,7 @@ % with the |utf8| option. % % The |\DeclareUnicodeCharacter| takes UTF-8 code point as its first argument -% (in form of a a hexadecimal number) and the definition that this maps to as +% (in form of a hexadecimal number) and the definition that this maps to as % its second argument. For example, the code point |00E4| which is % ``LATIN SMALL LETTER A WITH DIAERESIS'' would be set up via: %\begin{verbatim} @@ -410,7 +410,7 @@ %<cp1252&!ansinew> \ProvidesFile{cp1252.def} %<cp1250> \ProvidesFile{cp1250.def} %<cp1257> \ProvidesFile{cp1257.def} - [2020/11/26 v1.3d Input encoding file] + [2021/02/14 v1.3d Input encoding file] %<cp850>%% %<cp850>%% If you need a Euro symbol, try cp858 instead. %<cp850>%% diff --git a/Master/texmf-dist/source/latex-dev/base/inputenc.ins b/Master/texmf-dist/source/latex-dev/base/inputenc.ins index 19a8606e5d4..920a585bffc 100644 --- a/Master/texmf-dist/source/latex-dev/base/inputenc.ins +++ b/Master/texmf-dist/source/latex-dev/base/inputenc.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/latex209.dtx b/Master/texmf-dist/source/latex-dev/base/latex209.dtx index 183028fca77..bf92f8ef1e8 100644 --- a/Master/texmf-dist/source/latex-dev/base/latex209.dtx +++ b/Master/texmf-dist/source/latex-dev/base/latex209.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/latex209.ins b/Master/texmf-dist/source/latex-dev/base/latex209.ins index 7c5197b9bd4..33ebc2488c4 100644 --- a/Master/texmf-dist/source/latex-dev/base/latex209.ins +++ b/Master/texmf-dist/source/latex-dev/base/latex209.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/latexrelease.dtx b/Master/texmf-dist/source/latex-dev/base/latexrelease.dtx index 19a1d0db806..cfcac4b3971 100644 --- a/Master/texmf-dist/source/latex-dev/base/latexrelease.dtx +++ b/Master/texmf-dist/source/latex-dev/base/latexrelease.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -40,7 +40,7 @@ %<*!fixltx2e> % \fi % \ProvidesFile{latexrelease.dtx} - [2020/12/06 v1.0k LaTeX release emulation and tests + [2021/01/23 v1.0l LaTeX release emulation and tests (including releases up to \latexreleaseversion)] % \iffalse %</!fixltx2e> @@ -69,7 +69,7 @@ % \title{The \Lpack{latexrelease} package\thanks{This file % has version number \fileversion, last % revised \filedate.}} -% \author{The \LaTeX3 Project} +% \author{The \LaTeX Project} % \date{\filedate} % \MaintainedByLaTeXTeam{latex} % \maketitle @@ -129,7 +129,6 @@ % package has no information will generate a warning. Dates % earlier than 2015 will work but will roll back to some point in 2015 % when the method was introduced. -% |\IncludeInRelease| command is defined. % The |\requestedLaTeXdate| is set to the normalized date argument % so that package rollback defaults to the specified date. % @@ -137,9 +136,6 @@ % |current| This is the default behaviour, it does not change the % effective date of the format but does ensure that the % |\IncludeInRelease| command is defined. -% the |\requestedLaTeXdate| is reset to 0 so that package rollback -% does not use the implicit date. -% |\IncludeInRelease| command is defined. % The |\requestedLaTeXdate| macro is reset to 0 so that package rollback % does not use the implicit date. % @@ -147,11 +143,16 @@ % |latest| sets the effective date of the format to the release date % of this file, so in an older format applies all patches currently % available. -% |\IncludeInRelease| command is defined. % The |\requestedLaTeXdate| macro is reset to 0 so that package rollback % does not use the implicit date. % \end{itemize} % +% In all cases, when the package is loaded, the |\sourceLaTeXdate| is +% defined to be the numerical representation of |\fmtversion| before the +% rollback/forward actually happens, so it is possible to test from which +% was the original \LaTeX{} version before \Lpack{latexrelease} was loaded. +% This is particularly useful when some code in a package has to be +% redefined differently if rolling backwards in time or forwards. % % \section{Release Specific Code} % @@ -388,6 +389,16 @@ % % \section{Setup} % +% \begin{macro}{\sourceLaTeXdate} +% \changes{v1.0l}{2021/01/23}{\cs{sourceLaTeXdate} added} +% Store the original \LaTeX{} format version +% as a number in the format |YYYYMMDD|: +% \begin{macrocode} +\edef\sourceLaTeXdate{% + \expandafter\@parse@version\fmtversion//00\@nil} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\IncludeInRelease} % \begin{macro}{\EndIncludeInRelease} % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex-dev/base/latexrelease.ins b/Master/texmf-dist/source/latex-dev/base/latexrelease.ins index 141a677b48c..b4d0aef5677 100644 --- a/Master/texmf-dist/source/latex-dev/base/latexrelease.ins +++ b/Master/texmf-dist/source/latex-dev/base/latexrelease.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. @@ -93,6 +93,7 @@ extension .ins) which are part of the distribution. \from{ltluatex.dtx} {latexrelease}% empty \from{ltexpl.dtx} {latexrelease}% empty \from{ltdefns.dtx} {latexrelease}% + \from{ltcmd.dtx} {latexrelease}% \from{lthooks.dtx} {latexrelease}% empty % L3 layer module \from{ltalloc.dtx} {latexrelease}% empty \from{ltcntrl.dtx} {latexrelease}% empty diff --git a/Master/texmf-dist/source/latex-dev/base/latexsym.dtx b/Master/texmf-dist/source/latex-dev/base/latexsym.dtx index c53dac62f0c..7a97aa4318c 100644 --- a/Master/texmf-dist/source/latex-dev/base/latexsym.dtx +++ b/Master/texmf-dist/source/latex-dev/base/latexsym.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/latexsym.ins b/Master/texmf-dist/source/latex-dev/base/latexsym.ins index 620046ac9ba..902bbfc9e8e 100644 --- a/Master/texmf-dist/source/latex-dev/base/latexsym.ins +++ b/Master/texmf-dist/source/latex-dev/base/latexsym.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. @@ -88,7 +88,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/letter.dtx b/Master/texmf-dist/source/latex-dev/base/letter.dtx index faece887f86..3c7fe56ba15 100644 --- a/Master/texmf-dist/source/latex-dev/base/letter.dtx +++ b/Master/texmf-dist/source/latex-dev/base/letter.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -165,7 +165,7 @@ % \changes{v1.3a}{2020/03/07}{merged changes to classes.dtx into letter.dtx} % % \iffalse -% Copyright (C) 1994 LaTeX3 project, Frank Mittelbach +% Copyright (C) 1994 LaTeX Project, Frank Mittelbach % and Rainer Sch\"opf, all rights reserved. % \fi % diff --git a/Master/texmf-dist/source/latex-dev/base/letter.ins b/Master/texmf-dist/source/latex-dev/base/letter.ins index 1c2b2f9f010..44777393eb6 100644 --- a/Master/texmf-dist/source/latex-dev/base/letter.ins +++ b/Master/texmf-dist/source/latex-dev/base/letter.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltalloc.dtx b/Master/texmf-dist/source/latex-dev/base/ltalloc.dtx index 3328c1f504d..59c492836f9 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltalloc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltalloc.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltbibl.dtx b/Master/texmf-dist/source/latex-dev/base/ltbibl.dtx index 7f5066542f3..0319342dd49 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltbibl.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltbibl.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx b/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx index ec192293f10..8281b4b712b 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltboxes.dtx} - [2020/12/05 v1.4a LaTeX Kernel (Box Commands)] + [2021/02/10 v1.4b LaTeX Kernel (Box Commands)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltboxes.dtx} @@ -222,7 +222,7 @@ % \changes{v1.0j}{1994/10/18} % {stuff from ltpatch done} % \changes{v1.0p}{1994/11/09} -% {more colour changes\ldots} +% {more color changes\ldots} % \changes{v1.0q}{1994/11/17} % {\cs{@tempa} to \cs{reserved@a}} % \changes{v1.0t}{1995/05/07}{Use \cs{hb@xt@}} @@ -422,7 +422,7 @@ % {macro added} % \changes{v0.1a}{1993/12/03} % {color support} -% This macro is initially a no-op, but the colour package will redefine +% This macro is initially a no-op, but the color package will redefine % it to insert a |\special|. % \begin{macrocode} \let\set@color\relax @@ -431,38 +431,66 @@ % % \begin{macro}{\color@begingroup} % \changes{v1.0b}{1994/03/14} -% {macro added for colour support} +% {macro added for color support} % \begin{macro}{\color@endgroup} % \changes{v1.0b}{1994/03/14} -% {macro added for colour support} +% {macro added for color support} % \begin{macro}{\color@setgroup} % \changes{v1.0f}{1994/05/11} -% {macro added for colour support} +% {macro added for color support} % \begin{macro}{\normalcolor} % \changes{v1.0g}{1994/05/12} -% {macro added for colour support} +% {macro added for color support} % \begin{macro}{\color@hbox} % \changes{v1.0n}{1994/11/05} -% {macro added for colour support} +% {macro added for color support} % \begin{macro}{\color@vbox} % \changes{v1.0r}{1994/11/18} -% {macro added for colour support} +% {macro added for color support} % \begin{macro}{\color@endbox} % \changes{v1.0n}{1994/11/05} -% {macro added for colour support} -% These macros are initially a no-op, but the colour package will +% {macro added for color support} +% \changes{v1.4b}{2021/02/04} +% {Always add the color groups (gh/488)} +% In the past these macros were initially no-ops, and the \pkg{color} +% package redefined % redefine them to be |\begingroup|, |\endgroup|, % |\begingroup\set@color|,\\ |\hbox\bgroup\color@begingroup|, % |\color@endgroup\egroup|. -% and \meta{set to main document colour} respectively. +% and \meta{set to main document color} respectively. +% +% Nowadays we always set the group already in the kernel as this makes the +% coding simpler. % \begin{macrocode} -\let\color@begingroup\relax -\let\color@endgroup\relax -\let\color@setgroup\relax -\let\normalcolor\relax -\let\color@hbox\relax -\let\color@vbox\relax -\let\color@endbox\relax +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2021/05/01}% +%<latexrelease> {\color@begingroup}{color group settings}% +\let\color@begingroup\begingroup +\def\color@endgroup{\endgraf\endgroup} +\def\color@setgroup{\color@begingroup} % changed further in color package +\let\normalcolor\relax % remains untouched; only changed in a color package +\def\color@hbox{\hbox\bgroup\color@begingroup} +\def\color@vbox{\vbox\bgroup\color@begingroup} +\def\color@endbox{\color@endgroup\egroup} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\color@begingroup}{color group settings}% +%<latexrelease> +%<latexrelease>\let\color@begingroup\relax +%<latexrelease>\let\color@endgroup\relax +%<latexrelease>\let\color@setgroup\relax +%<latexrelease>\let\normalcolor\relax +%<latexrelease>\let\color@hbox\relax +%<latexrelease>\let\color@vbox\relax +%<latexrelease>\let\color@endbox\relax +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % \end{macro} % \end{macro} @@ -1016,7 +1044,7 @@ % % \begin{macro}{\@iiiminipage} % \changes{v1.0e}{1994/04/21} -% {Extra \cs{bgroup} for colour} +% {Extra \cs{bgroup} for color} % \changes{v1.0f}{1994/05/11} % {Use new \cs{color@setgroup} concept.} % Internal form of |minipage|. @@ -1054,11 +1082,11 @@ % {(RmS) replaced \cs{vskip}-\cs{lastskip} by \cs{unskip} % (proposed by FMi)} % \changes{v1.0e}{1994/04/21} -% {Extra \cs{egroup} for colour} +% {Extra \cs{egroup} for color} % \changes{v1.0f}{1994/05/11} % {Use new \cs{color@setgroup} concept.} % \changes{v1.0n}{1994/11/05} -% {Colour resetting for footnotes moved to here: as for main +% {Color resetting for footnotes moved to here: as for main % page.} % \begin{macrocode} \def\endminipage{% @@ -1093,9 +1121,9 @@ % Final |\strut| added 27 Mar 89, on suggestion by Don Hosek % \changes{LaTeX2.09}{1991/09/29}{(RmS) added \cs{reset@font}} % \changes{LaTeX2.09}{1992/11/26}{(RmS) added protection for \cs{edef}} -% \changes{v0.1a}{1994/03/07}{Extra group for colour} +% \changes{v0.1a}{1994/03/07}{Extra group for color} % \changes{v1.0e}{1994/04/21} -% {Extra \cs{endgraf} for colour} +% {Extra \cs{endgraf} for color} % \changes{v1.0f}{1994/05/11} % {Use new \cs{color@setgroup} concept.} % \changes{v1.0f}{1994/05/11} @@ -1103,11 +1131,17 @@ % \changes{v1.0m}{1994/11/04} % {Added \cs{protected@edef}. ASAJ.} % \changes{v1.0n}{1994/11/05} -% {Colour resetting for footnotes moved to endminipage: as for main +% {Color resetting for footnotes moved to endminipage: as for main % page.} % \changes{v1.0o}{1994/11/05} -% {Colour groups restored here.} +% {Color groups restored here.} +% \changes{v1.4b}{2021/02/10} +% {Explicitly run \cs{par} in support for paragraph tagging} % \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2021/05/01}% +%<latexrelease> {\@mpfootnotetext}{footnotetext tagging}% \long\def\@mpfootnotetext#1{% \global\setbox\@mpfootins\vbox{% \unvbox\@mpfootins @@ -1119,7 +1153,31 @@ \color@begingroup \@makefntext{% \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \par \color@endgroup}} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\@mpfootnotetext}{footnotetext tagging}% +%<latexrelease> +%<latexrelease>\long\def\@mpfootnotetext#1{% +%<latexrelease> \global\setbox\@mpfootins\vbox{% +%<latexrelease> \unvbox\@mpfootins +%<latexrelease> \reset@font\footnotesize +%<latexrelease> \hsize\columnwidth +%<latexrelease> \@parboxrestore +%<latexrelease> \protected@edef\@currentlabel +%<latexrelease> {\csname p@mpfootnote\endcsname\@thefnmark}% +%<latexrelease> \color@begingroup +%<latexrelease> \@makefntext{% +%<latexrelease> \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% +%<latexrelease> \color@endgroup}} +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex-dev/base/ltclass.dtx b/Master/texmf-dist/source/latex-dev/base/ltclass.dtx index 1400ec0a62d..26667cbeb1b 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltclass.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltclass.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltclass.dtx} - [2020/12/17 v1.3v LaTeX Kernel (Class & Package Interface)] + [2021/02/18 v1.3x LaTeX Kernel (Class & Package Interface)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltclass.dtx} @@ -712,6 +712,7 @@ % Path to the current file if explicitly given. The auxiliary is % needed here to insert a \cs{@empty} to prevent the loss of braces. % \changes{v1.3u}{2020/11/20}{Macro added} +% \changes{v1.3w}{2021/01/21}{Add empty entry for latexrelease} % \begin{macrocode} %</2ekernel> %<*2ekernel|latexrelease> @@ -719,6 +720,7 @@ %<latexrelease>\IncludeInRelease{2020/10/01}{\@kernel@currpathstack}% %<latexrelease> {Add \@kernel@currpathstack}% \gdef\@kernel@currpathstack{} +%<latexrelease>\g@addto@macro\@kernel@currpathstack{{}} \def\@p@pfilepath#1{% \gdef\@currpath{#1}\@p@pfilepath@aux\@empty} \def\@p@pfilepath@aux#1\@nil{% @@ -1164,13 +1166,14 @@ % % \begin{macro}{\PassOptionsToPackage} % \begin{macro}{\PassOptionsToClass} -% 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. +% 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. % \changes{v1.3t}{2020/10/18}{Drop path from \cs{input@path} (gh/414).} +% \changes{v1.3x}{2021/02/18}{save raw option lists (gh/85)} % \begin{macrocode} %</2ekernel> -%<latexrelease>\IncludeInRelease{2020/10/01}{\@pass@ptions} -%<latexrelease> {Add file replacement in \@pass@ptions}% +%<latexrelease>\IncludeInRelease{2021/05/01}% +%<latexrelease> {\@pass@ptions}{Raw option lists}% %<*2ekernel|latexrelease> \def\@pass@ptions#1#2#3{% \@expl@@@filehook@set@curr@file@@nNN @@ -1187,12 +1190,41 @@ % \begin{macrocode} \expandafter\let \csname opt@#3.#1\expandafter\endcsname - \csname opt@\reserved@a\endcsname} + \csname opt@\reserved@a\endcsname +% \end{macrocode} +% Extend raw option list +% \begin{macrocode} + \@ifundefined{@raw@opt@#3.#1}% + {\expandafter\gdef\csname @raw@opt@#3.#1\endcsname{#2}}% + {\expandafter\g@addto@macro\csname @raw@opt@#3.#1\endcsname{,#2}}% +} %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{2020/10/01}{\@pass@ptions} +%<latexrelease> {Add file replacement in \@pass@ptions}% +%<latexrelease> +%<latexrelease>\def\@pass@ptions#1#2#3{% +%<latexrelease> \@expl@@@filehook@set@curr@file@@nNN +%<latexrelease> {\@expl@@@filehook@resolve@file@subst@@w #3.#1\@nil}% +%<latexrelease> \reserved@a\reserved@b +%<latexrelease> \@expl@@@filehook@clear@replacement@flag@@ +%<latexrelease> \expandafter\xdef\csname opt@\reserved@a\endcsname{% +%<latexrelease> \@ifundefined{opt@\reserved@a}\@empty +%<latexrelease> {\csname opt@\reserved@a\endcsname,}% +%<latexrelease> \zap@space#2 \@empty}% +%<latexrelease> \expandafter\let +%<latexrelease> \csname opt@#3.#1\expandafter\endcsname +%<latexrelease> \csname opt@\reserved@a\endcsname} +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} % +% \begin{macrocode} %<latexrelease>\IncludeInRelease{0000/00/00}{\@pass@ptions} %<latexrelease> {\@pass@ptions}% +%<latexrelease> %<latexrelease>\def\@pass@ptions#1#2#3{% %<latexrelease> \expandafter\xdef\csname opt@#3.#1\endcsname{% %<latexrelease> \@ifundefined{opt@#3.#1}\@empty @@ -1200,6 +1232,9 @@ %<latexrelease> \zap@space#2 \@empty}} %<latexrelease>\EndIncludeInRelease %<*2ekernel> +% \end{macrocode} +% +% \begin{macrocode} \@onlypreamble\@pass@ptions % \end{macrocode} % @@ -1241,18 +1276,49 @@ % \end{macro} % % \begin{macro}{\OptionNotUsed} +% \changes{v1.3x}{2021/02/18}{filter out =value from unused option list (gh/85)} +% \begin{macro}{\@remove@eq@value} +% \changes{v1.3x}{2021/02/18}{macro added (gh/85)} % If we are in a class file, add |\CurrentOption| to the list of % unused options. Otherwise, in a package file do nothing. % \begin{macrocode} +%</2ekernel> +%<latexrelease>\IncludeInRelease{2021/05/01}% +%<latexrelease> {\OptionNotUsed}{filter unused option list}% +%<*2ekernel|latexrelease> +\def\@remove@eq@value#1=#2\@nil{#1} +% \end{macrocode} +% +% \begin{macrocode} \def\OptionNotUsed{% \ifx\@currext\@clsextension \xdef\@unusedoptionlist{% \ifx\@unusedoptionlist\@empty\else\@unusedoptionlist,\fi - \CurrentOption}% + \expandafter\@remove@eq@value\CurrentOption=\@nil}% \fi} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\OptionNotUsed}{filter unused option list}% +%<latexrelease>\let\@remove@eq@value\@undefined +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\def\OptionNotUsed{% +%<latexrelease> \ifx\@currext\@clsextension +%<latexrelease> \xdef\@unusedoptionlist{% +%<latexrelease> \ifx\@unusedoptionlist\@empty\else\@unusedoptionlist,\fi +%<latexrelease> \CurrentOption}% +%<latexrelease> \fi} +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% \begin{macrocode} \@onlypreamble\OptionNotUsed % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\default@ds} % The default option code. @@ -1403,11 +1469,30 @@ % {Name changed from \cs{@executeoption}} % \changes{v1.0e}{1994/05/17} % {Execute option after removing from list, not before} +% \changes{v1.3x}{2021/02/18}{filter out =value from unused option list (gh/85)} % \begin{macrocode} +%</2ekernel> +%<latexrelease>\IncludeInRelease{2021/05/01}% +%<latexrelease> {\@use@ption}{filter unused option list}% +%<*2ekernel|latexrelease> \def\@use@ption{% - \@expandtwoargs\@removeelement\CurrentOption + \@expandtwoargs\@removeelement + {\expandafter\@remove@eq@value\CurrentOption=\@nil}% \@unusedoptionlist\@unusedoptionlist \csname ds@\CurrentOption\endcsname} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\@use@ption}{filter unused option list}% +%<latexrelease>\def\@use@ption{% +%<latexrelease> \@expandtwoargs\@removeelement\CurrentOption +%<latexrelease> \@unusedoptionlist\@unusedoptionlist +%<latexrelease> \csname ds@\CurrentOption\endcsname} +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% \begin{macrocode} \@onlypreamble\@use@ption % \end{macrocode} % \end{macro} @@ -1721,15 +1806,23 @@ % {Prevent loss of brackets PR/3965} % \changes{v2.1b}{2016/11/09} % {Improve \cs{ifx} tests PR/4497} +% \changes{v1.3x}{2021/02/18}{save raw class option list (gh/85)} % \begin{macrocode} %</2ekernel> -%<latexrelease>\IncludeInRelease{2017/01/01}% +%<latexrelease>\IncludeInRelease{2020/10/01}% %<latexrelease> {\@fileswith@pti@ns}{ifx tests in \@fileswith@pti@ns}% %<*2ekernel|latexrelease> \def\@fileswith@pti@ns#1[#2]#3[#4]{% \ifx#1\@clsextension \ifx\@classoptionslist\relax \xdef\@classoptionslist{\zap@space#2 \@empty}% +% \end{macrocode} +% Save raw class list. +% \begin{macrocode} + \gdef\@raw@classoptionslist{#2}% +% \end{macrocode} +% +% \begin{macrocode} \def\reserved@a{% \@onefilewithoptions#3[{#2}][{#4}]#1% \@documentclasshook}% @@ -1768,6 +1861,33 @@ \fi \reserved@a} %</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{2017/01/01}% +%<latexrelease> {\@fileswith@pti@ns}{ifx tests in \@fileswith@pti@ns}% +%<latexrelease>\def\@fileswith@pti@ns#1[#2]#3[#4]{% +%<latexrelease> \ifx#1\@clsextension +%<latexrelease> \ifx\@classoptionslist\relax +%<latexrelease> \xdef\@classoptionslist{\zap@space#2 \@empty}% +%<latexrelease> \def\reserved@a{% +%<latexrelease> \@onefilewithoptions#3[{#2}][{#4}]#1% +%<latexrelease> \@documentclasshook}% +%<latexrelease> \else +%<latexrelease> \def\reserved@a{% +%<latexrelease> \@onefilewithoptions#3[{#2}][{#4}]#1}% +%<latexrelease> \fi +%<latexrelease> \else +%<latexrelease> \def\reserved@b##1,{% +%<latexrelease> \ifx\@nnil##1\relax\else +%<latexrelease> \ifx\@nnil##1\@nnil\else +%<latexrelease> \noexpand\@onefilewithoptions##1[{#2}][{#4}]% +%<latexrelease> \noexpand\@pkgextension +%<latexrelease> \fi +%<latexrelease> \expandafter\reserved@b +%<latexrelease> \fi}% +%<latexrelease> \edef\reserved@a{\zap@space#3 \@empty}% +%<latexrelease> \edef\reserved@a{\expandafter\reserved@b\reserved@a,\@nnil,}% +%<latexrelease> \fi +%<latexrelease> \reserved@a} % \end{macrocode} % % \begin{macrocode} @@ -2640,7 +2760,8 @@ % Text before the |\end|, write it with a warning. % \begin{macrocode} \@latex@warning{Writing text `##1' before % - \string\end{\@currenvir}\MessageBreak as last line of \@curr@file}% + \string\end{\@currenvir}\MessageBreak + as last line of \@curr@file}% \immediate\write\reserved@c{##1}% \fi% \ifx\relax##2\relax% @@ -2675,7 +2796,8 @@ %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease %<latexrelease>\IncludeInRelease{2019/10/01}% -%<latexrelease> {\filec@ntents}{Spaces in file names + optional arg}% +%<latexrelease> {\filec@ntents}{Spaces in file names + optional arg}% +%<latexrelease> %<latexrelease>\def\filecontents{\@tempswatrue\@fileswtrue %<latexrelease> \@ifnextchar[\filec@ntents@opt\filec@ntents %<latexrelease>} @@ -2805,7 +2927,7 @@ %<latexrelease>\endgroup% %<latexrelease>\EndIncludeInRelease %<latexrelease>\IncludeInRelease{0000/00/00}% -%<latexrelease> {\filec@ntents}{Spaces in file names + optional arg}% +%<latexrelease> {\filec@ntents}{Spaces in file names + optional arg}% %<latexrelease> %<latexrelease>\let\filec@ntents@opt \@undefined %<latexrelease>\let\filec@ntents@force \@undefined diff --git a/Master/texmf-dist/source/latex-dev/base/ltcmd.dtx b/Master/texmf-dist/source/latex-dev/base/ltcmd.dtx new file mode 100644 index 00000000000..26ce75224fb --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/base/ltcmd.dtx @@ -0,0 +1,4041 @@ +% \iffalse meta-comment +% +% Copyright (C) 1999 Frank Mittelbach, Chris Rowley, David Carlisle +% Copyright (C) 2004-2008 Frank Mittelbach, The LaTeX3 Project +% Copyright (C) 2009-2021 +% The LaTeX Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the LaTeX base system. +% ------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008 or later. +% +% This file has the LPPL maintenance status "maintained". +% +% The list of all files belonging to the LaTeX base distribution is +% given in the file `manifest.txt'. See also `legal.txt' for additional +% information. +% +% The list of derived (unpacked) files belonging to the distribution +% and covered by LPPL is defined by the unpacking scripts (with +% extension .ins) which are part of the distribution. +% +% \fi +% +% \iffalse +% +%%% From File: ltcmd.dtx +% +% \begin{macrocode} +\def\ltcmdversion{v1.0a} +\def\ltcmddate{2021/01/21} +% \end{macrocode} +% +%<*driver> +% \fi +\ProvidesFile{ltcmd.dtx} + [2020-11-20 v1.0 LaTeX Kernel (Document commands)] +% \iffalse +\documentclass{l3doc} +\GetFileInfo{ltcmd.dtx} +\title{\filename} +\date{\filedate} +\author{Frank Mittelbach, Chris Rowley, David Carlisle, \LaTeX{} Project Team} +\begin{document} + \maketitle + \DocInput{ltcmd.dtx} +\end{document} +%</driver> +% \fi +% +% \section{Creating document commands} +% +% \changes{v1.0}{2020-11-20}{Initial version derived from \texttt{xparse.dtx}} +% +% Document commands should be created using the tools provided by this module: +% \cs{NewDocumentCommand}, etc.\@, in almost all cases. This allows clean +% separation of document-level syntax from code-level interfaces. Users have +% a need to create new document commands, and as such a significant amount of +% documentation for \pkg{ltcmd} is provided as part of \texttt{usrguide3}. Here, +% additional material aimed at programmers is provided +% +% \StopEventually{} +% +% \begin{macrocode} +%<@@=cmd> +% \end{macrocode} +% +% \begin{macrocode} +%<*2ekernel> +\message{document commands,} +%</2ekernel> +% \end{macrocode} +% +% \pkg{ltcmd} code contains an |^^@| character, which usually has +% catcode~15, so \cs{IncludeInRelease} will break when this code is +% being skipped, so we'll save the catcode of |^^@| to restore later: +% \begin{macrocode} +%<*2ekernel|latexrelease> +%<latexrelease>\edef\@latexrelease@catcode@null{\the\catcode`\^^@ } +%<latexrelease>\catcode`\^^@=12 +%<latexrelease>\IncludeInRelease{2021/05/01}% +%<latexrelease> {\NewDocumentCommand}{Document commands}% +% \end{macrocode} +% +% \begin{macrocode} +\ExplSyntaxOn +% \end{macrocode} +% +% \subsection{Variables and constants} +% +% \begin{variable}{\l_@@_arg_spec_tl} +% Holds the argument specification after normalization of shorthands. +% \begin{macrocode} +\tl_new:N \l_@@_arg_spec_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_args_tl} +% Token list variable for grabbed arguments. +% \begin{macrocode} +\tl_new:N \l_@@_args_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_args_i_tl, \l_@@_args_ii_tl} +% Hold the modified arguments when dealing with default values or +% processors. +% \begin{macrocode} +\tl_new:N \l_@@_args_i_tl +\tl_new:N \l_@@_args_ii_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_current_arg_int} +% The number of the current argument being set up: this is used to +% make sure there are at most 9 arguments, then for creating the +% expandable auxiliary functions and knowing how many arguments the +% code function should take. +% \begin{macrocode} +\int_new:N \l_@@_current_arg_int +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_defaults_bool, \l_@@_defaults_tl} +% The boolean indicates whether there are any argument with default +% value other than |-NoValue-|; the token list holds the code to +% determine these default values in terms of other arguments. +% \begin{macrocode} +\bool_new:N \l_@@_defaults_bool +\tl_new:N \l_@@_defaults_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_environment_bool} +% Generating environments uses the same mechanism as generating functions. +% However, full processing of arguments is always needed for environments, +% and so the function-generating code needs to know this. +% This variable is also used at run time to give correct error messages. +% \begin{macrocode} +\bool_new:N \l_@@_environment_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_environment_str} +% Name of the environment, used at definition time and at run time. +% \begin{macrocode} +\str_new:N \l_@@_environment_str +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_expandable_bool} +% Used to indicate if an expandable command is begin generated, as this +% affects both the acceptable argument types and how they are implemented. +% \begin{macrocode} +\bool_new:N \l_@@_expandable_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_expandable_aux_name_tl} +% Used to create pretty-printing names for the auxiliaries: although the +% immediate definition does not vary, the full expansion does and so it +% does not count as a constant. +% \begin{macrocode} +\tl_new:N \l_@@_expandable_aux_name_tl +\tl_set:Nn \l_@@_expandable_aux_name_tl + { + \l_@@_function_tl \c_space_tl + ( arg~ \int_use:N \l_@@_current_arg_int ) + } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_grabber_int} +% Used (in exceptional cases) to get unique names for grabbers used by +% expandable commands. +% \begin{macrocode} +\int_new:N \g_@@_grabber_int +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_fn_tl} +% For passing the pre-formed name of the auxiliary to be used as the +% parsing function. +% \begin{macrocode} +\tl_new:N \l_@@_fn_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_fn_code_tl} +% For passing the pre-formed name of the auxiliary that contains the +% actual code. +% \begin{macrocode} +\tl_new:N \l_@@_fn_code_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_function_tl} +% Holds the control sequence name of the function currently being +% defined: used to avoid passing this as an argument and to avoid repeated +% use of \cs{cs_to_str:N}. +% \begin{macrocode} +\tl_new:N \l_@@_function_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_grab_expandably_bool} +% When defining a non-expandable command, indicates whether the +% arguments can all safely be grabbed by expandable grabbers. This is +% to support abuses of \pkg{xparse} that use protected functions +% inside csname constructions. +% \begin{macrocode} +\bool_new:N \l_@@_grab_expandably_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_obey_spaces_bool} +% For trailing optionals. +% \begin{macrocode} +\bool_new:N \l_@@_obey_spaces_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_last_delimiters_tl} +% Holds the delimiters (first tokens) of all optional arguments since +% the previous mandatory argument, to warn about cases where it would +% be impossible to omit optional arguments completely because the +% following mandatory argument has the same delimiter as one of the +% optional arguments. +% \begin{macrocode} +\tl_new:N \l_@@_last_delimiters_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_long_bool} +% Used to indicate that an argument is long, on a per-argument basis. +% \begin{macrocode} +\bool_new:N \l_@@_long_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_m_args_int} +% The number of \texttt{m} arguments: if this is the same as the total +% number of arguments, then a short-cut can be taken in the creation of +% the grabber code. +% \begin{macrocode} +\int_new:N \l_@@_m_args_int +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_prefixed_bool} +% When preparing the signature of non-expandable commands, indicates +% that the current argument is affected by a processor or by |+| +% (namely is long). +% \begin{macrocode} +\bool_new:N \l_@@_prefixed_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_process_all_tl, \l_@@_process_one_tl, \l_@@_process_some_bool} +% When preparing the signature, the processors that will be applied to +% a given argument are collected in \cs{l_@@_process_one_tl}, while +% \cs{l_@@_process_all_tl} contains processors for all arguments. The +% boolean indicates whether there are any processors (to bypass the +% whole endeavour otherwise). +% \begin{macrocode} +\tl_new:N \l_@@_process_all_tl +\tl_new:N \l_@@_process_one_tl +\bool_new:N \l_@@_process_some_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_saved_args_tl} +% Stores \cs{l_@@_args_tl} to deal with space-trimming of +% \texttt{b}-type arguments. +% \begin{macrocode} +\tl_new:N \l_@@_saved_args_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_signature_tl} +% Used when constructing the signature (code for argument grabbing) to +% hold what will become the implementation of the main function. +% When arguments are grabbed (at point of use of the command/environment), +% it also stores the code for grabbing the remaining arguments. +% \begin{macrocode} +\tl_new:N \l_@@_signature_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable} +% {\l_@@_some_obey_spaces_bool, \l_@@_some_long_bool, \l_@@_some_short_bool} +% These flags are set while normalizing the argument specification. +% The \texttt{obey_spaces} one is used to detect when |!| is used on +% an argument that is not a trailing optional argument. +% The other two are used to check whether all short arguments appear +% before long arguments: this is needed to grab arguments expandably. +% As soon as the first long argument is seen (other than +% \texttt{t}-type, whose long status is ignored) the +% \texttt{some_long} flag is set. The \texttt{some_short} flag is +% used for expandable commands, to know whether to define a short +% auxiliary too. +% \begin{macrocode} +\bool_new:N \l_@@_some_obey_spaces_bool +\bool_new:N \l_@@_some_long_bool +\bool_new:N \l_@@_some_short_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_tmp_prop, \l_@@_tmpa_tl, \l_@@_tmpb_tl} +% \begin{macro}{\@@_tmp:w} +% Scratch space. +% \begin{macrocode} +\prop_new:N \l_@@_tmp_prop +\tl_new:N \l_@@_tmpa_tl +\tl_new:N \l_@@_tmpb_tl +\cs_new_eq:NN \@@_tmp:w ? +% \end{macrocode} +% \end{macro} +% \end{variable} +% +% With \pkg{xparse}, information about commands being (re)defined was +% switched off by default, unless the |log-declarations| package +% option was used, so here we'll switch that off as well. +% \begin{macrocode} +\msg_redirect_module:nnn { LaTeX / ltcmd } { info } { none } +% \end{macrocode} +% +% \subsection{Declaring commands and environments} +% +% \begin{macro}{\@@_declare_cmd:Nnn, \@@_declare_expandable_cmd:Nnn} +% \begin{macro}{\@@_declare_cmd_aux:Nnn} +% \begin{macro} +% {\@@_declare_cmd_internal:Nnnn, \@@_declare_cmd_internal:cnxn} +% The main functions for creating commands set the appropriate flag then +% use the same internal code to do the definition. +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_cmd:Nnn + { + \bool_set_false:N \l_@@_expandable_bool + \@@_declare_cmd_aux:Nnn + } +\cs_new_protected:Npn \@@_declare_expandable_cmd:Nnn + { + \bool_set_true:N \l_@@_expandable_bool + \@@_declare_cmd_aux:Nnn + } +% \end{macrocode} +% The first stage is to log information, both for the user in the log and +% for programmatic use in a property list of all declared commands. +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_cmd_aux:Nnn #1#2#3 + { + \cs_if_exist:NTF #1 + { + \__kernel_msg_info:nnxx { ltcmd } { redefine-command } + { \token_to_str:N #1 } { \tl_to_str:n {#2} } + } + { + \bool_lazy_or:nnT + { \cs_if_exist_p:c { \cs_to_str:N #1 ~ code } } + { \cs_if_exist_p:c { \cs_to_str:N #1 ~ defaults } } + { + \__kernel_msg_warning:nnx { ltcmd } { unsupported-let } + { \token_to_str:N #1 } + } + \__kernel_msg_info:nnxx { ltcmd } { define-command } + { \token_to_str:N #1 } { \tl_to_str:n {#2} } + } + \bool_set_false:N \l_@@_environment_bool + \@@_declare_cmd_internal:Nnnn #1 {#2} {#3} { } + } +% \end{macrocode} +% At definition time, the variable \cs{l_@@_fn_tl} is only used for error messages. +% The real business of defining a document command starts with setting up +% the appropriate name, then normalizing the argument specification to get rid of +% shorthands. +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_cmd_internal:Nnnn #1#2#3#4 + { + \tl_set:Nx \l_@@_function_tl { \cs_to_str:N #1 } + \tl_set:Nx \l_@@_fn_tl + { \exp_not:c { \l_@@_function_tl \c_space_tl } } + \@@_normalize_arg_spec:n {#2} + \exp_args:No \@@_prepare_signature:n \l_@@_arg_spec_tl + \@@_declare_cmd_code:Nnn #1 {#2} {#3} + #4 + \@@_break_point:n {#2} + } +\cs_generate_variant:Nn \@@_declare_cmd_internal:Nnnn { cnx } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_break_point:n} +% A marker used to escape from creating a definition if necessary. +% \begin{macrocode} +\cs_new_eq:NN \@@_break_point:n \use_none:n +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_declare_cmd_code:Nnn} +% \begin{macro} +% {\@@_declare_cmd_code_aux:Nnn, \@@_declare_cmd_code_expandable:Nnn} +% The appropriate auxiliary is called. +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_cmd_code:Nnn + { + \bool_if:NTF \l_@@_grab_expandably_bool + { \@@_declare_cmd_code_expandable:Nnn } + { \@@_declare_cmd_code_aux:Nnn } + } +% \end{macrocode} +% Standard functions call \cs{@@_start:nNNnnn}, which receives the +% argument specification, an auxiliary used for +% grabbing arguments, an auxiliary containing the code, and then the +% signature, default arguments, and processors. +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_cmd_code_aux:Nnn #1#2#3 + { + \cs_generate_from_arg_count:cNnn + { \l_@@_function_tl \c_space_tl code } + \cs_set_protected:Npn \l_@@_current_arg_int {#3} + \cs_set_protected_nopar:Npx #1 + { + \bool_if:NTF \l_@@_environment_bool + { + \@@_start_env:nnnnn { \exp_not:n {#2} } + { \l_@@_environment_str } + } + { + \@@_start:nNNnnn { \exp_not:n {#2} } + \exp_not:c { \l_@@_function_tl \c_space_tl } + \exp_not:c { \l_@@_function_tl \c_space_tl code } + } + { \exp_not:o \l_@@_signature_tl } + { + \bool_if:NT \l_@@_defaults_bool + { \exp_not:o \l_@@_defaults_tl } + } + { + \bool_if:NT \l_@@_process_some_bool + { \exp_not:o \l_@@_process_all_tl } + } + } + } +% \end{macrocode} +% Expandable functions and functions whose arguments can be grabbed +% expandably call \cs{@@_start_expandable:nNNNNn}, which receives the +% argument specification, four auxiliaries (two for grabbing arguments, one for +% the code, and one for default arguments), and finally the signature. +% Non-expandable functions that take this branch should nevertheless +% be protected, as well as their \texttt{code} function. They will +% only be expanded in contexts such as constructing a csname. +% The two grabbers (named after the function with one or two spaces) +% are needed when there are both short and long arguments; otherwise +% the same grabber is included twice in the definition. If all +% arguments are long or all are short the (only) grabber is defined +% correspondingly to be long/short. Otherwise two grabbers are +% defined, one long, one short. +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_cmd_code_expandable:Nnn #1#2#3 + { + \exp_args:Ncc \cs_generate_from_arg_count:NNnn + { \l_@@_function_tl \c_space_tl code } + { cs_set \bool_if:NF \l_@@_expandable_bool { _protected } :Npn } + \l_@@_current_arg_int {#3} + \bool_if:NT \l_@@_defaults_bool + { + \use:x + { + \cs_generate_from_arg_count:cNnn + { \l_@@_function_tl \c_space_tl defaults } + \cs_set:Npn \l_@@_current_arg_int + { \exp_not:o \l_@@_defaults_tl } + } + } + \bool_if:NTF \l_@@_expandable_bool + { \cs_set_nopar:Npx } { \cs_set_protected_nopar:Npx } #1 + { + \exp_not:N \@@_start_expandable:nNNNNn + { \exp_not:n {#2} } + \exp_not:c { \l_@@_function_tl \c_space_tl } + \exp_not:c + { + \l_@@_function_tl \c_space_tl + \bool_if:NT \l_@@_some_short_bool + { \bool_if:NT \l_@@_some_long_bool { \c_space_tl } } + } + \exp_not:c { \l_@@_function_tl \c_space_tl code } + \bool_if:NTF \l_@@_defaults_bool + { \exp_not:c { \l_@@_function_tl \c_space_tl defaults } } + { ? } + { \exp_not:o \l_@@_signature_tl } + } + \bool_if:NTF \l_@@_some_long_bool + { + \bool_if:NT \l_@@_some_short_bool + { + \cs_set_nopar:cpx { \l_@@_function_tl \c_space_tl \c_space_tl } + ##1##2 { ##1 {##2} } + } + \cs_set:cpx + } + { \cs_set_nopar:cpx } + { \l_@@_function_tl \c_space_tl } ##1##2 { ##1 {##2} } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_declare_env:nnnn} +% \begin{macro}{\@@_declare_env_internal:nnnn} +% The lead-off to creating an environment is much the same as that for +% creating a command: issue the appropriate message, store the argument +% specification then hand off to an internal function. +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_env:nnnn #1#2 + { + \str_set:Nx \l_@@_environment_str {#1} + \str_set:Nx \l_@@_environment_str + { \tl_trim_spaces:o { \l_@@_environment_str } } + \cs_if_exist:cTF { \l_@@_environment_str } + { + \__kernel_msg_info:nnxx { ltcmd } { redefine-environment } + { \l_@@_environment_str } { \tl_to_str:n {#2} } + } + { + \__kernel_msg_info:nnxx { ltcmd } { define-environment } + { \l_@@_environment_str } { \tl_to_str:n {#2} } + } + \bool_set_false:N \l_@@_expandable_bool + \bool_set_true:N \l_@@_environment_bool + \exp_args:NV \@@_declare_env_internal:nnnn + \l_@@_environment_str {#2} + } +% \end{macrocode} +% Creating a document environment requires a few more steps than creating +% a single command. In order to pass the arguments of the command to the +% end of the function, it is necessary to store the grabbed arguments. +% To do that, the function used at the end of the environment has to be +% redefined to contain the appropriate information. To minimize the amount +% of expansion at point of use, the code here is expanded now as well as +% when used. +% The last argument of \cs{@@_declare_cmd_internal:Nnnn} is only run +% if the definition succeeded. In package mode this ensures that the +% original definition of the environment is not changed if the +% definition fails for any reason. This also avoids an error when +% defining the \verb*|end aux | function when the user asks for more +% than $9$ arguments. +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_env_internal:nnnn #1#2#3#4 + { + \@@_declare_cmd_internal:cnxn { environment~ #1 } {#2} + { + \cs_set_nopar:Npx \exp_not:c { environment~ #1 ~end~aux } + { + \exp_not:N \exp_not:N \exp_not:c { environment~ #1~end~aux~ } + \exp_not:n { \exp_not:o \l_@@_args_tl } + } + \exp_not:n {#3} + } + { + \cs_set_nopar:cpx { environment~ #1 ~end } + { \exp_not:c { environment~ #1 ~end~aux } } + \cs_generate_from_arg_count:cNnn + { environment~ #1 ~end~aux~ } \cs_set:Npn + \l_@@_current_arg_int {#4} + \cs_set_eq:cc {#1} { environment~ #1 } + \cs_set_eq:cc { end #1 } { environment~ #1 ~end } + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Structure of \pkg{xparse} commands} +% +% \begin{macro}{\@@_start_env:nnnnn, \@@_start:nNNnnn} +% For error messages that occur during run-time when getting arguments +% of environments it is necessary to keep track of the environment +% name. We begin non-expandable commands with a token equal to +% \cs{scan_stop:}, whose name gives a reasonable error message if the +% command is used inside a csname and protects against +% \texttt{f}-expansion. This is useless for environments since +% \cs{begin} is already not expandable. Both the command and +% environment codes start with \cs{group_align_safe_begin:}, then +% \cs{@@_run_code:} (used by both) does \cs{group_align_safe_end:}, so +% that delimited arguments may be grabbed in alignments if they +% contain and alignment tab token (see latex3/latex3/issues/839). +% \begin{macrocode} +\cs_new_protected:Npn \@@_start_env:nnnnn #1#2 + { + \conditionally@traceoff + \group_align_safe_begin: + \str_set:Nn \l_@@_environment_str {#2} + \bool_set_true:N \l_@@_environment_bool + \@@_start_aux:ccnnnn + { environment~ \l_@@_environment_str \c_space_tl } + { environment~ \l_@@_environment_str \c_space_tl code } + {#1} + } +\cs_new_protected:Npx \@@_start:nNNnnn #1#2#3 + { + \exp_not:c { xparse~function~is~not~expandable } + \exp_not:N \conditionally@traceoff + \exp_not:N \group_align_safe_begin: + \exp_not:n { \bool_set_false:N \l_@@_environment_bool } + \exp_not:N \@@_start_aux:NNnnnn + #2 #3 {#1} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_start_aux:NNnnnn, \@@_start_aux:ccnnnn} +% This sets up a few variables to minimize the boilerplate code +% included in all \pkg{xparse}-defined commands. It then runs the +% grabbers~|#4|. Again, the argument specification |#1| is only for +% diagnostics. +% \begin{macrocode} +\cs_new_protected:Npn \@@_start_aux:NNnnnn #1#2#3#4#5#6 + { + \tl_clear:N \l_@@_args_tl + \tl_set:Nn \l_@@_fn_tl {#1} + \tl_set:Nn \l_@@_fn_code_tl {#2} + \tl_set:Nn \l_@@_defaults_tl {#5} + \tl_set:Nn \l_@@_process_all_tl {#6} + #4 \@@_run_code: + } +\cs_generate_variant:Nn \@@_start_aux:NNnnnn { cc } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_run_code:} +% After arguments are grabbed, this function is responsible for +% inserting default values, running processors, and finally doing +% \cs{group_align_safe_end:} as promised, and running the code. +% \begin{macrocode} +\cs_new_protected:Npn \@@_run_code: + { + \tl_if_empty:NF \l_@@_defaults_tl { \@@_defaults: } + \tl_if_empty:NF \l_@@_process_all_tl { \@@_args_process: } + \group_align_safe_end: + \conditionally@traceon + \exp_after:wN \l_@@_fn_code_tl \l_@@_args_tl + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_defaults:} +% \begin{macro}{\@@_defaults_def:, \@@_defaults_def:nn, \@@_defaults_def:nnn} +% \begin{macro}{\@@_defaults_aux:, \@@_defaults_error:w} +% First construct \cs{@@_tmp:w} (see below) that will receive +% the arguments found so far and determine default values for any +% missing argument. Then call it repeatedly until the set of +% arguments stabilizes. Since that could lead to an infinite loop we +% only call it up to nine times, the maximal number needed for +% stabilization if there is a chain of arguments that depend on each +% other. If that fails to stabilize raise an error. +% \begin{macrocode} +\cs_new_protected:Npn \@@_defaults: + { + \@@_defaults_def: + \tl_set_eq:NN \l_@@_args_i_tl \l_@@_args_tl + \@@_defaults_aux: \@@_defaults_aux: \@@_defaults_aux: + \@@_defaults_aux: \@@_defaults_aux: \@@_defaults_aux: + \@@_defaults_aux: \@@_defaults_aux: \@@_defaults_aux: + \@@_defaults_error:w + \q_recursion_stop + \tl_set_eq:NN \l_@@_args_tl \l_@@_args_i_tl + } +\cs_new_protected:Npn \@@_defaults_aux: + { + \tl_set:Nx \l_@@_args_ii_tl + { \exp_after:wN \@@_tmp:w \l_@@_args_i_tl } + \tl_if_eq:NNT \l_@@_args_ii_tl \l_@@_args_i_tl + { \use_none_delimit_by_q_recursion_stop:w } + \tl_set_eq:NN \l_@@_args_i_tl \l_@@_args_ii_tl + } +\cs_new_protected:Npn \@@_defaults_error:w \q_recursion_stop + { + \__kernel_msg_error:nnx { ltcmd } { loop-in-defaults } + { \@@_environment_or_command: } + } +% \end{macrocode} +% To construct \cs{@@_tmp:w}, first go through the arguments +% found and the corresponding defaults, building a token list with +% |{#|\meta{arg number}|}| for arguments found in the input (whose +% default will not be used) and otherwise +% |{|\cs{exp_not:n}\Arg{default}|}| for arguments whose default will +% be used. +% \begin{macrocode} +\cs_new_protected:Npn \@@_defaults_def: + { + \tl_clear:N \l_@@_tmpa_tl + \int_zero:N \l_@@_current_arg_int + \@@_tl_mapthread_function:NNN \l_@@_args_tl \l_@@_defaults_tl + \@@_defaults_def:nn + \cs_generate_from_arg_count:NNVo \@@_tmp:w \cs_set:Npn + \l_@@_current_arg_int \l_@@_tmpa_tl + } +\cs_generate_variant:Nn \cs_generate_from_arg_count:NNnn { NNVo } +\cs_new_protected:Npn \@@_defaults_def:nn + { + \int_incr:N \l_@@_current_arg_int + \exp_args:NV \@@_defaults_def:nnn \l_@@_current_arg_int + } +\cs_new_protected:Npn \@@_defaults_def:nnn #1#2#3 + { + \tl_put_right:Nx \l_@@_tmpa_tl + { + { + \exp_not:N \exp_not:n + { + \tl_if_novalue:nTF {#2} + { \exp_not:o {#3} } + { \exp_not:n { ## #1 } } + } + } + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_args_process:} +% \begin{macro}{\@@_args_process_loop:nn, \@@_args_process_aux:n} +% Loop through arguments (stored in \cs{l_@@_args_tl}) and the +% corresponding processors (in \cs{l_@@_process_all_tl}) +% simultaneously, apply all processors for each argument and store the +% result back into \cs{l_@@_args_tl}. To allow processors to depend +% on other arguments, for every processor define a temporary auxiliary +% that receives all arguments \cs{l_@@_args_tl}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_args_process: + { + \tl_clear:N \l_@@_args_ii_tl + \@@_tl_mapthread_function:NNN + \l_@@_args_tl + \l_@@_process_all_tl + \@@_args_process_loop:nn + \tl_set_eq:NN \l_@@_args_tl \l_@@_args_ii_tl + } +\cs_new_protected:Npn \@@_args_process_loop:nn #1#2 + { + \tl_set:Nn \ProcessedArgument {#1} + \tl_if_novalue:nF {#1} + { \tl_map_function:nN {#2} \@@_args_process_aux:n } + \tl_put_right:No \l_@@_args_ii_tl + { \exp_after:wN { \ProcessedArgument } } + } +\cs_new_protected:Npn \@@_args_process_aux:n #1 + { + \cs_generate_from_arg_count:NNnn \@@_tmp:w \cs_set:Npn + { \tl_count:N \l_@@_args_tl } {#1} + \exp_args:NNNo \exp_after:wN \@@_tmp:w \l_@@_args_tl + { \ProcessedArgument } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_start_expandable:nNNNNn} +% This is called for all expandable commands. |#6| is the signature, +% responsible for grabbing arguments. |#5| is used to determine +% default values (or is |?| if there are none). |#4| is the code to run. +% |#2|~and~|#3| are functions (named after the command) that grab a single +% argument in the input stream (|#3|~is~short). The argument specification |#1| is +% only used by diagnostic functions. Same as for the non-expandable +% version, this starts with \cs{group_align_safe_begin:}, which +% expands to nothing, so may be safely used in an expandable context. +% \begin{macrocode} +\cs_new:Npn \@@_start_expandable:nNNNNn #1#2#3#4#5#6 + { + \group_align_safe_begin: + #6 \@@_end_expandable:NNw #5 #4 \q_@@ #2#3 + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_end_expandable:NNw} +% \begin{macro}[EXP]{\@@_end_expandable_aux:w} +% \begin{macro}[EXP]{\@@_end_expandable_aux:nNNNN} +% \begin{macro}[EXP]{\@@_end_expandable_defaults:nnnNNn} +% \begin{macro}[EXP]{\@@_end_expandable_defaults:nnw} +% \begin{macro}[EXP]{\@@_end_expandable_defaults:nw} +% Followed by a function |#1| to determine default values (or |?| if +% there are no defaults), the code +% |#2|, arguments that have been grabbed, then \cs{q_@@} and two generic +% grabbers. The idea to find default values is similar to the +% non-expandable case but we cannot define an auxiliary function, so +% at every step in the loop we need to go through all arguments +% searching for which ones started out as |-NoValue-| and replacing +% these by the newly computed values. In fact we need to keep track +% of three versions of all arguments: the original version, the +% previous version with default values, and the currently built +% version (first argument of \cs{@@_end_expandable_defaults:nnnNNn}). +% \begin{macrocode} +\cs_new:Npn \@@_end_expandable:NNw #1#2 + { \@@_end_expandable_aux:w #1#2 \prg_do_nothing: } +\cs_new:Npn \@@_end_expandable_aux:w #1#2#3 \q_@@ + { \exp_args:No \@@_end_expandable_aux:nNNNN {#3} #1 #2 } +\cs_new:Npn \@@_end_expandable_aux:nNNNN #1#2#3#4#5 + { + \token_if_eq_charcode:NNT ? #2 { \exp_after:wN \use_iv:nnnn } + \@@_end_expandable_defaults:nnnNNn {#1} { } {#1} #2#3 + { } { } { } { } { } { } { } { } { } { } + { + \__kernel_msg_expandable_error:nnf + { ltcmd } { loop-in-defaults } + { \exp_args:Nf \tl_trim_spaces:n { \token_to_str:N #4 } } + \use_iv:nnnn + } + \q_stop + } +\cs_new:Npn \@@_end_expandable_defaults:nnnNNn #1#2#3#4#5#6 + { + #6 + \str_if_eq:nnTF {#1} {#2} + { \use_i_delimit_by_q_stop:nw { \group_align_safe_end: #5 #1 } } + { + \exp_args:No \@@_tl_mapthread_function:nnN + { #4 #1 } {#3} + \@@_end_expandable_defaults:nnw + \@@_end_expandable_defaults:nnnNNn { } {#1} {#3} #4 #5 + } + } +\cs_new:Npn \@@_end_expandable_defaults:nnw #1#2 + { + \tl_if_novalue:nTF {#2} + { \exp_args:No \@@_end_expandable_defaults:nw {#1} } + { \@@_end_expandable_defaults:nw {#2} } + } +\cs_new:Npn \@@_end_expandable_defaults:nw + #1#2 \@@_end_expandable_defaults:nnnNNn #3 + { #2 \@@_end_expandable_defaults:nnnNNn { #3 {#1} } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Normalizing the argument specifications} +% +% The goal here is to expand aliases and check that the argument +% specification is valid before the main parsing run. If it is not +% valid the entire set up is abandoned to avoid any strange internal +% errors. A function is provided for each argument type that will grab +% any extra data items and call the loop function after performing the +% following checks and tasks. +% \begin{itemize} +% \item Check that each argument has the correct number of data items +% associated with it, and that where a single character is required, +% one has actually been supplied. +% \item Check that processors and the markers~|+| and~|!| are followed +% by an argument for which they make sense, and are not redundant. +% \item Check the absence of forbidden types for expandable commands, +% namely \texttt{G}/\texttt{v} always, and \texttt{l}/\texttt{u} +% after optional arguments (\pkg{xparse} may have inserted braces +% due to a failed search for an optional argument). +% \item Check that no optional argument is followed by a mandatory +% argument with the same delimiter, as otherwise the optional +% argument could never be omitted. +% \item Keep track in \cs{l_@@_some_long_bool} and +% \cs{l_@@_some_short_bool} of whether the command has some +% long/short arguments. +% \item Keep track in \cs{l_@@_grab_expandably_bool} of whether all +% arguments are \texttt{m}/\texttt{l}/\texttt{u} type and short +% arguments appear before long ones, in which case they can be +% grabbed expandably just as safely as they could be grabbed +% nonexpandably. Regardless of that, arguments of expandable +% commands will be grabbed expandably and arguments of environments +% will not (because the list of arguments built by non-expandable +% grabbing is used to pass them to the end-environment code). +% \end{itemize} +% Further checks happen at the end of the loop: +% \begin{itemize} +% \item that there are at most $9$ arguments; +% \item that an expandable command does not end with an optional +% argument (this case is detected by using the fact that +% \cs{l_@@_last_delimiters_tl} is cleared by every mandatory argument +% and filled by every optional argument). +% \end{itemize} +% +% \begin{macro}{\@@_normalize_arg_spec:n} +% \begin{macro}{\@@_normalize_arg_spec_loop:n} +% Loop through the argument specification, calling an auxiliary +% specific to each argument type. If any argument is unknown stop the +% definition. +% \begin{macrocode} +\cs_new_protected:Npn \@@_normalize_arg_spec:n #1 + { + \int_zero:N \l_@@_current_arg_int + \tl_clear:N \l_@@_last_delimiters_tl + \tl_clear:N \l_@@_arg_spec_tl + \bool_set_true:N \l_@@_grab_expandably_bool + \bool_set_false:N \l_@@_obey_spaces_bool + \bool_set_false:N \l_@@_long_bool + \bool_set_false:N \l_@@_some_obey_spaces_bool + \bool_set_false:N \l_@@_some_long_bool + \bool_set_false:N \l_@@_some_short_bool + \@@_normalize_arg_spec_loop:n #1 + \q_recursion_tail \q_recursion_tail \q_recursion_tail \q_recursion_stop + \int_compare:nNnT \l_@@_current_arg_int > 9 + { + \__kernel_msg_error:nnxx { ltcmd } { too-many-arguments } + { \@@_environment_or_command: } { \tl_to_str:n {#1} } + \@@_bad_def:wn + } + \bool_if:NT \l_@@_expandable_bool + { + \tl_if_empty:NF \l_@@_last_delimiters_tl + { + \__kernel_msg_error:nnxx { ltcmd } { expandable-ending-optional } + { \iow_char:N \\ \l_@@_function_tl } { \tl_to_str:n {#1} } + \@@_bad_def:wn + } + } + \bool_if:NT \l_@@_expandable_bool + { \bool_set_true:N \l_@@_grab_expandably_bool } + \bool_if:NT \l_@@_environment_bool + { \bool_set_false:N \l_@@_grab_expandably_bool } + } +\cs_new_protected:Npn \@@_normalize_arg_spec_loop:n #1 + { + \quark_if_recursion_tail_stop:n {#1} + \int_incr:N \l_@@_current_arg_int + \cs_if_exist_use:cF { @@_normalize_type_ \tl_to_str:n {#1} :w } + { + \bool_lazy_any:nTF + { + { \str_if_eq_p:nn {#1} { G } } + { \str_if_eq_p:nn {#1} { g } } + { \str_if_eq_p:nn {#1} { l } } + { \str_if_eq_p:nn {#1} { u } } + } + { + \__kernel_msg_error:nnxx { ltcmd } { xparse-argument-type } + { \@@_environment_or_command: } { \tl_to_str:n {#1} } + } + { + \__kernel_msg_error:nnxx { ltcmd } { unknown-argument-type } + { \@@_environment_or_command: } { \tl_to_str:n {#1} } + } + \@@_bad_def:wn + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro} +% { +% \@@_normalize_type_d:w, +% \@@_normalize_type_e:w, +% \@@_normalize_type_o:w, +% \@@_normalize_type_O:w, +% \@@_normalize_type_r:w, +% \@@_normalize_type_s:w, +% } +% These argument types are aliases of more general ones, for example +% with the default argument |-NoValue-|. To easily insert that marker +% expanded in the definitions we call \cs{@@_tmp:w} with the argument +% |-NoValue-|. For argument types that need additional data, check +% that the data is present (not \cs{q_recursion_tail}) before +% proceeding. +% \begin{macrocode} +\cs_set_protected:Npn \@@_tmp:w #1 + { + \cs_new_protected:Npn \@@_normalize_type_d:w ##1##2 + { + \quark_if_recursion_tail_stop_do:nn {##2} { \@@_bad_arg_spec:wn } + \@@_normalize_type_D:w {##1} {##2} {#1} + } + \cs_new_protected:Npn \@@_normalize_type_e:w ##1 + { + \quark_if_recursion_tail_stop_do:nn {##1} { \@@_bad_arg_spec:wn } + \@@_normalize_type_E:w {##1} { } + } + \cs_new_protected:Npn \@@_normalize_type_o:w + { \@@_normalize_type_D:w [ ] {#1} } + \cs_new_protected:Npn \@@_normalize_type_O:w + { \@@_normalize_type_D:w [ ] } + \cs_new_protected:Npn \@@_normalize_type_r:w ##1##2 + { + \quark_if_recursion_tail_stop_do:nn {##2} { \@@_bad_arg_spec:wn } + \@@_normalize_type_R:w {##1} {##2} {#1} + } + \cs_new_protected:Npn \@@_normalize_type_s:w + { \@@_normalize_type_t:w * } + } +\exp_args:No \@@_tmp:w { \c_novalue_tl } +% \end{macrocode} +% \end{macro} +% +% \begin{macro} +% { +% \@@_normalize_type_>:w, +% \@@_normalize_type_+:w, +% \@@_normalize_type_!:w, +% } +% Check that these prefixes have arguments, namely that the next token +% is not \cs{q_recursion_tail}, and remember to leave it after the +% looping macro. Processors are forbidden in expandable commands. +% If all is good, store the prefix in the cleaned up +% \cs{l_@@_arg_spec_tl}, and decrement the argument number as prefixes +% do not correspond to arguments. +% \begin{macrocode} +\cs_new_protected:cpn { @@_normalize_type_>:w } #1#2 + { + \quark_if_recursion_tail_stop_do:nn {#2} { \@@_bad_arg_spec:wn } + \bool_if:NT \l_@@_expandable_bool + { + \__kernel_msg_error:nnxx { ltcmd } { processor-in-expandable } + { \iow_char:N \\ \l_@@_function_tl } { \tl_to_str:n {#1} } + \@@_bad_def:wn + } + \tl_put_right:Nx \l_@@_arg_spec_tl { > { \tl_trim_spaces:n {#1} } } + \int_decr:N \l_@@_current_arg_int + \bool_set_false:N \l_@@_grab_expandably_bool + \@@_normalize_arg_spec_loop:n {#2} + } +\cs_new_protected:cpn { @@_normalize_type_+:w } #1 + { + \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn } + \bool_if:NT \l_@@_long_bool + { + \__kernel_msg_error:nnxx { ltcmd } { two-markers } + { \@@_environment_or_command: } { + } + \@@_bad_def:wn + } + \bool_set_true:N \l_@@_long_bool + \int_decr:N \l_@@_current_arg_int + \@@_normalize_arg_spec_loop:n {#1} + } +\cs_new_protected:cpn { @@_normalize_type_!:w } #1 + { + \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn } + \bool_if:NT \l_@@_obey_spaces_bool + { + \__kernel_msg_error:nnxx { ltcmd } { two-markers } + { \@@_environment_or_command: } { ! } + \@@_bad_def:wn + } + \bool_set_true:N \l_@@_obey_spaces_bool + \bool_set_true:N \l_@@_some_obey_spaces_bool + \int_decr:N \l_@@_current_arg_int + \@@_normalize_arg_spec_loop:n {#1} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro} +% { +% \@@_normalize_type_D:w, +% \@@_normalize_type_E:w, +% \@@_normalize_type_t:w, +% } +% \begin{macro}{\@@_normalize_E_unique_check:w} +% Optional argument types. Check that all required data is present +% (and consists of single characters if applicable) and check for +% forbidden types for expandable commands. For \texttt{E}-type +% require that there is at least one embellishment, that each one is a +% single character, and that there aren't more optional arguments than +% embellishments; also remember that each embellishment counts as one +% argument for \cs{l_@@_current_arg_int}. Then in each case +% store the data in \cs{l_@@_arg_spec_tl}, and +% for later checks store in \cs{l_@@_last_delimiters_tl} the tokens +% whose presence determines whether there is an optional argument (for +% braces store |{}|, seen later as an empty delimiter). +% \begin{macrocode} +\cs_new_protected:Npn \@@_normalize_type_D:w #1#2#3 + { + \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn } + \@@_single_token_check:n {#1} \@@_allowed_token_check:N #1 + \@@_single_token_check:n {#2} + \@@_add_arg_spec:n { D #1 #2 {#3} } + \tl_put_right:Nn \l_@@_last_delimiters_tl {#1} + \bool_set_false:N \l_@@_grab_expandably_bool + \@@_normalize_arg_spec_loop:n + } +\cs_new_protected:Npn \@@_normalize_type_E:w #1#2 + { + \quark_if_recursion_tail_stop_do:nn {#2} { \@@_bad_arg_spec:wn } + \tl_if_blank:nT {#1} { \@@_bad_arg_spec:wn } + \tl_map_function:nN {#1} \@@_single_token_check:n + \tl_map_function:nN {#1} \@@_allowed_token_check:N + \@@_normalize_E_unique_check:w #1 \q_nil \q_stop + \int_compare:nNnT { \tl_count:n {#2} } > { \tl_count:n {#1} } + { \@@_bad_arg_spec:wn } + \@@_add_arg_spec:n { E {#1} {#2} } + \tl_put_right:Nn \l_@@_last_delimiters_tl {#1} + \bool_set_false:N \l_@@_grab_expandably_bool + \int_add:Nn \l_@@_current_arg_int { \tl_count:n {#1} - 1 } + \@@_normalize_arg_spec_loop:n + } +\cs_new_protected:Npn \@@_normalize_E_unique_check:w #1#2 \q_stop + { + \quark_if_nil:NF #1 + { + \tl_if_in:nnT {#2} {#1} { \@@_bad_arg_spec:wn } + \@@_normalize_E_unique_check:w #2 \q_stop + } + } +\cs_new_protected:Npn \@@_normalize_type_t:w #1 + { + \quark_if_recursion_tail_stop_do:Nn #1 { \@@_bad_arg_spec:wn } + \@@_single_token_check:n {#1} \@@_allowed_token_check:N #1 + \tl_put_right:Nx \l_@@_arg_spec_tl + { + \bool_if:NT \l_@@_obey_spaces_bool { ! } + t \exp_not:n {#1} + } + \tl_put_right:Nn \l_@@_last_delimiters_tl {#1} + \bool_set_false:N \l_@@_grab_expandably_bool + \bool_set_false:N \l_@@_obey_spaces_bool + \bool_set_false:N \l_@@_long_bool + \@@_normalize_arg_spec_loop:n + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro} +% { +% \@@_normalize_type_m:w, +% \@@_normalize_type_R:w, +% \@@_normalize_type_v:w +% } +% Mandatory arguments. First check the required data is present, +% consists of single characters where applicable, and that the argument +% type is allowed for expandable commands if applicable. For the +% \texttt{m} and \texttt{R} argument types check that they do not +% follow some optional argument with that delimiter as otherwise the +% optional argument could not be omitted. Then save data in +% \cs{l_@@_arg_spec_tl}, count the mandatory argument, and empty the +% list of last delimiters. +% \begin{macrocode} +\cs_new_protected:Npn \@@_normalize_type_m:w + { + \@@_delimiter_check:nnn { } { m } { \iow_char:N \{ } + \@@_add_arg_spec_mandatory:n { m } + \@@_normalize_arg_spec_loop:n + } +\cs_new_protected:Npn \@@_normalize_type_R:w #1#2#3 + { + \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn } + \@@_single_token_check:n {#1} \@@_allowed_token_check:N #1 + \@@_single_token_check:n {#2} + \@@_delimiter_check:nnn {#1} { R/r } { \tl_to_str:n {#1} } + \bool_set_false:N \l_@@_grab_expandably_bool + \@@_add_arg_spec_mandatory:n { R #1 #2 {#3} } + \@@_normalize_arg_spec_loop:n + } +\cs_new_protected:Npn \@@_normalize_type_v:w + { + \@@_normalize_check_gv:N v + \@@_add_arg_spec_mandatory:n { v } + \@@_normalize_arg_spec_loop:n + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_normalize_type_b:w} +% This argument type is not allowed for commands. This is only +% allowed at the end of the argument specification, hence we check +% that |#1| is the end. +% \begin{macrocode} +\cs_new_protected:Npn \@@_normalize_type_b:w #1 + { + \bool_if:NF \l_@@_environment_bool + { + \__kernel_msg_error:nnxx + { ltcmd } { invalid-command-arg } + { \@@_environment_or_command: } { b } + \@@_bad_def:wn + } + \tl_clear:N \l_@@_last_delimiters_tl + \@@_add_arg_spec:n { b } + \quark_if_recursion_tail_stop:n {#1} + \__kernel_msg_error:nnxx { ltcmd } { arg-after-body } + { \@@_environment_or_command: } + { \tl_to_str:n {#1} } + \@@_bad_def:wn + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_single_token_check:n} +% Checks that the argument is a single (non-space) token (possibly +% surrounded by spaces), and aborts the definition otherwise. +% \begin{macrocode} +\cs_new_protected:Npn \@@_single_token_check:n #1 + { + \tl_trim_spaces_apply:nN {#1} \tl_if_single_token:nF + { + \__kernel_msg_error:nnxx { ltcmd } { not-single-token } + { \@@_environment_or_command: } { \tl_to_str:n {#1} } + \@@_bad_def:wn + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_allowed_token_check:N} +% Some tokens are now allowed as delimiters for some argument types, +% notably implicit begin/end-group tokens (|\bgroup|/|\egroup|). +% The major problem with these tokens is that for |\peek_...| functions, +% a literal~|{|$_1$. is virtually indistinguishable from a |\bgroup| or +% other token which was |\let| to a~|{|$_1$, and the same goes +% for~|}|$_2$. All other tokens can be easily distingushed from their +% implicit counterparts by grabbing them and looking at the string +% length (see \cs{@@_token_if_cs:NTF}), but for begin/end group tokens +% that is not possible without the risk of mistakenly grabbing the +% entire brace group (potentially leading to a~\texttt{!~Runaway argument} +% error) or trying to grab a |}|$_2$, leading to +% an~\verb|! Argument of \dots has an extra }| error. +% \begin{macrocode} +\cs_new_protected:Npn \@@_allowed_token_check:N #1 + { + \token_if_eq_meaning:NNTF #1 \c_group_begin_token + { \use:n } + { + \token_if_eq_meaning:NNTF #1 \c_group_end_token + { \use:n } + { \use_none:n } + } + { + \__kernel_msg_error:nnxxx + { ltcmd } { forbidden-implicit-group-token } + { \@@_environment_or_command: } { \tl_to_str:n {#1} } + { + \token_if_eq_meaning:NNTF #1 \c_group_begin_token + { begin } { end } + } + \@@_bad_def:wn + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_normalize_check_gv:N, \@@_normalize_check_lu:N} +% Called for arguments that are always forbidden, or forbidden after +% an optional argument, for expandable commands. +% \begin{macrocode} +\cs_new_protected:Npn \@@_normalize_check_gv:N #1 + { + \bool_if:NT \l_@@_expandable_bool + { + \__kernel_msg_error:nnxx + { ltcmd } { invalid-expandable-argument-type } + { \iow_char:N \\ \l_@@_function_tl } { \tl_to_str:n {#1} } + \@@_bad_def:wn + } + \bool_set_false:N \l_@@_grab_expandably_bool + } +\cs_new_protected:Npn \@@_normalize_check_lu:N #1 + { + \bool_if:NT \l_@@_expandable_bool + { + \tl_if_empty:NF \l_@@_last_delimiters_tl + { + \__kernel_msg_error:nnxx + { ltcmd } { invalid-after-optional-expandably } + { \iow_char:N \\ \l_@@_function_tl } { \tl_to_str:n {#1} } + \@@_bad_def:wn + } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_delimiter_check:nnn} +% Called for \texttt{m} and \texttt{R} arguments. Checks that the +% leading token does not coincide with the token denoting the presence +% of a previous optional argument. Instead of dealing with braces for +% the \texttt{m}-type we use an empty delimiter to denote that case. +% \begin{macrocode} +\cs_new_protected:Npn \@@_delimiter_check:nnn #1#2#3 + { + \tl_map_inline:Nn \l_@@_last_delimiters_tl + { + \tl_if_eq:nnT {##1} {#1} + { + \__kernel_msg_warning:nnxx { ltcmd } { optional-mandatory } + {#2} {#3} + } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_bad_arg_spec:wn, \@@_bad_def:wn} +% If the argument specification is wrong, this provides an escape from +% the entire definition process. +% \begin{macrocode} +\cs_new_protected:Npn \@@_bad_arg_spec:wn #1 \@@_break_point:n #2 + { + \__kernel_msg_error:nnxx { ltcmd } { bad-arg-spec } + { \@@_environment_or_command: } { \tl_to_str:n {#2} } + } +\cs_new_protected:Npn \@@_bad_def:wn #1 \@@_break_point:n #2 { } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_arg_spec:n, \@@_add_arg_spec_mandatory:n} +% When adding an argument to the argument specification, set the +% \texttt{some_long} or \texttt{some_short} booleans as appropriate +% and clear the booleans keeping track of |+| and |!| markers. +% Before that, test for a short argument following some long +% arguments: this is forbidden for expandable commands and prevents +% grabbing arguments expandably. +% +% For mandatory arguments do some more work, in particular complain if +% they were preceeded by~|!|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_arg_spec:n #1 + { + \bool_lazy_and:nnT + { ! \l_@@_long_bool } + { \l_@@_some_long_bool } + { + \bool_if:NT \l_@@_expandable_bool + { + \__kernel_msg_error:nnx { ltcmd } { inconsistent-long } + { \iow_char:N \\ \l_@@_function_tl } + \@@_bad_def:wn + } + \bool_set_false:N \l_@@_grab_expandably_bool + } + \bool_if:NTF \l_@@_long_bool + { \bool_set_true:N \l_@@_some_long_bool } + { \bool_set_true:N \l_@@_some_short_bool } + \tl_put_right:Nx \l_@@_arg_spec_tl + { + \bool_if:NT \l_@@_long_bool { + } + \bool_if:NT \l_@@_obey_spaces_bool { ! } + \exp_not:n {#1} + } + \bool_set_false:N \l_@@_long_bool + \bool_set_false:N \l_@@_obey_spaces_bool + } +\cs_new_protected:Npn \@@_add_arg_spec_mandatory:n #1 + { + \bool_if:NT \l_@@_some_obey_spaces_bool + { + \__kernel_msg_error:nnxx { ltcmd } { non-trailing-obey-spaces } + { \@@_environment_or_command: } { \tl_to_str:n {#1} } + \@@_bad_def:wn + } + \tl_clear:N \l_@@_last_delimiters_tl + \@@_add_arg_spec:n {#1} + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Preparing the signature: general mechanism} +% +% \begin{macro}{\@@_prepare_signature:n} +% \begin{macro}{\@@_prepare_signature:N} +% \begin{macro}{\@@_prepare_signature_bypass:N} +% Actually creating the signature uses the same loop approach as +% normalizing the signature. There are first a number of variables which need +% to be set to track what is going on. Many of these variables are unused +% when defining expandable commands. +% \begin{macrocode} +\cs_new_protected:Npn \@@_prepare_signature:n #1 + { + \int_zero:N \l_@@_current_arg_int + \bool_set_false:N \l_@@_long_bool + \bool_set_false:N \l_@@_obey_spaces_bool + \int_zero:N \l_@@_m_args_int + \bool_set_false:N \l_@@_defaults_bool + \tl_clear:N \l_@@_defaults_tl + \tl_clear:N \l_@@_process_all_tl + \tl_clear:N \l_@@_process_one_tl + \bool_set_false:N \l_@@_process_some_bool + \tl_clear:N \l_@@_signature_tl + \@@_prepare_signature:N #1 \q_recursion_tail \q_recursion_stop + \bool_if:NF \l_@@_expandable_bool { \@@_flush_m_args: } + } +% \end{macrocode} +% The main looping function does not take an argument, but carries out the +% reset on the processor boolean. This is split off from the rest of the +% process so that when actually setting up processors the flag-reset can +% be bypassed. +% +% For each known argument type there is an appropriate function to actually +% do the addition to the signature. These are separate for expandable and +% standard functions, as the approaches are different. +% \begin{macrocode} +\cs_new_protected:Npn \@@_prepare_signature:N + { + \bool_set_false:N \l_@@_prefixed_bool + \@@_prepare_signature_bypass:N + } +\cs_new_protected:Npn \@@_prepare_signature_bypass:N #1 + { + \quark_if_recursion_tail_stop:N #1 + \use:c + { + @@_add + \bool_if:NT \l_@@_grab_expandably_bool { _expandable } + _type_ \token_to_str:N #1 :w + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Setting up a standard signature} +% +% Each argument-adding function appends to the signature a grabber (and +% for some types, the delimiters or default value), except the one for +% \texttt{m} arguments. These are collected and added to the signature +% all at once by \cs{@@_flush_m_args:}, called for every other argument +% type. All of the functions then call the loop function +% \cs{@@_prepare_signature:N}. Default values of arguments are +% collected by \cs{@@_add_default:n} rather than being stored with the +% argument; this function and \cs{@@_add_default:} are also responsible +% for keeping track of \cs{l_@@_current_arg_int}. +% +% \begin{macro}{\@@_add_type_+:w} +% Making the next argument long means setting the flag. The \texttt{m} +% arguments are recorded here as +% this has to be done for every case where there is then a long argument. +% \begin{macrocode} +\cs_new_protected:cpn { @@_add_type_+:w } + { + \@@_flush_m_args: + \bool_set_true:N \l_@@_long_bool + \bool_set_true:N \l_@@_prefixed_bool + \@@_prepare_signature_bypass:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_type_!:w} +% Much the same for controlling trailing optional arguments. +% \begin{macrocode} +\cs_new_protected:cpn { @@_add_type_!:w } + { + \@@_flush_m_args: + \bool_set_true:N \l_@@_obey_spaces_bool + \bool_set_true:N \l_@@_prefixed_bool + \@@_prepare_signature_bypass:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_type_>:w} +% When a processor is found, the processor code is stored. It will be +% used by \cs{@@_args_process:} once arguments are all found. Here too +% the loop calls \cs{@@_prepare_signature_bypass:N} rather than +% \cs{@@_prepare_signature:N} so that the flag is not reset. +% \begin{macrocode} +\cs_new_protected:cpn { @@_add_type_>:w } #1 + { + \@@_flush_m_args: + \bool_set_true:N \l_@@_prefixed_bool + \bool_set_true:N \l_@@_process_some_bool + \tl_put_left:Nn \l_@@_process_one_tl { {#1} } + \@@_prepare_signature_bypass:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_type_b:w} +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_type_b:w + { + \@@_flush_m_args: + \@@_add_default: + \@@_add_grabber:N b + \@@_prepare_signature:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_type_D:w} +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_type_D:w #1#2#3 + { + \@@_flush_m_args: + \@@_add_default:n {#3} + \@@_add_grabber:N D + \tl_put_right:Nn \l_@@_signature_tl { #1 #2 } + \@@_prepare_signature:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_type_E:w} +% The \texttt{E}-type argument needs a special handling of default +% values. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_type_E:w #1#2 + { + \@@_flush_m_args: + \@@_add_default_E:nn {#1} {#2} + \@@_add_grabber:N E + \tl_put_right:Nn \l_@@_signature_tl { {#1} } + \@@_prepare_signature:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_type_m:w} +% The \texttt{m} type is special as short arguments which are not +% post-processed are simply counted at this stage. Thus there is a check +% to see if either of these cases apply. If so, a one-argument grabber +% is added to the signature. On the other hand, if a standard short +% argument is required it is simply counted at this stage, to be +% added later using \cs{@@_flush_m_args:}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_type_m:w + { + \@@_add_default: + \bool_if:NTF \l_@@_prefixed_bool + { \@@_add_grabber:N m } + { \int_incr:N \l_@@_m_args_int } + \@@_prepare_signature:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_type_R:w} +% The \texttt{R}-type argument is very similar to the \texttt{D}-type. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_type_R:w #1#2#3 + { + \@@_flush_m_args: + \@@_add_default:n {#3} + \@@_add_grabber:N R + \tl_put_right:Nn \l_@@_signature_tl { #1 #2 } + \@@_prepare_signature:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_type_t:w} +% Setting up a \texttt{t} argument means collecting one token for the test, +% and adding it along with the grabber to the signature. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_type_t:w #1 + { + \@@_flush_m_args: + \@@_add_default: + \@@_add_grabber:N t + \tl_put_right:Nn \l_@@_signature_tl {#1} + \@@_prepare_signature:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_type_v:w} +% At this stage, the \texttt{v} argument is identical to \texttt{l} +% except that since the grabber may fail to read a verbatim argument +% we need a default value. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_type_v:w + { + \@@_flush_m_args: + \exp_args:No \@@_add_default:n \c_novalue_tl + \@@_add_grabber:N v + \@@_prepare_signature:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_flush_m_args:} +% As \texttt{m} arguments are simply counted, there is a need to add +% them to the token register in a block. As this function can only +% be called if something other than \texttt{m} turns up, the flag can +% be switched here. +% \begin{macrocode} +\cs_new_protected:Npn \@@_flush_m_args: + { + \int_compare:nNnT \l_@@_m_args_int > 0 + { + \tl_put_right:Nx \l_@@_signature_tl + { \exp_not:c { @@_grab_m_ \int_use:N \l_@@_m_args_int :w } } + \tl_put_right:Nx \l_@@_process_all_tl + { \prg_replicate:nn { \l_@@_m_args_int } { { } } } + } + \int_zero:N \l_@@_m_args_int + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_grabber:N} +% To keep the various checks needed in one place, adding the grabber +% to the signature is done here. The only questions are whether the +% grabber should be long or not, and whether to obey spaces. The +% \cs{l_@@_obey_spaces_bool} boolean can only be \texttt{true} for +% trailing optional arguments. In that case spaces will not be +% ignored when looking for that optional argument. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_grabber:N #1 + { + \tl_put_right:Nx \l_@@_signature_tl + { + \exp_not:c + { + @@_grab_ #1 + \bool_if:NT \l_@@_long_bool { _long } + \bool_if:NT \l_@@_obey_spaces_bool { _obey_spaces } + :w + } + } + \bool_set_false:N \l_@@_long_bool + \bool_set_false:N \l_@@_obey_spaces_bool + \tl_put_right:Nx \l_@@_process_all_tl + { { \exp_not:o \l_@@_process_one_tl } } + \tl_clear:N \l_@@_process_one_tl + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_default:n, \@@_add_default:, \@@_add_default_E:nn} +% Store the default value of an argument, or rather code that gives +% that default value (it may involve other arguments). This is +% \cs{c_novalue_tl} for arguments with no actual default or with +% default |-NoValue-|; and (in a brace group) \cs{prg_do_nothing:} +% followed by a default value for others. For \texttt{E}-type +% arguments, pad the defaults |#2| with some \cs{c_novalue_tl} +% until there are as many as embellishments~|#1|. These functions are +% also used when defining expandable commands. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_default:n #1 + { + \tl_if_novalue:nTF {#1} + { \@@_add_default: } + { + \int_incr:N \l_@@_current_arg_int + \bool_set_true:N \l_@@_defaults_bool + \tl_put_right:Nn \l_@@_defaults_tl { { \prg_do_nothing: #1 } } + } + } +\cs_new_protected:Npn \@@_add_default: + { + \int_incr:N \l_@@_current_arg_int + \tl_put_right:Nn \l_@@_defaults_tl { \c_novalue_tl } + } +\cs_new_protected:Npn \@@_add_default_E:nn #1#2 + { + \tl_map_function:nN {#2} \@@_add_default:n + \prg_replicate:nn + { \tl_count:n {#1} - \tl_count:n {#2} } + { \@@_add_default: } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Setting up expandable types} +% +% The approach here is not dissimilar to that for standard types, but fewer types +% are supported. There is +% also a need to define the per-function auxiliaries: this is done here, while +% the general grabbers are dealt with later. +% +% \begin{macro}{\@@_add_expandable_type_+:w} +% We have already checked that short arguments are before long +% arguments, so \cs{l_@@_long_bool} only changes from \texttt{false} +% to \texttt{true} once (and there is no need to reset it after each +% argument). Also knock back the argument count because |+| is not an +% argument. Continue the loop. +% \begin{macrocode} +\cs_new_protected:cpn { @@_add_expandable_type_+:w } + { + \bool_set_true:N \l_@@_long_bool + \@@_prepare_signature:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_expandable_type_D:w} +% \begin{macro}{\@@_add_expandable_type_D_aux:NNNn} +% \begin{macro}{\@@_add_expandable_type_D_aux:NNN} +% \begin{macro}{\@@_add_expandable_type_D_aux:NN} +% The set up for \texttt{D}-type arguments involves constructing a +% rather complex auxiliary which is used +% repeatedly when grabbing. There is an auxiliary here so that the +% \texttt{R}-type can share code readily: |#1| is |D| or~|R|. +% The |_aux:NN| auxiliary is needed if the two delimiting tokens are +% identical: in contrast to the non-expandable route, the grabber here +% has to act differently for this case. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_expandable_type_D:w + { \@@_add_expandable_type_D_aux:NNNn D } +\cs_new_protected:Npn \@@_add_expandable_type_D_aux:NNNn #1#2#3#4 + { + \@@_add_default:n {#4} + \tl_if_eq:nnTF {#2} {#3} + { \@@_add_expandable_type_D_aux:NN #1 #2 } + { \@@_add_expandable_type_D_aux:NNN #1 #2 #3 } + \@@_prepare_signature:N + } +\cs_new_protected:Npn \@@_add_expandable_type_D_aux:NNN #1#2#3 + { + \bool_if:NTF \l_@@_long_bool + { \cs_set:cpx } + { \cs_set_nopar:cpx } + { \l_@@_expandable_aux_name_tl } ##1 ##2 #2 ##3 \q_@@ ##4 #3 + { ##1 {##2} {##3} {##4} } + \@@_add_expandable_grabber:nn {#1} + { + \exp_not:c { \l_@@_expandable_aux_name_tl } + \exp_not:n { #2 #3 } + } + } +\cs_new_protected:Npn \@@_add_expandable_type_D_aux:NN #1#2 + { + \bool_if:NTF \l_@@_long_bool + { \cs_set:cpx } + { \cs_set_nopar:cpx } + { \l_@@_expandable_aux_name_tl } ##1 #2 ##2 #2 + { ##1 {##2} } + \@@_add_expandable_grabber:nn { #1_alt } + { + \exp_not:c { \l_@@_expandable_aux_name_tl } + \exp_not:n {#2} + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_add_expandable_type_E:w} +% \begin{macro}{\@@_add_expandable_type_E_aux:n} +% For each embellishment, use \cs{@@_get_grabber:NN} to obtain an +% auxiliary delimited by that token and store a pair constituted of +% the auxiliary and the token in \cs{l_@@_tmpb_tl}, before appending +% the whole set of these pairs to the signature, and an equal number +% of |-NoValue-| markers (regardless of the default values of +% arguments). Set the current argument appropriately. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_expandable_type_E:w #1#2 + { + \@@_add_default_E:nn {#1} {#2} + \tl_clear:N \l_@@_tmpb_tl + \tl_map_function:nN {#1} \@@_add_expandable_type_E_aux:n + \@@_add_expandable_grabber:nn + { E \bool_if:NT \l_@@_long_bool { _long } } + { + { \exp_not:o \l_@@_tmpb_tl } + { + \prg_replicate:nn { \tl_count:n {#1} } + { { \c_novalue_tl } } + } + } + \@@_prepare_signature:N + } +\cs_new_protected:Npn \@@_add_expandable_type_E_aux:n #1 + { + \@@_get_grabber:NN #1 \l_@@_tmpa_tl + \tl_put_right:Nx \l_@@_tmpb_tl + { \exp_not:o \l_@@_tmpa_tl \exp_not:N #1 } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_add_expandable_type_m:w} +% Unlike the standard case, when working expandably each argument is always +% grabbed separately. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_expandable_type_m:w + { + \@@_add_default: + \@@_add_expandable_grabber:nn + { m \bool_if:NT \l_@@_long_bool { _long } } { } + \@@_prepare_signature:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_expandable_type_R:w} +% The \texttt{R}-type is very similar to the \texttt{D}-type +% argument, and so the same internals are used. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_expandable_type_R:w + { \@@_add_expandable_type_D_aux:NNNn R } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_expandable_type_t:w} +% An auxiliary delimited by |#1| is built now. It will be used to +% test for the presence of that token. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_expandable_type_t:w #1 + { + \@@_add_default: + \@@_get_grabber:NN #1 \l_@@_tmpa_tl + \@@_add_expandable_grabber:nn { t } + { + \exp_not:o \l_@@_tmpa_tl + \exp_not:N #1 + } + \@@_prepare_signature:N + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_expandable_grabber:nn} +% This is called for all arguments to place the right grabber in the +% signature. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_expandable_grabber:nn #1#2 + { + \tl_put_right:Nx \l_@@_signature_tl + { \exp_not:c { @@_expandable_grab_ #1 :w } #2 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_get_grabber:NN} +% \begin{macro}{\@@_get_grabber_auxi:NN} +% \begin{macro}{\@@_get_grabber_auxii:NN} +% Given a token |#1|, defines an expandable function delimited by that +% token and stores it in the token list~|#2|. The function is named +% after the token, unless that function name is already taken by some +% other grabber (this can happen in the rare case where delimiters +% with different category codes are used in the same document): in +% that case use a global counter to get a unique name. Since the +% grabbers are not named after \pkg{xparse} commands they should not +% be used to get material from the input stream. +% \begin{macrocode} +\cs_new_protected:Npn \@@_get_grabber:NN #1#2 + { + \cs_set:Npn \@@_tmp:w ##1 #1 {##1} + \exp_args:Nc \@@_get_grabber_auxi:NN + { @@_grabber_ \token_to_str:N #1 :w } #2 + } +\cs_new_protected:Npn \@@_get_grabber_auxi:NN #1#2 + { + \cs_if_eq:NNTF \@@_tmp:w #1 + { \tl_set:Nn #2 {#1} } + { + \cs_if_exist:NTF #1 + { + \int_gincr:N \g_@@_grabber_int + \exp_args:Nc \@@_get_grabber_auxi:NN + { + @@_grabber_ + - \int_use:N \g_@@_grabber_int :w + } + #2 + } + { \@@_get_grabber_auxii:NN #1 #2 } + } + } +\cs_new_protected:Npn \@@_get_grabber_auxii:NN #1#2 + { + \cs_set_eq:NN #1 \@@_tmp:w + \tl_set:Nn #2 {#1} + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Grabbing arguments} +% +% All of the grabbers follow the same basic pattern. The initial +% function stores in \cs{l_@@_signature_tl} the code to grab further +% arguments, defines (the function in) \cs{l_@@_fn_tl} that will grab +% the argument, and calls it. +% +% Defining \cs{l_@@_fn_tl} means determining whether to use +% \cs{cs_set:Npn} or \cs{cs_set_nopar:Npn}, and for optional arguments +% whether to skip spaces. Once the argument is found, \cs{l_@@_fn_tl} +% calls \cs{@@_add_arg:n}, responsible for calling processors and +% grabbing further arguments. +% +% \begin{macro} +% { +% \@@_grab_b:w, +% \@@_grab_b_long:w, +% \@@_grab_b_obey_spaces:w, +% \@@_grab_b_long_obey_spaces:w, +% \@@_grab_b_aux:NNw, +% \@@_grab_b_end:Nw +% } +% This uses the well-tested code of \texttt{D}-type arguments, +% skipping the peeking step because the \texttt{b}-type argument is +% always present, and adding a cleanup stage at the end by hijacking +% the signature. The clean-up consists of properly +% dealing with \cs{l_@@_args_tl} and also putting back the \cs{end} +% that served as an end-delimiter: this \cs{end} receives the +% environment name as its argument and is run normally. The +% \texttt{D}-type code stores the argument found (body of the +% environment) as a brace group in \cs{l_@@_args_tl} and depending on +% the presence of a prefix~|!| we trim spaces or not before adding +% this braced argument into the saved \cs{l_@@_args_tl}. +% The strange \verb*|\begin | control sequence is there for display +% purposes only: it has to look like |\begin| in the terminal but +% not to delimited arguments. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_b:w + { \@@_grab_b_aux:NNw \cs_set_protected_nopar:Npn \tl_trim_spaces:n } +\cs_new_protected:Npn \@@_grab_b_long:w + { \@@_grab_b_aux:NNw \cs_set_protected:Npn \tl_trim_spaces:n } +\cs_new_protected:Npn \@@_grab_b_obey_spaces:w + { \@@_grab_b_aux:NNw \cs_set_protected_nopar:Npn \exp_not:n } +\cs_new_protected:Npn \@@_grab_b_long_obey_spaces:w + { \@@_grab_b_aux:NNw \cs_set_protected:Npn \exp_not:n } +\cs_new_protected:Npn \@@_grab_b_aux:NNw #1#2#3 \@@_run_code: + { + \@@_grab_D_aux:NNnN \begin \end {#3} #1 + \tl_put_left:Nn \l_@@_signature_tl { \@@_grab_b_end:Nw #2 } + \tl_set_eq:NN \l_@@_saved_args_tl \l_@@_args_tl + \tl_clear:N \l_@@_args_tl + \exp_args:Nc \l_@@_fn_tl { begin ~ } + } +\cs_new_protected:Npn \@@_grab_b_end:Nw #1#2 \@@_run_code: + { + \tl_set:Nx \l_@@_args_tl + { + \exp_not:V \l_@@_saved_args_tl + { \exp_after:wN #1 \l_@@_args_tl } + } + #2 + \@@_run_code: + \end + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_grab_D:w} +% \begin{macro}{\@@_grab_D_long:w} +% \begin{macro}{\@@_grab_D_obey_spaces:w} +% \begin{macro}{\@@_grab_D_long_obey_spaces:w} +% The generic delimited argument grabber. The auxiliary function does +% a peek test before calling \cs{@@_grab_D_call:Nw}, so that the +% optional nature of the argument works as expected. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_D:w #1#2#3 \@@_run_code: + { + \@@_grab_D_aux:NNnNN #1 #2 {#3} \cs_set_protected_nopar:Npn + \@@_peek_nonspace_remove:NTF + } +\cs_new_protected:Npn \@@_grab_D_long:w #1#2#3 \@@_run_code: + { + \@@_grab_D_aux:NNnNN #1 #2 {#3} \cs_set_protected:Npn + \@@_peek_nonspace_remove:NTF + } +\cs_new_protected:Npn \@@_grab_D_obey_spaces:w #1#2#3 \@@_run_code: + { + \@@_grab_D_aux:NNnNN #1 #2 {#3} \cs_set_protected_nopar:Npn + \@@_peek_meaning_remove:NTF + } +\cs_new_protected:Npn \@@_grab_D_long_obey_spaces:w #1#2#3 \@@_run_code: + { + \@@_grab_D_aux:NNnNN #1 #2 {#3} \cs_set_protected:Npn + \@@_peek_meaning_remove:NTF + } +% \end{macrocode} +% \begin{macro}{\@@_grab_D_aux:NNnNN} +% \begin{macro}{\@@_grab_D_aux:NNnN} +% This is a bit complicated. The idea is that, in order to check for +% nested optional argument tokens (\texttt{[[...]]} and so on) the +% argument needs to be grabbed without removing any braces at all. If +% this is not done, then cases like |[{[}]| fail. So after testing for +% an optional argument, it is collected piece-wise. Inserting a quark +% prevents loss of braces, and there is then a test to see if there are +% nested delimiters to handle. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_D_aux:NNnNN #1#2#3#4#5 + { + \@@_grab_D_aux:NNnN #1#2 {#3} #4 + #5 #1 + { \@@_grab_D_call:Nw #1 } + { \@@_add_arg:o \c_novalue_tl } + } +% \end{macrocode} +% Inside the \enquote{standard} grabber, there is a test to see if the +% grabbed argument is entirely enclosed by braces. There are a couple of +% extra factors to allow for: the argument might be entirely empty, and +% spaces at the start and end of the input must be retained around a brace +% group. Also notice that a \emph{blank} argument might still contain +% spaces. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_D_aux:NNnN #1#2#3#4 + { + \tl_set:Nn \l_@@_signature_tl {#3} + \exp_after:wN #4 \l_@@_fn_tl ##1 #2 + { + \tl_if_in:nnTF {##1} {#1} + { \@@_grab_D_nested:NNnN #1 #2 {##1} #4 } + { + \tl_if_blank:oTF { \use_none:n ##1 } + { \@@_add_arg:o { \use_none:n ##1 } } + { + \str_if_eq:eeTF + { \exp_not:o { \use_none:n ##1 } } + { { \exp_not:o { \use_ii:nnn ##1 \q_nil } } } + { \@@_add_arg:o { \use_ii:nn ##1 } } + { \@@_add_arg:o { \use_none:n ##1 } } + } + } + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\@@_grab_D_nested:NNnN} +% \begin{macro}{\@@_grab_D_nested:w} +% \begin{macro}{\l_@@_nesting_a_tl} +% \begin{macro}{\l_@@_nesting_b_tl} +% \begin{macro}{\q_@@} +% Catching nested optional arguments means more work. The aim here is +% to collect up each pair of optional tokens without \TeX{} helping out, +% and without counting anything. The code above will already have +% removed the leading opening token and a closing token, but the +% wrong one. The aim is then to work through the material grabbed +% so far and divide it up on each opening token, grabbing a closing +% token to match (thus working in pairs). Once there are no opening +% tokens, then there is a second check to see if there are any +% opening tokens in the second part of the argument (for things +% like |[][]|). Once everything has been found, the entire collected +% material is added to the output as a single argument. The only tricky part +% here is ensuring that any grabbing function that might run away is named +% after the function currently being parsed and not after \pkg{xparse}. That +% leads to some rather complex nesting! There is also a need to prevent the +% loss of any braces, hence the insertion and removal of quarks along the +% way. +% \begin{macrocode} +\tl_new:N \l_@@_nesting_a_tl +\tl_new:N \l_@@_nesting_b_tl +\quark_new:N \q_@@ +\cs_new_protected:Npn \@@_grab_D_nested:NNnN #1#2#3#4 + { + \tl_clear:N \l_@@_nesting_a_tl + \tl_clear:N \l_@@_nesting_b_tl + \exp_after:wN #4 \l_@@_fn_tl ##1 #1 ##2 \q_@@ ##3 #2 + { + \tl_put_right:No \l_@@_nesting_a_tl { \use_none:n ##1 #1 } + \tl_put_right:No \l_@@_nesting_b_tl { \use_i:nn #2 ##3 } + \tl_if_in:nnTF {##2} {#1} + { + \l_@@_fn_tl + \q_nil ##2 \q_@@ \ERROR + } + { + \tl_put_right:Nx \l_@@_nesting_a_tl + { \@@_grab_D_nested:w \q_nil ##2 \q_stop } + \tl_if_in:NnTF \l_@@_nesting_b_tl {#1} + { + \tl_set_eq:NN \l_@@_tmpa_tl \l_@@_nesting_b_tl + \tl_clear:N \l_@@_nesting_b_tl + \exp_after:wN \l_@@_fn_tl \exp_after:wN + \q_nil \l_@@_tmpa_tl \q_nil \q_@@ \ERROR + } + { + \tl_put_right:No \l_@@_nesting_a_tl + \l_@@_nesting_b_tl + \@@_add_arg:V \l_@@_nesting_a_tl + } + } + } + \l_@@_fn_tl #3 \q_nil \q_@@ \ERROR + } +\cs_new:Npn \@@_grab_D_nested:w #1 \q_nil \q_stop + { \exp_not:o { \use_none:n #1 } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\@@_grab_D_call:Nw} +% For \texttt{D} and \texttt{R}-type arguments, to avoid losing any +% braces, a token needs to be inserted before the argument to be grabbed. +% If the argument runs away because the closing token is missing then this +% inserted token shows up in the terminal. Ideally, |#1| would therefore be +% used directly, but that is no good as it will mess up the rest of the +% grabber. Instead, a copy of |#1| with an altered category code is used, +% as this will look right in the terminal but will not mess up the grabber. +% The only issue then is that the category code of |#1| is unknown. So there +% is a quick test to ensure that the inserted token can never be matched by +% the grabber. (This assumes that the open and close delimiters are not the +% same character with different category codes, but that really should not +% happen in any sensible document-level syntax.) +% An exception is when |#1| is a control sequence token, in which case the +% character-token treatment is no good because if hit with \cs{token_to_str:N} +% it would add sputios tokens to the argument. In this case a different +% branch is taken. The token inserted is then the same \meta{csname} as |#1|, +% but with a space appended, so that the grabber don't see it as another +% of the same delimiter. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_grab_D_call:Nw #1 + { + \token_if_eq_catcode:NNTF + #1 + { + \exp_after:wN \exp_after:wN \exp_after:wN + \l_@@_fn_tl \char_generate:nn { `#1 } { 11 } + } + { + \@@_token_if_cs:NTF #1 + { + \exp_after:wN \l_@@_fn_tl + \cs:w \cs_to_str:N #1 ~ \cs_end: + } + { + \exp_after:wN \l_@@_fn_tl + \token_to_str:N #1 + } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro} +% { +% \@@_grab_E:w, \@@_grab_E_long:w, +% \@@_grab_E_obey_spaces:w, \@@_grab_E_long_obey_spaces:w +% } +% \begin{macro}{\@@_grab_E:nnNN} +% \begin{macro}{\@@_grab_E_loop:NnN} +% \begin{macro}{\@@_grab_E_finalise:} +% Everything here needs to point to a loop. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_E:w #1#2 \@@_run_code: + { + \@@_grab_E:nnNN {#1} {#2} + \cs_set_protected_nopar:Npn + \@@_peek_nonspace_remove:NTF + } +\cs_new_protected:Npn \@@_grab_E_long:w #1#2 \@@_run_code: + { + \@@_grab_E:nnNN {#1} {#2} + \cs_set_protected:Npn + \@@_peek_nonspace_remove:NTF + } +\cs_new_protected:Npn \@@_grab_E_obey_spaces:w #1#2 \@@_run_code: + { + \@@_grab_E:nnNN {#1} {#2} + \cs_set_protected_nopar:Npn + \@@_peek_meaning_remove:NTF + } +\cs_new_protected:Npn \@@_grab_E_long_obey_spaces:w #1#2 \@@_run_code: + { + \@@_grab_E:nnNN {#1} {#2} + \cs_set_protected:Npn + \@@_peek_meaning_remove:NTF + } +% \end{macrocode} +% A loop is needed here to allow a random ordering of keys. These are +% searched for one at a time, with any not found needing to be tracked: +% they can appear later. The grabbed values are held in a property list +% which is then turned into an ordered list to be passed back to the user. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_E:nnNN #1#2#3#4 + { + \exp_after:wN #3 \l_@@_fn_tl ##1##2##3 + { + \prop_put:Nnn \l_@@_tmp_prop {##1} {##3} + \@@_grab_E_loop:NnN #4 { } ##2 \q_recursion_stop + } + \prop_clear:N \l_@@_tmp_prop + \tl_set:Nn \l_@@_signature_tl {#2} + \cs_set_protected:Npn \@@_grab_E_finalise: + { + \tl_map_inline:nn {#1} + { + \prop_get:NnNF \l_@@_tmp_prop {####1} \l_@@_tmpb_tl + { \tl_set_eq:NN \l_@@_tmpb_tl \c_novalue_tl } + \tl_put_right:Nx \l_@@_args_tl + { { \exp_not:V \l_@@_tmpb_tl } } + } + \l_@@_signature_tl \@@_run_code: + } + \@@_grab_E_loop:NnN #4 { } #1 \q_recursion_tail \q_recursion_stop + } +\cs_new_protected:Npn \@@_grab_E_loop:NnN #1#2#3#4 \q_recursion_stop + { + \cs_if_eq:NNTF #3 \q_recursion_tail + { \@@_grab_E_finalise: } + { + #1 #3 + { \l_@@_fn_tl #3 {#2#4} } + { \@@_grab_E_loop:NnN #1 {#2#3} #4 \q_recursion_stop } + } + } +\cs_new_protected:Npn \@@_grab_E_finalise: { } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\@@_grab_m:w} +% \begin{macro}{\@@_grab_m_long:w} +% Collecting a single mandatory argument is quite easy. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_m:w #1 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#1} + \exp_after:wN \cs_set_protected_nopar:Npn \l_@@_fn_tl ##1 + { \@@_add_arg:n {##1} } + \l_@@_fn_tl + } +\cs_new_protected:Npn \@@_grab_m_long:w #1 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#1} + \exp_after:wN \cs_set_protected:Npn \l_@@_fn_tl ##1 + { \@@_add_arg:n {##1} } + \l_@@_fn_tl + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_grab_m_1:w} +% \begin{macro}{\@@_grab_m_2:w} +% \begin{macro}{\@@_grab_m_3:w} +% \begin{macro}{\@@_grab_m_4:w} +% \begin{macro}{\@@_grab_m_5:w} +% \begin{macro}{\@@_grab_m_6:w} +% \begin{macro}{\@@_grab_m_7:w} +% \begin{macro}{\@@_grab_m_8:w} +% \begin{macro}{\@@_grab_m_9:w} +% \begin{macro}{\@@_grab_m_aux:Nnnnnnnnn} +% Grabbing 1--8 mandatory arguments is done by giving 8--1 known +% arguments to a 9-argument function that stores them in +% \cs{l_@@_args_tl}. For simplicity, grabbing 9 mandatory arguments +% is done by grabbing 5 then 4 arguments. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_grab_m_aux:Nnnnnnnnn #1#2#3#4#5#6#7#8#9 + { + \tl_put_right:No \l_@@_args_tl + { #1 {#2} {#3} {#4} {#5} {#6} {#7} {#8} {#9} } + \l_@@_signature_tl \@@_run_code: + } +\cs_new_protected:cpn { @@_grab_m_1:w } #1 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#1} + \exp_after:wN \cs_set_eq:NN \l_@@_fn_tl \@@_grab_m_aux:Nnnnnnnnn + \l_@@_fn_tl \use_none:nnnnnnn { } { } { } { } { } { } { } + } +\cs_new_protected:cpn { @@_grab_m_2:w } #1 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#1} + \exp_after:wN \cs_set_eq:NN \l_@@_fn_tl \@@_grab_m_aux:Nnnnnnnnn + \l_@@_fn_tl \use_none:nnnnnn { } { } { } { } { } { } + } +\cs_new_protected:cpn { @@_grab_m_3:w } #1 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#1} + \exp_after:wN \cs_set_eq:NN \l_@@_fn_tl \@@_grab_m_aux:Nnnnnnnnn + \l_@@_fn_tl \use_none:nnnnn { } { } { } { } { } + } +\cs_new_protected:cpn { @@_grab_m_4:w } #1 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#1} + \exp_after:wN \cs_set_eq:NN \l_@@_fn_tl \@@_grab_m_aux:Nnnnnnnnn + \l_@@_fn_tl \use_none:nnnn { } { } { } { } + } +\cs_new_protected:cpn { @@_grab_m_5:w } #1 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#1} + \exp_after:wN \cs_set_eq:NN \l_@@_fn_tl \@@_grab_m_aux:Nnnnnnnnn + \l_@@_fn_tl \use_none:nnn { } { } { } + } +\cs_new_protected:cpn { @@_grab_m_6:w } #1 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#1} + \exp_after:wN \cs_set_eq:NN \l_@@_fn_tl \@@_grab_m_aux:Nnnnnnnnn + \l_@@_fn_tl \use_none:nn { } { } + } +\cs_new_protected:cpn { @@_grab_m_7:w } #1 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#1} + \exp_after:wN \cs_set_eq:NN \l_@@_fn_tl \@@_grab_m_aux:Nnnnnnnnn + \l_@@_fn_tl \use_none:n { } + } +\cs_new_protected:cpn { @@_grab_m_8:w } #1 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#1} + \exp_after:wN \cs_set_eq:NN \l_@@_fn_tl \@@_grab_m_aux:Nnnnnnnnn + \l_@@_fn_tl \prg_do_nothing: + } +\cs_new_protected:cpx { @@_grab_m_9:w } + { + \exp_not:c { @@_grab_m_5:w } + \exp_not:c { @@_grab_m_4:w } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_grab_R:w, \@@_grab_R_long:w} +% \begin{macro}{\@@_grab_R_aux:NNnN} +% The grabber for \texttt{R}-type arguments is basically the same as +% that for \texttt{D}-type ones, but always skips spaces (as it is mandatory) +% and has a hard-coded error message. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_R:w #1#2#3 \@@_run_code: + { \@@_grab_R_aux:NNnN #1 #2 {#3} \cs_set_protected_nopar:Npn } +\cs_new_protected:Npn \@@_grab_R_long:w #1#2#3 \@@_run_code: + { \@@_grab_R_aux:NNnN #1 #2 {#3} \cs_set_protected:Npn } +\cs_new_protected:Npn \@@_grab_R_aux:NNnN #1#2#3#4 + { + \@@_grab_D_aux:NNnN #1 #2 {#3} #4 + \@@_peek_nonspace_remove:NTF #1 + { \@@_grab_D_call:Nw #1 } + { + \__kernel_msg_error:nnxx { ltcmd } { missing-required } + { \@@_environment_or_command: } + { \token_to_str:N #1 } + \@@_add_arg:o \c_novalue_tl + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_grab_t:w} +% \begin{macro}{\@@_grab_t_obey_spaces:w} +% \begin{macro}{\@@_grab_t_aux:NNw} +% Dealing with a token is quite easy. Check the match, remove the +% token if needed and add a flag to the output. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_t:w + { \@@_grab_t_aux:NNw \@@_peek_nonspace_remove:NTF } +\cs_new_protected:Npn \@@_grab_t_obey_spaces:w + { \@@_grab_t_aux:NNw \@@_peek_meaning_remove:NTF } +\cs_new_protected:Npn \@@_grab_t_aux:NNw #1#2#3 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#3} + \exp_after:wN \cs_set_protected:Npn \l_@@_fn_tl + { + #1 #2 + { \@@_add_arg:n { \BooleanTrue } } + { \@@_add_arg:n { \BooleanFalse } } + } + \l_@@_fn_tl + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{variable}{\l_@@_v_arg_tl} +% \begin{macrocode} +\tl_new:N \l_@@_v_arg_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_grab_v:w} +% \begin{macro}{\@@_grab_v_long:w} +% \begin{macro}{\@@_grab_v_aux:w} +% \begin{macro}{\@@_grab_v_group_end:} +% The opening delimiter is the first non-space token, and is never +% read verbatim. This is required by consistency with the case where +% the preceding argument was optional and absent: then \TeX{} has +% already read and tokenized that token when looking for the optional +% argument. The first thing is thus to check is that this delimiter +% is a character, and to distinguish the case of a left brace (in that +% case, \cs{group_align_safe_end:} is needed to compensate for the +% begin-group character that was just seen). Then set verbatim +% catcodes with \cs{@@_grab_v_aux_catcodes:}. +% +% The group keep catcode changes local, and +% \cs{group_align_safe_begin/end:} allow to use a character +% with category code~$4$ (normally |&|) as the delimiter (all commands +% do \cs{group_align_safe_begin/end:}, so there's no need to do that +% again here). +% It is ended by \cs{@@_grab_v_group_end:}, which smuggles +% the collected argument out of the group. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_v:w + { + \bool_set_false:N \l_@@_long_bool + \@@_grab_v_aux:w + } +\cs_new_protected:Npn \@@_grab_v_long:w + { + \bool_set_true:N \l_@@_long_bool + \@@_grab_v_aux:w + } +\cs_new_protected:Npn \@@_grab_v_aux:w #1 \@@_run_code: + { + \tl_set:Nn \l_@@_signature_tl {#1} + \group_begin: + \tex_escapechar:D = 92 \scan_stop: + \tl_clear:N \l_@@_v_arg_tl + \peek_remove_spaces:n + { + \peek_meaning_remove:NTF \c_group_begin_token + { + \group_align_safe_end: + \@@_grab_v_bgroup: + } + { + \peek_N_type:TF + { \@@_grab_v_aux_test:N } + { \@@_grab_v_aux_abort:n { } } + } + } + } +\cs_new_protected:Npn \@@_grab_v_group_end: + { + \exp_args:NNNo + \group_end: + \tl_set:Nn \l_@@_v_arg_tl { \l_@@_v_arg_tl } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_grab_v_aux_test:N} +% \begin{macro} +% { +% \@@_grab_v_aux_loop:N, +% \@@_grab_v_aux_loop:NN, +% \@@_grab_v_aux_loop_end: +% } +% Check that the opening delimiter is a character, setup category codes, +% then start reading tokens one by one, keeping the delimiter as an argument. +% If the verbatim was not nested, we will be grabbing one character +% at each step. Unfortunately, it can happen that what follows the +% verbatim argument is already tokenized. Thus, we check at each step +% that the next token is indeed a \enquote{nice} +% character, \emph{i.e.}, is not a character with +% category code $1$ (begin-group), $2$ (end-group) +% or $6$ (macro parameter), nor the space character, +% with category code~$10$ and character code~$32$, +% nor a control sequence. +% The partially built argument is stored in \cs{l_@@_v_arg_tl}. +% If we ever meet a token which we cannot grab (non-N-type), +% or which is not a character according to +% \cs{@@_grab_v_token_if_char:NTF}, then we bail out with +% \cs{@@_grab_v_aux_abort:n}. Otherwise, we stop at the first +% character matching the delimiter. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_v_aux_test:N #1 + { + \@@_grab_v_token_if_char:NTF #1 + { + \@@_grab_v_aux_put:N #1 + \@@_grab_v_aux_catcodes: + \@@_grab_v_aux_loop:N #1 + } + { \@@_grab_v_aux_abort:n {#1} #1 } + } +\cs_new_protected:Npn \@@_grab_v_aux_loop:N #1 + { + \peek_N_type:TF + { \@@_grab_v_aux_loop:NN #1 } + { \@@_grab_v_aux_abort:n { } } + } +\cs_new_protected:Npn \@@_grab_v_aux_loop:NN #1#2 + { + \@@_grab_v_token_if_char:NTF #2 + { + \token_if_eq_charcode:NNTF #1 #2 + { \@@_grab_v_aux_loop_end: } + { + \@@_grab_v_aux_put:N #2 + \@@_grab_v_aux_loop:N #1 + } + } + { \@@_grab_v_aux_abort:n {#2} #2 } + } +\cs_new_protected:Npn \@@_grab_v_aux_loop_end: + { + \@@_grab_v_group_end: + \@@_add_arg:x { \tl_tail:N \l_@@_v_arg_tl } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{variable}{\l_@@_v_nesting_int} +% \begin{macrocode} +\int_new:N \l_@@_v_nesting_int +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_grab_v_bgroup:} +% \begin{macro}{\@@_grab_v_bgroup_loop:} +% \begin{macro}{\@@_grab_v_bgroup_loop:N} +% If the opening delimiter is a left brace, we keep track of +% how many left and right braces were encountered so far in +% \cs{l_@@_v_nesting_int} (the methods used for optional +% arguments cannot apply here), and stop as soon as it reaches~$0$. +% +% Some care was needed when removing the opening delimiter, which +% has already been assigned category code~$1$: using +% \cs{peek_meaning_remove:NTF} in the \cs{@@_grab_v_aux:w} +% function would break within alignments. Instead, we first +% convert that token to a string, and remove the result as a +% normal undelimited argument. +% \begin{macrocode} +\cs_new_protected:Npx \@@_grab_v_bgroup: + { + \exp_not:N \@@_grab_v_aux_catcodes: + \exp_not:n { \int_set:Nn \l_@@_v_nesting_int { 1 } } + \exp_not:N \@@_grab_v_aux_put:N \iow_char:N \{ + \exp_not:N \@@_grab_v_bgroup_loop: + } +\cs_new_protected:Npn \@@_grab_v_bgroup_loop: + { + \peek_N_type:TF + { \@@_grab_v_bgroup_loop:N } + { \@@_grab_v_aux_abort:n { } } + } +\cs_new_protected:Npn \@@_grab_v_bgroup_loop:N #1 + { + \@@_grab_v_token_if_char:NTF #1 + { + \token_if_eq_charcode:NNTF \c_group_end_token #1 + { + \int_decr:N \l_@@_v_nesting_int + \int_compare:nNnTF \l_@@_v_nesting_int > 0 + { + \@@_grab_v_aux_put:N #1 + \@@_grab_v_bgroup_loop: + } + { \@@_grab_v_aux_loop_end: } + } + { + \token_if_eq_charcode:NNT \c_group_begin_token #1 + { \int_incr:N \l_@@_v_nesting_int } + \@@_grab_v_aux_put:N #1 + \@@_grab_v_bgroup_loop: + } + } + { \@@_grab_v_aux_abort:n {#1} #1 } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_grab_v_aux_catcodes:} +% \begin{macro}{\@@_grab_v_aux_abort:n} +% The approach for short verbatim arguments is to make the end-line +% character a macro parameter character: this is forbidden by the +% rest of the code. Then the error branch can check what caused the +% bail out and give the appropriate error message. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_v_aux_catcodes: + { + \cs_set_eq:NN \do \char_set_catcode_other:N + \dospecials + \tex_endlinechar:D = `\^^M \scan_stop: + \bool_if:NTF \l_@@_long_bool + { \char_set_catcode_other:n { \tex_endlinechar:D } } + { \char_set_catcode_parameter:n { \tex_endlinechar:D } } + } +\cs_new_protected:Npn \@@_grab_v_aux_abort:n #1 + { + \@@_grab_v_group_end: + \exp_after:wN \exp_after:wN \exp_after:wN + \peek_meaning_remove:NTF \char_generate:nn { \tex_endlinechar:D } { 6 } + { + \__kernel_msg_error:nnxxx { ltcmd } { verbatim-newline } + { \@@_environment_or_command: } + { \tl_to_str:N \l_@@_v_arg_tl } + { \tl_to_str:n {#1} } + \@@_add_arg:o \c_novalue_tl + } + { + \__kernel_msg_error:nnxxx { ltcmd } { verbatim-tokenized } + { \@@_environment_or_command: } + { \tl_to_str:N \l_@@_v_arg_tl } + { \tl_to_str:n {#1} } + \@@_add_arg:o \c_novalue_tl + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_grab_v_aux_put:N} +% Storing one token in the collected argument. Most tokens are +% converted to category code $12$, with the exception of active +% characters, and spaces (not sure what should be done for those). +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_v_aux_put:N #1 + { + \tl_put_right:Nx \l_@@_v_arg_tl + { + \token_if_active:NTF #1 + { \exp_not:N #1 } { \token_to_str:N #1 } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_grab_v_token_if_char:NTF} +% This function assumes that the escape character is printable. +% Then the string representation of control sequences is at least +% two characters, and \cs{str_tail:n} only removes the escape +% character. Macro parameter characters are doubled by +% \cs{tl_to_str:n}, and will also yield a non-empty result, +% hence are not considered as characters. +% \begin{macrocode} +\cs_new_protected:Npn \@@_grab_v_token_if_char:NTF #1 + { \str_if_eq:eeTF { } { \str_tail:n {#1} } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_arg:n, \@@_add_arg:V, \@@_add_arg:o, \@@_add_arg:x} +% When an argument is found it is stored, then further arguments are +% grabbed by calling \cs{l_@@_signature_tl}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_arg:n #1 + { + \tl_put_right:Nn \l_@@_args_tl { {#1} } + \l_@@_signature_tl \@@_run_code: + } +\cs_generate_variant:Nn \@@_add_arg:n { V , o , x } +% \end{macrocode} +% \end{macro} +% +% \subsection{Grabbing arguments expandably} +% +% \begin{macro}[EXP]{\@@_expandable_grab_D:w} +% \begin{macro}[EXP]{\@@_expandable_grab_D:NNNwNNn} +% \begin{macro}[EXP]{\@@_expandable_grab_D:NNNwNNnnn} +% \begin{macro}[EXP]{\@@_expandable_grab_D:Nw} +% \begin{macro}[EXP]{\@@_expandable_grab_D:nnNNNwNN} +% The first step is to grab the first token or group. The generic grabbers +% \cs{\meta{function}}\verb*| | and \cs{\meta{function}}\verb*| | are just after \cs{q_@@}, we go and find +% them (and use the long one). +% \begin{macrocode} +\cs_new:Npn \@@_expandable_grab_D:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_D:NNNwNNn #1 \q_@@ #2 #3 } } +% \end{macrocode} +% We then wish to test whether |#7|, which we just grabbed, is exactly |#2|. +% A preliminary test is whether their string representations coincide, then +% expand the only grabber function we have, |#1|, once: the two strings below +% are equal if and only if |#7| matches |#2| exactly.\footnote{It is obvious +% that if \texttt{\#7} matches \texttt{\#2} then the strings are equal. We +% must check the converse. The right-hand-side of \cs{str_if_eq:onTF} does +% not end with \texttt{\#3}, implying that the grabber function took +% everything as its arguments. The first brace group can only be empty if +% \texttt{\#7} starts with \texttt{\#2}, otherwise the brace group preceding +% \texttt{\#7} would not vanish. The third brace group is empty, thus the +% \cs{q_@@} that was used by our grabber \texttt{\#1} must be the one +% that we inserted (not some token in \texttt{\#7}), hence the second brace +% group contains the end of \texttt{\#7} followed by \texttt{\#2}. Since this +% is \texttt{\#2} on the right-hand-side, and no brace can be lost there, +% \texttt{\#7} must contain nothing else than its leading \texttt{\#2}.} +% The preliminary test is needed as |#7| could validly contain +% \tn{par} (because a later mandatory argument could be long) and our +% grabber may be short. If +% |#7| does not match |#2|, then the optional argument is missing, we use the +% default |-NoValue-|, and put back the argument |#7| in the input stream. +% +% If it does match, then interesting things need to be done. We will grab the +% argument piece by piece, with the following pattern: +% \begin{quote} +% \meta{grabber} \Arg{tokens} \\ +% ~~\cs{q_nil} \Arg{piece 1} \meta{piece 2} \cs{ERROR} \cs{q_@@}\\ +% ~~\cs{q_nil} \meta{input stream} +% \end{quote} +% The \meta{grabber} will find an opening delimiter in \meta{piece 2}, take +% the \cs{q_@@} as a second delimiter, and find more material delimited +% by the closing delimiter in the \meta{input stream}. We then move the part +% before the opening delimiter from \meta{piece 2} to \meta{piece 1}, and the +% material taken from the \meta{input stream} to the \meta{piece 2}. Thus, +% the argument moves gradually from the \meta{input stream} to the +% \meta{piece 2}, then to the \meta{piece 1} when we have made sure to find +% all opening and closing delimiters. This two-step process ensures that +% nesting works: the number of opening delimiters minus closing delimiters in +% \meta{piece 1} is always equal to the number of closing delimiters in +% \meta{piece 2}. We stop grabbing arguments once the \meta{piece 2} contains +% no opening delimiter any more, hence the balance is reached, and the final +% argument is \meta{piece 1} \meta{piece 2}. +% The indirection via \cs{@@_tmp:w} allows to insert |-NoValue-| expanded. +% \begin{macrocode} +\cs_set_protected:Npn \@@_tmp:w #1 + { + \cs_new:Npn \@@_expandable_grab_D:NNNwNNn ##1##2##3##4 \q_@@ ##5##6##7 + { + \str_if_eq:nnTF {##2} {##7} + { + \str_if_eq:onTF + { ##1 { } { } ##7 ##2 \q_@@ ##3 } + { { } {##2} { } } + } + { \use_ii:nn } + { + ##1 + { \@@_expandable_grab_D:NNNwNNnnn ##1##2##3##4 \q_@@ ##5##6 } + \q_nil { } ##2 \ERROR \q_@@ \ERROR + } + { ##4 {#1} \q_@@ ##5 ##6 {##7} } + } + } +\exp_args:No \@@_tmp:w { \c_novalue_tl } +% \end{macrocode} +% At this stage, |#7| is \cs{q_nil} \Arg{piece 1} \meta{more for piece 1}, +% and we want to concatenate all that, removing \cs{q_nil}, and keeping the +% opening delimiter |#2|. Simply use \cs{use_ii:nn}. Also, |#8| is +% \meta{remainder of piece 2} \cs{ERROR}, and |#9| is \cs{ERROR} \meta{more +% for piece 2}. We concatenate those, replacing the two \cs{ERROR} by the +% closing delimiter |#3|. +% \begin{macrocode} +\cs_new:Npn \@@_expandable_grab_D:NNNwNNnnn #1#2#3#4 \q_@@ #5#6#7#8#9 + { + \exp_args:Nof \@@_expandable_grab_D:nnNNNwNN + { \use_ii:nn #7 #2 } + { \@@_expandable_grab_D:Nw #3 \exp_stop_f: #8 #9 } + #1#2#3 #4 \q_@@ #5 #6 + } +\cs_new:Npn \@@_expandable_grab_D:Nw #1#2 \ERROR \ERROR { #2 #1 } +% \end{macrocode} +% Armed with our two new \meta{pieces}, we are ready to loop. However, we +% must first see if \meta{piece 2} (here |#2|) contains any opening +% delimiter |#4|. Again, we expand |#3|, this time removing its whole output +% with \cs{use_none:nnn}. The test is similar to \cs{tl_if_in:nnTF}. The +% token list is empty if and only if |#2| does not contain the opening +% delimiter. In that case, we are done, and put the argument (from which we +% remove a spurious pair of delimiters coming from how we started the loop). +% Otherwise, we go back to looping with +% \cs{@@_expandable_grab_D:NNNwNNnnn}. The code to deal with brace stripping +% is much the same as for the non-expandable case. +% \begin{macrocode} +\cs_new:Npn \@@_expandable_grab_D:nnNNNwNN #1#2#3#4#5#6 \q_@@ #7#8 + { + \exp_args:No \tl_if_empty:oTF + { #3 { \use_none:nnn } #2 \q_@@ #5 #4 \q_@@ #5 } + { + \tl_if_blank:oTF { \use_none:nn #1#2 } + { \@@_put_arg_expandable:ow { \use_none:nn #1#2 } } + { + \str_if_eq:eeTF + { \exp_not:o { \use_none:nn #1#2 } } + { { \exp_not:o { \use_iii:nnnn #1#2 \q_nil } } } + { \@@_put_arg_expandable:ow { \use_iii:nnn #1#2 } } + { \@@_put_arg_expandable:ow { \use_none:nn #1#2 } } + } + #6 \q_@@ #7 #8 + } + { + #3 + { \@@_expandable_grab_D:NNNwNNnnn #3#4#5#6 \q_@@ #7 #8 } + \q_nil {#1} #2 \ERROR \q_@@ \ERROR + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_expandable_grab_D_alt:w} +% \begin{macro}[EXP]{\@@_expandable_grab_D_alt:NNwNNn} +% \begin{macro}[EXP]{\@@_expandable_grab_D_alt:Nwn} +% When the delimiters are identical, nesting is not possible and a simplified +% approach is used. The test concept here is the same as for the case where +% the delimiters are different but there cannot be any nesting. +% \begin{macrocode} +\cs_new:Npn \@@_expandable_grab_D_alt:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_D_alt:NNwNNn #1 \q_@@ #2 #3 } } +\cs_set_protected:Npn \@@_tmp:w #1 + { + \cs_new:Npn \@@_expandable_grab_D_alt:NNwNNn ##1##2##3 \q_@@ ##4##5##6 + { + \str_if_eq:nnTF {##6} {##2} + { + \str_if_eq:onTF + { ##1 { } ##6 ##2 ##2 } + { { } ##2 } + } + { \use_ii:nn } + { + ##1 + { \@@_expandable_grab_D_alt:NNwn ##4 ##5 ##3 \q_@@ } + ##6 \ERROR + } + { ##3 {#1} \q_@@ ##4 ##5 {##6} } + } + } +\exp_args:No \@@_tmp:w { \c_novalue_tl } +\cs_new:Npn \@@_expandable_grab_D_alt:NNwn #1#2#3 \q_@@ #4 + { + \tl_if_blank:oTF { \use_none:n #4 } + { \@@_put_arg_expandable:ow { \use_none:n #4 } } + { + \str_if_eq:eeTF + { \exp_not:o { \use_none:n #4 } } + { { \exp_not:o { \use_ii:nnn #4 \q_nil } } } + { \@@_put_arg_expandable:ow { \use_ii:nn #4 } } + { \@@_put_arg_expandable:ow { \use_none:n #4 } } + } + #3 \q_@@ #1 #2 + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_expandable_grab_E:w, \@@_expandable_grab_E_long:w} +% \begin{macro}[EXP]{\@@_expandable_grab_E_aux:w} +% \begin{macro}[EXP]{\@@_expandable_grab_E_test:nnw} +% \begin{macro}[EXP]{\@@_expandable_grab_E_loop:nnnNNw} +% \begin{macro}[EXP]{\@@_expandable_grab_E_find:w} +% \begin{macro}[EXP]{\@@_expandable_grab_E_find:nnw} +% \begin{macro}[EXP]{\@@_expandable_grab_E_end:nnw} +% We keep track of long/short by placing the appropriate grabber as +% the third token after \cs{q_@@}; it is eventually removed by the +% \texttt{end:nnw} auxiliary. The \texttt{aux:w} auxiliary will be +% called repeatedly with two arguments: the set +% of pairs \meta{parser} \meta{token}, and the set of arguments found +% so far (initially all |{-NoValue-}|). At each step, grab what +% follows in the input stream then call the \texttt{loop:nnnNNw} +% auxiliary to compare it with each possible embellishment in turn. +% This auxiliary's |#1| is what was found in the input, |#2| collects +% \meta{parser} \meta{token} pairs that did not match, |#3| collects +% the corresponding arguments found previously, |#4| and |#5| is the +% current pair, |#6| is the remaining pairs, |#7| is empty or two +% \cs{q_nil}, and |#8| is the current argument. If none of the pairs +% matched (determined by \cs{quark_if_nil:NTF}) then call the +% \texttt{end} auxiliary to stop looking for embellishments, +% remembering to put what was grabbed in the input back where it +% belongs, and storing the arguments found just before \cs{q_@@}. If +% the current argument |#8| is not |-NoValue-| or if the input |#1| +% does not match |#5| (see \texttt{t}-type arguments below for a +% similar \cs{str_if_eq:onTF} test) then carry on the loop. +% Otherwise, we found a new embellishment: grab the corresponding +% argument in the input using the \texttt{find:w} auxiliary. To avoid +% losing braces around that auxiliary's argument we include a +% space, which will be eliminated in the next loop through +% embellishments. +% \begin{macrocode} +\cs_new:Npn \@@_expandable_grab_E:w #1 \q_@@ #2#3 + { \@@_expandable_grab_E_aux:w #1 \q_@@ #2 #3 #3 } +\cs_new:Npn \@@_expandable_grab_E_long:w #1 \q_@@ #2#3 + { \@@_expandable_grab_E_aux:w #1 \q_@@ #2 #3 #2 } +\cs_new:Npn \@@_expandable_grab_E_aux:w #1 \q_@@ #2#3#4 + { #2 { \@@_expandable_grab_E_test:nnw #1 \q_@@ #2 #3 #4 } } +\cs_new:Npn \@@_expandable_grab_E_test:nnw #1#2#3 \q_@@ #4#5#6#7 + { + \@@_expandable_grab_E_loop:nnnNNw {#7} { } { } + #1 \q_nil \q_nil \q_nil \q_mark #2 \q_nil + #3 \q_@@ #4 #5 #6 + } +\cs_new:Npn \@@_expandable_grab_E_loop:nnnNNw + #1#2#3#4#5#6 \q_nil #7 \q_mark #8 + { + \quark_if_nil:NTF #4 + { \@@_expandable_grab_E_end:nnw {#1} {#3} } + { + \tl_if_novalue:nTF {#8} + { \str_if_eq:onTF { #4 { } #1 #5 } {#5} } + { \use_ii:nn } + { \@@_expandable_grab_E_find:w { #2 #4 #5 #6 } {#3} ~ } + { + \@@_expandable_grab_E_loop:nnnNNw + {#1} { #2 #4 #5 } { #3 {#8} } + #6 \q_nil #7 \q_mark + } + } + } +\cs_new:Npn \@@_expandable_grab_E_find:w #1 \q_@@ #2#3#4 + { #4 { \@@_expandable_grab_E_find:nnw #1 \q_@@ #2 #3 #4 } } +\cs_new:Npn \@@_expandable_grab_E_find:nnw #1#2#3 \q_nil #4 \q_@@ #5#6#7#8 + { \@@_expandable_grab_E_aux:w {#1} { #2 {#8} #3 } #4 \q_@@ #5 #6 #7 } +\cs_new:Npn \@@_expandable_grab_E_end:nnw #1#2#3 \q_@@ #4#5#6 + { #3 #2 \q_@@ #4 #5 {#1} } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_expandable_grab_m:w, \@@_expandable_grab_m_long:w} +% \begin{macro}[EXP]{\@@_expandable_grab_m_aux:wNn} +% The mandatory case is easy: find the auxiliary after the \cs{q_@@}, +% and use it directly to grab the argument, then correctly position +% the argument before \cs{q_@@}. +% \begin{macrocode} +\cs_new:Npn \@@_expandable_grab_m:w #1 \q_@@ #2#3 + { #3 { \@@_expandable_grab_m_aux:wNn #1 \q_@@ #2 #3 } } +\cs_new:Npn \@@_expandable_grab_m_long:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_m_aux:wNn #1 \q_@@ #2 #3 } } +\cs_new:Npn \@@_expandable_grab_m_aux:wNn #1 \q_@@ #2#3#4 + { #1 {#4} \q_@@ #2 #3 } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_expandable_grab_R:w} +% \begin{macro}[EXP]{\@@_expandable_grab_R_aux:NNNwNNn} +% Much the same as for the \texttt{D}-type argument, with only the lead-off +% function varying. +% \begin{macrocode} +\cs_new:Npn \@@_expandable_grab_R:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_R_aux:NNNwNNn #1 \q_@@ #2#3 } } +\cs_set_protected:Npn \@@_tmp:w #1 + { + \cs_new:Npn \@@_expandable_grab_R_aux:NNNwNNn ##1##2##3##4 \q_@@ ##5##6##7 + { + \str_if_eq:nnTF {##7} {##2} + { + \str_if_eq:onTF + { ##1 { } { } ##7 ##2 \q_@@ ##3 } + { { } {##2} { } } + } + { \use_ii:nn } + { + ##1 + { \@@_expandable_grab_D:NNNwNNnnn ##1##2##3##4 \q_@@ ##5##6 } + \q_nil { } ##2 \ERROR \q_@@ \ERROR + } + { + \__kernel_msg_expandable_error:nnff + { ltcmd } { missing-required } + { \exp_args:Nf \tl_trim_spaces:n { \token_to_str:N ##5 } } + { \tl_to_str:n {##2} } + ##4 {#1} \q_@@ ##5 ##6 {##7} + } + } + } +\exp_args:No \@@_tmp:w { \c_novalue_tl } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_expandable_grab_R_alt:w} +% \begin{macro}[EXP]{\@@_expandable_grab_R_alt_aux:NNwNNn} +% When the delimiters are identical, nesting is not possible and a simplified +% approach is used. The test concept here is the same as for the case where +% the delimiters are different. +% \begin{macrocode} +\cs_new:Npn \@@_expandable_grab_R_alt:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_R_alt_aux:NNwNNn #1 \q_@@ #2#3 } } +\cs_set_protected:Npn \@@_tmp:w #1 + { + \cs_new:Npn \@@_expandable_grab_R_alt_aux:NNwNNn ##1##2##3 \q_@@ ##4##5##6 + { + \str_if_eq:nnTF {##6} {##2} + { + \str_if_eq:onTF + { ##1 { } ##6 ##2 ##2 } + { { } ##2 } + } + { \use_ii:nn } + { + ##1 + { \@@_expandable_grab_D_alt:NNwn ##4 ##5 ##3 \q_@@ } + ##6 \ERROR + } + { + \__kernel_msg_expandable_error:nnff + { ltcmd } { missing-required } + { \exp_args:Nf \tl_trim_spaces:n { \token_to_str:N ##4 } } + { \tl_to_str:n {##2} } + ##3 {#1} \q_@@ ##4 ##5 {##6} + } + } + } +\exp_args:No \@@_tmp:w { \c_novalue_tl } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_expandable_grab_t:w} +% \begin{macro}[EXP]{\@@_expandable_grab_t_aux:NNwn} +% As for a \texttt{D}-type argument, here we compare the grabbed tokens using +% the only parser we have in order to work out if |#2| is exactly equal to +% the output of the grabber. +% \begin{macrocode} +\cs_new:Npn \@@_expandable_grab_t:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_t_aux:NNwn #1 \q_@@ #2 #3 } } +\cs_new:Npn \@@_expandable_grab_t_aux:NNwn #1#2#3 \q_@@ #4#5#6 + { + \str_if_eq:onTF { #1 { } #6 #2 } {#2} + { #3 { \BooleanTrue } \q_@@ #4 #5 } + { #3 { \BooleanFalse } \q_@@ #4 #5 {#6} } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP] +% {\@@_put_arg_expandable:nw, \@@_put_arg_expandable:ow} +% A useful helper, to store arguments when they are ready. +% \begin{macrocode} +\cs_new:Npn \@@_put_arg_expandable:nw #1#2 \q_@@ { #2 {#1} \q_@@ } +\cs_generate_variant:Nn \@@_put_arg_expandable:nw { o } +% \end{macrocode} +% \end{macro} +% +% \subsection{Argument processors} +% +% \begin{macro}{\@@_bool_reverse:N} +% A simple reversal. +% \begin{macrocode} +\cs_new_protected:Npn \@@_bool_reverse:N #1 + { + \bool_if:NTF #1 + { \tl_set:Nn \ProcessedArgument { \c_false_bool } } + { \tl_set:Nn \ProcessedArgument { \c_true_bool } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\l_@@_split_list_seq, \l_@@_split_list_tl} +% \begin{macro}{\@@_split_list:nn} +% \begin{macro}{\@@_split_list_multi:nn, \@@_split_list_multi:nV} +% \begin{macro}{\@@_split_list_single:Nn} +% Splitting can take place either at a single token or at a longer +% identifier. To deal with single active tokens, a two-part procedure is +% needed. +% \begin{macrocode} +\seq_new:N \l_@@_split_list_seq +\tl_new:N \l_@@_split_list_tl +\cs_new_protected:Npn \@@_split_list:nn #1#2 + { + \tl_if_single:nTF {#1} + { + \token_if_cs:NTF #1 + { \@@_split_list_multi:nn {#1} {#2} } + { \@@_split_list_single:Nn #1 {#2} } + } + { \@@_split_list_multi:nn {#1} {#2} } + } +\cs_new_protected:Npn \@@_split_list_multi:nn #1#2 + { + \seq_set_split:Nnn \l_@@_split_list_seq {#1} {#2} + \tl_clear:N \ProcessedArgument + \seq_map_inline:Nn \l_@@_split_list_seq + { \tl_put_right:Nn \ProcessedArgument { {##1} } } + } +\cs_generate_variant:Nn \@@_split_list_multi:nn { nV } +\group_begin: +\char_set_catcode_active:N \^^@ +\cs_new_protected:Npn \@@_split_list_single:Nn #1#2 + { + \tl_set:Nn \l_@@_split_list_tl {#2} + \group_begin: + \char_set_lccode:nn { `\^^@ } { `#1 } + \tex_lowercase:D + { + \group_end: + \tl_replace_all:Nnn \l_@@_split_list_tl { ^^@ } + } {#1} + \@@_split_list_multi:nV {#1} \l_@@_split_list_tl + } +\group_end: +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{variable} +% +% \begin{macro}{\@@_split_argument:nnn} +% \begin{macro}{\@@_split_argument_aux:nnnn} +% \begin{macro}[EXP]{\@@_split_argument_aux:n} +% \begin{macro}[rEXP]{\@@_split_argument_aux:wn} +% Splitting to a known number of items is a special version of splitting +% a list, in which the limit is hard-coded and where there will always be +% exactly the correct number of output items. An auxiliary function is +% used to save on working out the token list length several times. +% \begin{macrocode} +\cs_new_protected:Npn \@@_split_argument:nnn #1#2#3 + { + \@@_split_list:nn {#2} {#3} + \exp_args:Nf \@@_split_argument_aux:nnnn + { \tl_count:N \ProcessedArgument } + {#1} {#2} {#3} + } +\cs_new_protected:Npn \@@_split_argument_aux:nnnn #1#2#3#4 + { + \int_compare:nNnF {#1} = { #2 + 1 } + { + \int_compare:nNnTF {#1} > { #2 + 1 } + { + \tl_set:Nx \ProcessedArgument + { + \exp_last_unbraced:NnNo + \@@_split_argument_aux:n + { #2 + 1 } + \use_none_delimit_by_q_stop:w + \ProcessedArgument + \q_stop + } + \__kernel_msg_error:nnxxx { ltcmd } { split-excess-tokens } + { \tl_to_str:n {#3} } { \int_eval:n { #2 + 1 } } + { \tl_to_str:n {#4} } + } + { + \tl_put_right:Nx \ProcessedArgument + { + \prg_replicate:nn { #2 + 1 - (#1) } + { { \exp_not:V \c_novalue_tl } } + } + } + } + } +% \end{macrocode} +% Auxiliaries to leave exactly the correct number of arguments in +% \cs{ProcessedArgument}. +% \begin{macrocode} +\cs_new:Npn \@@_split_argument_aux:n #1 + { \prg_replicate:nn {#1} { \@@_split_argument_aux:wn } } +\cs_new:Npn \@@_split_argument_aux:wn #1 \use_none_delimit_by_q_stop:w #2 + { + \exp_not:n { {#2} } + #1 + \use_none_delimit_by_q_stop:w + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_trim_spaces:n} +% This one is almost trivial. +% \begin{macrocode} +\cs_new_protected:Npn \@@_trim_spaces:n #1 + { \tl_set:Nx \ProcessedArgument { \tl_trim_spaces:n {#1} } } +% \end{macrocode} +% \end{macro} +% +% \subsection{Access to the argument specification} +% +% \begin{macro}{\@@_get_arg_spec_error:N, \@@_get_arg_spec_error:n} +% \begin{macro}{\@@_get_arg_spec_error_aux:n} +% Provide an informative error when trying to get the argument +% specification of a non-\pkg{xparse} command or environment. +% \begin{macrocode} +\cs_new_protected:Npn \@@_get_arg_spec_error:N #1 + { + \bool_set_false:N \l_@@_environment_bool + \tl_set:Nn \l_@@_fn_tl {#1} + \@@_get_arg_spec_error_aux:n { \cs_if_exist:NTF #1 } + } +\cs_new_protected:Npn \@@_get_arg_spec_error:n #1 + { + \bool_set_true:N \l_@@_environment_bool + \str_set:Nx \l_@@_environment_str {#1} + \@@_get_arg_spec_error_aux:n + { \cs_if_exist:cTF { \l_@@_environment_str } } + } +\cs_new_protected:Npn \@@_get_arg_spec_error_aux:n #1 + { + #1 + { + \__kernel_msg_error:nnx { ltcmd } { non-xparse } + { \@@_environment_or_command: } + } + { + \__kernel_msg_error:nnx { ltcmd } { unknown } + { \@@_environment_or_command: } + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_get_arg_spec:NTF} +% If the command is not an \pkg{xparse} command, complain. If it is, +% its second \enquote{item} is the argument specification. +% \begin{macrocode} +\cs_new_protected:Npn \@@_get_arg_spec:NTF #1#2#3 + { + \@@_cmd_if_xparse:NTF #1 + { + \tl_set:Nx \ArgumentSpecification { \tl_item:Nn #1 { 2 } } + #2 + } + {#3} + } +% \end{macrocode} +% \end{macro} +% +% Rolling forward from 2020-10-01 is tricky because the entire |ltcmd| +% module is new, but the user-level commands have the same name, so only +% these will clash. To work around that, in |latexrelease| mode we will +% (temporarily) disable \cs{__kernel_chk_if_free_cs:N} for this final +% part of the code, then restore at the end. +% \begin{macrocode} +%<latexrelease>\cs_new_eq:NN \@@_chk_if_free_cs:N \__kernel_chk_if_free_cs:N +%<latexrelease>\cs_gset_eq:NN \__kernel_chk_if_free_cs:N \use_none:n +% \end{macrocode} +% +% \begin{variable}{\ArgumentSpecification} +% \begin{macrocode} +\tl_new:N \ArgumentSpecification +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_get_arg_spec:N} +% \begin{macro}{\@@_get_arg_spec:n} +% Recovering the argument specification is now trivial. +% \begin{macrocode} +\cs_new_protected:Npn \@@_get_arg_spec:N #1 + { + \@@_get_arg_spec:NTF #1 { } + { \@@_get_arg_spec_error:N #1 } + } +\cs_new_protected:Npn \@@_get_arg_spec:n #1 + { + \exp_args:Nc \@@_get_arg_spec:NTF + { environment~ \tl_to_str:n {#1} } + { } + { \@@_get_arg_spec_error:n {#1} } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_show_arg_spec:N} +% \begin{macro}{\@@_show_arg_spec:n} +% Showing the argument specification simply means finding it and then +% calling the \cs{tl_show:N} function. +% \begin{macrocode} +\cs_new_protected:Npn \@@_show_arg_spec:N #1 + { + \@@_get_arg_spec:NTF #1 + { \tl_show:N \ArgumentSpecification } + { \@@_get_arg_spec_error:N #1 } + } +\cs_new_protected:Npn \@@_show_arg_spec:n #1 + { + \exp_args:Nc \@@_get_arg_spec:NTF + { environment~ \tl_to_str:n {#1} } + { \tl_show:N \ArgumentSpecification } + { \@@_get_arg_spec_error:n {#1} } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Utilities} +% +% \begin{macro}{\@@_check_definable:nNT, \@@_check_definable_aux:nN} +% Check that a token list is appropriate as a first argument of +% \cs{NewDocumentCommand} and similar functions and otherwise +% produce an error. First trim whitespace to allow for spaces around +% the actual command to be defined. If the result has multiple +% tokens, it is not a valid argument. The single token is a control +% sequence exactly if its string representation has more than one +% character (using \cs{token_to_str:N} rather than \cs{tl_to_str:n} +% to avoid problems with macro parameter characters, and setting +% \cs{tex_escapechar:D} to prevent it from being non-printable). +% Finally, check for an active character: this is done by lowercasing +% the token to fix its character code (arbitrarily to that of~|?|) +% and comparing the result to an active~|?|. Both control sequences +% and active characters are valid arguments, and non-active character +% tokens are not. In all cases, the group opened to keep assignments +% local must be closed. +% \begin{macrocode} +\cs_new_protected:Npn \@@_check_definable:nNT #1 + { \tl_trim_spaces_apply:nN {#1} \@@_check_definable_aux:nN } +\group_begin: + \char_set_catcode_active:n { `? } + \cs_new_protected:Npn \@@_check_definable_aux:nN #1#2 + { + \group_begin: + \tl_if_single_token:nTF {#1} + { + \int_set:Nn \tex_escapechar:D { 92 } + \exp_args:Nx \tl_if_empty:nTF + { \exp_args:No \str_tail:n { \token_to_str:N #1 } } + { + \exp_args:Nx \char_set_lccode:nn + { ` \str_head:n {#1} } { `? } + \tex_lowercase:D { \tl_if_eq:nnTF {#1} } { ? } + { \group_end: \use_iii:nnn } + { \group_end: \use_i:nnn } + } + { \group_end: \use_iii:nnn } + } + { \group_end: \use_ii:nnn } + { + \__kernel_msg_error:nnxx { ltcmd } { not-definable } + { \tl_to_str:n {#1} } { \token_to_str:N #2 } + } + { + \__kernel_msg_error:nnxx { ltcmd } { not-one-token } + { \tl_to_str:n {#1} } { \token_to_str:N #2 } + } + } +\group_end: +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_token_if_cs:NTF} +% Based on the definition of \cs{@@_check_definable_aux:nN} above, but +% only checks for an actual control sequence (\emph{i.e.}, +% \cs[no-index]{\meta{anything}}). \cs{tex_escapechar:D} is +% temporarily changed to a known value and then it checks if +% |\string#1| contains more than one character: if it does, it's a +% control sequence. This test differs from \cs{token_if_cs:NTF} for +% example in \verb|\token_if_cs:NTF \c_group_begin_token {T}{F}|, +% where \cs{token_if_cs:NTF} returns false. +% \begin{macrocode} +\cs_new_protected:Npn \@@_token_if_cs:NTF #1 + { + \group_begin: + \int_set:Nn \tex_escapechar:D { 92 } + \exp_args:Nx \tl_if_empty:nTF + { \exp_args:No \str_tail:n { \token_to_str:N #1 } } + { \group_end: \use_ii:nn } + { \group_end: \use_i:nn } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_tl_mapthread_function:NNN, \@@_tl_mapthread_function:nnN} +% \begin{macro}{\@@_tl_mapthread_loop:w} +% Analogue of \cs{seq_mapthread_function:NNN} for token lists. +% \begin{macrocode} +\cs_new:Npn \@@_tl_mapthread_function:NNN #1#2#3 + { + \exp_after:wN \exp_after:wN + \exp_after:wN \@@_tl_mapthread_loop:w + \exp_after:wN \exp_after:wN + \exp_after:wN #3 + \exp_after:wN #1 + \exp_after:wN \q_recursion_tail + \exp_after:wN \q_mark + #2 + \q_recursion_tail + \q_recursion_stop + } +\cs_new:Npn \@@_tl_mapthread_function:nnN #1#2#3 + { + \@@_tl_mapthread_loop:w #3 + #1 \q_recursion_tail \q_mark + #2 \q_recursion_tail \q_recursion_stop + } +\cs_new:Npn \@@_tl_mapthread_loop:w #1#2#3 \q_mark #4 + { + \quark_if_recursion_tail_stop:n {#2} + \quark_if_recursion_tail_stop:n {#4} + #1 {#2} {#4} + \@@_tl_mapthread_loop:w #1#3 \q_mark + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_cmd_if_xparse:NTF} +% \begin{macro}{\@@_cmd_if_xparse_aux:N} +% To determine whether the command is an \pkg{xparse} command check +% that its |arg_spec| is empty (this also excludes non-macros) and +% that its |replacement_spec| starts with either \cs{@@_start:nNNnnn} +% (non-expandable command) or \cs{@@_start_expandable:nNNNNn} +% (expandable command) or \cs{@@_start_env:nnnnn} (environment). +% \begin{macrocode} +\cs_new_protected:Npn \@@_cmd_if_xparse:NTF #1 + { + \exp_args:Nf \str_case_e:nnTF + { + \exp_args:Nf \tl_if_empty:nT { \cs_argument_spec:N #1 } + { + \exp_last_unbraced:Nf \@@_cmd_if_xparse_aux:w + { \cs_replacement_spec:N #1 } ~ \q_stop + } + } + { + { \token_to_str:N \@@_start:nNNnnn } { } + { \token_to_str:N \@@_start_expandable:nNNNNn } { } + { \token_to_str:N \@@_start_env:nnnnn } { } + } + } +\cs_new:Npn \@@_cmd_if_xparse_aux:w #1 ~ #2 \q_stop {#1} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_peek_nonspace:NTF, \@@_peek_nonspace_remove:NTF, \@@_peek_nonspace_aux:nNNTF} +% Collect spaces in a loop, and put the collected spaces back in the +% false branch of a call to \cs{peek_meaning:NTF} or +% \cs{peek_meaning_remove:NTF}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_peek_nonspace:NTF + { \@@_peek_nonspace_aux:nNNTF { } \@@_peek_meaning:NTF } +\cs_new_protected:Npn \@@_peek_nonspace_remove:NTF + { \@@_peek_nonspace_aux:nNNTF { } \@@_peek_meaning_remove:NTF } +\cs_new_protected:Npn \@@_peek_nonspace_aux:nNNTF #1#2#3#4#5 + { + \peek_meaning_remove:NTF \c_space_token + { \@@_peek_nonspace_aux:nNNTF { #1 ~ } #2 #3 {#4} {#5} } + { #2 #3 { #4 } { #5 #1 } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_peek_meaning:NTF, \@@_peek_meaning_remove:NTF} +% \begin{macro}{\@@_peek_cs_check_equal:NNN, \@@_peek_meaning_aux:NNTF, \@@_peek_true_remove:NNw} +% Peek ahead for a token with a given meaning. In case the search +% token is a control sequence, also check that the \meta{csname} is +% the same as the control sequence peeked at. This extra verification +% is necessary when the command is delimited by control sequence tokens +% (as opposed to character tokens), and we want the the exact same +% control sequence to match. +% \begin{macrocode} +\cs_new_protected:Npn \@@_peek_meaning:NTF + { \@@_peek_meaning_aux:NNTF \c_false_bool } +\cs_new_protected:Npn \@@_peek_meaning_remove:NTF + { \@@_peek_meaning_aux:NNTF \c_true_bool } +\cs_new_protected:Npn \@@_peek_meaning_aux:NNTF #1#2#3#4 + { + \tl_set:Nn \l_@@_tmpa_tl {#3} + \tl_set:Nn \l_@@_tmpb_tl {#4} + \peek_meaning:NTF #2 + { + \token_if_eq_meaning:NNTF #2 \c_group_begin_token + { \@@_peek_true_remove:Nw #1 } + { + \@@_token_if_cs:NTF #2 + { \@@_peek_cs_check_equal:NNN #1 #2 } + { \@@_peek_true_remove:Nw #1 } + } + } + { \l_@@_tmpb_tl } + } +\cs_new_protected:Npn \@@_peek_cs_check_equal:NNN #1#2#3 + { + \str_if_eq:nnTF {#2} {#3} + { \@@_peek_true_remove:Nw #1 } + { \l_@@_tmpb_tl } + #3 + } +\cs_new_protected:Npn \@@_peek_true_remove:Nw #1 + { + \bool_if:NTF #1 + { + \tex_afterassignment:D \l_@@_tmpa_tl + \cs_set_eq:NN \@@_tmp:w + } + { \l_@@_tmpa_tl } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Messages} +% +% \begin{variable}{\c_@@_ignore_def_tl} +% \begin{macrocode} +\tl_const:Nn \c_@@_ignore_def_tl + { \\ \\ LaTeX~will~ignore~this~entire~definition. } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_environment_or_command:} +% Two texts used in several messages. +% \begin{macrocode} +\cs_new:Npn \@@_environment_or_command: + { + \bool_if:NTF \l_@@_environment_bool + { environment ~ ' \l_@@_environment_str ' } + { + command ~ ' + \exp_args:Nf \tl_trim_spaces:n + { \exp_after:wN \token_to_str:N \l_@@_fn_tl } + ' + } + } +% \end{macrocode} +% \end{macro} +% +% Some messages intended as errors when defining commands/environments. +% \begin{macrocode} +\__kernel_msg_new:nnnn { ltcmd } { arg-after-body } + { In~the~definition~of~#1,~b~(body)~argument~must~be~last. } + { + The~'body'~argument~type~is~followed~by~'#2'~in~the~argument~ + specification~of~the~#1.~This~is~not~allowed. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { bad-arg-spec } + { Bad~argument~specification~'#2'~for~#1. } + { + The~argument~specification~provided~was~not~valid:~ + one~or~more~mandatory~pieces~of~information~were~missing. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { command-already-defined } + { Command~'#1'~already~defined! } + { + You~have~used~#2~ + with~a~command~that~already~has~a~definition. \\ \\ + The~existing~definition~of~'#1'~will~not~be~altered. + } +\__kernel_msg_new:nnnn { ltcmd } { command-not-yet-defined } + { Command ~'#1'~not~yet~defined! } + { + You~have~used~#2~ + with~a~command~that~was~never~defined. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { environment-already-defined } + { Environment~'#1'~already~defined! } + { + You~have~used~\NewDocumentEnvironment + with~an~environment~that~already~has~a~definition. \\ \\ + The~existing~definition~of~'#1'~will~not~be~altered. + } +\__kernel_msg_new:nnnn { ltcmd } { environment-not-yet-defined } + { Environment~'#1'~not~yet~defined! } + { + You~have~used~\RenewDocumentEnvironment + with~an~environment~that~was~never~defined. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { expandable-ending-optional } + { + Argument~specification~'#2'~for~expandable~command~'#1'~ + ends~with~optional~argument. + } + { + Expandable~commands~must~have~a~final~mandatory~argument~ + (or~no~arguments~at~all).~You~cannot~have~a~terminal~optional~ + argument~with~expandable~commands. + } +\__kernel_msg_new:nnnn { ltcmd } { inconsistent-long } + { Inconsistent~long~arguments~for~expandable~command~'#1'. } + { + The~arguments~for~an~expandable~command~must~not~involve~short~ + arguments~after~long~arguments.~You~have~tried~to~mix~the~two~types. + } +\__kernel_msg_new:nnnn { ltcmd } { invalid-command-arg } + { Argument~type~'#2'~not~available~for~#1. } + { + The~letter~'#2'~can~only~be~used~in~environment~argument~ + specifications,~not~for~commands. + \\ \\ + LaTeX~will~ignore~this~entire~definition. + } +\__kernel_msg_new:nnnn { ltcmd } { invalid-expandable-argument-type } + { Argument~type~'#2'~not~available~for~expandable~command~'#1'. } + { + The~letter~'#2'~specifies~an~argument~type~which~cannot~be~used~ + in~an~expandable~command. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { invalid-after-optional-expandably } + { + Argument~type~'#2'~not~available~after~optional~argument~ + for~expandable~command~'#1'. + } + { + The~letter~'#2'~specifies~an~argument~type~which~cannot~be~used~ + in~an~expandable~command~after~an~optional~argument. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { non-trailing-obey-spaces } + { Prefix~'!'~used~before~mandatory~argument~'#2'~of~#1. } + { + The~prefix~'!'~can~only~apply~to~trailing~optional~arguments. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { not-definable } + { First~argument~of~'#2'~must~be~a~command. } + { + The~first~argument~of~'#2'~should~be~the~document~command~that~will~ + be~defined.~The~provided~argument~'#1'~is~a~character.~Perhaps~a~ + backslash~is~missing? + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { not-one-token } + { First~argument~of~'#2'~must~be~a~command. } + { + The~first~argument~of~'#2'~should~be~the~document~command~that~will~ + be~defined.~The~provided~argument~'#1'~contains~more~than~one~ + token.~Perhaps~a~backslash~is~missing? + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { not-single-token } + { + Argument~delimiter~'#2'~for~the~#1~should~be~ + a~single~non-space~token. + } + { + The~argument~specification~provided~was~not~valid:~in~a~place~ + where~a~single~token~is~required,~LaTeX~found~'#2'. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { forbidden-implicit-group-token } + { Argument~delimiter~'#2'~for~the~#1~is~not~allowed. } + { + The~argument~specification~provided~was~not~valid:~the~implicit~ + #3-group~token~'#2'~is~not~allowed~as~an~argument~delimiter. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { processor-in-expandable } + { Argument~processor~'>{#2}'~cannot~be~used~for~the~expandable~command~'#1'. } + { + The~argument~specification~for~#1~contains~a~processor~function:~ + this~is~only~supported~for~standard~robust~commands. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { too-many-arguments } + { Too~many~arguments~in~argument~specification~'#2'~of~#1. } + { + The~argument~specification~provided~has~more~than~9~arguments.~ + This~cannot~be~implemented. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { two-markers } + { Two~'#2'~apply~to~the~same~argument~in~argument~specification~of~#1. } + { + The~argument~specification~provided~has~two~markers~'#2'~applying~ + to~the~same~argument;~these~are~redundant. + } +\__kernel_msg_new:nnnn { ltcmd } { unknown-argument-type } + { Unknown~argument~type~'#2'~for~the~#1. } + { + The~letter~'#2'~does~not~specify~a~known~argument~type. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { ltcmd } { xparse-argument-type } + { Deprecated~argument~type~'#2'~for~the~#1~requires~xparse. } + { + The~letter~'#2'~specifies~a~known~argument~type~that~requires~ + the~xparse~package. + \c_@@_ignore_def_tl + } +% \end{macrocode} +% +% Errors when using commands/environments. The \texttt{if-boolean} +% message is always used in expandable errors. The +% \texttt{loop-in-defaults} and \texttt{missing-required} messages can +% be expandable or not expandable. +% \begin{macrocode} +\__kernel_msg_new:nnn { ltcmd } { if-boolean } + { Invalid~use~\iow_char:N\\IfBooleanTF~{#1} } +\__kernel_msg_new:nnnn { ltcmd } { loop-in-defaults } + { Defaults~of~#1~have~circular~dependency. } + { + The~default~values~of~two~or~more~arguments~of~the~#1~ + depend~on~each~other~in~a~way~that~cannot~be~resolved. + } +\__kernel_msg_new:nnnn { ltcmd } { missing-required } + { Missing~required~argument~for~#1. } + { + The~current~#1~expects~an~argument~starting~with~'#2'.~ + LaTeX~did~not~find~it,~and~will~insert~a~default~value~to~be~processed. + } +\__kernel_msg_new:nnnn { ltcmd } { non-xparse } + { \str_uppercase:n #1~not~defined~using~xparse. } + { + You~have~asked~for~the~argument~specification~for~the~#1,~ + but~this~was~not~defined~using~xparse. + } +\__kernel_msg_new:nnnn { ltcmd } { split-excess-tokens } + { Too~many~'#1'~tokens~when~trying~to~split~argument. } + { + LaTeX~was~asked~to~split~the~input~'#3'~ + at~each~occurrence~of~the~token~'#1',~up~to~a~maximum~of~#2~parts.~ + There~were~too~many~'#1'~tokens. + } +\__kernel_msg_new:nnnn { ltcmd } { unknown } + { Unknown~document~#1. } + { + You~have~asked~for~the~argument~specification~for~the~#1,~ + but~it~is~not~defined. + } +\__kernel_msg_new:nnnn { ltcmd } { verbatim-newline } + { Verbatim~argument~of~#1~ended~by~end~of~line. } + { + The~verbatim~argument~of~the~#1~cannot~contain~more~than~one~line,~ + but~the~end~ + of~the~current~line~has~been~reached.~You~may~have~forgotten~the~ + closing~delimiter. + \\ \\ + LaTeX~will~ignore~'#2'. + } +\__kernel_msg_new:nnnn { ltcmd } { verbatim-tokenized } + { The~verbatim~#1~cannot~be~used~inside~an~argument. } + { + The~#1~takes~a~verbatim~argument.~ + It~may~not~appear~within~the~argument~of~another~function.~ + It~received~an~illegal~token \tl_if_empty:nF {#3} { ~'#3' } . + \\ \\ + LaTeX~will~ignore~'#2'. + } +% \end{macrocode} +% +% Intended more for information. +% \begin{macrocode} +\__kernel_msg_new:nnn { ltcmd } { define-command } + { + Defining~command~#1~ + with~sig.~'#2'~\msg_line_context:. + } +\__kernel_msg_new:nnn { ltcmd } { define-environment } + { + Defining~environment~'#1'~ + with~sig.~'#2'~\msg_line_context:. + } +\__kernel_msg_new:nnn { ltcmd } { redefine-command } + { + Redefining~command~#1~ + with~sig.~'#2'~\msg_line_context:. + } +\__kernel_msg_new:nnn { ltcmd } { redefine-environment } + { + Redefining~environment~'#1'~ + with~sig.~'#2'~\msg_line_context:. + } +\__kernel_msg_new:nnn { ltcmd } { optional-mandatory } + { + Since~the~mandatory~argument~'#1'~has~the~same~delimiter~'#2'~ + as~a~previous~optional~argument,~it~will~not~be~possible~to~ + omit~all~optional~arguments~when~calling~this~command. + } +\__kernel_msg_new:nnn { ltcmd } { unsupported-let } + { + The~command~'#1'~was~undefined~but~not~the~associated~commands~ + '#1~code'~and/or~'#1~defaults'.~Maybe~you~tried~using~ + \iow_char:N\\let.~This~may~lead~to~an~infinite~loop. + } +% \end{macrocode} +% +% \subsection{User functions} +% +% The user functions are more or less just the internal functions +% renamed. +% +% \begin{macro}{\BooleanFalse} +% \begin{macro}{\BooleanTrue} +% Design-space names for the Boolean values. +% \begin{macrocode} +\cs_new_eq:NN \BooleanFalse \c_false_bool +\cs_new_eq:NN \BooleanTrue \c_true_bool +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\NewDocumentCommand} +% \begin{macro}{\RenewDocumentCommand} +% \begin{macro}{\ProvideDocumentCommand} +% \begin{macro}{\DeclareDocumentCommand} +% The user macros are pretty simple wrappers around the internal ones. +% There is however a check that the first argument is a single token, +% possibly surrounded by spaces (hence the strange \cs{use:nnn}), and +% is definable. +% \begin{macrocode} +\cs_new_protected:Npn \NewDocumentCommand #1#2#3 + { + \@@_check_definable:nNT {#1} \NewDocumentCommand + { + \cs_if_exist:NTF #1 + { + \__kernel_msg_error:nnxx { ltcmd } { command-already-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \NewDocumentCommand } + } + { \@@_declare_cmd:Nnn #1 {#2} {#3} } + } + } +\cs_new_protected:Npn \RenewDocumentCommand #1#2#3 + { + \@@_check_definable:nNT {#1} \RenewDocumentCommand + { + \cs_if_exist:NTF #1 + { \@@_declare_cmd:Nnn #1 {#2} {#3} } + { + \__kernel_msg_error:nnxx { ltcmd } { command-not-yet-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \RenewDocumentCommand } + } + } + } +\cs_new_protected:Npn \ProvideDocumentCommand #1#2#3 + { + \@@_check_definable:nNT {#1} \ProvideDocumentCommand + { \cs_if_exist:NF #1 { \@@_declare_cmd:Nnn #1 {#2} {#3} } } + } +\cs_new_protected:Npn \DeclareDocumentCommand #1#2#3 + { + \@@_check_definable:nNT {#1} \DeclareDocumentCommand + { \@@_declare_cmd:Nnn #1 {#2} {#3} } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\NewDocumentEnvironment} +% \begin{macro}{\RenewDocumentEnvironment} +% \begin{macro}{\ProvideDocumentEnvironment} +% \begin{macro}{\DeclareDocumentEnvironment} +% Very similar for environments. +% \begin{macrocode} +\cs_new_protected:Npn \NewDocumentEnvironment #1#2#3#4 + { + \cs_if_exist:cTF {#1} + { \__kernel_msg_error:nnx { ltcmd } { environment-already-defined } {#1} } + { \@@_declare_env:nnnn {#1} {#2} {#3} {#4} } + } +\cs_new_protected:Npn \RenewDocumentEnvironment #1#2#3#4 + { + \cs_if_exist:cTF {#1} + { \@@_declare_env:nnnn {#1} {#2} {#3} {#4} } + { \__kernel_msg_error:nnx { ltcmd } { environment-not-yet-defined } {#1} } + } +\cs_new_protected:Npn \ProvideDocumentEnvironment #1#2#3#4 + { \cs_if_exist:cF {#1} { \@@_declare_env:nnnn {#1} {#2} {#3} {#4} } } +\cs_new_protected:Npn \DeclareDocumentEnvironment #1#2#3#4 + { \@@_declare_env:nnnn {#1} {#2} {#3} {#4} } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\NewExpandableDocumentCommand} +% \begin{macro}{\RenewExpandableDocumentCommand} +% \begin{macro}{\ProvideExpandableDocumentCommand} +% \begin{macro}{\DeclareExpandableDocumentCommand} +% The expandable versions are essentially the same as the basic +% functions. The strange \cs{use:nnn} is there in case |#1| is +% surrounded with spaces, as can happen with usual document catcodes +% in \cs{RenewExpandableDocumentCommand} |{| |\!| |}| \ldots{} +% \begin{macrocode} +\cs_new_protected:Npn \NewExpandableDocumentCommand #1#2#3 + { + \@@_check_definable:nNT {#1} \NewExpandableDocumentCommand + { + \cs_if_exist:NTF #1 + { + \__kernel_msg_error:nnxx { ltcmd } { command-already-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \NewExpandableDocumentCommand } + } + { \@@_declare_expandable_cmd:Nnn #1 {#2} {#3} } + } + } +\cs_new_protected:Npn \RenewExpandableDocumentCommand #1#2#3 + { + \@@_check_definable:nNT {#1} \RenewExpandableDocumentCommand + { + \cs_if_exist:NTF #1 + { \@@_declare_expandable_cmd:Nnn #1 {#2} {#3} } + { + \__kernel_msg_error:nnxx { ltcmd } { command-not-yet-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \RenewExpandableDocumentCommand } + } + } + } +\cs_new_protected:Npn \ProvideExpandableDocumentCommand #1#2#3 + { + \@@_check_definable:nNT {#1} \ProvideExpandableDocumentCommand + { + \cs_if_exist:NF #1 + { \@@_declare_expandable_cmd:Nnn #1 {#2} {#3} } + } + } +\cs_new_protected:Npn \DeclareExpandableDocumentCommand #1#2#3 + { + \@@_check_definable:nNT {#1} \DeclareExpandableDocumentCommand + { \@@_declare_expandable_cmd:Nnn #1 {#2} {#3} } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\IfBooleanT, \IfBooleanF, \IfBooleanTF} +% The logical \meta{true} and \meta{false} statements are just the +% normal \cs{c_true_bool} and \cs{c_false_bool} so \cs{bool_if:NTF} is +% almost enough. However, this code-level function blows up badly +% when passed invalid input. We want \cs{IfBooleanTF} to accept a +% single (non-space) token equal to \cs{c_true_bool} or +% \cs{c_false_bool}, possibly surrounded by spaces. If the input is +% blank or multiple items, jump to the error and pick the false +% branch. If the input, ignoring spaces (we do this by omitting +% braces in the \cs{tl_if_single_token:nF} test), is not a single +% token then jump to the error as well. It is then safe to compare +% the token to the two booleans, picking the appropriate branch. If +% neither matches, we jump to the error as well. +% \begin{macrocode} +\cs_new:Npn \IfBooleanTF #1 + { + \tl_if_single:nF {#1} + { \prg_break:n { \use:n } } + \tl_if_single_token:nF #1 + { \prg_break:n { \use:n } } + \token_if_eq_meaning:NNT #1 \c_true_bool + { \prg_break:n { \use_ii:nnn } } + \token_if_eq_meaning:NNT #1 \c_false_bool + { \prg_break:n { \use_iii:nnn } } + \prg_break:n { \use:n } + \prg_break_point: + { + \__kernel_msg_expandable_error:nnn { ltcmd } { if-boolean } {#1} + \use_ii:nn + } + } +\cs_new:Npn \IfBooleanT #1#2 { \IfBooleanTF {#1} {#2} { } } +\cs_new:Npn \IfBooleanF #1 { \IfBooleanTF {#1} { } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IfNoValueT, \IfNoValueF, \IfNoValueTF} +% Simple re-naming. +% \begin{macrocode} +\cs_new_eq:NN \IfNoValueF \tl_if_novalue:nF +\cs_new_eq:NN \IfNoValueT \tl_if_novalue:nT +\cs_new_eq:NN \IfNoValueTF \tl_if_novalue:nTF +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IfValueT, \IfValueF, \IfValueTF} +% Inverted logic. +% \begin{macrocode} +\cs_new:Npn \IfValueF { \tl_if_novalue:nT } +\cs_new:Npn \IfValueT { \tl_if_novalue:nF } +\cs_new:Npn \IfValueTF #1#2#3 { \tl_if_novalue:nTF {#1} {#3} {#2} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ProcessedArgument} +% Processed arguments are returned using this name, which is reserved +% here although the definition will change. +% \begin{macrocode} +\tl_new:N \ProcessedArgument +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ReverseBoolean, \SplitArgument, \SplitList, \TrimSpaces} +% Simple copies. +% \begin{macrocode} +\cs_new_eq:NN \ReverseBoolean \@@_bool_reverse:N +\cs_new_eq:NN \SplitArgument \@@_split_argument:nnn +\cs_new_eq:NN \SplitList \@@_split_list:nn +\cs_new_eq:NN \TrimSpaces \@@_trim_spaces:n +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ProcessList} +% To support \cs{SplitList}. +% \begin{macrocode} +\cs_new_eq:NN \ProcessList \tl_map_function:nN +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\GetDocumentCommandArgSpec} +% \begin{macro}{\GetDocumentEnvironmentArgSpec} +% \begin{macro}{\ShowDocumentCommandArgSpec} +% \begin{macro}{\ShowDocumentEnvironmentArgSpec} +% More simple mappings, with a check that the argument is a single +% control sequence or active character. +% \begin{macrocode} +\cs_new_protected:Npn \GetDocumentCommandArgSpec #1 + { + \@@_check_definable:nNT {#1} \GetDocumentCommandArgSpec + { \@@_get_arg_spec:N #1 } + } +\cs_new_eq:NN \GetDocumentEnvironmentArgSpec \@@_get_arg_spec:n +\cs_new_protected:Npn \ShowDocumentCommandArgSpec #1 + { + \@@_check_definable:nNT {#1} \ShowDocumentCommandArgSpec + { \@@_show_arg_spec:N #1 } + } +\cs_new_eq:NN \ShowDocumentEnvironmentArgSpec \@@_show_arg_spec:n +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% Finally as promised, restore \cs{__kernel_chk_if_free_cs:N}: +% \begin{macrocode} +%<latexrelease>\cs_gset_eq:NN \__kernel_chk_if_free_cs:N \@@_chk_if_free_cs:N +%<latexrelease>\cs_undefine:N \@@_chk_if_free_cs:N +% \end{macrocode} +% +% \begin{macrocode} +\ExplSyntaxOff +% \end{macrocode} +% +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\catcode`\^^@=\@latexrelease@catcode@null\relax +%<latexrelease> +%<latexrelease>\IncludeInRelease{2020/10/01}% +%<latexrelease> {\NewDocumentCommand}{Document commands}% +%<latexrelease>\@ifundefined{NewDocumentCommand} +%<latexrelease> {% +%<latexrelease> \IfFileExists{xparse.ltx} +%<latexrelease> {\input xparse.ltx } +%<latexrelease> {\@latex@error{LaTeX requires xparse}\@ehd}% +%<latexrelease> } +%<latexrelease> {} +%<latexrelease>\EndIncludeInRelease +%<latexrelease> +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\NewDocumentCommand}{Document commands}% +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% We need to stop DocStrip treating |@@| in a special way at this point. +% \begin{macrocode} +%<@@=> +% \end{macrocode} +% +% \Finale diff --git a/Master/texmf-dist/source/latex-dev/base/ltcntrl.dtx b/Master/texmf-dist/source/latex-dev/base/ltcntrl.dtx index a9357a06b87..d65b3aee94f 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltcntrl.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltcntrl.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx b/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx index 121979116c9..445cac2f2e4 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx b/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx index aff93510f97..ab9d4d0da16 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltdefns.dtx} - [2020/11/25 v1.5o LaTeX Kernel (definition commands)] + [2021/01/15 v1.5o LaTeX Kernel (definition commands)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltdefns.dtx} @@ -1471,7 +1471,7 @@ % \ldots % \end{quote} % \cs{robust@command@act} will iterate over the \meta{action-list}, evaluating -% each \meta{if-type-$n$}\meta{robust-cmd}|{|\meta{true}|}{|\meta{false}|}|. +% each \meta{if-type-$n$} \meta{robust-cmd} |{|\meta{true}|}{|\meta{false}|}|. % If the \meta{if-type-$n$} conditional returns \meta{true}, then % \meta{act-type-$n$}\meta{act-arg} is executed, and the loop ends. If the % conditional returns \meta{false}, then \meta{if-type-$n+1$} is executed in diff --git a/Master/texmf-dist/source/latex-dev/base/ltdirchk.dtx b/Master/texmf-dist/source/latex-dev/base/ltdirchk.dtx index 0e85f0a4052..36a1ca616cd 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltdirchk.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltdirchk.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -37,7 +37,7 @@ %<*driver> % \fi \ProvidesFile{ltdirchk.dtx} - [2020/12/05 v1.3a LaTeX Kernel (System Dependent Parts)] + [2021/01/15 v1.3a LaTeX Kernel (System Dependent Parts)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltdirchk.dtx} @@ -127,14 +127,16 @@ % |\input@path| should expand to a list of such directories, each in a % |{}| group. % +% \begin{sloppypar} % \DescribeMacro{\filename@parse} % After a call of the form: |\filename@parse{|\meta{filename}|}|, the -% three macros |\filename@area|,|\filename@base|,|\filename@ext| should +% three macros |\filename@area|, |\filename@base| and |\filename@ext| should % be defined to be the `area' (or directory), basename and % extension respectively. If there was no extension specified in % \meta{filename}, |\filename@ext| should be |\let| to |\relax| (so this % case may be tested with |\@ifundefined{filename@ext}| and, perhaps a % default extension substituted). +% \end{sloppypar} % % Normally one would not need to define this macro in |texsys.cfg| as % the automatic tests can supply parsers that work with UNIX and VMS and @@ -470,14 +472,16 @@ % |{}| group. % % +% \begin{sloppypar} % \DescribeMacro{\filename@parse} % After a call of the form: |\filename@parse{|\meta{filename}|}|, the -% three macros |\filename@area|,|\filename@base|,|\filename@ext| should +% three macros |\filename@area|, |\filename@base|, |\filename@ext| should % be defined to be the `area' (or directory), basename and % extension respectively. If there was no extension specified in % \meta{filename}, |\filename@ext| should be |\let| to |\relax| (so this % case may be tested with |\@ifundefined{filename@ext}| and, perhaps a % default extension substituted). +% \end{sloppypar} % % Normally one would not need to define this macro in |texsys.cfg| as % the automatic tests can supply parsers that work with UNIX and VMS diff --git a/Master/texmf-dist/source/latex-dev/base/lterror.dtx b/Master/texmf-dist/source/latex-dev/base/lterror.dtx index 91d221bced3..7f480a0171f 100644 --- a/Master/texmf-dist/source/latex-dev/base/lterror.dtx +++ b/Master/texmf-dist/source/latex-dev/base/lterror.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltexpl.dtx b/Master/texmf-dist/source/latex-dev/base/ltexpl.dtx index b642fd72a39..a9be1b05211 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltexpl.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltexpl.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 2019-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltexpl.dtx} - [2020/12/18 v1.2h LaTeX Kernel (expl3-dependent code)] + [2021/01/24 v1.3a LaTeX Kernel (expl3-dependent code)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltexpl.dtx} @@ -101,14 +101,16 @@ % First define some blank commands, so that in case something goes wrong while % loading \textsf{expl3}, we won't get strange \texttt{Undefined control % sequence} errors. +% \changes{v1.3a}{2021/01/24}{Define \pkg{expl3} hooks conditionally} % \begin{macrocode} %<*2ekernel|latexrelease> %<latexrelease>\IncludeInRelease{2020/10/01}% %<latexrelease> {\@expl@sys@load@backend@@}{Roll forward support}% -\def\@expl@sys@load@backend@@{} -\def\@expl@push@filename@@{} -\def\@expl@push@filename@aux@@{} -\def\@expl@pop@filename@@{} +\def\reserved@a#1{\ifdefined#1\else\def#1{}\fi} +\reserved@a\@expl@sys@load@backend@@ +\reserved@a\@expl@push@filename@@ +\reserved@a\@expl@push@filename@aux@@ +\reserved@a\@expl@pop@filename@@ %<latexrelease>\EndIncludeInRelease %</2ekernel|latexrelease> % \end{macrocode} @@ -188,7 +190,9 @@ % In \texttt{2ekernel} mode, an error is fatal and building the format % is aborted. Use \verb=\batchmode \read -1 to \tokenlist=, which errors % with -% \verb=! Emergency stop. (cannot \read from terminal in nonstop modes)= +%\begin{verbatim} +% ! Emergency stop. (cannot \read from terminal in nonstop modes) +%\end{verbatim} % and aborts the \TeX{} run. In \texttt{latexrelease} mode, raise an % error and do nothing. Both ways, the error message shows the minimum % \textsf{expl3} engine requirements. @@ -214,7 +218,7 @@ %</2ekernel> % \end{macrocode} % We do not support a roll forward across 2019. You need to start -% with 2019 if you want to get to 2020 or beyond. +% with 2019 if you want to get to 2020 or beyond. % \changes{v1.2g}{2020/11/24}{Support for roll forward (gh/434)} % \begin{macrocode} %<*latexrelease> @@ -225,21 +229,18 @@ --- I'm giving up!\MessageBreak\MessageBreak Note that manually loading the expl3 package\MessageBreak from your distribution is not enough}% - \@@end % die + \batchmode \read -1 to \reserved@a %</latexrelease> }% - {% - \input expl3.ltx - \ifdefined\NewDocumentCommand - \else - \IfFileExists{xparse.ltx} - {\input xparse.ltx } - {}% - \fi - }% + {\input expl3.ltx }% } %<latexrelease>\EndIncludeInRelease %<latexrelease> +% \end{macrocode} +% To support roll-forward for the case where \textsf{xparse} is fully +% integrated into the kernel, we do not need to repeat the complex test +% above as we can simply look for the marker command. +% \begin{macrocode} %<latexrelease>\IncludeInRelease{2020/02/02}% %<latexrelease> {expl3}{Pre-load expl3}% %<latexrelease>\IfFileExists{expl3.ltx} @@ -262,35 +263,8 @@ %<latexrelease>\EndIncludeInRelease % \end{macrocode} % -% -% Starting with 2020-10 the kernel contains most of the -% \texttt{xparse} interfaces loaded above. These interfaces are -% later used to define various user command. However, if somebody -% with an earlier installation tries to roll forward (using a -% \texttt{latexrelease} package from a newer release) this will not -% work as the earlier kernel doesn't contain commands such as -% \cs{NewDocumentCommand}. -% -% We therefore add code into \texttt{latexrelease.sty} to load the -% \texttt{xparse} package of the current installation instead. this -% may not work if the installation is really old, but roll forward -% can't do miracles. -% -% If the kernel is 2020-10 or later \cs{NewDocumentCommand} is -% already known (whether or not you roll forward or back) so -% nothing happens, but if you start from am earlier kernel the -% \texttt{xparse} package gets loaded by \texttt{latexrelease}. -% \changes{v1.2g}{2020/11/24}{Load xparse in latexrelease if needed (gh/434)} -% \begin{macrocode} -%<latexrelease>\IncludeInRelease{2020/10/01}% -%<latexrelease> {\NewDocumentCommand}{Emergency loading xparse}% -%<latexrelease> -%<latexrelease>\ifdefined\NewDocumentCommand \else -%<latexrelease> \RequirePackage{xparse} -%<latexrelease>\fi -%<latexrelease> -%<latexrelease>\EndIncludeInRelease -% \end{macrocode} +% \changes{v1.3a}{2021/01/21} +% {Move \pkg{xparse} rollback code to \texttt{ltcmd.dtx}} % % \subsection{Using expl3 code} % diff --git a/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx b/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx index b5b5de629a6..85c758ae608 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment -%% -%% File: ltfilehook.dtx (C) Copyright 2020,2021 Frank Mittelbach, -%% Phelype Oleinik & LaTeX Team +% +% Copyright (C) 2020-2021 +% Frank Mittelbach, Phelype Oleinik & LaTeX Team % % This file is part of the LaTeX base system. % ------------------------------------------- @@ -31,8 +31,8 @@ %%% From File: ltfilehook.dtx % % \begin{macrocode} -\providecommand\ltfilehookversion{v1.0e} -\providecommand\ltfilehookdate{2021/01/07} +\providecommand\ltfilehookversion{v1.0g} +\providecommand\ltfilehookdate{2021/02/08} % \end{macrocode} % %<*driver> @@ -55,6 +55,10 @@ } \ExplSyntaxOff +\providecommand\InternalDetectionOff{} +\providecommand\InternalDetectionOn{} + + \usepackage{structuredlog} % for demonstration \EnableCrossrefs @@ -622,6 +626,7 @@ % When rolling forward the following expl3 functions may not be defined. % If we roll back the code does nothing. % \changes{v1.0d}{2020/11/24}{Support for roll forward (gh/434)} +% \InternalDetectionOff % \begin{macrocode} %<latexrelease>\IncludeInRelease{2020/10/01}% %<latexrelease> {\file_parse_full_name_apply:nN}{Roll forward help}% @@ -643,7 +648,8 @@ %<latexrelease> { %<latexrelease> \tl_if_empty:nTF {#3} %<latexrelease> { \__file_parse_full_name_base:nw { } #2 . \s__file_stop {#1} } -%<latexrelease> { \__file_parse_full_name_area:nw { #1 / #2 } #3 \s__file_stop } +%<latexrelease> { \__file_parse_full_name_area:nw { #1 / #2 } +%<latexrelease> #3 \s__file_stop } %<latexrelease> } %<latexrelease>\cs_new:Npn \__file_parse_full_name_base:nw #1 #2 . #3 \s__file_stop %<latexrelease> { @@ -657,7 +663,8 @@ %<latexrelease> } %<latexrelease> { \__file_parse_full_name_tidy:nnnN {#1} { .#2 } } %<latexrelease> } -%<latexrelease> { \__file_parse_full_name_base:nw { #1 . #2 } #3 \s__file_stop } +%<latexrelease> { \__file_parse_full_name_base:nw { #1 . #2 } +%<latexrelease> #3 \s__file_stop } %<latexrelease> } %<latexrelease>\cs_new:Npn \__file_parse_full_name_tidy:nnnN #1 #2 #3 #4 %<latexrelease> { @@ -675,6 +682,7 @@ %<latexrelease>\EndIncludeInRelease %<*2ekernel> % \end{macrocode} +% \InternalDetectionOn % % \begin{macrocode} %<@@=> @@ -847,6 +855,17 @@ %<latexrelease>\long\def \InputIfFileExists#1#2{% %<latexrelease> \IfFileExists{#1}% %<latexrelease> {#2\@addtofilelist{#1}\@@input \@filef@und}} +% \end{macrocode} +% +% Also undo the internal command as some packages unfortunately test +% for their existence instead of using \cs{IfFormatAtLeastTF}. +% \changes{v1.0g}{2021/02/08}{Undo the internal for robust +% \cs{InputIfFileExists} in rollback (gh/494)} +% \begin{macrocode} +%<latexrelease>\expandafter\let\csname InputIfFileExists \endcsname\@undefined +% \end{macrocode} +% +% \begin{macrocode} %<latexrelease>\let\@input@file@exists@with@hooks\@undefined %<latexrelease>\let\unqu@tefilef@und\@undefined %<latexrelease>\EndIncludeInRelease @@ -897,7 +916,8 @@ @file-subst@ \@@_subst_file_normalize:Nn \use_ii_iii:nnn {#1} } - { \@@_subst_file_normalize:Nn \@@_file_name_compose:nnn {#2} } + { \@@_subst_file_normalize:Nn \@@_file_name_compose:nnn + {#2} } \group_end: } \cs_new_protected:Npn \@@_subst_remove:n #1 @@ -990,6 +1010,7 @@ % \subsection{Selecting a file (\cs{set@curr@file})} % % \begin{macro}{\set@curr@file,\@curr@file,\@curr@file@reqd} +% \changes{v1.0f}{2021/01/31}{set \cs{protect} to \cs{string} gh/481} % Now we hook into \cs{set@curr@file} to resolve a possible file % substitution, and add \cs{@expl@@@filehook@set@curr@file@@nNN} % at the end, after \cs{@curr@file} is set. @@ -1013,11 +1034,12 @@ % \begin{macrocode} %</2ekernel> %<*2ekernel|latexrelease> -%<latexrelease>\IncludeInRelease{2020/10/01}% +%<latexrelease>\IncludeInRelease{2021/05/01}% %<latexrelease> {\set@curr@file}{Setting current file name}% \def\set@curr@file#1{% \begingroup \escapechar\m@ne + \let\protect\string \expandafter\def\csname\expandafter\endcsname \expandafter{\csname\endcsname}% % \end{macrocode} @@ -1055,6 +1077,28 @@ % \end{macrocode} % % \begin{macrocode} +%<latexrelease>\IncludeInRelease{2020/10/01}% +%<latexrelease>\def\set@curr@file#1{% +%<latexrelease> \begingroup +%<latexrelease> \escapechar\m@ne +%<latexrelease> \expandafter\def\csname\expandafter\endcsname +%<latexrelease> \expandafter{\csname\endcsname}% +%<latexrelease> \@expl@@@filehook@if@no@extension@@nTF{#1}% +%<latexrelease> {\@tempswatrue}{\@tempswafalse}% +%<latexrelease> \@kernel@make@file@csname\@curr@file +%<latexrelease> \@expl@@@filehook@resolve@file@subst@@w {#1}% +%<latexrelease> \@expl@@@filehook@if@file@replaced@@TF +%<latexrelease> {\@kernel@make@file@csname\@curr@file@reqd +%<latexrelease> \@expl@@@filehook@normalize@file@name@@w{#1}% +%<latexrelease> \if@tempswa \@expl@@@filehook@drop@extension@@N\@curr@file@reqd \fi}% +%<latexrelease> {\if@tempswa \@expl@@@filehook@drop@extension@@N\@curr@file \fi +%<latexrelease> \global\let\@curr@file@reqd\@curr@file}% +%<latexrelease> \@expl@@@filehook@clear@replacement@flag@@ +%<latexrelease> \endgroup} +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} %<latexrelease>\IncludeInRelease{2019/10/01}% %<latexrelease> {\set@curr@file}{Setting current file name}% %<latexrelease>\def\set@curr@file#1{% @@ -1106,7 +1150,8 @@ \expandafter\ifx\csname\endcsname#1% .tex\else\string#1\fi} % \end{macrocode} -% +% +% \begin{sloppypar} % Then we call \cs{@expl@@@filehook@set@curr@file@@nNN} once for % \cs{@curr@file} to set \cs[no-index]{CurrentFile(Path)Used} and once for % \cs{@curr@file@reqd} to set \cs[no-index]{CurrentFile(Path)}. @@ -1116,6 +1161,7 @@ % \cs{@curr@file} and \cs{@curr@file@reqd} differ. This macro is % issued separate from \cs{set@curr@file} because it changes % \cs{CurrentFile}, and side-effects would quickly get out of control. +% \end{sloppypar} % \begin{macrocode} \def\@filehook@set@CurrentFile{% \@expl@@@filehook@set@curr@file@@nNN{\@curr@file}% @@ -1185,7 +1231,7 @@ %</2ekernel> %<*2ekernel|latexrelease> %<latexrelease>\IncludeInRelease{2020/10/01}% -%<latexrelease> {\@@_resolve_file_subst:w}{Replace files detect loops}% +%<latexrelease> {\@@_resolve_file_subst:w}{Replace files detect loops}% \ExplSyntaxOn \cs_new:Npn \@@_resolve_file_subst:w #1 \@nil { \@@_file_parse_full_name:nN {#1} \@@_file_subst_begin:nnn } @@ -1284,7 +1330,7 @@ %</2ekernel> %<*2ekernel|latexrelease> %<latexrelease>\IncludeInRelease{2020/10/01}% -%<latexrelease> {\@@_file_subst_tortoise_hare:nn}{Tortoise and Hare}% +%<latexrelease> {\@@_file_subst_tortoise_hare:nn}{Tortoise and Hare}% \ExplSyntaxOn \cs_new:Npn \@@_file_subst_tortoise_hare:nn #1 #2 #3 { @@ -1437,7 +1483,7 @@ % \begin{macrocode} %<@@=> % \end{macrocode} -% +% \InternalDetectionOff % \begin{macrocode} %</2ekernel> %<*2ekernel|latexrelease> @@ -1495,6 +1541,7 @@ \cs_new_eq:NN \@expl@@@filehook@file@pop@assign@@nnnn \__filehook_file_pop_assign:nnnn % \end{macrocode} +% \InternalDetectionOn % % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx b/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx index f91dfe32aaf..b27f9105873 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltfiles.dtx} - [2020/12/04 v1.2j LaTeX Kernel (File Handling)] + [2021/01/15 v1.2j LaTeX Kernel (File Handling)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltfiles.dtx} @@ -49,6 +49,9 @@ \providecommand\pkg[1]{\texttt{#1}} +\providecommand\InternalDetectionOff{} +\providecommand\InternalDetectionOn{} + \begin{document} \MaintainedByLaTeXTeam{latex} \maketitle @@ -458,12 +461,14 @@ % applied several times with harmful effects. We therefore % explicitly drop it at this point. the coding is somewhat obscure % due to the name of the macro which requires constructing. +% \InternalDetectionOff % \begin{macrocode} \edef \@kernel@after@begindocument@before {% \let\expandafter\noexpand\csname __hook env/document/begin\endcsname \noexpand\@empty} % \end{macrocode} +% \InternalDetectionOn % % \begin{macrocode} \let \@kernel@before@begindocument \@empty @@ -996,10 +1001,11 @@ % A side effect of the new code is that we will see quotes around % file name displays where there haven't been any before. % -% For compatibility with existing code using |{abc}.tex| or |{one.two}.png| -% an initial brace group is discarded before expansion and |\string| is applied -% The content of the brace group is discarded. This means that a leading space -% will be lost unless protected (by |{ }| or |" "| or |\space|) but filenames +% For compatibility with existing code using |{abc}.tex| or +% |{one.two}.png|, an initial brace group is discarded before +% expansion and |\string| is applied. The content of the brace +% group is discarded. This means that a leading space will be lost +% unless protected (by |{ }| or |" "| or |\space|) but filenames % with a space are hopefully rare. % % \changes{v1.2a}{2019/07/01}{Support UTF-8} diff --git a/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx b/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx index ee45ea5588f..d6fa6e8a7bf 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltfinal.dtx} - [2021/01/06 v2.2l LaTeX Kernel (Final Settings)] + [2021/02/25 v2.2m LaTeX Kernel (Final Settings)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltfinal.dtx} @@ -525,12 +525,13 @@ %</2ekernel> %<*2ekernel|latexrelease> %<latexrelease>\IncludeInRelease{2017/04/15}% -%<latexrelease> {\document@default@language}{Save language for hyphenation}% +%<latexrelease> {\document@default@language}{Save language for hyphenation}% \let\document@default@language\m@ne %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease %<latexrelease>\IncludeInRelease{0000/00/00}% -%<latexrelease> {\document@default@language}{Save language for hyphenation}% +%<latexrelease> {\document@default@language}{Save language for hyphenation}% +% %<latexrelease>\let\document@default@language\@undefined %<latexrelease>\EndIncludeInRelease %<*2ekernel> @@ -565,6 +566,52 @@ \fi % \end{macrocode} % +% For pdf\TeX\ preload and enable automatic glyph to Unicode mapping +% for more reliable copy and paste support. +% \changes{v2.2l}{2021/01/21}{Load glyphtounicode.tex for pdf\TeX} +% \changes{v2.2m}{2021/02/25}{Improve speed of ToUnicode everyjob loading code} +% +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2021/05/01}% +%<latexrelease> {\pdfgentounicode}{Preload glyphtounicode}% +\ifx \pdfgentounicode \@undefined \else +%<*2ekernel> + \ifnum 0=0% + \ifdefined\pdftexversion +% \pdftexversion<140 does not have \pdfgentounicode, so we only check higher values + \ifnum \pdftexversion=140 \ifnum\pdftexrevision<22 1\fi\fi + \fi + \relax +%</2ekernel> + \input glyphtounicode +%<*2ekernel> + \else + \begingroup + \everyeof{\noexpand}\endlinechar-1 + \edef\x{\endgroup + \everyjob{\the\everyjob\@@input glyphtounicode }% + }\x + \fi +%</2ekernel> + \pdfgentounicode=1 +\fi +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% When rolling back we can't unload the glyphtounicode mappings, but we +% can reset |\pdfgentounicode| to ensure that they aren't used. +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\pdfgentounicode}{Preload glyphtounicode}% +%<latexrelease>\ifx \pdfgentounicode \@undefined \else +%<latexrelease> \pdfgentounicode=0 +%<latexrelease>\fi +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% % \subsection{Input encoding} % % \changes{v2.1a}{2018/03/25}{default to UTF-8} @@ -1147,6 +1194,7 @@ % {Load first aid file if existing} % \begin{macrocode} \@input{latex2e-first-aid-for-external-files.ltx} +\@input{ltpara.ltx} % \end{macrocode} % % diff --git a/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx b/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx index 1c8f844bc37..f2324118a04 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -31,7 +31,7 @@ % %<*driver> % \fi -\ProvidesFile{ltfloat.dtx}[2020/12/05 v1.2d LaTeX Kernel (Floats)] +\ProvidesFile{ltfloat.dtx}[2021/02/10 v1.2f LaTeX Kernel (Floats)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltfloat.dtx} @@ -1004,7 +1004,12 @@ % \changes{v1.1m}{1995/05/25}{(CAR) Resettings moved to hook} % \changes{v1.1n}{1996/07/26}{remove unnecessary \cs{global} before % \cs{@minipage...}} +% \changes{v1.2e}{2021/02/03}{Explicitly end with \cs{par} (gh/489)} % \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2021/05/01}% +%<latexrelease> {\@savemarbox}{Explicit par for marginpar}% \long\def \@savemarbox #1#2{% \global\setbox #1% \color@vbox @@ -1012,12 +1017,35 @@ \hsize\marginparwidth \@parboxrestore \@marginparreset - #2% + #2\par \@minipagefalse \outer@nobreak }% \color@endbox } +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\@savemarbox}{Explicit par for marginpar}% +%<latexrelease> +%<latexrelease>\long\def \@savemarbox #1#2{% +%<latexrelease> \global\setbox #1% +%<latexrelease> \color@vbox +%<latexrelease> \vtop{% +%<latexrelease> \hsize\marginparwidth +%<latexrelease> \@parboxrestore +%<latexrelease> \@marginparreset +%<latexrelease> #2% +%<latexrelease> \@minipagefalse +%<latexrelease> \outer@nobreak +%<latexrelease> }% +%<latexrelease> \color@endbox +%<latexrelease>} +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % \end{macro} % @@ -1480,7 +1508,13 @@ % {Removed \cs{normalcolor} (again)} % \changes{v1.1t}{1997/11/19} % {Missing percent, again} +% \changes{v1.2e}{2021/02/10}{Explicitly run \cs{par} at the end of footnote text +% in preparation for paragraph hooks} % \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2021/05/01}% +%<latexrelease> {\@footnotetext}{footnotetext tagging}% \long\def\@footnotetext#1{\insert\footins{% \reset@font\footnotesize \interlinepenalty\interfootnotelinepenalty @@ -1493,7 +1527,32 @@ \color@begingroup \@makefntext{% \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \par \color@endgroup}}% +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\@footnotetext}{footnotetext tagging}% +%<latexrelease> +%<latexrelease>\long\def\@footnotetext#1{\insert\footins{% +%<latexrelease> \reset@font\footnotesize +%<latexrelease> \interlinepenalty\interfootnotelinepenalty +%<latexrelease> \splittopskip\footnotesep +%<latexrelease> \splitmaxdepth \dp\strutbox \floatingpenalty \@MM +%<latexrelease> \hsize\columnwidth \@parboxrestore +%<latexrelease> \protected@edef\@currentlabel{% +%<latexrelease> \csname p@footnote\endcsname\@thefnmark +%<latexrelease> }% +%<latexrelease> \color@begingroup +%<latexrelease> \@makefntext{% +%<latexrelease> \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% +%<latexrelease> \color@endgroup}}% +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % \end{macro} % @@ -1558,10 +1617,49 @@ % \begin{macrocode} \def\@mpfn{footnote} \def\thempfn{\thefootnote} -%</2ekernel> % \end{macrocode} +% % \end{macro} % \end{macro} % +% +% +% +% \begin{macro}{\footref} +% This command generates a footnote mark. The value is produced by +% referencing a \cs{label} placed into a \cs{footnote} elsewhere +% (can be one in the main galley or in a minipage). +% \changes{v1.2f}{2021/02/16}{\cs{footref} added} +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2021/05/01}% +%<latexrelease> {\footref}{Add footref}% +\def\footref#1{% + \begingroup + \unrestored@protected@xdef\@thefnmark{\ref{#1}}% + \endgroup + \@footnotemark +} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% We don't remove it when rolling back. +% \begin{macrocode} +%%<latexrelease>\IncludeInRelease{0000/00/00}% +%%<latexrelease> {\footref}{Add footref}% +%%<latexrelease> +%%<latexrelease>\let\footref\@undefined +%%<latexrelease> +%%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macrocode} +%</2ekernel> +% \end{macrocode} +% % \Finale % diff --git a/Master/texmf-dist/source/latex-dev/base/ltfntcmd.dtx b/Master/texmf-dist/source/latex-dev/base/ltfntcmd.dtx index 8d587a848a5..5f70053a688 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfntcmd.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfntcmd.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltfssaxes.dtx b/Master/texmf-dist/source/latex-dev/base/ltfssaxes.dtx index 4e3b4d983cc..e0c07874556 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfssaxes.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfssaxes.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 2019-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -35,7 +35,7 @@ % % \ProvidesFile{ltfssaxes.dtx} - [2020/12/22 v1.0h LaTeX Kernel (NFSS Axes handing)] + [2021/01/15 v1.0h LaTeX Kernel (NFSS Axes handing)] % \iffalse \documentclass{ltxdoc} \begin{document} @@ -764,8 +764,10 @@ %<latexrelease>\IncludeInRelease{2020/02/02}% %<latexrelease> {\fontseries}{delay fontseries update}% %<latexrelease> -%<latexrelease>\DeclareRobustCommand\fontseries[1]{\@forced@seriesfalse\merge@font@series{#1}} -%<latexrelease>\DeclareRobustCommand\fontseriesforce[1]{\@forced@seriestrue\edef\f@series{#1}} +%<latexrelease>\DeclareRobustCommand\fontseries[1]{\@forced@seriesfalse +%<latexrelease> \merge@font@series{#1}} +%<latexrelease>\DeclareRobustCommand\fontseriesforce[1]{\@forced@seriestrue +%<latexrelease> \edef\f@series{#1}} %<latexrelease>\let\delayed@f@adjustment\@undefined %<latexrelease> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx b/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx index d2dde745d4c..6d575fc9d0b 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltfsscmp.dtx b/Master/texmf-dist/source/latex-dev/base/ltfsscmp.dtx index 29580b8d5e5..03be855127d 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfsscmp.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfsscmp.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx b/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx index 725d0e39fcc..9710d543829 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -36,7 +36,7 @@ % % \ProvidesFile{ltfssdcl.dtx} - [2020/12/05 v3.0v LaTeX Kernel (NFSS Declarative Interface)] + [2021/02/15 v3.0w LaTeX Kernel (NFSS Declarative Interface)] % \iffalse \documentclass{ltxdoc} \begin{document} @@ -490,7 +490,11 @@ in version \math@version}% \@eha \fi - \else \expandafter\non@alpherr\fi +% \end{macrocode} +% extra \cs{expandafter} to remove the \cs{expandafter} added below +% \changes{v3.0w}{2021/02/115}{fix for (gh/501)} +% \begin{macrocode} + \else \expandafter\expandafter\expandafter\non@alpherr\fi % \end{macrocode} % If the legacy interface is used, e.g., \verb=$\sf -1$= the math % alphabet \verb=#1= does not take an argument so we better do not @@ -1526,7 +1530,7 @@ \def\set@mathdelimiter#1#2#3#4#5#6{% % \end{macrocode} % We use \cs{protected} not \cs{MakeRobust} so that -% \verb=\bigl\lfoor= etc.\ works inside \cs{protected@edef}. +% \verb=\bigl\lfoor= etc.\ works inside the argument of \cs{protected@edef}. % \changes{v3.0s}{2019/08/27}{Make math delimiters robust} % \changes{v3.0t}{2020/01/20}{fix for gh/251} % \begin{macrocode} @@ -1733,7 +1737,7 @@ \relax % \end{macrocode} % If it is undefined, fine otherwise check if it is a math alphabet -% defined via |\DeclareSymbolFontAlphabet|: +% defined via \\ |\DeclareSymbolFontAlphabet|: % \begin{macrocode} \else \edef\reserved@a{% diff --git a/Master/texmf-dist/source/latex-dev/base/ltfssini.dtx b/Master/texmf-dist/source/latex-dev/base/ltfssini.dtx index a92321bf5d7..361adac9c36 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfssini.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfssini.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -36,7 +36,7 @@ % % \ProvidesFile{ltfssini.dtx} - [2020/12/06 v3.2f LaTeX Kernel (NFSS Initialisation)] + [2021/01/15 v3.2f LaTeX Kernel (NFSS Initialisation)] % \iffalse \documentclass{ltxdoc} \begin{document} @@ -448,7 +448,7 @@ % \item \cs{bfseries} is called for a family using \texttt{bx} % (e.g., CMR) % \item Switch to a font family that is none of the meta -% families, e.g., via \verb=\fontfamily{ptm}\selectfont= +% families, e.g., via \verb=\fontfamily{ptm}\allowbreak\verb=\selectfont= % \item Then none of the real meta families, match but the final % \verb=\@elt{??}= will. % \item Therefore if the current series is \cs{mddefault} or @@ -1307,8 +1307,9 @@ } % \end{macrocode} % \end{macro} - - +% +% +% % \begin{macro}{\if@font@series@context} % The boolean to signal if we found the requested font series context. % \begin{macrocode} @@ -1334,9 +1335,11 @@ %<latexrelease>\EndIncludeInRelease %<*2ekernel> % \end{macrocode} - - - +% +% +% +% +% % % \section{Supporting nested emphasis} % @@ -1401,9 +1404,9 @@ \let\emfontdeclare@clist\@empty % \end{macrocode} % \end{macro} - - - +% +% +% % \begin{macro}{\emrest} % Reset the font to upright and upper/lower case. With the default rules % using \cs{shapedefault} does that for us but to be on the safe side we @@ -1412,12 +1415,13 @@ \DeclareRobustCommand\emreset{\upshape\ulcshape} % \end{macrocode} % \end{macro} - - - +% +% +% % \begin{macro}{\em} -% The new definition for \cs{em} (and implicitly \cs{emph} is like -% it was before if \cs{emfontdeclare@clist} is empty. +% +% The new definition for \cs{em} (and implicitly \cs{emph}) is the +% same as before as long as \cs{emfontdeclare@clist} is empty. % \begin{macrocode} \DeclareRobustCommand\em{% \@nomath\em diff --git a/Master/texmf-dist/source/latex-dev/base/ltfsstrc.dtx b/Master/texmf-dist/source/latex-dev/base/ltfsstrc.dtx index bd0f6fabd21..961abafc8a3 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfsstrc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfsstrc.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -30,7 +30,7 @@ % \iffalse %%% From File: ltfsstrc.dtx %% Copyright (C) 1989-97 by Frank Mittelbach and Rainer Sch\"opf. -%% Copyright (C) 1994-97 by LaTeX3 project. All rights reserved. +%% Copyright (C) 1994-97 by LaTeX Project. All rights reserved. % %<package>\NeedsTeXFormat{LaTeX2e}[2021/05/01] %<package>\ProvidesPackage{tracefnt} diff --git a/Master/texmf-dist/source/latex-dev/base/lthooks.dtx b/Master/texmf-dist/source/latex-dev/base/lthooks.dtx index 404938d203a..803914b4a74 100644 --- a/Master/texmf-dist/source/latex-dev/base/lthooks.dtx +++ b/Master/texmf-dist/source/latex-dev/base/lthooks.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment -%% -%% File: lthooks.dtx (C) Copyright 2020,2021 Frank Mittelbach, -%% Phelype Oleinik & LaTeX Team +% +% Copyright (C) 2020-2021 +% Frank Mittelbach, Phelype Oleinik & LaTeX Team % % This file is part of the LaTeX base system. % ------------------------------------------- @@ -32,7 +32,7 @@ % % \begin{macrocode} \def\lthooksversion{v1.0h} -\def\lthooksdate{2021/01/07} +\def\lthooksdate{2021/01/15} % \end{macrocode} % %<*driver> @@ -54,6 +54,9 @@ } \ExplSyntaxOff +\providecommand\InternalDetectionOff{} +\providecommand\InternalDetectionOn{} + \EnableCrossrefs \CodelineIndex \begin{document} @@ -1336,14 +1339,8 @@ % Like \cs{AtBeginDocument} but for the \hook{enddocument} hook. % \end{function} % -% -% -% \begin{function}{\AtBeginDvi} -% \begin{syntax} -% \cs{AtBeginDvi} \oarg{label} \Arg{code} -% \end{syntax} -% This hook is discussed in conjunction with the shipout hooks. -% \end{function} +% There is also \cs{AtBeginDvi} which is discussed in conjunction +% with the shipout hooks. % % \bigskip % @@ -1772,9 +1769,11 @@ % % \begin{macro}[EXP]{\@@_str_compare:nn} % Private copy of \cs{__str_if_eq:nn} +% \InternalDetectionOff % \begin{macrocode} \cs_new_eq:NN \@@_str_compare:nn \__str_if_eq:nn % \end{macrocode} +% \InternalDetectionOn % \end{macro} % % \subsection{Declarations} @@ -2898,9 +2897,11 @@ % together in hook |#1|. % \begin{macrocode} \cs_new_protected:cpn { @@_rule_incompatible-error_gset:nnn } #1#2#3 - { \@@_tl_gset:cn { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } { xE } } + { \@@_tl_gset:cn { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } + { xE } } \cs_new_protected:cpn { @@_rule_incompatible-warning_gset:nnn } #1#2#3 - { \@@_tl_gset:cn { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } { xW } } + { \@@_tl_gset:cn { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } + { xW } } % \end{macrocode} % \end{macro} % @@ -4449,6 +4450,7 @@ % \begin{macro}{\@expl@@@initialize@all@@, % \@expl@@@hook@curr@name@pop@@} % +% \InternalDetectionOff % \begin{macrocode} \cs_new_eq:NN \@expl@@@initialize@all@@ \__hook_initialize_all: @@ -4458,6 +4460,7 @@ \cs_new_eq:NN \@expl@@@hook@curr@name@pop@@ \__hook_curr_name_pop: % \end{macrocode} +% \InternalDetectionOn % \end{macro} % % diff --git a/Master/texmf-dist/source/latex-dev/base/lthyphen.dtx b/Master/texmf-dist/source/latex-dev/base/lthyphen.dtx index f8321719c72..9244db06423 100644 --- a/Master/texmf-dist/source/latex-dev/base/lthyphen.dtx +++ b/Master/texmf-dist/source/latex-dev/base/lthyphen.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -40,7 +40,7 @@ %\iffalse This is a META comment % % File `lthyphen.dtx'. -% Copyright (C) 1994-94 LaTeX3 project, Frank Mittelbach and +% Copyright (C) 1994-94 LaTeX Project, Frank Mittelbach and % Rainer Sch\"opf, all rights reserved. % %\fi diff --git a/Master/texmf-dist/source/latex-dev/base/ltidxglo.dtx b/Master/texmf-dist/source/latex-dev/base/ltidxglo.dtx index f435fea4d04..75a80cd4390 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltidxglo.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltidxglo.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltlength.dtx b/Master/texmf-dist/source/latex-dev/base/ltlength.dtx index 388aac78d7e..1be147547ec 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltlength.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltlength.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltlists.dtx b/Master/texmf-dist/source/latex-dev/base/ltlists.dtx index 087b418847f..fecb3125880 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltlists.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltlists.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltlogos.dtx b/Master/texmf-dist/source/latex-dev/base/ltlogos.dtx index 6fd7b35c928..132eaf636f7 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltlogos.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltlogos.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltluatex.dtx b/Master/texmf-dist/source/latex-dev/base/ltluatex.dtx index 957a71d8488..e3fa9f93437 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltluatex.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltluatex.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 2015-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -28,7 +28,7 @@ \ProvidesFile{ltluatex.dtx} %</driver> %<*tex> -[2020/12/06 v1.1s +[2021/01/15 v1.1s %</tex> %<plain> LuaTeX support for plain TeX (core) %<*tex> @@ -38,6 +38,10 @@ %</tex> %<*driver> \documentclass{ltxdoc} + +\providecommand\InternalDetectionOff{} +\providecommand\InternalDetectionOn{} + \GetFileInfo{ltluatex.dtx} \begin{document} \title{\filename\\(Lua\TeX{}-specific support)} @@ -204,6 +208,7 @@ % The number is returned and also \meta{name} argument is added to the % |lua.name| array at that index. % +% \begin{sloppypar} % \noindent % \DescribeMacro{new_luafunction} % |luatexbase.new_luafunction(|\meta{functionname}|)|\\ @@ -211,6 +216,7 @@ % with |\luafunction|, |\lateluafunction|, and |\luadef|, % indexed from~$1$. The optional \meta{functionname} argument % is just used for logging. +% \end{sloppypar} % % These functions all require access to a named \TeX{} count register % to manage their allocations. The standard names are those defined @@ -1116,6 +1122,7 @@ luatexbase.registernumber = registernumber % \changes{v1.1c}{2017/02/18}{Parameterize count used in tracking} % As attributes are used for Lua manipulations its useful to be able % to assign from this end. +% \InternalDetectionOff % \begin{macrocode} local attributes=setmetatable( {}, @@ -1143,6 +1150,7 @@ local function new_attribute(name) end luatexbase.new_attribute = new_attribute % \end{macrocode} +% \InternalDetectionOn % \end{macro} % % \subsection{Custom whatsit allocation} diff --git a/Master/texmf-dist/source/latex-dev/base/ltmath.dtx b/Master/texmf-dist/source/latex-dev/base/ltmath.dtx index 58ca26b4a5f..ca90e1980d2 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltmath.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltmath.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltmiscen.dtx b/Master/texmf-dist/source/latex-dev/base/ltmiscen.dtx index c7254ad3532..939bd51a2da 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltmiscen.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltmiscen.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltmiscen.dtx} - [2020/12/18 v1.1x LaTeX Kernel (Misc. Environments)] + [2021/02/08 v1.1y LaTeX Kernel (Misc. Environments)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltmiscen.dtx} @@ -868,6 +868,15 @@ %<latexrelease> \expandafter\endgroup\if@endpe\@doendpe\fi %<latexrelease> \if@ignore\@ignorefalse\ignorespaces\fi} %<latexrelease> +% \end{macrocode} +% Also undo the internal commands as some packages unfortunately test +% for their existence instead of using \cs{IfFormatAtLeastTF}. +% \changes{v1.1y}{2021/02/08}{Undo the internals for robust \cs{begin} +% and \cs{end} in rollback (gh/494)} +% \begin{macrocode} +%<latexrelease>\expandafter\let\csname begin \endcsname\@undefined +%<latexrelease>\expandafter\let\csname end \endcsname\@undefined +%<latexrelease> %<latexrelease>\EndIncludeInRelease %<*2ekernel> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx b/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx index 4eea0ad41ec..73146428c0d 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -37,14 +37,14 @@ %<TS1>\ProvidesFile{ts1enc.def}[2001/06/05 v3.0e (jk/car/fm) %<TU>\ProvidesFile{tuenc.def} %<package>\ProvidesPackage{fontenc} -%<OT1|T1|OMS|OML|OT4|TU|package> [2020/08/10 v2.0s +%<OT1|T1|OMS|OML|OT4|TU|package> [2021/02/19 v2.0u %<OT1|T1|OMS|OML|OT4|TS1|TU> Standard LaTeX file] %<package> Standard LaTeX package] % %<*driver> % \fi \ProvidesFile{ltoutenc.dtx} - [2020/12/05 v2.0s LaTeX Kernel (font encodings)] + [2021/02/19 v2.0u LaTeX Kernel (font encodings)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltoutenc.dtx} @@ -1717,6 +1717,17 @@ \DeclareTextSymbol{\textemdash}{OT1}{124} \DeclareTextSymbol{\textendash}{OT1}{123} % \end{macrocode} +% +% The \verb=\nobreak\hskip\z@= is there to prevent a break after +% the hyphen but allow later breaks in the remainder of the word. +% \changes{v2.0u}{2021/02/19}{Add \cs{textnonbreakinghyphen}, \cs{textfiguredash} +% and \cs{texthorizontalbar} (gh/404)} +% \begin{macrocode} +\DeclareTextCommand{\textnonbreakinghyphen}{OT1}{\mbox{-}\nobreak\hskip\z@} +\DeclareTextCommand{\textfiguredash} {OT1}{\textendash} +\DeclareTextCommand{\texthorizontalbar} {OT1}{\textemdash} +% \end{macrocode} +% % Using the ligatures helps with OT1 fonts that have % |\textexclamdown| and |\textquestiondown| in unusual positions. % \changes{v1.95}{2002/06/17}{Definition of \cs{textexclamdown} changed (pr/3368)} @@ -2045,6 +2056,19 @@ \DeclareTextSymbol{\textdollar}{T1}{`\$} \DeclareTextSymbol{\textemdash}{T1}{22} \DeclareTextSymbol{\textendash}{T1}{21} +% \end{macrocode} +% +% The \verb=\nobreak\hskip\z@= is there to prevent a break after +% the hyphen but allow later breaks in the remainder of the word. +% \changes{v2.0u}{2021/02/19}{Add \cs{textnonbreakinghyphen}, \cs{textfiguredash} +% and \cs{texthorizontalbar} (gh/404)} +% \begin{macrocode} +\DeclareTextCommand{\textnonbreakinghyphen}{T1}{\mbox{-}\nobreak\hskip\z@} +\DeclareTextCommand{\textfiguredash} {T1}{\textendash} +\DeclareTextCommand{\texthorizontalbar} {T1}{\textemdash} +% \end{macrocode} +% +% \begin{macrocode} \DeclareTextSymbol{\textexclamdown}{T1}{189} \DeclareTextSymbol{\textgreater}{T1}{`\>} %\DeclareTextSymbol{\texthyphenchar}{T1}{127} @@ -2583,8 +2607,31 @@ \DeclareTextSymbol{\textquotesingle}{TS1}{39} % \end{macrocode} % "28 = 40 -% \begin{macrocode} -\DeclareTextSymbol{\textasteriskcentered}{TS1}{42} +% +% The symbol \cs{textasteriskcentered} ``\textasteriskcentered'' is +% supposed to be always available in \texttt{TS1} and that is +% important as it is used in footnote symbols. However, in a few +% fonts it is missing even though they are otherwise fairly +% complete. We therefore use a rather elaborate method and check if +% the slot has a glyph and if not produce a poor man's version by +% using a normal ``*'' slightly enlarged and somewhat lowered. +% The main application for this symbol is in footnote symbols and +% there it should produce a comparable size and show a similar placement. +% \changes{v2.0t}{2021/02/17}{Special definition for +% \cs{textasteriskcentered} when missing in TS1 (gh/502)} +% \begin{macrocode} +%\DeclareTextSymbol{\textasteriskcentered}{TS1}{42} % that's wanted +\DeclareTextCommand \textasteriskcentered{TS1}{% % and that's needed + \iffontchar\font 42 \char42 \else + \begingroup\fontencoding{T1}% + \fontsize + {\the\dimexpr1.3\dimexpr\f@size pt\relax}% + {\f@baselineskip}% + \selectfont + \raisebox{-0.7ex}[\dimexpr\height-0.7ex][0pt]{*}% + \endgroup + \fi +} % \end{macrocode} % Note that '054 is a comma and '056 is a full stop: these make % numbers using oldstyle digits easier to input. @@ -3106,8 +3153,34 @@ \DeclareTextSymbol{\textbaht} \UnicodeEncodingName{"0E3F} \DeclareTextSymbol{\SS} \UnicodeEncodingName{"1E9E} \DeclareTextSymbol{\textcompwordmark} \UnicodeEncodingName{"200C} +% \end{macrocode} +% +% \changes{v2.0u}{2021/02/19}{Add \cs{textnonbreakinghyphen}, \cs{textfiguredash} +% and \cs{texthorizontalbar} (gh/404)} +% \begin{macrocode} +%\DeclareTextSymbol{\textnonbreakinghyphen} \UnicodeEncodingName{"2011} +%\DeclareTextSymbol{\textfiguredash} \UnicodeEncodingName{"2012} \DeclareTextSymbol{\textendash} \UnicodeEncodingName{"2013} \DeclareTextSymbol{\textemdash} \UnicodeEncodingName{"2014} +%\DeclareTextSymbol{\texthorizontalbar} \UnicodeEncodingName{"2015} +% \end{macrocode} +% Unfortunately some fonts do not implement \texttt{"2011}, \texttt{"2012} and/or +% \texttt{"2015} (including the \LaTeX{} default fonts for Unicode +% engines) so we provide some approximations if the glyph is +% missing, like we do for \texttt{OT1} and \texttt{T1}. +% +% The \verb=\nobreak\hskip\z@= is there to prevent a break after +% the hyphen but allow later breaks in the remainder of the word. +% \begin{macrocode} +\DeclareTextCommand{\textnonbreakinghyphen} \UnicodeEncodingName + {\iffontchar\font "2011 \char "2011 \else \mbox{-}\nobreak\hskip\z@ \fi} +\DeclareTextCommand{\textfiguredash} \UnicodeEncodingName + {\iffontchar\font "2012 \char "2012 \else \char "2013 \fi} +\DeclareTextCommand{\texthorizontalbar} \UnicodeEncodingName + {\iffontchar\font "2015 \char "2015 \else \char "2014 \fi} +% \end{macrocode} +% +% \begin{macrocode} \DeclareTextSymbol{\textbardbl} \UnicodeEncodingName{"2016} \DeclareTextSymbol{\textquoteleft} \UnicodeEncodingName{"2018} \DeclareTextSymbol{\textquoteright} \UnicodeEncodingName{"2019} @@ -3159,15 +3232,17 @@ % \end{macrocode} % % Not all fonts have U+2217 but using U+002A requires some adjustment. +% \changes{v2.0t}{2021/02/17}{Adjust values for +% \cs{textasteriskcentered} To match TS1 definition (gh/502)} % \begin{macrocode} \DeclareTextCommand{\textasteriskcentered}\UnicodeEncodingName{% \iffontchar\font"2217 \char"2217 \else \begingroup \fontsize - {\the\dimexpr1.2\dimexpr\f@size pt\relax}% + {\the\dimexpr1.3\dimexpr\f@size pt\relax}% {\f@baselineskip}% \selectfont - \raisebox{-0.6ex}[\dimexpr\height-0.6ex][0pt]{*}% + \raisebox{-0.7ex}[\dimexpr\height-0.7ex][0pt]{*}% \endgroup \fi } diff --git a/Master/texmf-dist/source/latex-dev/base/ltoutenc.ins b/Master/texmf-dist/source/latex-dev/base/ltoutenc.ins index 23c27697f84..1330b5c44eb 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltoutenc.ins +++ b/Master/texmf-dist/source/latex-dev/base/ltoutenc.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltoutput.dtx b/Master/texmf-dist/source/latex-dev/base/ltoutput.dtx index f418459f661..69bfa1f036b 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltoutput.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltoutput.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -57,7 +57,7 @@ % \iffalse % LATEX VERSION 2e % Copyright (C) 1992 by Leslie Lamport -% Copyright (C) 1994-2000 by Leslie Lamport, LaTeX3 project +% Copyright (C) 1994-2000 by Leslie Lamport, LaTeX Project % % LaTeX 2e kernel file for the output routine. % diff --git a/Master/texmf-dist/source/latex-dev/base/ltpage.dtx b/Master/texmf-dist/source/latex-dev/base/ltpage.dtx index ce6681e7e08..4504033f542 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltpage.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltpage.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltpageno.dtx b/Master/texmf-dist/source/latex-dev/base/ltpageno.dtx index 80055c7c5d9..03d36a53d98 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltpageno.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltpageno.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltpar.dtx b/Master/texmf-dist/source/latex-dev/base/ltpar.dtx index 169954f9ea8..f4f3d5e63fc 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltpar.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltpar.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltpara.dtx b/Master/texmf-dist/source/latex-dev/base/ltpara.dtx new file mode 100644 index 00000000000..1a3df95a6e2 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/base/ltpara.dtx @@ -0,0 +1,1159 @@ +% \iffalse meta-comment +% +%% File: ltpara.dtx (C) Copyright 2020-2021 +% Frank Mittelbach, LaTeX Team +% +% It may be distributed and/or modified under the conditions of the +% LaTeX Project Public License (LPPL), either version 1.3c of this +% license or (at your option) any later version. The latest version +% of this license is in the file +% +% https://www.latex-project.org/lppl.txt +% +% +%%% From File: lthooks.dtx +% +% \begin{macrocode} +\def\ltparaversion{v1.0d} +\def\ltparadate{2021/02/18} +% \end{macrocode} +%<*driver> +\documentclass{l3doc} + +%\usepackage{ltpara} + +% Fixing footnotes in functions and variables: this should be in l3doc! +\newcommand\fixfootnote[2]{\footnotemark + \AddToHookNext{env/#1/after}{\footnotetext{#2}}} +\AddToHook{env/function/begin}{\def\footnote{\fixfootnote{function}}} +\AddToHook{env/variable/begin}{\def\footnote{\fixfootnote{variable}}} + +\EnableCrossrefs +\CodelineIndex +\begin{document} + \DocInput{ltpara.dtx} +\end{document} +%</driver> +% +% \fi +% +% \providecommand\hook[1]{\texttt{#1}} +% \providecommand\env[1]{\texttt{#1}} +% +% +% +% \title{The \texttt{ltpara.dtx} code\thanks{This file has version +% \ltparaversion\ dated \ltparadate, \copyright\ \LaTeX\ +% Project.}} +% \author{Frank Mittelbach} +% +% \maketitle +% +% +% \begin{abstract} +% This code defines four special kernel hooks to support paragraph +% tagging as well as four public hooks which can be occasionally +% useful. +% \end{abstract} +% +% \tableofcontents +% +% +% \section{Introduction} +% +% +% The building of paragraphs in the \TeX{} engine(s) has a number +% of peculiarities that makes it on one hand fairly flexible but on +% the other hand somewhat awkward to control or reliably to extend. +% Thus to better understand the code below we start with a brief introduction +% of the mechanism; for more details refer to the +% \TeX{}book~\cite[chap.~14]{texbook} (for the full truth you may +% even have to study the program code). +% +% \subsection{The default processing done by the engine} +% +% \TeX{} automatically starts building a paragraph when it is +% currently in vertical mode and encounters anything that can only +% live in horizontal mode. Most often this is a character, but +% there are also many commands that can be used only in horizontal mode. +% If any of them is encountered, \TeX{} will immediately back up +% (i.e., the character or command is read later again), adds a +% \cs{parskip} glue to the current vertical list unless the list is +% empty, switches to +% horizontal mode, starts its special \enquote{start of paragraph +% processing} and only then rereads the character or command that +% caused the mode change.\footnote{Already not quite true: the +% command \cs{noindent} starts the paragraph but influences the +% special processing by suppressing the paragraph indentation box +% normally inserted by it.} +% +% This \enquote{start of paragraph +% processing} first adds an empty box at the start of the +% horizontal list of width \cs{parindent} (which represents the +% paragraph indentation) unless the paragraph was started with +% \cs{noindent} in which case no such box is +% added\footnote{That's a bit different from placing a zero-sized +% box!}. It then reads and processes all tokens stored in the +% special engine token register \cs{everypar}. After that it reads +% and processes whatever has caused the paragraph to start. +% +% Thus out of the box, \TeX{} offers the possibility to put some +% special code into \cs{everypar} to gain control at (more or less) +% the start of the paragraph. For example, in LaTeX{} and a number +% of packages, special code like the following is sometimes used: +%\begin{verbatim} +% \everypar{{\setbox\z@\lastbox}\everypar{} ...} +%\end{verbatim} +% This removes the paragraph indentation box again (that was already +% placed by \TeX), then resets \cs{everypar} so that it doesn't do +% anything on the next paragraph start and then does whatever it +% wants to do, e.g., in an \cs{item} of a list it will typeset the label in +% front of the paragraph text. +% However, there is only one such \cs{everypar} token register and +% if different packages and/or the kernel all attempt to add their +% own code here, coordination is very difficult if not impossible. +% +% The process when the paragraph ends has different mechanisms and interfaces. +% A paragraph ends when the engine primitive \cs{par} is called +% while \TeX{} is in unrestricted horizontal mode, i.e., is +% building a paragraph. At other times this primitive does nothing +% or generates as an error depending on the mode \TeX{} is in, +% e.g., the \cs{par} in +% \verb=\hbox{a\par b}= is ignored, but \verb=$a\par b$= would complain. +% +% If this primitive ends the paragraph it does some special +% \enquote{end of horizontal list} processing, then calls \TeX{} paragraph +% builder that breaks the horizontal list into lines then these +% lines are added as boxes to the enclosing vertical list and +% \TeX{} returns to vertical mode. +% +% This \cs{par} command can be given explicitly, but there are also +% situations in which \TeX{} is generating it on the fly. Most +% often this happens when \TeX\ encounters a blank line which is +% automatically changed to a \cs{par} command which is then +% executed. The other possibility is that \TeX{} encounters a +% command which is incompatible with horizontal processing, e.g., +% \cs{vskip} (a request for adding vertical space). In such case it +% silently backs up, and inserts a \cs{par} in the hope that this +% gets it out of horizontal mode and makes the offending command +% acceptable. + +% The important point to note here is that \TeX{} really inserts +% the command \cs{par} which can be redefined. Thus, it may not have +% its original \enquote{primitive} meaning and therefore may not end the +% horizontal list and call the paragraph builder. This approach +% offers some flexibility but also allows you to easily produce a +% \TeX{} document that loops forever, for example, the simple line +%\begin{verbatim} +% A \let\par\relax \vskip +%\end{verbatim} +% will start a horizontal list at \texttt{A}, redefines \cs{par}, +% then sees \cs{vskip} and inserts \cs{par} to end the +% paragraph. But this now only runs \cs{relax} so nothing changes +% and \cs{vskip} is read again, issues a \cs{par} which \ldots. In +% short, it takes a plain \TeX{} document with five tokens to run +% forever (as not even memory is consumed and therefore eventually +% exhausted). +% +% There are no other ways than changing \cs{par} to gain control at +% the end of a paragraph, i.e., there is no token list like +% \cs{everypar} that is inserted, i.e., the only way to change the +% default behavior is to modify the action that \cs{par} executes +% with similar issues as outlined before: different processes need +% to ensure that they do not overwrite their modifications or +% worse, think that the \cs{par} in front of them is the engine +% primitive while in fact it has already been changed by other +% code. +% +% +% To make matters slightly worse there are a few places where +% \TeX{} handles the situation differently (most likely for speed +% reasons back when computers were much slower). If \TeX{} finds +% itself in unrestricted horizontal mode at the end of building a +% vertical box (or an \cs{insert}, \cs{vadjust} or at the end of +% executing the output routine code), it will finish the horizontal +% list not by issuing a \cs{par} command (which would be consistent +% with all other places, but by simply executing the primitive version +% of \cs{par} regardless of the definition that \cs{par} has at the +% time. +% +% Thus, if you have carefully crafted a redefined \cs{par} to execute +% some special actions at the end of a paragraph and you write +% something like +%\begin{verbatim} +% \vbox{Some paragraph ... text.} +%\end{verbatim} +% you will find that your code has never run for the last paragraph +% in that box. \LaTeX{} avoids this problem, by making sure that +% all its boxes (such as \cs{parbox} or the \env{minipage} +% environment, etc.) all internally add an explicit \cs{par} at the +% end so that such code is run and \TeX{} finds itself in vertical +% mode already without the need to start up the paragraph builder +% internally. But, of course, this only works for boxes under direct +% control of the \LaTeX{} kernel, if some package uses low-level +% \cs{vbox}es without adding this precaution the \TeX{} +% optimization kicks in and no special \cs{par} code is executed. +% +% And there is another optimization that is painful: if a paragraph +% is interrupted by a mathematical display, e.g., \verb=\[...\]= in +% \LaTeX{} or \verb=$$...$$= in plain \TeX{}, then \TeX{} will +% resume horizontal mode afterward, i.e., build a new horizontal +% list (without inserting an indentation box or \cs{everypar} at +% that point). However, if that list immediately ends with an +% explicit or implicit \cs{par} then \TeX{} will simply throw away +% this \enquote{null} paragraph and not do its usual \enquote{end +% of horizontal list} processing, so this special case need to be +% accounted for when introducing some extended processing. +% +% +% +% \section{The new mechanism implemented for \LaTeX{}} +% +% To improve the situation (and also to support automatic tagging +% of PDF documents) we now offer public as well as private hooks at +% the start and end of the paragraph processing. The public hooks +% can be used by packages (or by the user in the preamble or +% within the document) and using the hook mechanisms it is possible +% to reorder or arrange code from different packages in a way that +% it can safely coexist. +% +% To make that happen we have to make use of the basic +% functionality that is offered by \TeX{}, e.g., we install +% special code inside \cs{everypar} to provide hooks at the +% beginning and we redefine \cs{par} to do some special processing +% when appropriate to install hooks at the end of the paragraph. +% +% In order to make this work, we have to ensure that package use of +% \cs{everypar} is not overwriting our code. This is done through a +% trick: we basically hide the real \cs{everypar} from the packages +% and offer them a new token register (with the same name). So if +% they install their own code it doesn't overwrite ours. Our code +% then inserts the new \cs{everypar} at the right place inside the +% process so that it looks as if it was the primitive +% \cs{everypar}.\footnote{Ideally, \cs{everypar} wouldn't be used +% at all by packages and instead they would simply write their code +% into the hooks now offered by the kernel. However, while this is +% the longterm goal and clearly an improvement (because then the +% packages do no longer need to worry about getting their code +% overwritten or needing to account for already existing code in +% \cs{everypar}), this will not happen overnight. For that reason +% support for this legacy method is retained.} +% +% At the end of the paragraph it would be great if we could use a +% similar trick. However, due to the fact that \TeX{} inserts the +% token \cs{par} (that doesn't have a defined meaning) we can't hide +% \enquote{the real thing\textsuperscript{TM}} and offer the +% package an indistinguishable alternate. +% +% Fortunately, \LaTeX{} has already redefined \cs{par} for its own +% purposes. As a result there aren't many packages that attempt to +% change \cs{par}, because without a lot of extra care that would +% fail miserably. But bottom line, if you load a package that +% alters \cs{par} then the end of paragraph hooks are most likely +% not executing while that redefinition is +% active.\footnote{Similarly to the \cs{everypar} situation, the +% remedy is that such packages stop doing this and instead add +% their alterations into the paragraph hooks now provided.} +% +% +% +% \subsection{The provided hooks} +% +% +% \begin{variable}{para/before, +% para/begin, +% para/end, +% para/after +% } +% The following four public hooks are defined and executed for +% each paragraph: +% \begin{description} +% +% \item[\hook{para/before}] +% +% This hook is executed after the kernel hook +% \cs{@kernel@before@para@before} (discussed below) in vertical +% mode immediately after \TeX{} has contributed \cs{parskip} to +% the vertical list and before the actual paragraph processing in +% horizontal mode starts. +% +% This hook should either not produce any typeset material or add +% only vertical material. If it starts a paragraph an error is +% generated. The reason is that we are in the starting process of +% processing a paragraph and so this would lead to endless +% recursion.\footnote{One could allow it but only if the newly +% started paragraph is processed without any hooks. Furthermore +% correct spacing would be a bit of a nightmare so for now this +% is forbidden.} +% +% \end{description} +% \end{variable} +% +% \vspace{-\bigskipamount} +% +% \begin{description} +% +% \item[\hook{para/begin}] +% +% This hook is executed after the kernel hook +% \cs{@kernel@before@para@begin} (discussed below) in horizontal +% mode immediately before the indentation box is placed (if there +% is any, i.e., if the paragraph hasn't been started with +% \cs{noindent}). +% +% The indentation box to be typeset is available to the hook as +% \cs{IndentationBox} and its automatic placement (after the hook is +% executed) can be prevented through \cs{SuppressIndentationBox}. +% +% If not suppressed, then the indentation is typeset directly +% after the hook execution by something equivalent to +% \cs{box}\cs{IndentationBox} followed by the current content of +% the token register \cs{everypar} as it is available to the +% kernel or to packages (that run some legacy code). +% +% One has to be careful not to add any code to the hook that +% starts its own paragraph (e.g., by adding a \cs{parbox} or a +% \cs{marginpar} inside) because that would call the hook inside +% again (as a new paragraph is started there) and thus lead to an +% endless recursion ending only after exhausting the available +% memory. This can only be done by making sure that is not +% executed for the inner paragraphs (or at least not recursively +% forever). +% +% +% \item[\hook{para/end}] +% +% This hook is executed at the end of a paragraph when \TeX{} is +% ready to return to vertical mode and after it has removed the +% last horizontal glue (but not kern) placed on the horizontal +% list. The code is still executed in horizontal mode so it is +% possible to add further horizontal material at this point, but +% it should not alter the mode (even a temporary exit from +% horizontal mode would create chaos---any attempt will cause an +% error message)! After the hook has ended the kernel hook +% \cs{@kernel@after@para@end} is executed and then \TeX{} returns to +% vertical mode. +% +% The hook is offered as public hook, but because of the +% requirement to stay within horizontal mode one needs to be +% careful in what is placed into the hook.\footnote{Maybe we +% should guard against that, but it would be rather tricky to +% implement as mode changes can happen across group boundaries so +% one would need to keep a private stack just for that. Well, +% something to ponder.} +% +% This hook is implemented as a reversed hook. +% +% \item[\hook{para/after}] +% +% This hook is executed directly after \TeX{} has returned to +% vertical mode and after any material that migrated out of the +% horizontal list (e.g., from a \cs{vadjust}) has processed. +% +% This hook should either not produce any typeset material or add +% only vertical material. +% However, for this hook starting a new paragraph is not a +% disaster so that it isn't prevented. +% +% This hook is implemented as a reversed hook. +% +% Once that hook code has been processed the kernel hook +% \cs{@kernel@after@para@after} is executed as the final action +% of the paragraph processing. +% +% \end{description} +% +% \begin{variable}{\@kernel@before@para@before, +% \@kernel@after@para@after, +% \@kernel@before@para@begin, +% \@kernel@after@para@end, +% } +% As already mentioned above there are also four kernel hooks that +% are executed at the start and end of the processing. +% \begin{description} +% +% \item[\cs{@kernel@before@para@before}] +% For future extensions, not currently used by the kernel. +% + +% \item[\cs{@kernel@after@para@after}] +% For future extensions, not currently used by the kernel. +% +% +% \item[\cs{@kernel@before@para@begin}] +% +% Used by the kernel to implement tagging. This hook is executed +% at the very beginning of a paragraph after \TeX{} has switched to +% horizontal mode but before any indentation box got added or any +% \cs{everypar} was run. +% +% It should not generate typeset material that could alter the +% position. Note that it should never leave hmode, otherwise you +% will end with a loop! We could guard against this, but since it +% is an internal kernel hook that shouldn't be touched this isn't +% checked. +% \end{description} +% \end{variable} +% +% \vspace{-\bigskipamount} +% +% \begin{description} +% +% \item[\cs{@kernel@after@para@end}] +% +% Used by the kernel to implement tagging. It is executed +% directly after the public \hook{para/end} hook. After it there +% is a quick check that we are still in horizontal mode, i.e., +% that the public hook has not mistakenly ended horizontal mode +% prematurely (this is an incomplete check just testing the mode +% and could perhaps be improved (at the cost of speed)). +% +% \end{description} +% +% +% \subsection{Altered and newly provided commands} +% +% \begin{function}{\par,\endgraf,\para_end:} +% An explicit request for ending a paragraph is known in plain +% \TeX{} under the name \cs{endgraf} where it simply calls the +% paragraph primitive (regardless of what \cs{par} may have as its +% current definition). In \LaTeX{} \cs{endgraf} with that behavior +% was also made available. +% +% With the new paragraph handling in \LaTeX{}, ending a paragraph +% means a bit more than just calling the engine's paragraph +% builder: the process also has to add any hook code for the end of +% a paragraph. Thus +% \cs{endgraf} was changed to provide this additional functionality +% (and so by extension \cs{par} subject to its current meaning). +% +% The \pkg{expl3} name for the functionality is \cs{para_end:}. +% \end{function} +% +% \begin{quote} +% \textbf{Note:} \em The next two commands are still under +% discussion and may slightly change their semantics (as described +% in the document) and/or their names between now and the 2021 +% Spring release! +% \end{quote} +% +% \begin{function}{\SuppressIndentationBox,\para_suppress_indentation:} +% Inside the \hook{para/begin} hook one can use this command to +% suppress the indentation box at the start of the +% paragraph. (Technically it is possible to use this command +% outside the hook as well, but this should not be relied upon.) +% The box itself remains available for use. +% +% The \pkg{expl3} name for the function is \cs{para_suppress_indentation:}. +% \end{function} +% +% \begin{variable}{\IndentationBox,\g_para_indentation_box} +% The box register holding the indentation box for the paragraph is +% available for inspection (or changes) inside hooks. It remains +% available even if the \cs{SuppressIndentationBox} command was +% used; in that case it will just not be automatically placed. +% +% The \pkg{expl3} name for the box register is \cs{g_para_indentation_box}. +% \end{variable} +% +% +% +% +% \subsection{Examples} +% +% None of the examples in this section are meant for real use as +% they are far too simpleminded but they should give some ideas of +% what could be possible if a bit more care is applied. +% +% \subsubsection{Testing the mechanism} +% +% The idea is to output for each paragraph encountered some +% information: a paragraph sequence number, a level number in roman +% numerals, the environment in which this paragraph appears, and +% the line number where the start or end of the paragraph is, e.g., +% something like +%\begin{verbatim} +% PARA: 1-i start (document env. on input line 38) +% PARA: 1-i end (document env. on input line 38) +% PARA: 2-i start (document env. on input line 40) +% PARA: 3-ii start (minipage env. on input line 40) +% PARA: 3-ii end (minipage env. on input line 40) +% PARA: 2-i end (document env. on input line 41) +%\end{verbatim} +% As you can see paragraph 2 starts on line 40 and ends on 41 and +% inside a minipage started paragraph 3 (start and end on line 40). +% If you run this on some document you will find that \LaTeX{} +% considers more things \enquote{a paragraph} than you have +% probably thought. +% +% This was generated by the following hook code: +%\begin{verbatim} +% \newcounter{paracnt} % sequence counter +% \newcounter{paralevel} % level counter +%\end{verbatim} +% +% To support paragraph nesting we need to maintain a stack of the +% sequence numbers. This is most easily done using \pkg{expl3} +% functions, so we switch over. This is not a very general +% implementation, just enough for what we need and a bit of +% \LaTeXe{} thrown in as well. When popping the result gets stored +% in \cs{paracntvalue} and the \cs{ERROR} should never happen +% because it means we have tried to pop from an empty stack. +%\begin{verbatim} +% \ExplSyntaxOn +% \seq_new:N \g_para_seq +% \cs_new:Npn \ParaPush +% {\seq_gpush:No \g_para_seq {\the\value{paracnt}}} +% \cs_new:Npn \ParaPop {\seq_gpop:NNF \g_para_seq \paracntvalue \ERROR } +% \ExplSyntaxOff +%\end{verbatim} +% At the start of the paragraph increment both sequence counter and +% level and also save the then current sequence number on our stack. +%\begin{verbatim} +% \AddToHook{para/begin}{% +% \stepcounter{paracnt}\stepcounter{paralevel}% +% \ParaPush +%\end{verbatim} +% To display the sequence number we \cs{typeout} the current +% sequence and level number. The command \cs{@currenvir} gives us +% the current environment and \cs{on@line} produces a space and +% the current input line number. +%\begin{verbatim} +% \typeout{PARA: \arabic{paracnt}-\roman{paralevel} start +% (\@currenvir\space env.\on@line)}% +%\end{verbatim} +% We also typeset the sequence number as a tiny red number in a box +% that takes up no horizontal space. This helps us seeing where +% \LaTeX{} sees the start and end of the paragraphs in the +% document. +%\begin{verbatim} +% \llap{\color{red}\tiny\arabic{paracnt}\ }% +% } +%\end{verbatim} +% +% At the end of the paragraph we display sequence number and +% level again. The level counter has the correct value but we need +% to retrieve the right sequence value by popping it off the stack +% after which it is available in \cs{paracntvalue} the way we have +% set this up above. +%\begin{verbatim} +% \AddToHook{para/end}{% +% \ParaPop +% \typeout{PARA: \paracntvalue-\roman{paralevel} end \space\space +% (\@currenvir\space env.\on@line)}% +%\end{verbatim} +% We also typeset again a tiny red number with that value, this +% time sticking out to the right.\footnote{Note that this can alter +% the document pagination, because a paragraph ending in a display +% (e.g., an equation) will get an extra line---in that case our tiny number +% has an effect even though it doesn't take up any space, because +% it paragraph is no longer empty and thus isn't dropped!} +% We also decrement the level counter since our level has finished. +%\begin{verbatim} +% \rlap{\color{red}\tiny\ \paracntvalue}% +% \addtocounter{paralevel}{-1}% +% } +% \makeatother +%\end{verbatim} +% +% +% +% \subsubsection{Mark the first paragraph of each \env{itemize}} +% +% The code for this is rather simple. We apply hook code that is +% executed only once inside a hook that is executed at the begin of +% each \env{itemize}. We explicitly change the color back and +% forth so that we don't introduce grouping around the paragraph. +%\begin{verbatim} +% \AddToHook{env/itemize/begin}{% +% \AddToHookNext{para/begin}{\color{blue}}% +% \AddToHookNext{para/end}{\color{black}}% +% } +%\end{verbatim} +% As a result the first paragraph of each \env{itemize} will appear +% in blue. +% +% +% \StopEventually{\setlength\IndexMin{200pt} \PrintIndex } +% +% +% \section{The Implementation} +% +% \begin{macrocode} +%<*2ekernel> +% \end{macrocode} +% +% \begin{macrocode} +%<@@=para> +\ExplSyntaxOn +% \end{macrocode} + + +% +% +% \subsection{Providing hooks for paragraphs} +% +% +% \begin{macro}{para/before,para/after,para/begin,para/end} +% The public hooks. They are implemented as a paired set of hooks. +% \begin{macrocode} +\hook_new_pair:nn{para/before}{para/after} +\hook_new_pair:nn{para/begin}{para/end} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@kernel@before@para@before, +% \@kernel@after@para@after, +% \@kernel@before@para@begin, +% \@kernel@after@para@end} +% The corresponding kernel hooks (for tagging and future extensions). +% \begin{macrocode} +\let \@kernel@before@para@before \@empty +\let \@kernel@before@para@begin \@empty +\let \@kernel@after@para@end \@empty +\let \@kernel@after@para@after \@empty +% \end{macrocode} +% \end{macro} +% +% +% +% +% +% \begin{macro}{\g_@@_standard_everypar_tl} +% Whenever \TeX{} starts a paragraph it inserts first an +% indentation box and then executes the tokens stored in +% \cs{tex_everypar:D} (known to \LaTeX{} as \cs{everypar}). We +% alter this behavior slightly here, so that hooks are added +% into the right place. Otherwise the process change remains +% transparent to any legacy code for this space. +% +% We keep the standard code to be used by \cs{tex_everypar:D} in a +% separate token list because we have to switch back and forth +% for error recovery and so altering \cs{tex_everypar:D} all the +% time should be a tiny bit faster. +% \begin{macrocode} +\tl_new:N \g_@@_standard_everypar_tl +% \end{macrocode} +% Here is now its definition: +% \begin{macrocode} +\tl_gset:Nn \g_@@_standard_everypar_tl { +% \end{macrocode} +% First we remove the indentation box and store it in +% \cs{g_para_indentation_box}. If there was none because the paragraph +% was started by \cs{noindent} the box register will be void. +% \begin{macrocode} + \box_gset_to_last:N \g_para_indentation_box +% \end{macrocode} +% +% This will make the newly started horizontal list empty, so if we +% stop it now and return to vertical mode it will be dropped by +% \TeX{}. We do that but inside a group so that any \cs{parshape} +% settings will not get lost as we need them for later. +% \begin{macrocode} + \group_begin: + \tex_par:D + \group_end: +% \end{macrocode} +% We then change \cs{tex_everypar:D} to generate an error so that +% we can detect and report if the \hook{para/before} hook illegally +% changed out of vmode. +% \begin{macrocode} + \tex_everypar:D { \__kernel_msg_error:nnnn {para}{mode}{before}{vertical} } + \@kernel@before@para@before + \hook_use:n {para/before} +% \end{macrocode} +% Assuming the hooks have been well behaved it is time to return to +% horizontal mode and start the paragraph in earnest. We already +% have the indentation box saved away so we now have to restart the +% paragraph with an empty \cs{tex_everypar:D} and with +% \cs{tex_noindent:D}. And we need to make sure not to get another +% \cs{parskip} or rather (since we can't prevent that) that it is +% of zero size. +% \begin{macrocode} + \group_begin: + \tex_everypar:D {} + \skip_zero:N \tex_parskip:D + \tex_noindent:D + \group_end: +% \end{macrocode} +% That brings us back to the start of the horizontal list but we +% need to change \cs{tex_everypar:D} back to its normal content in +% case there are nested paragraphs coming up. +% \begin{macrocode} + \tex_everypar:D{\g_@@_standard_everypar_tl} +% \showthe\tex_everypar:D +% \end{macrocode} +% Then we set up \cs{@@_handle_indent:} to reinsert the indentation +% box later. This can be undone via \cs{SuppressIndentationBox} +% inside the hook(s). +% \begin{macrocode} + \cs_set_eq:NN \@@_handle_indent: \@@_add_indentation_box: +% \end{macrocode} +% +% This is followed by executing the kernel and the public hook. The +% kernel hook is there to enable tagging. +% \begin{macrocode} + \@kernel@before@para@begin + \hook_use:n {para/begin} +% \end{macrocode} +% If we aren't in horizontal mode any longer the hooks above misbehaved. +% \begin{macrocode} + \if_mode_horizontal: \else: + \__kernel_msg_error:nnnn {para}{mode}{begin}{vertical} \fi: +% \end{macrocode} +% Finally we reinsert the indentation box (unless suppressed) and +% then call \cs{everypar} the way legacy \LaTeX\ code expects it. +% +% However, adding the public \cs{everypar} is a bit tricky (see below) so +% we add that later, and indirectly. +% \begin{macrocode} + \@@_handle_indent: +% \the \everypar % <--- done differently +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\tex_everypar:D} +% \cs{tex_everypar:D} then only has to execute +% \cs{g_@@_standard_everypar_tl} by default. +% \begin{macrocode} +\tex_everypar:D{\g_@@_standard_everypar_tl} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}[int]{\everypar} +% +% Tokens inserted at the beginning of the paragraph are placed into +% \cs{everypar} inside legacy \LaTeX{} code, e.g., by the list +% environments or by headings to handle \cs{clubpenalty}, etc. Now +% this isn't any longer the primitive but simply a toks register +% used in the code above but to legacy \LaTeX{} code that is +% transparent. +% +% There is, however, a problem: a handful packages use exactly the +% same trick and replace the primitive with a token register and +% call the token register inside the renamed primitive. That is +% they assume that \cs{everypar} is the primitive and that it will +% still be called at the start of the paragraph even if renamed. +% +% But if we have already replaced it by a token register then all +% they do is to give that token register a new name. Thus our code +% in \cs{tex_everypar:D} would call \cs{everypar} (which is their +% now token register) and the code that they added ends up in our +% token register which is then never used at all. A bit mind +% boggling I guess. +% +% So what we have to do is not to call the token register +% \cs{everypar} by its name inside \cs{tex_everypar:D} but by using +% its actual register number. +% \begin{macrocode} +\newtoks \everypar +% \end{macrocode} +% +% After we have allocated a new toks register with the name +% \cs{everypar} the actual register number is available (briefly) +% inside \cs{allocationnumber}. So instead of \cs{the}\cs{everypar} +% we have to put \cs{the}\cs{toks}\meta{allocated number} at the end of +% \cs{tex_everypar:D}. +% +% So what remains doing is to append a few tokens to the token list +% \cs{g_@@_standard_everypar_tl} which we do now. We use \texttt{x} +% expansion here to get the value of \cs{allocationnumber} in, all +% the other tokens should not be expanded at this point. + +% One important point here is to terminate the register allocation +% number with a real space. This space will get swallowed up when +% the number is read. Anything else, such as \cs{scan_stop:} would +% remain in the input and that would mean that it would interfere +% with \cs{everypar} code that attempts to scan ahead to see how +% the paragraph text starts. +% \begin{macrocode} +\tl_gput_right:Nx \g_@@_standard_everypar_tl { + \exp_not:N \the + \exp_not:N \toks + \the \allocationnumber + \c_space_tl +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\g_para_indentation_box} +% For managing the indentation we need to provide a public +% accessible box register +% \begin{macrocode} +\box_new:N \g_para_indentation_box +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\@@_handle_indent:,\@@_add_indentation_box:} +% Adding (typesetting) the indent box is straight forward, the +% default action for is \cs{@@_handle_indent:} is +% \cs{@@_add_indentation_box:}. +% \begin{macrocode} +\cs_new:Npn \@@_add_indentation_box: { + \box_use_drop:N \g_para_indentation_box +} +\cs_new_eq:NN \@@_handle_indent: \@@_add_indentation_box: +% \end{macrocode} +% The declaration \cs{para_suppress_indentation:} (or +% \cs{SuppressIndentationBox}) changes that to do nothing. +% \begin{macrocode} +\cs_new:Npn \para_suppress_indentation: { + \cs_set_eq:NN \@@_handle_indent: \prg_do_nothing: +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\IndentationBox,\SuppressIndentationBox} +% The \LaTeXe{} names for the indentation box and for suppressing it +% for use in the \hook{para/begin} hook. +% \begin{macrocode} +\cs_set_eq:NN \IndentationBox \g_para_indentation_box +\cs_set_eq:NN \SuppressIndentationBox \para_suppress_indentation: +% \end{macrocode} +% \end{macro} +% +% +% +% +% +% +% \begin{macro}{\para_end:} +% Adding hooks to the end of a paragraph is similar but here we +% need to alter the command that is used by \TeX{} to end horizontal +% mode and return to vertical mode, i.e., \cs{par}. +% +% This is a bit more complicated as this command can appear anywhere +% either explicitly or implicitly added by \TeX{} in certain +% situations: +% \begin{itemize} +% \item +% when using \cs{par} in the code or the document +% \item +% when using a blank line (which is converted to \cs{par}) +% \item +% when \TeX{} finds any commands incompatible with horizontal +% mode it issues a \cs{par} and then rereads the command. +% \end{itemize} +% +% Unfortunately, \TeX{} has some (these days) unnecessary +% optimization: if a \cs{vbox} ends and \TeX{} is still in +% horizontal mode it simply exercises the paragraph builder instead +% of issuing a \cs{par}. It is therefore necessary for \LaTeX{} to +% ensure that this case doesn't happen and all boxes internally +% have a \cs{par} command at their end. +% +% This \cs{par} may or may not run the ``par primitive'' (which is +% always available as \cs{tex_par:D} in \pkg{expl3}); it is +% permissible to have a changed meaning and it is in fact changed +% by \LaTeX{} in various ways at various points inside +% \texttt{latex.ltx}. For this \LaTeXe{} code has the following +% conventions: \cs{@@@@par} and \cs{endgraf} both refer to the +% default meaning (in the past this was the initex primitive) while +% \cs{par} is the current meaning which may does something else. +% +% +% We are now going to change this default meaning to run +% \cs{para_end:} instead, which ultimately executes the initex +% primitive but additionally adds our hooks when appropriate. +% This way the change is again transparent to the legacy \LaTeXe{} +% code. +% +% In most cases \cs{para_end:} should behave exactly like the +% primitive and we achieve this by simply expanding it to the +% primitive which is available to us as \cs{tex_par:D}. This way we +% don't have to care about whether \TeX{} just does nothing (e.g., +% if in vertical mode already) or generate an error, etc. +% \begin{macrocode} +\cs_new_protected:Npn \para_end: { +% \end{macrocode} +% +% The only case we care about is when we are in horizontal mode +% (i.e., doing typesetting) and not also in inner mode (i.e., +% making paragraphs and not building an \cs{hbox}. +% \begin{macrocode} +% \bool_lazy_and:nnT +% { \mode_if_horizontal_p: } +% { \bool_not_p:n { \mode_if_inner_p: } } +% { ... +% \end{macrocode} +% Since this is executed for each and every paragraph in a document +% we try to stay a fast as possible, So we are aren't using the +% above construct but two conditionals instead. Using low-level +% \cs{if_mode...} conditions would be even faster but has the +% danger to conflict with conditionals in the user hooks. +% \begin{macrocode} + \mode_if_horizontal:TF { + \mode_if_inner:F { +% \end{macrocode} +% In that case the action of the primitive would be to remove the +% last glue (not kern) from the horizontal list constructed to form +% a paragraph then append the a penalty of 10000 and the +% \cs{parfillskip} at the end and pass the whole list to the +% paragraph builder which breaks it into lines and \TeX{} then +% returns to vertical mode. +% +% What we want to do instead is to add our hook code at the end of +% the horizontal list before that happens and the code is passed to +% the paragraph builder. If there was a glue item at the end then +% it should get removed before the hook code gets added so we have +% to arrange for its removal ourselves. +% +% There is not much point in checking if there was really a glue +% item at the end of the horizontal list, instead we simply try to +% remove one using \cs{tex_unskip:D}, if there wasn't one this will +% do nothing. +% \begin{macrocode} + \tex_unskip:D +% \end{macrocode} +% The we execute the public hook (which may add final typesetting +% material) followed by the kernel hook we need for adding tagging +% support. None of this is supposed to change the mode---at the +% moment we make only a very simple test for this, more devious +% changes go unnoticed, but too bad, that will then probably +% badly backfire. +% \begin{macrocode} + \hook_use:n{para/end} + \@kernel@after@para@end + \mode_if_horizontal:TF { +% \end{macrocode} +% The final action (before getting to the point where +% \cs{tex_par:D} is called) is to add a kern item so that the +% primitive is prevented from removing glue (if there was some). If +% we don't do this and the +% horizontal list ended in several glue items we would end up with +% removing two instead of just the last one, which would be wrong. +% We use a kern as that is minimally faster. +% +% There is however one other \TeX{} optimization that hurts: in a +% sequence like this \verb=$$ ... $$ \par= \TeX{} will be in +% horizontal mode after the display, ready to receive further +% paragraph text, but since the \cs{par} follows immediately there +% is a ``null'' paragraph at the end and \TeX{} simply throws that +% away. The space between \verb=$$= and \cs{par} got already +% dropped during the display processing so the \cs{par} is not +% removing any space and appending \cs{parfillskip}, instead it +% simply goes silently to vmode. Now if we would had added something (to +% prevent glue removal) that would look to \TeX{} like material +% after the display and so we would end up with an empty paragraph +% just containing \cs{parfillskip}. +% +% We therefore check if the current hlist is empty +% (\cs{tex_lastnodetype:D} has the value \texttt{-1} and +% only if not we add our kern. +% \begin{macrocode} + \if_int_compare:w 0 < \tex_lastnodetype:D + \tex_kern:D \c_zero_dim + \fi: +% \end{macrocode} +% To run the \hook{para/after} hook we first end the +% paragraph. This means that the \cs{tex_par:D} at the very end is +% unnecessary but executing it there unnecessarily is better than +% having code that test for all the different mode possibilities. +% \begin{macrocode} + \tex_par:D + \hook_use:n{para/after} + \@kernel@after@para@after + } +% \end{macrocode} +% If we haven't been in horizontal mode then the earlier hook +% \hook{para/end} is at fault and we report that. +% \begin{macrocode} + { \__kernel_msg_error:nnnn {para}{mode}{end}{horizontal} } +% \end{macrocode} +% Finally close out the nested conditionals. +% \begin{macrocode} + } + } +% \end{macrocode} +% +% \begin{macrocode} + \tex_par:D +} +% \end{macrocode} +% \end{macro} +% +% This ends the \texttt{para} module code. +% \begin{macrocode} +%<@@=> +% \end{macrocode} +% +% \begin{macro}{\par,\endgraf} +% \begin{macro}[int]{\@@par} +% +% Having the new default definition for \cs{par} we also have to +% set it up so that it gets used. This is needed in three places +% \cs{par}, \cs{@@par} (to which \LaTeX{} resets \cs{par} +% occasionally) and \cs{endgraf} which is another name for the +% ``default'' action of \cs{par}. +% \begin{macrocode} +\cs_set_eq:NN \par \para_end: +\cs_set_eq:NN \@@par \para_end: +\cs_set_eq:NN \endgraf \para_end: +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% While this is not integrated properly into the format we have to +% redo the \cs{everypar} setting from the kernel, otherwise that +% gets lost (as it happens before that file is loaded). +% \begin{macrocode} +\everypar{\@nodocument} %% To get an error if text appears before the +% \end{macrocode} +% +% +% \subsection{The error messages} +% +% Well, one really, first argument is the hook name second the mode +% it should have stayed in but didn't. +% \begin{macrocode} +\__kernel_msg_new:nnnn {para} {mode} + { + Illegal~mode~ change~ in~ hook~ 'para/#1'.\\ + Hook~ code~ did~ not~ remain~ in~ #2~ mode. + } + { + Paragraph~ hooks~ cannot~ change~ the~ TeX~ mode~ without~ causing~ + endless~ recursion.~ The~ hook~ code~ in~ 'para/#1'~ needs~ to~ stay~ + in~ #2~ mode,~ but~ it~ didn't.~ Examine~ the~ hook~ + code~ with~ \ShowHook~ to~ find~ the~ issue. + } +% \end{macrocode} +% +% \begin{macrocode} +\ExplSyntaxOff +% \end{macrocode} +% +% \subsection{Kernel corrections} +% +% These corrections/changes are already part of the 2021/05 +% release, i.e., but for testing with older releases they have been +% included here for now. So this section will vanish soon. +% +% +% Marginpar boxes are missing a final internal \cs{par}. +% \begin{macrocode} +\IfFormatAtLeastTF{2021/05/01}{} +{ +\long\def \@savemarbox #1#2{% + \global\setbox #1% + \color@vbox + \vtop{% + \hsize\marginparwidth + \@parboxrestore + \@marginparreset + #2\par % <-- needed + \@minipagefalse + \outer@nobreak + }% + \color@endbox +} +% \end{macrocode} +% +% Two sample definitions for the kernel hooks to help a bit with +% tracing. +% \begin{macrocode} +\newcounter{paracnt} +\def\@kernel@before@para@begin{% + \stepcounter{paracnt}% + \typeout{PARA: \arabic{paracnt} start + (\@currenvir\space level\on@line)}% +} +\def\@kernel@after@para@end {% + \typeout{PARA: \arabic{paracnt} end \space\space + (\@currenvir\space level\on@line)}% + \addtocounter{paracnt}{-1}% +} +% \end{macrocode} +% +% +% The next lines belong in the kernel and just make sure that we +% avoid the these days unnecessary optimization that \TeX{} doesn't +% call on \cs{par} if a vertical box ends in hmode. Instead \TeX{} +% directly calls the par builder in that case :-(. +% \begin{macrocode} +\let\color@begingroup\begingroup +\def\color@endgroup{\endgraf\endgroup} +\def\color@setgroup{\color@begingroup} % \def\color@setgroup{\color@begingroup\set@color} +\def\color@hbox{\hbox\bgroup\color@begingroup} +\def\color@vbox{\vbox\bgroup\color@begingroup} +\def\color@endbox{\color@endgroup\egroup} +} +% \end{macrocode} +% +% +% +% \begin{macrocode} +%<*2ekernel> +% \end{macrocode} +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% + +%%%% unused as hok was dropped + +% \subsubsection{Put the first word of each paragraph in an \cs{fbox} and append +% a \P{} sign at the end of the paragraph} +% +% We make the assumption that the first word ends in a space so +% that we can grab it easily (which +% is of course not quite right). So here is the code for that. +%\begin{verbatim} +% \def\firstwordboxed#1 {\fbox{#1} } +%\end{verbatim} +% Installing that is then just a matter of putting it into the right +% hook. Since we don't want to box the indentation (or what comes +% from \cs{everypar} we shouldn't use \hook{para/begin} but +% \hook{para/textbegin}. +% Adding the \P{} is equally simple. +%\begin{verbatim} +% \AddToHook{para/textbegin}{\firstwordboxed} +% \AddToHook{para/end}{\P} +%\end{verbatim} +% While this will work more or less flawless (if you accept that it +% will pick up any punctuation after the first word), it will fail +% in at least two cases. +% \begin{itemize} +% \item Single word paragraphs ending with \cs{par} instead of an +% empty line will blow up because the \cs{par} will be picked up as +% part of the argument and error as our \cs{firstwordboxed} doesn't +% accept a \cs{par} not being long. That is actually good, because +% picking it up would be worse: it would get ignored inside +% \cs{fbox} and so the paragraph would be combined with the next +% (or worse). +% +% \item The second problem is, of course, that sticking it into +% every \hook{para/textbegin} means it get applied to places like +% \cs{section} which is not really what you want. So some more +% elaborate mechanism would be necessary---a task for another rainy +% day. +% \end{itemize} +% +% There is one other point to note here. The \cs{firstwordboxed} is +% expected to scan ahead. So can that kind of code be placed into a +% hook? The answer is a kind of yes and no. + +% Hooks can receive code from different places, but obviously only +% one chunk of code can do some scanning ahead, the one that comes +% last. Any hook code in a different position would see any +% following code from later chunks as part of the scanning which +% may or may not be a problem. In fact, even in our simple example, +% the argument picked up by \cs{firstwordboxed} isn't really the +% first word of the paragraph. It is that but in front of it there +% is also the code responsible for running +% \verb=\AddTohookNext{para/textbegin}=. As long as this is not +% doing anything harmful it doesn't hurt in this case, but it +% clearly shows that this example is not as simple as it +% claims to be and on the whole we have to conclude that hooks +% aren't really meant to do such scanning or at least not without a +% lot of precaution. +% diff --git a/Master/texmf-dist/source/latex-dev/base/ltpictur.dtx b/Master/texmf-dist/source/latex-dev/base/ltpictur.dtx index 10773f376cf..b958d43760c 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltpictur.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltpictur.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltplain.dtx b/Master/texmf-dist/source/latex-dev/base/ltplain.dtx index 0b03fd1364d..fa53cc17ece 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltplain.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltplain.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltsect.dtx b/Master/texmf-dist/source/latex-dev/base/ltsect.dtx index 70106e2e583..29ea142ba6c 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltsect.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltsect.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx b/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx index 2ea0a1b6651..565f35f529c 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx @@ -1,6 +1,7 @@ % \iffalse meta-comment %% -%% File: ltshipout.dtx (C) Copyright 2020,2021 Frank Mittelbach, LaTeX Team +%% Copyright (C) 2020-2021 +%% Frank Mittelbach, LaTeX Team %% % % This file is part of the LaTeX base system. @@ -31,8 +32,8 @@ %%% From File: ltshipout.dtx % % \begin{macrocode} -\providecommand\ltshipoutversion{v1.0d} -\providecommand\ltshipoutdate{2020/12/06} +\providecommand\ltshipoutversion{v1.0i} +\providecommand\ltshipoutdate{2021/01/25} % \end{macrocode} % %<*driver> @@ -55,6 +56,9 @@ } \ExplSyntaxOff +\providecommand\InternalDetectionOff{} +\providecommand\InternalDetectionOn{} + \EnableCrossrefs \CodelineIndex \begin{document} @@ -108,11 +112,50 @@ % It then stores it in a named box register. This box can then be % manipulated through a set of hooks after which it is shipped out % for real. +% +% Each shipout that actually happens (i.e., where the material is +% not discarded for one or the other reason) is recorded and the +% total number is available in a readonly variable and in a +% \LaTeX{} counter. +% \end{function} +% +% +% \begin{function}{\RawShipout} +% This command implements a simplified shipout that bypasses the +% foreground and background +% hooks, e.g., only \hook{shipout/firstpage} and +% \hook{shipout/lastpage} are executed and the total shipout +% counters are incremented. +% +% The command doesn't use \cs{ShipoutBox} but its own private box +% register so that it can be used inside of shipout hooks to do +% some additional shipouts while already in the output routine with +% the current page being stored in \cs{ShipoutBox}. It does have +% access to \cs{ShipoutBox} if it is used in \hook{shipout/before} +% (or \hook{shipout/after}) and can use its content. +% +% It is safe to use it in \hook{shipout/before} or +% \hook{shipout/after} but not necessarily in the other +% \hook{shipout/...} hooks as they are intended for special +% processing. % \end{function} % % \begin{variable}{\ShipoutBox,\l_shipout_box} -% This box register is called \cs{ShipoutBox} (alternatively available via the -% L3 name \cs{l_shipout_box}). +% This box register is called \cs{ShipoutBox} (alternatively +% available via the L3 name \cs{l_shipout_box}). +% +% During the execution of \hook{shipout/before} this box contains +% the accumulated material for the page, but not yet any material +% added by other shipout hooks. +% During execution of \hook{shipout/after}, i.e., after the shipout +% has happened, the box also contains any background or foreground +% material. +% +% Material from the hooks \hook{shipout/firstpage} or +% \hook{shipout/lastpage} is not included (but only used during the +% actual shipout) to facilitate reuse of the box data (e.g., +% \hook{shipout/firstpage} material should never be added to a +% later page of the output). % \end{variable} % % @@ -133,11 +176,11 @@ % % \subsection{Provided hooks} % -% \begin{variable}{shipout/before, +% \begin{variable}{shipout/before,shipout/after, % shipout/foreground,shipout/background, % shipout/firstpage, % shipout/lastpage} -% The code offers a number of hooks into which packages (or the +% The code for \cs{shipout} offers a number of hooks into which packages (or the % user) can add code to support different use cases. % These are: % \begin{description} @@ -148,6 +191,20 @@ % It can be used to alter that box content or to discard it % completely (see \cs{DiscardShipoutBox} below). % +% You can use \cs{RawShipout} inside this hook for special use +% cases. It can make use of \cs{ShipoutBox} (which doesn't yet +% include the background and foreground material). +% +% \textbf{Note:} It is not possible (or say advisable) to try +% and use this hook to typeset material with the intention to +% return it to main vertical list, it will go wrong and give +% unexpected results in many cases---for starters it will appear +% after the current page not before or it will vanish or the +% vertical spacing will be wrong! +% \end{description} +% \end{variable} +% +% \begin{description} % \item[\hook{shipout/background}] % % This hook adds a picture environment into the background of @@ -186,9 +243,14 @@ % not discarded at the last minute). It should only contain % \cs{special} or similar commands needed to direct post processors % handling the \texttt{.dvi} or \texttt{.pdf} output.\footnotemark +% \footnotetext{In +% \LaTeXe{} that was already existing, but implemented using a box +% register with the name \cs{@begindvibox}.} % % ^^A \fmi{not sure it has to be that restrictive.} % +% This hook is added to the very first page regardless of how it +% is shipped out (i.e., with \cs{shipout} or \cs{RawShipout}). % % \item[\hook{shipout/lastpage}] % @@ -196,6 +258,7 @@ % the output file. It is only executed on the very last page of % the output file --- % or rather on the page that \LaTeX{} believes is the last one. +% Again it is executed regardless of the shipout method. % % It may not be possible for \LaTeX{} to correctly determine % which page is the last one without several reruns. If this @@ -203,17 +266,32 @@ % extra page to place the material and also request a rerun to % get the correct placement sorted out. % +% \item[\hook{shipout/after}] +% +% This hook is executed after a shipout has happened. If the +% shipout box is discarded this hook is not looked at. +% +% You can use \cs{RawShipout} inside this hook for special use +% cases and the main \cs{ShipoutBox} is still available at this +% point (but in contrast to \hook{shipout/before} it now +% includes the background and foreground material). +% +% \textbf{Note:} Just like \hook{shipout/before} this hook is +% not meant to be used for adding adding typeset material back +% to the main vertical list---it might vanish or the +% vertical spacing will be wrong! +% +% % \end{description} -% \end{variable}\footnotetext{In -% \LaTeXe{} that was already existing, but implemented using a box -% register with the name \cs{@begindvibox}.} % % As mentioned above the hook \hook{shipout/before} is executed % first and can manipulate the prepared shipout box stored in % \cs{ShipoutBox} or set things up for use in \cs{write} during the -% actual shipout. The other hooks are added inside hboxes to the -% box being shipped out in the following -% order: +% actual shipout. It is even run if there was a +% \cs{DiscardShipoutBox} request in the document. +% +% The other hooks (except \hook{shipout/after}) are added inside +% hboxes to the box being shipped out in the following order: % \begin{center} % \begin{tabular}{ll} % \hook{shipout/firstpage} & only on the first page \\ @@ -226,14 +304,22 @@ % If any of the hooks has no code then that particular no box is % added at that point. % +% Once the (page) box has been shipped out the \hook{shipout/after} +% hook is called (while you are still inside the output routine). It +% is not called if the shipout box was discarded. +% % In a document that doesn't produce pages, e.g., only makes -% \cs{typeout}s, none of the hooks are executed (as there is no +% \cs{typeout}s, none of the hooks are ever executed (as there is no % \cs{shipout}) not even the \hook{shipout/lastpage} hook. % +% If \cs{RawShipout} is used instead of \cs{shipout} then only the +% hooks \hook{shipout/firstpage} and \hook{shipout/lastpage} are +% executed (on the first or last page), all others are bypassed. % -% \subsection{Legacy \LaTeX{} commands} % % +% \subsection{Legacy \LaTeX{} commands} +% % \begin{function}{\AtBeginDvi,\AtEndDvi} % \cs{AtBeginDvi} is the existing \LaTeXe{} interface to fill the % \hook{shipout/firstpage} hook. This is not really a good name @@ -256,12 +342,12 @@ % % \subsection{Special commands for use inside the hooks} % -% \begin{function}{\DiscardShipoutBox,\shipout_discard_box:} +% \begin{function}{\DiscardShipoutBox,\shipout_discard:} % \begin{syntax} % \cs{AddToHookNext} \texttt{\{shipout/before\} \{...\cs{DiscardShipoutBox}...\}} % \end{syntax} % The \cs{DiscardShipoutBox} declaration (L3 name -% \cs{shipout_discard_box:}) +% \cs{shipout_discard:}) % requests that on the next % shipout the page box is thrown away instead of being shipped to % the \texttt{.dvi} or \texttt{.pdf} file. @@ -272,6 +358,8 @@ % Note that if this declaration is used directly in the document it % may depend on the placement to which page it applies, given that % \LaTeX{} output routine is called in an asynchronous manner! +% Thus normally one would use this only as part of the +% \hook{shipout/before} code. % % \fmi{Once we have a new mark mechanism available we can improve % on that and make sure that the declaration applies to the page @@ -290,12 +378,28 @@ % names as given below. % % +% +% \subsection{Provided Lua\TeX\ callbacks} +% +% \begin{variable}{pre_shipout_filter} +% Under Lua\TeX{} the \texttt{pre\_shipout\_filter} Lua callback is +% provided which gets called immediately before the shipout primitive gets invoked. +% The signature is +% \begin{verbatim} +% function(<node> head) +% return true +% end +% \end{verbatim} +% The \texttt{head} is the list node corresponding to the box to be shipped out. +% The return value should always be \texttt{true}. +% \end{variable} +% % \subsection{Information counters} % % % \begin{variable}{\ReadonlyShipoutCounter,\g_shipout_readonly_int} % \begin{syntax} -% \cs{ifnum}\cs{ReadOnlyShipoutCounter}\texttt{=...} +% \cs{ifnum}\cs{ReadonlyShipoutCounter}\texttt{=...} % \cs{int_use:N} \cs{g_shipout_readonly_int} \texttt{\% expl3 usage} % \end{syntax} % This integer holds the number of pages shipped out up to now @@ -303,6 +407,7 @@ % routine). More precisely, it is incremented only after it is % clear that a page will be shipped out, i.e., after the % \hook{shipout/before} hook (because that might discard the page)! +% In contrast \hook{shipout/after} sees the incremented value. % % Just like with the \texttt{page} counter its value is % only accurate within the output routine. In the body of the @@ -310,10 +415,11 @@ % asynchronously! % % Also important: it \emph{must not} be set, only read. There are -% no provisions to prevent that but if you do, chaos will be the -% result. To emphasize this fact it is not provided as a \LaTeX{} -% counter but as a \TeX{} counter (i.e., a command), so -% \cs{Alph}\Arg{\cs{ReadonlyShipoutCounter}} etc, would not work. +% no provisions to prevent that restriction, but if you manipulate +% it, chaos will be the result. To emphasize this fact it is not +% provided as a \LaTeX{} counter but as a \TeX{} counter (i.e., a +% command), so \cs{Alph}\verb={=\cs{ReadonlyShipoutCounter}\verb=}= +% etc, would not work. % \end{variable} % % \begin{variable}{totalpages,\g_shipout_totalpages_int} @@ -325,7 +431,8 @@ % \texttt{totalpages} counter is a \LaTeX{} counter and incremented % for each shipout attempt including those pages that are discarded % for one or the other reason. Again \hook{shipout/before} sees -% the counter before it is incremented). +% the counter before it is incremented. In contrast +% \hook{shipout/after} sees the incremented value. % % Furthermore, while it is incremented for each page, its value is % never used by \LaTeX. It can therefore be freely reset or changed by user @@ -427,6 +534,21 @@ % This is the name of the shipout box as \pkg{atbegshi} knows it. % \end{function} % +% +% \begin{function}{\AtBeginShipoutOriginalShipout} +% This is the name of the \cs{shipout} primitive as \pkg{atbegshi} +% knows it. This bypasses all the mechanisms set up by the \LaTeX{} +% kernel and there are various scenarios in which it can therefore +% fail. It should only be used to run existing legacy +% \pkg{atbegshi} code but not in newly developed applications. +% +% The kernel alternative is \cs{RawShipout} which is integrated +% with the \LaTeX{} mechanisms and updates, for example, the +% \cs{ReadonlyShipoutCounter} counter. Please use \cs{RawShipout} +% for new code if you want to bypass the before, foreground and +% background hooks. +% \end{function} +% % \begin{function}{\AtBeginShipoutInit} % By default \pkg{atbegshi} delayed its action until % \verb=\begin{document}=. This command was forcing it in an earlier @@ -591,6 +713,41 @@ % \end{macro} % % +% \begin{macro}{\l_@@_raw_box} +% The \cs{RawShipout} gets its own box but it is internal as there +% is no hook manipulation for it. +% \begin{macrocode} +\box_new:N \l_@@_raw_box +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_finalize_box:} +% For Lua\TeX{} invoke the \texttt{pre\_shipout\_filter} callback. +% \changes{v1.0i}{2021/01/22}{Add \texttt{pre\_shipout\_filter} Lua callback} +% \begin{macrocode} +\sys_if_engine_luatex:TF + { + \newluafunction \@@_finalize_box: + \exp_args:Nx \everyjob { + \exp_not:V \everyjob + \exp_not:N \lua_now:n { + luatexbase.create_callback('pre_shipout_filter', 'list') + local~call, getbox, setbox = luatexbase.call_callback, tex.getbox, tex.setbox~ + lua.get_functions_table()[\the \@@_finalize_box:] = function() + local~result = call('pre_shipout_filter', getbox(\the \l_shipout_box)) + if~not (result == true) then~ + setbox(\the \l_shipout_box, result~or~nil) + end~ + end + } + } + \protected \luadef \@@_finalize_box: \the \@@_finalize_box: + } { + \cs_set_eq:NN \@@_finalize_box: \scan_stop: + } +% \end{macrocode} +% \end{macro} % % % \begin{macro}{\@@_execute:} @@ -618,7 +775,8 @@ % % \begin{macro}{\l_@@_group_level_tl} % Helper token list to record the group level at which -% \cs{@@_execute:} is encountered. \begin{macrocode} +% \cs{@@_execute:} is encountered. +% \begin{macrocode} \tl_new:N \l_@@_group_level_tl % \end{macrocode} % \end{macro} @@ -632,28 +790,78 @@ \cs_new:Npn \@@_execute_test_level: { \int_compare:nNnT \l_@@_group_level_tl < \tex_currentgrouplevel:D - \tex_aftergroup:D - \@@_execute_cont: + \tex_aftergroup:D \@@_execute_cont: } % \end{macrocode} % \end{macro} % % % \begin{macro}{\@@_execute_cont:} +% This does the actual shipout running several hooks as part of it. +% The code for them is passed as argument \verb=#2= to \verb=#4= +% to \cs{@@_execute_main_cont:Nnnn}; the first argument is the box +% to be shipped out. +% \begin{macrocode} +\cs_new:Npn \@@_execute_cont: { + \@@_execute_main_cont:Nnnn + \l_shipout_box + { \hook_use:n {shipout/before} } + { \hook_if_empty:nF {shipout/foreground} + { \@@_add_foreground_picture:n + { \hook_use:n {shipout/foreground} } } +% \end{macrocode} +% If the user hook for the background (\hook{shipout/background}) has +% no code, there might still code in the kernel hook so we need to +% test for this too. +% We only test for the \cs{@kernel@before@shipout@background} +% though. If the \cs{@kernel@after@shipout@background} needs +% executing even if the user hook is empty then we can add another +% test (or the kernel could put something into the before hook). +% +% \changes{v1.0d}{2020/11/23}{Check for both kernel and user hook (gh/431)} +% \changes{v1.0f}{2021/01/08}{Added another kernel hook for more +% flexibility (cf \texttt{https://github.com/pgf-tikz/pgf/issues/960}} +% \begin{macrocode} + \bool_lazy_and:nnF + { \hook_if_empty_p:n {shipout/background} } + { \tl_if_empty_p:N \@kernel@before@shipout@background } + { \@@_add_background_picture:n + { \@kernel@before@shipout@background + \hook_use:n {shipout/background} + \@kernel@after@shipout@background } + } + } + { \hook_use:n {shipout/after} } +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_execute_main_cont:Nnnn} % When we have reached this point the shipout box has been % processed and is available in \cs{l_shipout_box} and ready for -% real ship out (perhaps).. +% real ship out (unless it gets discarded during the process). +% +% The three arguments hold hook code that is executed just before the +% actual shipout (\verb=#1=), within the shipout adding +% background and foreground material (\verb=#2=) and after the +% shipout has happened (\verb=#3=). +% These are passed as arguments because the same code without those +% hooks is also used when doing a ``raw'' shipout implemented by +% \cs{RawShipout}. +% The only hook that is always executed is that for the very last +% page, i.e., \hook{shipout/lastpage}. % % First we quickly check if it is void (can't happen in the % standard \LaTeX{} output routine but \cs{shipout} might be called % from a package that has some special processing logic). If it is % void we aren't shipping anything out and processing ends.\footnote{In that -% case we don't reset the deadcyles, that would be up to the OR +% case we don't reset the deadcycles, that would be up to the OR % processing logic to do.} % \begin{macrocode} -\cs_new:Npn \@@_execute_cont: { - \box_if_empty:NTF \l_shipout_box - { \PackageWarning{ltshipout}{Ignoring~ void~ shipout~ box} } +\cs_new:Npn \@@_execute_main_cont:Nnnn #1#2#3#4 { + \box_if_empty:NTF #1 + { \@latex@warning{Ignoring~ void~ shipout~ box} } { % \end{macrocode} % Otherwise we assume that we will ship something and prepare for @@ -661,7 +869,8 @@ % \cs{protect} while we are running the hook code). % We also save the current \cs{protect} state to restore it later. % \begin{macrocode} - \bool_gset_false:N \g_@@_discard_bool +% \bool_gset_false:N \g_@@_discard_bool % setting this would disable + % \DiscardShipoutBox on doc-level \cs_set_eq:NN \@@_saved_protect: \protect \set@typeset@protect % \end{macrocode} @@ -670,11 +879,12 @@ % necessary as the code could access them via \cs{box_ht:N}, etc., % but it is perhaps convenient.} % \begin{macrocode} - \@@_get_box_size:N \l_shipout_box + \@@_get_box_size:N #1 % \end{macrocode} -% Then we execute the \hook{shipout/before} hook. +% Then we execute the \hook{shipout/before} hook (or nothing in +% case of \cs{RawShipout}). % \begin{macrocode} - \hook_use:n {shipout/before} + #2 % \end{macrocode} % In \cs{g_shipout_totalpages_int} we count all shipout attempts so % we increment that counter already here (the other one is @@ -693,7 +903,7 @@ % we now test for it. % \begin{macrocode} \bool_if:NTF \g_@@_discard_bool - { \PackageInfo{ltshipout}{Completed~ page~ discarded} + { \@latex@info@no@line{Completed~ page~ discarded} \bool_gset_false:N \g_@@_discard_bool % \end{macrocode} % As we are discarding the page box and not shipping anything out, @@ -707,7 +917,7 @@ % needed? Or the resetting of \cs{protect} to its kernel value?} % \begin{macrocode} % \group_begin: -% \box_set_eq_drop:NN \l_shipout_box \l_shipout_box +% \box_set_eq_drop:NN #1 #1 % \group_end: % \cs_set_eq:NN \protect \exp_not:N } @@ -718,8 +928,8 @@ % once more but this time make it a warning, because the best % practice way is to use the request mechanism. % \begin{macrocode} - { \box_if_empty:NTF \l_shipout_box - { \PackageWarning{ltshipout}{ + { \box_if_empty:NTF #1 + { \@latex@warning{ Shipout~ box~ was~ voided~ by~ hook,\MessageBreak ignoring~ shipout~ box } } @@ -743,33 +953,36 @@ % changed) and then look at the hooks \hook{shipout/foreground} % and \hook{shipout/background}. If either or both are non-empty % we add a \texttt{picture} environment to the box (in the -% foreground and or in the background) and execute the hook code +% foreground and/or in the background) and execute the hook code % inside that environment. % % \begin{macrocode} - \@@_get_box_size:N \l_shipout_box - \hook_if_empty:nF {shipout/foreground} - { \@@_add_foreground_picture:n - { \hook_use:n {shipout/foreground} } } + \@@_get_box_size:N #1 % \end{macrocode} -% If there is no user hook, there might still code in the kernel hook. -% \changes{v1.0d}{2020/11/23}{Check for both kernel and user hook (gh/431)} +% The first hook we run is the \hook{shipout/firstpage} hook. This +% is only done once, then the \cs{@@_run_firstpage_hook:} +% command redefines itself to do nothing. If the hook contains +% \cs{special}s for integration at the top of the page they will be +% temporarily stored in a safe place and added later with +% \cs{@@_add_firstpage_specials:}. +% \begin{macrocode} + \@@_run_firstpage_hook: +% \end{macrocode} +% Run the hooks for background and foreground or, if this +% is called by \cs{RawShipout}, copy the box \cs{l_@@_raw_box} to +% \cs{l_shipout_box} so that firstpage and lastpage material gets +% added if necessary (that is always done to \cs{l_shipout_box}. % \begin{macrocode} - \bool_lazy_and:nnF - { \hook_if_empty_p:n {shipout/background} } - { \tl_if_empty_p:N \@kernel@before@shipout@background } - { \@@_add_background_picture:n - { \@kernel@before@shipout@background - \hook_use:n {shipout/background} } } + #3 % \end{macrocode} -% We then run \cs{@@_execute_firstpage_hook:} that adds +% We then run \cs{@@_add_firstpage_specials:} that adds % the content of the hook \hook{shipout/firstpage} to the % start of the first page (if non-empty). It is then redefined to % do nothing on later pages. % \begin{macrocode} - \@@_execute_firstpage_hook: + \@@_add_firstpage_specials: % \end{macrocode} -% The we check if we have to add the \hook{shipout/lastpage} hook +% Then we check if we have to add the \hook{shipout/lastpage} hook % or the corresponding kernel hook % because we have reached the last page. This test will be false for % all but one (and hopefully the correct) page. @@ -780,12 +993,14 @@ { \hook_if_empty_p:n {shipout/lastpage} } { \tl_if_empty_p:N \@kernel@after@shipout@lastpage } { \@@_debug:n { \typeout{Executing~ lastpage~ hook~ - on~ page~ \int_use:N \g_shipout_readonly_int } } - \_@@_add_foreground_box:n { \UseHook{shipout/lastpage} - \@kernel@after@shipout@lastpage } + on~ page~ \int_use:N \g_shipout_readonly_int } } + \_@@_add_foreground_box:n + { \UseHook{shipout/lastpage} + \@kernel@after@shipout@lastpage } } \bool_gset_true:N \g_@@_lastpage_handled_bool } + \@@_finalize_box: % \end{macrocode} % Finally we run the actual \TeX{} primitive for shipout. As that will % expand delayed \cs{write} statements inside the page in which @@ -794,6 +1009,21 @@ % \begin{macrocode} \cs_set_eq:NN \protect \exp_not:N \tex_shipout:D \box_use:N \l_shipout_box +% \end{macrocode} +% The \cs{l_shipout_box} may contain the firstpage material if this +% was the very first shipout. That makes it unsuitable for reuse in +% another shipout, so as a safety measure the next command resets +% \cs{l_shipout_box} to its earlier state if that is necessary. On +% later pages this is then a no-op. +% \begin{macrocode} + \@@_drop_firstpage_specials: +% \end{macrocode} +% The \hook{shipout/after} hook (if in \verb=#4=) needs to run with +% \cs{protect}ed commands again being executed, because that hook +% will ``typeset'' material added at the top of the next page. +% \begin{macrocode} + \set@typeset@protect + #4 } } % \end{macrocode} @@ -808,6 +1038,54 @@ % \end{macro} % % +% +% +% \begin{macro}{\@@_execute_raw:, +% \@@_execute_test_level_raw:} +% +% This implements the ``raw'' shipout which bypasses the before, +% foreground, background and after hooks. It follows the same pattern than +% \cs{_@@_execute_raw:} except that it finally calls +% \cs{_@@_execute_main_cont:Nnnn} with three empty arguments. +% instead of the hook code. +% \begin{macrocode} +\cs_set_protected:Npn \@@_execute_raw: { + \tl_set:Nx \l_@@_group_level_tl + { \int_value:w \tex_currentgrouplevel:D } + \tex_afterassignment:D \@@_execute_test_level_raw: + \tex_setbox:D \l_@@_raw_box +} +% \end{macrocode} +% +% \begin{macrocode} +\cs_new:Npn \@@_execute_test_level_raw: { + \int_compare:nNnT + \l_@@_group_level_tl < \tex_currentgrouplevel:D + \tex_aftergroup:D \@@_execute_nohooks_cont: +} +% \end{macrocode} +% Well, not totally empty arguments, we add some debugging if we +% are actually doing a shipout. +% \begin{macrocode} +\cs_new:Npn \@@_execute_nohooks_cont: { + \@@_execute_main_cont:Nnnn \l_@@_raw_box + {} { \@@_debug:n{ \typeout{Doing~ raw~ shipout~ ...} } + \box_set_eq:NN \l_shipout_box \l_@@_raw_box } {} +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\RawShipout} +% The interface name for raw shipout. +% \changes{v1.0g}{2021/01/10}{Macro added} +% \begin{macrocode} +\cs_gset_eq:NN \RawShipout \@@_execute_raw: +% \end{macrocode} +% \end{macro} +% +% +% +% % \begin{macro}{\@@_saved_protect:} % Remember the current \cs{protect} state. % \begin{macrocode} @@ -815,13 +1093,14 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{shipout/before, +% \begin{macro}{shipout/before,shipout/after, % shipout/foreground,shipout/background, % shipout/firstpage, % shipout/lastpage} % Declaring all hooks for the shipout code. % \begin{macrocode} \hook_new:n{shipout/before} +\hook_new:n{shipout/after} \hook_new:n{shipout/foreground} \hook_new:n{shipout/background} \hook_new:n{shipout/firstpage} @@ -832,36 +1111,71 @@ % % % \begin{macro}{\@kernel@after@shipout@lastpage, -% \@kernel@before@shipout@background} +% \@kernel@before@shipout@background, +% \@kernel@after@shipout@background} % And here are the internal kernel hooks going before or after the % public ones where needed. +% \changes{v1.0g}{2021/01/10}{Internal hook +% \cs{@kernel@after@shipout@background} added} % \begin{macrocode} \let\@kernel@after@shipout@lastpage\@empty \let\@kernel@before@shipout@background\@empty +\let\@kernel@after@shipout@background\@empty % \end{macrocode} % \end{macro} % % -% \begin{macro}{\@@_execute_firstpage_hook: } -% This command adds any specials into a box and adds that to the -% very beginning of the first box shipped out. After that we -% redefine it to do nothing on later pages. +% \begin{macro}{\@@_run_firstpage_hook:} +% +% \changes{v1.0h}{2021/01/19}{Handling of firstpage hook altered} +% +% There are three commands to handle the \hook{shipout/firstpage} +% hook: +% \cs{@@_run_firstpage_hook:}, \cs{@@_add_firstpage_specials:} and +% \cs{@@_drop_firstpage_specials:}. +% +% That hook is supposed to contain \cs{special}s and similar +% material to be placed at the very beginning of the output page +% and so it needs careful placing to avoid that anything else gets +% in front of it. And this means we have to wait with this until +% other hooks such as \hook{shipout/background} have added their +% bits. It is also important that such \cs{special}s show up only +% on the very first page, so if this page gets saved before +% \cs{shipout} for later reuse, we have to make sure that they +% aren't in the saved version. +% +% In addition the hook may also contain code to be executed ``first'', e.g., +% visible from code in \hook{shipout/background} and this conflicts +% with adding the \cs{special}s late. +% +% Therefore the processing is split into different parts: +% \cs{@@_run_firstpage_hook:} is done early and checks if there is +% any material in the hook. % \begin{macrocode} -\cs_new:Npn \@@_execute_firstpage_hook: { +\cs_new:Npn \@@_run_firstpage_hook: { + \hook_if_empty:nTF {shipout/firstpage} % \end{macrocode} -% Adding something to the beginning means adding it to the -% background as that layer is done first in the output. Of course -% that is only needed if the hook actually contains anything. +% If not then we define the other two commands to do nothing. % \begin{macrocode} - \hook_if_empty:nF {shipout/firstpage} - { \@@_add_background_box:n { \UseHook{shipout/firstpage} } } + { + \cs_gset_eq:NN \@@_add_firstpage_specials: \prg_do_nothing: + \cs_gset_eq:NN \@@_drop_firstpage_specials: \prg_do_nothing: + } +% \end{macrocode} +% If there is material we execute inside a box, which means any +% \cs{special} will end up in that box and any other code is +% executed and can have side effects (as long as they are global). +% \begin{macrocode} + { + \hbox_set:Nn \l_@@_firstpage_box { \UseHook{shipout/firstpage} } + } % \end{macrocode} % Once we are here we change the definition to do nothing next time % and we also change the command used to implement \cs{AtBeginDvi} -% to become a warning and not add further material to a hook that +% to become a warning and not add further material to a hook that % is never used again. % \begin{macrocode} - \cs_gset_eq:NN \@@_execute_firstpage_hook: \prg_do_nothing: + \cs_gset_eq:NN \@@_run_firstpage_hook: \prg_do_nothing: \cs_gset:Npn \@@_add_firstpage_material:Nn ##1 ##2 { \@latex@warning{ First~ page~ is~ already~ shipped~ out,~ ignoring\MessageBreak @@ -869,8 +1183,67 @@ } } % \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@@_add_firstpage_specials:,\@@_drop_firstpage_specials:} +% The \cs{@@_add_firstpage_specials:} then adds the \cs{special}s +% stored in \cs{l_@@_firstpage_box} to the page to be shipped out +% when the time is ready. Note that if there was no material in the +% \hook{shipout/firstpage} hook then this command gets redefined to +% do nothing. But for most documents there is something, e.g., some +% PostScript header, or some meta data declaration, etc.\ so by +% default we assume there is something to do. +% \begin{macrocode} +\cs_new:Npn \@@_add_firstpage_specials: { +% \end{macrocode} +% First we make a copy of the \cs{l_shipout_box} that we can +% restore it later on. +% \begin{macrocode} + \box_set_eq:NN \l_@@_raw_box \l_shipout_box +% \end{macrocode} +% Adding something to the beginning means adding it to the +% background as that layer is done first in the output. +% \begin{macrocode} + \@@_add_background_box:n { \hbox_unpack_drop:N \l_@@_firstpage_box } +% \end{macrocode} +% After the actual shipout \cs{@@_drop_firstpage_specials:} is +% run to +% restore the earlier content of \cs{l_shipout_box} and then +% redefines itself again to do nothing. +% +% As a final act we change the definition to do nothing next time. +% \begin{macrocode} + \cs_gset_eq:NN \@@_add_firstpage_specials: \prg_do_nothing: +} +% \end{macrocode} +% +% The \cs{@@_drop_firstpage_specials:} is run after the shipout has +% occurred but before the \hook{shipout/afterpage} hook is executed. +% That is the point where we have to restore the \cs{ShipoutBox} to +% its state without the \hook{shipout/firstpage} material. +% \begin{macrocode} +\cs_new:Npn \@@_drop_firstpage_specials: { + \box_set_eq:NN \l_shipout_box \l_@@_raw_box +% \end{macrocode} +% If there was no such material then \cs{@@_run_firstpage_hook:} +% will have changed the definition to a no-op already. Otherwise +% this is what we do here. +% \begin{macrocode} + \cs_gset_eq:NN \@@_drop_firstpage_specials: \prg_do_nothing: + } +% \end{macrocode} % \end{macro} % + +% \begin{macro}{\l_@@_firstpage_box} +% The box to hold any firstpage \cs{special}s. +% \begin{macrocode} +\box_new:N \l_@@_firstpage_box +% \end{macrocode} +% \end{macro} + % % \begin{macro}{\g_@@_lastpage_handled_bool} % A boolean to signal if we have already handled the @@ -911,8 +1284,8 @@ \dim_set:Nn \l_shipout_box_ht_dim { \box_ht:N #1 } \dim_set:Nn \l_shipout_box_dp_dim { \box_dp:N #1 } \dim_set:Nn \l_shipout_box_wd_dim { \box_wd:N #1 } - \dim_set:Nn \l_shipout_box_ht_plus_dp_dim { \l_shipout_box_ht_dim + - \l_shipout_box_dp_dim } + \dim_set:Nn \l_shipout_box_ht_plus_dp_dim + { \l_shipout_box_ht_dim + \l_shipout_box_dp_dim } } % \end{macrocode} % \end{macro} @@ -1442,7 +1815,8 @@ % defined so we better not use \cs{cs_new_protected:Npn} here. % \changes{v1.0d}{2020/11/24}{Support for roll forward (gh/434)} % \begin{macrocode} -\cs_set_protected:Npn \AtBeginDvi {\@@_add_firstpage_material:Nn \AtBeginDvi} +\cs_set_protected:Npn \AtBeginDvi + {\@@_add_firstpage_material:Nn \AtBeginDvi} % \end{macrocode} % \end{macro} % @@ -1471,6 +1845,7 @@ % \@expl@@@shipout@add@foreground@picture@@n} % Some internals needed elsewhere. % +% \InternalDetectionOff % \begin{macrocode} \cs_set_eq:NN \@expl@@@shipout@add@firstpage@material@@Nn \__shipout_add_firstpage_material:Nn @@ -1495,6 +1870,7 @@ \cs_set_eq:NN \@expl@@@shipout@add@foreground@picture@@n \__shipout_add_foreground_picture:n % \end{macrocode} +% \InternalDetectionOn % \end{macro} % % \begin{macrocode} @@ -1524,6 +1900,7 @@ %<latexrelease> \csname tex_shipout:D\endcsname %<latexrelease>\fi %<latexrelease> +%<latexrelease>\let \RawShipout\@undefined %<latexrelease>\let \ShipoutBox\@undefined %<latexrelease>\let \ReadonlyShipoutCounter \@undefined %<latexrelease>\let \c@totalpages \@undefined @@ -1547,23 +1924,13 @@ %<latexrelease>\let \ShipoutBoxDepth \@undefined %<latexrelease>\let \ShipoutBoxWidth \@undefined %<latexrelease> -%<latexrelease>\let \AtBeginShipoutDiscard \@undefined -%<latexrelease> -%<latexrelease>\let \AtBeginShipoutAddToBox \@undefined -%<latexrelease>\let \AtBeginShipoutAddToBoxForeground \@undefined -%<latexrelease>\let \AtBeginShipoutUpperLeft \@undefined -%<latexrelease>\let \AtBeginShipoutUpperLeftForeground \@undefined -%<latexrelease> % \end{macrocode} % We do not undo a substitution when rolling back. As the file % support gets undone the underlying data is no longer used (and % sufficiently obscure that it should not interfere with existing % commands) and properly removing it would mean we need to make the -% \cs{unclare@...} and its support macros available in all earlier +% \cs{undeclare@...} and its support macros available in all earlier % kernel releases which is pointless (and actually worse). -% \begin{macrocode} -%\undeclare@file@substitution{everyshi.sty} -% \end{macrocode} % % \begin{macrocode} %<latexrelease> @@ -1647,7 +2014,7 @@ % \begin{macrocode} %<*atbegshi-ltx> \ProvidesPackage{atbegshi-ltx} - [2020/10/15 v1.0b + [2021/01/10 v1.0c Emulation of the original atbegshi^^Jpackage with kernel methods] % \end{macrocode} % @@ -1659,6 +2026,7 @@ % \end{macro} % % +% % \begin{macro}{\AtBeginShipoutInit} % Compatibility only, we aren't delaying \ldots % \begin{macrocode} @@ -1712,6 +2080,19 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\AtBeginShipoutOriginalShipout} +% This offers the raw \cs{shipout} primitive of the engine. A page +% shipped out with this is not counted by +% \cs{ReadonlyShipoutCounter} counter and thus the mechanism to +% place \cs{special}s at the very end of the output might fail, +% etc. It should therefore not be used in new applications but is +% only provided to allow running legacy code. For new code use the +% commands provided by the kernel instead. +% \begin{macrocode} +\ExplSyntaxOn +\cs_new_eq:NN \AtBeginShipoutOriginalShipout \tex_shipout:D +% \end{macrocode} +% \end{macro} % % % \begin{macro}{\ShipoutBoxHeight,\ShipoutBoxWidth,\ShipoutBoxDepth} @@ -1720,7 +2101,6 @@ % \verb=\the\ht<box>= value. This may has some implications in some % use cases and if that is a problem then it might need changing. % \begin{macrocode} -\ExplSyntaxOn \cs_new:Npn \ShipoutBoxHeight { \dim_use:N \l_shipout_box_ht_dim } \cs_new:Npn \ShipoutBoxDepth { \dim_use:N \l_shipout_box_dp_dim } \cs_new:Npn \ShipoutBoxWidth { \dim_use:N \l_shipout_box_wd_dim } @@ -1747,56 +2127,8 @@ % % \subsection{Package \pkg{everyshi} emulation} % -% \begin{macrocode} -%<*everyshi-ltx> -% \end{macrocode} -% -% \begin{macrocode} -\ProvidesPackage{everyshi-ltx} - [2020/10/15 v1.0b - Emulation of the original everyshi^^Jpackage with kernel methods] -% \end{macrocode} -% -% \begin{macro}{\EveryShipout,\AtNextShipout} -% This package has only two public commands so simulating it is easy: -% \begin{macrocode} -\protected \def \EveryShipout {\AddToHook{shipout/before}} -\protected \def \AtNextShipout {\AddToHookNext{shipout/before}} -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -% This is one difference between \pkg{everyshi} and the kernel -% implementation, the latter does not directly use box 255. -% -% For usage by ordinary users this makes no difference but of a -% package use complicated code together with \pkg{everyshi} and -% directly manipulates box 255 then this package needs updating. -% In most cases the updates are simple because the kernel offers -% hooks that makes such complicated code unnecessary. -% -% We therefore add a little file into the adjusted package -% \begin{macrocode} -%% -%% In normal circumstances the above emulation is sufficient and in -%% all known packages (we know of) that use everyshi it either works or -%% the packages have been adjusted. -%% -%% Code that directly manipulates box 255, however, might fail. -%% If that is the case look at the shipout hooks offered now as -%% they are normally sufficient to avoid such manipulations (or -%% replace box 255 with \ShipoutBox in the code. -%% -%</everyshi-ltx> -% \end{macrocode} -% -% -% If the package is requested we substitute the one above: -% \begin{macrocode} -%<*2ekernel> -\declare@file@substitution{everyshi.sty}{everyshi-ltx.sty} -%</2ekernel> -% \end{macrocode} +% This is now directly handled in that package so emulation is not +% necessary any more. % % % Rather important :-) diff --git a/Master/texmf-dist/source/latex-dev/base/ltspace.dtx b/Master/texmf-dist/source/latex-dev/base/ltspace.dtx index 8b933e8c971..17fb0d65185 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltspace.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltspace.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/lttab.dtx b/Master/texmf-dist/source/latex-dev/base/lttab.dtx index 545b30d3af1..a964b365753 100644 --- a/Master/texmf-dist/source/latex-dev/base/lttab.dtx +++ b/Master/texmf-dist/source/latex-dev/base/lttab.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/lttextcomp.dtx b/Master/texmf-dist/source/latex-dev/base/lttextcomp.dtx index 3ea90d005f9..d840f0448b9 100644 --- a/Master/texmf-dist/source/latex-dev/base/lttextcomp.dtx +++ b/Master/texmf-dist/source/latex-dev/base/lttextcomp.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 2019-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -26,6 +26,9 @@ % extension .ins) which are part of the distribution. % % \fi +% +%%% From File: lttextcomp.dtx +% % \iffalse % %<*driver> @@ -33,7 +36,7 @@ % % \ProvidesFile{lttextcomp.dtx} - [2020/12/05 v1.0d LaTeX Kernel (text companion symbols)] + [2021/01/20 v1.0d LaTeX Kernel (text companion symbols)] % \iffalse \documentclass{ltxdoc} \begin{document} @@ -362,13 +365,14 @@ } % \end{macrocode} % \end{macro} - - - - +% +% +% +% +% % \begin{macro}{\tc@fake@euro} % |\tc@fake@euro| is an example of a ``fake'' definition to use in arg |#3| of -% |\CheckEncodingSubset| when a symbol is not available in a +% the command |\CheckEncodingSubset| when a symbol is not available in a % certain font family. Here we produce a poor man's Euro symbol by combining % a ``C'' with a ``=''. % \begin{macrocode} @@ -386,10 +390,10 @@ } % \end{macrocode} % \end{macro} - - - - +% +% +% +% % \begin{macro}{\tc@check@symbol} % \begin{macro}{\tc@check@accent} % These are two abbreviations that we use below to check symbols @@ -401,12 +405,12 @@ % to ensure that |\textcurrency| is only typeset if the current % font has a \texttt{TS1} subset id of less than 3. Otherwise % |\tc@error| is called telling the user that for this font family -% |\textcurreny| is not available. +% |\textcurrency| is not available. % \begin{macrocode} \def\tc@check@symbol{\CheckEncodingSubset\UseTextSymbol{TS1}\tc@subst} % \end{macrocode} % -% Accents and been mad an error in the \texttt{textcomp} package when +% Accents have been made an error in the \texttt{textcomp} package when % not available. Now that we provide the functionality in the % kernel we avoid the error by swapping in a \texttt{T1} accent if % the \texttt{TS1} accent is not available. @@ -415,7 +419,8 @@ % \end{macrocode} % % \begin{macrocode} -\def\tc@check@accent#1{\CheckEncodingSubset\UseTextAccent{TS1}{\tc@swap@accent#1}} +\def\tc@check@accent#1{\CheckEncodingSubset\UseTextAccent + {TS1}{\tc@swap@accent#1}} \def\tc@swap@accent#1#2{\UseTextAccent{T1}#1} % \end{macrocode} % \end{macro} @@ -430,17 +435,17 @@ % % \begin{macrocode} \DeclareTextSymbolDefault{\textdollar}{TS1} -\UndeclareTextCommand{\textdollar} {OT1} % don't use the OT1 def any longer +\UndeclareTextCommand{\textdollar}{OT1} % don't use the OT1 def any longer % \end{macrocode} % % \begin{macrocode} \DeclareTextSymbolDefault{\textsterling}{TS1} -\UndeclareTextCommand{\textsterling}{OT1} % don't use the OT1 def any longer +\UndeclareTextCommand{\textsterling}{OT1}% don't use the OT1 def any longer % \end{macrocode} % % \begin{macrocode} \DeclareTextSymbolDefault{\textperthousand}{TS1} -\UndeclareTextCommand{\textperthousand}{T1} % don't use the T1 def +\UndeclareTextCommand{\textperthousand}{T1} % don't use the T1 def % \end{macrocode} % Using \cs{UndeclareTextCommand} above is enough only if the % encoding definition files are not reloaded afterwards. In the @@ -462,9 +467,9 @@ % \end{macrocode} % % And here are the other \texttt{TS1} glyphs that are implemented -% by every font (or nearly everyone---a few are commented out and +% by every font (or nearly every---a few are commented out and % moved to sub-encoding 9, -% because they aren't around in one or two fonts. +% because they aren't around in some fonts. % \begin{macrocode} %%\DeclareTextSymbolDefault{\textbardbl}{TS1} % subst in sub-enc 9 above \DeclareTextSymbolDefault{\textbrokenbar}{TS1} @@ -541,31 +546,49 @@ % % \begin{macrocode} \ifx\Umathcode\@undefined - \DeclareTextCommandDefault{\capitalacute} {\tc@check@accent{\'}2\capitalacute} - \DeclareTextCommandDefault{\capitalbreve} {\tc@check@accent{\u}2\capitalbreve} - \DeclareTextCommandDefault{\capitalcaron} {\tc@check@accent{\v}2\capitalcaron} - \DeclareTextCommandDefault{\capitalcedilla} {\tc@check@accent{\c}2\capitalcedilla} - \DeclareTextCommandDefault{\capitalcircumflex} {\tc@check@accent{\^}2\capitalcircumflex} - \DeclareTextCommandDefault{\capitaldieresis} {\tc@check@accent{\"}2\capitaldieresis} - \DeclareTextCommandDefault{\capitaldotaccent} {\tc@check@accent{\.}2\capitaldotaccent} - \DeclareTextCommandDefault{\capitalgrave} {\tc@check@accent{\`}2\capitalgrave} - \DeclareTextCommandDefault{\capitalhungarumlaut}{\tc@check@accent{\H}2\capitalhungarumlaut} - \DeclareTextCommandDefault{\capitalmacron} {\tc@check@accent{\=}2\capitalmacron} - \DeclareTextCommandDefault{\capitalogonek} {\tc@check@accent{\k}2\capitalogonek} - \DeclareTextCommandDefault{\capitalring} {\tc@check@accent{\r}2\capitalring} - \DeclareTextCommandDefault{\capitaltie} {\tc@check@accent{\t}2\capitaltie} - \DeclareTextCommandDefault{\capitaltilde} {\tc@check@accent{\~}2\capitaltilde} + \DeclareTextCommandDefault{\capitalacute} + {\tc@check@accent{\'}2\capitalacute} + \DeclareTextCommandDefault{\capitalbreve} + {\tc@check@accent{\u}2\capitalbreve} + \DeclareTextCommandDefault{\capitalcaron} + {\tc@check@accent{\v}2\capitalcaron} + \DeclareTextCommandDefault{\capitalcedilla} + {\tc@check@accent{\c}2\capitalcedilla} + \DeclareTextCommandDefault{\capitalcircumflex} + {\tc@check@accent{\^}2\capitalcircumflex} + \DeclareTextCommandDefault{\capitaldieresis} + {\tc@check@accent{\"}2\capitaldieresis} + \DeclareTextCommandDefault{\capitaldotaccent} + {\tc@check@accent{\.}2\capitaldotaccent} + \DeclareTextCommandDefault{\capitalgrave} + {\tc@check@accent{\`}2\capitalgrave} + \DeclareTextCommandDefault{\capitalhungarumlaut} + {\tc@check@accent{\H}2\capitalhungarumlaut} + \DeclareTextCommandDefault{\capitalmacron} + {\tc@check@accent{\=}2\capitalmacron} + \DeclareTextCommandDefault{\capitalogonek} + {\tc@check@accent{\k}2\capitalogonek} + \DeclareTextCommandDefault{\capitalring} + {\tc@check@accent{\r}2\capitalring} + \DeclareTextCommandDefault{\capitaltie} + {\tc@check@accent{\t}2\capitaltie} + \DeclareTextCommandDefault{\capitaltilde} + {\tc@check@accent{\~}2\capitaltilde} % \end{macrocode} % For \cs{newtie} and \cs{capitalnewtie} this is actually wrong, they should pick up % the accent from the substitution font (not done yet). % \begin{macrocode} - \DeclareTextCommandDefault{\newtie} {\tc@check@accent{\t}2\newtie} - \DeclareTextCommandDefault{\capitalnewtie} {\tc@check@accent{\t}2\capitalnewtie} + \DeclareTextCommandDefault{\newtie} + {\tc@check@accent{\t}2\newtie} + \DeclareTextCommandDefault{\capitalnewtie} + {\tc@check@accent{\t}2\capitalnewtie} % \end{macrocode} % % In Unicode engines we just execute the simple accents: -% \changes{v1.0c}{2020/02/10}{Use \cs{@tabacckludge} for tabbing where necessary (gh/271)} -% \changes{v1.0d}{2020/04/29}{Make all capital accents text commands for hyperref (gh/332)} +% \changes{v1.0c}{2020/02/10}{Use \cs{@tabacckludge} for +% tabbing where necessary (gh/271)} +% \changes{v1.0d}{2020/04/29}{Make all capital accents text +% commands for hyperref (gh/332)} % \begin{macrocode} \else \DeclareTextCommandDefault\capitalacute{\@tabacckludge'} @@ -593,8 +616,10 @@ % The next two symbols exist in some fonts (faked?), but we ignore % that to keep the subsets reasonable compact and most important linear. % \begin{macrocode} -\DeclareTextCommandDefault{\textlbrackdbl} {\tc@check@symbol2\textlbrackdbl} -\DeclareTextCommandDefault{\textrbrackdbl} {\tc@check@symbol2\textrbrackdbl} +\DeclareTextCommandDefault{\textlbrackdbl} + {\tc@check@symbol2\textlbrackdbl} +\DeclareTextCommandDefault{\textrbrackdbl} + {\tc@check@symbol2\textrbrackdbl} % \end{macrocode} % % @@ -603,72 +628,118 @@ % claim they aren't in sub-encoding 2 as that's true for most % fonts. % \begin{macrocode} -\DeclareTextCommandDefault{\texteightoldstyle} {\tc@check@symbol2\texteightoldstyle} -\DeclareTextCommandDefault{\textfiveoldstyle} {\tc@check@symbol2\textfiveoldstyle} -\DeclareTextCommandDefault{\textfouroldstyle} {\tc@check@symbol2\textfouroldstyle} -\DeclareTextCommandDefault{\textnineoldstyle} {\tc@check@symbol2\textnineoldstyle} -\DeclareTextCommandDefault{\textoneoldstyle} {\tc@check@symbol2\textoneoldstyle} -\DeclareTextCommandDefault{\textsevenoldstyle} {\tc@check@symbol2\textsevenoldstyle} -\DeclareTextCommandDefault{\textsixoldstyle} {\tc@check@symbol2\textsixoldstyle} -\DeclareTextCommandDefault{\textthreeoldstyle} {\tc@check@symbol2\textthreeoldstyle} -\DeclareTextCommandDefault{\texttwooldstyle} {\tc@check@symbol2\texttwooldstyle} -\DeclareTextCommandDefault{\textzerooldstyle} {\tc@check@symbol2\textzerooldstyle} -% \end{macrocode} -% -% -% -% The next set of glyphs is special to TeX fonts (and available -% with a few older PS fonts supported in the virtual fonts), but +\DeclareTextCommandDefault{\texteightoldstyle} + {\tc@check@symbol2\texteightoldstyle} +\DeclareTextCommandDefault{\textfiveoldstyle} + {\tc@check@symbol2\textfiveoldstyle} +\DeclareTextCommandDefault{\textfouroldstyle} + {\tc@check@symbol2\textfouroldstyle} +\DeclareTextCommandDefault{\textnineoldstyle} + {\tc@check@symbol2\textnineoldstyle} +\DeclareTextCommandDefault{\textoneoldstyle} + {\tc@check@symbol2\textoneoldstyle} +\DeclareTextCommandDefault{\textsevenoldstyle} + {\tc@check@symbol2\textsevenoldstyle} +\DeclareTextCommandDefault{\textsixoldstyle} + {\tc@check@symbol2\textsixoldstyle} +\DeclareTextCommandDefault{\textthreeoldstyle} + {\tc@check@symbol2\textthreeoldstyle} +\DeclareTextCommandDefault{\texttwooldstyle} + {\tc@check@symbol2\texttwooldstyle} +\DeclareTextCommandDefault{\textzerooldstyle} + {\tc@check@symbol2\textzerooldstyle} +% \end{macrocode} +% +% +% +% The next set of glyphs is special to \TeX{} fonts (and available +% with a few older PS fonts supported through virtual fonts), but % not any longer in the majority of fonts provided through % autoinst, so we pretend there aren't available in sub-encoding 2 % and below. % \begin{macrocode} -\DeclareTextCommandDefault{\textacutedbl} {\tc@check@symbol2\textacutedbl} -\DeclareTextCommandDefault{\textasciiacute} {\tc@check@symbol2\textasciiacute} -\DeclareTextCommandDefault{\textasciibreve} {\tc@check@symbol2\textasciibreve} -\DeclareTextCommandDefault{\textasciicaron} {\tc@check@symbol2\textasciicaron} -\DeclareTextCommandDefault{\textasciidieresis} {\tc@check@symbol2\textasciidieresis} -\DeclareTextCommandDefault{\textasciigrave} {\tc@check@symbol2\textasciigrave} -\DeclareTextCommandDefault{\textasciimacron} {\tc@check@symbol2\textasciimacron} -\DeclareTextCommandDefault{\textgravedbl} {\tc@check@symbol2\textgravedbl} -\DeclareTextCommandDefault{\texttildelow} {\tc@check@symbol2\texttildelow} +\DeclareTextCommandDefault{\textacutedbl} + {\tc@check@symbol2\textacutedbl} +\DeclareTextCommandDefault{\textasciiacute} + {\tc@check@symbol2\textasciiacute} +\DeclareTextCommandDefault{\textasciibreve} + {\tc@check@symbol2\textasciibreve} +\DeclareTextCommandDefault{\textasciicaron} + {\tc@check@symbol2\textasciicaron} +\DeclareTextCommandDefault{\textasciidieresis} + {\tc@check@symbol2\textasciidieresis} +\DeclareTextCommandDefault{\textasciigrave} + {\tc@check@symbol2\textasciigrave} +\DeclareTextCommandDefault{\textasciimacron} + {\tc@check@symbol2\textasciimacron} +\DeclareTextCommandDefault{\textgravedbl} + {\tc@check@symbol2\textgravedbl} +\DeclareTextCommandDefault{\texttildelow} + {\tc@check@symbol2\texttildelow} % \end{macrocode} % % % Finally those below are only available in CM-based fonts but in % no font that has its origin outside of the \TeX{} world. % \begin{macrocode} -\DeclareTextCommandDefault{\textbaht} {\tc@check@symbol2\textbaht} -\DeclareTextCommandDefault{\textbigcircle} {\tc@check@symbol2\textbigcircle} -\DeclareTextCommandDefault{\textborn} {\tc@check@symbol2\textborn} -\DeclareTextCommandDefault{\textcentoldstyle} {\tc@check@symbol2\textcentoldstyle} -\DeclareTextCommandDefault{\textcircledP} {\tc@check@symbol2\textcircledP} -\DeclareTextCommandDefault{\textcopyleft} {\tc@check@symbol2\textcopyleft} -\DeclareTextCommandDefault{\textdblhyphenchar} {\tc@check@symbol2\textdblhyphenchar} -\DeclareTextCommandDefault{\textdblhyphen} {\tc@check@symbol2\textdblhyphen} -\DeclareTextCommandDefault{\textdied} {\tc@check@symbol2\textdied} -\DeclareTextCommandDefault{\textdiscount} {\tc@check@symbol2\textdiscount} -\DeclareTextCommandDefault{\textdivorced} {\tc@check@symbol2\textdivorced} -\DeclareTextCommandDefault{\textdollaroldstyle} {\tc@check@symbol2\textdollaroldstyle} -\DeclareTextCommandDefault{\textguarani} {\tc@check@symbol2\textguarani} -\DeclareTextCommandDefault{\textleaf} {\tc@check@symbol2\textleaf} -\DeclareTextCommandDefault{\textlquill} {\tc@check@symbol2\textlquill} -\DeclareTextCommandDefault{\textmarried} {\tc@check@symbol2\textmarried} -\DeclareTextCommandDefault{\textmho} {\tc@check@symbol2\textmho} -\DeclareTextCommandDefault{\textmusicalnote} {\tc@check@symbol2\textmusicalnote} -\DeclareTextCommandDefault{\textnaira} {\tc@check@symbol2\textnaira} -\DeclareTextCommandDefault{\textopenbullet} {\tc@check@symbol2\textopenbullet} -\DeclareTextCommandDefault{\textpeso} {\tc@check@symbol2\textpeso} -\DeclareTextCommandDefault{\textpilcrow} {\tc@check@symbol2\textpilcrow} -\DeclareTextCommandDefault{\textrecipe} {\tc@check@symbol2\textrecipe} -\DeclareTextCommandDefault{\textreferencemark} {\tc@check@symbol2\textreferencemark} -\DeclareTextCommandDefault{\textrquill} {\tc@check@symbol2\textrquill} -\DeclareTextCommandDefault{\textservicemark} {\tc@check@symbol2\textservicemark} -\DeclareTextCommandDefault{\textsurd} {\tc@check@symbol2\textsurd} +\DeclareTextCommandDefault{\textbaht} + {\tc@check@symbol2\textbaht} +\DeclareTextCommandDefault{\textbigcircle} + {\tc@check@symbol2\textbigcircle} +\DeclareTextCommandDefault{\textborn} + {\tc@check@symbol2\textborn} +\DeclareTextCommandDefault{\textcentoldstyle} + {\tc@check@symbol2\textcentoldstyle} +\DeclareTextCommandDefault{\textcircledP} + {\tc@check@symbol2\textcircledP} +\DeclareTextCommandDefault{\textcopyleft} + {\tc@check@symbol2\textcopyleft} +\DeclareTextCommandDefault{\textdblhyphenchar} + {\tc@check@symbol2\textdblhyphenchar} +\DeclareTextCommandDefault{\textdblhyphen} + {\tc@check@symbol2\textdblhyphen} +\DeclareTextCommandDefault{\textdied} + {\tc@check@symbol2\textdied} +\DeclareTextCommandDefault{\textdiscount} + {\tc@check@symbol2\textdiscount} +\DeclareTextCommandDefault{\textdivorced} + {\tc@check@symbol2\textdivorced} +\DeclareTextCommandDefault{\textdollaroldstyle} + {\tc@check@symbol2\textdollaroldstyle} +\DeclareTextCommandDefault{\textguarani} + {\tc@check@symbol2\textguarani} +\DeclareTextCommandDefault{\textleaf} + {\tc@check@symbol2\textleaf} +\DeclareTextCommandDefault{\textlquill} + {\tc@check@symbol2\textlquill} +\DeclareTextCommandDefault{\textmarried} + {\tc@check@symbol2\textmarried} +\DeclareTextCommandDefault{\textmho} + {\tc@check@symbol2\textmho} +\DeclareTextCommandDefault{\textmusicalnote} + {\tc@check@symbol2\textmusicalnote} +\DeclareTextCommandDefault{\textnaira} + {\tc@check@symbol2\textnaira} +\DeclareTextCommandDefault{\textopenbullet} + {\tc@check@symbol2\textopenbullet} +\DeclareTextCommandDefault{\textpeso} + {\tc@check@symbol2\textpeso} +\DeclareTextCommandDefault{\textpilcrow} + {\tc@check@symbol2\textpilcrow} +\DeclareTextCommandDefault{\textrecipe} + {\tc@check@symbol2\textrecipe} +\DeclareTextCommandDefault{\textreferencemark} + {\tc@check@symbol2\textreferencemark} +\DeclareTextCommandDefault{\textrquill} + {\tc@check@symbol2\textrquill} +\DeclareTextCommandDefault{\textservicemark} + {\tc@check@symbol2\textservicemark} +\DeclareTextCommandDefault{\textsurd} + {\tc@check@symbol2\textsurd} % \end{macrocode} % % The \cs{textpertenthousand} also belongs in this group but here -% we have a choice: in T1 there is definition for +% we have a choice: in T1 there is a definition for % \cs{textpertenthousand} making the symbol up from \% and % \verb=\char 24= (twice) but in many fonts that char doesn't exist % and the slot is reused for random ligatures. So better not use it @@ -679,7 +750,8 @@ % Alternatively we could just state that the symbol is unavailable in % those fonts. For now I substitute. % \begin{macrocode} -\DeclareTextCommandDefault{\textpertenthousand} {\tc@check@symbol2\textpertenthousand} +\DeclareTextCommandDefault{\textpertenthousand} + {\tc@check@symbol2\textpertenthousand} \UndeclareTextCommand{\textpertenthousand}{T1} % \end{macrocode} % @@ -691,8 +763,10 @@ % symbols. In the higher-numbered sub-encodings we see only a few % dropped additionally. % \begin{macrocode} -\DeclareTextCommandDefault{\textlangle} {\tc@check@symbol3\textlangle} -\DeclareTextCommandDefault{\textrangle} {\tc@check@symbol3\textrangle} +\DeclareTextCommandDefault{\textlangle} + {\tc@check@symbol3\textlangle} +\DeclareTextCommandDefault{\textrangle} + {\tc@check@symbol3\textrangle} % \end{macrocode} % % @@ -702,14 +776,22 @@ % \subsection{Sub-encoding \texttt{4}} % % \begin{macrocode} -\DeclareTextCommandDefault{\textcolonmonetary} {\tc@check@symbol4\textcolonmonetary} -\DeclareTextCommandDefault{\textdong} {\tc@check@symbol4\textdong} -\DeclareTextCommandDefault{\textdownarrow} {\tc@check@symbol4\textdownarrow} -\DeclareTextCommandDefault{\textleftarrow} {\tc@check@symbol4\textleftarrow} -\DeclareTextCommandDefault{\textlira} {\tc@check@symbol4\textlira} -\DeclareTextCommandDefault{\textrightarrow} {\tc@check@symbol4\textrightarrow} -\DeclareTextCommandDefault{\textuparrow} {\tc@check@symbol4\textuparrow} -\DeclareTextCommandDefault{\textwon} {\tc@check@symbol4\textwon} +\DeclareTextCommandDefault{\textcolonmonetary} + {\tc@check@symbol4\textcolonmonetary} +\DeclareTextCommandDefault{\textdong} + {\tc@check@symbol4\textdong} +\DeclareTextCommandDefault{\textdownarrow} + {\tc@check@symbol4\textdownarrow} +\DeclareTextCommandDefault{\textleftarrow} + {\tc@check@symbol4\textleftarrow} +\DeclareTextCommandDefault{\textlira} + {\tc@check@symbol4\textlira} +\DeclareTextCommandDefault{\textrightarrow} + {\tc@check@symbol4\textrightarrow} +\DeclareTextCommandDefault{\textuparrow} + {\tc@check@symbol4\textuparrow} +\DeclareTextCommandDefault{\textwon} + {\tc@check@symbol4\textwon} % \end{macrocode} % % @@ -727,15 +809,17 @@ % % But the coverage is so random that it is impossible to sort them % properly and if we tried to ensure that they only typeset those -% glyphs that are really always available would put them all into -% sub-encoding \texttt{9} so that's a compromise really. +% glyphs that are really always available, we would have to put them all into +% sub-encoding \texttt{9}; so putting them into 5 is really a compromise. % -% Modern fonts that don't typeset a tofu character if a glyph is -% missing are only cataloged as sub-encoding \texttt{5} if they -% really support of its glyph set. +% Modern fonts usually don't typeset a tofu character if a glyph is +% missing. They are therefore only classified as sub-encoding \texttt{5} if they +% really support its glyph set completely. % \begin{macrocode} -\DeclareTextCommandDefault{\textestimated} {\tc@check@symbol5\textestimated} -\DeclareTextCommandDefault{\textnumero} {\tc@check@symbol5\textnumero} +\DeclareTextCommandDefault{\textestimated} + {\tc@check@symbol5\textestimated} +\DeclareTextCommandDefault{\textnumero} + {\tc@check@symbol5\textnumero} % \end{macrocode} % % @@ -744,8 +828,10 @@ % \subsection{Sub-encoding \texttt{6}} % % \begin{macrocode} -\DeclareTextCommandDefault{\textflorin} {\tc@check@symbol6\textflorin} -\DeclareTextCommandDefault{\textcurrency} {\tc@check@symbol6\textcurrency} +\DeclareTextCommandDefault{\textflorin} + {\tc@check@symbol6\textflorin} +\DeclareTextCommandDefault{\textcurrency} + {\tc@check@symbol6\textcurrency} % \end{macrocode} % % @@ -753,10 +839,14 @@ % \subsection{Sub-encoding \texttt{7}} % % \begin{macrocode} -\DeclareTextCommandDefault{\textfractionsolidus}{\tc@check@symbol7\textfractionsolidus} -\DeclareTextCommandDefault{\textohm} {\tc@check@symbol7\textohm} -\DeclareTextCommandDefault{\textmu} {\tc@check@symbol7\textmu} -\DeclareTextCommandDefault{\textminus} {\tc@check@symbol7\textminus} +\DeclareTextCommandDefault{\textfractionsolidus} + {\tc@check@symbol7\textfractionsolidus} +\DeclareTextCommandDefault{\textohm} + {\tc@check@symbol7\textohm} +\DeclareTextCommandDefault{\textmu} + {\tc@check@symbol7\textmu} +\DeclareTextCommandDefault{\textminus} + {\tc@check@symbol7\textminus} % \end{macrocode} % % @@ -764,16 +854,19 @@ % \subsection{Sub-encoding \texttt{8}} % % \begin{macrocode} -\DeclareTextCommandDefault{\textblank} {\tc@check@symbol{8}\textblank} -\DeclareTextCommandDefault{\textinterrobangdown}{\tc@check@symbol{8}\textinterrobangdown} -\DeclareTextCommandDefault{\textinterrobang} {\tc@check@symbol{8}\textinterrobang} +\DeclareTextCommandDefault{\textblank} + {\tc@check@symbol{8}\textblank} +\DeclareTextCommandDefault{\textinterrobangdown} + {\tc@check@symbol{8}\textinterrobangdown} +\DeclareTextCommandDefault{\textinterrobang} + {\tc@check@symbol{8}\textinterrobang} % \end{macrocode} % % Fonts with this sub-encoding don't have a Euro symbol, but % instead of substituting we fake it. % \begin{macrocode} \DeclareTextCommandDefault{\texteuro} - {\CheckEncodingSubset\UseTextSymbol{TS1}\tc@fake@euro{8}\texteuro} + {\CheckEncodingSubset\UseTextSymbol{TS1}\tc@fake@euro{8}\texteuro} % \end{macrocode} % % @@ -782,13 +875,20 @@ % \subsection{Sub-encoding \texttt{9} (most missing)} % % \begin{macrocode} -\DeclareTextCommandDefault{\textcelsius}{\tc@check@symbol{9}\textcelsius} -\DeclareTextCommandDefault{\textonesuperior}{\tc@check@symbol{9}\textonesuperior} -\DeclareTextCommandDefault{\textthreequartersemdash}{\tc@check@symbol{9}\textthreequartersemdash} -\DeclareTextCommandDefault{\textthreesuperior}{\tc@check@symbol{9}\textthreesuperior} -\DeclareTextCommandDefault{\texttwelveudash}{\tc@check@symbol{9}\texttwelveudash} -\DeclareTextCommandDefault{\texttwosuperior}{\tc@check@symbol{9}\texttwosuperior} -\DeclareTextCommandDefault{\textbardbl}{\tc@check@symbol{9}\textbardbl} +\DeclareTextCommandDefault{\textcelsius} + {\tc@check@symbol{9}\textcelsius} +\DeclareTextCommandDefault{\textonesuperior} + {\tc@check@symbol{9}\textonesuperior} +\DeclareTextCommandDefault{\textthreequartersemdash} + {\tc@check@symbol{9}\textthreequartersemdash} +\DeclareTextCommandDefault{\textthreesuperior} + {\tc@check@symbol{9}\textthreesuperior} +\DeclareTextCommandDefault{\texttwelveudash} + {\tc@check@symbol{9}\texttwelveudash} +\DeclareTextCommandDefault{\texttwosuperior} + {\tc@check@symbol{9}\texttwosuperior} +\DeclareTextCommandDefault{\textbardbl} + {\tc@check@symbol{9}\textbardbl} % \end{macrocode} % % @@ -832,18 +932,18 @@ % \end{macrocode} % These have Unicode slots so this should be integrated into TU explicitly % \begin{macrocode} -\DeclareTextSymbol{\textpilcrow} \UnicodeEncodingName{"00B6} -\DeclareTextSymbol{\textborn} \UnicodeEncodingName{"002A} -\DeclareTextSymbol{\textdied} \UnicodeEncodingName{"2020} -\DeclareTextSymbol{\textlbrackdbl} \UnicodeEncodingName{"27E6} -\DeclareTextSymbol{\textrbrackdbl} \UnicodeEncodingName{"27E7} -\DeclareTextSymbol{\textguarani} \UnicodeEncodingName{"20B2} +\DeclareTextSymbol{\textpilcrow} \UnicodeEncodingName{"00B6} +\DeclareTextSymbol{\textborn} \UnicodeEncodingName{"002A} +\DeclareTextSymbol{\textdied} \UnicodeEncodingName{"2020} +\DeclareTextSymbol{\textlbrackdbl} \UnicodeEncodingName{"27E6} +\DeclareTextSymbol{\textrbrackdbl} \UnicodeEncodingName{"27E7} +\DeclareTextSymbol{\textguarani} \UnicodeEncodingName{"20B2} % \end{macrocode} % We could make \cs{textcentoldstyle} and \cs{textdollaroldstyle} % point to dollar and cent in the Unicode encoding % \begin{macrocode} -%\DeclareTextSymbol{\textcentoldstyle} \UnicodeEncodingName{"00A2} -%\DeclareTextSymbol{\textdollaroldstyle} \UnicodeEncodingName{"0024} +%\DeclareTextSymbol{\textcentoldstyle} \UnicodeEncodingName{"00A2} +%\DeclareTextSymbol{\textdollaroldstyle}\UnicodeEncodingName{"0024} % \end{macrocode} % but I think it is better to pick them up from TS1 even if that % usually means LMR fonts @@ -908,7 +1008,8 @@ \DeclareEncodingSubset{TS1}{lmss} {1} \DeclareEncodingSubset{TS1}{lmssq} {1} \DeclareEncodingSubset{TS1}{lmvtt} {1} -\DeclareEncodingSubset{TS1}{lmtt} {1} % missing TM, SM, pertenthousand for some reason +\DeclareEncodingSubset{TS1}{lmtt} {1} % missing TM, SM and + % pertenthousand for some reason % \end{macrocode} % % \begin{macrocode} @@ -918,33 +1019,33 @@ % \end{macrocode} % % \begin{macrocode} -\DeclareEncodingSubset{TS1}{bch} {5} % tofu for blank, ohm -\DeclareEncodingSubset{TS1}{futj} {5} % tofu for blank, interrobang/down, ohm -\DeclareEncodingSubset{TS1}{futs} {5} % tofu for blank, ohm -\DeclareEncodingSubset{TS1}{futx} {5} % probably (currently broken distrib) -\DeclareEncodingSubset{TS1}{pag} {5} % tofu for blank, interrobang/down, ohm -\DeclareEncodingSubset{TS1}{pbk} {5} % tofu for blank, interrobang/down, ohm -\DeclareEncodingSubset{TS1}{pcr} {5} % tofu for blank, interrobang/down, ohm -\DeclareEncodingSubset{TS1}{phv} {5} % tofu for blank, interrobang/down, ohm -\DeclareEncodingSubset{TS1}{pnc} {5} % tofu for blank, interrobang/down, ohm -\DeclareEncodingSubset{TS1}{pplj} {5} % tofu for blank -\DeclareEncodingSubset{TS1}{pplx} {5} % tofu for blank -\DeclareEncodingSubset{TS1}{ppl} {5} % tofu for blank interrobang/down -\DeclareEncodingSubset{TS1}{ptm} {5} % tofu for blank, interrobang/down, ohm -\DeclareEncodingSubset{TS1}{pzc} {5} % tofu for blank, interrobang/down, ohm -\DeclareEncodingSubset{TS1}{ul9} {5} % tofu for blank, interrobang/down, ohm +\DeclareEncodingSubset{TS1}{bch} {5} % tofu for blank, ohm +\DeclareEncodingSubset{TS1}{futj}{5} % tofu for blank, interrobang/down, ohm +\DeclareEncodingSubset{TS1}{futs}{5} % tofu for blank, ohm +\DeclareEncodingSubset{TS1}{futx}{5} % probably (currently broken distrib) +\DeclareEncodingSubset{TS1}{pag} {5} % tofu for blank, interrobang/down, ohm +\DeclareEncodingSubset{TS1}{pbk} {5} % tofu for blank, interrobang/down, ohm +\DeclareEncodingSubset{TS1}{pcr} {5} % tofu for blank, interrobang/down, ohm +\DeclareEncodingSubset{TS1}{phv} {5} % tofu for blank, interrobang/down, ohm +\DeclareEncodingSubset{TS1}{pnc} {5} % tofu for blank, interrobang/down, ohm +\DeclareEncodingSubset{TS1}{pplj}{5} % tofu for blank +\DeclareEncodingSubset{TS1}{pplx}{5} % tofu for blank +\DeclareEncodingSubset{TS1}{ppl} {5} % tofu for blank interrobang/down +\DeclareEncodingSubset{TS1}{ptm} {5} % tofu for blank, interrobang/down, ohm +\DeclareEncodingSubset{TS1}{pzc} {5} % tofu for blank, interrobang/down, ohm +\DeclareEncodingSubset{TS1}{ul9} {5} % tofu for blank, interrobang/down, ohm % \end{macrocode} % % \begin{macrocode} -\DeclareEncodingSubset{TS1}{dayroms} {6} % tofu for blank, interrobang/down, ohm -\DeclareEncodingSubset{TS1}{dayrom} {6} % tofu for blank, interrobang/down, ohm +\DeclareEncodingSubset{TS1}{dayroms}{6} % tofu for blank, interrobang/down, ohm +\DeclareEncodingSubset{TS1}{dayrom} {6} % tofu for blank, interrobang/down, ohm % \end{macrocode} % % \begin{macrocode} -\DeclareEncodingSubset{TS1}{augie} {8} % really only missing euro -\DeclareEncodingSubset{TS1}{put} {8} -\DeclareEncodingSubset{TS1}{uag} {8} % probably (currently broken distrib) -\DeclareEncodingSubset{TS1}{ugq} {8} +\DeclareEncodingSubset{TS1}{augie}{8} % really only missing euro +\DeclareEncodingSubset{TS1}{put} {8} +\DeclareEncodingSubset{TS1}{uag} {8} % probably (currently broken distrib) +\DeclareEncodingSubset{TS1}{ugq} {8} % \end{macrocode} % % \begin{macrocode} @@ -976,14 +1077,14 @@ % substituted. % % \begin{macrocode} -\DeclareEncodingSubset{TS1}{lato-*} {0} % with a bunch of tofu inside -\DeclareEncodingSubset{TS1}{opensans-*} {0} % with a bunch of tofu inside -\DeclareEncodingSubset{TS1}{cantarell-*} {0} % with a bunch of tofu inside -\DeclareEncodingSubset{TS1}{fbb-*} {0} % missing centoldstyle +\DeclareEncodingSubset{TS1}{lato-*} {0} % with a bunch of tofu inside +\DeclareEncodingSubset{TS1}{opensans-*} {0} % with a bunch of tofu inside +\DeclareEncodingSubset{TS1}{cantarell-*} {0} % with a bunch of tofu inside +\DeclareEncodingSubset{TS1}{fbb-*} {0} % missing centoldstyle % \end{macrocode} % % \begin{macrocode} -\DeclareEncodingSubset{TS1}{tli} {1} % with lots of tofu inside +\DeclareEncodingSubset{TS1}{tli} {1} % with lots of tofu inside % \end{macrocode} % % \begin{macrocode} @@ -1109,7 +1210,7 @@ \DeclareEncodingSubset{TS1}{erewhon-*} {7} \DeclareEncodingSubset{TS1}{ComicNeue-TLF} {7} \DeclareEncodingSubset{TS1}{ComicNeueAngular-TLF} {7} -\DeclareEncodingSubset{TS1}{Forum-LF} {7} % the superiors are missing +\DeclareEncodingSubset{TS1}{Forum-LF} {7} % the superiors are missing % \end{macrocode} % % \begin{macrocode} @@ -1237,26 +1338,32 @@ %<latexrelease>\let\textbrokenbar\@undefined %<latexrelease>\let\textcelsius\@undefined %<latexrelease>\let\textcent\@undefined -%<latexrelease>\DeclareTextCommandDefault{\textcopyright}{\textcircled{c}} +%<latexrelease>\DeclareTextCommandDefault{\textcopyright} +%<latexrelease> {\textcircled{c}} %<latexrelease>\let\textdegree\@undefined %<latexrelease>\let\textdiv\@undefined %<latexrelease>\let\textlnot\@undefined %<latexrelease>\let\textonehalf\@undefined %<latexrelease>\let\textonequarter\@undefined %<latexrelease>\let\textonesuperior\@undefined -%<latexrelease>\DeclareTextCommandDefault{\textordfeminine}{\textsuperscript{a}} -%<latexrelease>\DeclareTextCommandDefault{\textordmasculine}{\textsuperscript{o}} +%<latexrelease>\DeclareTextCommandDefault{\textordfeminine} +%<latexrelease> {\textsuperscript{a}} +%<latexrelease>\DeclareTextCommandDefault{\textordmasculine} +%<latexrelease> {\textsuperscript{o}} %<latexrelease>\let\textpm\@undefined %<latexrelease>\let\textquotesingle\@undefined %<latexrelease>\let\textquotestraightbase\@undefined %<latexrelease>\let\textquotestraightdblbase\@undefined -%<latexrelease>\DeclareTextCommandDefault{\textregistered}{\textcircled{% -%<latexrelease> \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}} +%<latexrelease>\DeclareTextCommandDefault{\textregistered} +%<latexrelease> {\textcircled{% +%<latexrelease> \check@mathfonts\fontsize\sf@size\z@ +%<latexrelease> \math@fontsfalse\selectfont R}} %<latexrelease>\let\textthreequartersemdash\@undefined %<latexrelease>\let\textthreequarters\@undefined %<latexrelease>\let\textthreesuperior\@undefined %<latexrelease>\let\texttimes\@undefined -%<latexrelease>\DeclareTextCommandDefault{\texttrademark}{\textsuperscript{TM}} +%<latexrelease>\DeclareTextCommandDefault{\texttrademark} +%<latexrelease> {\textsuperscript{TM}} %<latexrelease>\let\texttwelveudash\@undefined %<latexrelease>\let\texttwosuperior\@undefined %<latexrelease>\let\textyen\@undefined @@ -1433,9 +1540,12 @@ % kernel is info only). Using the package options you can change this behavior. % \changes{v2.0n}{2020/02/05}{Changed the package default to info (gh/262)} % \begin{macrocode} -\DeclareOption{error}{\gdef\tc@errorwarn{\PackageError{textcomp}}} -\DeclareOption{warn}{\gdef\tc@errorwarn#1#2{\PackageWarning{textcomp}{#1}}} -\DeclareOption{info}{\gdef\tc@errorwarn#1#2{\PackageInfo{textcomp}{#1}}} +\DeclareOption{error} + {\gdef\tc@errorwarn{\PackageError{textcomp}}} +\DeclareOption{warn} + {\gdef\tc@errorwarn#1#2{\PackageWarning{textcomp}{#1}}} +\DeclareOption{info} + {\gdef\tc@errorwarn#1#2{\PackageInfo{textcomp}{#1}}} \DeclareOption{quiet}{\gdef\tc@errorwarn#1#2{}} % \end{macrocode} % @@ -1773,7 +1883,7 @@ % to ensure that |\textcurrency| is only typeset if the current % font has a \texttt{TS1} subset id of less than 3. Otherwise % |\tc@error| is called telling the user that for this font family -% |\textcurreny| is not available. +% |\textcurrency| is not available. % \begin{macrocode} \def\tc@check@symbol{\CheckEncodingSubset\UseTextSymbol{TS1}\tc@subst} \def\tc@check@accent{\CheckEncodingSubset\UseTextAccent{TS1}\tc@error} @@ -2008,7 +2118,7 @@ % % Finally input the encoding-specific definitions for % \texttt{TS1} thus making the top-level definitions -% optimised for this encoding (and not for the default +% optimized for this encoding (and not for the default % encoding). % \changes{v1.9o}{1998/03/20}{Load decls after defaults for speed.} % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex-dev/base/ltthm.dtx b/Master/texmf-dist/source/latex-dev/base/ltthm.dtx index c33ea4202fd..00fe97c77af 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltthm.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltthm.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltvers.dtx b/Master/texmf-dist/source/latex-dev/base/ltvers.dtx index df57faf23b4..26eaee98901 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltvers.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltvers.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltvers.dtx} - [2020/12/05 v1.1e LaTeX Kernel (Version Info)] + [2021/01/15 v1.1e LaTeX Kernel (Version Info)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltvers.dtx} @@ -115,7 +115,7 @@ {2021-05-01} %</2ekernel|latexrelease> %<*2ekernel> -\def\patch@level{-1} +\def\patch@level{-2} % \end{macrocode} % % \begin{macro}{\development@branch@name} @@ -181,28 +181,30 @@ % \begin{macrocode} \ifnum0\ifnum\patch@level=0 \ifx\development@branch@name\@empty 1\fi\fi>0 % \everyjob\expandafter{\the\everyjob - \typeout{\fmtname \space<\fmtversion>}} + \typeout{\fmtname\space <\fmtversion>}} \immediate \write16{\fmtname \space<\fmtversion>} \else\ifnum\patch@level>0 \everyjob\expandafter{\the\everyjob - \typeout{\fmtname \space<\fmtversion> patch level \patch@level}} + \typeout{\fmtname\space <\fmtversion> patch level \patch@level}} \immediate - \write16{\fmtname \space<\fmtversion> patch level \patch@level} + \write16{\fmtname\space <\fmtversion> patch level \patch@level} \else \everyjob\expandafter{\the\everyjob - \typeout{\fmtname \space<\fmtversion> pre-release-\number-\patch@level\space - \ifx\development@branch@name\@undefined \else - \ifx\development@branch@name\@empty \else - \space (\development@branch@name\space branch)% + \typeout{\fmtname\space <\fmtversion> + pre-release-\number-\patch@level\space + \ifx\development@branch@name\@undefined \else + \ifx\development@branch@name\@empty \else + \space (\development@branch@name\space branch)% \fi \fi }} \immediate - \write16{\fmtname \space<\fmtversion> pre-release-\number-\patch@level\space - \ifx\development@branch@name\@undefined \else - \ifx\development@branch@name\@empty \else - \space (\development@branch@name\space branch)% + \write16{\fmtname\space <\fmtversion> + pre-release-\number-\patch@level\space + \ifx\development@branch@name\@undefined \else + \ifx\development@branch@name\@empty \else + \space (\development@branch@name\space branch)% \fi \fi } diff --git a/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx b/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx index e00f9bcb9f9..7a21f7d871f 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/ltxref.dtx b/Master/texmf-dist/source/latex-dev/base/ltxref.dtx index 4e78deec4ad..dd482299b28 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltxref.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltxref.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/makeindx.dtx b/Master/texmf-dist/source/latex-dev/base/makeindx.dtx index c4a76ffabef..e8e48e60b06 100644 --- a/Master/texmf-dist/source/latex-dev/base/makeindx.dtx +++ b/Master/texmf-dist/source/latex-dev/base/makeindx.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -28,7 +28,7 @@ % \fi %\iffalse % Copyright (C) 1985 by Leslie Lamport -% Copyright (C) 1994-98 by \LaTeX3 Project and Johannes Braams +% Copyright (C) 1994-98 by LaTeX Project and Johannes Braams %\fi % % \changes{1.0b}{1994/01/21}{added a missing \cs{end\{macro\}}, a diff --git a/Master/texmf-dist/source/latex-dev/base/makeindx.ins b/Master/texmf-dist/source/latex-dev/base/makeindx.ins index 771e3b12c6e..427d4c79674 100644 --- a/Master/texmf-dist/source/latex-dev/base/makeindx.ins +++ b/Master/texmf-dist/source/latex-dev/base/makeindx.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/newdc.ins b/Master/texmf-dist/source/latex-dev/base/newdc.ins index 0ea49996610..e2ce183f05e 100644 --- a/Master/texmf-dist/source/latex-dev/base/newdc.ins +++ b/Master/texmf-dist/source/latex-dev/base/newdc.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/newlfont.dtx b/Master/texmf-dist/source/latex-dev/base/newlfont.dtx index 085d2348ba8..3b6e001075b 100644 --- a/Master/texmf-dist/source/latex-dev/base/newlfont.dtx +++ b/Master/texmf-dist/source/latex-dev/base/newlfont.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/nfssfont.dtx b/Master/texmf-dist/source/latex-dev/base/nfssfont.dtx index 09d91dc51d5..554c7ae8f07 100644 --- a/Master/texmf-dist/source/latex-dev/base/nfssfont.dtx +++ b/Master/texmf-dist/source/latex-dev/base/nfssfont.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/nfssfont.ins b/Master/texmf-dist/source/latex-dev/base/nfssfont.ins index 24a2e115e07..7d1b9cc41ae 100644 --- a/Master/texmf-dist/source/latex-dev/base/nfssfont.ins +++ b/Master/texmf-dist/source/latex-dev/base/nfssfont.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/olddc.ins b/Master/texmf-dist/source/latex-dev/base/olddc.ins index 7401e29f6d6..d878507d8e3 100644 --- a/Master/texmf-dist/source/latex-dev/base/olddc.ins +++ b/Master/texmf-dist/source/latex-dev/base/olddc.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/oldlfont.dtx b/Master/texmf-dist/source/latex-dev/base/oldlfont.dtx index 56204af7ae4..d04ddb6323b 100644 --- a/Master/texmf-dist/source/latex-dev/base/oldlfont.dtx +++ b/Master/texmf-dist/source/latex-dev/base/oldlfont.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/preload.dtx b/Master/texmf-dist/source/latex-dev/base/preload.dtx index 22554b429fd..b2ca24bce5b 100644 --- a/Master/texmf-dist/source/latex-dev/base/preload.dtx +++ b/Master/texmf-dist/source/latex-dev/base/preload.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/proc.dtx b/Master/texmf-dist/source/latex-dev/base/proc.dtx index 814006e411b..7a1329fb82c 100644 --- a/Master/texmf-dist/source/latex-dev/base/proc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/proc.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -28,8 +28,8 @@ % \fi % % \iffalse -% Copyright (C) 1991,1992 by Leslie Lamport \and -% Copyright (C) 1994-2020 by the \LaTeX3 project \and Johannes Braams +% Copyright (C) 1991,1992 by Leslie Lamport and +% Copyright (C) 1994-2020 by the LaTeX Project and Johannes Braams % % \changes{v1.1}{1994/01/25}{Made `proc' a document class and provide % a .sty file for compatibility mode} diff --git a/Master/texmf-dist/source/latex-dev/base/proc.ins b/Master/texmf-dist/source/latex-dev/base/proc.ins index b9c3cbe0645..cfed5bd6a39 100644 --- a/Master/texmf-dist/source/latex-dev/base/proc.ins +++ b/Master/texmf-dist/source/latex-dev/base/proc.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/slides.dtx b/Master/texmf-dist/source/latex-dev/base/slides.dtx index 9c83a3d851a..883e7d34f04 100644 --- a/Master/texmf-dist/source/latex-dev/base/slides.dtx +++ b/Master/texmf-dist/source/latex-dev/base/slides.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -28,7 +28,7 @@ % \fi % % \iffalse -% Copyright (C) 1994-97 LaTeX3 project, Frank Mittelbach +% Copyright (C) 1994-97 LaTeX Project, Frank Mittelbach % and Rainer Sch\"opf, all rights reserved. % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex-dev/base/slides.ins b/Master/texmf-dist/source/latex-dev/base/slides.ins index 1213d4f4d90..43ec2bebdf8 100644 --- a/Master/texmf-dist/source/latex-dev/base/slides.ins +++ b/Master/texmf-dist/source/latex-dev/base/slides.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. @@ -97,7 +97,7 @@ extension .ins) which are part of the distribution. This is a generated file. Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. @@ -139,7 +139,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/slifonts.fdd b/Master/texmf-dist/source/latex-dev/base/slifonts.fdd index d3951cfa574..ec8b802596f 100644 --- a/Master/texmf-dist/source/latex-dev/base/slifonts.fdd +++ b/Master/texmf-dist/source/latex-dev/base/slifonts.fdd @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright 1993-2019 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -30,7 +30,7 @@ %\iffalse This is a META comment % % File `slifonts.fdd'. -% Copyright (C) 1989-1998 LaTeX3 project, Frank Mittelbach and +% Copyright (C) 1989-1998 LaTeX Project, Frank Mittelbach and % Rainer Sch\"opf, all rights reserved. % %<lcmss&!ec>\ProvidesFile{ot1lcmss.fd} diff --git a/Master/texmf-dist/source/latex-dev/base/syntonly.dtx b/Master/texmf-dist/source/latex-dev/base/syntonly.dtx index 55b2ad3cec6..b214c49ae4a 100644 --- a/Master/texmf-dist/source/latex-dev/base/syntonly.dtx +++ b/Master/texmf-dist/source/latex-dev/base/syntonly.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/syntonly.ins b/Master/texmf-dist/source/latex-dev/base/syntonly.ins index 3717d1e6fe8..6b4113ed115 100644 --- a/Master/texmf-dist/source/latex-dev/base/syntonly.ins +++ b/Master/texmf-dist/source/latex-dev/base/syntonly.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 1993-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/tulm.fdd b/Master/texmf-dist/source/latex-dev/base/tulm.fdd index 9308d801ff2..5c1566a5bad 100644 --- a/Master/texmf-dist/source/latex-dev/base/tulm.fdd +++ b/Master/texmf-dist/source/latex-dev/base/tulm.fdd @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright 2016-2019 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -30,7 +30,7 @@ %\iffalse This is a META comment % % File `cmfonts.fdd'. -% Copyright (C) 2016-2019 LaTeX3 Project +% Copyright (C) 2016-2019 LaTeX Project % % %<TUlmr>\ProvidesFile{tulmr.fd} @@ -51,7 +51,7 @@ \title{The file \texttt{tulm.fdd} for use with \LaTeXe.\thanks{This file has version number \fileversion, dated \filedate.}} -\date{\filedate}\author{LaTeX3 Project} +\date{\filedate}\author{\LaTeX\ Project} \addtolength\textwidth{30pt} \begin{document} \MaintainedByLaTeXTeam{latex} diff --git a/Master/texmf-dist/source/latex-dev/base/tulm.ins b/Master/texmf-dist/source/latex-dev/base/tulm.ins index 1c4e45e8c42..98962f2b207 100644 --- a/Master/texmf-dist/source/latex-dev/base/tulm.ins +++ b/Master/texmf-dist/source/latex-dev/base/tulm.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 2016-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. @@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs.html Copyright (C) 2016-2021 -The LaTeX3 Project and any individual authors listed elsewhere +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/unpack.ins b/Master/texmf-dist/source/latex-dev/base/unpack.ins index 9df3403f5b3..6332fcb5c00 100644 --- a/Master/texmf-dist/source/latex-dev/base/unpack.ins +++ b/Master/texmf-dist/source/latex-dev/base/unpack.ins @@ -4,7 +4,7 @@ %% LaTeX or TeX. %% %% Copyright (C) 1993-2021 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the LaTeX base system. diff --git a/Master/texmf-dist/source/latex-dev/base/utf8ienc.dtx b/Master/texmf-dist/source/latex-dev/base/utf8ienc.dtx index cd11cb0f2ae..79c725915c7 100644 --- a/Master/texmf-dist/source/latex-dev/base/utf8ienc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/utf8ienc.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1993-2021 -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the LaTeX base system. @@ -216,7 +216,7 @@ %<+ts1> \ProvidesFile{ts1enc.dfu} %<+x2> \ProvidesFile{x2enc.dfu} %<+all> \ProvidesFile{utf8enc.dfu} -%<-utf8-2018> [2020/11/26 v1.2k UTF-8 support for inputenc] +%<-utf8-2018> [2021/01/27 v1.2l UTF-8 support for inputenc] % \end{macrocode} % % \begin{macrocode} @@ -1137,7 +1137,7 @@ % \changes{v1.1q}{2015/12/02}{Add remaining latin uses of accents in T1} % \changes{v1.1r}{2015/12/03}{Add some more ogonek cases} % \changes{v1.1s}{2016/01/11}{Add some more caron and acute} -% \changes{v1.1t}{2017/01/28}{Add caron cominations for GgYy} +% \changes{v1.1t}{2017/01/28}{Add caron combinations for GgYy} % \begin{macrocode} %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00A0}{\nobreakspace} %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00A1}{\textexclamdown} @@ -1701,6 +1701,18 @@ %<all,ts1>\DeclareUnicodeCharacter{0E3F}{\textbaht} %<all,t1>\DeclareUnicodeCharacter{1E02}{\.B} %<all,t1>\DeclareUnicodeCharacter{1E03}{\.b} +% \end{macrocode} +% \changes{v1.2k}{2021/01/27}{Added various additional dot accents (gh/484)} +% \begin{macrocode} +%<all,t1>\DeclareUnicodeCharacter{1E0D}{\d d} +%<all,t1>\DeclareUnicodeCharacter{1E25}{\d h} +%<all,t1>\DeclareUnicodeCharacter{1E37}{\d l} +%<all,t1>\DeclareUnicodeCharacter{1E43}{\d m} +%<all,t1>\DeclareUnicodeCharacter{1E45}{\.n} +%<all,t1>\DeclareUnicodeCharacter{1E47}{\d n} +%<all,t1>\DeclareUnicodeCharacter{1E5B}{\d r} +%<all,t1>\DeclareUnicodeCharacter{1E63}{\d s} +%<all,t1>\DeclareUnicodeCharacter{1E6D}{\d t} %<all,t1>\DeclareUnicodeCharacter{1E9E}{\SS} %<all,x2,t2c,t2b,t2a,t1,utf8>\DeclareUnicodeCharacter{200C}{\textcompwordmark} % \end{macrocode} diff --git a/Master/texmf-dist/source/latex-dev/tools/afterpage.dtx b/Master/texmf-dist/source/latex-dev/tools/afterpage.dtx index 600d221cb63..e5fa69f5152 100644 --- a/Master/texmf-dist/source/latex-dev/tools/afterpage.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/afterpage.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/afterpage.ins b/Master/texmf-dist/source/latex-dev/tools/afterpage.ins index 96cba1ed0ca..0cfc531f193 100644 --- a/Master/texmf-dist/source/latex-dev/tools/afterpage.ins +++ b/Master/texmf-dist/source/latex-dev/tools/afterpage.ins @@ -3,8 +3,8 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright (C) 1993-2020 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% Copyright (C) 1993-2021 +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the Standard LaTeX `Tools Bundle'. @@ -45,8 +45,8 @@ The source is maintained by the LaTeX Project team and bug reports for it can be opened at https://latex-project.org/bugs/ (but please observe conditions on bug reports sent to that address!) -Copyright (C) 1993-2020 -The LaTeX3 Project and any individual authors listed elsewhere +Copyright (C) 1993-2021 +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/array.dtx b/Master/texmf-dist/source/latex-dev/tools/array.dtx index ff963d7f514..1ca08036d95 100644 --- a/Master/texmf-dist/source/latex-dev/tools/array.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/array.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. @@ -33,7 +33,7 @@ %<+package>\DeclareCurrentRelease{}{2020-10-01} %<+package> %<+package>\ProvidesPackage{array} -%<+package> [2020/10/01 v2.5c Tabular extension package (FMi)] +%<+package> [2021/02/10 v2.5d Tabular extension package (FMi)] % % \fi % @@ -188,7 +188,7 @@ % David Carlisle\thanks{David kindly agreed on the inclusion % of the \texttt{\textbackslash{}newcolumntype} implementation, % formerly in -% \texttt{newarray.sty} into this package }} +% \texttt{newarray.sty} into this package.}} % % \date{Printed \today} % @@ -361,6 +361,56 @@ % columns have predefined widths. % \end{itemize} % +% +% \subsection{The behavior of the \texttt{\string\\} command} +% +% In the basic \texttt{tabular} implementation of \LaTeX{} the \cs{\bslash} +% command ending the rows of the \texttt{tabular} or \texttt{array} has +% a somewhat inconsistent behavior if its optional argument is used. The +% result then depends on the type of rightmost column and as remarked in +% Leslie Lamport's \LaTeX{} manual~\cite{bk:lamport} may not always produce the +% expected extra space. +% +% +% Without the \textsf{array} package the extra space requested by the +% optional argument of \cs{\bslash} is measured from the last baseline of +% the rightmost column (indicated by ``x'' in the following +% example). As a result, swapping the column will give different +% results: +% \begin{verbatim} +% \begin{tabular}[t]{lp{1cm}} +% 1 & 1\newline x \\[20pt] 2 & 2 \end{tabular} +% \begin{tabular}[t]{p{1cm}l} +% 1\newline 1 & x \\[20pt] 2 & 2 \end{tabular} +% \end{verbatim} +% \pagebreak +% If you run this without the \textsf{array} package you will get the +% following result: +% \begin{center} +% \begin{tabular}[t]{lp{1cm}} +% 1 & 1\newline x \\[32pt] 2 & 2 \end{tabular} +% \begin{tabular}[t]{p{1cm}l} +% 1\newline 1 & x \\[20pt] 2 & 2 \end{tabular} +% \end{center} +% In contrast, when the \textsf{array} package is loaded, the requested +% space in the optional argument is always measured from the baseline of +% the whole row and not from the last baseline of the rightmost column, thus +% swapping columns doesn't change the spacing and we same table height +% with an effective 8pt of extra space (as the second line already takes +% up 12pt of the requested 20pt): +% \begin{center} +% \begin{tabular}[t]{lp{1cm}} +% 1 & 1\newline x \\[20pt] 2 & 2 \end{tabular} +% \begin{tabular}[t]{p{1cm}l} +% 1\newline 1 & x \\[20pt] 2 & 2 \end{tabular} +% \end{center} +% +% This correction of behavior only makes a difference if the rightmost column +% is a \texttt{p}-column. Thus if you add the \textsf{array} +% package to an existing document, you should verify the spacing in all +% tables that have this kind of structure. +% +% % \subsection{Defining new column specifiers} % % \DeleteShortVerb{\=} @@ -1958,8 +2008,9 @@ % \changes{v2.2d}{1994/05/16}{Use \LaTeXe \cs{@finalstrut}} % \changes{v2.3g}{1996/05/07}{Add \cs{hfil} for tools/2120} % \changes{v2.4i}{2018/09/13}{Add group to prevent color leak (gh/72)} +% \changes{v2.5d}{2021/02/10}{Explicitly run \cs{par} at the end of pboxes} % \begin{macrocode} -\def\@endpbox{\@finalstrut\@arstrutbox \color@endgroup \egroup\hfil} +\def\@endpbox{\@finalstrut\@arstrutbox \par \color@endgroup \egroup\hfil} % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex-dev/tools/bm.dtx b/Master/texmf-dist/source/latex-dev/tools/bm.dtx index 096f6c4bc2a..80c73f57189 100644 --- a/Master/texmf-dist/source/latex-dev/tools/bm.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/bm.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/bm.ins b/Master/texmf-dist/source/latex-dev/tools/bm.ins index e963d1d88e2..c00a3e5cca4 100644 --- a/Master/texmf-dist/source/latex-dev/tools/bm.ins +++ b/Master/texmf-dist/source/latex-dev/tools/bm.ins @@ -3,8 +3,8 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright (C) 1993-2020 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% Copyright (C) 1993-2021 +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the Standard LaTeX `Tools Bundle'. @@ -45,8 +45,8 @@ The source is maintained by the LaTeX Project team and bug reports for it can be opened at https://latex-project.org/bugs/ (but please observe conditions on bug reports sent to that address!) -Copyright (C) 1993-2020 -The LaTeX3 Project and any individual authors listed elsewhere +Copyright (C) 1993-2021 +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/calc.dtx b/Master/texmf-dist/source/latex-dev/tools/calc.dtx index 62fe27489b2..78b6167fe6f 100644 --- a/Master/texmf-dist/source/latex-dev/tools/calc.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/calc.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. @@ -25,7 +25,7 @@ %% Copyright (C) 1992--1995 %% Kresten Krab Thorup and Frank Jensen. %% Copyright (C) 1997--2007 -%% Kresten Krab Thorup, Frank Jensen and the LaTeX3 Project. +%% Kresten Krab Thorup, Frank Jensen and the LaTeX Project. %% %% The original authors (fj@hugin.dk and krab@daimi.aau.dk) have %% contributed this package to the LaTeX distribution. diff --git a/Master/texmf-dist/source/latex-dev/tools/dcolumn.dtx b/Master/texmf-dist/source/latex-dev/tools/dcolumn.dtx index 1899cce5560..069e633221d 100644 --- a/Master/texmf-dist/source/latex-dev/tools/dcolumn.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/dcolumn.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/delarray.dtx b/Master/texmf-dist/source/latex-dev/tools/delarray.dtx index 17cac2052cb..cc503707b0d 100644 --- a/Master/texmf-dist/source/latex-dev/tools/delarray.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/delarray.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/enumerate.dtx b/Master/texmf-dist/source/latex-dev/tools/enumerate.dtx index 3ce463e6015..150a7386b83 100644 --- a/Master/texmf-dist/source/latex-dev/tools/enumerate.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/enumerate.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/fileerr.dtx b/Master/texmf-dist/source/latex-dev/tools/fileerr.dtx index 16a95e28203..d9163041161 100644 --- a/Master/texmf-dist/source/latex-dev/tools/fileerr.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/fileerr.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/fontsmpl.dtx b/Master/texmf-dist/source/latex-dev/tools/fontsmpl.dtx index a5fb2964a98..b7208267736 100644 --- a/Master/texmf-dist/source/latex-dev/tools/fontsmpl.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/fontsmpl.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/ftnright.dtx b/Master/texmf-dist/source/latex-dev/tools/ftnright.dtx index e5fffdfcd92..e8da56aa204 100644 --- a/Master/texmf-dist/source/latex-dev/tools/ftnright.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/ftnright.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. @@ -314,7 +314,7 @@ % \newblock Addison-Wesley, Reading, Massachusetts, 1986. % % \bibitem{src:ltxiii94} -% \LaTeX3 project. +% \LaTeX\ Project. % \newblock \LaTeXe distribution, 1994. % \newblock Sources for {\LaTeXe} the successor to \LaTeX~2.09. % diff --git a/Master/texmf-dist/source/latex-dev/tools/hhline.dtx b/Master/texmf-dist/source/latex-dev/tools/hhline.dtx index b9234b5aa25..98d68024515 100644 --- a/Master/texmf-dist/source/latex-dev/tools/hhline.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/hhline.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/indentfirst.dtx b/Master/texmf-dist/source/latex-dev/tools/indentfirst.dtx index 7123be04c54..e54df284ae1 100644 --- a/Master/texmf-dist/source/latex-dev/tools/indentfirst.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/indentfirst.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/layout.dtx b/Master/texmf-dist/source/latex-dev/tools/layout.dtx index 8918ffdca48..6962674255b 100644 --- a/Master/texmf-dist/source/latex-dev/tools/layout.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/layout.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. @@ -30,7 +30,7 @@ %<+package>\ProvidesPackage{layout} %<+driver>\ProvidesFile{layout.drv} %\ProvidesFile{layout.dtx} - [2014/10/28 v1.2c Show layout parameters] + [2020-07-25 v1.2d Show layout parameters] % % A short driver is provided that can be extracted if necessary by % the \textsf{DocStrip} program provided with \LaTeXe. @@ -54,6 +54,17 @@ % \changes{v1.1d}{1994/09/08}{Stored texts in control sequences to % allow other languages} % +% \makeatletter +% \def\allowtofu{^^A +%\def\UTFviii@undefined@err##1{^^A +% \PackageWarning{inputenc}{Unicode character \expandafter +% \UTFviii@splitcsname\string##1\relax +% \MessageBreak +% not set up for use with LaTeX}^^A +% \raisebox{.8pt}{\fboxsep1pt\kern.1pt\fbox{$\cdot$}\kern.1pt}^^A +% }} +% \makeatother +% % \GetFileInfo{layout.dtx} % \title{Displaying page layout variables} % \author{Kent McPherson a.o.\thanks{Converted for \LaTeXe\ by @@ -172,6 +183,20 @@ \def\notshown{non mostrato} } % \end{macrocode} +% +% \changes{v1.2d}{2020-07-25}{Added option for Japanese (gh353)} +% \begin{allowtofu} +% \begin{macrocode} +\DeclareOption{japanese}{% + \def\Headertext{天} + \def\Bodytext{基本版面} + \def\Footertext{地} + \def\MarginNotestext{傍\\注} + \def\oneinchtext{1インチ} + \def\notshown{非表示} + } +% \end{macrocode} +% \end{allowtofu} % % This package has an option \Lopt{verbose}. Using it will make the % command |\layout| type some of the parameters on the terminal. diff --git a/Master/texmf-dist/source/latex-dev/tools/longtable.dtx b/Master/texmf-dist/source/latex-dev/tools/longtable.dtx index 004d630fcec..c236aabb205 100644 --- a/Master/texmf-dist/source/latex-dev/tools/longtable.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/longtable.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. @@ -27,11 +27,17 @@ \ProvidesFile{longtable.dtx} %</dtx> %<package>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<package>\providecommand\DeclareRelease[3]{} +%<package>\providecommand\DeclareCurrentRelease[2]{} +%<package> +%<package>\DeclareRelease{}{2020-01-02}{longtable-2020-01-07.sty} +%<package>\DeclareCurrentRelease{}{2020-02-07} +%<package> %<package>\ProvidesPackage{longtable} %<driver> \ProvidesFile{longtable.drv} % \fi % \ProvidesFile{longtable.dtx} - [2020/01/07 v4.13 Multi-page Table package (DPC)] + [2020-02-07 v4.14 Multi-page Table package (DPC)] % % \iffalse %<*driver> @@ -303,7 +309,7 @@ % (see below), the "LTchunksize" must be at least as large as the % number of rows in each of the head or foot sections. % -% This document specifies "\setcounter{LTchunksize}{10}". If you look +% This document specifies "\setcounter{LTchunksize}{200}". If you look % at the previous table, after the \emph{first} run of \LaTeX\ you will % see that various parts of the table do not line up. % \LaTeX\ will also have printed a warning that the column @@ -877,9 +883,11 @@ % \end{macro} % % \begin{macro}{\LTchunksize} -% Chunk size (The number of rows taken per "\halign"). Default 20. +% \changes{v4.14}{2020/02/07} +% {Increase default chunksize from 20 to 200} +% Chunk size (The number of rows taken per "\halign"). Default 200. % \begin{macrocode} -\newcount\LTchunksize \LTchunksize=20 +\newcount\LTchunksize \LTchunksize=200 % \end{macrocode} % \end{macro} % @@ -916,6 +924,14 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\LT@gbox} +% \changes{v4.14}{2020/02/07} +% {global box added (tools/2914)} +% \begin{macrocode} +\newbox\LT@gbox +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\LT@cols} % Counter for number of columns. % \begin{macrocode} @@ -1212,7 +1228,7 @@ % \end{macro} % % \begin{macro}{\LT@start} -% % \changes{v4.13}{2020/01/07} +% \changes{v4.13}{2020/01/07} % {fix issue https://github.com/davidcarlisle/dpctex/issues/8} % This macro starts the process of putting the table on the current % page. It is not called until either a "\\" or "\endlongtable" command @@ -1228,6 +1244,34 @@ \let\LT@start\endgraf \endgraf\penalty\z@\vskip\LTpre\endgraf % \end{macrocode} +% \changes{v4.14}{2020/02/07} +% {Guard against shrink glue on current page tools/3396 and github 183} +% This next block was suggested by Lars Hellström in pr tools/3396 +% He documents it as: +% +% The original problem occurs because TeX has not yet found an awfully bad +% "(b=*)" breakpoint and is therefore still collecting material to see if there +% is a really good break somewhere just ahead. As we know there aren't, we +% want to make it stop looking and break the page, so that "\pagetotal" will be +% for the page where the table will actually end up. To achieve this, we +% need to give \TeX\ an awfully bad, but legal, breakpoint. The simplest way of +% doing this seems to be to insert a "\kern" that counters the "\pageshrink" for +% the page, followed by a "\penalty" and a "\par" (to exercise the page builder). +% We also have to make sure that this breakpoint doesn't affect how the next +% page is broken, so we make the penalty 9999 (10000 is infinite and thus not +% a legal breakpoint) and cancel out the "\kern" with a new "\kern". +% +% I don't think this is the \emph{right} solution to the problem (that would be +% that the standard output routine has a feature for syncronizing with +% typesetting, as part of the preparations for switching output routine), but +% it's OK. Perhaps XOR will make it better. +% \begin{macrocode} + \ifdim \pagetotal<\pagegoal \else + \dimen@=\pageshrink + \advance \dimen@ 1sp % + \kern\dimen@\penalty 9999\endgraf \kern-\dimen@ + \fi +% \end{macrocode} % Start a new page if there is not enough room for the table head, foot, % and one extra line. % \begin{macrocode} @@ -1259,7 +1303,18 @@ % % \begin{macrocode} \advance\dimen@ -\pagegoal - \ifdim \dimen@>\z@\vfil\break\fi + \ifdim \dimen@>\z@ + \vfil\break + \else +% \end{macrocode} +% +% \changes{v4.14}{2020/02/07} +% {Guard against shrink glue on current page see github 183} +% The LT output routine does not handle shrink on the page, which can cause +% The first page to be over-long, so forget it is there. +% \begin{macrocode} + \ifdim\pageshrink>\z@\pageshrink\z@\fi + \fi % \end{macrocode} % Store height of page minus table foot in "\@colroom". % \changes{v3.14}{1995/05/02} @@ -1269,9 +1324,12 @@ % \end{macrocode} % If the foot is non empty, reduce the "\vsize" and "\@colroom" % accordingly. +% \changes{v4.14}{2020/02/07} +% {Rearrange vertical space tests for tools/3512 (floats on same page)} % \begin{macrocode} \ifvoid\LT@foot\else - \advance\vsize-\ht\LT@foot +% \advance\vsize-\ht\LT@foot + \global\advance\vsize-\ht\LT@foot \global\advance\@colroom-\ht\LT@foot \dimen@\pagegoal\advance\dimen@-\ht\LT@foot\pagegoal\dimen@ \maxdepth\z@ @@ -1350,8 +1408,15 @@ \fi % \end{macrocode} % Force one more go with the \env{longtable} output routine. +% \changes{v4.14}{2020/02/07} +% {Rearrange vertical space tests for tools/3512 (floats on same page)} % \begin{macrocode} \endgraf\penalty -\LT@end@pen + \ifvoid\LT@foot\else + \global\advance\vsize\ht\LT@foot + \global\advance\@colroom\ht\LT@foot + \dimen@\pagegoal\advance\dimen@\ht\LT@foot\pagegoal\dimen@ + \fi % \end{macrocode} % Now close the group to return to the standard routine. % \begin{macrocode} @@ -1361,9 +1426,11 @@ % table.\footnote{This can not be the correct. However if it is omitted, % there is a problem with marginpars, for example on page~3 of this % document. Any Output Routine Gurus out there?} +% \changes{v4.14}{2020/02/07} +% {Rearrange vertical space tests for tools/3512 (floats on same page)} % \begin{macrocode} \global\@mparbottom\z@ - \pagegoal\vsize +% \pagegoal\vsize \endgraf\penalty\z@\addvspace\LTpost % \end{macrocode} % Footnotes. As done in the \package{multicol} package. @@ -1452,6 +1519,8 @@ % \begin{macro}{\LT@setprevdepth} % \changes{v4.05}{1996/11/12} % {Macro added} +% \changes{v4.14}{2020/02/07} +% {spurious \cs{global} removed} % This will be redefined to set the "\prevdepth" % at the start of a chunk. % \begin{macrocode} @@ -1471,7 +1540,7 @@ \global\advance\LT@rows\@ne \ifnum\LT@rows=\LTchunksize \gdef\LT@setprevdepth{% - \prevdepth\z@\global + \prevdepth\z@ \global\let\LT@setprevdepth\relax}% \expandafter\LT@xtabularcr \else @@ -1528,11 +1597,13 @@ % \begin{macro}{\LT@echunk} % \changes{v4.05}{1996/11/12} % {\cs{unskip} added for pagebreak support} +% \changes{v4.14}{2020/02/07} +% {allocated global box (tools/2914)} % This ends the current chunk, and removes the dummy row. % \begin{macrocode} \def\LT@echunk{% \crcr\LT@save@row\cr\egroup - \global\setbox\@ne\lastbox + \global\setbox\LT@gbox\lastbox % \end{macrocode} % The following line was added in v4.05. % \package{longtable} relies on "\lineskip" glue (which is 0pt) to @@ -1753,9 +1824,11 @@ % Loop through the last row, discarding glue, and saving box widths. At % V3.04 changed the scratch box to 2, as the new "\kill" requires that % "\box0" be preserved. +% \changes{v4.14}{2020/02/07} +% {allocated global box (tools/2914)} % \begin{macrocode} \setbox\tw@\hbox{% - \unhbox\@ne + \unhbox\LT@gbox \let\LT@old@row\LT@save@row \global\let\LT@save@row\@empty \count@\LT@cols @@ -1973,13 +2046,17 @@ % vsplit off a bit of the last chunk, so that the last page did not just % have head and foot sections, but it is hard to do this in a consistent % manner.} +% \changes{v4.14}{2020/02/07} +% {Rearrange vertical space tests for tools/3512 (floats on same page)} % \begin{macrocode} \dimen@\pagegoal + \advance\dimen@\ht\LT@foot \advance\dimen@-\ht\LT@lastfoot \ifdim\dimen@<\ht\z@ \setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot\vss}% \@makecol \@outputpage + \global\vsize\@colroom \setbox\z@\vbox{\box\LT@head}% % \end{macrocode} % End of "\ifdim\dimen@<\ht\@cclc". @@ -1993,14 +2070,17 @@ % Reset "\@colroom". % \changes{v3.14}{1995/05/02} % {Reset \cs{@colroom}, for tools/1584} +% \changes{v4.14}{2020/02/07} +% {Rearrange vertical space tests for tools/3512 (floats on same page)} % \begin{macrocode} - \global\@colroom\@colht - \global\vsize\@colht +% \global\@colroom\@colht +% \global\vsize\@colht % \end{macrocode} % Put the last page of the table on to the main vertical list. +% \changes{v4.14}{2020/02/07} +% {Remove box from final page tools/3512} % \begin{macrocode} - \vbox - {\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}% + \unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi % \end{macrocode} % End of "\ifnum\outputpenalty > -\LT@end@pen". % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex-dev/tools/longtable.ins b/Master/texmf-dist/source/latex-dev/tools/longtable.ins index 7ada121ea95..92a04e00d4e 100644 --- a/Master/texmf-dist/source/latex-dev/tools/longtable.ins +++ b/Master/texmf-dist/source/latex-dev/tools/longtable.ins @@ -3,8 +3,8 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright (C) 1993-2020 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% Copyright (C) 1993-2021 +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the Standard LaTeX `Tools Bundle'. @@ -45,8 +45,8 @@ The source is maintained by the LaTeX Project team and bug reports for it can be opened at https://latex-project.org/bugs/ (but please observe conditions on bug reports sent to that address!) -Copyright (C) 1993-2020 -The LaTeX3 Project and any individual authors listed elsewhere +Copyright (C) 1993-2021 +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/multicol.dtx b/Master/texmf-dist/source/latex-dev/tools/multicol.dtx index 39bccef2d78..1d16a01c158 100644 --- a/Master/texmf-dist/source/latex-dev/tools/multicol.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/multicol.dtx @@ -77,7 +77,7 @@ %% not for the payment of a license fee per se (which might or might %% not follow from this evaluation). %% -%% The license fee, if any, can be payed either to the LaTeX3 fund +%% The license fee, if any, can be payed either to the LaTeX fund %% (see ltx3info.txt in the base LaTeX distribution) or to the author of %% the program who can be contacted at %% diff --git a/Master/texmf-dist/source/latex-dev/tools/multicol.ins b/Master/texmf-dist/source/latex-dev/tools/multicol.ins index f872b83cdee..c8838f8be22 100644 --- a/Master/texmf-dist/source/latex-dev/tools/multicol.ins +++ b/Master/texmf-dist/source/latex-dev/tools/multicol.ins @@ -3,8 +3,8 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright (C) 1993-2020 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% Copyright (C) 1993-2021 +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the Standard LaTeX `Tools Bundle'. @@ -45,8 +45,8 @@ The source is maintained by the LaTeX Project team and bug reports for it can be opened at https://latex-project.org/bugs/ (but please observe conditions on bug reports sent to that address!) -Copyright (C) 1993-2020 -The LaTeX3 Project and any individual authors listed elsewhere +Copyright (C) 1993-2021 +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/rawfonts.dtx b/Master/texmf-dist/source/latex-dev/tools/rawfonts.dtx index 9c5daa57a50..f54aeaf44db 100644 --- a/Master/texmf-dist/source/latex-dev/tools/rawfonts.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/rawfonts.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/shellesc.dtx b/Master/texmf-dist/source/latex-dev/tools/shellesc.dtx index 3b96c3e9ee3..54027cada76 100644 --- a/Master/texmf-dist/source/latex-dev/tools/shellesc.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/shellesc.dtx @@ -1,8 +1,8 @@ % \iffalse %% Source File: shellesc.dtx -%% Copyright (C) 2015-2020 +%% Copyright (C) 2015-2021 %% -%% The LaTeX3 Project and any individual authors listed elsewhere +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file may be distributed under the terms of the LPPL. @@ -36,7 +36,7 @@ % \title{The \textsf{shellesc} Package\thanks{This file % has version number \fileversion, last % revised \filedate.}} -% \author{\LaTeX3 project} +% \author{\LaTeX\ project} % \date{\filedate} % % diff --git a/Master/texmf-dist/source/latex-dev/tools/showkeys.dtx b/Master/texmf-dist/source/latex-dev/tools/showkeys.dtx index 59eb699ae81..3c9236f2ef4 100644 --- a/Master/texmf-dist/source/latex-dev/tools/showkeys.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/showkeys.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. @@ -22,7 +22,7 @@ % \fi % \iffalse %% File: showkeys.dtx Copyright (C) 1992-1997 David Carlisle -%% File: showkeys.dtx Copyright (C) 2006-2019 David Carlisle, LaTeX3 Project +%% File: showkeys.dtx Copyright (C) 2006-2019 David Carlisle, LaTeX Project % %<*dtx> \ProvidesFile{showkeys.dtx} diff --git a/Master/texmf-dist/source/latex-dev/tools/somedefs.dtx b/Master/texmf-dist/source/latex-dev/tools/somedefs.dtx index 120ad980781..825a93ec666 100644 --- a/Master/texmf-dist/source/latex-dev/tools/somedefs.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/somedefs.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/tabularx.dtx b/Master/texmf-dist/source/latex-dev/tools/tabularx.dtx index 577730e665b..a0f75fc4fa6 100644 --- a/Master/texmf-dist/source/latex-dev/tools/tabularx.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/tabularx.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/tabularx.ins b/Master/texmf-dist/source/latex-dev/tools/tabularx.ins index 05effd3342e..a0d39c2564a 100644 --- a/Master/texmf-dist/source/latex-dev/tools/tabularx.ins +++ b/Master/texmf-dist/source/latex-dev/tools/tabularx.ins @@ -3,8 +3,8 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright (C) 1993-2020 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% Copyright (C) 1993-2021 +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the Standard LaTeX `Tools Bundle'. @@ -45,8 +45,8 @@ The source is maintained by the LaTeX Project team and bug reports for it can be opened at https://latex-project.org/bugs/ (but please observe conditions on bug reports sent to that address!) -Copyright (C) 1993-2020 -The LaTeX3 Project and any individual authors listed elsewhere +Copyright (C) 1993-2021 +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/theorem.dtx b/Master/texmf-dist/source/latex-dev/tools/theorem.dtx index 0df7dbb7649..8543ff9d7cb 100644 --- a/Master/texmf-dist/source/latex-dev/tools/theorem.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/theorem.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/tools.ins b/Master/texmf-dist/source/latex-dev/tools/tools.ins index 5e978712215..15c64ac80ab 100644 --- a/Master/texmf-dist/source/latex-dev/tools/tools.ins +++ b/Master/texmf-dist/source/latex-dev/tools/tools.ins @@ -3,8 +3,8 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright (C) 1993-2020 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% Copyright (C) 1993-2021 +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the Standard LaTeX `Tools Bundle'. @@ -49,8 +49,8 @@ reports for it can be opened at https://latex-project.org/bugs/ (but please observe conditions on bug reports sent to that address!) -Copyright (C) 1993-2020 -The LaTeX3 Project and any individual authors listed elsewhere +Copyright (C) 1993-2021 +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/trace.dtx b/Master/texmf-dist/source/latex-dev/tools/trace.dtx index 4a08f569bb5..7ab6e18e25b 100644 --- a/Master/texmf-dist/source/latex-dev/tools/trace.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/trace.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/varioref.dtx b/Master/texmf-dist/source/latex-dev/tools/varioref.dtx index 2bba60465e0..eac06580e73 100644 --- a/Master/texmf-dist/source/latex-dev/tools/varioref.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/varioref.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/varioref.ins b/Master/texmf-dist/source/latex-dev/tools/varioref.ins index 951eedad891..559f1f28542 100644 --- a/Master/texmf-dist/source/latex-dev/tools/varioref.ins +++ b/Master/texmf-dist/source/latex-dev/tools/varioref.ins @@ -3,8 +3,8 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright (C) 1993-2020 -%% The LaTeX3 Project and any individual authors listed elsewhere +%% Copyright (C) 1993-2021 +%% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% %% This file is part of the Standard LaTeX `Tools Bundle'. @@ -45,8 +45,8 @@ The source is maintained by the LaTeX Project team and bug reports for it can be opened at https://latex-project.org/bugs/ (but please observe conditions on bug reports sent to that address!) -Copyright (C) 1993-2020 -The LaTeX3 Project and any individual authors listed elsewhere +Copyright (C) 1993-2021 +The LaTeX Project and any individual authors listed elsewhere in this file. This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/verbatim.dtx b/Master/texmf-dist/source/latex-dev/tools/verbatim.dtx index e62886e0033..fcbaf28172e 100644 --- a/Master/texmf-dist/source/latex-dev/tools/verbatim.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/verbatim.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/xr.dtx b/Master/texmf-dist/source/latex-dev/tools/xr.dtx index a963886cde7..c0d0b90c0fc 100644 --- a/Master/texmf-dist/source/latex-dev/tools/xr.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/xr.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. diff --git a/Master/texmf-dist/source/latex-dev/tools/xspace.dtx b/Master/texmf-dist/source/latex-dev/tools/xspace.dtx index ebe8d0f9478..adcfe154da3 100644 --- a/Master/texmf-dist/source/latex-dev/tools/xspace.dtx +++ b/Master/texmf-dist/source/latex-dev/tools/xspace.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2020 +% Copyright (C) 1993-2021 % -% The LaTeX3 Project and any individual authors listed elsewhere +% The LaTeX Project and any individual authors listed elsewhere % in this file. % % This file is part of the Standard LaTeX `Tools Bundle'. |