summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-08-09 03:01:14 +0000
committerNorbert Preining <norbert@preining.info>2023-08-09 03:01:14 +0000
commit9c6ffed1253f7d203afb08f7fffc9c661c48567b (patch)
treeeffd795e39f54272c64ea1ddae648d4d6c49bd96 /macros
parent313a3ccce8935aa26c29f2e430042cffee435454 (diff)
CTAN sync 202308090301
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/apa6/README2
-rw-r--r--macros/latex/contrib/apa6/apa6.dtx30
-rw-r--r--macros/latex/contrib/apa6/apa6.ins8
-rw-r--r--macros/latex/contrib/apa6/apa6.pdfbin595965 -> 603020 bytes
-rw-r--r--macros/latex/contrib/apa6/config/APAamerican.txt4
-rw-r--r--macros/latex/contrib/apa6/config/APAbritish.txt4
-rw-r--r--macros/latex/contrib/apa6/config/APAczech.txt4
-rw-r--r--macros/latex/contrib/apa6/config/APAdutch.txt4
-rw-r--r--macros/latex/contrib/apa6/config/APAendfloat.cfg4
-rw-r--r--macros/latex/contrib/apa6/config/APAenglish.txt4
-rw-r--r--macros/latex/contrib/apa6/config/APAgerman.txt4
-rw-r--r--macros/latex/contrib/apa6/config/APAgreek.txt4
-rw-r--r--macros/latex/contrib/apa6/config/APAngerman.txt4
-rw-r--r--macros/latex/contrib/apa6/config/APAturkish.txt4
-rw-r--r--macros/latex/contrib/apa6/pseudoTeX/TeX2WordForapa6.bas4
-rw-r--r--macros/latex/contrib/apa6/pseudoTeX/apa6.ptex4
-rw-r--r--macros/latex/contrib/apa6/samples/bibliography.bib4
-rw-r--r--macros/latex/contrib/apa6/samples/longsample.tex4
-rw-r--r--macros/latex/contrib/apa6/samples/shortsample.tex4
-rw-r--r--macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdfbin8287659 -> 8285082 bytes
-rw-r--r--macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex6
-rw-r--r--macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty3
-rw-r--r--macros/latex/contrib/memoir/README106
-rw-r--r--macros/latex/contrib/memoir/doc-src/memman.tex508
-rw-r--r--macros/latex/contrib/memoir/doc-src/memsty.sty5
-rw-r--r--macros/latex/contrib/memoir/memman.pdfbin2837566 -> 2845232 bytes
-rw-r--r--macros/latex/contrib/memoir/memoir.dtx4504
-rw-r--r--macros/latex/contrib/memoir/mempatch.dtx123
-rw-r--r--macros/latex/contrib/naive-ebnf/DEPENDS.txt15
-rw-r--r--macros/latex/contrib/naive-ebnf/naive-ebnf.dtx13
-rw-r--r--macros/latex/contrib/naive-ebnf/naive-ebnf.pdfbin718356 -> 727190 bytes
-rw-r--r--macros/luatex/latex/luacomplex/README.txt9
-rw-r--r--macros/luatex/latex/luacomplex/luacomplex.pdfbin133379 -> 109293 bytes
-rw-r--r--macros/luatex/latex/luacomplex/luacomplex.sty95
-rw-r--r--macros/luatex/latex/luacomplex/luacomplex.tex53
35 files changed, 1160 insertions, 4380 deletions
diff --git a/macros/latex/contrib/apa6/README b/macros/latex/contrib/apa6/README
index c45a7bcc56..ac2ab3adc8 100644
--- a/macros/latex/contrib/apa6/README
+++ b/macros/latex/contrib/apa6/README
@@ -3,7 +3,7 @@
apa6 - A LaTeX class for formatting documents in compliance with the
American Psychological Association's Publication Manual, 6th edition
-Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/apa6.dtx b/macros/latex/contrib/apa6/apa6.dtx
index 647e6410a9..718df74936 100644
--- a/macros/latex/contrib/apa6/apa6.dtx
+++ b/macros/latex/contrib/apa6/apa6.dtx
@@ -4,11 +4,11 @@
% %
% CHANGE THESE VALUES WITH EACH NEW RELEASE: %
% %
-%<class>\ProvidesClass{apa6}[2020/01/13 v2.34 APA formatting (6th edition)]
+%<class>\ProvidesClass{apa6}[2023/08/07 v2.35 APA formatting (6th edition)]
% %
%<*internal> %
-\def\apaSixVersionDate{2020/01/13}
-\def\apaSixVersionNumber{2.34}
+\def\apaSixVersionDate{2023/08/07}
+\def\apaSixVersionNumber{2.35}
% %
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -20,7 +20,7 @@
apa6 - A LaTeX class for formatting documents in compliance with the
American Psychological Association's Publication Manual, 6th edition
-Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
@@ -64,7 +64,7 @@ details.
apa6 - A LaTeX class for formatting documents in compliance with the
American Psychological Association's Publication Manual, 6th edition
-Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
@@ -84,7 +84,7 @@ by, the American Psychological Association.
\endpreamble
\postamble
-Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
@@ -321,6 +321,9 @@ and the derived files apa6.ins,
% \changes{v2.34}{2020/01/13}{Changed biblatex loading to freeze to
% APA 6th Edition compatibility}
%
+% \changes{v2.35}{2023/08/07}{Sanitize title string (credit: Ulrike
+% Fischer)}
+%
% \begin{abstract}
% The \textit{Publication Manual} of the American Psychological
% Association is widely used in the social sciences. The most
@@ -943,6 +946,7 @@ and the derived files apa6.ins,
% non-boldface; used only if no bibliographic options have been
% specified
% \item \textsf{geometry}: formats margins
+% \item \textsf{gettitlestring}: for cleaning title references
% \item \textsf{graphicx}: allows inclusion of figures
% \item \textsf{longtable}: formats tables that exceed one page in
% length; loaded only if the |longtable| option is specified. Also
@@ -1449,6 +1453,8 @@ and the derived files apa6.ins,
\RequirePackage{graphicx} % this is for including graphics
+\RequirePackage{gettitlestring} % this helps clean up section and title references
+
\RequirePackage{booktabs} % this is for nice-looking tables
\setlength{\abovetopsep}{0pt} % set the distance between the table title and the table toprule
\setlength{\belowbottomsep}{0pt} % set the distance between the table bottomrule and any notes
@@ -2214,10 +2220,9 @@ and the derived files apa6.ins,
% \newlength{\app@t@width}
% \setlength{\app@t@width}{\columnwidth}
% \addtolength{\app@t@width}{-8em}%% leveltwo is defined with leftskip=rightskip=4em plus 1fill
- \long\def\section##1{%
- \makeatletter%
- \def\@currentlabelname{##1}%
- \makeatother%
+\long\def\section##1{%
+ \GetTitleString{##1}%
+ \let\@currentlabelname\GetTitleStringResult
\ifapamodeman{%
\clearpage
\setcounter{postfig}{0}
@@ -2759,7 +2764,8 @@ and the derived files apa6.ins,
% need the `keeplastbox' option to allow final reference to be
% properly indented on the final line
% https://tex.stackexchange.com/questions/198287/reference-and-biography-indentation-issue
-\IfFileExists{flushend.sty}{\RequirePackage[keeplastbox]{flushend}}{}
+% \IfFileExists{flushend.sty}{\RequirePackage[keeplastbox]{flushend}}{} % old package version
+\IfFileExists{flushend.sty}{\RequirePackage{flushend}}{}
%========== ftnright and alterations ==================
@@ -4766,4 +4772,4 @@ End Sub
%\end{macro}
%
%
-%\Finale
+%\Finale \ No newline at end of file
diff --git a/macros/latex/contrib/apa6/apa6.ins b/macros/latex/contrib/apa6/apa6.ins
index 6d5485881b..7fb1dbae9a 100644
--- a/macros/latex/contrib/apa6/apa6.ins
+++ b/macros/latex/contrib/apa6/apa6.ins
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -36,7 +36,7 @@
apa6 - A LaTeX class for formatting documents in compliance with the
American Psychological Association's Publication Manual, 6th edition
-Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
@@ -56,7 +56,7 @@ by, the American Psychological Association.
\endpreamble
\postamble
-Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
@@ -127,7 +127,7 @@ and the derived files apa6.ins,
}
\endbatchfile
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/apa6.pdf b/macros/latex/contrib/apa6/apa6.pdf
index d6d3fc7cf6..082c0a9fe5 100644
--- a/macros/latex/contrib/apa6/apa6.pdf
+++ b/macros/latex/contrib/apa6/apa6.pdf
Binary files differ
diff --git a/macros/latex/contrib/apa6/config/APAamerican.txt b/macros/latex/contrib/apa6/config/APAamerican.txt
index 132ff75ecf..bd16d7849a 100644
--- a/macros/latex/contrib/apa6/config/APAamerican.txt
+++ b/macros/latex/contrib/apa6/config/APAamerican.txt
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -35,7 +35,7 @@
\renewcommand{\notesname}{Footnotes}
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/config/APAbritish.txt b/macros/latex/contrib/apa6/config/APAbritish.txt
index b4fe54695d..c8255209dc 100644
--- a/macros/latex/contrib/apa6/config/APAbritish.txt
+++ b/macros/latex/contrib/apa6/config/APAbritish.txt
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -35,7 +35,7 @@
\renewcommand{\notesname}{Footnotes}
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/config/APAczech.txt b/macros/latex/contrib/apa6/config/APAczech.txt
index 242beee55c..2a8ec9e883 100644
--- a/macros/latex/contrib/apa6/config/APAczech.txt
+++ b/macros/latex/contrib/apa6/config/APAczech.txt
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -35,7 +35,7 @@
\renewcommand{\notesname}{Poznámky}% Footnotes
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/config/APAdutch.txt b/macros/latex/contrib/apa6/config/APAdutch.txt
index d8b28e16da..22270e14d3 100644
--- a/macros/latex/contrib/apa6/config/APAdutch.txt
+++ b/macros/latex/contrib/apa6/config/APAdutch.txt
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -35,7 +35,7 @@
\renewcommand{\notesname}{Voetnoten}% Footnotes
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/config/APAendfloat.cfg b/macros/latex/contrib/apa6/config/APAendfloat.cfg
index 99c937cb39..a50cb09f4c 100644
--- a/macros/latex/contrib/apa6/config/APAendfloat.cfg
+++ b/macros/latex/contrib/apa6/config/APAendfloat.cfg
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -99,7 +99,7 @@
\xdef\ef@endsidetabletest{\string\\end\string\{sidewaystable\string\}}
\xdef\ef@endlongtabletest{\string\\end\string\{longtable\string\}}}%
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/config/APAenglish.txt b/macros/latex/contrib/apa6/config/APAenglish.txt
index 68ab6237d4..3063fc7d06 100644
--- a/macros/latex/contrib/apa6/config/APAenglish.txt
+++ b/macros/latex/contrib/apa6/config/APAenglish.txt
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -35,7 +35,7 @@
\renewcommand{\notesname}{Footnotes}
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/config/APAgerman.txt b/macros/latex/contrib/apa6/config/APAgerman.txt
index f2adf9a041..f9855ea32a 100644
--- a/macros/latex/contrib/apa6/config/APAgerman.txt
+++ b/macros/latex/contrib/apa6/config/APAgerman.txt
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -35,7 +35,7 @@
\renewcommand{\notesname}{Fußnoten}% Footnotes
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/config/APAgreek.txt b/macros/latex/contrib/apa6/config/APAgreek.txt
index 665d23d965..86fcf2f436 100644
--- a/macros/latex/contrib/apa6/config/APAgreek.txt
+++ b/macros/latex/contrib/apa6/config/APAgreek.txt
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -35,7 +35,7 @@
\renewcommand{\notesname}{Uposhmei'wseis}% Footnotes
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/config/APAngerman.txt b/macros/latex/contrib/apa6/config/APAngerman.txt
index 3b697bb7c2..c166d8961f 100644
--- a/macros/latex/contrib/apa6/config/APAngerman.txt
+++ b/macros/latex/contrib/apa6/config/APAngerman.txt
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -35,7 +35,7 @@
\renewcommand{\notesname}{Fußnoten}% Footnotes
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/config/APAturkish.txt b/macros/latex/contrib/apa6/config/APAturkish.txt
index bd1674d9c1..e33976e5f6 100644
--- a/macros/latex/contrib/apa6/config/APAturkish.txt
+++ b/macros/latex/contrib/apa6/config/APAturkish.txt
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -35,7 +35,7 @@
\renewcommand{\notesname}{Dipnotlar}% Footnotes
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/pseudoTeX/TeX2WordForapa6.bas b/macros/latex/contrib/apa6/pseudoTeX/TeX2WordForapa6.bas
index 239c8976a1..5bfdffa172 100644
--- a/macros/latex/contrib/apa6/pseudoTeX/TeX2WordForapa6.bas
+++ b/macros/latex/contrib/apa6/pseudoTeX/TeX2WordForapa6.bas
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -360,7 +360,7 @@ Sub FormatAndMoveTex2WordFigures()
End Sub
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/pseudoTeX/apa6.ptex b/macros/latex/contrib/apa6/pseudoTeX/apa6.ptex
index a98b14e6f2..7775a19395 100644
--- a/macros/latex/contrib/apa6/pseudoTeX/apa6.ptex
+++ b/macros/latex/contrib/apa6/pseudoTeX/apa6.ptex
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -375,7 +375,7 @@
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/samples/bibliography.bib b/macros/latex/contrib/apa6/samples/bibliography.bib
index fe16588c9a..4f98e6901c 100644
--- a/macros/latex/contrib/apa6/samples/bibliography.bib
+++ b/macros/latex/contrib/apa6/samples/bibliography.bib
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -190,7 +190,7 @@ the design of multimedia instruction},
}
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/samples/longsample.tex b/macros/latex/contrib/apa6/samples/longsample.tex
index 38d00b8546..98b9062816 100644
--- a/macros/latex/contrib/apa6/samples/longsample.tex
+++ b/macros/latex/contrib/apa6/samples/longsample.tex
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -185,7 +185,7 @@ The detailed results are shown in Table~\ref{tab:DeckedTable}. \lipsum[22]
\end{document}
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/apa6/samples/shortsample.tex b/macros/latex/contrib/apa6/samples/shortsample.tex
index 8c21c1004c..d854761fde 100644
--- a/macros/latex/contrib/apa6/samples/shortsample.tex
+++ b/macros/latex/contrib/apa6/samples/shortsample.tex
@@ -10,7 +10,7 @@
%% apa6 - A LaTeX class for formatting documents in compliance with the
%% American Psychological Association's Publication Manual, 6th edition
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -132,7 +132,7 @@ skill in interpreting the results for the masses.
\end{document}
%%
-%% Copyright (C) 2011-2020 by Brian D. Beitzel <brian at beitzel.com>
+%% Copyright (C) 2011-2023 by Brian D. Beitzel <brian at beitzel.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
diff --git a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf
index 5e9fff73df..df8748d316 100644
--- a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf
+++ b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex
index e07a5b02c1..9b1ec0f77c 100644
--- a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex
+++ b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex
@@ -69,8 +69,8 @@
\setlength{\parindent}{0pt}
\definecolor{LightGray}{gray}{0.9}
-\def\TPversion{0.2.5}
-\def\TPdate{06 juin 2023}
+\def\TPversion{0.2.7}
+\def\TPdate{08 août 2023}
\usepackage[most]{tcolorbox}
\usepackage[outputdir=build]{minted}
@@ -209,6 +209,8 @@ Une commande pour des cartes en version \og miniatures \fg{} (individuelle, main
\part{Historique}
+{\small \bverb|v0.2.7|~:~~~~Retour en arrière sur les cartes de Tarot \textsf{v2} qui sont supprimées (pb de licence).
+
{\small \bverb|v0.2.5|~:~~~~Compatibilité des \textit{Mini}-Cartes avec les cartes avec nom anglais.
{\small \bverb|v0.2.4|~:~~~~Ajout du style carte Poker \textsf{fr} + style Bicycle \textsf{bicycl} + ajout d'une clé \textsf{<StyleJeu>}
diff --git a/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty b/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty
index ce50d3361f..daee9c4690 100644
--- a/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty
+++ b/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty
@@ -11,7 +11,8 @@
% Uno v1 cards Image's Licence.: MIT License https://eperezcosano.github.io/uno-part1/
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{JeuxCartes}[2023/06/06 v0.2.5 Jeux de cartes]
+\ProvidesPackage{JeuxCartes}[2023/08/08 v0.2.7 Jeux de cartes]
+% 0.2.7 Retour en arrière design v2 tarot (pb de licence)
% 0.2.5 Correction d'un dysfonctionnement avec le J qui peut désormais être utilisé en MiniCarte avec le Joker [en] + MiniMains [en]
% 0.2.4 Style <fr> avec cartes françaises + <bicycl> + modification des clés avec l'ajout de <StyleJeu> + Suppression xcolor
% 0.2.3 Ajout d'une option pour présenter une main "inversée" + style <v5>
diff --git a/macros/latex/contrib/memoir/README b/macros/latex/contrib/memoir/README
index b2581abbb8..0edb2a1741 100644
--- a/macros/latex/contrib/memoir/README
+++ b/macros/latex/contrib/memoir/README
@@ -16,16 +16,96 @@ more popular packages.
Lars Madsen <daleif@math.au.dk> is maintaining memoir.
- NOTE: The full User Manual (memman.pdf) is a large document of about
-550 pages in total. You do not need to print all of it, especially if you
-already have an earlier edition. Roughly speaking, the main portions are:
-o Frontmatter: Preface, Toc, Introduction, Terminology ~ 40 pages
-o Mainmatter:
- Class commands and environments, etc. ~ 380 pages
-o Appendices: (La)Tex programming, Errors and warnings ~ 40 pages
-o Backmatter:
- Command glossary ~ 40 pages
- Bibliography, indexes ~ 50 pages
+WORD OF ADVISE: It is not recommended to manually update memoir into
+an old LaTeX installation. Not all changes are compatible with older
+un-updated LaTeX systems and we often make no attempt to be backwards
+compatible. Instead we assume that users use updated memoir with an
+updated LaTeX installation.
+
+Changes (2023/08/08)
+
+o memoir v3.8
+
+-- now requires a LaTeX format from 2021/06/01 or newer.
+
+ The class will halt compilation (in all interaction modes) if the
+ format is too old.
+
+-- \titleref is now an alias for \nameref (autoloaded).
+ The class have been adjusted to provide info for sectionals and
+ normal captions.
+
+ The titleref package will remain marked as being emulated
+ as it shouldn't be used with the class (and haven't been updated in
+ 20+ years).
+
+-- nameref paches in the class are no longer needed
+
+-- label handling for subcaptions and friends have been reimplemented.
+
+-- no longer re-defines \label as per request of the LaTeX Team.
+
+-- booktabs is now loaded as a required package instead of being
+ embedded
+
+-- Fixed typo in the caption of figure 2.13. Thanks to Vladimir
+ G. Ivanović for the report.
+
+-- removed etex loading (was only loaded for kernels from before
+ 2015). The noetex class option removed as well.
+
+-- reimplemented \pagenumbering(*) as a single macro
+
+-- additions to \@xfloat is now done via a cmd/after hook if the
+ format version supports it.
+
+-- Definition of \theHpoem changed to \providecommand
+
+-- The \theH<counter> macros defined in memoir was modified to use
+ \the\value{counter} instead of just \arabic{counter} as some
+ packages change \arabic.
+
+-- \toclevel@part was actually never fixed in v3.7.19, now it is
+
+-- added \@currentcounter in various places that manually
+ set \@currentlabel (primarily footnote constructions). Reported by
+ Gustavo Barros.
+
+-- replaced hardcoded \footnotesize in \verbfootnote by \foottextfont
+
+-- made a small change to footnote formatting. Now one can use
+ \raggedright in \footnotetext to get raggedright footnotes. Use
+ with care as \raggedright does change various paragraph settings
+
+-- replaced etoolbox loading by xpatch (which loads etoolbox) as it
+ can patch more.
+
+-- Added a Hook named memoir/subcaption/aftercounter which is executed
+ after \refstepcounter in \subcaption, \subbottom, \subtop
+ etc. Requested by Gustavo Barros.
+
+-- Redefinition of \@setsize removed, was copied from setspace.sty
+ which states that it was only needed for some 209 packages.
+
+
+The following macros have been disabled (to either give a warning or
+an error).
+
+-- \namerefon and \namerefoff => warning (now always on)
+
+-- \currenttitle => error (given that many things are now "titled",
+ relying on this to get the current "title" is too risky, use proper
+ \label+\titleref instead)
+
+-- \theTitleReference => warning (was used in the old implementation
+ of \titleref and \currenttitle)
+
+
+o memhfixc v1.21
+
+-- All nameref patches have been removed
+-- provided \subfigureautorefname
+
Changes (2022/11/17)
@@ -45,12 +125,6 @@ o memhfixc v1.20
longer used in memhfixc
-WORD OF ADVISE: It is not recommended to manually update memoir into
-an old LaTeX installation. Not all changes are compatible with older
-un-updated LaTeX systems and we often make no attempt to be backwards
-compatible. Instead we assume that users use updated memoir with an
-updated LaTeX installation.
-
Changes (2022/07/29)
diff --git a/macros/latex/contrib/memoir/doc-src/memman.tex b/macros/latex/contrib/memoir/doc-src/memman.tex
index 7c04b891ff..c95b8a0dae 100644
--- a/macros/latex/contrib/memoir/doc-src/memman.tex
+++ b/macros/latex/contrib/memoir/doc-src/memman.tex
@@ -385,6 +385,143 @@ Manual last changed \svnyear/\svnmonth/\svnday
%#% extend
+%#% extstart include maintainer-remarks.tex
+
+\svnidlong
+{$Ignore: $}
+{$LastChangedDate: 2023-08-08 16:33:42 +0200 (Tue, 08 Aug 2023) $}
+{$LastChangedRevision: 772 $}
+{$LastChangedBy: daleif@math.au.dk $}
+
+\chapter{Remarks from the maintainer}
+\label{cha:remarks-from-maint}
+
+
+When Peter Wilson released the first version of \theclass{} (back in
+2021), \LaTeX{} land was very different. Updating packages outside of
+the yearly release (TeXLive) had to be done by hand. Manuals for
+packages was \emph{not} even a requirement for CTAN. Thus it made
+sense to embed the functionality from several packages and provide
+usage information about them in this very manual. Peter even added a
+lot of historical notes as well, that was later spun of as a separate
+document of its own (see \cite{MEMDESIGN}). As time progressed
+methods were set in place to make it easier to update packages during
+a release cycle and later packages and classes were required to always
+provide a suitable manual.
+
+Over the past five years I have moved several packages out from being
+embedded copies over to simply loading them as packages.\footnote{One
+ of the main reasons to do so was maintance, it is not feasible to
+ keep track of changes to an embedded package and then applying those
+ to \theclass.} As it is useful to have usage description in one
+place, we have kept that in the manual, but users should always refer
+back to the packages original manuals. Summer 2023, I moved
+\Lpack{booktabs} from embedding to loading.
+
+\fancybreak{}
+
+As of Summer 2023 (begining with \theclass\ version 3.8) things are
+changing a for \theclass. In the past 4 years (begining in 2019) the
+\LaTeX\ Team have added lot of new functionality into the \LaTeX{}
+format.\footnote{Most notably most of the \Lpack{xparse} package, plus
+ the entire \LaTeX3 programming layer.} They will continue to add
+extra features to the kernel that are going to be very useful in the
+future, both at the level of class and package writers, but also at
+user level. As such we would like to begin using these new features
+without having to also provide backwards compatibility for those (few)
+users who manually update \theclass.\footnote{Overleaf users should be
+ aware that Overleaf does not update packages or kernels on their
+ \LaTeX\ images. So if we say the cut off is summer 2021, Overleaf
+ might not have the correct kernel update in their version of TeXLive
+ 2021.}
+
+Counting from version 3.8 we will therefore now require users to have
+a modern \LaTeX{} kernel installed. For \theclass\ version 3.8 a user
+who manually updates \theclass\ will need to have a \LaTeX\ format
+released by 2021/06/01 or later. If the version is too old \theclass\
+will halt the compilatiion to force users to react to the error and
+not just ignore it.\footnote{Most \LaTeX\ editors incuding OverLeaf
+ use \texttt{-interaction=nonstopmode}, aka try do make a PDF even if
+ there are compilation errors. On old kernels, \theclass\ will end
+ even this! } In case we would like to use functionality that are in
+a even newer formats, we will make sure that these macros are provided
+by the class (eventhough they may do nothing unless you have the
+proper kernel).
+
+Going forward a main goal of the \LaTeX\ Team is the ability to tag
+PDF files. The \theclass~class will also have to be adapted to become
+compatible with this feature. For version~3.8 this required us to
+rework how \cmd{\titleref} was implemted as we should no longer
+redefine \cmd{\label}.\footnote{\cmd{\titleref} is now an alias for
+ \cmd{\nameref} (from the \Lpack{nameref} package), a package which
+ is maintained in close relation with \Lpack{hyperref}.}
+
+\fancybreak{}
+
+Additionally, going forward I will additionally be starting to look at
+removing certain functionality from \theclass. This will be things
+that does not really belong in \theclass, users should really get this
+functionality from somewhere else (some additional package). Unless it
+is clear that the macro has to go due to reimplemantation of a
+feature, the removal will be announced in advance (say 12--18 months),
+by adding a warning to the macro (especially if we would like the user
+to use a different macro). It will also be marked in the manual that
+the macro/environment will be removed in a future release.
+
+% Macros and environments currently under consideration (but not marked
+% yet) include: \begingroup
+% \renewcommand\descriptionlabel[1]{\hspace\labelsep\parbox[t]{\dimexpr\textwidth-5pt\relax}{#1}}
+% \begin{description}
+% \item[\cmd{\patchcommand}]
+% Users should use \cmd{\pretocmd} and \cmd{\apptocmd} from
+% \Lpack{etoolbox}. The \Lpack{xpatch} package even have extended
+% versions of them.
+% \item[ctabular]
+% This is a breakable version of \Pe{tabular} but with not way of
+% replicating the table header like for example \Lpack{longtable}
+% can. These days there are several packages to handles tables.
+% \item[\cmd{\newloglike}]
+% \item[\cmd{\provideloglike}]
+% Users should really use \cmd{\DeclareMathOperator} from
+% \Lpack{amsopn} (autoloaded by the ever present \Lpack{amsmath}).
+% \end{description}
+% \endgroup
+
+\begin{flushright}
+ Summer 2023
+
+ /daleif
+\end{flushright}
+
+
+\section*{Public interfaces removed/disabled in v3.8}
+
+The four title macros was disabled due to the \cmd{\titleref} reimplementation.
+\begingroup
+\renewcommand\descriptionlabel[1]{\hspace\labelsep\parbox[t]{\dimexpr\textwidth-5pt\relax}{#1}}
+\begin{description}
+\item[\cmd{\currenttitle}] Would have given the title of the current
+ sectional devide. Too risky to rely on, use
+ \cmd{\label}+\cmd{\titleref} instead. Throws an error if used.
+\item[\cmd{\namerefon}, \cmd{\namerefoff}]
+ These could turn sectional title referencing on/off. As we now load
+ \Lpack{nameref} by default, the value is always on. Both macros now
+ just give a warning.
+\item[\cmd{\theTitleReference}]
+ Could control the look of \cmd{\titleref}. Does nothing but issue a warning.
+\item[\texttt{noetex} (class option)] We only loaded \Lpack{etex} for
+ formats before 2015. The package loading and the class option have
+ been removed.
+\end{description}
+\endgroup
+
+
+
+
+
+
+
+%#% extend
%#% extstart include preface.tex
%\chapter{Foreword}
@@ -1314,8 +1451,8 @@ been answered.
\svnidlong
{$Ignore: $}
-{$LastChangedDate: 2019-11-14 18:06:44 +0100 (Thu, 14 Nov 2019) $}
-{$LastChangedRevision: 662 $}
+{$LastChangedDate: 2023-08-06 15:24:34 +0200 (Sun, 06 Aug 2023) $}
+{$LastChangedRevision: 767 $}
{$LastChangedBy: daleif@math.au.dk $}
\chapter{Introduction to the eighth edition}
@@ -1755,7 +1892,7 @@ The following packages are automatically loaded by the class:
\Lpack{array}
\item \Lpack{dcolumn}
\item \Lpack{delarray}
- \item \Lpack{etex}
+% \item \Lpack{etex}
% \item \Lpack{ifetex}
% \item \Lpack{ifxetex}
% \item \Lpack{ifpdf}
@@ -1763,6 +1900,11 @@ The following packages are automatically loaded by the class:
\item \Lpack{iftex}
\item \Lpack{tabularx}
\item \Lpack{textcase}~(with~\texttt{overload}~option)
+ \item \Lpack{xpatch}~(it~autoloads~\Lpack{etoolbox})
+ \item \Lpack{booktabs}
+ \item \Lpack{nameref}
+ \item \Lpack{mparhack}~(if~twocolumn)
+ \item \Lpack{memhfixc}~(if~\Lpack{hyperref}~is~loaded)
\end{lineitems}
\end{center}
@@ -2054,12 +2196,15 @@ track of memoir related matters.
\fancybreak{}
-\textit{From the maintainer:} Most \Mname\ related questions
-should go to \url{http://tex.stackexchange.com}, please remember to
-tag them properly, that really helps locating the \Mname\ related
-questions. If no-one comes up with an answer, you can also write me
+Most \Mname\ related questions should go to
+\url{http://tex.stackexchange.com}, please remember to tag them
+properly, that really helps locating the \Mname\ related questions. If
+no-one comes up with an answer, you can also write the maintainer
directly via \texttt{daleif (at) math dot au dot dk}.
+See also \emph{\titleref{cha:remarks-from-maint}} on
+page~\pageref{cha:remarks-from-maint} for furher information from the
+maintainer.
%#% extend
@@ -2907,8 +3052,8 @@ want to put \cmd{\raggedbottom} in the preamble\index{preamble}.
\svnidlong
{$Ignore: $}
-{$LastChangedDate: 2020-03-25 19:00:55 +0100 (Wed, 25 Mar 2020) $}
-{$LastChangedRevision: 686 $}
+{$LastChangedDate: 2023-07-27 17:07:49 +0200 (Thu, 27 Jul 2023) $}
+{$LastChangedRevision: 757 $}
{$LastChangedBy: daleif@math.au.dk $}
\chapter{Laying out the page} \label{chap:layingpage}
@@ -3069,14 +3214,16 @@ same parameters on a verso page.
\centering
\oddpagelayoutfalse
\drawstock
-\caption{The \textsf{memoir} class page layout parameters for a verso page} \label{fig:evenstock}
+\caption{The \textsf{memoir} class page layout parameters for a verso
+ (left hand) page} \label{fig:evenstock}
\end{figure}
\begin{figure}
\centering
%%%\drawmarginparsfalse
\drawstock
-\caption{The \textsf{memoir} class page layout parameters for a recto page} \label{fig:oddstock}
+\caption{The \textsf{memoir} class page layout parameters for a recto
+ (right hand) page} \label{fig:oddstock}
\end{figure}
@@ -4933,7 +5080,7 @@ code below, and then the result was scaled down.
\caption{Example of the nine \cs{setpageXX} macros for placing
a trimmed page on the stock. These are all odd pages, under
\Lopt{twoside}, even pages will have the left/right trims
- reversed. The outer fra indicate the stock size. Inside the trim
+ reversed. The outer frames indicate the stock size. Inside the trim
marks hint at where the page is positioned on the stock.}
\label{fig:setpage}
\end{figure}
@@ -18333,8 +18480,8 @@ package can be used with the class, but there are a few caveats:
\svnidlong
{$Ignore: $}
-{$LastChangedDate: 2018-09-06 15:05:23 +0200 (Thu, 06 Sep 2018) $}
-{$LastChangedRevision: 612 $}
+{$LastChangedDate: 2023-08-03 11:37:58 +0200 (Thu, 03 Aug 2023) $}
+{$LastChangedRevision: 765 $}
{$LastChangedBy: daleif@math.au.dk $}
@@ -18379,8 +18526,14 @@ documentation of these packages.
We have kept the documentation we had written for the manual (and
updated it slightly), but refer to \cite{ARRAY}, \cite{DELARRAY}, \cite{TABULARX} and
\cite{DCOLUMN} for the 100\% up to date documentation.
+
+ As of Summer 2023: The \Lpack{booktabs} package is now loaded
+ instead of embedded. The code was an exact copy.
\end{note}
+
+
+
\fancybreak{}
@@ -19228,7 +19381,8 @@ Dy & 66 & 0.930 & & Pt & 78 & 1.160 \\
rules and
wrote the \Lpack{booktabs} package~\cite{BOOKTABS} to provide
better horizontal rules. Like many typographers, he abhors vertical rules.
-The following is taken almost verbatim from the \Lpack{booktabs} package.
+The following is taken almost verbatim from the \Lpack{booktabs}
+package which as of Summer 2023 is automatically loaded (was embedded).
\index{table!rule|(}
@@ -20358,8 +20512,8 @@ illustrate these points.
\svnidlong
{$Ignore: $}
-{$LastChangedDate: 2021-03-22 14:24:31 +0100 (Mon, 22 Mar 2021) $}
-{$LastChangedRevision: 706 $}
+{$LastChangedDate: 2023-07-27 17:07:49 +0200 (Thu, 27 Jul 2023) $}
+{$LastChangedRevision: 757 $}
{$LastChangedBy: daleif@math.au.dk $}
\chapter{Page notes} \label{chap:mnotes}
@@ -20596,6 +20750,12 @@ paragraph\index{footnotes!as a paragraph} after the
\cmd{\paragraphfootnotes} declaration. The default style is used after
the \cmd{\plainfootnotes} declaration.
+\begin{caveat}
+ Following \cmd{\paragraphfootnotes} the footnotes should only be a
+ single paragraph each.
+\end{caveat}
+
+
The style can be changed at any
time but there may be odd effects if the change is made in the middle of
a page when there are footnotes before and after the declaration. You may
@@ -20865,6 +21025,18 @@ The first line of a paragraph within a footnote is indented by
The text in the footnote\index{footnote!text!font} is typeset using
the \cmd{\foottextfont} font. The default is \cmd{\footnotesize}.
+\leavevmode\Added{Summer 2023} In case you wanted the footnotes to be
+typeset ragged right you can use
+\begin{lcode}
+ \renewcommand\foottextfont{\footnotesize\raggedright}
+\end{lcode}
+Just be aware that (1) \cmd{\raggedright} has an effect on paragraph
+settings, so things like \cmd{\parindent} might need to be reset to
+\cmd{\footparindent} after \cmd{\raggedright}. (2) Column footnotes
+are already in ragged right. (3) \cmd{\raggedright} should never be
+used with paragraph footnotes.
+
+
Altogether, the class specifies
\begin{lcode}
@@ -25946,9 +26118,9 @@ In increasing or decreasing order of probability (your choice) they are:
\svnidlong
{$Ignore: $}
-{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
-{$LastChangedRevision: 442 $}
-{$LastChangedBy: daleif $}
+{$LastChangedDate: 2023-07-27 17:07:49 +0200 (Thu, 27 Jul 2023) $}
+{$LastChangedRevision: 757 $}
+{$LastChangedBy: daleif@math.au.dk $}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Cross referencing} \label{chap:xref}
@@ -26146,71 +26318,94 @@ The chapter \textit{\titleref{chap:bringhurst}} describes \ldots
\end{lcode}
The chapter \textit{\titleref{chap:bringhurst}} describes \ldots
- There are two packages, \Lpack{nameref}~\cite{NAMEREF} and
-\Lpack{titleref}~\cite{TITLEREF},
- that let you refer to things by name instead of number.
-
- Name references were added to the class as a consequence of adding
-a second optional argument to the sectioning commands. I found
-that this broke the \Lpack{nameref} package, and hence the
-\Lpack{hyperref} package as well, so they had to be fixed. The change
-also broke Donald Arseneau's \Lpack{titleref} package, and it turned out
-that \Lpack{nameref} also clobbered \Lpack{titleref}. The class also
-provides titles, like \cmd{\poemtitle}, that are not recognised by
-either of the packages. From my viewpoint the most efficient
-thing to do was to enable the class itself to provide name
-referencing.
+% There are two packages, \Lpack{nameref}~\cite{NAMEREF} and
+% \Lpack{titleref}~\cite{TITLEREF}, that let you refer to things by name
+% instead of number. Over time \Lpack{nameref} has turned out to be the
+% industry standard.
+\begin{Changed}[Summer 2023]
+ We are now autoloading the \Lpack{nameref} (see \cite{NAMEREF}) and
+ uses that for our implementation for \cmd{\titleref} (it is just an
+ alias for \cmd{\nameref}).\footnotemark
+\end{Changed}
+\footnotetext{This change fixes several incompatability issues we've
+ had with the old implementation of \cs{titleref}, which needed a
+ redefinition of \cs{label} to work. For the coming PDF-tagging
+ project such redefinitions of kernel macros like \cs{label} is
+ frowned upon. At their end the kernel team has updated \cmd{\label}
+ for even easier sopport for \Lpack{nameref}.}
\begin{syntax}
-\cmd{\titleref}\marg{labstr} \\
+\cmd{\titleref}\marg{labstr} \qquad
+\cmd{\titleref*}\marg{labstr} \\
\end{syntax}
\glossary(titleref)%
{\cs{titleref}\marg{labstr}}%
{Prints the (section, or other) title of the number associated
- with \meta{labstr} from a \cs{label}.}
+ with \meta{labstr} from a \cs{label}.}%
+\glossary(titleref*)%
+ {\cs{titleref*}\marg{labstr}}%
+ {Similar to \cs{titleref}, but if \protect\Lpack{hyperref} is loaded this
+ does \emph{not} add a hyperlink. Mapped onto \cs{nameref*}.}
The macro \cmd{\titleref} is a class addition to the usual set of
cross referencing commands. Instead of printing a number it typesets
the title associated with the labelled number. This is really only useful
if there \emph{is} a title, such as from a \cmd{\caption} or
-\cmd{\section} command. For example, look at this code
-and its result.
+\cmd{\section} command. The starred version is for when
+\Lpack{hyperref} is loaded, then the starred version does \emph{not}
+create a hyperlink. If \Lpack{hyperref} is \emph{not} loaded, then the
+two macros does the same thing.
-\begin{egsource}{eg:sec:nxref:1}
-Labels may be applied to:
-\begin{enumerate}
-\item Chapters, sections, etc. \label{sec:nxref:1}
-...
-\item Items in numbered lists, etc. \ldots \label{sec:nxref:5}
-\end{enumerate}
-Item \ref{sec:nxref:1} in section \textit{\titleref{sec:nxref}}
-mentions sections while item \titleref{sec:nxref:5}, on page
-\pageref{sec:nxref:5} in the same section, mentions things like
-items in enumerated lists that should not be referenced
-by \verb?\titleref?.
-\end{egsource}
-\begin{egresult}[Named references should be to titled elements]{eg:sec:nxref:1}
-Labels may be applied to:
-\begin{enumerate}
-\item Chapters, sections, etc. \label{sec:nxref:1}
-\item Captions
-\item Legends
-\item Poem titles
-\item Items in numbered lists, etc. \ldots \label{sec:nxref:5}
-\end{enumerate}
-Item \ref{sec:nxref:1} in section \textit{\titleref{sec:nxref}}
-mentions sections while item\index{reference!unexpected result}
-\titleref{sec:nxref:5}, on page
-\pageref{sec:nxref:5} in the same section, mentions things like
-items in enumerated lists
-that should not be referenced by \verb?\titleref?.
-\end{egresult}
- As the above example shows, you have to be a little careful in using
-\cmd{\titleref}.
-Generally speaking, \cmd{\titleref}\marg{key} produces the last named
-thing before the \cmd{\label} that defines the \meta{key}.
+
+% For an example, look at this code and its result.
+% \begin{egsource}{eg:sec:nxref:1}
+% Labels may be applied to:
+% \begin{enumerate}
+% \item Chapters, sections, etc. \label{sec:nxref:1}
+% ...
+% \item Items in numbered lists, etc. \ldots \label{sec:nxref:5}
+% \end{enumerate}
+% Item \ref{sec:nxref:1} in section \textit{\titleref{sec:nxref}}
+% mentions sections while item \titleref{sec:nxref:5}, on page
+% \pageref{sec:nxref:5} in the same section, mentions things like
+% items in enumerated lists that should not be referenced
+% by \verb?\titleref?.
+% \end{egsource}
+
+% \begin{egresult}[Named references should be to titled elements]{eg:sec:nxref:1}
+% Labels may be applied to:
+% \begin{enumerate}
+% \item Chapters, sections, etc. \label{sec:nxref:1}
+% \item Captions
+% \item Legends
+% \item Poem titles
+% \item Items in numbered lists, etc. \ldots \label{sec:nxref:5}
+% \end{enumerate}
+% Item \ref{sec:nxref:1} in section \textit{\titleref{sec:nxref}}
+% mentions sections while item\index{reference!unexpected result}
+% \titleref{sec:nxref:5}, on page
+% \pageref{sec:nxref:5} in the same section, mentions things like
+% items in enumerated lists
+% that should not be referenced by \verb?\titleref?.
+% \end{egresult}
+
+
+%\newpage
+
+
+There can be three possibilities for the name of a sectional division;
+the full name, the name in the \toc, and the name in the page header.
+Aka
+\begin{verbatim}
+\section[toc][header]{title}
+\end{verbatim}
+Following the tradition used by \Lpack{nameref}\footnote{The old
+ \cmd{\titleref} implementation did the same.} we generally use the
+title for the \toc{}. This corresponds to the default setting
+\cmd{\tocnameref}. Issuing \cmd{\headnameref} we instead use the
+header (if available) when preparing the title for the label.
\begin{syntax}
\cmd{\headnameref} \cmd{\tocnameref} \\
@@ -26220,90 +26415,27 @@ thing before the \cmd{\label} that defines the \meta{key}.
{Use header title for sectional title references.}
\glossary(tocnameref)%
{\cs{tocnameref}}%
- {Use \prtoc{} title for sectional title references.}
-There can be three possibilities for the name of a sectional division;
-the full name, the name in the \toc, and the name in the page header.
-As far as \cmd{\titleref} is concerned it does not use the fullname,
-and so the choice simplifies to the \toc{} or page header. Following
-the declaration \cmd{\headnameref} it uses the page header name.
-Following the opposite declaration \cmd{\tocnameref}, which is the
-default, it uses the \toc\ name.
+ {Use \prtoc{} title for sectional title references (default).}
-\Note{} Specifically with the \Lclass{memoir} class,
-do not put a \cmd{\label} command inside an
-argument to a \cmd{\chapter} or \cmd{\section} or \cmd{\caption}, etc.,
-command. Most likely it will either be ignored or referencing it will
-produce incorrect values. This restriction does not apply to the standard
-classes, but in any case I think it is good practice not to embed any
-\cmd{\label} commands.
+\fancybreak{}
-\begin{syntax}
-\cmd{\currenttitle} \\
-\end{syntax}
-\glossary(currenttitle)%
- {\cs{currenttitle}}%
- {Gives the title of the last sectional division command.}
- If you just want to refer to the current title you can do so with
-\cmd{\currenttitle}. This acts as though there had been a label associated
-with the title and then \cmd{\titleref} had been used to refer to that label.
-For example:
-\begin{egsource}{eg:sec:nxref:2}
-This sentence in the section titled `\currenttitle' is an example of the
-use of the command \verb?\currenttitle?.
-\end{egsource}
+
+\Note{} In general it is \emph{not} recommended to place
+\cmd{\label} inside an argument for a \cmd{\chapter}, \cmd{\section},
+\cmd{\caption}, etc., command. At that point there is not title data
+available to use for the label.
-\begin{egresult}[Current title]{eg:sec:nxref:2}
-This sentence in the section titled `\currenttitle' is an example of the
-use of the command \verb?\currenttitle?.
-\end{egresult}
+% \fancybreak{}
-\begin{syntax}
-\cmd{\theTitleReference}\marg{num}\marg{text} \\
-\end{syntax}
-\glossary(theTitleReference)%
- {\cs{theTitleReference}\marg{num}\marg{text}}
- {Called by \cs{titleref} and \cs{currenttitle} with the number and
- text of the title to print the values.}
-Both \cmd{\titleref} and \cmd{\currenttitle} use the \cmd{\theTitleReference}
-to typeset the title. This is called with two arguments ---
-the number, \meta{num}, and the text, \meta{text}, of the title. The
-default definition is:
-\begin{lcode}
-\newcommand{\theTitleReference}[2]{#2}
-\end{lcode}
-so that only the \meta{text} argument is printed. You could, for example,
-change the definition to
-\begin{lcode}
-\renewcommand{\theTitleReference}[2]{#1\space \textit{#2}}
-\end{lcode}
-to print the number followed by the title in italics. If you do this, only use
-\cmd{\titleref} for numbered titles, as a printed number for an
-unnumbered title (a) makes no sense, and (b) will in any case be
-incorrect.
- The commands \cmd{\titleref}, \cmd{\theTitleReference} and
-\cmd{\currenttitle} are direct equivalents of those in the \Lpack{titleref}
-package~\cite{TITLEREF}.
+\begin{Changed}[Summer 2023]
+ The following macros are no longer used. They will either issue a
+ warning or an error. Users are encouraged to remove them:
+ \cmd{\currenttitle}, \cmd{\namerefon} (is always on),
+ \cmd{\namerefoff} and \cmd{\theTitleReference}.
+\end{Changed}
+
-\begin{syntax}
-\cmd{\namerefon} \cmd{\namerefoff} \\
-\end{syntax}
-\glossary(namerefon)%
- {\cs{namerefon}}%
- {Makes \cs{titleref} operative.}
-\glossary(namerefoff)%
- {\cs{namerefoff}}%
- {Makes \cs{titleref} inoperative.}
-
- The capability for referencing by name has one potentially
-unfortunate side effect --- it causes some arguments, such as that
-for \cmd{\legend}, to be moving\index{moving argument} arguments
-and hence any fragile\index{fragile} command
-in the argument will need \cmd{\protect}ing. However, not every document
-will require the use of \cmd{\titleref} and so the declaration
-\cmd{\namerefoff} is provided to switch it off (the argument to
-\cmd{\legend} would then not be moving). The declaration
-\cmd{\namerefon}, which is the default, enables name referencing.
\index{reference!by name|)}
@@ -28158,8 +28290,8 @@ pdflatex memman
\svnidlong
{$Ignore: $}
-{$LastChangedDate: 2021-03-22 18:32:04 +0100 (Mon, 22 Mar 2021) $}
-{$LastChangedRevision: 707 $}
+{$LastChangedDate: 2023-08-06 23:23:21 +0200 (Sun, 06 Aug 2023) $}
+{$LastChangedRevision: 768 $}
{$LastChangedBy: daleif@math.au.dk $}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -28635,7 +28767,7 @@ in other orthographies.
The \cmd{\quarkmarks} declaration uses \cmd{\printtime}, so be careful
if you change it.
- Nicola Talbot's \Lpack{datetime} package~\cite{DATETIME} provides
+ Nicola Talbot's \Lpack{datetime2} package~\cite{DATETIME2} provides
a much more comprehensive collection of styles for printing the time;
also for dates.
@@ -28953,6 +29085,23 @@ optional argument) only \meta{start-code} is useful ---
\meta{macro} has any delimited arguments then \cmd{\patchcommand}
cannot be used.
+\begin{recommended}
+ Again \Lpack{xpatch} and \Lpack{etoolbox} (both loaded by \theclass)
+ are recommended. See the commands
+ \begin{syntax}
+ \cmd{\xpatchcmd}\marg{macro}\marg{search}\marg{replace}\marg{success}\marg{failure} \\
+ \cmd{\xapptocmd}\marg{macro}\marg{code}\marg{success}\marg{failure} \\
+ \cmd{\xpretocmd}\marg{macro}\marg{code}\marg{success}\marg{failure} \\
+ \cmd{\patchcmd}\marg{macro}\marg{search}\marg{replace}\marg{success}\marg{failure} \\
+ \cmd{\apptocmd}\marg{macro}\marg{code}\marg{success}\marg{failure} \\
+ \cmd{\pretocmd}\marg{macro}\marg{code}\marg{success}\marg{failure} \\
+ \end{syntax}
+ Here \cmd{\xpatchcmd} can patch some macros can \cmd{\patchcmd}
+ cannot. The combination of \verb|\(x)pretocmd| and
+ \verb|\(x)apptocmd| give the same result as \cmd{\patchcommand}.
+\end{recommended}
+
+
\section{String arguments}
In the code for the class I have sometimes used macro arguments
@@ -28996,6 +29145,9 @@ values. For example:
}
\end{lcode}
+See also the tests available in \Lpack{etoolbox}.
+
+
\section{Odd/even page checking}
It is difficult to check robustly if the current page is odd or even
@@ -38847,12 +38999,12 @@ access CTAN is available at \url{http://www.tug.org}.
\CTANurl{/macros/latex/contrib/url/})
%%% keep
-\bibitem[Ars01a]{TITLEREF}
- Donald Arseneau.
- \newblock \emph{The titleref package}.
- \newblock April, 2001.
- \newblock (Available from CTAN via
- \CTANurl{/macros/latex/contrib/titleref/})
+% \bibitem[Ars01a]{TITLEREF}
+% Donald Arseneau.
+% \newblock \emph{The titleref package}.
+% \newblock April, 2001.
+% \newblock (Available from CTAN via
+% \CTANurl{/macros/latex/contrib/titleref/})
%%% keep
\bibitem[Ars01b]{CHAPTERBIB}
@@ -38977,10 +39129,10 @@ access CTAN is available at \url{http://www.tug.org}.
\CTANurl{/macros/latex/required/tools/})
%%% keep
-\bibitem[Car98b]{LONGTABLE}
+\bibitem[Car21]{LONGTABLE}
David Carlisle.
\newblock \emph{The longtable package}.
- \newblock May, 1998.
+ \newblock May, 2021.
\newblock (Available from CTAN via
\CTANurl{/macros/latex/required/tools/})
@@ -39643,18 +39795,18 @@ Michael~E. Mortenson.
\CTANurl{/fonts/mathpazo/})
%%% keep
-\bibitem[Rahtz01]{NAMEREF}
- Sebastian Rahtz.
+\bibitem[Rahtz23a]{NAMEREF}
+ Sebastian Rahtz, Heiko Oberdiek, The \LaTeX3 Project.
\newblock \emph{Section name references in LaTeX}.
- \newblock January, 2001.
+ \newblock 2023.
\newblock (Available from CTAN (the \texttt{nameref} package) via
\CTANurl{/macros/latex/contrib/hyperref/})
%%% keep
-\bibitem[Rahtz02]{HYPERREF}
- Sebastian Rahtz.
+\bibitem[Rahtz23b]{HYPERREF}
+ Sebastian Rahtz, Heiko Oberdiek, The \LaTeX3 Project.
\newblock \emph{Hypertext marks in LaTeX}.
- \newblock May, 2002. Now maintained and frequently updated by Heiko Oberdiek.
+ \newblock 2023.
\newblock (Available from CTAN via
\CTANurl{/macros/latex/contrib/hyperref/})
@@ -39766,12 +39918,12 @@ Martin Scharrer,
\newblock Vrijie Universiteit, Amsterdam, 2004.
%%% keep
-\bibitem[Tal06]{DATETIME}
+\bibitem[Tal21]{DATETIME2}
Nicola L. C. Talbot.
- \newblock \emph{datetime.sty: Formatting Current Date and Time}.
- \newblock December, 2006.
+ \newblock \emph{datetime2: date and time formats}.
+ \newblock Martch, 2021.
\newblock (Available from CTAN via
- \CTANurl{/macros/latex/contrib/datetime/})
+ \CTANurl{/macros/latex/contrib/datetime2/})
%%% keep
\bibitem[Thi98]{ORNAMENTAL}
@@ -40118,11 +40270,11 @@ Peter Wilson (with the assistance of Lars Madsen).
\newblock (Available from CTAN via
\CTANurl{/macros/latex/contrib/memoir/})
-\bibitem[Wil19b]{MEMMAN}
+\bibitem[Wil23]{MEMMAN}
Peter Wilson (with the assistance of Lars Madsen).
\newblock \emph{The Memoir Class for Configurable Typesetting ---
User Guide}
- \newblock November, 2019. Regularly updated.
+ \newblock November, 2023. Regularly updated.
\newblock (Available from CTAN via
\CTANurl{/macros/latex/contrib/memoir/})
@@ -40135,16 +40287,16 @@ Peter Wilson (with the assistance of Lars Madsen).
%%% keep
-\bibitem[Wil??]{RUMOUR}
-Peter Wilson.
-\newblock \emph{A Rumour of Humour: A scientist's commonplace book}.
-\newblock To be published.
+% \bibitem[Wil??]{RUMOUR}
+% Peter Wilson.
+% \newblock \emph{A Rumour of Humour: A scientist's commonplace book}.
+% \newblock To be published.
-\bibitem[Wri19]{SIUNITX}
+\bibitem[Wri23]{SIUNITX}
Joseph Wright.
\newblock \emph{Siunitx — A comprehensive (SI) units package}
- \newblock October, 2019.
+ \newblock October, 2023.
\newblock (Available from CTAN via \CTANurl{/macros/latex/contrib/siunitx})
diff --git a/macros/latex/contrib/memoir/doc-src/memsty.sty b/macros/latex/contrib/memoir/doc-src/memsty.sty
index dfe40dc0b2..6f37b8e569 100644
--- a/macros/latex/contrib/memoir/doc-src/memsty.sty
+++ b/macros/latex/contrib/memoir/doc-src/memsty.sty
@@ -23,6 +23,7 @@
\providecommand{\PWnote}[2]{}
\newcommand\Added[1]{\sidepar{\tiny Added #1}}
+\newcommand\ToBeRemoved[1]{\sidepar{\tiny To be removed #1}}
%%%%%%%%%%%%%%%%%%% kill scale change warning in layouts
\renewcommand*{\setlayoutscale}[1]{\setlength{\l@youtunitlength}{1pt}
@@ -1133,9 +1134,9 @@ it to use the new width for the margin par}
}
%\newenvironment{caveat}{\par\medskip\noindent\textbf{\textit{Caveat.}}\enskip\itshape}{\par\medskip}
-\newenvironment{caveat}{\begin{leftbar}\noindent\textbf{\textit{Caveat.}}\enskip}{\end{leftbar}}
+\newenvironment{caveat}[1][]{\begin{leftbar}\noindent\textbf{\textit{Caveat.}}\@ifmtarg{#1}{}{\Added{#1}}\enskip}{\end{leftbar}}
%\newenvironment{Changed}{\par\medskip\noindent\textbf{\textit{Changed.}}\enskip}{\par\medskip}
-\newenvironment{Changed}{\begin{leftbar}\noindent\textbf{\textit{Changed.}}\enskip}{\end{leftbar}}
+\newenvironment{Changed}[1][]{\begin{leftbar}\noindent\textbf{\textit{Changed.}\@ifmtarg{#1}{}{\Added{#1}}}\enskip}{\end{leftbar}}
\newenvironment{note}{\par\medskip\noindent\textbf{\textit{Note.}}\enskip\itshape}{\par\medskip}
\newenvironment{note*}[1]{\par\medskip\noindent\textbf{\textit{#1.}}\enskip\itshape}{\par\medskip}
\newenvironment{hint}{\par\medskip\noindent\textbf{\textit{Hint.}}\enskip\itshape}{\par\medskip}
diff --git a/macros/latex/contrib/memoir/memman.pdf b/macros/latex/contrib/memoir/memman.pdf
index 4b27d2a696..fff50043ec 100644
--- a/macros/latex/contrib/memoir/memman.pdf
+++ b/macros/latex/contrib/memoir/memman.pdf
Binary files differ
diff --git a/macros/latex/contrib/memoir/memoir.dtx b/macros/latex/contrib/memoir/memoir.dtx
index ba5162db9d..b22db8831b 100644
--- a/macros/latex/contrib/memoir/memoir.dtx
+++ b/macros/latex/contrib/memoir/memoir.dtx
@@ -20,7 +20,7 @@
% This work consists of the files listed in the README file.
%
% \fi
-% \CheckSum{31045}
+% \CheckSum{28676}
%
% \changes{v0.1}{2001/05/20}{First public alpha release}
% \changes{v0.2}{2001/06/03}{First beta release}
@@ -130,6 +130,7 @@
% \changes{v3.7q}{2022/02/20}{Maintenance}
% \changes{v3.7r}{2022/07/29}{Maintenance}
% \changes{v3.7.19}{2022/11/17}{Maintenance}
+% \changes{v3.8}{2023/08/08}{Maintenance, see the README for details}
%
% \def\dtxfile{memoir.dtx}
%
@@ -197,6 +198,7 @@
% \def\fileversion{v3.7q} \def\filedate{2022/02/20}
% \def\fileversion{v3.7r} \def\filedate{2022/07/29}
% \def\fileversion{v3.7.19} \def\filedate{2022/11/17}
+% \def\fileversion{v3.8} \def\filedate{2023/08/08}
% \title{The LaTeX \Lpack{memoir} class for configurable book
% typesetting: Source code\thanks{This
% file (\texttt{\dtxfile}) has version number \fileversion, last revised
@@ -342,6 +344,7 @@
\newcommand*{\Lenv}[1]{\texttt {#1}} % typeset an environment
\newcommand*{\Lpack}[1]{\textsf {#1}} % typeset a package
\newcommand*{\ctt}{\textsc{ctt}} % comp.text.tex
+\newcommand*{\Lhook}[1]{\meta{#1}} % name of a hook
\newenvironment{PW}{\em}{}
\newenvironment{dlf}{\em}{}
\newcommand*{\theTeXbook}{\textit{The \TeX book}}
@@ -411,12 +414,13 @@
%
% \section{Identification} \label{sec:id}
%
-% The \Lpack{memoir} document class can only be used with LaTeX2e,
-% so we make
-% sure that an appropriate message is displayed when another \TeX{}
-% format is used.
+% The \Lpack{memoir} document class can only be used with LaTeX2e, so
+% we make sure that an appropriate message is displayed when another
+% \TeX{} format is used.
+% \changes{v3.8}{2023/08/02}{Added requirement on the kernel}
% \begin{macrocode}
-%<class>\NeedsTeXFormat{LaTeX2e}
+%<class>\def\mem@atleast@kernel{2021/06/01}
+%<class>\NeedsTeXFormat{LaTeX2e}[\mem@atleast@kernel]
% \end{macrocode}
%
% ^^A Use the Golden Section as the version number (1.6180339887 4989484820 4586834365)
@@ -427,12 +431,45 @@
% Announce the name, option files and version for LaTeX2e files:
% \begin{macrocode}
%<class>\ProvidesClass{memoir}%
-%<class> [2022/11/17 v3.7.19 configurable book, report, article document class]
+%<class> [2023/08/08 v3.8 configurable book, report, article document class]
+%<class>\newcommand\memversion{v3.8, 2023/08/08}
% \end{macrocode}
-% In the manual it is useful to know the current version.
+%
+% \changes{v3.7m}{2020/08/05}{Added \cs{IfFormatAtLeastTF}}
+% \changes{v3.8}{2023/08/02}{Moved up earlier so we can use it to
+% issue an error if the kernel is too old.}
+% \begin{macro}{\IfFormatAtLeastTF}
+% Credit to Frank Mittelbach. Using
+% \cs{IfFormatAtLeastTF}\marg{date}\marg{true}\marg{false} we can
+% execute \meta{true} if the format is dated after the given
+% \meta{date} (in {\scriptsize\ttfamily YYYY/MM/DD} format) and
+% \meta{false} otherwise. The main use is for when we get info that
+% certain features are being added to the \LaTeX\ format, features
+% that we want to base class features on. Then this is an easy method
+% for providing the code only avaiable on newer formats and code left
+% over for those still using the older \LaTeX\ formats.\footnote{The \dots TF is a
+% nice \LaTeX3 convention.}
+% \begin{macrocode}
+%<class>\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
+% \end{macrocode}
+% \end{macro}
+%
+% Stop the loading if the kernel is too old (as \cs{NeedsTeXFormat}
+% only issues a warning). Though we cannot do much about nonstopmode.
% \begin{macrocode}
-%<class>\newcommand\memversion{v3.7.19, 2022/11/17}
-%<9pt>\ProvidesFile{mem9.clo}%
+%<class>\IfFormatAtLeastTF{\mem@atleast@kernel}{}{
+%<class> \ClassError{memoir}{%
+%<class> Your LaTeX release is too old.\MessageBreak
+%<class> The memoir class requires at LaTeX format\MessageBreak
+%<class> from at least \mem@atleast@kernel\space onwards. Please update your\MessageBreak
+%<class> entire LaTeX installation instead of manually updating\MessageBreak
+%<class> just memoir}{}
+%<class> % \batchmode\read-1to\@tempa% evil mode engaged
+%<class>}
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<9pt> \ProvidesFile{mem9.clo}%
%<9pt> [2022/07/29 v0.5 memoir class 9pt size option]
%<10pt>\ProvidesFile{mem10.clo}%
%<10pt> [2022/07/29 v0.5 memoir class 10pt size option]
@@ -467,17 +504,21 @@
%
% (2022/02/20): In order to be able to use a patching approach instead
% of overwriting kernel macros, we will now require the
-% \Lpack{etoolbox} package.
+% \Lpack{etoolbox} package. (2023/07/28) changed to \Lpack{xpatch} as
+% it supports a little more.
+% \changes{v3.8}{2023/07/28}{replaced etoolbox by xpatch}
% \begin{macrocode}
-\RequirePackage{etoolbox}
+\RequirePackage{xpatch}
% \end{macrocode}
%
+%
+%
% Note (2001/08/03): Old versions of the \Lpack{amsmath} package did odd
% things with \cs{@tempa}, \cs{@tempb} and \cs{@tempc}. I have now replaced
% any use of these with \cs{@memtempa}, etc.
%
-%
-% In this part we define a few commands that are used later on.
+% \medskip\noindent
+% In this part we define a few commands that are used later on.
%
% \begin{macro}{\@ptsize}
% \begin{macro}{\@memptsize}
@@ -601,26 +642,6 @@
% \end{macro}
% \end{macro}
%
-%
-% \changes{v3.7m}{2020/08/05}{Added \cs{IfFormatAtLeastTF}}
-% \begin{macro}{\IfFormatAtLeastTF}
-% Credit to Frank Mittelbach. Using
-% \cs{IfFormatAtLeastTF}\marg{date}\marg{true}\marg{false} we can
-% execute \meta{true} if the format is dated after the given
-% \meta{date} (in {\scriptsize\ttfamily YYYY/MM/DD} format) and
-% \meta{false} otherwise. The main use is for when we get info that
-% certain features are being added to the \LaTeX\ format, features
-% that we want to base class features on. Then this is an easy method
-% for providing the code only avaiable on newer formats and code left
-% over for those still using the older \LaTeX\ formats.\footnote{The \dots TF is a
-% \LaTeX3 convention.}
-% \begin{macrocode}
-\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
-
-% \end{macrocode}
-% \end{macro}
-%
-%
% \begin{macro}{\ifsamename}
% \begin{macro}{\nametest}
% The macro \cs{nametest}\marg{name1}\marg{name2} tests whether the
@@ -848,6 +869,69 @@
% \end{macro}
% \end{macro}
%
+% \subsection{Hooks and provided kernel commands}
+%
+% \changes{v3.8}{2023/07/28}{Section added}
+%
+% First we make sure a few kernel commands are present, providing variants if needed.
+% \begin{macro}{\ExpandArgs}
+% The macro \cs{ExpandArgs}\marg{list} is an alias for
+% \verb|\exp_args:Nlist|, can for example be used as
+% \begin{verbatim}
+% \ExpandArgs{c}\newcommand{\foo bar}
+% \end{verbatim}
+% to do argument manipulation to the argument \emph{after}
+% \cs{newcommand}, \emph{before} \cs{newcommand} gets access to it.
+% The \meta{list} arg specification need to comply with expl3
+% standards, see \cite{LTX3}.
+% \begin{macrocode}
+\ExplSyntaxOn
+\IfFormatAtLeastTF{ 2022-06-01 }
+{}
+{
+ \RequirePackage { xparse }
+ \providecommand \ExpandArgs [1]
+ { \cs_if_exist_use:c { exp_args:N #1 } }
+}
+\ExplSyntaxOff
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\NewHookWithArguments}
+% \begin{macro}{\UseHookWithArguments}
+% These is a fairly new addition to \cite{LTHOOKS}, but it will
+% become super usefull in the future. If not already in the kernel,
+% we provide it and have it do nothing at all. Credit to
+% Phelype Oleinik. The various hooks the class has will over time be
+% supplemented by \cs{UseHookWithArguments} and the older non-Hook
+% ones will then slowly be phased out.
+% \begin{macrocode}
+\providecommand\NewHookWithArguments[2]{}
+\ExplSyntaxOn
+\@ifundefined{UseHookWithArguments}{
+ \cs_new:Npn \UseHookWithArguments #1 #2 {
+ \cs:w use_none: \prg_replicate:nn {#2} { n } \cs_end:
+ }
+}{}
+\ExplSyntaxOff
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% As we now require a kernel that have support for the new kernel
+% hooks, we'll use this area to define the hooks and provide commands
+% that are useful in even newer kernels, but might not be in the
+% kernels we'd like to support.
+%
+% The \Lhook{memoir/subcaption} hook is executed after
+% \cs{refstepcounter} in \cs{subcaption}, \cs{subbottom}, \cs{subtop}
+% and similar.
+% \begin{macrocode}
+\NewHook{memoir/subcaption/aftercounter}
+
+% \end{macrocode}
+%
+%
% \subsection{Classes, Packages and Files}
%
% \begin{macro}{\@memfakeusepackage}
@@ -936,13 +1020,14 @@
% the latter via our definition of the file hook. We will now instead
% use the separate hooks. Note that we will \emph{not} be adding any
% extra labels to these hooks and will provide no interface to do
-% so. If more control is needed, please use the kernel interface directly.
+% so. If more control is needed, please use the kerel interface directly.
% \begin{macro}{\AtBeginFile}
% \begin{macro}{\AtEndFile}
% \cs{AtBeginFile}\marg{file}\marg{code} inserts \meta{code}
% just before \meta{file} is input. Similarly \cs{AtEndFile} inserts
% just after input.
%
+% \medskip\noindent
% \textbf{Breaking change:} In the old implemenation
% \verb!\AtEndFile{file}! worked for \texttt{file.tex} even if one
% did not speficy the extension. Now you will need to use
@@ -1218,20 +1303,25 @@
% \end{macro}
%
% \begin{macrocode}
-} % end of els part of format check
+
+ % end of else part of format check
+}
+
% \end{macrocode}
%
%
%
% \begin{macro}{\phantomsection}
-% A command needed if the \Lpack{hyperref} package is used, for putting
-% before certain \cs{addcontentsline} commands.
+% Whenever \Lpack{hyperref} is used and one uses fx
+% \cs{addcontentsline} at a place that has to hypertarget (e.g. a
+% counter being stepped) one adds \cs{phantomsection}.
% \begin{macrocode}
\newcommand{\phantomsection}{}
% \end{macrocode}
% \end{macro}
%
+% ^^A dlf note: kernal macro redefinition
% \begin{macro}{\nofiles}
% The kernel's \cs{nofiles}, which surprisingly may be called \emph{before}
% the class is loaded, lets \cs{makeindex} to \cs{relax}. This could
@@ -1903,6 +1993,19 @@
%
% \section{Declaration of Options} \label{sec:opt}
%
+% \changes{v3.8}{2023/08/03}{Added secret option}
+% \begin{macrocode}
+ % secret extra option for testing stuff in the wild
+ % caution 1: patching inside \ifmem@devmode ... \fi requires that all
+ % if statements in the patch are blanced
+ % caution 2: pathing inside \mem@devmode@run{ ... }{} does not work
+ % if the search pattern contains #<num>
+ % thus added both variants
+\newif\ifmem@devmode
+\let\mem@devmode@run\@secondoftwo
+\DeclareOption{dev-mode}{\let\mem@devmode@run\@firstoftwo\mem@devmodetrue}
+
+% \end{macrocode}
%
% \subsection{Setting Paper Sizes}
%
@@ -2617,33 +2720,6 @@
% \end{macro}
%
%
-% \changes{v1.6180339f}{2009/07/12}{Added dead man switch for etex}
-% \subsection{ETeX}
-%
-% If found we automatically load the eTeX package right after
-% executing the class options. Though, some odd \LaTeX\ installations
-% may have the eTeX pacakge, but is not based on eTeX (eventhough that
-% is what the LaTeX-project have recommended for several years now),
-% so we add a dead mans switch to disable the loading.
-%
-% \medskip\noindent
-% Update 2015: Since the 2015 LaTeX kernel automatically takes care of
-% allocating extra registers, the \Lpack{etex} package is no longer
-% needed with newer kernels. Therefore automatic loading \Lpack{etex}
-% now only happen if the kernel is pre 2015.
-% \begin{macro}{\ifmem@noetex}
-% \begin{macro}{\mem@noetextrue}
-% \begin{macro}{\mem@noetexfalse}
-% \begin{macrocode}
-\newif\ifmem@noetex
- \mem@noetexfalse
-\DeclareOption{noetex}{\mem@noetextrue}
-
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
%
% \section{Executing Options} \label{sec:xopt}
%
@@ -2670,30 +2746,18 @@
% option after \cs{ProcessOptions*}}
% \begin{macrocode}
\ProcessOptions*
- \ifmemlandscape
- \setlength\@tempdima {\stockheight}
- \setlength\stockheight{\stockwidth}
- \setlength\stockwidth {\@tempdima}
- \fi
% \end{macrocode}
-% Load the eTeX package if found, and if the user has not explicitly
-% asked us not to.
-%
-% \medskip\noindent
-% Update 2015: Since 2015 the LaTeX kernel automatically
-% allocate extra registers, thus that part of the \Lpack{etex}
-% package is no longer needed for newer \LaTeX\ kernels. At the
-% request of the LaTeX Team, we now only load \Lpack{etex} on older
-% kernels.
-% \changes{v3.7e}{2015/07/08}{Only load \Lpack{etex} on older kernels}
-% \begin{macrocode}
-\ifmem@noetex\relax\else
- \ifx\e@alloc\@undefined
- \IfFileExists{etex.sty}{\RequirePackage{etex}}{}
- \fi
+% Execute the delayed landscape switch if given
+% \begin{macrocode}
+\ifmemlandscape
+ \setlength\@tempdima {\stockheight}
+ \setlength\stockheight{\stockwidth}
+ \setlength\stockwidth {\@tempdima}
\fi
+
% \end{macrocode}
+
% \begin{macro}{\memoirpostopthook}
% A user could define this \emph{before} the \cs{documentclass} command
% to do something at this point. For example, to set up a new stock size: \\
@@ -2727,7 +2791,9 @@
% \end{macro}
%
-% Set \cs{clearforchapter} according to the options.
+% Set the macro \cs{clearforchapter} according to the options (via
+% \cs{openleft}, \cs{openright} or \cs{openany} defined
+% earlier)
% \begin{macrocode}
\if@openleft
\openleft
@@ -3688,7 +3754,8 @@
% \end{macro}
%
% \begin{macro}{\interlinepenalty}
-% Allow the breaking of a page in the middle of a paragraph.
+% Allow the breaking of a page in the middle of a paragraph. Using
+% the kernel default and here just showing it.
% \begin{macrocode}
% \interlinepenalty 0
% \end{macrocode}
@@ -3696,7 +3763,8 @@
%
%
% \begin{macro}{\brokenpenalty}
-% We allow the breaking of a page after a hyphenated line.
+% We allow the breaking of a page after a hyphenated line. Using
+% the kernel default and here just showing it.
% \begin{macrocode}
% \brokenpenalty 100
% \end{macrocode}
@@ -3711,22 +3779,23 @@
% \begin{macro}{\headsep}
% \begin{macro}{\topskip}
% \begin{macro}{\footskip}
-% The \cs{headheight} is the height of the box that will contain the
-% running head. In this class it is point size dependent ---
-% \cs{onelineskip} (normally it is a constant 12pt).
-%
-% The \cs{headsep} is the distance between the bottom
-% of the running head and the top of the text. For the larger sizes
-% this is 1.8 times the fontsize.
-%
-% The \cs{topskip} is the \cs{baselineskip} for the first line on a page;
-% \LaTeX's output routine will not work properly if it has the
-% value 0pt, so do not do that! For the lareger sizes this is the font size.
-%
-% The distance from the baseline of the box which contains the
-% running footer to the baseline of last line of text is controlled
-% by the \cs{footskip}. For the larger sizes this is 2.5 times the
-% font size.
+% The \cs{headheight} is the height of the box that will contain the
+% running head. In this class it is point size dependent ---
+% \cs{onelineskip} (normally it is a constant 12pt).
+%
+% The \cs{headsep} is the distance between the bottom of the running
+% head and the top of the text. For the larger sizes this is 1.8
+% times the fontsize.
+%
+% The \cs{topskip} is the \cs{baselineskip} for the first line on a
+% page; \LaTeX's output routine will not work properly if it has the
+% value 0pt, so do not do that! For the larger sizes this is the
+% font size.
+%
+% The distance from the baseline of the box which contains the
+% running footer to the baseline of last line of text is controlled
+% by the \cs{footskip}. For the larger sizes this is 2.5 times the
+% font size.
% \changes{v0.11 (mem14.clo)}{2001/10/30}{Changed \cs{headheight} from 16pt to 17.5pt}
% \changes{v0.11 (mem11.clo)}{2002/03/10}{Changed \cs{headheight} from 13pt to 13.6pt}
% \changes{v0.4b (mem12.clo)}{2010/10/19}{Changed \cs{headheight} from 14pt to 14.5pt}
@@ -5426,7 +5495,7 @@
% the various engines do not quite agree on which variables to use. As
% of 2018 we will be using this: First of \cs{pdfpageheight/width} is
% used by pdf(e)tex based enginges. We set them if they are
-% defined. Just incase someone need to be able to patch this, we make
+% defined. Just in case someone need to be able to patch this, we make
% it into a macro and just run it at the start of the cocument
% \begin{macrocode}
\newcommand\mem@fixpagelayout{%
@@ -7465,25 +7534,16 @@
% \cs{pagenumbering}\marg{style} is the normal version whereas
% the starred version does not reset the counter.
% \changes{v1.0}{2001/09/21}{Added \cs{pagenumbering} and \cs{pagenumbering*} }
+% \changes{v3.8}{2023/05/08}{Reimplemented as a single macro via \RenewDocumentCommand}
% \begin{macrocode}
-\renewcommand{\pagenumbering}{%
- \@ifstar{\@smempnum}{\@mempnum}}
-% \end{macrocode}
-% \begin{macro}{\@smempnum}
-% \begin{macrocode}
-\newcommand{\@smempnum}[1]{%
- \gdef\thepage{\csname @#1\endcsname \c@page}}
-% \end{macrocode}
-% \end{macro}
-% \begin{macro}{\@mempnum}
-% \begin{macrocode}
-\newcommand{\@mempnum}[1]{%
- \@smempnum{#1}\global\c@page \@ne}
+\RenewDocumentCommand\pagenumbering{sm}{%
+ \gdef\thepage{\csname @#2\endcsname \c@page}%
+ \IfBooleanF{#1}{\global\c@page \@ne}% reset counter unless starred
+}
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\c@storedpagenumber}
% A counter to store the page number.
@@ -7662,20 +7722,23 @@
%
% \begin{macro}{\@setsize}
% Modify the kernel command.
+% \changes{v3.8}{2023/08/08}{\cs{@setsize} redef removed. It came from
+% setspace.sty which note that it was needed for some 209 packages. In
+% the kernel it is just defined to use \cs{@setfontsize}. We remove it}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check what this does!!!!!!!!
% \begin{macrocode}
-\renewcommand*{\@setsize}[4]{%
- \@nomath#1%
- \let\@currsize#1%
- \baselineskip #2%
- \baselineskip \baselinestretch\baselineskip
- \parskip \baselinestretch\parskip
- \setbox\strutbox \hbox{%
- \vrule height.7\baselineskip
- depth .3\baselineskip
- width \z@}%
- \skip\footins \baselinestretch\skip\footins
- \normalbaselineskip\baselineskip#3#4}
+ % \renewcommand*{\@setsize}[4]{%
+ % \@nomath#1%
+ % \let\@currsize#1%
+ % \baselineskip #2%
+ % \baselineskip \baselinestretch\baselineskip
+ % \parskip \baselinestretch\parskip
+ % \setbox\strutbox \hbox{%
+ % \vrule height.7\baselineskip
+ % depth .3\baselineskip
+ % width \z@}%
+ % \skip\footins \baselinestretch\skip\footins
+ % \normalbaselineskip\baselineskip#3#4}
% \end{macrocode}
% \end{macro}
@@ -7804,23 +7867,44 @@
% \end{macro}
%
% \begin{macro}{\@xfloat}
-% Reset \cs{baselinestretch} in floats. Because of a package like
-% \Lpack{fixltx2e} (recommended package), we have to delay the
-% addition.
-% \changes{v3.7d}{2014/07/28}{Delayed addition to
-% \cs{@xfloat}. Reported by Ulrike Fischer}.
+% Reset \cs{baselinestretch} in floats. If the format version
+% supports it we add it via a cmd hook, if not, we delay until the
+% start of the document and use the older definition. Note that the
+% hook cannot access the arguments given to \cs{@xfloat}, luckily it
+% stores \#1 in \cs{@captype}.
+% \changes{v3.7d}{2014/07/28}{Delayed addition to \cs{@xfloat}. Reported by Ulrike Fischer}
% \changes{v3.7g}{2017/05/08}{Delayed the addition of the adjustment
% to the float until after \cs{normalsize}. Reported at \protect\url{https://tex.stackexchange.com/q/368422/3929}}
+% \changes{v3.8}{2023/05/08}{Additions to \cs{@xfloat} now added
+% via a cmd/after hook if the format supports it}
% \begin{macrocode}
-\AtBeginDocument{
- \let\m@m@xfloat\@xfloat
- \def\@xfloat #1[#2]{%
- \m@m@xfloat #1[#2]%
+\IfFormatAtLeastTF{2021/04/20}{%
+ \AddToHook{cmd/@xfloat/after}{%
\def\baselinestretch{\m@m@float@spacing}%
\normalsize%
- \@nameuse{#1adjustment}%
- }
+ \@nameuse{\@captype adjustment}% \@xfloat stores its #1 arg in \@captype
+ }%
+}{%
+ \AtBeginDocument{%
+ % \typeout{Old kernel, redefining \string\@xfloat\ instead of using a hook}
+ \let\m@m@xfloat\@xfloat%
+ \def\@xfloat #1[#2]{%
+ \m@m@xfloat #1[#2]%
+ \def\baselinestretch{\m@m@float@spacing}%
+ \normalsize%
+ \@nameuse{#1adjustment}%
+ }%
+ }%
}
+% The code can also be made (slightly modified) using a cmd hook
+% eliminating the explicit \AtBeginDocument, note that we probably
+% need a format check in order to be able to use the cmd hook
+% \AddToHook{cmd/@xfloat/after}{%
+% \def\baselinestretch{\m@m@float@spacing}%
+% \normalsize%
+% \@nameuse{\@captype adjustment}% \@xfloat stores its #1 arg in \@captype
+% }
+
% \end{macrocode}
% \end{macro}
@@ -7989,7 +8073,8 @@
% \begin{macro}{\maketitlehookc}
% \begin{macro}{\maketitlehookd}
% The four hooks which will be called by \cs{maketitle}. These are initially
-% vacuous.
+% vacuous. The hooks are placed before title, before author, before
+% date and after date respectively.
% \begin{macrocode}
\newcommand{\maketitlehooka}{}
\newcommand{\maketitlehookb}{}
@@ -8146,11 +8231,8 @@
\newcommand{\makethanksmark}{%
\leavevmode%
\parindent 1em\noindent
-%%% \leftskip\thanksmarksep\relax
\memRTLleftskip\thanksmarksep\relax
-%%% \advance\leftskip\thanksmarkwidth
\advance\memRTLleftskip\thanksmarkwidth
-%%% \null\nobreak\hskip-\leftskip\relax
\null\nobreak\hskip-\memRTLleftskip\relax
\makethanksmarkhook\relax
\thanksfootmark}
@@ -8206,7 +8288,8 @@
% \begin{macro}{\maketitle}
% The following is a
% modification of \cs{maketitle} as in the \Lpack{article}, \Lpack{report},
-% and \Lpack{book} classes. It sets the pagestyle to \pstyle{title}.
+% and \Lpack{book} classes. It sets the pagestyle to \pstyle{title}
+% and as a default sets \pstyle{title} to point to \pstyle{plain}.
% \changes{v1.4}{2004/01/21}{Removed the \cs{rlap} from \cs{@makefnmark}
% in \cs{maketitle} so multiple \cs{thanks}
% work per \cs{footnote}}
@@ -8557,6 +8640,7 @@
% \begin{table}
% \centering
% \caption{Document division levels}\label{tab:levels}
+% \medskip
% \begin{tabular}{lr} \hline
% Division & Level \\ \hline
% book & -2 \\
@@ -8662,8 +8746,8 @@
%
% Book, part and chapter are the top level document divisions.
% \begin{macrocode}
-\newcounter{book} \setcounter{book}{0}
-\newcounter{part} \setcounter{part}{0}
+\newcounter{book} \setcounter{book}{0}
+\newcounter{part} \setcounter{part}{0}
\newcounter{chapter} \setcounter{chapter}{0}
% \end{macrocode}
% The lower level divisions get reset by higher level divisions.
@@ -8916,15 +9000,18 @@
% \subsection{Book}
%
% This was added at the request of Frederic Connes who said that in
-% Frency typography there was often a division above the \cs{part} level.
+% French typography there was often a division above the \cs{part} level.
%
% \begin{macro}{\theHbook}
% \begin{macro}{\toclevel@book}
% These are needed if the \Lpack{hyperref} is used.
% \changes{v3.7.19}{2022/10/25}{Changing \cs{theH...} definitions to
% \cs{def} for better compability with future hyperref}
+% \changes{v3.8}{2023/06/20}{Changed \cs{theHbook} to use
+% \cs{the}\cs{value\{counter\}} as packages can mess up \cs{arabic}
+% advise from Ulrike}
% \begin{macrocode}
-\def\theHbook{\arabic{book}}
+\def\theHbook{\the\value{book}}
\def\toclevel@book{-2}
% \end{macrocode}
@@ -9016,6 +9103,10 @@
%
% \begin{macro}{\membookinfo}
% \begin{macro}{\membookstarinfo}
+% Hooks. Arguments given for \cs{membookinfo} will be \cs{thebook}
+% (unless secnumdepth), the data for the toc and the title. The
+% argument for \cs{membookstarinfo} (starred version) will just be
+% the title.
% \begin{macrocode}
\newcommand{\membookinfo}[3]{}
\newcommand{\membookstarinfo}[1]{}
@@ -9256,6 +9347,10 @@
%
% \begin{macro}{\mempartinfo}
% \begin{macro}{\mempartstarinfo}
+% Hooks for the part data. Arguments as listed. Though first arg for
+% \cs{mempartinfo} might be empty if secnumdepth say so.
+%
+% \medskip\noindent
% \verb?\mempartinfo{\thepart}{short}{long}? \\
% \verb?\mempartstarinfo{long}? \\
% \changes{v1.61803}{2008/01/30}{Made \cs{mempartinfo} long (mempatch v4.9).}
@@ -9614,6 +9709,7 @@
% \begin{macrocode}
\@nameuse{chapter@f@rtoc@before@write@hook}%
% \end{macrocode}
+%
% Vittorio De Martino (\texttt{demartino.vittoria@grtn.it}) on
% 31 March 2003 reported that for articled chapters, which do not do
% any \cs{clearpage}, \cs{addcontents} had to come after the title.
@@ -9646,8 +9742,10 @@
% \changes{v3.6k}{2013/04/24}{Added \cs{memendofchapterhook}}.
% The hook at the very end can be used to automatically add a new page
% right after \cs{chapter}.
+% \changes{v3.70.20}{2023/07/24}{Redef of \cs{M@gettitle} requires
+% expansion for macro arguments}
% \begin{macrocode}
- \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{\f@rtoc}\fi%
+ \ifheadnameref\ExpandArgs{V}\M@gettitle\f@rhdr\else\ExpandArgs{V}\M@gettitle\f@rtoc\fi%
\memendofchapterhook%
}
@@ -9746,9 +9844,9 @@
% \begin{macro}{\afterchapskip}
% Lengths separating the various parts of a chapter heading.
% \begin{macrocode}
-\newlength{\beforechapskip}\setlength{\beforechapskip}{50pt}
-\newlength{\midchapskip}\setlength{\midchapskip}{20pt}
-\newlength{\afterchapskip}\setlength{\afterchapskip}{40pt}
+\newlength{\beforechapskip} \setlength{\beforechapskip}{50pt}
+\newlength{\midchapskip} \setlength{\midchapskip}{20pt}
+\newlength{\afterchapskip} \setlength{\afterchapskip}{40pt}
% \end{macrocode}
% \end{macro}
@@ -9812,6 +9910,8 @@
%
% \begin{macro}{\@m@mschapter}
% This deals with the new optional argument for starred chapters.
+% \changes{v3.70.20}{2023/07/24}{Redef of \cs{M@gettitle} requires
+% expansion for macro arguments}
% \begin{macrocode}
\newcommand{\@m@mschapter}[2][\@empty]{%
\@schapter{#2}%
@@ -9828,7 +9928,7 @@
\else
\memchapstarinfo{\f@rhdr}{#2}%
\fi
- \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{#2}\fi}
+ \ifheadnameref\ExpandArgs\M@gettitle\f@rhdr\else\M@gettitle{#2}\fi}
% \end{macrocode}
% \end{macro}
@@ -9894,8 +9994,9 @@
% \begin{macro}{\makechapterstyle}
% \begin{macro}{\chapterstyle}
% \cs{chapterstyle}\marg{style} is like \cs{pagestyle}, except it's for
-% chapters.
+% chapters.
%
+% \medskip\noindent
% \cs{makechapterstyle}\marg{style}\marg{text} creates
% or overrides the \meta{style} chapter style defining it as \meta{text}
% So, \verb?\makechapterstyle{fred}{code}? specifies that the chapter style
@@ -10895,7 +10996,16 @@
% \end{macrocode}
% \end{macro}
%
-%
+% \begin{macro}{\@sect}
+% \changes{v3.8}{2023/07/24}{Added patch.}
+% The \Lpack{pdfpages} package assumes \cs{@sect} in order to add
+% stuff to say \cs{@currentlabelname}. So in case others use it we map \cs{@sect}.
+% \begin{macrocode}
+\def\@sect#1#2#3#4#5#6[#7]#8{\M@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}][{#7}]{#8}}
+
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\@ssect}
% Add hook for name reference to \cs{section*} etc. \\
% \cs{@ssect}\marg{indent}\marg{beforeskip}\marg{afterskip}\marg{style}\marg{title}
@@ -12225,9 +12335,12 @@
% We end by redefining \cs{theHsection} introduced in \cs{@resets@ppsub}
% \changes{v3.7p}{2021/06/16}{Moved redef of \cs{theHsection} here instead
% of in \Lpack{memhfixc}}
+% \changes{v3.8}{2023/06/20}{Changed \cs{theHsection} to use
+% \cs{the}\cs{value\{counter\}} as packages can mess up \cs{arabic}
+% advise from Ulrike}
% \begin{macrocode}
}{%
- \def\theHsection{\theHchapter.\arabic{section}}
+ \def\theHsection{\theHchapter.\the\value{section}}
}
% \end{macrocode}
@@ -12458,9 +12571,7 @@
% \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{centerlastline}}
% \begin{macrocode}
\newcommand*{\centerlastline}{%
-%%% \leftskip\@flushglue
\memRTLleftskip\@flushglue
-%%% \rightskip=\z@ plus -1fil
\memRTLrightskip=\z@ plus -1fil
\parfillskip=\z@ plus 2fil}
@@ -12530,9 +12641,7 @@
\setlength{\ragrparindent}{\parindent}
\newcommand{\raggedyright}[1][2em]{%
\let\\\@centercr\@rightskip \z@ \@plus #1\relax
-%%% \rightskip\@rightskip
\memRTLrightskip\@rightskip
-%%% \leftskip\z@skip
\memRTLleftskip\z@skip
\parindent\ragrparindent}
@@ -12547,9 +12656,7 @@
% \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{justlastraggedleft}}
% \begin{macrocode}
\newcommand*{\justlastraggedleft}{%
-%%% \leftskip\@flushglue
\memRTLleftskip\@flushglue
-%%% \rightskip-\leftskip
\memRTLrightskip-\memRTLleftskip
\parfillskip\leftskip
\parindent \z@}
@@ -14782,10 +14889,12 @@
% \begin{macro}{\thepoem}
% \begin{macro}{\theHpoem}
% Counter for poem titles.
+% \changes{v3.8}{2023/06/20}{Changed \cs{theHpoem} to
+% \cs{providecommand} per request of the kernel team}
% \begin{macrocode}
\newcounter{poem}\setcounter{poem}{0}
- \renewcommand*{\thepoem}{\@arabic\c@poem}
-\newcommand*{\theHpoem}{\arabic{poem}}
+\renewcommand*{\thepoem}{\@arabic\c@poem}
+\providecommand*{\theHpoem}{\the\value{poem}}
% \end{macrocode}
% \end{macro}
@@ -14899,8 +15008,10 @@
\fi
% \end{macrocode}
% Add hook for title referencing.
+% \changes{v3.70.20}{2023/07/24}{Redef of \cs{M@gettitle} requires
+% expansion for macro arguments}
% \begin{macrocode}
- \ifheadnameref\M@gettitle{\poemf@rhdr}\else\M@gettitle{\poemf@rtoc}\fi}
+ \ifheadnameref\ExpandArgs{V}\M@gettitle\poemf@rhdr\else\ExpandArgs{V}\M@gettitle\poemf@rtoc\fi}
% \end{macrocode}
% \end{macro}
@@ -15186,2075 +15297,6 @@
% \begin{macrocode}
\RequirePackage{array}[2018/04/30]
% \end{macrocode}
-% The embeded copy is outcommented for now and will be removed in a
-% later version.
-%
-% \changes{v3.7h}{2018/09/06}{Outcommented the embedded copy of
-% \Lpack{array} and replaced it with requiring the \Lpack{array} package
-% instead.}
-%
-% ^^A % The description and code are essentially copied from the \Lpack{array}
-% ^^A package~\cite{ARRAY}.
-% ^^A
-% \begin{macrocode}
- %
- % %%%%%%%%%% Array package code %%%%%%%%%%%%%%%%%%%%%
- % %%%%%%%%%% With acknowledgements to %%%%%%%%%%%%%%%%%%%%%
- % %%%%%%%%%% Frank Mittelbach & David Carlisle %%%%%%%%%%%%%%%%%%%%%
- %
- % %%%%%%%%%% Copy corresponds to array.sty 2016/10/06 v2.4d %%%%%%%%%
-% \end{macrocode}
-% ^^A \changes{v3.7g}{2018/03/05}{Updated the embedded copy of the
-% ^^A \Lpack{array} package to version 2.4d, 2016/10/06}
-% ^^A \begin{dlf}
-% ^^A dlf: The \Lpack{array} package has redundant code (caused by a
-% ^^A quick mashing of and earlier \Lpack{array} version and the
-% ^^A \Lpack{newaray} package). In thus update (2018/03/05) this
-% ^^A redundant code is \emph{not} removed as it makes it very hard to
-% ^^A see where there are class changes to the \Lpack{array} code, and
-% ^^A when stuff is simply removed. We'll leave it up to the LaTeXteam to
-% ^^A clean up the \Lpack{array} code at some point.
-% ^^A
-% ^^A The following is a carbon copy of the DTX code from
-% ^^A \verb|array.dtx|, package specific \cs{changes} lines have been
-% ^^A removed, and we have made any error/warning messages class specific,
-% ^^A instead of package specific.
-% ^^A \end{dlf}
-% ^^A
-% ^^A
-% ^^A \subsubsection{The construction of the preamble}
-% ^^A
-% ^^A It is obvious that those environments will consist mainly of an
-% ^^A \verb=\halign=, because \TeX\ typesets tables using this primitive.
-% ^^A That is why we will now take a look at the algorithm which determines
-% ^^A a preamble for a \verb=\halign= starting with a given user preamble
-% ^^A using the options mentioned above.
-% ^^A
-% ^^A The most interesting macros of this implementation are without doubt
-% ^^A those which are responsible for the construction of the preamble for
-% ^^A the \verb=\halign=. The underlying algorithm was developed by
-% ^^A \textsc{Lamport} (resp.\ \textsc{Knuth}, see texhax V87\#??), and it
-% ^^A has been extended and improved.
-% ^^A
-% ^^A The user preamble will be read \textsf{token} by \textsf{token}. A
-% ^^A \textsf{token} is a single character like \texttt{c} or a block
-% ^^A enclosed in \verb={...}=. For example the preamble of
-% ^^A \verb=\begin{tabular}=\linebreak[0]\verb={lc||c@{\hspace{1cm}}}= consists of
-% ^^A the \textsf{token} \texttt{l}, \texttt{c}, \texttt{|}, \texttt{|},
-% ^^A \texttt{@} and \verb=\hspace{1cm}=.
-% ^^A
-% ^^A The currently used \textsf{token} and the one, used before, are needed
-% ^^A to decide on how the construction of the preamble has to be
-% ^^A continued.
-% ^^A In the example mentioned above the \texttt{l} causes the preamble
-% ^^A to begin with \verb=\hskip\tabcolsep=. Furthermore
-% ^^A \verb=# \hfil= would be appended to define a flush left column.
-% ^^A The next \textsf{token} is a \texttt{c}. Because it was preceded by an
-% ^^A \texttt{l} it generates a new column. This is done with
-% ^^A \verb=\hskip \tabcolsep & \hskip \tabcolsep=. The column which is to
-% ^^A be centered will be appended with \verb=\hfil # \hfil=.
-% ^^A The \textsf{token} \texttt{|} would then add a space of
-% ^^A \verb=\hskip \tabcolsep=
-% ^^A and a vertical line because the last
-% ^^A \textsf{tokens} was a \texttt{c}.
-% ^^A The following \textsf{token} \texttt{|} would only add a space
-% ^^A \verb=\hskip \doublerulesep= because it was preceded by the
-% ^^A \textsf{token} \texttt{|}. We will not discuss our example further but
-% ^^A rather take a look at the general case of constructing preambles.
-% ^^A
-% ^^A The example shows that the desired preamble for the
-% ^^A \verb=\halign= can be constructed as soon as the action of all
-% ^^A combinations
-% ^^A of the preamble \textsf{tokens} are specified. There are 18 such
-% ^^A \textsf{tokens}
-% ^^A so we have $19 \cdot 18 = 342$ combinations if we count the
-% ^^A beginning of
-% ^^A the preamble as a special \textsf{token}. Fortunately, there are many
-% ^^A combinations which generate the same spaces, so we can define
-% ^^A \textsf{token} classes. We will identify a
-% ^^A \textsf{token} within a class with a number, so we can insert the
-% ^^A formatting (for example of a column).
-% ^^A Table~\ref{tab:Klassen} lists all \textsf{token} classes and
-% ^^A their corresponding numbers.
-% ^^A \begin{table}[ht]
-% ^^A \begin{center}
-% ^^A \begin{tabular}[t]{>{\ttfamily}ccc}
-% ^^A \textsf{token} & \verb=\@chclass= & \verb=\@chnum= \\[2mm]
-% ^^A c & 0 & 0 \\
-% ^^A l & 0 & 1 \\
-% ^^A r & 0 & 2 \\
-% ^^A p-arg & 0 & 3 \\
-% ^^A t-arg & 0 & 4 \\
-% ^^A b-arg & 0 & 5 \\
-% ^^A | & 1 & 0 \\
-% ^^A !-arg & 1 & 1 \\
-% ^^A <-arg & 2 & --- \\
-% ^^A >-arg & 3 & ---
-% ^^A \end{tabular}
-% ^^A \kern3mm \vrule \kern3mm%
-% ^^A \begin{tabular}[t]{>{\ttfamily}ccc}
-% ^^A \textsf{token} & \verb=\@chclass= & \verb=\@chnum= \\[2mm]
-% ^^A Start & 4 & --- \\
-% ^^A @-arg & 5 & --- \\
-% ^^A ! & 6 & --- \\
-% ^^A @ & 7 & --- \\
-% ^^A < & 8 & --- \\
-% ^^A > & 9 & --- \\
-% ^^A p & 10 & 3 \\
-% ^^A t & 10 & 4 \\
-% ^^A b & 10 & 5
-% ^^A \end{tabular}
-% ^^A \end{center}
-% ^^A \caption{Classes of preamble \textsf{tokens}}
-% ^^A \label{tab:Klassen}
-% ^^A \end{table}
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\@chclass}
-% ^^A \begin{macro}{\@chnum}
-% ^^A \begin{macro}{\@lastchclass}
-% ^^A The class and the number of the current \textsf{token} are saved in
-% ^^A the
-% ^^A \textsf{count} registers \verb=\@chclass=
-% ^^A and \verb=\@chnum=, while the class of the previous
-% ^^A \textsf{token} is stored in the
-% ^^A \textsf{count} register \verb=\@lastchclass=.
-% ^^A All of the mentioned registers are already allocated in
-% ^^A \texttt{latex.tex},
-% ^^A which is the reason why the following three lines of code are
-% ^^A commented out.
-% ^^A Later throughout the text I will not mention it again explicitly
-% ^^A whenever I use a \verb=%= sign. These parts are already defined in
-% ^^A \texttt{latex.tex}.
-% \begin{macrocode}
- % % \newcount \@chclass
- % % \newcount \@chnum
- % % \newcount \@lastchclass
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\@addtopreamble}
-% ^^A We will save the already constructed preamble for
-% ^^A the \verb=\halign=
-% ^^A in the global macro \verb=\@preamble=. This will then be
-% ^^A enlarged with
-% ^^A the command \verb=\@addtopreamble=.
-% \begin{macrocode}
- % \def\@addtopreamble#1{\xdef\@preamble{\@preamble #1}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A
-% ^^A
-% ^^A \subsubsection{The character class of a \textsf{token}}
-% ^^A
-% ^^A \begin{macro}{\@testpach}
-% ^^A With the help of \verb=\@lastchclass= we can now define a macro
-% ^^A which determines the class and the number of a given preamble
-% ^^A \textsf{token}
-% ^^A and assigns them to the registers
-% ^^A \verb=\@chclass= and \verb=\@chnum=.
-% \begin{macrocode}
- % \def\@testpach{\@chclass
-% \end{macrocode}
-% ^^A First we deal with the cases in which the \textsf{token}
-% ^^A (\verb=#1=) is the argument of \texttt{!}, \texttt{@}, \texttt{<} or
-% ^^A \texttt{>}. We can see this from the value of \verb=\@lastchclass=:
-% \begin{macrocode}
- % \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
- % \ifnum \@lastchclass=7 5 \else
- % \ifnum \@lastchclass=8 \tw@ \else
- % \ifnum \@lastchclass=9 \thr@@
-% \end{macrocode}
-% ^^A Otherwise we will assume that the \textsf{token} belongs to the
-% ^^A class $0$
-% ^^A and assign the corresponding number to \verb=\@chnum= if our
-% ^^A assumption is correct.
-% \begin{macrocode}
- % \else \z@
-% \end{macrocode}
-% ^^A If the last \textsf{token} was a \texttt{p}, \texttt{m} or a
-% ^^A \texttt{b}, \verb=\@chnum= already has the right value. This is the
-% ^^A reason for the somewhat curious choice of the \textsf{token}
-% ^^A numbers in class $10$.
-% \begin{macrocode}
- % \ifnum \@lastchclass = 10 \else
-% \end{macrocode}
-% ^^A Otherwise we will check if \verb=\@nextchar= is either a \texttt{c},
-% ^^A \texttt{l} or an \texttt{r}. Some applications change the
-% ^^A catcodes of certain characters like ``\texttt{@}'' in
-% ^^A \texttt{amstex.sty}. As a result the tests below would fail since
-% ^^A they assume non-active character tokens. Therefore we evaluate
-% ^^A \verb=\@nextchar= once thereby turning the first token of its
-% ^^A replacement text into a char. At this point here this should have
-% ^^A been the only char present in \verb=\@nextchar= which put into via a
-% ^^A \verb=\def=.
-% \begin{macrocode}
- % \edef\@nextchar{\expandafter\string\@nextchar}%
- % \@chnum
- % \if \@nextchar c\z@ \else
- % \if \@nextchar l\@ne \else
- % \if \@nextchar r\tw@ \else
-% \end{macrocode}
-% ^^A If it is a different \textsf{token}, we know that the class was
-% ^^A not $0$. We assign the value $0$ to \verb=\@chnum= because this value
-% ^^A is needed for the \texttt{|}--\textsf{token}. Now we must check
-% ^^A the remaining classes. Note that the value of \verb=\@chnum= is
-% ^^A insignificant here for most classes.
-% \begin{macrocode}
- % \z@ \@chclass
- % \if\@nextchar |\@ne \else
- % \if \@nextchar !6 \else
- % \if \@nextchar @7 \else
- % \if \@nextchar <8 \else
- % \if \@nextchar >9 \else
-% \end{macrocode}
-% ^^A The remaining permitted \textsf{tokens} are \texttt{p},
-% ^^A \texttt{m} and \texttt{b} (class $10$).
-% \begin{macrocode}
- % 10
- % \@chnum
- % \if \@nextchar m\thr@@\else
- % \if \@nextchar p4 \else
- % \if \@nextchar b5 \else
-% \end{macrocode}
-% ^^A Now the only remaining possibility is a forbidden \textsf{token},
-% ^^A so we choose class $0$ and number $0$ and give an error message.
-% ^^A Then we finish the macro by closing all \verb=\if='s.
-% \begin{macrocode}
- % \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
- % \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A
-% ^^A
-% ^^A \subsubsection{Multiple columns ($*$--form)}
-% ^^A
-% ^^A \begin{macro}{\@xexpast}
-% ^^A \begin{macro}{\the@toks}
-% ^^A \begin{macro}{\the@toksz}
-% ^^A \label{@xexpast} Now we discuss the macro that deletes all forms
-% ^^A of type \verb=*{=\textit{N\/}\verb=}{=\textit{String\/}\verb=}= from a user
-% ^^A preamble and replaces them with \textit{N} copies of
-% ^^A \textit{String}. Nested $*$--expressions are dealt with
-% ^^A correctly, that means $*$--expressions are not substituted if
-% ^^A they are in explicit braces, as in \verb=@{*}=.
-% ^^A
-% ^^A This macro is called via
-% ^^A \verb=\@xexpast=\meta{preamble}\verb=*0x\@@=.
-% ^^A The $*$--expression \verb=*0x= is being used to terminate the
-% ^^A recursion,
-% ^^A as we shall see later, and \verb=\@@= serves as an argument
-% ^^A delimiter. \verb=\@xexpast= has four arguments. The first
-% ^^A one is the part of the
-% ^^A user preamble before the first $*$--expression while the second
-% ^^A and third ones are the arguments of the first $*$--expression
-% ^^A (that is \textit{N} and \textit{String} in the notation mentioned
-% ^^A above).
-% ^^A The fourth argument is the rest of the preamble.
-% \begin{macrocode}
- % \def\@xexpast#1*#2#3#4\@@{%
-% \end{macrocode}
-% ^^A The number of copies of \textit{String} (\verb=#2=) that are to be
-% ^^A produced will be saved in a \textsf{count} register.
-% \begin{macrocode}
- % \@tempcnta #2
-% \end{macrocode}
-% ^^A We save the part of the preamble which does not
-% ^^A contain a $*$--form (\verb=#1=)
-% ^^A in a \PlainTeX\ \textsf{token} register.
-% ^^A We also save \textit{String} (\verb=#3=) using a \LaTeX\
-% ^^A \textsf{token} register.
-% \begin{macrocode}
- % \toks@={#1}\@temptokena={#3}%
-% \end{macrocode}
-% ^^A Now we have to use a little trick to produce \textit{N} copies of
-% ^^A \textit{String}.
-% ^^A We could try \verb=\def\@tempa{#1}= and then
-% ^^A \textit{N} times \verb=\edef\@tempa{\@tempa#3}=. This would have the
-% ^^A undesired effect that all macros within \verb=#1= and \verb=#3=
-% ^^A would be expanded, although, for example, constructions like
-% ^^A \verb=@{..}= are not supposed to be changed.
-% ^^A That is why we \verb=\let= two control sequences to
-% ^^A be equivalent to \verb=\relax=.
-% \begin{macrocode}
- % \let\the@toksz\relax \let\the@toks\relax
-% \end{macrocode}
-% ^^A Then we ensure that \verb=\@tempa= contains
-% ^^A \verb={\the@toksz\the@toks...\the@toks}= (the macro
-% ^^A \verb=\the@toks= exactly \textit{N\/} times) as substitution text.
-% \begin{macrocode}
- % \def\@tempa{\the@toksz}%
- % \ifnum\@tempcnta >0 \@whilenum\@tempcnta >0\do
- % {\edef\@tempa{\@tempa\the@toks}\advance \@tempcnta \m@ne}%
-% \end{macrocode}
-% ^^A If \textit{N\/} was greater than zero we prepare for another call
-% ^^A of \verb=\@xexpast=. Otherwise we assume we have reached the end of
-% ^^A the user preamble, because we had appended \verb=*0x\@@= when we first
-% ^^A called \verb=\@xexpast=. In other words: if the user inserts
-% ^^A \verb=*{0}{..}= in his preamble, \LaTeX\ ignores the rest of it.
-% \begin{macrocode}
- % \let \@tempb \@xexpast \else
- % \let \@tempb \@xexnoop \fi
-% \end{macrocode}
-% ^^A Now we will make sure that the part of the user preamble, which
-% ^^A was already dealt with, will be saved again in \verb=\@tempa=.
-% \begin{macrocode}
- % \def\the@toksz{\the\toks@}\def\the@toks{\the\@temptokena}%
- % \edef\@tempa{\@tempa}%
-% \end{macrocode}
-% ^^A We have now evaluated the first $*$--expression, and the user
-% ^^A preamble up to this point
-% ^^A is saved in \verb=\@tempa=. We will put the contents of
-% ^^A \verb=\@tempa= and the rest of the user preamble together and work
-% ^^A on the result with \verb=\@tempb=. This macro either corresponds
-% ^^A to \verb=\@xexpast=, so that the next
-% ^^A $*$--expression is handled, or to the macro \verb=\@xexnoop=,
-% ^^A which only ends the recursion by deleting its argument.
-% \begin{macrocode}
- % \expandafter \@tempb \@tempa #4\@@}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@xexnoop}
-% ^^A So the first big problem is solved. Now it is easy to
-% ^^A specify \verb=\@xexnoop=.
-% ^^A Its argument is delimited by \verb=\@@= and it simply expands to
-% ^^A nothing.
-% \begin{macrocode}
- % % \def\@xexnoop#1\@@{}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A
-% ^^A \subsubsection{The insertion of declarations
-% ^^A (\texttt{>}, \texttt{<}, \texttt{!}, \texttt{@})}
-% ^^A
-% ^^A
-% ^^A The preamble will be enlarged with the help of \verb=\xdef=, but the
-% ^^A arguments of \texttt{>}, \texttt{<},~\texttt{!}\ and \texttt{@} are
-% ^^A not supposed to be expanded during the construction (we want an
-% ^^A implementation that doesn't need a \verb=\protect=). So we have to find a
-% ^^A way to inhibit the expansion of those arguments.
-% ^^A
-% ^^A We will solve this problem with \textsf{token} registers. We need
-% ^^A one register for every \texttt{!}\ and \texttt{@}, while we need two
-% ^^A for every \texttt{c}, \texttt{l}, \texttt{r}, \texttt{m}, \texttt{p}
-% ^^A or \texttt{b}. This limits the number of columns of a table because
-% ^^A there are only 256 \textsf{token} registers. But then, who needs
-% ^^A tables with more than 100 columns?
-% ^^A
-% ^^A One could also find a solution which only needs two or three
-% ^^A \textsf{token} registers by proceeding similarly as in the macro
-% ^^A \verb=\@xexpast= (see page \pageref{@xexpast}). The advantage of our
-% ^^A approach is the fact that we avoid some of the problems that arise
-% ^^A with the other method\footnote{Maybe there are also historical
-% ^^A reasons.}.
-% ^^A
-% ^^A So how do we proceed? Let us assume that we had \verb=!{foo}= in the
-% ^^A user preamble and say we saved \texttt{foo} in
-% ^^A \textsf{token} register $5$. Then we call
-% ^^A \verb=\@addtopreamble{\the@toks5}= where
-% ^^A \verb=\the@toks= is defined in a way that it does not expand
-% ^^A (for example it could be equivalent to \verb=\relax=). Every
-% ^^A following call
-% ^^A of \verb=\@addtopreamble= leaves \verb=\the@toks5= unchanged in
-% ^^A \verb=\@preamble=. If the construction of the preamble is completed
-% ^^A we change the definition of \verb=\the@toks= to
-% ^^A \verb=\the\toks= and expand \verb=\@preamble= for the last time.
-% ^^A During this process all parts of the form
-% ^^A \verb=\the@toks=\meta{Number}
-% ^^A will be substituted by the contents of the respective \textsf{token}
-% ^^A registers.
-% ^^A
-% ^^A As we can see from this informal discussion the construction of the
-% ^^A preamble has to take place within a group, so that the
-% ^^A \textsf{token} registers we use will be freed later on. For that
-% ^^A reason we keep all assignments to \verb=\@preamble= global; therefore the
-% ^^A replacement text of this macro will remain the same after we leave
-% ^^A the group.
-% ^^A
-% ^^A \begin{macro}{\count@}
-% ^^A We further need a \textsf{count} register to remember which
-% ^^A \textsf{token} register is to be used next. This will be
-% ^^A initialized with $-1$ if we want to begin with the \textsf{token}
-% ^^A register $0$. We use the \PlainTeX\ scratch register \verb=\count@=
-% ^^A because everything takes place locally. All we have to do is
-% ^^A insert \verb=\the@toks= \verb=\the= \verb=\count@= into the preamble.
-% ^^A \verb=\the@toks= will remain unchanged and \verb=\the\count@= expands into
-% ^^A the saved number.
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\prepnext@tok}
-% ^^A The macro \verb=\prepnext@tok= is in charge of preparing the next
-% ^^A \textsf{token} register. For that purpose we increase
-% ^^A \verb=\count@= by $1$:
-% \begin{macrocode}
- % \def\prepnext@tok{\advance \count@ \@ne
-% \end{macrocode}
-% ^^A Then we locally delete any contents the
-% ^^A \textsf{token} register might have.
-% \begin{macrocode}
- % \toks\count@{}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\save@decl}
-% ^^A During the construction of the preamble the current
-% ^^A \textsf{token} is always saved in the macro \verb=\@nextchar= (see the
-% ^^A definition of \verb=\@mkpream= on page \pageref{@mkpream}). The macro
-% ^^A \verb=\save@decl= saves it into the next free \textsf{token} register,
-% ^^A i.e.\ in \verb=\toks\count@=.
-% \begin{macrocode}
- % \def\save@decl{\toks\count@ \expandafter{\@nextchar}}
-% \end{macrocode}
-% ^^A The reason for the use of \verb=\relax= is the following
-% ^^A hypothetical situation in the preamble:
-% ^^A \quad \verb=..\the\toks1\the\toks2..= \quad \TeX\ expands
-% ^^A \verb=\the\toks2= first in order to find out if the digit \verb=1=
-% ^^A is followed by other digits. E.g.\ a \verb=5= saved in the
-% ^^A \textsf{token} register $2$ would lead \TeX\ to insert the contents
-% ^^A of \textsf{token} register $15$ instead of $1$ later on.
-% ^^A
-% ^^A The example above referred to an older version of \verb=\save@decl= which
-% ^^A inserted a \verb=\relex= inside the token register. This is now moved to
-% ^^A the places where the actual token registers are inserted (look for
-% ^^A \verb=\the@toks=) because the old version would still make= @=
-% ^^A expressions to moving arguments since after expanding the second
-% ^^A register while looking for the end of the number the contents of the
-% ^^A token register is added so that later on the whole register will be
-% ^^A expanded. This serious bug was found after nearly two years
-% ^^A international use of this package by Johannes Braams.
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A How does the situation look like, if we want to add another column
-% ^^A to the preamble, i.e.\ if we have found a \texttt{c}, \texttt{l},
-% ^^A \texttt{r}, \texttt{p}, \texttt{m} or \texttt{b} in the user
-% ^^A preamble? In this case we have the problem of the \textsf{token}
-% ^^A register from \verb=>{..}= and \verb=<{..}= having to be inserted at this
-% ^^A moment because formatting instructions like \verb=\hfil= have to be set
-% ^^A around them. On the other hand it is not known yet, if any \verb=<{..}=
-% ^^A instruction will appear in the user preamble at all.
-% ^^A
-% ^^A We solve this problem by adding two \textsf{token} registers at a
-% ^^A time. This explains, why we have freed the \textsf{token} registers
-% ^^A in \verb=\prepnext@tok=.
-% ^^A
-% ^^A \begin{macro}{\insert@column}
-% ^^A \begin{macro}{\@sharp}
-% ^^A We now define the macro \verb=\insert@column= which will do
-% ^^A this work for us.
-% \begin{macrocode}
- % \def\insert@column{%
-% \end{macrocode}
-% ^^A Here, we assume that the \textsf{count} register
-% ^^A \verb=\@tempcnta= has saved the value $\verb=\count@= - 1$.
-% \begin{macrocode}
- % \the@toks \the \@tempcnta
-% \end{macrocode}
-% ^^A Next follows the \verb=#= sign which specifies the place
-% ^^A where the text of the column shall be inserted. To avoid
-% ^^A errors during the expansions in
-% ^^A \verb=\@addtopreamble= we hide this sign in the command
-% ^^A \verb=\@sharp= which is temporarily occupied with
-% ^^A \verb=\relax= during the build-up of the preamble.
-% ^^A To remove unwanted spaces before and after the column text, we set
-% ^^A an \verb=\ignorespaces= in front and a \verb=\unskip= afterwards.
-% \begin{macrocode}
- % \ignorespaces \@sharp \unskip
-% \end{macrocode}
-% ^^A Then the second \textsf{token} register follows whose number should
-% ^^A be saved in \verb=\count@=.
-% ^^A We make sure that there will be no further expansion after reading
-% ^^A the number, by finishing with \verb=\relax=. The case above is not
-% ^^A critical since it is ended by \verb=\ignorespaces=.
-% \begin{macrocode}
- % \the@toks \the \count@ \relax}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A
-% ^^A \subsubsection{The separation of columns}
-% ^^A
-% ^^A \begin{macro}{\@addamp}
-% ^^A In the preamble a \verb=&= has to be inserted between any two columns;
-% ^^A before the first column there should not be a \verb=&=. As the user
-% ^^A preamble may start with a \texttt{|} we have to remember somehow
-% ^^A if we have already inserted a \verb=#= (i.e.\ a column). This is done
-% ^^A with the boolean variable \verb=\if@firstamp= that we test in
-% ^^A \verb=\@addamp=, the macro that inserts the \verb=&=.
-% \begin{macrocode}
- % % \newif \@iffirstamp
- % % \def\@addamp{\if@firstamp \@firstampfalse
- % % \else \@addtopreamble &\fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@acol}
-% ^^A \begin{macro}{\@acolampacol}
-% ^^A \begin{macro}{\col@sep}
-% ^^A We will now define some abbreviations for the extensions,
-% ^^A appearing most often in the preamble build-up.
-% ^^A Here \verb=\col@sep= is a \textsf{dimen} register which is set
-% ^^A equivalent to \verb=\arraycolsep= in an \textsf{array}--environment,
-% ^^A otherwise it is set equivalent to \verb=\tabcolsep=.
-% \begin{macrocode}
- % \newdimen\col@sep
- % \def\@acol{\@addtopreamble{\hskip\col@sep}}
- % % \def\@acolampacol{\@acol\@addamp\@acol}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \subsubsection{The macro \texttt{\textbackslash @mkpream}}
-% ^^A
-% ^^A \begin{macro}{\@mkpream}
-% ^^A \begin{macro}{\the@toks}
-% ^^A \label{@mkpream}
-% ^^A Now we can define the macro which builds up the preamble for the
-% ^^A \verb=\halign=.
-% ^^A First we initialize \verb=\@preamble=, \verb=\@lastchclass=
-% ^^A and the boolean variable \verb=\if@firstamp=.
-% \begin{macrocode}
- % \def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue
-% \end{macrocode}
-% ^^A During the build-up of the preamble we cannot directly use the
-% ^^A \verb=#= sign; this would lead to an error message in the next
-% ^^A \verb=\@addtopreamble= call.
-% ^^A Instead, we use the command \verb=\@sharp= at places where later
-% ^^A a \verb=#= will be.
-% ^^A This command is at first given the meaning \verb=\relax=;
-% ^^A therefore it will not be expanded when the preamble
-% ^^A is extended.
-% ^^A In the macro \verb=\@array=, shortly before the \verb=\halign=
-% ^^A is carried out, \verb=\@sharp= is given its final meaning.
-% ^^A
-% ^^A In a similar way,
-% ^^A we deal with the commands \verb=\@startpbox= and
-% ^^A \verb=\@endpbox=, although the reason is different here: these
-% ^^A macros expand in many \textsf{tokens} which would delay the
-% ^^A build-up of the preamble.
-% \begin{macrocode}
- % \let\@sharp\relax \let\@startpbox\relax \let\@endpbox\relax
-% \end{macrocode}
-% ^^A Now we remove possible $*$-forms in the user preamble with the
-% ^^A command \verb=\@xexpast=. As we already know, this command saves
-% ^^A its result in the macro \verb=\@tempa=.
-% \begin{macrocode}
- % \@xexpast #1*0x\@@
-% \end{macrocode}
-% ^^A Afterwards we initialize all registers and macros, that we need
-% ^^A for the build-up of the preamble.
-% ^^A Since we want to start with the \textsf{token} register $0$,
-% ^^A \verb=\count@= has to contain the value $-1$.
-% \begin{macrocode}
- % \count@\m@ne
- % \let\the@toks\relax
-% \end{macrocode}
-% ^^A Then we call up \verb=\prepnext@tok= in order to prepare the
-% ^^A \textsf{token} register $0$ for use.
-% \begin{macrocode}
- % \prepnext@tok
-% \end{macrocode}
-% ^^A To evaluate the user preamble (without stars) saved in
-% ^^A \verb=\@tempa= we use the \LaTeX--macro \verb=\@tfor=.
-% ^^A The strange appearing construction with \verb=\expandafter= is
-% ^^A based on the fact that we have to put the replacement text of
-% ^^A \verb=\@tempa= and not the macro \verb=\@tempa= to this
-% ^^A \LaTeX--macro.
-% \begin{macrocode}
- % \expandafter \@tfor \expandafter \@nextchar
- % \expandafter :\expandafter =\@tempa \do
-% \end{macrocode}
-% ^^A The body of this loop (the group after the \verb=\do=)
-% ^^A is executed for one \textsf{token} at a time, whereas
-% ^^A the current \textsf{token} is saved in \verb=\@nextchar=.
-% ^^A At first we evaluate the current \textsf{token} with the already
-% ^^A defined macro \verb=\@testpach=, i.e.\ we assign to
-% ^^A \verb=\@chclass= the character class and to \verb=\@chnum=
-% ^^A the character number of this \textsf{token}.
-% \begin{macrocode}
- % {\@testpach
-% \end{macrocode}
-% ^^A Then we branch out depending on the value of \verb=\@chclass= into
-% ^^A different macros that extend the preamble respectively.
-% \begin{macrocode}
- % \ifcase \@chclass \@classz \or \@classi \or \@classii
- % \or \save@decl \or \or \@classv \or \@classvi
- % \or \@classvii \or \@classviii \or \@classix
- % \or \@classx \fi
-% \end{macrocode}
-% ^^A Two cases deserve our special attention: Since the current
-% ^^A \textsf{token} cannot have the character class $4$ (start) we
-% ^^A have skipped this possibility. If the character class is $3$,
-% ^^A only the content of \verb=\@nextchar= has to be saved into the current
-% ^^A \textsf{token} register; therefore we call up \verb=\save@decl=
-% ^^A directly and save a macro name. After the preamble has been
-% ^^A extended we assign the value of \verb=\@chclass= to the counter
-% ^^A \verb=\@lastchclass= to assure that this information will be available
-% ^^A during the next run of the loop.
-% \begin{macrocode}
- % \@lastchclass\@chclass}%
-% \end{macrocode}
-% ^^A After the loop has been finished space must still be added to
-% ^^A the created preamble, depending on the last \textsf{token}.
-% ^^A Depending on the value of \verb=\@lastchclass= we perform
-% ^^A the necessary operations.
-% \begin{macrocode}
- % \ifcase\@lastchclass
-% \end{macrocode}
-% ^^A If the last class equals $0$ we add a
-% ^^A \verb=\hskip \col@sep=.
-% \begin{macrocode}
- % \@acol \or
-% \end{macrocode}
-% ^^A If it equals $1$ we do not add any additional space so that the
-% ^^A horizontal lines do not exceed the vertical ones.
-% \begin{macrocode}
- % \or
-% \end{macrocode}
-% ^^A Class $2$ is treated like class $0$ because a \verb=<{...}= can
-% ^^A only directly follow after class $0$.
-% \begin{macrocode}
- % \@acol \or
-% \end{macrocode}
-% ^^A Most of the other possibilities can only appear if the user
-% ^^A preamble was defective. Class $3$ is not allowed since after a
-% ^^A \verb=>{..}= there must always follow a \texttt{c}, \texttt{l},
-% ^^A \texttt{r}, \texttt{p},\texttt{m} or \texttt{b}. We report an
-% ^^A error and ignore the declaration given by \verb={..}=.
-% \begin{macrocode}
- % \@preamerr \thr@@ \or
-% \end{macrocode}
-% ^^A If \verb=\@lastchclass= is $4$ the user preamble has been empty.
-% ^^A To continue, we insert a \verb=#= in the preamble.
-% \begin{macrocode}
- % \@preamerr \tw@ \@addtopreamble\@sharp \or
-% \end{macrocode}
-% ^^A Class $5$ is allowed again. In this case
-% ^^A (the user preamble ends with \verb=@{..}=) we need not
-% ^^A do anything.
-% \begin{macrocode}
- % \or
-% \end{macrocode}
-% ^^A Any other case means that the arguments to \verb=@=, \texttt{!},
-% ^^A \texttt{<}, \texttt{>}, \texttt{p}, \texttt{m} or \texttt{b} have
-% ^^A been forgotten. So we report an error and ignore the last
-% ^^A \textsf{token}.
-% \begin{macrocode}
- % \else \@preamerr \@ne \fi
-% \end{macrocode}
-% ^^A Now that the build-up of the preamble is almost finished we can
-% ^^A insert the \textsf{token} registers and therefore redefine
-% ^^A \verb=\the@toks=. The actual insertion, though, is performed
-% ^^A later.
-% \begin{macrocode}
- % \def\the@toks{\the\toks}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A \subsubsection{The macros \texttt{\textbackslash @classz}
-% ^^A to \texttt{\textbackslash @classx}}
-% ^^A
-% ^^A The preamble is extended by the macros \verb=\@classz= to
-% ^^A \verb=\@classx= which are called by \verb=\@mkpream=
-% ^^A depending on \verb=\@lastchclass=
-% ^^A (i.e. the character class of the last \textsf{token}).
-% ^^A \begin{macro}{\@classx}
-% ^^A First we define =\@classx= because of its important r\^ole.
-% ^^A When it is called we find that the current
-% ^^A \textsf{token} is \texttt{p}, \texttt{m} or \texttt{b}.
-% ^^A That means that a new column has to start.
-% \begin{macrocode}
- % \def\@classx{%
-% \end{macrocode}
-% ^^A Depending on the value of \verb=\@lastchclass= different actions
-% ^^A must take place:
-% \begin{macrocode}
- % \ifcase \@lastchclass
-% \end{macrocode}
-% ^^A If the last character class was $0$ we separate the columns by
-% ^^A \verb=\hskip\col@sep= followed by \verb=&= and another
-% ^^A \verb=\hskip\col@sep=.
-% \begin{macrocode}
- % \@acolampacol \or
-% \end{macrocode}
-% ^^A If the last class was class $1$ --- that means that a vertical
-% ^^A line was
-% ^^A drawn, --- before this line a \verb=\hskip\col@sep= was inserted.
-% ^^A Therefore there has to be only a \verb=&= followed by
-% ^^A \verb=\hskip\col@sep=. But this \verb=&= may be inserted only
-% ^^A if this is not the first column. This process is controlled
-% ^^A by \verb=\if@firstamp= in the macro \verb=\addamp=.
-% \begin{macrocode}
- % \@addamp \@acol \or
-% \end{macrocode}
-% ^^A Class $2$ is treated like class $0$ because \verb=<{...}= can only
-% ^^A follow after class $0$.
-% \begin{macrocode}
- % \@acolampacol \or
-% \end{macrocode}
-% ^^A Class $3$ requires no actions because all things necessary have
-% ^^A been done by the preamble \textsf{token} \texttt{>}.
-% \begin{macrocode}
- % \or
-% \end{macrocode}
-% ^^A Class $4$ means that we are at the beginning of the preamble.
-% ^^A Therefore we start the preamble with \verb=\hskip\col@sep= and
-% ^^A then call \verb=\@firstampfalse=. This makes sure that a later
-% ^^A \verb=\@addamp= inserts the character
-% ^^A \verb=&= into the preamble.
-% \begin{macrocode}
- % \@acol \@firstampfalse \or
-% \end{macrocode}
-% ^^A For class $5$ \textsf{tokens} only the character \verb=&= is inserted
-% ^^A as a column separator. Therefore we call \verb=\@addamp=.
-% \begin{macrocode}
- % \@addamp
-% \end{macrocode}
-% ^^A Other cases are impossible. For an example
-% ^^A $\verb=\@lastchclass= = 6$---as it might appear in a
-% ^^A preamble of the form \verb=...!p...=---\texttt{p} would have
-% ^^A been taken as an argument of \texttt{!}\ by \verb=\@testpach=.
-% \begin{macrocode}
- % \fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\@classz}
-% ^^A If the character class of the last \textsf{token} is $0$ we have
-% ^^A \texttt{c}, \texttt{l}, \texttt{r} or an argument of \texttt{m},
-% ^^A \texttt{b} or\ \texttt{p}. In the first three cases the preamble
-% ^^A must be extended the same way as if we had class $10$. The
-% ^^A remaining two cases do not require any action because the space
-% ^^A needed was generated by the last \textsf{token} (i.e.\
-% ^^A \texttt{m}, \texttt{b} or \texttt{p}). Since \verb=\@lastchclass= has
-% ^^A the value $10$ at this point nothing happens when \verb=\@classx= is
-% ^^A called. So the macro \verb=\@chlassz= may start like this:
-% \begin{macrocode}
- % \def\@classz{\@classx
-% \end{macrocode}
-% ^^A According to the definition of \verb=\insert@column= we must store
-% ^^A the number of the \textsf{token} register in which a preceding
-% ^^A \verb=>{..}= might have stored its argument into
-% ^^A \verb=\@tempcnta=.
-% \begin{macrocode}
- % \@tempcnta \count@
-% \end{macrocode}
-% ^^A To have $\verb=\count@= = \verb=\@tmpcnta= + 1$ we prepare
-% ^^A the next \textsf{token} register.
-% \begin{macrocode}
- % \prepnext@tok
-% \end{macrocode}
-% ^^A Now the preamble must be extended with the column whose format
-% ^^A can be determined by \verb=\@chnum=.
-% \begin{macrocode}
- % \@addtopreamble{\ifcase \@chnum
-% \end{macrocode}
-% ^^A If \verb=\@chnum= has the value $0$ a centered column has to be
-% ^^A generated.
-% ^^A So we begin with stretchable space.
-% \begin{macrocode}
- % \hfil
-% \end{macrocode}
-% ^^A The command \verb=\d@llarbegin= follows expanding into \verb=\begingroup=
-% ^^A (in the \textsf{tabular}--environment) or into \verb=$=. Doing this
-% ^^A (provided an appropriate setting of \verb=\d@llarbegin=) we achieve
-% ^^A that the contents of the columns of an \textsf{array}--environment
-% ^^A are set in math mode while those of a \textsf{tabular}--environment
-% ^^A are set in LR mode.
-% \begin{macrocode}
- % \d@llarbegin
-% \end{macrocode}
-% ^^A Now we insert the contents of the two \textsf{token} registers
-% ^^A and the symbol
-% ^^A for the column entry (i.e.\ \verb=#= or
-% ^^A more precise \verb=\@sharp=) using \verb=\insert@column=.
-% \begin{macrocode}
- % \insert@column
-% \end{macrocode}
-% ^^A We end this case with \verb=\d@llarend= and \verb=\hfil= where \verb=\d@llarend=
-% ^^A again is either \verb=$= or \verb=\endgroup=.
-% \begin{macrocode}
- % \d@llarend \hfil \or
-% \end{macrocode}
-% ^^A The templates for \texttt{l} and \texttt{r} (i.e.\ \verb=\@chnum= $1$
-% ^^A or $2$) are generated the same way. Since one \verb=\hfil= is
-% ^^A missing the text is moved to the relevant side.
-% ^^A The \verb=\kern\z@= is needed in case of an empty column
-% ^^A entry. Otherwise
-% ^^A the \verb=\unskip= in \verb=\insert@column= removes the
-% ^^A \verb=\hfil=. Changed to \verb=\hskip1sp= so that it interacts better with
-% ^^A \verb=\@bsphack=.
-% \begin{macrocode}
- % \hskip1sp\d@llarbegin \insert@column \d@llarend \hfil \or
- % \hfil\hskip1sp\d@llarbegin \insert@column \d@llarend \or
-% \end{macrocode}
-% ^^A The templates for \texttt{p}, \texttt{m} and \texttt{b} mainly
-% ^^A consist of a \textsf{box}. In case of \texttt{m} it is generated
-% ^^A by \verb=\vcenter=. This command is allowed only in math
-% ^^A mode. Therefore we start with a~\verb=$=.
-% \begin{macrocode}
- % $\vcenter%$ emacs
-% \end{macrocode}
-% ^^A The part of the templates which is the same in all three cases
-% ^^A (\texttt{p}, \texttt{m} and \texttt{b})
-% ^^A is built by the macros \verb=\@startpbox= and
-% ^^A \verb=\@endpbox=. \verb=\@startpbox= has an argument:
-% ^^A the width of the column which is stored in the current
-% ^^A \textsf{token} (i.e.\ \verb=\@nextchar=).
-% ^^A Between these two macros we find the well known
-% ^^A \verb=\insert@column=.
-% \begin{macrocode}
- % \@startpbox{\@nextchar}\insert@column \@endpbox $\or%$ emacs
-% \end{macrocode}
-% ^^A The templates for \texttt{p} and \texttt{b} are generated in the
-% ^^A same way though we do not need the \verb=$= characters because we use
-% ^^A \verb=\vtop= or \verb=\vbox=.
-% \begin{macrocode}
- % \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
- % \vbox \@startpbox{\@nextchar}\insert@column \@endpbox
-% \end{macrocode}
-% ^^A Other values for \verb=\@chnum= are impossible. Therefore we
-% ^^A end the arguments to \verb=\@addtopreamble= and \verb=\ifcase=.
-% ^^A Before we come to the end of \verb=\@classz= we have to
-% ^^A prepare the next \textsf{token} register.
-% \begin{macrocode}
- % \fi}\prepnext@tok}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\@classix}
-% ^^A In case of class $9$ (\texttt{>}--\textsf{token}) we first check
-% ^^A if the character class of the last
-% ^^A \textsf{token} was $3$. In this case we have a
-% ^^A user preamble of the form \verb=..>{...}>{...}..= which
-% ^^A is not allowed. We only give an error message and continue.
-% ^^A So the declarations defined by the first \verb=>{...}=
-% ^^A are ignored.
-% \begin{macrocode}
- % \def\@classix{\ifnum \@lastchclass = \thr@@
- % \@preamerr \thr@@ \fi
-% \end{macrocode}
-% ^^A Furthermore, we call up \verb=\@class10= because afterwards always a
-% ^^A new column is started by \texttt{c}, \texttt{l}, \texttt{r},
-% ^^A \texttt{p}, \texttt{m} or \texttt{b}.
-% \begin{macrocode}
- % \@classx}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\@classviii}
-% ^^A If the current \textsf{token} is a \texttt{<} the last character
-% ^^A class must be $0$. In this case it is not necessary to extend the
-% ^^A preamble. Otherwise we output an error message, set \verb=\@chclass=
-% ^^A to $6$ and call \verb=\@classvi=. By doing this we achieve that
-% ^^A \texttt{<} is treated like \texttt{!}.
-% \begin{macrocode}
- % \def\@classviii{\ifnum \@lastchclass >\z@
- % \@preamerr 4\@chclass 6 \@classvi \fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@arrayrule}
-% ^^A There is only one incompatibility with the original definition:
-% ^^A the definition of \verb=\@arrayrule=. In the original a line without
-% ^^A width\footnote{So the space between \texttt{cc} and \texttt{c|c}
-% ^^A is equal.} is created by multiple insertions of
-% ^^A \verb=\hskip .5\arrayrulewidth=.
-% ^^A We only insert a vertical line into the
-% ^^A preamble. This is done to prevent problems with \TeX's main
-% ^^A memory when generating tables with many vertical lines in them
-% ^^A (especially in the case of \textsf{floats}).
-% \begin{macrocode}
- % \def\@arrayrule{\@addtopreamble \vline}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@classvii}
-% ^^A As a consequence it follows that in case of class $7$
-% ^^A (\verb=@= \textsf{token}) the preamble need not to be extended.
-% ^^A In the original definition $\verb=\@lastchclass= = 1$
-% ^^A is treated by inserting \verb=\hskip .5\arrayrulewidth=.
-% ^^A We only check if the last \textsf{token} was of class $3$ which is
-% ^^A forbidden.
-% \begin{macrocode}
- % \def\@classvii{\ifnum \@lastchclass = \thr@@
-% \end{macrocode}
-% ^^A If this is true we output an error message and
-% ^^A ignore the declarations stored
-% ^^A by the last \verb=>{...}=, because these are overwritten
-% ^^A by the argument of \texttt{@}.
-% \begin{macrocode}
- % \@preamerr \thr@@ \fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\@classvi}
-% ^^A If the current \textsf{token} is a regular \texttt{!}\ and the
-% ^^A last class was $0$ or $2$ we extend the preamble with
-% ^^A \verb=\hskip\col@sep=. If the last \textsf{token} was of class $1$
-% ^^A (for instance \texttt{|}) we extend with \verb=\hskip \doublerulesep=
-% ^^A because the construction \verb=!{...}= has to be treated like
-% ^^A \texttt{|}.
-% \begin{macrocode}
- % \def\@classvi{\ifcase \@lastchclass
- % \@acol \or
- % \@addtopreamble{\hskip \doublerulesep}\or
- % \@acol \or
-% \end{macrocode}
-% ^^A Now \verb=\@preamerr...= should follow because a
-% ^^A user preamble of the form \verb=..>{..}!.= is not allowed.
-% ^^A To save memory we call \verb=\@classvii= instead which also
-% ^^A does what we want.
-% \begin{macrocode}
- % \@classvii
-% \end{macrocode}
-% ^^A If \verb=\@lastchclass= is $4$ or $5$ nothing has to be done.
-% ^^A Class $6$ to $10$ are not possible.
-% ^^A So we finish the macro.
-% \begin{macrocode}
- % \fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@classii}
-% ^^A \begin{macro}{\@classiii}
-% ^^A In the case of character classes $2$ and $3$ (i.e.\ the argument
-% ^^A of \texttt{<} or \texttt{>}) we only have to store the current
-% ^^A \textsf{token} (\verb=\@nextchar=) into the corresponding
-% ^^A \textsf{token} register since the preparation and
-% ^^A insertion of these registers
-% ^^A are done by the macro \verb=\@classz=.
-% ^^A This is equivalent to calling \verb=\save@decl= in the case of
-% ^^A class $3$. To save command identifiers we do this call up
-% ^^A in the macro \verb=\@mkpream=.
-% ^^A
-% ^^A Class $2$ exhibits a more complicated situation: the
-% ^^A \textsf{token} registers have already been inserted by
-% ^^A \verb=\@classz=. So the value of \verb=\count@= is too high
-% ^^A by one. Therefore we decrease \verb=\count@= by $1$.
-% \begin{macrocode}
- % \def\@classii{\advance \count@ \m@ne
-% \end{macrocode}
-% ^^A Next we store the current \textsf{token} into the correct
-% ^^A \textsf{token} register by calling \verb=\save@decl= and then
-% ^^A increase the value of \verb=\count@= again. At this point we
-% ^^A can save memory once more (at the cost of time) if we use the
-% ^^A macro \verb=\prepnext@tok=.
-% \begin{macrocode}
- % \save@decl\prepnext@tok}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\@classv}
-% ^^A If the current \textsf{token} is of class $5$ then it is an
-% ^^A argument of a \texttt{@} \textsf{token}. It must be stored into a
-% ^^A \textsf{token} register.
-% \begin{macrocode}
- % \def\@classv{\save@decl
-% \end{macrocode}
-% ^^A We extend the preamble with a command which inserts this
-% ^^A \textsf{token} register into the preamble when its construction
-% ^^A is finished. The user expects that this argument is worked out in
-% ^^A math mode if it was used in an
-% ^^A \textsf{array}--environment. Therefore we surround it with
-% ^^A \verb=\d@llar...='s.
-% \begin{macrocode}
- % \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%
-% \end{macrocode}
-% ^^A Finally we must prepare the next \textsf{token} register.
-% \begin{macrocode}
- % \prepnext@tok}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@classi}
-% ^^A In the case of class $0$ we were able to generate the necessary
-% ^^A space between columns by using the macro \verb=\@classx=.
-% ^^A Analogously the macro \verb=\@classvi= can be used for class $1$.
-% \begin{macrocode}
- % \def\@classi{\@classvi
-% \end{macrocode}
-% ^^A Depending on \verb=\@chnum= a vertical line
-% \begin{macrocode}
- % \ifcase \@chnum \@arrayrule \or
-% \end{macrocode}
-% ^^A or (in case of \verb=!{...}=) the current \textsf{token} --- stored
-% ^^A in \verb=\@nextchar= --- has to be inserted into the preamble.
-% ^^A This corresponds to calling \verb=\@classv=.
-% \begin{macrocode}
- % \@classv \fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\@startpbox}
-% ^^A In \verb=\@classz= the macro \verb=\@startpbox= is used.
-% ^^A The width of the \textsf{parbox} is passed as an argument.
-% ^^A \verb=\vcenter=, \verb=\vtop= or \verb=\vbox= are already in the
-% ^^A preamble. So we start with the braces for the wanted box.
-% \begin{macrocode}
- % \def\@startpbox#1{\bgroup
-% \end{macrocode}
-% ^^A The argument is the width of the box. This information has to be
-% ^^A assigned to \verb=\hsize=.
-% ^^A Then we assign default values to several parameters used in a
-% ^^A \textsf{parbox}.
-% \begin{macrocode}
- % \setlength\hsize{#1}\@arrayparboxrestore
-% \end{macrocode}
-% ^^A Our main problem is to obtain the same distance between succeeding
-% ^^A lines of the \textsf{parbox}.
-% ^^A We have to remember that the distance between two \textsf{parboxes}
-% ^^A should be defined by \verb=\@arstrut=. That means that it can be
-% ^^A greater than the distance in a \textsf{parbox}.
-% ^^A Therefore it is not enough to set a \verb=\@arstrut= at the
-% ^^A beginning and at the end of the \textsf{parbox}. This would
-% ^^A dimension the distance
-% ^^A between first and second line and the distance between the two
-% ^^A last lines of the \textsf{parbox} wrongly.
-% ^^A To prevent this we set an invisible rule of height
-% ^^A \verb=\@arstrutbox=
-% ^^A at the beginning of the \textsf{parbox}. This has no effect on the
-% ^^A depth of the first line. At the end of the \textsf{parbox} we set
-% ^^A analogously another invisible rule which only affects the depth
-% ^^A of the last line. It is necessary to wait inserting this strut
-% ^^A until the paragraph actually starts to allow for things like
-% ^^A \verb=\parindent= changes via \verb=>{...}=.
-% \begin{macrocode}
- % \everypar{%
- % \vrule \@height \ht\@arstrutbox \@width \z@
- % \everypar{}}%
- % }
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@endpbox}
-% ^^A If there are any declarations defined by \verb=>{...}=
-% ^^A and \verb=<{...}=
-% ^^A they now follow in the macro \verb=\@classz= --- the contents
-% ^^A of the column in between.
-% ^^A So the macro \verb=\@endpbox= must insert the \textsf{specialstrut}
-% ^^A mentioned earlier and then close the group opened by
-% ^^A \verb=\@startpbox=.
-% \begin{macrocode}
- % \def\@endpbox{\@finalstrut\@arstrutbox \egroup\hfil}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \subsubsection{Building and calling \texttt{\textbackslash halign}}
-% ^^A
-% ^^A \begin{macro}{\@array}
-% ^^A After we have discussed the macros needed for the evaluation
-% ^^A of the user preamble we can define the macro \verb=\@array=
-% ^^A which uses these macros to create a \verb=\halign=.
-% ^^A It has two arguments. The first one is a position argument
-% ^^A which can be \texttt{t}, \texttt{b} or \texttt{c}; the
-% ^^A second one describes the wanted preamble,
-% ^^A e.g.\ it has the form \verb=|c|c|c|=.
-% \begin{macrocode}
- % \def\@array[#1]#2{%
-% \end{macrocode}
-% ^^A First we define a \textsf{strut} whose size basically corresponds
-% ^^A to a normal \textsf{strut} multiplied by the factor
-% ^^A \verb=\arraystretch=.
-% ^^A This \textsf{strut} is then inserted into every row and enforces
-% ^^A a minimal distance between two rows.
-% ^^A Nevertheless, when using horizontal lines, large letters
-% ^^A (like accented capital letters) still collide with such lines.
-% ^^A Therefore at first we add to the height of a normal \textsf{strut}
-% ^^A the value of the parameter \verb=\extrarowheight=.
-% \begin{macrocode}
- % \@tempdima \ht \strutbox
- % \advance \@tempdima by\extrarowheight
- % \setbox \@arstrutbox \hbox{\vrule
- % \@height \arraystretch \@tempdima
- % \@depth \arraystretch \dp \strutbox
- % \@width \z@}%
-% \end{macrocode}
-% ^^A Then we open a group, in which the user preamble is evaluated by
-% ^^A the macro \verb=\@mkpream=. As we know this must happen locally.
-% ^^A This macro creates a preamble for a \verb=\halign= and saves
-% ^^A its result globally in the control sequence \verb=\@preamble=.
-% \begin{macrocode}
- % \begingroup
- % \@mkpream{#2}%
-% \end{macrocode}
-% ^^A We again redefine \verb=\@preamble= so that a call up of \verb=\@preamble=
-% ^^A now starts the \verb=\halign=. Thus also the arguments of \texttt{>},
-% ^^A \texttt{<}, \texttt{@} and \texttt{!}, saved in the
-% ^^A \textsf{token} registers are inserted into the preamble. The
-% ^^A \verb=\tabskip= at the beginning and end of the preamble is set to
-% ^^A \textsf{0pt} (in the beginning by the use of \verb=\ialign=). Also the
-% ^^A command \verb=\@arstrut= is build in, which inserts the
-% ^^A \verb=\@arstrutbox=, defined above. Of course, the opening brace after
-% ^^A \verb=\ialign= has to be implicit as it will be closed in \verb=\endarray=
-% ^^A or another macro.
-% ^^A
-% ^^A The \verb=\noexpand= in front of \verb=\ialign= does no harm in standard \LaTeX{}
-% ^^A and was added since some experimental support for using text glyphs in math
-% ^^A redefines \verb=\halign= with the result that is becomes expandable with
-% ^^A disastrous results in cases like this.
-% ^^A In the kernel definition for this macro the problem does
-% ^^A not surface because there \verb=\protect= is set (which is not necessary in this
-% ^^A implementation as there is no arbitrary user input that can get expanded) and
-% ^^A the experimental code made the redefinition robust. Whether this is the right
-% ^^A approach is open to question; consider the \verb=\noexpand= a courtesy to allow an
-% ^^A unsupported redefinition of a \TeX{} primitive for the moment (as people rely
-% ^^A on that experimental code).
-% \begin{macrocode}
- % \xdef\@preamble{\noexpand \ialign \@halignto
- % \bgroup \@arstrut \@preamble
- % \tabskip \z@ \cr}%
-% \end{macrocode}
-% ^^A What we have not explained yet is the macro \verb=\@halignto=
-% ^^A that was just used. Depending on its replacement text the
-% ^^A \verb=\halign= becomes a \verb=\halign= \texttt{to} \meta{dimen}.
-% ^^A Now we close the group again. Thus
-% ^^A \verb=\@startpbox= and \verb=\@endpbox= as well as all
-% ^^A \textsf{token} registers get their former meaning back.
-% \begin{macrocode}
- % \endgroup
-% \end{macrocode}
-% ^^A To support the \texttt{delarray.sty} package we include a hook
-% ^^A into this part of the code which is a no-op in the main package.
-% \begin{macrocode}
- % \@arrayleft
-% \end{macrocode}
-% ^^A Now we decide depending on the position argument in which
-% ^^A \textsf{box} the \verb=\halign= is to be put. (\verb=\vcenter= may be used
-% ^^A because we are in math mode.)
-% \begin{macrocode}
- % \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
-% \end{macrocode}
-% ^^A Now another implicit opening brace appears; then definitions
-% ^^A which shall stay local follow. While constructing the
-% ^^A \verb=\@preamble= in \verb=\@mkpream= the \verb=#= sign must be
-% ^^A hidden in the macro \verb=\@sharp= which is \verb=\let= to
-% ^^A \verb=\relax= at that moment (see definition of \verb=\@mkpream=
-% ^^A on page~\pageref{@mkpream}).
-% ^^A All these now get their actual meaning.
-% \begin{macrocode}
- % \bgroup
- % \let \@sharp ##\let \protect \relax
-% \end{macrocode}
-% ^^A With the above defined \textsf{struts} we fix down the distance
-% ^^A between rows by setting \verb=\lineskip= and \verb=\baselineskip=
-% ^^A to \textsf{0pt}. Since there have to be set \verb=$='s
-% ^^A around every column in the \textsf{array}--environment
-% ^^A the parameter \verb=\mathsurround= should
-% ^^A also be set to \textsf{0pt}. This prevents additional space between
-% ^^A the rows. The
-% ^^A \PlainTeX--macro \verb=\m@th= does this.
-% \begin{macrocode}
- % \lineskip \z@
- % \baselineskip \z@
- % \m@th
-% \end{macrocode}
-% ^^A Beside, we have to assign a special meaning (which we still have
-% ^^A to specify) to the line separator \verb=\\=. We also have to
-% ^^A redefine the command \verb=\par= in such a way that empty lines in
-% ^^A \verb=\halign= cannot do any damage. We succeed in doing so
-% ^^A by choosing something that will disappear when expanding.
-% ^^A After that we only have to call up \verb=\@preamble= to
-% ^^A start the wanted \verb=\halign=.
-% \begin{macrocode}
- % \let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\arraybackslash}
-% ^^A Restore \verb=\\= for use in array and tabular environment (after
-% ^^A \verb=\raggedright= etc.).
-% \begin{macrocode}
- % \def\arraybackslash{\let\\\tabularnewline}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\extrarowheight}
-% ^^A The \textsf{dimen} parameter used above also needs to be
-% ^^A allocated. As a default value we use \textsf{0pt}, to ensure
-% ^^A compatibility with standard \LaTeX.
-% \begin{macrocode}
- % \newdimen \extrarowheight
- % \extrarowheight=0pt
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@arstrut}
-% ^^A Now the insertion of \verb=\@arstrutbox= through \verb=\@arstut=
-% ^^A is easy since we know exactly in which mode \TeX\ is while working
-% ^^A on the \verb=\halign= preamble.
-% \begin{macrocode}
- % \def\@arstrut{\unhcopy\@arstrutbox}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \subsubsection{The line separator \texttt{\textbackslash\textbackslash}}
-% ^^A
-% ^^A \begin{macro}{\@arraycr}
-% ^^A In the macro \verb=\@array= the line separator \verb=\\= is
-% ^^A \verb=\let= to the command \verb=\@arraycr=.
-% ^^A Its definition starts with a special brace which I have directly
-% ^^A copied from the original definition. It is
-% ^^A necessary, because the \verb=\futurlet= in \verb=\@ifnextchar=
-% ^^A might
-% ^^A expand a following \verb=&= \textsf{token} in a construction like
-% ^^A \verb=\\ &=. This would otherwise end the alignment template at a
-% ^^A wrong time. On the other hand we have to be careful to avoid
-% ^^A producing a real group, i.e.\ \verb={}=, because the command will also
-% ^^A be used for the array environment, i.e.\ in math mode. In that
-% ^^A case an extra \verb={}= would produce an ord atom which could mess up
-% ^^A the spacing. For this reason we use a combination that does not
-% ^^A really produce a group at all but modifies the master counter so
-% ^^A that a \verb=&= will not be considered belonging to the current
-% ^^A \verb=\halign= while we are looking for a \verb=*= or \verb=[=.
-% ^^A For further information see
-% ^^A \cite[Appendix D]{bk:knuth}.
-% \begin{macrocode}
- % \def\@arraycr{\relax\iffalse{\fi\ifnum 0=`}\fi
-% \end{macrocode}
-% ^^A Then we test whether the user is using the star form and ignore
-% ^^A a possible star (I also disagree with this procedure, because a
-% ^^A star does not make any sense here).
-% \begin{macrocode}
- % \@ifstar \@xarraycr \@xarraycr}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@xarraycr}
-% ^^A In the command \verb=\@xarraycr= we test if an optional argument
-% ^^A exists.
-% \begin{macrocode}
- % \def\@xarraycr{\@ifnextchar [%
-% \end{macrocode}
-% ^^A If it does, we branch out into the macro \verb=\@argarraycr= if
-% ^^A not we close the special brace (mentioned above) and end the row
-% ^^A of the \verb=\halign= with a \verb=\cr=.
-% \begin{macrocode}
- % \@argarraycr {\ifnum 0=`{}\fi\cr}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\@argarraycr}
-% ^^A If additional space is requested by the user this case is treated
-% ^^A in the macro \verb=\@argarraycr=. First we close the special brace
-% ^^A and then we test if the additional space is positive.
-% \begin{macrocode}
- % \def\@argarraycr[#1]{\ifnum0=`{}\fi\ifdim #1>\z@
-% \end{macrocode}
-% ^^A If this is the case we create an invisible vertical rule with
-% ^^A depth \verb=\dp\@arstutbox=${}+{}$\meta{wanted\ space}.
-% ^^A Thus we achieve that all vertical lines specified
-% ^^A in the user preamble by a \texttt{|} are now
-% ^^A generally drawn.
-% ^^A Then the row ends with a \verb=\cr=.
-% ^^A
-% ^^A If the space is negative we end the row at once with a \verb=\cr=
-% ^^A and move back up with a \verb=\vskip=.
-% ^^A
-% ^^A While testing these macros I found out that the
-% ^^A \verb=\endtemplate=
-% ^^A created by \verb=\cr= and \verb=&= is something like an
-% ^^A \verb=\outer= primitive and therefore it should not appear in
-% ^^A incomplete \verb=\if= statements. Thus the following solution was
-% ^^A chosen which hides the \verb=\cr= in other macros when \TeX\
-% ^^A is skipping conditional text.
-% \begin{macrocode}
- % \expandafter\@xargarraycr\else
- % \expandafter\@yargarraycr\fi{#1}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@xargarraycr}
-% ^^A \begin{macro}{\@yargarraycr}
-% ^^A The following macros were already explained above.
-% \begin{macrocode}
- % \def\@xargarraycr#1{\unskip
- % \@tempdima #1\advance\@tempdima \dp\@arstrutbox
- % \vrule \@depth\@tempdima \@width\z@ \cr}
- % \def\@yargarraycr#1{\cr\noalign{\vskip #1}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A
-% ^^A \subsubsection{Spanning several columns}
-% ^^A
-% ^^A \begin{macro}{\multicolumn}
-% ^^A If several columns should be held together with a special format
-% ^^A the command \verb=\multicolumn= must be used. It has three
-% ^^A arguments: the number of columns to be covered; the format for
-% ^^A the result column and the actual column entry.
-% \begin{macrocode}
- % \long\def\multicolumn#1#2#3{%
-% \end{macrocode}
-% ^^A First we combine the given number of columns into a single one;
-% ^^A then we start a new block so that the following definition is kept
-% ^^A local.
-% \begin{macrocode}
- % \multispan{#1}\begingroup
-% \end{macrocode}
-% ^^A Since a \verb=\multicolumn= should only describe the format of a
-% ^^A result column, we redefine \verb=\@addamp= in such a way that one gets
-% ^^A an error message if one uses more than one \texttt{c},
-% ^^A \texttt{l}, \texttt{r}, \texttt{p}, \texttt{m} or \texttt{b} in
-% ^^A the second argument. One should consider that this definition is
-% ^^A local to the build-up of the preamble; an \textsf{array}-- or
-% ^^A \textsf{tabular}--environment in the third argument of the
-% ^^A \verb=\multicolumn= is therefore worked through correctly as well.
-% \begin{macrocode}
- % \def\@addamp{\if@firstamp \@firstampfalse \else
- % \@preamerr 5\fi}%
-% \end{macrocode}
-% ^^A Then we evaluate the second argument with the help of
-% ^^A \verb=\@mkpream=.
-% ^^A Now we still have to insert the contents of the \textsf{token}
-% ^^A register into the \verb=\@preamble=, i.e.\ we have to say
-% ^^A \verb=\xdef\@preamble{\@preamble}=. This is achieved shorter by
-% ^^A writing:
-% \begin{macrocode}
- % \@mkpream{#2}\@addtopreamble\@empty
-% \end{macrocode}
-% ^^A After the \verb=\@preamble= is created we forget all local
-% ^^A definitions and occupations of the \textsf{token} registers.
-% \begin{macrocode}
- % \endgroup
-% \end{macrocode}
-% ^^A In the special situation of \verb=\multicolumn= \verb=\@preamble=
-% ^^A is not needed as preamble for a \verb=\halign= but it is directly
-% ^^A inserted into our table. Thus instead of \verb=\sharp=
-% ^^A there has to be the column entry (\verb=#3=) wanted by the user.
-% \begin{macrocode}
- % \def\@sharp{#3}%
-% \end{macrocode}
-% ^^A Now we can pass the \verb=\@preamble= to \TeX\ . For safety
-% ^^A we start with an \verb=\@arstrut=. This should usually be in the
-% ^^A template for the first column however we do not know if this
-% ^^A template was overwritten by our \verb=\multicolumn=.
-% ^^A We also add a \verb=\null= at the right end to prevent any following
-% ^^A \verb=\unskip= (for example from \verb=\\[..]=) to remove the \verb=\tabcolsep=.
-% \begin{macrocode}
- % \@arstrut \@preamble
- % \null
- % \ignorespaces}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A \subsubsection{The Environment Definitions}
-% ^^A
-% ^^A After these preparations we are able to define the environments. They
-% ^^A only differ in the initialisations of \verb=\d@llar...=, \verb=\col@sep=
-% ^^A and \verb=\@halignto=.
-% ^^A
-% ^^A \begin{macro}{\@halignto}
-% ^^A \begin{macro}{\d@llarbegin}
-% ^^A \begin{macro}{\d@llarend}
-% ^^A \verb=\d@llar= has to be
-% ^^A locally asigned since otherwise nested \textsf{tabular} and \textsf{array}
-% ^^A environments (via \verb=\multicolumn=) are impossible.
-% ^^A For 25 years or so \verb=\@halignto= was set globally (to save space on the
-% ^^A save stack, but that was a mistake: if there is a tabular in the
-% ^^A output routine (e.g., in the running header) then that tabular is
-% ^^A able overwrite the \verb=\@halignto=
-% ^^A setting of a tabular in the main text resulting in a very weird error.
-% ^^A When the new font selection scheme is in force we have to
-% ^^A we surround all \verb=\halign= entries
-% ^^A with braces. See remarks in TUGboat 10\#2. Actually we are going
-% ^^A to use \verb=\begingroup= and \verb=\endgroup=. However, this is only
-% ^^A necessary when we are in text mode. In math the surrounding
-% ^^A dollar signs will already serve as the necessary extra grouping
-% ^^A level. Therefore we switch the settings of \verb=\d@llarbegin= and
-% ^^A \verb=\d@llarend= between groups and dollar signs.
-% \begin{macrocode}
- % \let\d@llarbegin\begingroup
- % \let\d@llarend\endgroup
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\array}
-% ^^A Our new definition of \verb=\array= then reads:
-% \begin{macrocode}
- % \def\array{\col@sep\arraycolsep
- % \def\d@llarbegin{$}\let\d@llarend\d@llarbegin\def\@halignto{}%$ emacs
-% \end{macrocode}
-% ^^A Since there might be an optional argument we call another
-% ^^A macro which is also used by the other environments.
-% \begin{macrocode}
- % \@tabarray}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@tabarray}
-% ^^A This macro tests for a optional bracket and then calls up
-% ^^A \verb=\@array= or \verb=\@array[c]= (as default).
-% \begin{macrocode}
- % \def\@tabarray{\@ifnextchar[{\@array}{\@array[c]}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\tabular}
-% ^^A \begin{macro}{\tabular*}
-% ^^A The environments \textsf{tabular} and \textsf{tabular$*$} differ
-% ^^A only in the initialisation of the command \verb=\@halignto=. Therefore
-% ^^A we define
-% \begin{macrocode}
- % \def\tabular{\def\@halignto{}\@tabular}
-% \end{macrocode}
-% ^^A and analogously for the star form. We evaluate the argument first
-% ^^A using =\setlength= so that users of the \texttt{calc} package can
-% ^^A write code like\\ \verb=\begin{tabular*}{(\columnwidth-1cm)/2}...=
-% ^^A \begin{macrocode}
- % \expandafter\def\csname tabular*\endcsname#1{%
- % \setlength\dimen@{#1}%
- % \edef\@halignto{to\the\dimen@}\@tabular}
-% ^^A \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@tabular}
-% ^^A The rest of the job is carried out by the \verb=\@tabular= macro:
-% \begin{macrocode}
- % \def\@tabular{%
-% \end{macrocode}
-% ^^A First of all we have to make sure that we start out in
-% ^^A \textsf{hmode}. Otherwise we might find our table dangling by
-% ^^A itself on a line.
-% \begin{macrocode}
- % \leavevmode
-% \end{macrocode}
-% ^^A It should be taken into consideration that the macro \verb=\@array=
-% ^^A must be called in math mode. Therefore we open a \textsf{box},
-% ^^A insert a \verb=$= and then assign the correct values to \verb=\col@sep= and
-% ^^A \verb=\d@llar...=.
-% \begin{macrocode}
- % \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup% $ emacs
- % \let\d@llarend\endgroup
-% \end{macrocode}
-% ^^A Now everything \textsf{tabular} specific is done and we are able to
-% ^^A call the \verb=\@tabarray= macro.
-% \begin{macrocode}
- % \@tabarray}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\endarray}
-% ^^A When the processing of \textsf{array} is finished we have to
-% ^^A close the \verb=\halign=
-% ^^A and afterwards the surrounding \textsf{box} selected by
-% ^^A \verb=\@array=. To save \textsf{token} space we then redefine
-% ^^A \verb=\@preamble=
-% ^^A because its replacement text isn't longer needed.
-% \begin{macrocode}
- % \def\endarray{\crcr \egroup \egroup \gdef\@preamble{}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\endtabular}
-% ^^A \begin{macro}{\endtabular*}
-% ^^A To end a \textsf{tabular} or \textsf{tabular$*$} environment we
-% ^^A call up \verb=\endarray=, close the math mode and then the surrounding
-% ^^A \verb=\hbox=.
-% \begin{macrocode}
- % \def\endtabular{\endarray $\egroup}%$ emacs
- % \expandafter\let\csname endtabular*\endcsname=\endtabular
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A \subsubsection{Last minute definitions}
-% ^^A
-% ^^A
-% ^^A If this file is used as a package file we should \verb=\let= all macros
-% ^^A to \verb=\relax= that were used in the original but are no longer
-% ^^A necessary.
-% \begin{macrocode}
- % \let\@ampacol=\relax \let\@expast=\relax
- % \let\@arrayclassiv=\relax \let\@arrayclassz=\relax
- % \let\@tabclassiv=\relax \let\@tabclassz=\relax
- % \let\@arrayacol=\relax \let\@tabacol=\relax
- % \let\@tabularcr=\relax \let\@@endpbox=\relax
- % \let\@argtabularcr=\relax \let\@xtabularcr=\relax
-% \end{macrocode}
-% ^^A
-% ^^A \begin{macro}{\@preamerr}
-% ^^A We also have to redefine the error routine \verb=\@preamerr= since
-% ^^A new kind of errors are possible.
-% ^^A The code for this macro is not perfect yet;
-% ^^A it still needs too much memory.
-% \begin{macrocode}
- % \def\@preamerr#1{\def\@tempd{{..} at wrong position: }%
- % %\PackageError{array}{%
- % \ClassError{memoir}{% changed in menoir
- % \ifcase #1 Illegal pream-token (\@nextchar): `c' used\or %0
- % Missing arg: token ignored\or %1
- % Empty preamble: `l' used\or %2
- % >\@tempd token ignored\or %3
- % <\@tempd changed to !{..}\or %4
- % Only one column-spec. allowed.\fi}\@ehc} %5
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A
-% ^^A \subsubsection
-% ^^A [Defining your own column specifiers]
-% ^^A {Defining your own column specifiers\footnotemark}
-% ^^A
-% ^^A \footnotetext{The code and the documentation in this section was
-% ^^A written by David. So far only the code from newarray was plugged
-% ^^A into array so that some parts of the documentation still claim
-% ^^A that this is newarray and even worse, some parts of the code are
-% ^^A unnecessarily doubled. This will go away in a future release. For
-% ^^A the moment we thought it would be more important to bring both
-% ^^A packages together.}
-% ^^A
-% ^^A \begin{macro}{\newcolumn}
-% ^^A In \texttt{newarray.sty} the macro for specifying new columns was
-% ^^A named \verb"\newcolumn". When the functionality was added to
-% ^^A \texttt{array.sty} the command was renamed \verb"\newcolumntype".
-% ^^A Initially both names were supported, but now (In versions of this
-% ^^A package distributed for \LaTeXe) the old name is not defined.
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\newcolumntype}
-% ^^A As
-% ^^A described above, the \verb"\newcolumntype" macro gives users the chance
-% ^^A to define letters, to be used in the same way as the primitive
-% ^^A column specifiers, `c' `p' etc.
-% \begin{macrocode}
- % \def\newcolumntype#1{%
-% \end{macrocode}
-% ^^A \verb"\NC@char" was added in V2.01 so that active characters, like "@" in
-% ^^A AMS\LaTeX\ may be used. This trick was stolen from \texttt{array.sty}
-% ^^A 2.0h. Note that we need to use the possibly active token,
-% ^^A \verb"#1", in several places, as that is the token that actually
-% ^^A appears in the preamble argument.
-% \begin{macrocode}
- % \edef\NC@char{\string#1}%
-% \end{macrocode}
-% ^^A First we check whether there is already a definition for this column.
-% ^^A Unlike \verb"\newcommand" we give a warning rather than an error if it is
-% ^^A defined. If it is a new column, add \verb"\NC@do" \meta{column} to
-% ^^A the list \verb"\NC@list".
-% \begin{macrocode}
- % \@ifundefined{NC@find@\NC@char}%
- % {\@tfor\next:=<>clrmbp@!|\do{\if\noexpand\next\NC@char
- % %\PackageWarning{array}%
- % \@memwarn{Redefining primitive column \NC@char}\fi}% memoir change
- % \NC@list\expandafter{\the\NC@list\NC@do#1}}%
- % {%\PackageWarning{array}
- % \@memwarn{Column \NC@char\space is already defined}}% memoir change
-% \end{macrocode}
-% ^^A Now we define a macro with an argument delimited by the new column
-% ^^A specifier, this is used to find occurrences of this specifier in the
-% ^^A user preamble.
-% \begin{macrocode}
- % \@namedef{NC@find@\NC@char}##1#1{\NC@{##1}}%
-% \end{macrocode}
-% ^^A If an optional argument was not given, give a default argument of 0.
-% \begin{macrocode}
- % \@ifnextchar[{\newcol@{\NC@char}}{\newcol@{\NC@char}[0]}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \begin{macro}{\newcol@}
-% ^^A We can now define the macro which does the rewriting,
-% ^^A \verb"\@reargdef" takes the same arguments as \verb"\newcommand", but
-% ^^A does not check that the command is new. For a column, say `D' with
-% ^^A one argument, define a command \verb"\NC@rewrite@D" with one
-% ^^A argument, which recursively calls \verb"\NC@find" on the user preamble
-% ^^A after replacing the first token or group with the replacement text
-% ^^A specified in the \verb"\newcolumntype" command. \verb"\NC@find" will find the
-% ^^A next occurrence of `D' as it will be \verb"\let" equal to
-% ^^A \verb"\NC@find@D" by \verb"\NC@do".
-% \begin{macrocode}
- % \def\newcol@#1[#2]#3{\expandafter\@reargdef
- % \csname NC@rewrite@#1\endcsname[#2]{\NC@find#3}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \begin{macro}{\NC@}
-% ^^A Having found an occurrence of the new column, save the preamble
-% ^^A before the column in \verb"\@temptokena", then check to see if we
-% ^^A are at the end of the preamble. (A dummy occurrence of the column
-% ^^A specifier will be placed at the end of the preamble by \verb"\NC@do".
-% \begin{macrocode}
- % \def\NC@#1{%
- % \@temptokena\expandafter{\the\@temptokena#1}\futurelet\next\NC@ifend}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \begin{macro}{\NC@ifend}
-% ^^A We can tell that we are at the end as \verb"\NC@do" will place a \verb"\relax"
-% ^^A after the dummy column.
-% \begin{macrocode}
- % \def\NC@ifend{%
-% \end{macrocode}
-% ^^A If we are at the end, do nothing. (The whole preamble will now be in
-% ^^A \verb"\@temptokena".)
-% \begin{macrocode}
- % \ifx\next\relax
-% \end{macrocode}
-% ^^A Otherwise set the flag \verb"\if@tempswa", and rewrite the column.
-% ^^A \verb"\expandafter" introduced 1n V2.01
-% \begin{macrocode}
- % \else\@tempswatrue\expandafter\NC@rewrite\fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \begin{macro}{\NC@do}
-% ^^A If the user has specified `C' and `L' as new columns, the list of
-% ^^A rewrites (in the token register \verb"\NC@list") will look like
-% ^^A \verb"\NC@do *" \verb"\NC@do C" \verb"\NC@do L".
-% ^^A So we need to define \verb"\NC@do" as a one argument macro which
-% ^^A initialises the rewriting of the specified column. Let us assume that
-% ^^A `C' is the argument.
-% \begin{macrocode}
- % \def\NC@do#1{%
-% \end{macrocode}
-% ^^A First we let \verb"\NC@rewrite" and \verb"\NC@find" be
-% ^^A \verb"\NC@rewrite@C" and \verb"\NC@find@C" respectively.
-% \begin{macrocode}
- % \expandafter\let\expandafter\NC@rewrite
- % \csname NC@rewrite@\string#1\endcsname
- % \expandafter\let\expandafter\NC@find
- % \csname NC@find@\string#1\endcsname
-% \end{macrocode}
-% ^^A Clear the token register \verb"\@temptokena" after putting the present
-% ^^A contents of the register in front of the token \verb"\NC@find". At the
-% ^^A end we place the tokens `\verb"C\relax"' which \verb"\NC@ifend" will use
-% ^^A to detect the end of the user preamble.
-% \begin{macrocode}
- % \expandafter\@temptokena\expandafter{\expandafter}%
- % \expandafter\NC@find\the\@temptokena#1\relax}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\showcols}
-% ^^A This macro is useful for debugging \verb"\newcolumntype" specifications,
-% ^^A it is the equivalent of the primitive \verb"\show" command for macro
-% ^^A definitions. All we need to do is locally redefine \verb"\NC@do" to take
-% ^^A its argument (say `C') and then \verb"\show" the (slightly modified)
-% ^^A definition of \verb"\NC@rewrite@C". Actually as the the list always
-% ^^A starts off with \verb"\NC@do *" and we do not want to print the
-% ^^A definition of the $*$-form, define \verb"\NC@do" to throw away the first
-% ^^A item in the list, and then redefine itself to print the rest of the
-% ^^A definitions.
-% \begin{macrocode}
- % \def\showcols{{\def\NC@do##1{\let\NC@do\NC@show}\the\NC@list}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \begin{macro}{\NC@show}
-% ^^A If the column `C' is defined as above, then
-% ^^A \verb"\show\NC@rewrite@C" would output\\
-% ^^A \verb"\long macro: ->\NC@find >{$}c<{$}".
-% ^^A We want to strip the \verb"long macro: ->" and the \verb"\NC@find". So first we
-% ^^A use \verb"\meaning" and then apply the macro \verb"\NC@strip" to the tokens so
-% ^^A produced and then \verb"\typeout" the required string.
-% \begin{macrocode}
- % \def\NC@show#1{%
- % \typeout{Column #1\expandafter\expandafter\expandafter\NC@strip
- % \expandafter\meaning\csname NC@rewrite@#1\endcsname\@@}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \begin{macro}{\NC@strip}
-% ^^A Delimit the arguments to \verb"\NC@strip" with `\texttt{:}', `\texttt{->}',
-% ^^A a space, and \verb"\@@" to pull out the required parts of the output from
-% ^^A \verb"\meaning".
-% \begin{macrocode}
- % \def\NC@strip#1:#2->#3 #4\@@{#2 -> #4}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \begin{macro}{\NC@list}
-% ^^A Allocate the token register used for the rewrite list.
-% \begin{macrocode}
- % \newtoks\NC@list
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \subsubsection{The $*$--form}
-% ^^A We view the $*$-form as a slight generalisation of the system
-% ^^A described in the previous subsection. The idea is to define a $*$
-% ^^A column by a command of the form:
-% ^^A \begin{verbatim}
-% ^^A \newcolumntype{*}[2]{%
-% ^^A \count@=#1\ifnum\count@>0
-% ^^A \advance\count@ by -1 #2*{\count@}{#2}\fi}
-% ^^A \end{verbatim}
-% ^^A \begin{macro}{\NC@rewrite@*}\label{NC@rewrite@*}
-% ^^A This does not work however as \verb"\newcolumntype" takes great care not
-% ^^A to expand anything in the preamble, and so the \verb"\if" is never
-% ^^A expanded. \verb"\newcolumntype" sets up various other parts of the
-% ^^A rewrite correctly though so we can define:
-% \begin{macrocode}
- % \newcolumntype{*}[2]{}
-% \end{macrocode}
-% ^^A Now we must correct the definition of \verb"\NC@rewrite@*". The
-% ^^A following is probably more efficient than a direct translation of
-% ^^A the idea sketched above, we do not need to put a $*$ in the preamble
-% ^^A and call the rewrite recursively, we can just put \verb"#1" copies of
-% ^^A \verb"#2" into \verb"\@temptokena". (Nested $*$ forms will be expanded
-% ^^A when the whole rewrite list is expanded again, see \verb"\@mkpream")
-% \begin{macrocode}
- % \long\@namedef{NC@rewrite@*}#1#2{%
-% \end{macrocode}
-% ^^A Store the number.
-% \begin{macrocode}
- % \count@#1\relax
-% \end{macrocode}
-% ^^A Put \verb"#1" copies of \verb"#2" in the token register.
-% \begin{macrocode}
- % \loop
- % \ifnum\count@>\z@
- % \advance\count@\m@ne
- % \@temptokena\expandafter{\the\@temptokena#2}%
- % \repeat
-% \end{macrocode}
-% ^^A \verb"\NC@do" will ensure that \verb"\NC@find" is \verb"\let" equal
-% ^^A to \verb"\NC@find@*".
-% \begin{macrocode}
- % \NC@find}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \subsubsection{Modifications to internal macros of \texttt{array.sty}}
-% ^^A
-% ^^A \begin{macro}{\@xexpast}
-% ^^A \begin{macro}{\@xexnoop}
-% ^^A These macros are used to expand $*$-forms in
-% ^^A \texttt{array.sty}. \verb"\let" them to \verb"\relax" to save space.
-% \begin{macrocode}
- % \let\@xexpast\relax
- % \let\@xexnoop\relax
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\save@decl}
-% ^^A We do not assume that the token register is free, we add the new
-% ^^A declarations to the front of the register. This is to allow user
-% ^^A preambles of the form, \verb">{foo}>{bar}..". Users are not encouraged to
-% ^^A enter such expressions directly, but they may result from the
-% ^^A rewriting of \verb"\newcolumntype"'s.
-% \begin{macrocode}
- % \def\save@decl{\toks \count@ = \expandafter\expandafter\expandafter
- % {\expandafter\@nextchar\the\toks\count@}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \begin{macro}{\@mkpream}
-% ^^A The main modification to \verb"\@mkpream" is to replace the call to
-% ^^A \verb"\@xexpast" (which expanded $*$-forms) by a loop which expands
-% ^^A all \verb"\newcolumntype" specifiers.
-% \begin{macrocode}
- % \def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue
- % \let\@sharp\relax \let\@startpbox\relax \let\@endpbox\relax
-% \end{macrocode}
-% ^^A Now we remove possible $*$-forms and user-defined column
-% ^^A specifiers in the user preamble by repeatedly executing the list
-% ^^A \verb"\NC@list" until the re-writes have no more effect. The
-% ^^A expanded preamble will then be in the token register
-% ^^A \verb"\@temptokena". Actually we need to know at this point that
-% ^^A this is not \verb"\toks0".
-% \begin{macrocode}
- % \@temptokena{#1}\@tempswatrue
- % \@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}%
-% \end{macrocode}
-% ^^A Afterwards we initialize all registers and macros, that we need
-% ^^A for the build-up of the preamble.
-% \begin{macrocode}
- % \count@\m@ne
- % \let\the@toks\relax
- % \prepnext@tok
-% \end{macrocode}
-% ^^A Having expanded all tokens defined using \verb"\newcolumntype" (including
-% ^^A \verb"*"), we evaluate the remaining tokens, which are saved in
-% ^^A \verb"\@temptokena". We use the \LaTeX--macro \verb"\@tfor" to inspect each
-% ^^A token in turn.
-% \begin{macrocode}
- % \expandafter \@tfor \expandafter \@nextchar
- % \expandafter :\expandafter =\the\@temptokena \do
-% \end{macrocode}
-% ^^A \verb"\@testpatch" does not take an argument since \texttt{array.sty} 2.0h.
-% \begin{macrocode}
- % {\@testpach
- % \ifcase \@chclass \@classz \or \@classi \or \@classii
- % \or \save@decl \or \or \@classv \or \@classvi
- % \or \@classvii \or \@classviii
-% \end{macrocode}
-% ^^A In \texttt{newarray.sty} class 9 is equivalent to class 10.
-% \begin{macrocode}
- % \or \@classx
- % \or \@classx \fi
- % \@lastchclass\@chclass}%
- % \ifcase\@lastchclass
- % \@acol \or
- % \or
- % \@acol \or
- % \@preamerr \thr@@ \or
- % \@preamerr \tw@ \@addtopreamble\@sharp \or
- % \or
- % \else \@preamerr \@ne \fi
- % \def\the@toks{\the\toks}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@classix}
-% ^^A \texttt{array.sty} does not allow repeated \texttt{>}
-% ^^A declarations for the same column. This is allowed in
-% ^^A \texttt{newarray.sty} as documented in the introduction. Removing
-% ^^A the test for this case makes class 9 equivalent to class 10, and
-% ^^A so this macro is redundant. It is \verb"\let" to \verb"\relax" to save
-% ^^A space.
-% \begin{macrocode}
- % \let\@classix\relax
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@classviii}
-% ^^A In \texttt{newarray.sty} explicitly allow class 2, as repeated
-% ^^A \texttt{<} expressions are accepted by this package.
-% \begin{macrocode}
- % \def\@classviii{\ifnum \@lastchclass >\z@\ifnum\@lastchclass=\tw@\else
- % \@preamerr 4\@chclass 6 \@classvi \fi\fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\@classv}
-% ^^A Class 5 is \texttt{@}-expressions (and is also called by class 1)
-% ^^A This macro was incorrect in Version~1. Now we do not expand the
-% ^^A \verb"@"-expression, but instead explicitly replace an
-% ^^A \verb"\extracolsep" command by an assignment to \verb"\tabskip" by a
-% ^^A method similar to the \verb"\newcolumntype" system described above.
-% ^^A \verb"\d@llarbegin" \verb"\d@llarend" were introduced in V2.01 to match
-% ^^A \texttt{array.sty} 2.0h.
-% \begin{macrocode}
- % \def\@classv{\save@decl
- % \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@
- % \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%
- % \prepnext@tok}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\NC@ecs}
-% ^^A Rewrite the first occurrence of \verb"\extracolsep{1in}" to
-% ^^A \verb"\tabskip1in\relax". As a side effect discard any tokens after a
-% ^^A second \verb"\extracolsep", there is no point in the user entering two of
-% ^^A these commands anyway, so this is not really a restriction.
-% \begin{macrocode}
- % \def\NC@ecs#1\extracolsep#2#3\extracolsep#4\@@@{\def\@tempa{#2}%
- % \ifx\@tempa\@empty\else\toks\count@={#1\tabskip#2\relax#3}\fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \subsubsection{Support for the \texttt{delarray.sty}}
-% ^^A
-% ^^A The \texttt{delarray.sty} package extends the array syntax by
-% ^^A supporting the notation of delimiters. To this end we extend the
-% ^^A array parsing mechanism to include a hook which can be used by this
-% ^^A (or another) package to do some additional parsing.
-% ^^A
-% ^^A \begin{macro}{\@tabarray}
-% ^^A This macro tests for an optional bracket and then calls up
-% ^^A \verb"\@@array" or \verb"\@@array[c]" (as default).
-% \begin{macrocode}
- % \def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \begin{macro}{\@@array}
-% ^^A This macro tests could then test an optional delimiter before the
-% ^^A left brace of the main preamble argument. Here in the main package
-% ^^A it simply is let to be \verb"\@array".
-% \begin{macrocode}
- % \let\@@array\@array
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\endarray}
-% ^^A \begin{macro}{\@arrayright}
-% ^^A We have to declare the hook we put into \verb"\@array" above.
-% ^^A A similar hook `\verb"\@arrayright"' will be inserted into the
-% ^^A \verb"\endarray" to gain control. Both defaults to empty.
-% \begin{macrocode}
- % \def\endarray{\crcr \egroup \egroup \@arrayright \gdef\@preamble{}}
- % \let\@arrayleft\@empty
- % \let\@arrayright\@empty
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A \subsubsection{Support for \texttt{\textbackslash firsthline} and
-% ^^A \texttt{\textbackslash lasthline}}
-% ^^A
-% ^^A The Companion~\cite[p.137]{GOOSSENS94} suggests two additional
-% ^^A commands to control the alignments in case of tabulars with
-% ^^A horizontal lines. They are now added to this package.
-% ^^A
-% ^^A \begin{macro}{\extratabsurround}
-% ^^A The extra space around a table when \verb"\firsthline" or \verb"\lasthline"
-% ^^A are used.
-% \begin{macrocode}
- % \newlength{\extratabsurround}
- % \setlength{\extratabsurround}{2pt}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\backup@length}
-% ^^A This register will be used internally by \verb"\firsthline" and
-% ^^A \verb"\lasthline".
-% \begin{macrocode}
- % \newlength{\backup@length}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\firsthline}
-% ^^A This code can probably be improved but for the moment it should
-% ^^A serve.
-% ^^A
-% ^^A We start by producing a single tabular row without any visible
-% ^^A content that will produce the external reference point in case
-% ^^A \verb"[t]" is used.
-% \begin{macrocode}
- % \newcommand{\firsthline}{%}} emacs
- % \multicolumn1c{%
-% \end{macrocode}
-% ^^A Within this row we calculate \verb"\backup@length" to be the height
-% ^^A plus depth of a standard line. In addition we have to add the
-% ^^A width of the \verb"\hline", something that was forgotten in the
-% ^^A original definition.
-% \begin{macrocode}
- % \global\backup@length\ht\@arstrutbox
- % \global\advance\backup@length\dp\@arstrutbox
- % \global\advance\backup@length\arrayrulewidth
-% \end{macrocode}
-% ^^A Finally we do want to make the height of this first line be a bit
-% ^^A larger than usual, for this we place the standard array strut
-% ^^A into it but raised by \verb"\extratabsurround"
-% \begin{macrocode}
- % \raise\extratabsurround\copy\@arstrutbox
-% \end{macrocode}
-% ^^A Having done all this we end the line and back up by the value of
-% ^^A \verb"\backup@length" and then finally place our \verb"\hline". This should
-% ^^A place the line exactly at the right place but keep the reference
-% ^^A point of the whole tabular at the baseline of the first row.
-% \begin{macrocode}
- % }\\[-\backup@length]\hline
- % }
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\lasthline}
-% ^^A For \verb"\lasthline" the situation is even worse and I got it
-% ^^A completely wrong initially.
-% ^^A
-% ^^A The problem in this case is that if the optional argument \verb"[b]"
-% ^^A is used we do want the reference point of the tabular be at the
-% ^^A baseline of the last row but at the same time do want the the
-% ^^A depth of this last line increased by \verb"\extratabsurround" without
-% ^^A changing the placement \verb"\hline".
-% ^^A
-% ^^A We start by placing the rule followed by an invisible row.
-% \begin{macrocode}
- % \newcommand{\lasthline}{\hline\multicolumn1c{%}} emacs
-% \end{macrocode}
-% ^^A We now calculate \verb"\backup@length" to be the height and depth of
-% ^^A two lines plus the width of the rule.
-% \begin{macrocode}
- % \global\backup@length2\ht\@arstrutbox
- % \global\advance\backup@length2\dp\@arstrutbox
- % \global\advance\backup@length\arrayrulewidth
-% \end{macrocode}
-% ^^A This will bring us back to the baseline of the second last row:
-% \begin{macrocode}
- % }\\[-\backup@length]%
-% \end{macrocode}
-% ^^A Thus if we now add another invisible row the reference point of
-% ^^A that row will be at the baseline of the last row (and will be the
-% ^^A reference for the whole tabular). Since this row is invisible we
-% ^^A can enlarge its depth by the desired amount.
-% \begin{macrocode}
- % \multicolumn1c{%
- % \lower\extratabsurround\copy\@arstrutbox
- % }%
- % }
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \subsubsection{Getting the spacing around rules right}
-% ^^A
-% ^^A Beside a larger functionality \texttt{array.sty} has one
-% ^^A important difference to the standard \texttt{tabular} and
-% ^^A \texttt{array} environments: horizontal and vertical rules make a
-% ^^A table larger or wider, e.g., \verb=\doublerulesep= really denotes
-% ^^A the space between two rules and isn't measured from the middle of
-% ^^A the rules.
-% ^^A
-% ^^A \begin{macro}{\@xhline}
-% ^^A For vertical rules this is implemented by the definitions above,
-% ^^A for horizontal rules we have to take out the backspace.
-% \begin{macrocode}
- % \CheckCommand*\@xhline{\ifx\reserved@a\hline
- % \vskip\doublerulesep
- % \vskip-\arrayrulewidth
- % \fi
- % \ifnum0=`{\fi}}
- % \renewcommand*\@xhline{\ifx\reserved@a\hline
- % \vskip\doublerulesep
- % \fi
- % \ifnum0=`{\fi}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% \begin{macrocode}
- % %%%%%%%%%% end array.sty 2016/10/06 v2.4d %%%%%%%%%
- %
-% \end{macrocode}
-% ^^A
-% ^^A
%
% \subsubsection{Class additions to Array}
%
@@ -17316,173 +15358,6 @@
% \Lpack{dcolumn} and replaced it with requiring the \Lpack{dcolumn} package
% instead.}
%
-% ^^A The description and code are essentially copied from the
-% ^^A \Lpack{dcolumn} package~\cite{DCOLUMN}.
-% ^^A
-% \begin{macrocode}
- % %%%%%%%%%% Dcolumn package code %%%%%%%%%%%%%%%%%%%%%
- % %%%%%%%%%% With acknowledgements to David Carlisle %%%%%%%%%%%%%%%%%%%%%
- %
-% \end{macrocode}
-% ^^A
-% ^^A
-% ^^A The \Lpack{dcolumn} package~\cite{DCOLUMN} defines \texttt{D}
-% ^^A to be a column specifier
-% ^^A with three arguments.\\
-% ^^A \verb?D?\marg{sep.tex}\marg{sep.dvi}\marg{decimal places}
-% ^^A for columns which are to be aligned on a `decimal point'.
-% ^^A
-% ^^A
-% ^^A The basic ideas behind these macros have been explained earlier.
-% ^^A However they use three
-% ^^A tricks which may be useful in other contexts.
-% ^^A \begin{itemize}
-% ^^A \item The separator is surrounded in extra \verb?{ }?, so that it is set
-% ^^A with \cs{mathord} spacing, otherwise, for instance a `,' would have
-% ^^A extra space after it.
-% ^^A \item The separator is not given its special definition by making it
-% ^^A active, as this would not work for an entry such as \verb?& .5 &?, as the
-% ^^A first token of an alignment entry is read \emph{before} the preamble
-% ^^A part, incase it is an \cs{omit}, in which case the preamble is to be
-% ^^A omitted. Instead we switch the mathcode to (hex) 8000, which makes the
-% ^^A token act as if it were active.
-% ^^A \item Although \verb?\mathcode`.="8000? makes \texttt{.} act as if it
-% ^^A were active, it is still not allowed in constructions such as
-% ^^A \verb?\def.{}?, even in math-mode, so we have to construct an active
-% ^^A version of the separator, this is done by making it the uppercase of
-% ^^A \verb?~?, and then using the construct\\
-% ^^A \verb?\uppercase{\def~}?\marg{definition}.\\
-% ^^A Note that the \meta{definition} is not uppercased, so the definition
-% ^^A can refer to the standard, non-active use of the separator.
-% ^^A \end{itemize}
-% ^^A
-% ^^A \begin{macro}{\DC@}
-% ^^A Set up uppercase tables as required, and then grab the first part of
-% ^^A the numerical argument into \cs{count@}.
-% \begin{macrocode}
- % \def\DC@#1#2#3{%
- % \uccode`\~=`#1\relax
- % \m@th
- % \afterassignment\DC@x\count@#3\relax{#1}{#2}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\DC@x}
-% ^^A If \cs{count@} is negative, centre on the decimal point. If it is
-% ^^A positive either \verb?#1? will be empty in which case bad out decimal
-% ^^A part to the number of digits specified by \cs{count@} or
-% ^^A it is none empty in which case \cs{count@} contains the
-% ^^A number of digits to the left of the point, and \verb?#1? contains a junk
-% ^^A token (probably \verb?.?) followed by the number of digits to the right
-% ^^A of the point. In either of these latter cases, \cs{DC@right} is used.
-% \begin{macrocode}
- % \def\DC@x#1\relax#2#3{%
- % \ifnum\z@>\count@
- % \expandafter\DC@centre
- % \else
- % \expandafter\DC@right
- % \fi
- % {#2}{#3}{#1}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\DC@centre}
-% ^^A If centering on the decimal point, just need to box up the two halves.
-% \begin{macrocode}
- % \def\DC@centre#1#2#3{%
- % \let\DC@end\DC@endcentre
- % \uppercase{\def~}{$\egroup\setbox\tw@=\hbox\bgroup${#2}}%$
- % \setbox\tw@=\hbox{${\phantom{{#2}}}$}%
- % \setbox\z@=\hbox\bgroup$\mathcode`#1="8000 }%$
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\DC@endcentre}
-% ^^A and then pad out the smaller of the two boxes so there is the same
-% ^^A amount of stuff either side of the point.
-% \begin{macrocode}
- % \def\DC@endcentre{$\egroup%$
- % \ifdim \wd\z@>\wd\tw@
- % \setbox\tw@=\hbox to\wd\z@{\unhbox\tw@\hfill}%
- % \else
- % \setbox\z@=\hbox to\wd\tw@{\hfill\unhbox\z@}\fi
- % \box\z@\box\tw@}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\DC@right}
-% ^^A This deals with both the cases where a specified number of decimal
-% ^^A places is given.
-% \begin{macrocode}
- % \def\DC@right#1#2#3{%
- % \ifx\relax#3\relax
-% \end{macrocode}
-% ^^A If \verb?#3? is empty, add \cs{hfill} to right align the column, and
-% ^^A Just set \cs{DC@rl} to begin a group, so nothing fancy is done with
-% ^^A the whole number part.
-% \begin{macrocode}
- % \hfill
- % \let\DC@rl\bgroup
- % \else
-% \end{macrocode}
-% ^^A Otherwise set \cs{DC@rl} so that the whole number part is put in a
-% ^^A box \cs{count@} times as wide as a digit.
-% ^^A In order to share code with the other branch, then move \verb?#3? (the
-% ^^A number of decimal places) into \cs{count@} throwing away the `.' from
-% ^^A the user syntax.
-% \begin{macrocode}
- % \edef\DC@rl{to\the\count@\dimen@ii\bgroup\hss\hfill}%
- % \count@\@gobble#3\relax
- % \fi
-% \end{macrocode}
-% ^^A
-% \begin{macrocode}
- % \let\DC@end\DC@endright
-% \end{macrocode}
-% ^^A Box 2 contains the decimal part, set to \cs{dimen@} which is
-% ^^A calculated below to be \cs{count@} times the width of a digit, plus
-% ^^A the width of the `decimal point'.
-% \begin{macrocode}
- % \uppercase{\def~}{$\egroup\setbox\tw@\hbox to\dimen@\bgroup${#2}}%
- % \setbox\z@\hbox{$1$}\dimen@ii\wd\z@
- % \dimen@\count@\dimen@ii
- % \setbox\z@\hbox{${#2}$}\advance\dimen@\wd\z@
- % \setbox\tw@\hbox to\dimen@{}%
-% \end{macrocode}
-% ^^A Box 0 contains the whole number part, either just at its natural
-% ^^A size for right aligned columns, or set to (the old value of)
-% ^^A \cs{count@} times the width of a digit. \cs{DC@rl} defined above
-% ^^A determines the two cases.
-% \begin{macrocode}
- % \setbox\z@\hbox\DC@rl$\mathcode`#1="8000 }%$
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\DC@endright}
-% ^^A Just finish off the second box, and then put out both boxes.
-% \begin{macrocode}
- % \def\DC@endright{$\hfil\egroup\box\z@\box\tw@}%$
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{D}
-% ^^A The user interface, define the {\tt D} column to take three arguments.
-% ^^A For special purposes, you may need to directly access \cs{DC@} rather
-% ^^A than the \verb?D? column, eg to get a bold version you could use
-% ^^A\begin{verbatim}
-% ^^A \newcolumntype{E}[3]{>{\boldmath\DC@{#1}{#2}{#3}}c<{\DC@end}}
-% ^^A\end{verbatim}
-% \begin{macrocode}
- % \newcolumntype{D}[3]{>{\DC@{#1}{#2}{#3}}c<{\DC@end}}
- %
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% \begin{macrocode}
- % %%%%%%%%%% end Dcolumn package code %%%%%%%%%%%%%%%%%%%%%
- %
-% \end{macrocode}
-% ^^A
%
%
% \subsection{Support for delimeters}
@@ -17495,103 +15370,6 @@
% The embeded copy is outcommented for now and will be removed in a
% later version.
%
-% \changes{v3.7h}{2018/09/06}{Outcommented the embedded copy of
-% \Lpack{delarray} and replaced it with requiring the \Lpack{delarray} package
-% instead.}
-% ^^A
-% ^^A The description and code are essentially from the
-% ^^A \Lpack{delarray} package~\cite{DELARRAY}, v1.01 1994/03/14.
-% ^^A
-% \begin{macrocode}
- % %%%%%%%%%% Delarray package code %%%%%%%%%%%%%%%%%%%%%
- % %%%%%%%%%% With acknowledgements to David Carlisle %%%%%%%%%%%%%%%%%%%%%
- %
-% \end{macrocode}
-% ^^A
-% ^^A
-% ^^A The array syntax is extended by
-% ^^A supporting the notation of delimiters. To this end we extend the
-% ^^A array parsing mechanism to include a hook which can be used by this
-% ^^A (or another) package to do some additional parsing.
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\@@array}
-% ^^A This macro tests for an optional delimiter before the left brace
-% ^^A of the main preamble argument. If there is no delimiter,
-% ^^A \cs{@arrayleft} and \cs{@arrayright} are made a no-ops, and
-% ^^A \cs{@array} is called with the positional argument. Otherwise
-% ^^A call \cs{@del@array}.
-% \begin{macrocode}
- % \def\@@array[#1]{\@ifnextchar\bgroup
- % {\let\@arrayleft\relax\let\@arrayright\relax\@array[#1]}%
- % {\@del@array[#1]}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \begin{macro}{\@del@array}
-% ^^A We now know that we have an {\tt array} (or {\tt tabular}) with
-% ^^A delimiters.
-% \begin{macrocode}
- % \def\@del@array[#1]#2#3#4{%
-% \end{macrocode}
-% ^^A The following line is completely redundant but it does catch errors
-% ^^A involving delimiters before the processing of the alignment begins.
-% ^^A A common error is likely to be omiting the `.' in a
-% ^^A \cs{cases}-type construction. This causes the first token of the
-% ^^A alignment to be gobbled, possibly causing lots of spurious errors
-% ^^A before the cause of the error, the missing delimiter, is discovered as
-% ^^A \cs{@arrayright} puts the alignment and the delimiters together.
-% \begin{macrocode}
- % \setbox\z@\hbox{$\left#2\right#4$}%
-% \end{macrocode}
-% ^^A In the case of a `c' argument we do not need to rebox the alignment,
-% ^^A so we can define \cs{@arrayleft} and \cs{@arrayright} just to
-% ^^A insert the delimiters.
-% \begin{macrocode}
- % \if#1c\def\@arrayleft{\left#2}\def\@arrayright{\right#4}%
-% \end{macrocode}
-% ^^A Otherwise we (should) have a {\tt[t]} or {\tt[b]} argument, so first we
-% ^^A store the alignment, without delimiters in box0.
-% \begin{macrocode}
- % \else\def\@arrayleft{\setbox\z@}%
-% \end{macrocode}
-% ^^A Then after the alignment is finished:
-% \begin{macrocode}
- % \def\@arrayright{%
-% \end{macrocode}
-% ^^A Calculate the amount the box needs to be lowered (this will be
-% ^^A negative in the case of \verb?[b]?). A little bit of arithmetic cf.\
-% ^^A \theTeXbook, Appendix G, rule 8. We calculate the amount this
-% ^^A way, rather than just taking the difference between the depth of box0
-% ^^A and the depth of the box defined below, as the depth of that box may
-% ^^A be affected by the delimiters if \cs{delimitershortfall} or
-% ^^A \cs{delimiterfactor} have non-standard values.
-% \begin{macrocode}
- % \dimen@=\dp\z@
- % \advance\dimen@-\ht\z@
- % \divide \dimen@ by \tw@
- % \advance\dimen@ by\fontdimen22 \textfont\tw@
-% \end{macrocode}
-% ^^A Now lower the alignment and the delimiters into place.
-% \begin{macrocode}
- % \lower\dimen@\hbox{$\left#2\vcenter{\unvbox\z@}\right#4$}}%
-% \end{macrocode}
-% ^^A End the \verb?\if#1c?
-% \begin{macrocode}
- % \fi
-% \end{macrocode}
-% ^^A Now that we have defined \cs{@arrayleft} and \cs{@arrayright}, call
-% ^^A \cs{@array}.
-% \begin{macrocode}
- % \@array[#1]{#3}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% \begin{macrocode}
- % %%%%%%%%%% end Delarray package code %%%%%%%%%%%%%%%%%%%%%
- %
-% \end{macrocode}
-% ^^A
%
%
% \subsection{The tabularx environment}
@@ -17601,702 +15379,6 @@
% \begin{macrocode}
\RequirePackage{tabularx}[2016/02/03]
% \end{macrocode}
-% The embeded copy is outcommented for now and will be removed in a
-% later version.
-%
-% \changes{v3.7h}{2018/09/06}{Outcommented the embedded copy of
-% \Lpack{tabularx} and replaced it with requiring the \Lpack{tabularx} package
-% instead.}
-
-%
-% ^^A The code and description are essentially from David Carlisle's
-% ^^A \Lpack{tabularx} package~\cite{TABULARX}, v2.07 1999/01/07.
-% ^^A
-% \begin{macrocode}
- % %%%%%%%%%% Tabularx package code %%%%%%%%%%%%%%%%%%%%%
- % %%%%%%%%%% With acknowledgements to David Carlisle %%%%%%%%%%%%%%%%%%%%%
- %
- % %%% This is a carbon copy of the tabularx dtx sources for v2.11,
- % %%% 2016/02/03 with two changes: error messages mention the class
- % %%% instead of tabularx.
- %
- % %%%%%%%%%% Tabularx package code v2.11 2016/02/03 %%%%%%%%%%%%%%%%%%%%%
- %
-% \end{macrocode}
-% ^^A
-% ^^A
-% ^^A
-% ^^A The \Lpack{tabularx} package~\cite{TABULARX} implements a version of the \texttt{tabular}
-% ^^A environment in which the widths of certain columns are calculated so
-% ^^A that the table is is a specified width. The columns that may stretch are
-% ^^A marked by an \texttt{X} in the preamble argument.
-% ^^A
-% ^^A What follows is a carbon copy of the contents of \texttt{tabularx.dtx} with small changes: (1) We make errors/warnings
-% ^^A mention the class instead of \texttt{tabularx}, (2) we strip \texttt{tabularx} related \cs{changes} macros, (3) we
-% ^^A remove loading the \Lpack{array} package, as we already come with a copy.
-% ^^A
-% ^^A First some registers etc.\ that we need.
-% \begin{macrocode}
- % \newdimen\TX@col@width
- % \newdimen\TX@old@table
- % \newdimen\TX@old@col
- % \newdimen\TX@target
- % \newdimen\TX@delta
- % \newcount\TX@cols
- % \newif\ifTX@
-% \end{macrocode}
-% ^^A
-% ^^A Now a trick to get the body of an environment into a token register, without doing any expansion. This does not do any
-% ^^A real checking of nested environments, so if you should need to nest one {\ttfamily tabularx} inside another, the inner
-% ^^A one must be surrounded by \verb+{ }+.
-% ^^A
-% ^^A \begin{macro}{\tabularx}
-% ^^A Prior to (\texttt{tabularx}) v1.06, this macro took two arguments, which were saved in
-% ^^A separate registers before the table body was saved by \verb+\TX@get@body+.
-% ^^A Unfortunately this disables the \verb|[t]| optional argument. Now just save
-% ^^A the width specification separately, then clear the token register
-% ^^A \verb|\toks@|.
-% ^^A Finally call \verb|\TX@get@body| to begin saving the body of the table.
-% ^^A The \verb|{\ifnum0=`}\fi| was added at (tabularx) v1.03, to allow \Lenv{tabularx} to appear
-% ^^A inside a \verb|\halign|.^^A
-% ^^A \setbox0=\hbox{\footnotesize"\iffalse{\fi\ifnum0=`}\fi"}^^A
-% ^^A \setbox2=\hbox{\footnotesize"\ifnum0=`{}\fi"}^^A
-% ^^A \footnote{This adds an extra level of grouping,
-% ^^A which is not really needed. Instead, I could use \box0\ here, and
-% ^^A \box2\ below, however the code here would then have to be moved after
-% ^^A the first line, because of the footnote to page 386 of the \TeX{}Book,
-% ^^A and I do not think I should be writing code that is so obscure as to
-% ^^A be documented in a footnote in an appendix called ``Dirty Tricks''!}
-% ^^A
-% ^^A This mechanism of grabbing an environment body does have the
-% ^^A disadvantage (shared with the AMS alignment environments) that you
-% ^^A can not make extension environments by code such as
-% ^^A\begin{verbatim}
-% ^^A\newenvironment{foo}{\begin{tabularx}{XX}}{\end{tabularx}}
-% ^^A\end{verbatim}
-% ^^A as the code is looking for a literal string \verb"\end{tabularx}" to stop
-% ^^A scanning. Since version (tabularx) 2.02, one may avoid this problem by using
-% ^^A \verb|\tabularx| and \verb|\endtabularx| directly in the definition:
-% ^^A\begin{verbatim}
-% ^^A\newenvironment{foo}{\tabularx{XX}}{\endtabularx}
-% ^^A\end{verbatim}
-% ^^A The scanner now looks for the end of the current environment (\verb|foo| in
-% ^^A this example.) There are some restrictions on this usage, the
-% ^^A principal one being that \verb|\endtabularx| must not be inside any \verb"{ }" pairs
-% ^^A ao that the code before \verb"\endtabularx" may be extracted and added to the table body
-% ^^A (prior to version (tabularx) 2.09 \verb"\endtabularx" had to be
-% ^^A the \emph{first} token of the `end code' of the environment).
-% \begin{macrocode}
- % \def\tabularx#1{%
-% \end{macrocode}
-% ^^A Allow \verb"\tabularx" \verb"\endtabularx" (but not \verb"\begin{tabularx}"
-% ^^A \verb"\end{tabularx}") to be used in \verb"\newenvironment" definitions.
-% \begin{macrocode}
- % \edef\TX@{\@currenvir}%
- % {\ifnum0=`}\fi
-% \end{macrocode}
-% ^^A \verb"\relax" added at v1.05 so that non-expandable length tokens, like
-% ^^A \verb"\textwidth" do not generate an extra space, and an overfull box.
-% ^^A \verb"\relax" removed again at v4.09 in favour of \verb"\setlength" so if you
-% ^^A use the calc package you can use a width of \verb"(\textwidth-12pt)/2".
-% \begin{macrocode}
- % \setlength\TX@target{#1}%
- % \TX@typeout{Target width: #1 = \the\TX@target.}%
- % \toks@{}\TX@get@body}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\endtabularx}
-% ^^A This does not do very much\ldots
-% \begin{macrocode}
- % \let\endtabularx\relax
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@get@body}
-% ^^A Place all tokens as far as the first \verb"\end" into a token register.
-% ^^A Then call \verb"\TX@find@end" to see if we are at \verb"\end{tabularx}".
-% \begin{macrocode}
- % \long\def\TX@get@body#1\end
- % {\toks@\expandafter{\the\toks@#1}\TX@find@end}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@find@end}
-% ^^A If we are at \verb"\end{tabularx}", call \verb"\TX@endtabularx", otherwise
-% ^^A add \verb"\end{...}" to the register, and call \verb"\TX@get@body" again.
-% \begin{macrocode}
- % \def\TX@find@end#1{%
- % \def\@tempa{#1}%
- % \ifx\@tempa\TX@\expandafter\TX@endtabularx
- % \else\toks@\expandafter
- % {\the\toks@\end{#1}}\expandafter\TX@get@body\fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@find@endtabularxa}
-% ^^A split up the end code, and extract the part that lives in the table body.
-% \begin{macrocode}
- % \long\def\TX@find@endtabularxa
- % #1\endtabularx#2\endtabularx#3\TX@find@endtabularxa{%
- % \ifx\TX@#2\relax\else
- % \toks@\expandafter{\the\toks@#1}%
- % \fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \begin{macro}{\TX@find@endtabularxb}
-% ^^A split up the end code, and extract the part that lives outside the table body.
-% \begin{macrocode}
- % \long\def\TX@find@endtabularxb
- % #1\endtabularx#2\endtabularx#3\TX@find@endtabularxb{%
- % \ifx\TX@#2%
- % \expandafter\@firstoftwo
- % \else
- % \expandafter\@secondoftwo
- % \fi
- % {#1}{#2}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@find@endtabularxbb}
-% ^^A Helper to avoid needing 15 consecutive \verb"\expandafter"
-% \begin{macrocode}
- % \def\TX@find@endtabularxbb{%
- % \expandafter\expandafter\expandafter
- % \TX@find@endtabularxb
- % }
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@}
-% ^^A The string {\ttfamily tabularx} as a macro for testing with \verb"\ifx".
-% \begin{macrocode}
- % \def\TX@{tabularx}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A Now that all the parts of the table specification are stored in
-% ^^A registers, we can begin the work of setting the table.
-% ^^A
-% ^^A The algorithm for finding the correct column widths is as follows.
-% ^^A Firstly set the table with each {\ttfamily X} column the width of the
-% ^^A final table. Assuming that there is at least one {\ttfamily X} column,
-% ^^A this will produce a table that is too wide. Divide the excess width by
-% ^^A the number of {\ttfamily X} columns, and reduce the column width by
-% ^^A this amount. Reset the table. If the table is not now the correct
-% ^^A width, a \verb"\multicolumn" entry must be `hiding' one of the {\ttfamily
-% ^^A X} columns, and so there is one less {\ttfamily X} column affecting
-% ^^A the width of the table. So we reduce by 1 the number of X columns and
-% ^^A repeat the process.
-% ^^A
-% ^^A \begin{macro}{\TX@endtabularx}
-% ^^A Although I have tried to make {\ttfamily tabularx} look like an
-% ^^A environment, it is in fact a command, all the work is done by this
-% ^^A macro.
-% \begin{macrocode}
- % \def\TX@endtabularx{%
- % \expandafter\expandafter\expandafter
- % \TX@find@endtabularxa\csname end\TX@\endcsname
- % \endtabularx\TX@\endtabularx\TX@find@endtabularxa
-% \end{macrocode}
-% ^^A Define the {\ttfamily X} column, with an internal version of the
-% ^^A \verb"\newcolumntype" command. The \verb"\expandafter" commands enable
-% ^^A \verb"\NC@newcol" to get the {\em expansion} of\\
-% ^^A \verb"\tabularxcolumn{\TX@col@width}" as its
-% ^^A argument. This will be the definition of an {\ttfamily X} column, as
-% ^^A discussed in section 4.
-% \begin{macrocode}
- % \expandafter\TX@newcol\expandafter{\tabularxcolumn{\TX@col@width}}%
-% \end{macrocode}
-% ^^A Initialise the column width, and the number of {\ttfamily X} columns.
-% ^^A The number of {\ttfamily X} columns is set to one, which means that
-% ^^A the initial count will be one too high, but this value is decremented
-% ^^A before it is used in the main loop.
-% ^^A
-% ^^A Since v1.02, switch the definition of \verb"\verb".
-% \begin{macrocode}
- % \let\verb\TX@verb
-% \end{macrocode}
-% ^^A Since v1.05, save the values of all \LaTeX\ counters, the list
-% ^^A \verb"\cl@@ckpt" contains the names of all the \LaTeX\ counters that have
-% ^^A been defined so far. We expand \verb"\setcounter" at this point, as it
-% ^^A results in fewer tokens being stored in \verb"\TX@ckpt", but the actual
-% ^^A resetting of the counters occurs when \verb"\TX@ckpt" is expanded after
-% ^^A each trial run.
-% ^^A Actually since v1.07, use something equivalent to the expansion of the
-% ^^A original definition of \verb"\setcounter", so that \verb"tabularx" works in
-% ^^A conjunction with \verb"calc.sty".
-% \begin{macrocode}
- % \def\@elt##1{\global\value{##1}\the\value{##1}\relax}%
- % \edef\TX@ckpt{\cl@@ckpt}%
- % \let\@elt\relax
- % \TX@old@table\maxdimen
- % \TX@col@width\TX@target
- % \global\TX@cols\@ne
-% \end{macrocode}
-% ^^A Typeout some headings (unless this is disabled).
-% \begin{macrocode}
- % \TX@typeout@
- % {\@spaces Table Width\@spaces Column Width\@spaces X Columns}%
-% \end{macrocode}%
-% ^^A First attempt. Modify the {\ttfamily X} definition to count {\ttfamily
-% ^^A X} columns.
-% \begin{macrocode}
- % \TX@trial{\def\NC@rewrite@X{%
- % \global\advance\TX@cols\@ne\NC@find p{\TX@col@width}}}%
-% \end{macrocode}
-% ^^A Repeatedly decrease column width until table is the correct width,
-% ^^A or stops shrinking, or the columns become two narrow.
-% ^^A If there are no multicolumn entries, this will only take one attempt.
-% \begin{macrocode}
- % \loop
- % \TX@arith
- % \ifTX@
- % \TX@trial{}%
- % \repeat
-% \end{macrocode}
-% ^^A One last time, with warnings back on (see appendix D)
-% ^^A use {\ttfamily tabular*} to put it in a box of the right size, in case
-% ^^A the algorithm failed to find the correct size.
-% ^^A
-% ^^A Since v1.04, locally make \verb"\footnotetext" save its argument in a token
-% ^^A register.
-% ^^A Since v1.06, \verb"\toks@" contains the preamble specification,
-% ^^A and possible optional argument, as well as the table body.
-% \begin{macrocode}
- % {\let\@footnotetext\TX@ftntext\let\@xfootnotenext\TX@xftntext
- % \csname tabular*\expandafter\endcsname\expandafter\TX@target
- % \the\toks@
- % \csname endtabular*\endcsname}%
-% \end{macrocode}
-% ^^A Now the alignment is finished, and the \verb"}" has restored the original
-% ^^A meaning of \verb"\@footnotetext" expand the register \verb"\TX@ftn" which will
-% ^^A execute a series of\\
-% ^^A \verb"\footnotetext["\meta{num}\verb"]{"\meta{note}\verb"}"\\
-% ^^A commands. We need to be careful about clearing the register as we may
-% ^^A be inside a nested {\ttfamily tabularx}.
-% \begin{macrocode}
- % \global\TX@ftn\expandafter{\expandafter}\the\TX@ftn
-% \end{macrocode}
-% ^^A Now finish off the {\ttfamily tabularx} environment. Note that we need
-% ^^A \verb"\end{tabularx}" here as the \verb"\end{tabularx}" in the user's
-% ^^A file is never expanded. Now use \verb"\TX@" rather than \verb"tabularx".
-% ^^A
-% ^^A We also need to finish off the group started by \verb"{\ifnum0=`}\fi" in
-% ^^A the macro \verb"\tabularx".
-% \begin{macrocode}
- % \ifnum0=`{\fi}%
- % \expandafter\expandafter\expandafter
- % \TX@find@endtabularxbb
- % \expandafter\end\expandafter{\TX@}%
- % \endtabularx\TX@\endtabularx\TX@find@endtabularxb
- % }
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A
-% ^^A \begin{macro}{\TX@arith}
-% ^^A Calculate the column width for the next try, setting the flag
-% ^^A \verb"\ifTX@" to false if the loop should be aborted.
-% \begin{macrocode}
- % \def\TX@arith{%
- % \TX@false
- % \@tempdimb\maxdimen
- % \divide\@tempdimb\TX@cols
- % \ifdim\TX@col@width>\@tempdimb
- % \TX@typeout@{Don't exceed \maxdimen}%
- % \wd\@tempboxa\maxdimen
- % \fi
- % \ifdim\TX@old@table=\wd\@tempboxa
-% \end{macrocode}
-% ^^A If we have reduced the column width, but the table width has not
-% ^^A changed, we stop the loop, and output the table (which will cause an
-% ^^A over-full alignment) with the previous value of \verb"\TX@col@width".
-% \begin{macrocode}
- % \TX@col@width\TX@old@col
- % \TX@typeout@{Reached minimum width, backing up.}%
- % \else
-% \end{macrocode}
-% ^^A Otherwise calculate the amount by which the current table is too wide.
-% \begin{macrocode}
- % \dimen@\wd\@tempboxa
- % \advance\dimen@ -\TX@target
- % \ifdim\dimen@<\TX@delta
-% \end{macrocode}
-% ^^A If this amount is less than \verb"\TX@delta", stop. (\verb"\TX@delta"
-% ^^A should be non-zero otherwise we may miss the target due to rounding
-% ^^A error.)
-% \begin{macrocode}
- % \TX@typeout@{Reached target.}%
- % \else
-% \end{macrocode}
-% ^^A Reduce the number of effective {\ttfamily X} columns by one. (Checking
-% ^^A that we do not get 0, as this would produce an error later.) Then
-% ^^A divide excess width by the number of effective columns, and calculate
-% ^^A the new column width. Temporarily store this value (times $-1$) in
-% ^^A \verb"\dimen@".
-% \begin{macrocode}
- % \ifnum\TX@cols>\@ne
- % \advance\TX@cols\m@ne
- % \fi
- % \divide\dimen@\TX@cols
- % \advance\dimen@ -\TX@col@width
- % \ifdim \dimen@ >\z@
-% \end{macrocode}
-% ^^A If the new width would be too narrow, abort the loop. At the moment
-% ^^A too narrow, means less than 0\,pt!
-% ^^A
-% ^^A Prior to v2.03, if the loop was aborted here, the X columns were left
-% ^^A with the width of the previous run, but this may make the table far
-% ^^A too wide as initial guesses are always too big. Now force to
-% ^^A \verb"\TX@error@width" which defaults to be 1em. If you want to
-% ^^A get the old behaviour stick\\
-% ^^A \verb"\renewcommand\TX@error@width{\TX@col@width}"\\
-% ^^A in a package file loaded after \textsf{tabularx}.
-% \begin{macrocode}
- % %\PackageWarning{tabularx}%
- % \@memwarn{X Columns too narrow (table too wide)\MessageBreak}% <-- change here
- % \TX@col@width\TX@error@width\relax
- % \else
-% \end{macrocode}
-% ^^A Otherwise save the old settings, and set the new column width. Set the
-% ^^A flag to true so that the table will be set, and the loop will be
-% ^^A executed again.
-% \begin{macrocode}
- % \TX@old@col\TX@col@width
- % \TX@old@table\wd\@tempboxa
- % \TX@col@width-\dimen@
- % \TX@true
- % \fi
- % \fi
- % \fi}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@error@width}
-% ^^A If the calculated width is negative, use this instead.
-% \begin{macrocode}
- % \def\TX@error@width{1em}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@delta}
-% ^^A Accept a table that is within \verb"\hfuzz" of the correct width.
-% \begin{macrocode}
- % \TX@delta\hfuzz
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A Initialise the {\ttfamily X} column. The definition can be empty here,
-% ^^A as it is set for each {\ttfamily tabularx} environment.
-% \begin{macrocode}
- % \newcolumntype{X}{}
-% \end{macrocode}
-% ^^A
-% ^^A \begin{macro}{\tabularxcolumn}
-% ^^A The default definition of {\ttfamily X} is \verb"p{#1}".
-% \begin{macrocode}
- % \def\tabularxcolumn#1{p{#1}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@newcol}
-% ^^A A little macro just used to cut down the number of \verb"\expandafter"
-% ^^A commands needed.
-% \begin{macrocode}
- % \def\TX@newcol{\newcol@{X}[0]}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@trial}
-% ^^A Make a test run.
-% \begin{macrocode}
- % \def\TX@trial#1{%
- % \setbox\@tempboxa\hbox{%
-% \end{macrocode}
-% ^^A Any extra commands. This is used on the first run to count the number
-% ^^A of {\ttfamily X} columns.
-% \begin{macrocode}
- % #1\relax
-% \end{macrocode}
-% ^^A Since v1.04, make \verb"\footnotetext" gobble its arguments. Also locally
-% ^^A clear \verb"\TX@vwarn" so that the warning is generated by the {\ttfamily
-% ^^A final} run, and does not appear in the middle of the table if
-% ^^A \verb"\tracingtabularx".
-% \begin{macrocode}
- % \let\@footnotetext\TX@trial@ftn
- % \let\TX@vwarn\@empty
-% \end{macrocode}
-% ^^A Do not nest {\ttfamily tabularx} environments during trial runs. This
-% ^^A would waste time, and the global setting of \verb"\TX@cols" would break the
-% ^^A algorithm.
-% \begin{macrocode}
- % \expandafter\let\expandafter\tabularx\csname tabular*\endcsname
- % \expandafter\let\expandafter\endtabularx\csname endtabular*\endcsname
-% \end{macrocode}
-% ^^A Added at v1.05: disable \verb"\write"s during a trial run. This trick is
-% ^^A from the \TeX{}Book.\footnote{Actually the \TeX{}Book trick does
-% ^^A not work correctly, so changed for v2.05.}
-% \begin{macrocode}
- % \def\write{\begingroup
- % \def\let{\afterassignment\endgroup\toks@}%
- % \afterassignment\let\count@}%
-% \end{macrocode}
-% ^^A Turn off warnings (see appendix D). Also prevent them being turned
-% ^^A back on by setting the parameter names to be registers.
-% \begin{macrocode}
- % \hbadness\@M
- % \hfuzz\maxdimen
- % \let\hbadness\@tempcnta
- % \let\hfuzz\@tempdima
-% \end{macrocode}
-% ^^A Make the table, and finish the hbox.
-% ^^A Since v1.06, \verb"\toks@" contains the preamble specification,
-% ^^A and possible optional argument, as well as the table body.
-% \begin{macrocode}
- % \expandafter\tabular\the\toks@
- % \endtabular}%
-% \end{macrocode}
-% ^^A Since v1.05 reset all \LaTeX\ counters, by executing \verb"\TX@ckpt".
-% \begin{macrocode}
- % \TX@ckpt
-% \end{macrocode}
-% ^^A Print some statistics.
-% ^^A Added \verb"\TX@align" in v1.05, to line up the columns.
-% \begin{macrocode}
- % \TX@typeout@{\@spaces
- % \expandafter\TX@align
- % \the\wd\@tempboxa\space\space\space\space\space\@@
- % \expandafter\TX@align
- % \the\TX@col@width\space\space\space\space\space\@@
- % \@spaces\the\TX@cols}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@align}
-% ^^A Macro added at v1.05, to improve the printing of the tracing info.
-% \begin{macrocode}
- % \def\TX@align#1.#2#3#4#5#6#7#8#9\@@{%
- % \ifnum#1<10 \space\fi
- % \ifnum#1<100 \space\fi
- % \ifnum#1<\@m\space\fi
- % \ifnum#1<\@M\space\fi
- % #1.#2#3#4#5#6#7#8\space\space}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\arraybackslash}
-% ^^A \verb"\\" hack.
-% \begin{macrocode}
- % \ifx\arraybackslash\@undefined
- % \def\arraybackslash{\let\\\tabularnewline}
- % \fi
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\tracingtabularx}
-% ^^A Print statistics on column and table widths.
-% \begin{macrocode}
- % \def\tracingtabularx{%
- % %\def\TX@typeout{\PackageWarningNoLine{tabularx}}%
- % \def\TX@typeout{\ClassWarningNoLine{memoir}}% <--- changed
- % \def\TX@typeout@##1{\typeout{(tabularx) ##1}}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@typeout}
-% ^^A The default is to be to be quiet
-% \begin{macrocode}
- % \let\TX@typeout\@gobble
- % \let\TX@typeout@\@gobble
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@ftn}
-% ^^A A token register for saving footnote texts.
-% \begin{macrocode}
- % \newtoks\TX@ftn
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@ftntext}
-% ^^A \begin{macro}{\TX@xftntext}
-% ^^A Inside the alignment just save up the footnote text in a token
-% ^^A register.
-% \begin{macrocode}
- % \long\def\TX@ftntext#1{%
- % \edef\@tempa{\the\TX@ftn\noexpand\footnotetext
- % [\the\csname c@\@mpfn\endcsname]}%
- % \global\TX@ftn\expandafter{\@tempa{#1}}}%
- % \long\def\TX@xftntext[#1]#2{%
- % \global\TX@ftn\expandafter{\the\TX@ftn\footnotetext[#1]{#2}}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@trial@ftn}
-% ^^A On trial runs, gobble footnote texts.
-% \begin{macrocode}
- % \long\def\TX@trial@ftn#1{}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A This last section was added at Version 1.02. Previous versions
-% ^^A documented the fact that \verb"\verb" did not work inside {\ttfamily
-% ^^A tabularx}, but that did not stop people using it! This usually put
-% ^^A \LaTeX\ into an irrecoverable error position, with error messages that
-% ^^A did not mention the cause of the error. The `poor man's \verb"\verb"' (and
-% ^^A \verb"\verb*") defined here is based on page 382 of the \TeX{}Book. As
-% ^^A explained there, doing verbatim this way means that spaces are not
-% ^^A treated correctly, and so \verb"\verb*" may well be useless, however I
-% ^^A consider this section of code to be error-recovery, rather than a real
-% ^^A implementation of verbatim.
-% ^^A
-% ^^A The mechanism is quite general, and any macro which wants to allow a
-% ^^A form of \verb"\verb" to be used within its argument may
-% ^^A \verb"\let\verb=\TX@verb". (Making sure to restore the real definition
-% ^^A later!)
-% ^^A
-% ^^A \verb"\verb" and \verb"\verb*" are subject to the following restrictions:
-% ^^A \begin{enumerate}
-% ^^A \item Spaces in the argument are not read verbatim, but may be skipped
-% ^^A according to \TeX's usual rules.
-% ^^A \item Spaces will be added to the output after control words, even if
-% ^^A they were not present in the input.
-% ^^A \item Unless the argument is a single space, any trailing space,
-% ^^A whether in the original argument, or added as in (2),
-% ^^A will be omitted.
-% ^^A \item The argument must not end with \verb"\", so \verb"\verb|\|" is not
-% ^^A allowed, however, because of (3), \verb"\verb|\ |" produces
-% ^^A \verb"\".
-% ^^A \item The argument must be balanced with respect to \verb"{" and \verb"}". So
-% ^^A \verb"\verb|{|" is not allowed.
-% ^^A \item A comment character like \verb"%" will not appear verbatim. It will
-% ^^A act as usual, commenting out the rest of the input line!
-% ^^A \item The combinations \verb"?`" and \verb"!`" will appear as
-% ^^A {\ttfamily?`} and {\ttfamily!`} if the {\ttfamily cmtt} font is
-% ^^A being used.
-% ^^A \end{enumerate}
-% ^^A
-% ^^A \begin{macro}{\TX@verb}
-% ^^A The internal definition of \verb"\verb". Spaces will be replaced by \verb"~", so
-% ^^A for the star-form, \verb"\let" \verb"~" be \verb*| |, which we obtain as
-% ^^A \verb"\uppercase{*}". Use \verb"{\ifnum0=`}\fi" rather than \verb"\bgroup" to allow
-% ^^A \verb"&" to appear in the argument.
-% \begin{macrocode}
- % {\uccode`\*=`\ %
- % \uppercase{\gdef\TX@verb{%
- % \leavevmode\null\TX@vwarn
- % {\ifnum0=`}\fi\ttfamily\let\\\ignorespaces
- % \@ifstar{\let~*\TX@vb}{\TX@vb}}}}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@vb}
-% ^^A Get the `almost verbatim' text using \verb"\meaning". The `\verb"!"' is added to
-% ^^A the front of the user supplied text, to ensure that the whole argument
-% ^^A does not consist of a single \verb"{ }" group. \TeX\ would strip the outer
-% ^^A braces from such a group. The `\verb"!"' will be removed later.
-% ^^A
-% ^^A Originally I followed Knuth, and had \verb"\def\@tempa{##1}", however this
-% ^^A did not allow \verb"#" to appear in the argument. So in v1.04, I changed
-% ^^A this to to use a token register, and \verb"\edef". This allows \verb"#" appear,
-% ^^A but makes each one appear twice!, so later we loop through, replacing
-% ^^A \verb"##" by \verb"#".
-% \begin{macrocode}
- % \def\TX@vb#1{\def\@tempa##1#1{\toks@{##1}\edef\@tempa{\the\toks@}%
- % \expandafter\TX@v\meaning\@tempa\\ \\\ifnum0=`{\fi}}\@tempa!}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@v}
-% ^^A Strip the initial segment of the \verb"\meaning", including the `\verb"!"'
-% ^^A added earlier.
-% \begin{macrocode}
- % \def\TX@v#1!{\afterassignment\TX@vfirst\let\@tempa= }
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A As explained above we are going to replace \verb"##" pairs by \verb"#". To do
-% ^^A this we need non-special \verb"#" tokens. Make \verb"*" into a parameter
-% ^^A token so that we can define macros with arguments. The normal meanings
-% ^^A will be restored by the \verb"\endgroup" later.
-% \begin{macrocode}
- % \begingroup
- % \catcode`\*=\catcode`\#
- % \catcode`\#=12
-% \end{macrocode}
-% ^^A
-% ^^A \begin{macro}{\TX@vfirst}
-% ^^A As a special case, prevent the first character from being dropped.
-% ^^A This makes \verb"\verb*| |" produce \verb*| |. Then call \verb"\TX@v@".
-% ^^A This is slightly tricky since v1.04, as I have to ensure that an
-% ^^A actual \verb"#" rather than a command \verb"\let" to \verb"#" is passed on if the
-% ^^A first character is \verb"#".
-% \begin{macrocode}
- % \gdef\TX@vfirst{%
- % \if\@tempa#%
- % \def\@tempb{\TX@v@#}%
- % \else
- % \let\@tempb\TX@v@
- % \if\@tempa\space~\else\@tempa\fi
- % \fi
- % \@tempb}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@v@}
-% ^^A Loop through the \verb"\meaning", replacing all spaces by \verb"~". If the last
-% ^^A character is a space it is dropped, so that \verb"\verb*|\LaTeX|" produces
-% ^^A \verb"\LaTeX" not \verb*|\LaTeX |. The rewritten tokens are then further
-% ^^A processed to replace \verb"##" pairs.
-% \begin{macrocode}
- % \gdef\TX@v@*1 *2{%
- % \TX@v@hash*1##\relax\if*2\\\else~\expandafter\TX@v@\fi*2}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A \begin{macro}{\TX@v@hash}
-% ^^A The inner loop, replacing \verb"##" by \verb"#".
-% \begin{macrocode}
- % \gdef\TX@v@hash*1##*2{*1\ifx*2\relax\else#\expandafter\TX@v@hash\fi*2}
-% \end{macrocode}
-% ^^A \end{macro}
-% ^^A
-% ^^A As promised, we now restore the normal meanings of \verb"#" and \verb"*".
-% \begin{macrocode}
- % \endgroup
-% \end{macrocode}
-% ^^A
-% ^^A \begin{macro}{\TX@vwarn}
-% ^^A Warn the user the first time this \verb"\verb" is used.
-% \begin{macrocode}
- % \def\TX@vwarn{%
- % \@warning{\noexpand\verb may be unreliable inside tabularx}%
- % \global\let\TX@vwarn\@empty}
-% \end{macrocode}
-% ^^A \end{macro}
-% \begin{macrocode}
- %
- % %%%%%%%%%% end Tabularx package code v2.11 %%%%%%%%%%%%%%%%%%%%%
- %
- %
- %
- %
-% \end{macrocode}
-% ^^A
-% ^^A At this point we had better stop anyone trying to load the several
-% ^^A tabular-related packages (as effectively they are already loaded).
-% \begin{macrocode}
- % %%\@memfakeusepackage{array}
- % %%\@memfakeusepackage{dcolumn}
- % %%\@memfakeusepackage{delarray}
- % %%\@memfakeusepackage{tabularx}
- %
-% \end{macrocode}
-% ^^A
-% ^^A
%
% \subsection{Fear's rules}
%
@@ -18317,513 +15399,16 @@
% \end{macrocode}
% \end{macro}
%
-% The following is taken almost verbatim from the \Lpack{booktabs} package,
-% version~1.618, March 2003.
-%
+% As of Summer 2023 we instead load \Lpack{booktabs} directly and
+% remove it from emulation. The only change from the class code and
+% the current \Lpack{booktabs} code was using \cmd{\bktabrule} which
+% never seem to be changed at all.
+% \changes{v3.8}{2023/07/28}{Replaced booktabs embedding by loading
+% \Lpack{booktabs}}
% \begin{macrocode}
-%%%%%%%%%% Booktabs package code %%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%% slightly modified by PRW %%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%% by permission of Simon Fear %%%%%%%%%%%%%%%%%%%%%
-
+\RequirePackage{booktabs}[2020/01/12]
% \end{macrocode}
-% Danie Els is now (2005) the official maintainer of the \Lpack{booktabs} package. He provided me with
-% some updates to synchronize \Lpack{memoir}, \Lpack{booktabs} and support for \Lpack{colortbl} with \Lpack{booktabs}. I made the appropriate changes/extensions
-% on 2005/09/03 as part of version 1.618 of \Lpack{memoir}.
-%
-% \begin{macro}{\CT@arc@}
-% This supports the \Lpack{bookhands}/\Lpack{colortbl} package combination.
-% \begin{macrocode}
-\AtBeginDocument{%
- \providecommand*{\CT@arc@}{}}
-
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\heavyrulewidth}
-% \begin{macro}{\lightrulewidth}
-% \begin{macro}{\cmidrulewidth}
-% \begin{macro}{\belowrulesep}
-% \begin{macro}{\belowbottomsep}
-% \begin{macro}{\aboverulesep}
-% \begin{macro}{\abovetopsep}
-% \begin{macro}{\cmidrulesep}
-% \begin{macro}{\cmidrulekern}
-% \begin{macro}{\defaultaddspace}
-% First we set up some new dimensions.
-% \begin{macrocode}
-\newdimen\heavyrulewidth
-\newdimen\lightrulewidth
-\newdimen\cmidrulewidth
-\newdimen\belowrulesep
-\newdimen\belowbottomsep
-\newdimen\aboverulesep
-\newdimen\abovetopsep
-\newdimen\cmidrulesep
-\newdimen\cmidrulekern
-\newdimen\defaultaddspace
-\heavyrulewidth=.08em
-\lightrulewidth=.05em
-\cmidrulewidth=.03em
-\belowrulesep=.65ex
-\belowbottomsep=\z@
-\aboverulesep=.4ex
-\abovetopsep=\z@
-\cmidrulesep=\doublerulesep
-\cmidrulekern=.5em
-\defaultaddspace=.5em
-
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
%
-% \begin{macro}{\@cmidla}
-% \begin{macro}{\@cmidlb}
-% \begin{macro}{\@aboverulesep}
-% \begin{macro}{\@belowrulesep}
-% \begin{macro}{\@thisruleclass}
-% \begin{macro}{\@lastruleclass}
-% \begin{macro}{\@thisrulewidth}
-% And some internal counters and other things of no interest to the end user:
-% \begin{macrocode}
-\newcount\@cmidla
-\newcount\@cmidlb
-\newdimen\@aboverulesep
-\newdimen\@belowrulesep
-\newcount\@thisruleclass
-\newcount\@lastruleclass
-\@lastruleclass=0
-\newdimen\@thisrulewidth
-
-% \end{macrocode}
-% which will be described as needed below.
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\futurenonspacelet}
-% \begin{macro}{\@BTfnslone}
-% \begin{macro}{\@BTfnsltwo}
-% \begin{macro}{\@BTfnslthree}
-% Next we define a very useful macro (more-or-less straight from the
-% \theTeXbook's Dirty Tricks chapter; documented there). Use
-% \cs{futurenonspacelet} instead of \cs{futurelet} when looking for the next
-% (non-space) token after a macro that has an argument. (After a macro
-% without an argument, space is ignored anyway, so \cs{futurenonspacelet}
-% wouldn't be needed.) This hack allows users to type white
-% space between successive rule commands.
-% \begin{macrocode}
-\def\futurenonspacelet#1{\def\@BTcs{#1}%
- \afterassignment\@BTfnslone\let\nexttoken= }
-\def\@BTfnslone{\expandafter\futurelet\@BTcs\@BTfnsltwo}
-\def\@BTfnsltwo{\expandafter\ifx\@BTcs\@sptoken\let\next=\@BTfnslthree
- \else\let\next=\nexttoken\fi \next}
-\def\@BTfnslthree{\afterassignment\@BTfnslone\let\next= }
-
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \subsubsection{Full width rules}
-%
-% When we are not in a \texttt{longtable} environment, we can simply
-% implement the full width rules as a \cs{hrule} in a \verb?\noalign{}?
-% group. But within a \texttt{longtable}, the rule has to be drawn like a
-% \verb?\cmidrule{1-\LT@cols}? (the rationale for this is explained in the
-% \texttt{longtable} documentation).
-
-% In order to allow for both, all the rule macros have to
-% open a \cs{noalign} group immediately, while they work out whether
-% they have been called within a \texttt{longtable}; if you don't do this,
-% \TeX's underlying \cs{halign} process gets hiccups.
-% I use \LaTeX's
-% dirty trick (\verb?\ifnum=0`}?) to fool the parser that the bracket
-% count is OK. The bracket really gets closed after all the skipping
-% at the end of the \cs{@BTendrule} macro.
-
-% The class 1 rules, and \cs{specialrule}, really only differ in the
-% defaults for space above and
-% below, and the width, passed to a common routine, \cs{@BTrule},
-% described below. The spaces, \cs{@aboverulesep} and \cs{@belowrulesep},
-% are set within the \cs{noalign} group, so are inherited by
-% \cs{@BTrule}. Similarly, \cs{@BTrule} knows as much as it needs to
-% about the routine that called it by examining the inherited
-% \cs{@thisruleclass}. The optional width argument is parsed by
-% \cs{@BTrule} after being set to default if absent.
-
-%
-% \begin{macro}{\toprule}
-% \begin{macro}{\midrule}
-% \begin{macro}{\bottomrule}
-% \begin{macro}{\specialrule}
-% \begin{macrocode}
-\def\toprule{\noalign{\ifnum0=`}\fi
- \@aboverulesep=\abovetopsep
- \global\@belowrulesep=\belowrulesep
- \global\@thisruleclass=\@ne
- \@ifnextchar[{\@BTrule}{\@BTrule[\heavyrulewidth]}}
-
-\def\midrule{\noalign{\ifnum0=`}\fi
- \@aboverulesep=\aboverulesep
- \global\@belowrulesep=\belowrulesep
- \global\@thisruleclass=\@ne
- \@ifnextchar[{\@BTrule}{\@BTrule[\lightrulewidth]}}
-
-\def\bottomrule{\noalign{\ifnum0=`}\fi
- \@aboverulesep=\aboverulesep
- \global\@belowrulesep=\belowbottomsep
- \global\@thisruleclass=\@ne
- \@ifnextchar[{\@BTrule}{\@BTrule[\heavyrulewidth]}}
-
-\def\specialrule#1#2#3{\noalign{\ifnum0=`}\fi
- \@aboverulesep=#2\global\@belowrulesep=#3\global\@thisruleclass=\tw@
- \@BTrule[#1]}
-
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \begin{macro}{\addlinespace}
-% An \cs{addlinespace} is essentially a zero-width rule with
-% zero space above and argument (or default) space below. But because
-% the rule is not actually drawn, but is just a \cs{vskip}, there is no
-% need to check if we're in a longtable, so we don't need to call
-% \cs{@BTrule} as for `real' rules. But we do share the \cs{@BTendrule}
-% lookahead and flagsetting code (described below), and the \cs{vskip} is done there.
-% \begin{macrocode}
-\def\addlinespace{\noalign{\ifnum0=`}\fi
- \@ifnextchar[{\@addspace}{\@addspace[\defaultaddspace]}}
-\def\@addspace[#1]{\global\@belowrulesep=#1\global\@thisruleclass=\tw@
- \futurelet\@tempa\@BTendrule}
-
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\@BTrule}
-% All the rules (except \cs{addlinespace}) share this code.
-% \begin{macrocode}
-\def\@BTrule[#1]{%
-% \end{macrocode}
-% Note (2016/05/16): code rearranged a bit to come back into sync with
-% \Lpack{booktabs} v1.618033.
-%
-% \changes{v3.7f}{2016/05/16}{changed the order so the \cs{ifx} lines
-% come first. From booktabs 2016/04/27 v1.618033}
-% \changes{v3.7k}{2020/02/06}{changed to be in sync with booktabs
-% datad 2020/01/12. The comments are a carbon copy from booktabs.dtx}
-% Now we work out, by a very nasty hack, if we're within a
-% \verb|longtable|. It's easy if \verb=\longtable= isn't even defined: then we
-% can't be. But it is not enough just to check if \verb=longtable= is
-% loaded --- we might be within an ordinary table rather than a
-% longtable. So we look to see if \verb=\hline= has been re-defined
-% from its \LaTeX\ definition to be the same as
-% \verb=\LT@hline=. (Longtable currently does this redefinition when it opens a
-% \verb=longtable= environment, but not globally, so it is
-% cleared it when the environment closes.) Another
-% package could potentially do this! And \verb=longtable= might change the
-% way it implements this! So, it is not entirely safe, but I have
-% found no better way so far.
-%
-% We set up \verb=\@BTswitch= to call \verb=\@BTnormal= or \verb=\@BLTrule=, as
-% appropriate, then call it.
-% \begin{macrocode}
- \ifx\longtable\undefined
- \let\@BTswitch\@BTnormal
- \else\ifx\hline\LT@hline
- \nobreak
- \let\@BTswitch\@BLTrule
- \else
- \let\@BTswitch\@BTnormal
- \fi\fi
-% \end{macrocode}
-% Call \verb=\@BTswitch= at end of macro
-% \begin{macrocode}
- \global\@thisrulewidth=#1\relax
-% \end{macrocode}
-% Save the width argument (if the user didn't give one, then the
-% calling routine will have called \cs{@BTrule} with the default) in a global
-% variable for later use when drawing the rule.
-% \begin{macrocode}
- \ifnum\@thisruleclass=\tw@\vskip\@aboverulesep\else
-% \end{macrocode}
-% Specialrules always insert specified space above. (Note: addlinespaces
-% don't come here).
-% \begin{macrocode}
- \ifnum\@lastruleclass=\z@\vskip\@aboverulesep\else
- \ifnum\@lastruleclass=\@ne\vskip\doublerulesep\fi\fi\fi
-% \end{macrocode}
-% After text (last rule class 0), precede the rule by \cs{aboverulesep};
-% but if immediately after a
-% previous rule, insert a \cs{doublerulesep}.
-%
-% \begin{macrocode}
- \@BTswitch}
-
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@BTnormal}
-% This is when we're \emph{not} within a longtable. We are already in a
-% \cs{noalign} group, all we need do is draw an \cs{hrule} and gobble any
-% trailing spaces, then call the closing routine with \cs{@tempa} set
-% equal to the next token in the document.
-% \begin{macrocode}
-% \def\@BTnormal{\hrule
-% \@height \@thisrulewidth\futurenonspacelet\@tempa\@BTendrule}
-\def\@BTnormal{%
-%% \bktabrule{\@thisrulewidth}
- {\CT@arc@\bktabrule{\@thisrulewidth}}%
- \futurenonspacelet\@tempa\@BTendrule}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@BLTrule}
-% This is for full width rule within a \texttt{longtable}. First we check if
-% a kerning argument has been used; if so let \cs{@@BLTrule} read it,
-% else call \cs{@@BLTrule} with an empty string:
-% \begin{macrocode}
-\def\@BLTrule{\@ifnextchar({\@@BLTrule}{\@@BLTrule()}}
-% \end{macrocode}
-% \end{macro}
-% \begin{macro}{\@@BLTrule}
-% \begin{macrocode}
-\def\@@BLTrule(#1){\@setrulekerning{#1}%
-\global\@cmidlb\LT@cols
-% \end{macrocode}
-% The \cs{@setrulekerning} routine parses the kerning argument tokens
-% and sets global kerning widths accordingly (or to defaults, if user
-% hasn't set them explicitly). The global assignment to \cs{@cmidlb}
-% sets up the column count for the \cs{@cmidruleb} macro, which is
-% shared with \verb?cmidrules?.
-% \begin{macrocode}
-\ifnum0=`{\fi}%
-% \end{macrocode}
-% Close the currently open \cs{noalign} group. Within a \texttt{longtable},
-% rules are all to be drawn as leaders within a text box that is
-% \cs{LT@cols} columns wide.
-% \begin{macrocode}
-\@cmidruleb
-% \end{macrocode}
-% Draw the rule. We share the \cs{@cmidruleb} code with ordinary \cs{cmidrule}s.
-% \begin{macrocode}
-\noalign{\ifnum0=`}\fi
-% \end{macrocode}
-% We have to open a new noalign immediately else \TeX{} will start a new
-% text box where we don't want one. Then, after gobbling any
-% unwanted white space, we call the closing routine.
-% \begin{macrocode}
-\futurenonspacelet\@tempa\@BTendrule}
-
-% \end{macrocode}
-% \end{macro}
-% \begin{macro}{\@BTendrule}
-% We look one step ahead (token is in \cs{@tempa}) to see if another
-% rule follows (shame on user!). If so, we set \cs{@lastruleclass} equal
-% to \cs{@thisruleclass} (thus setting it up for the following rule). If
-% there isn't a following rule, we clear \cs{@lastruleclass} (ie set it
-% to zero), which isn't technically true since we have just drawn a
-% rule, but sets it up correctly for the next rule encountered, which
-% must be following some intervening text.
-% \begin{macrocode}
-\def\@BTendrule{%
- \ifx\@tempa\toprule\global\@lastruleclass=\@thisruleclass
- \else\ifx\@tempa\midrule\global\@lastruleclass=\@thisruleclass
- \else\ifx\@tempa\bottomrule\global\@lastruleclass=\@thisruleclass
- \else\ifx\@tempa\cmidrule\global\@lastruleclass=\@thisruleclass
- \else\ifx\@tempa\specialrule\global\@lastruleclass=\@thisruleclass
- \else\ifx\@tempa\addlinespace\global\@lastruleclass=\@thisruleclass
- \else\global\@lastruleclass=\z@\fi\fi\fi\fi\fi\fi
- \ifnum\@lastruleclass=\@ne\relax\else\vskip\@belowrulesep\fi
- \ifnum0=`{\fi}}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \subsubsection{Special subrules}
-%
-% \begin{macro}{\@setrulekerning}
-% The following code parses the trimming arguments (if there are any)
-% for \cs{cmidrule} or a \cs{BLTrule}. The rule
-% will be trimmed left and right by \cs{cmrkern@l} and \cs{cmrkern@l},
-% which are zero by default, set to \cs{cmidrulekern} by the plain
-% \verb?(lr)? arguments, or user set as in \verb?(r{.5em})?. We parse token by
-% token through the arguments. The
-% tokens \verb?r? and \verb?l? cause \cs{cmrkern@r} or \cs{cmrkern@l} to be set to
-% \cs{cmidrulekern}. There is no lookahead to see if a width is the
-% next token; this strategy is efficient for the plain commands,
-% while inefficient for the qualified commands, but more importantly
-% it is much easier to program. Tokens \verb?r? and \verb?l? also set
-% \cs{cmrswitch} so that if the next token turns out to be
-% \marg{wd} then the kerning will be done on the side
-% currently specified. I have been too lazy to program an error
-% message should one encounter tokens other than \verb?r?, \verb?l? or
-% \marg{wd}.
-% \changes{v1.618}{2005/09/03}{Fixed bug in booktabs trim command by improving character comparison code in \cs{@setrulekerning} (mempatch v3.8)}
-% \begin{macrocode}
-\def\@setrulekerning#1{%
- \global\let\cmrkern@l\z@
- \global\let\cmrkern@r\z@
- \@tfor\@tempa :=#1\do
- {\def\@tempb{r}%
- \ifx\@tempa\@tempb
- \global\let\cmrkern@r\cmidrulekern
- \def\cmrsideswitch{\cmrkern@r}%
- \else
- \def\@tempb{l}%
- \ifx\@tempa\@tempb
- \global\let\cmrkern@l\cmidrulekern
- \def\cmrsideswitch{\cmrkern@l}%
- \else
- \global\expandafter\let\cmrsideswitch\@tempa
- \fi
- \fi}}
-
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\cmidrule}
-% \begin{macro}{\@cmidrule}
-% \begin{macro}{\@@cmidrule}
-% The \cs{cmidrule} re-uses \cs{@lastruleclass} in an entirely different
-% way from the full width rules. (Maybe I should have used a
-% different flag; it seemed efficient at the time \ldots). This
-% is (left) set to one if you are in the middle of a row of
-% \cs{cmidrules}, or starting a new one (with \cs{morecmidrules}).
-% Otherwise, when \cs{@lastruleclass} is zero, we precede the
-% rule with \cs{aboverulesep}.
-% \begin{macrocode}
-\def\cmidrule{\noalign{\ifnum0=`}\fi
- \@ifnextchar[{\@cmidrule}{\@cmidrule[\cmidrulewidth]}}
-\def\@cmidrule[#1]{\@ifnextchar({\@@cmidrule[#1]}{\@@cmidrule[#1]()}}
-\def\@@cmidrule[#1](#2)#3{\@@@cmidrule[#3]{#1}{#2}}
-
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\@@@cmidrule}
-% The above is fiddling around to set defaults for missing optional
-% arguments. We also pass to \cs{@@@cmidrule} in a different order,
-% namely =[a-b]=\verb?{width required}= \verb?{kerning commands}= (this being
-% the order in which the arguments are actually processed):
-% \begin{macrocode}
-\def\@@@cmidrule[#1-#2]#3#4{\global\@cmidla#1\relax
- \global\advance\@cmidla\m@ne
- \ifnum\@cmidla>0\global\let\@gtempa\@cmidrulea\else
- \global\let\@gtempa\@cmidruleb\fi
- \global\@cmidlb#2\relax
- \global\advance\@cmidlb-\@cmidla
-% \end{macrocode}
-% This has set up a switch (\cs{@gtempa}) to call the relevant routine,
-% \cs{@cmidrulea} or \cs{@cmidruleb}, depending on whether we start
-% from column one or not.
-% \begin{macrocode}
- \global\@thisrulewidth=#3
-% \end{macrocode}
-% That is, set per default or given argument. Then parse any trimming
-% arguments to set, globally, \cs{cmrkern@r} and \cs{cmrkern@l} accordingly:
-% \begin{macrocode}
- \@setrulekerning{#4}
-% \end{macrocode}
-% Now insert space above if needed, close the \cs{noalign},
-% then switch to appropriate rule drawing routine as determined
-% above (\cs{let} to \cs{@gtempa}):
-% \begin{macrocode}
- \ifnum\@lastruleclass=\z@\vskip \aboverulesep\fi
- \ifnum0=`{\fi}\@gtempa
-% \end{macrocode}
-% Having now drawn the rule,
-% open another \cs{noalign}, and call the closing routine:
-% \begin{macrocode}
- \noalign{\ifnum0=`}\fi\futurenonspacelet\@tempa\@xcmidrule}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@xcmidrule}
-% In this closing routine, see if another \cs{cmidrule} follows;
-% if so, backspace
-% vertical so it will line up with the one you just drew,
-% and setting \cs{@lastruleclass} to 1 will suppress
-% adding space above the next. If a \cs{morecimdrules} follows,
-% we add (positive) \cs{cmidrulesep} (and again set \cs{@lastruleclass}
-% to one). Otherwise this is the last rule of the current group
-% and we can just add \cs{belowrulesep}. Finally, we close the \cs{noalign}.
-% \begin{macrocode}
-\def\@xcmidrule{\ifx\@tempa\cmidrule\vskip-\@thisrulewidth
- \global\@lastruleclass=\@ne\else
- \ifx\@tempa\morecmidrules\vskip \cmidrulesep
- \global\@lastruleclass=\@ne\else
- \vskip \belowrulesep\global\@lastruleclass=\z@\fi\fi
- \ifnum0=`{\fi}}
-
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@cmidrulea}
-% \begin{macro}{\@cmidruleb}
-% This code (called below) actually draws the rules. They are drawn
-% as boxes in text, rather than in a \cs{noalign} group, which permits
-% the left and right kerning.
-% \changes{v3.7f}{2016/05/16}{Added \cs{kern}\cs{z@} to comply to
-% latest booktabs updates. In Booktabs they were added to protect
-% against unskips.}
-% \begin{macrocode}
-\def\@cmidrulea{%
- \multispan\@cmidla&\multispan\@cmidlb
-%% \unskip\hskip \cmrkern@l\leaders\bktabrule{\@thisrulewidth}\hfill
- \unskip\hskip \cmrkern@l{%
- \CT@arc@\leaders\bktabrule{\@thisrulewidth}\hfill\kern\z@}%
- \hskip \cmrkern@r\cr}
-\def\@cmidruleb{%
- \multispan\@cmidlb
-%% \unskip\hskip \cmrkern@l\leaders\bktabrule{\@thisrulewidth}\hfill
- \unskip\hskip \cmrkern@l{%
- \CT@arc@\leaders\bktabrule{\@thisrulewidth}\hfill\kern\z@}%
- \hskip \cmrkern@r\cr}
-
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\morecmidrules}
-% This is really a dummy command; all the work is done above
-% within the \cs{cmidrule} routine. We look one step ahead there
-% to see if a \cs{morecmidrules} follows the current \cs{cmidrule},
-% and if so set the flag. Otherwise, \cs{morecmidrules} itself
-% does nothing.
-% \begin{macrocode}
-\def\morecmidrules{\noalign{\relax}}
-
-%%%%%%%%%% end of Booktabs package code %%%%%%%%%%%%%%%%%%%%%
-
-% \end{macrocode}
-% \end{macro}
-%
-% Ensure that the real \Lpack{booktabs} package can't get called.
-% \changes{v1.618}{2005/09/03}{Killed use of real booktabs package (mempatch v3.12)}
-% \begin{macrocode}
-%%\@memfakeusepackage{booktabs}
-
-% \end{macrocode}
-%
-%
%
% \subsection{Continuous tabulars}
%
@@ -19472,7 +16057,7 @@
\newcommand{\newfloat}[4][\@empty]{%
% \end{macrocode}
% \begin{macro}{\ftype@X}
-% Define the float type, set it to the float counter, and double
+% Define the float type, set it to the float counter, and increase
% the counter afterwards.
% \begin{macrocode}
%%% \@namedef{ftype@#2}{\value{newflo@tctr}}
@@ -19555,18 +16140,8 @@
% \end{macrocode}
% \end{macro}
%
-% \changes{v3.6i}{2011/02/18}{Added this instead of inserting the
-% adjustment code directly into the environment definitions}
-% \changes{v3.7g}{2017/05/08}{Moved into delayed \cs{@xfloat} redef as
-% we need it to run after \cs{normalsize}}
% \begin{macro}{\@xfloat}
-% In order to inject adjustment code into the core of the floats we
-% will need to patch the code float macros a little.
-% \begin{macrocode}
- %\let\mem@old@xfloat\@xfloat
- %\def\@xfloat#1[#2]{\mem@old@xfloat{#1}[#2]\@nameuse{#1adjustment}}
-% \end{macrocode}
-%
+% Was adjusted earlier.
% \end{macro}
%
% \begin{macro}{\setfloatlocations}
@@ -20781,6 +17356,8 @@
%
% \changes{v3.7i}{2019/10/24}{Added a \cs{par} to the start. This can
% get rid of sporadic spaces caused by hyperref changing \cs{refstepcounter}}
+% \changes{v3.8}{2023/08/02}{Added \cs{mem@step@subcounter} instead
+% of refstep}
% \begin{macrocode}
\newcommand{\subcaption}{%
\par
@@ -20789,7 +17366,7 @@
\ifdonemaincaption\else
\advance\csname c@\@captype\endcsname\@ne
\fi
- \refstepcounter{sub\@captype}\@contkeep
+ \mem@step@subcounter%
\@ifnextchar [%
{\@memsubcap{sub\@captype}}%
{\@memsubcap{sub\@captype}[\@empty]}}
@@ -20840,12 +17417,14 @@
% \begin{macro}{\contsubcaption}
% \cs{contsubcaption}\oarg{caption} is the continued version of
% \cs{subcaption}.
+% \changes{v3.8}{2023/08/02}{Added \cs{mem@step@subcounter} instead
+% of refstep}
% \begin{macrocode}
\newcommand{\contsubcaption}{%
- \bgroup
+ \bgroup%
\let\label=\memsub@label
- \@contset
- \refstepcounter{sub\@captype}\@contkeep
+ \@contset%
+ \mem@step@subcounter%
\@ifnextchar [%
{\@memsubcap{sub\@captype}}%
{\@memsubcap{sub\@captype}[\@empty]}}
@@ -20867,9 +17446,12 @@
% \begin{macro}{\mem@step@subcounter}
% \changes{v3.7i}{2019/10/24}{Added}
% Utility macro to save some typing.
+% \changes{v3.8}{2023/08/02}{Added
+% \Lhook{memoir/subcaption/aftercounter} hook}
% \begin{macrocode}
\newcommand\mem@step@subcounter{%
\refstepcounter{sub\@captype}\@contkeep%
+ \UseHook{memoir/subcaption/aftercounter}%
}
% \end{macrocode}
% \end{macro}
@@ -21131,7 +17713,10 @@
% \end{macro}
%
% \begin{macro}{\memsub@label}
-% These are copies of \cs{sub@label} and \cs{subref}.
+% Basically we want a \cmd{\label} inside the caption to set
+% \emph{two} labels with different values of
+% \cmd{\@currentlabel}. First locally \cmd{\label} is set to
+% \cmd{\mem@sublabel} defined as
% \begin{macrocode}
\newcommand{\memsub@label}{%
\@ifnextchar (%
@@ -21142,107 +17727,63 @@
% \end{macrocode}
% \end{macro}
%
+% As of summer 2023 we are autoloading \Lpack{nameref}, thus the code
+% for \cmd{\sf@@memsub@label} can be greatly reduced plus we can use
+% the \cmd{\label} that has the \Lpack{nameref} extensions, then we
+% don't have to look out for changes in say \Lpack{hyperref} etc.
+%
% \begin{macro}{\sf@memsub@label}
-% This is a copy of \cs{sf@sub@label}.
+% \changes{v3.8}{2023/07/31}{Set \cs{@currentlabelname} directly
+% instad of using \cs{mem@currentlabelname}}
% \begin{macrocode}
\def\sf@memsub@label(#1)#2{%
- \protected@edef\mem@currentlabelname{#1}%
+ \protected@edef\@currentlabelname{#1}%
+ % if available we can also use % \ExpandArgs{x}\mem@set@cln{#1}
\sf@@memsub@label{#2}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\sf@@memsub@label}
-% This is an expanded copy of \cs{sf@@sub@label} processed after any packages may
-% have been loaded.
-% An added complexity here is when \Lpack{showkeys} is used. It
-% redefines \cs{label} to write it in the margins. But the
-% \cs{sf@@memsub@label} writes the label to aux directly. So in order
-% to support \Lpack{showkeys}, we add a hook, and define this hook if
-% \Lpack{showkeys} is loaded.
-% \changes{v3.7g}{2018/02/28}{Added hook into \cs{sf@@memsub@label},
-% issue reported via \texttt{https://tex.stackexchange.com/q/374301/3929}}
-% \begin{macrocode}
-\newcommand\sf@@memsub@label@hook[1]{}
+% \changes{v3.8}{2023/07/31}{reimplemented}
+% This sets two labels, the user given one an one prefixed by
+% \verb?sub@?. The difference between them is the value of
+% \cmd{\@currentlabel}. For the latter we will aditionally locally
+% disable showkeys.
+%
+% First we'd like to have a copy of the ``kernel'' \cmd{\label}
+% command. Packages may have added stuff to make a copy at begin doc.
+% \begin{macro}{\mem@kernel@label}
+% \begin{macrocode}
+\AtBeginDocument{
+ \let\mem@kernel@label\label
+}
-\AtBeginDocument{%
- \@ifpackageloaded{nameref}{%
-% \end{macrocode}
-% The \Lpack{nameref} package is loaded.
-% \begin{macrocode}
- \newcommand*{\sf@@memsub@label}[1]{%
- \@bsphack
- \sf@@memsub@label@hook{#1}%
- \protected@write\@auxout{}{%
- \string\newlabel{#1}%
- {{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}%
- {\thepage}%
- {\mem@currentlabelname\relax}%
- {\@currentHref}{}}}%
- \protected@write\@auxout{}{%
- \string\newlabel{sub@#1}%
- {{\@nameuse{@@thesub\@captype}}%
- {\thepage}%
- {\mem@currentlabelname\relax}%
- {\@currentHref}{}}}%
- \@esphack}
- }{% no nameref
- \@ifpackageloaded{hyperref}{%
-% \end{macrocode}
-% The \Lpack{hyperref} package is loaded, but not \Lpack{nameref}.
-% \begin{macrocode}
- \newcommand*{\sf@@memsub@label}[1]{%
- \@bsphack
- \sf@@memsub@label@hook{#1}%
- \protected@write\@auxout{}{%
- \string\newlabel{#1}%
- {{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}%
- {\thepage}%
- {\mem@currentlabelname\relax}%
- {\@currentHref}{}}}%
- \protected@write\@auxout{}{%
- \string\newlabel{sub@#1}%
- {{\@nameuse{@@thesub\@captype}}%
- {\thepage}%
- {\mem@currentlabelname\relax}%
- {\@currentHref}{}}}%
- \@esphack}
- }{% no hyperref
-% \end{macrocode}
-% Neither the \Lpack{hyperref} nor the \Lpack{nameref}
-% package is loaded.
-% \begin{macrocode}
- \let\@memoldlabel\label
- \newcommand*{\sf@@memsub@label}[1]{%
- \@bsphack
- \sf@@memsub@label@hook{#1}%
- \@memoldlabel{#1}%
- \protected@write\@auxout{}{%
- \string\newlabel{sub@#1}%
- {{\@nameuse{@@thesub\@captype}}%
- {\thepage}}}%
- \@esphack}
- }{}%
- }% end no nameref
-% \end{macrocode}
-% Next add the hook redefinition if \Lpack{showkeys} is loaded. Please
-% note that the placement of the \Lpack{showkeys} label, might be a
-% little strange.
-% \changes{v3.7g}{2018/02/28}{added}
-% \changes{v3.7k}{2020/02/06}{Added a check on \cs{SK@}, if not
-% defined showkeys is running under final mode}
-% \begin{macrocode}
- \@ifpackageloaded{showkeys}{%
- \ifdefined\SK@\relax
- \renewcommand\sf@@memsub@label@hook[1]{%
- \SK@\SK@@label{#1}%
- }
- \fi
- }{}
-} % end AtBeginDocument
+% \end{macrocode}
+% Next we define the macro it self in terms of this
+% \begin{macrocode}
+\newcommand\sf@@memsub@label[1]{%
+ \@bsphack%
+ \mem@kernel@label{#1}% normal label
+% \end{macrocode}
+% Next locally redefine \cmd{\@currentlabel} so the next label only
+% gets the sub number. TODO: make the format
+% configurable. Additionally disable showkeys for this extra
+% label. This way we do not need a hook into the construction to
+% support \Lpack{showkeys} that just comes from the normal \cmd{\label}.
+% \begin{macrocode}
+ \begingroup%
+ % \ExpandArgs{x}\mem@set@cln{\@nameuse{@@thesub\@captype}}
+ \protected@edef\@currentlabel{\@nameuse{@@thesub\@captype}}% sub@label
+ \def\showkeyslabelformat##1{}% disable showkeys for this extra label
+ \mem@kernel@label{sub@#1}% internally generated sub@label
+ \endgroup%
+ \@esphack%
+}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\subcaptionref}
% This is a copy of the \cs{subref} macro.
@@ -22465,7 +19006,7 @@
% \begin{macro}{\eminnershape}
% \begin{macro}{\emph}
% The old emphasis font command (the original \cs{em} is defined in the
-% kernel file \file{ltfssini.dtx}, coded here as \cs{@m@m@m}).
+% kernel file \file{ltfssini.dtx}).
% \changes{v0.2}{2001/06/03}{Redid coding for \cs{emph} and \cs{em}}
% \changes{v1.618}{2005/09/03}{Dont' deprecate \cs{em} and deleted \cs{@mem@emwarn} (mempatch v3.0)}
% \changes{v1.618}{2005/09/03}{Completely redid \cs{em} and \cs{emph}, matching latest fixltx2e package (mempatch v3.3)}
@@ -22534,174 +19075,118 @@
%
% \subsection{Title referencing}
%
-% This is based on DA's \Lpack{titleref} package~\cite{TITLEREF}.
-% The following
-% remarks are taken from that package.
-%
-%
-% Titles for numbered sectioning units and for floats with captions are
-% the same as the respective TOC, LOF, or LOT entry (even when no TOC is
-% printed). When a short title is provided (\verb?\section[short]{long}?)
-% it will be used for the \cs{titleref}. This is especially useful for
-% figure captions. Unnumbered sections take their title reference from
-% the printed title. Beware! This turns the title into a moving argument
-% when it normally is not, and will cause weird errors if there are
-% `fragile' commands present.
-%
-% Enumerated lists do not have titles and simply inherit the title of
-% their section.
-%
-% The format of the title reference is controlled by the command
-% \cs{theTitleReference}, which can be redefined with \cs{renewcommand}.
-% It takes two parameters: the number and the title. The number is
-% just the regular \cs{ref} and it is WRONG in unnumbered sections.
-% Beware! The default definition is the unadorned title. You could
-% do, for example, \\
-% \verb?\renewcommand{\theTitleReference}[2]{#1\ \emph{#2}}?.
-%
-% The title of the current section is also available without \cs{label}:
-% Use the command \cs{currenttitle} to generate a \cs{titleref} to the current
-% section. If you have redefined \cs{theTitleReference} to print the number
-% with the title, be aware that the two may not correspond: In a numbered
-% list the number will show the current item but the title will show the
-% current section, but in an unnumbered section the number will show
-% some previous section number.
-%
-% The big problem with the \verb?[usetoc]? method is that \cs{titleref} will
-% not refer to a \cs{label} which was given in the title or caption itself;
-% the label must be placed after the sectioning command or the caption.
-% If you make a title-reference to a label given in a title, you will get
-% a warning message.
-%
-% \changes{v1.4}{2003/11/16}{Added title referencing (from patch v1.4)}
-%
-% \begin{macro}{\ifheadnameref}
-% \begin{macro}{\headnameref}
-% \begin{macro}{\tocnameref}
-% \cs{ifheadnameref}: FALSE use ToC entry, TRUE use header entry
-% \changes{v1.61803}{2008/01/30}{Added \cs{headnameref} and \cs{tocnameref}}
-% \begin{macrocode}
-\newif\ifheadnameref
-\newcommand*{\headnameref}{\headnamereftrue}
-\newcommand*{\tocnameref}{\headnamereffalse}
- \tocnameref
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
+% \changes{v3.8}{2023/07/25}{Entire section rewritten}
+% As of Summer 2023 this has been redone by directly loading the
+% \Lpack{nameref} package instead. It is loaded without changing the
+% sectional macros, which are in turn updated to set
+% \cs{@currentlabelname} for the new kernel label system to
+% pickup. The new kernel label system also requires us not to modify
+% \cs{label} so the switch was required.
%
-% \begin{macro}{\theTitleReference}
-% \cs{theTitleReference}\marg{num}\marg{title} is the style for typesetting
-% a referenced (number and) title.
+% \begin{macro}{\titleref}
+% Instead of defining our own macro we now let \cs{titleref} be an
+% alias for \cs{nameref}. Do remember that it also have a starred
+% version.
% \begin{macrocode}
-\newcommand{\theTitleReference}[2]{#2}
+% disable nameref sectional patches (the macro just needs to be defined)
+\def\NR@nopatch@sectioning{set}
+\def\NR@nopatch@caption{set}
+\RequirePackage{nameref}
+\newcommand\titleref{\nameref}
% \end{macrocode}
% \end{macro}
-%
-% \begin{macro}{\label}
-% This redefinition of \cs{label} is intended to work with other redirections
-% of \cs{label}, if they record extra information in a similar way.
+% \begin{macro}{\mem@set@cln}
+% We'll need to set \cs{@currentlabelname} in various places. The
+% title may need to be cleaned. \Lpack{nameref} provides
+% \cs{NR@gettitle} and we just use our own name for it.
% \begin{macrocode}
-\let\@mem@old@label\label
-\def\label#1{\@bsphack\begingroup
- \protected@edef\@currentlabel{\protect\M@TitleReference
- {\@currentlabel}{\M@currentTitle}}%
- \@mem@old@label{#1}%
- \endgroup \@esphack}%
-
+\def\mem@set@cln{\NR@gettitle}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@mem@@gettitle}
-% \cs{@mem@@gettitle}\marg{title} grabs a title text.
+% \begin{macro}{\M@gettitle}
+% All the sectional macros in memoir has been using \cs{M@gettitle}
+% for years to access the title to use for \cs{titleref}. We simply
+% change its definition to use our simpler case. Do remember that if
+% the argument for \cs{M@gettitle} is a macro, it needs to be
+% expanded once.
% \begin{macrocode}
-\def\@mem@@gettitle#1{\begingroup \let\protect\@unexpandable@protect
- \let\label\@mem@nestwarn
- \let\index\@gobble \let\glossary\@gobble
- \let\markboth\@gobbletwo \let\@mkboth\@gobbletwo
- \let\markright\@gobble
- \edef\@tempa{\noexpand\def\noexpand\M@currentTitle{#1}}%
- \expandafter\endgroup\@tempa}
-
+\newcommand\M@gettitle[1]{\mem@set@cln{#1}}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@mem@nestwarn}
-% \begin{macro}{\M@TitleReference}
+% In the sectional macros the title we will be giving to
+% \cs{@currentlabelname} will be the title for the toc or if requested
+% (and avaiable) the title for the header. That is
+% \begin{verbatim}
+% \chapter{title} % sends title to toc and header, so use title
+% \chapter[toc]{title} % sends toc to toc and header, so use toc
+% \chapter[toc][header]{title} % data depends on \headnameref and
+% % \tocnameref (default)
+% \end{verbatim}
+% \changes{v1.4}{2003/11/16}{Added title referencing (from patch v1.4)}
+%
+% \begin{macro}{\ifheadnameref}
+% \begin{macro}{\headnameref}
+% \begin{macro}{\tocnameref}
+% \cs{ifheadnameref}: FALSE use ToC entry, TRUE use header entry. Used
+% inside the sectional macros that support two optional arguments.
+% \changes{v1.61803}{2008/01/30}{Added \cs{headnameref} and \cs{tocnameref}}
% \begin{macrocode}
-\let\@mem@nestwarn\@gobble
-\let\M@TitleReference\@firstoftwo
-
+\newif\ifheadnameref
+\newcommand*{\headnameref}{\headnamereftrue}
+\newcommand*{\tocnameref}{\headnamereffalse}
+ \tocnameref
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
-% \begin{macro}{\titleref}
-% \begin{macro}{\currenttitle}
-% \begin{macro}{\@mem@titleref}
-% \begin{macro}{\@mem@titlerefnolink}
-% \cs{titleref}\marg{key} prints the title corresponding to
-% \verb?\label{key}?. \cs{currenttitle} prints the latest title.
-% \cs{titleref} extended to support a starred version that will not
-% provide hyperlinks when using \Lpack{hyperref}. The
-% \Lpack{hyperref} definition of \cs{@mem@titlerefnolink} is found
-% in \Lpack{memhfixc}.
-% \changes{v1.6180339c}{2009/01/18}{Extended \cs{titleref}, suggestion
-% on ctt by martin@helios.de}
+% Following the 2023 reimplementation of \cmd{\titleref} the following
+% public macros are no longer used and are redefined to either do
+% nothing or give an error.
+% \begin{macro}{\namerefon}
+% \begin{macro}{\namerefoff}
+% Was used to enable (default) or disable support for
+% \cmd{\titleref}. Now does nothing.
% \begin{macrocode}
-\newcommand*\@mem@titleref[1]{\begingroup
- \let\numberline\@gobble
- \let\M@TitleReference\@mem@theTR % interrupt recursion of \ref
- \ref{#1}\endgroup}
-\let\@mem@titlerefnolink\@mem@titleref
-
-\DeclareRobustCommand\titleref{\@ifstar{\@mem@titlerefnolink}{\@mem@titleref}}
-
-\DeclareRobustCommand{\currenttitle}{\begingroup
- \let\numberline\@gobble
- \theTitleReference\@currentlabel\M@currentTitle\endgroup}
-
+\providecommand\namerefon{\@memwarn{\protect\namerefon\space no longer does anything}}
+\providecommand\namerefoff{\@memwarn{\protect\namerefoff\space no longer does anything}}
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{verbatim}
-% % \DeclareRobustCommand\@mem@nestwarn[1]{\@memwarn%
-% % {Label \string"#1\string" was put in a title,\MessageBreak
-% % so the \noexpand\titleref is incorrect}}
-% \end{verbatim}
-%
-% \begin{macro}{\M@currentTitle}
-% \begin{macrocode}
-\let\M@currentTitle\@empty
-
+% \begin{macro}{\currenttitle}
+% \cmd{\currenttitle} was advertised to give the most recent
+% sectional title. It is better to be more specific and use a label
+% and \cmd{\titleref}. Now defined to give an error.
+% \begin{macrocode}
+\providecommand\currenttitle{%
+ \@memerror{The \protect\currenttitle\space command is no longer\MessageBreak
+ available}{%
+ Place a label and use \protect\titleref{label} instead
+ }
+}
% \end{macrocode}
% \end{macro}
-%
-% \begin{macro}{\@mem@theTR}
-% proper definition:
+% \begin{macro}{\theTitleReference}
+% Was used to define the output of \cmd{\titleref}. Now just gives a
+% warning.
% \begin{macrocode}
-\def\@mem@theTR{\let\M@TitleReference\@firstoftwo \theTitleReference}
-
+\providecommand\theTitleReference[2]{%
+ \@memwarn{\protect\theTitleReference\space is no longer available}
+}
% \end{macrocode}
% \end{macro}
-%
-% \begin{macro}{\namerefon}
-% \begin{macro}{\namerefoff}
-% Named references has turned some arguments (e.g., \verb?\legend{text}?) into
-% moving ones (Sven.Hartrumpf@FernUni-Hagen.de reported a problem but
-% not a cause, March 2003). Not everyone needs named references.
+% \begin{macro}{\M@TitleReference}
+% This was used in the old implementation as a part of the data inside
+% \verb|\newlabel| in the \verb|.aux|-files. Deleting it will cause
+% the first compilation after a memoir update to fail. We'll
+% just define it to gobble two args.
% \begin{macrocode}
-\newcommand*{\namerefon}{\let\M@gettitle\@mem@@gettitle}
-\newcommand*{\namerefoff}{\let\M@gettitle\@gobble}
- \namerefon
+\let\M@TitleReference\@gobbletwo
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
%
% \section{Table of Contents, etc.}
@@ -22770,7 +19255,7 @@
% We define two lengths and a utility command.
% \begin{macrocode}
\newlength{\tocentryskip} \setlength{\tocentryskip}{1em}
-\newlength{\tocbaseline} \setlength{\tocbaseline}{20pt}
+\newlength{\tocbaseline} \setlength{\tocbaseline}{20pt}
\newcommand{\tocskip}[1]{%
\addtocontents{toc}{\protect\vspace{#1}}}
% \end{macrocode}
@@ -23695,7 +20180,7 @@
% \changes{v3.7.19}{2022/10/25}{Changing \cs{toclevel@part} definition to
% \cs{def} for better compability with future hyperref}
% \begin{macrocode}
-\newcommand*{\toclevel@part}{-1}
+\def\toclevel@part{-1}
% \end{macrocode}
% \end{macro}
@@ -23897,7 +20382,7 @@
% \changes{v1.3}{2002/11/14}{Added \cs{chapternumberline}}
% \changes{v1.618}{2005/09/03}{Added \cs{@chapapp@head} to \cs{chapternumberline} (mempatch v3.12)}
% \changes{v1.61803398d}{2010/02/13}{added hook into chapter numberline}
-% changes{v3.6k}{2012/07/22}{Factored out the box command}
+% \changes{v3.6k}{2012/07/22}{Factored out the box command}
% \begin{macrocode}
\newcommand*\chapternumberlinehook[1]{}
\newcommand{\chapternumberline}[1]{%
@@ -24285,7 +20770,11 @@
% \end{macro}
% \end{macro}
% \end{macro}
-%
+% \paragraph{Caveat:} In certain cases an immediate verson of
+% \cs{cftinserthook} might be needed due to race conditions. We might
+% add such a version at some point.
+%
+%
% \subsection{ToC and divisional numbering}
%
% Commands are provided, based on the \Lpack{tocvsec2} package, for changing
@@ -25408,12 +21897,14 @@
% \cs{flushbottom} than just let \cs{@texttop}. We also add a switch
% macro to see if \cs{flushbottom} is active. \cs{raggedbottom} and
% \cs{sloppybottom} sets the switch to false}
+% \changes{v3.8}{2023/08/08}{The kernel defined these as robust, we'd
+% better too}
% \begin{macrocode}
-\renewcommand{\raggedbottom}{%
+\DeclareRobustCommand{\raggedbottom}{%
\def\mem@flshbot{01}%
\def\@textbottom{\vskip\z@ plus.0001fil}%
\let\@texttop\@mkidx}
-\renewcommand{\flushbottom}{%
+\DeclareRobustCommand{\flushbottom}{%
\def\mem@flshbot{00}%
\let\@textbottom\relax
\let\@texttop\@mkidx}
@@ -26825,6 +23316,7 @@
% \splittopskip\footnotesep
% \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
% \hsize\columnwidth \@parboxrestore
+% \def\@currentcounter{footnote}% added later
% \protected@edef\@currentlabel{%
% \csname p@footnote\endcsname\@thefnmark}%
% \color@begingroup
@@ -26916,6 +23408,7 @@
% \reset@font\footnotesize
% \hsize\columnwidth
% \@parboxrestore
+% \def\@currentcounter{mpfootnote}% forgotten
% \protected@edef\@currentlabel{%
% \csname p@mpfootnote\endcsname\@thefnmark}%
% \color@begingroup
@@ -27252,14 +23745,18 @@
%
% I'm not at all sure about the color bits, though!
% \changes{v1.618}{2005/09/02}{Fixed colors in \cs{verbfootnote} (mempatch v2.3)}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
+% \changes{v3.8}{2023/07/27}{replaced hardcoded \cs{foornotesize}
+% by \cs{foottextfont}}
% \begin{macrocode}
\long\def\@verbfootnotetext{%
\insert\footins\bgroup
- \footnotesize
+ \foottextfont%
\interlinepenalty\interfootnotelinepenalty
\splittopskip\footnotesep
\splitmaxdepth \dp\strutbox \floatingpenalty \@MM
\hsize\columnwidth \@parboxrestore
+ \def\@currentcounter{footnote}%
\edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}%
%%%% \color@begingroup
\@makefntext{\rule{\z@}{\footnotesep}\ignorespaces}%
@@ -27298,14 +23795,18 @@
% \begin{macro}{\@verbmpfootnotetext}
% Footnotes in minipages are a little different, so another
% version of \cs{...footnotetext}.
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
+% \changes{v3.8}{2023/07/27}{replaced hardcoded \cs{foornotesize}
+% by \cs{foottextfont}}
% \begin{macrocode}
\long\def\@verbmpfootnotetext{%
\global\setbox\@mpfootins\vbox{%
- \reset@font\footnotesize
+ \reset@font\foottextfont
\unvbox\@mpfootins
\bgroup
\hsize\columnwidth
\@parboxrestore
+ \def\@currentcounter{mpfootnote}%
\edef\@currentlabel{\csname p@mpfootnote\endcsname\@thefnmark}%
\color@begingroup
\@makefntext{\rule{\z@}{\footnotesep}\ignorespaces}%
@@ -27426,18 +23927,21 @@
% \changes{v1.6180}{2006/06/12}{Stop font changes leaking into footnotes.
% The v1.618 change was too early}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable'}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
+% \changes{v3.8}{2023/07/27}{removed group around \cs{footnotetext}}
% \begin{macrocode}
\renewcommand{\@mpfootnotetext}[1]{%
\global\setbox\@mpfootins\vbox{%
\unvbox\@mpfootins
\def\baselinestretch{\m@m@footnote@spacing}%
\foottextfont \hsize\columnwidth \@parboxrestore
+ \def\@currentcounter{mpfootnote}%
\protected@edef\@currentlabel{%
\csname p@mpfootnote\endcsname\@thefnmark}%
\color@begingroup
\reset@font%
\@makefntext{%
- \rule\z@\footnotesep\ignorespaces{\foottextfont #1}%
+ \rule\z@\footnotesep\ignorespaces\foottextfont #1%
\@finalstrut\strutbox}%
\color@endgroup}}
@@ -27644,6 +24148,8 @@
% \cs{m@make@footnotetext} and \cs{m@make@mpfootnotetext}
% (courtesy David Wilson)}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
+% \changes{v3.8}{2023/07/27}{removed group around \cs{footnotetextX}}
% \begin{macrocode}
\newcommand{\m@make@footnotetext}[1]{%
\@namelongdef{@footnotetext#1}##1{%
@@ -27652,11 +24158,12 @@
\reset@font\@nameuse{foottextfont#1}%
\@preamfntext
\hsize\columnwidth
+ \def\@currentcounter{footnote}%
\protected@edef\@currentlabel{%
\csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}}%
\color@begingroup
\@nameuse{@makefntext#1}{%
- \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1}##1}% <- v1.6180339a
+ \rule\z@\footnotesep\ignorespaces\@nameuse{foottextfont#1 ##1}%
\@finalstrut\strutbox}%
\color@endgroup}%
\m@mmf@prepare}}
@@ -27667,6 +24174,8 @@
% \begin{macro}{\m@make@mpfootnotetext}
% \cs{m@make@mpfootnotetext}\marg{series} creates \cs{@mpfootnotetext<series>}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
+% \changes{v3.8}{2023/07/27}{removed group around \cs{footnotetextX}}
% \begin{macrocode}
\newcommand{\m@make@mpfootnotetext}[1]{%
\@namelongdef{@mpfootnotetext#1}##1{%
@@ -27675,11 +24184,12 @@
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\@nameuse{foottextfont#1}%
\hsize\columnwidth \@parboxrestore
+ \def\@currentcounter{mpfootnote}%
\protected@edef\@currentlabel{%
\csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
\color@begingroup
\@nameuse{@makefntext#1}{%
- \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1}##1}% <- v1.6180339a
+ \rule\z@\footnotesep\ignorespaces\@nameuse{foottextfont#1}##1%
\@finalstrut\strutbox}%
\color@endgroup}%
\m@mmf@prepare}}
@@ -28010,11 +24520,13 @@
% \cs{@footnotetext} for the \verb?v@r? series.
% \changes{v1.618}{2005/09/03}{Added missing percent to \cs{@twocolfootnotetext} (mempatch v3.1)}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\@twocolfootnotetext}[1]{\insert\footinsv@r{%
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\foottextfont
\@preamfntext
+ \def\@currentcounter{footnote}%
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark}%
\color@begingroup
@@ -28040,10 +24552,11 @@
%
% \begin{macro}{\@twocolfootfmt}
% \cs{@twocolfootfmt}
+% \changes{v3.8}{2023/07/27}{removed group around \cs{footnotetext}}
% \begin{macrocode}
\newcommand{\@twocolfootfmt}[1]{%
\@preamtwofmt
- {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
+ {\footfootmark\strut \foottextfont #1\strut\par}\allowbreak}
% \end{macrocode}
% \end{macro}
@@ -28052,6 +24565,7 @@
% \cs{@mptwocolfootnotetext}\marg{text} is the two column version
% of \cs{@mpfootnotetext} for the \verb?v@r? series for minipages.
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\@mptwocolfootnotetext}[1]{%
\global\setbox\@mpfootinsv@r\vbox{%
@@ -28059,6 +24573,7 @@
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\foottextfont
\hsize\columnwidth \@parboxrestore
+ \def\@currentcounter{mpfootnote}%
\protected@edef\@currentlabel{%
\csname p@mpfootnote\endcsname\@thefnmark}%
\color@begingroup
@@ -28096,6 +24611,7 @@
% \cs{m@make@twocolfootnotetext}\marg{series} creates
% \cs{@twocolfootnotetext}\meta{series}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\m@make@twocolfootnotetext}[1]{%
\@namelongdef{@twocolfootnotetext#1}##1{%
@@ -28103,6 +24619,7 @@
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\@nameuse{foottextfont#1}%
\@preamfntext
+ \def\@currentcounter{footnote}%
\protected@edef\@currentlabel{%
\csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
\color@begingroup
@@ -28117,6 +24634,7 @@
% \cs{m@make@mptwocolfootnotetext}\marg{series} creates
% \cs{@mptwocolfootnotetext}\meta{series}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\m@make@mptwocolfootnotetext}[1]{%
\@namelongdef{@mptwocolfootnotetext#1}##1{%
@@ -28125,6 +24643,7 @@
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\@nameuse{foottextfont#1}%
\hsize\columnwidth \@parboxrestore
+ \def\@currentcounter{mpfootnote}%
\protected@edef\@currentlabel{%
\csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
\color@begingroup
@@ -28138,12 +24657,13 @@
% \cs{m@make@twocolfootfmt}\marg{series} creates
% \cs{@twocolfootfmt}\meta{series}
% \changes{v1.61}{2004/03/14}{Removed space from \cs{m@make@twocolfootfmt} [RS]}
+% \changes{v3.8}{2023/07/27}{removed group around \cs{footnotetextX}}
% \begin{macrocode}
\newcommand{\m@make@twocolfootfmt}[1]{%
\@namedef{@twocolfootfmt#1}##1{%
\@preamtwofmt
{\@nameuse{footfootmark#1}\strut
- {\@nameuse{foottextfont#1}##1}\strut\par}\allowbreak}}
+ \@nameuse{foottextfont#1}##1\strut\par}\allowbreak}}
% \end{macrocode}
% \end{macro}
@@ -28197,11 +24717,13 @@
% \cs{@threecolfootnotetext}\marg{text} is the three column version of
% \cs{@footnotetext}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\@threecolfootnotetext}[1]{\insert\footinsv@r{%
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\foottextfont
\@preamfntext
+ \def\@currentcounter{footnote}%
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark}%
\color@begingroup
@@ -28226,10 +24748,11 @@
%
% \begin{macro}{\@threecolfootfmt}
%
+% \changes{v3.8}{2023/07/27}{removed group around \cs{footnotetext}}
% \begin{macrocode}
\newcommand{\@threecolfootfmt}[1]{%
\@preamthreefmt
- {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
+ {\footfootmark\strut \foottextfont #1\strut\par}\allowbreak}
% \end{macrocode}
% \end{macro}
@@ -28238,6 +24761,7 @@
% \cs{@mpthreecolfootnotetext}\marg{text} is the three column version of
% \cs{@mpfootnotetext}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\@mpthreecolfootnotetext}[1]{%
\global\setbox\@mpfootinsv@r\vbox{%
@@ -28245,6 +24769,7 @@
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\foottextfont
\hsize\columnwidth \@parboxrestore
+ \def\@currentcounter{mpfootnote}%
\protected@edef\@currentlabel{%
\csname p@mpfootnote\endcsname\@thefnmark}%
\color@begingroup
@@ -28283,6 +24808,7 @@
% \cs{m@make@threecolfootnotetext}\marg{series} creates
% \cs{@threecolfootnotetext}\meta{series}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\m@make@threecolfootnotetext}[1]{%
\@namelongdef{@threecolfootnotetext#1}##1{%
@@ -28290,6 +24816,7 @@
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\@nameuse{foottextfont#1}%
\@preamfntext
+ \def\@currentcounter{footnote}%
\protected@edef\@currentlabel{%
\csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
\color@begingroup
@@ -28303,6 +24830,7 @@
% \cs{m@make@mpthreecolfootnotetext}\marg{series} creates
% \cs{@mpthreecolfootnotetext}\meta{series}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\m@make@mpthreecolfootnotetext}[1]{%
\@namelongdef{@mpthreecolfootnotetext#1}##1{%
@@ -28311,6 +24839,7 @@
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\@nameuse{foottextfont#1}%
\hsize\columnwidth \@parboxrestore
+ \def\@currentcounter{mpfootnote}%
\protected@edef\@currentlabel{%
\csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
\color@begingroup
@@ -28324,12 +24853,13 @@
% \cs{m@make@threecolfootfmt}\marg{series} creates
% \cs{@threecolfootfmt}\meta{series}
% \changes{v1.61}{2004/03/14}{Removed space from \cs{m@make@threecolfootfmt} [RS]}
+% \changes{v3.8}{2023/07/27}{removed group around \cs{footnotetext}}
% \begin{macrocode}
\newcommand{\m@make@threecolfootfmt}[1]{%
\@namelongdef{@threecolfootfmt#1}##1{%
\@preamthreefmt
{\@nameuse{footfootmark#1}\strut
- {\@nameuse{foottextfont#1}##1}\strut\par}\allowbreak}}
+ \@nameuse{foottextfont#1}##1\strut\par}\allowbreak}}
% \end{macrocode}
% \end{macro}
@@ -28476,11 +25006,13 @@
% \cs{@parafootnotetext}\marg{text} is a paragraph version of
% \cs{@footnotetext}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\@parafootnotetext}[1]{\insert\footinsv@r{
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\foottextfont
\@preamfntext
+ \def\@currentcounter{footnote}%
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark}%
\setbox0=\vbox{\hsize=\maxdimen
@@ -28495,11 +25027,12 @@
% \begin{macro}{\@parafootfmt}
% \cs{@parafootfmt}\marg{text} is a paragraph version of
% \cs{@footfmt}
+% \changes{v3.8}{2023/07/27}{removed group around \cs{footnotetext}}
% \begin{macrocode}
\newcommand{\@parafootfmt}[1]{%
\parindent=\z@
\parfillskip=0pt \@plus 1fil
- {\footfootmark\strut {\foottextfont #1}\penalty-10}}
+ {\footfootmark\strut \foottextfont #1\penalty-10}}
% \end{macrocode}
% \end{macro}
@@ -28508,6 +25041,7 @@
% \cs{@mpparafootnotetext}\marg{text} is a paragraph version of
% \cs{@mpfootnotetext}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{adding the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\@mpparafootnotetext}[1]{%
\global\setbox\@mpfootinsv@r\vbox{%
@@ -28515,6 +25049,7 @@
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\foottextfont
\hsize\columnwidth \@parboxrestore
+ \def\@currentcounter{mpfootnote}%
\protected@edef\@currentlabel{%
\csname p@mpfootnote\endcsname\@thefnmark}%
\setbox0=\vbox{\hsize=\maxdimen
@@ -28569,6 +25104,7 @@
% \cs{m@make@parafootnotetext}\marg{series} creates
% \cs{@parafootnotetext}\meta{series}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\m@make@parafootnotetext}[1]{%
\@namelongdef{@parafootnotetext#1}##1{%
@@ -28576,6 +25112,7 @@
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\@nameuse{foottextfont#1}%
\@preamfntext
+ \def\@currentcounter{footnote}%
\protected@edef\@currentlabel{%
\csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
\setbox0=\vbox{\hsize=\maxdimen
@@ -28591,6 +25128,7 @@
% \cs{m@make@mpparafootnotetext}\marg{series} creates
% \cs{@mpparafootnotetext}\meta{series}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\m@make@mpparafootnotetext}[1]{%
\@namelongdef{@mpparafootnotetext#1}##1{%
@@ -28599,6 +25137,7 @@
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\@nameuse{foottextfont#1}%
\hsize\columnwidth \@parboxrestore
+ \def\@currentcounter{mpfootnote}%
\protected@edef\@currentlabel{%
\csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
\setbox0=\vbox{\hsize=\maxdimen
@@ -28614,13 +25153,14 @@
% \cs{m@make@parafootfmt}\marg{series} creates
% \cs{@parafootfmt}\meta{series}
% \changes{v1.61}{2004/03/14}{Removed space from \cs{m@make@parafootfmt} [RS]}
+% \changes{v3.8}{2023/07/27}{removed group around \cs{footnotetextX}}
% \begin{macrocode}
\newcommand{\m@make@parafootfmt}[1]{%
\@namelongdef{@parafootfmt#1}##1{%
\parindent=\z@
\parfillskip=0pt \@plus 1fil
{\@nameuse{footfootmark#1}\strut
- {\@nameuse{foottextfont#1}##1}\penalty-10}}}
+ \@nameuse{foottextfont#1}##1\penalty-10}}}
% \end{macrocode}
% \end{macro}
@@ -29061,11 +25601,13 @@
% \end{macrocode}
% Use \cs{marginpar} for placing the footnote.
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\marginpar{%
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font
\foottextfont
+ \def\@currentcounter{footnote}%
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark}%
\color@begingroup
@@ -29077,6 +25619,8 @@
% \changes{v1.618033988c}{2010/02/20}{sporadic spaces removed, error
% reported on texlive mailinglist}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
+% \changes{v3.8}{2023/07/27}{removed group around \cs{footnotetext}}
% \begin{macrocode}
\insert\footins{%
\def\baselinestretch{\m@m@footnote@spacing}%
@@ -29084,11 +25628,12 @@
\foottextfont
\@preamfntext
\hsize\columnwidth
+ \def\@currentcounter{footnote}%
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark}%
\color@begingroup
\@makefntext{%
- \rule\z@\footnotesep\ignorespaces{\foottextfont #1}%
+ \rule\z@\footnotesep\ignorespaces\foottextfont #1%
\@finalstrut\strutbox}%
\color@endgroup}%
\fi%
@@ -29494,6 +26039,7 @@
% \changes{v1.61803398d}{2010/02/05}{changed \cs{sidefootfont}
% to \cs{sidefoottextfont}}
% \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable}
+% \changes{v3.8}{2023/07/26}{added the missing \cs{@currentcounter}}
% \begin{macrocode}
\newcommand{\@sidefootnotetext}[1]{\insert\sidefootins{%
\hsize\sidefootwidth
@@ -29505,6 +26051,7 @@
\allowbreak
\prevdepth=\dp\strutbox
\vskip-\parskip
+ \def\@currentcounter{sidefootnote}%
\protected@edef\@currentlabel{%
\csname p@sidefootnote\endcsname\@thesidefnmark}%
\color@begingroup
@@ -30261,11 +26808,15 @@
% \changes{v3.6k}{2013/05/17}{Forgot about labels in the note text.}
% \changes{v3.7g}{2018/01/03}{Added \cs{phantomsection}, otherwise
% \cs{label} does not work correctly. Reported in \texttt{https://tex.stackexchange.com/q/408448/3929}}
+% \changes{v3.8}{2023/07/26}{added \cs{@currentcounter} and
+% defined that \cs{@currentlabel} points to}
% \begin{macrocode}
-\newcommand\startnoteentrystart[4]{%
+\newcommand\startnoteentrystart[4]{% number; manual id; auto label; href anchor
\prenoteinnotes%
\noteidinnotes{#1}{#2}%
- \@ifmtarg{#2}{\phantomsection\def\@currentlabel{#1}}{}%
+ \phantomsection%
+ \@ifmtarg{#2}{\def\@currentlabel{#1}}{\def\@currentlabel{#2}}%
+ \def\@currentcounter{pagenote}%
\pagenoteanchor{#4}%
\pageinnotes{#3}%
\prenotetext%
@@ -34738,7 +31289,7 @@
% \subsection{Fractions and subscripts}
%
%
-% Styles for fractions like 3/4.
+% Styles for fractions like 3/4 (but better).
%
% \begin{macro}{\slashfracstyle}
% \cs{slashfracstyle} based on the kernel \cs{textsuperscript} macro
@@ -36630,9 +33181,10 @@
% \Lpack{array} package}
% \changes{v3.7h}{2018/09/06}{\Lpack{array} no longer embedded,
% required instead}
+% \changes{v3.8}{2023/07/28}{booktabs no longer emulated}
% \begin{macrocode}
% \EmulatedPackage{array}[2016/10/06]
-\EmulatedPackage{booktabs}[2016/05/16]
+ % \EmulatedPackage{booktabs}[2016/05/16]
\EmulatedPackage{ccaption}[2008/07/23]
\EmulatedPackage{changepage}[2008/07/23]
\EmulatedPackage{chngcntr}[2008/07/23]
@@ -36919,6 +33471,12 @@ keyword "\\glossaryentry"
% \newblock (Available from CTAN in
% \texttt{/macros/latex/contrib/patchcmd})
%
+% \bibitem[LTX3]{LTX3}
+% The \LaTeX{} Project.
+% \newblock \emph{The \LaTeX3 sources}
+% \newblock June, 2023.
+% \newblock (Available from CTAN in \texttt{/macros/latex/contrib/l3kernel})
+%
% \bibitem[Fai98]{MOREVERB}
% Robin Fairbairns.
% \newblock \emph{The moreverb package}.
@@ -37002,10 +33560,10 @@ keyword "\\glossaryentry"
% \newblock \emph{The ltfilehook package}
% \newblock July 2020.
%
-% \bibitem[Mit2020b]{LTHOOKS}
+% \bibitem[Mit2023]{LTHOOKS}
% Frank Mittelbach
-% \newblock \emph{The lthooks package}
-% \newblock July 2020.
+% \newblock \emph{\LaTeX's hook management}
+% \newblock June 2023.
%
% \bibitem[Mit2020c]{LTSHIPOUT}
% Frank Mittelbach
@@ -37020,10 +33578,10 @@ keyword "\\glossaryentry"
% \texttt{/macros/latex/contrib/fancyhdr})
%
%
-% \bibitem[Rah01]{NAMEREF}
-% Sebastian Rahtz.
+% \bibitem[Rah23]{NAMEREF}
+% Sebastian Rahtz, Heiko Oberdiek, The \LaTeX{} project.
% \newblock \emph{Section name references in LaTeX}.
-% \newblock January 2001.
+% \newblock 2023.
% \newblock (Available from CTAN in
% \texttt{/macros/latex/contrib/hyperref})
%
diff --git a/macros/latex/contrib/memoir/mempatch.dtx b/macros/latex/contrib/memoir/mempatch.dtx
index 540bc678cb..f47f1f0195 100644
--- a/macros/latex/contrib/memoir/mempatch.dtx
+++ b/macros/latex/contrib/memoir/mempatch.dtx
@@ -20,7 +20,7 @@
%
%
% \fi
-% \CheckSum{610}
+% \CheckSum{562}
%
% \def\dtxfile{\texttt{mempatch.dtx}}
% \def\fileversion{v1.0} \def\filedate{2003/10/04}
@@ -312,6 +312,7 @@
%% With the new hooking system from 2020+ memhfixc is automatically
%% added after loading hyperref with the memoir class
%%
+%% Version 1.21 2023/07/28
%% Version 1.20 2022/11/17
%% Version 1.19 2021/06/16
%% Version 1.18 2019/10/24
@@ -338,7 +339,7 @@
%
%
% \begin{macrocode}
-\ProvidesPackage{memhfixc}[2022/11/17 v1.20 nameref/hyperref package fixes for memoir class]
+\ProvidesPackage{memhfixc}[2023/07/28 v1.21 hyperref package fixes for memoir class]
% \end{macrocode}
%
% \begin{macro}{\M@hfixcfinish}
@@ -355,86 +356,13 @@
%
% \subsection{Patches for nameref}
%
-% \changes{v1.13}{2010/04/19}{Rewritten to help fix a race condition}
%
-% The nameref package changes \cs{@sect} and \cs{label} so we bring
-% back the memoir stuff. We have earlier been using
-% \verb?\AtBeginDocument? plus \verb?\@ifpackageloaded{nameref}? to
-% add our changes to \Lpack{nameref}. But this is not a good solution,
-% as \Lpack{hyperref} can delay \Lpack{nameref} loading using
-% \verb?\AtBeginDocument{\usepackage{nameref}}? \emph{and} add thiis
-% \emph{after} \Lpack{memhfixc} is loaded. A better solution is to use
-% \verb?\AtEndPackage?, then it does not matter how far after
-% \Lpack{memhfixc} \Lpack{nameref} is loaded.
-%
-% \changes{v1.13}{2010/04/19}{Code in the next part have been changed
-% to match \cs{AtEndPackage}}
-% \begin{macrocode}
-\AtEndPackage{nameref}{%
-% \end{macrocode}
-
-% \begin{macro}{\M@sect}
-% \begin{macro}{\NR@sectm@m}
-% The \Lpack{nameref} package~\cite{NAMEREF} fiddles with \cs{@sect} (which memoir replaces
-% by \cs{M@sect}).
-% \begin{macrocode}
- \@ifundefined{NR@sectm@m}{% haven't fiddled with \M@sect
- \typeout{Redoing nameref's sectioning}
- \let\NR@sectm@m\M@sect
- \def\M@sect##1##2##3##4##5##6[##7][##8]##9{%
- \setcounter{section@level}{##2}%
- \def\@currentlabelname{##7}%
- \NR@sectm@m{##1}{##2}{##3}{##4}{##5}{##6}[{##7}][{##8}]{\Sectionformat{##9}{##2}}}%
- }%
- {% \NR@sectm@m has already been defined
- }%
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
+% \changes{v1.21}{2023/07/25}{Patches removed}
%
-% \begin{macro}{\label}
-% \begin{macro}{\MNR@label}
-% The \Lpack{nameref} package replaces \cs{label}, which (which memoir has added to).
-% Make the memoir addition again.
-%
-% \begin{macrocode}
- \@ifundefined{MNR@label}{% haven't fiddled with \label
- \typeout{Redoing nameref's label}
- \let\MNR@label\label
- \def\label##1{\@bsphack\begingroup
- \protected@edef\@currentlabel{\protect\M@TitleReference
- {\@currentlabel}{\M@currentTitle}}%
- \MNR@label{##1}%
- \endgroup \@esphack}%
- \let\MNR@old@caption\@caption
- \long\def\@caption##1[##2]##3{%
- \MNR@old@caption{##1}[{##2}]{##3}%
- \def\@currentlabelname{##2}%
- \M@gettitle{##2}%
- }%
- }%
- {% \MNR@label has already been defined
- }%
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
+% As of Summer 2023, memoir now autoloads \Lpack{nameref} and adjusts
+% it self to it. Thus no patches needed.
%
-% \begin{macro}{\nameref}
-% We use \cs{titleref} to provide the same functionality as
-% \cs{nameref}, so as not to confuse users, we let \cs{nameref} be
-% an alias for \cs{titleref}.
-% \begin{macrocode}
-\DeclareRobustCommand\nameref{\@ifstar{\@mem@titlerefnolink}{\@mem@titleref}}
-% \end{macrocode}
-% \end{macro}
%
-% \begin{macrocode}
-}% end of AtEndPackage
-% \end{macrocode}
-
-
%
% We are done unless the \Lpack{hyperref} package has been loaded
% \begin{macrocode}
@@ -531,11 +459,15 @@
% \end{macro}
%
% \begin{macro}{\bookautorefname}
+% \begin{macro}{\subfigureautorefname}
+% \changes{v1.21}{2023/07/28}{Added \cs{subfigureautorefname}}
% \begin{macrocode}
\providecommand{\bookautorefname}{Book}
+\providecommand{\subfigureautorefname}{Subfigure}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@@writetorep}
% Change \Lpack{hyperref}'s \cs{@@writetorep} as memoir uses \cs{partnumberline} and
@@ -774,10 +706,11 @@
% \Lpack{hyperref} provide a \cs{ref*} command that does not give a
% hyperlink under \Lpack{hyperref}, we extend \cs{titleref} to
% support it.
+% \changes{v1.21}{2023/08/07}{removed}
% \begin{macrocode}
-\def\@mem@titlerefnolink#1{\begingroup \let\numberline\@gobble
- \let\M@TitleReference\@mem@theTR % interrupt recursion of \ref
- \ref*{#1}\endgroup}
+ %\def\@mem@titlerefnolink#1{\begingroup \let\numberline\@gobble
+ % \let\M@TitleReference\@mem@theTR % interrupt recursion of \ref
+ % \ref*{#1}\endgroup}
% \end{macrocode}
% \end{macro}
@@ -1027,26 +960,26 @@
% \newblock \emph{The LaTeX Companion}.
% \newblock Addison-Wesley Publishing Company, 1994.
%
+% \bibitem[Rahtz23a]{NAMEREF}
+% Sebastian Rahtz, Heiko Oberdiek, The \LaTeX3 Project.
+% \newblock \emph{Section name references in LaTeX}.
+% \newblock 2023.
+% \newblock (Available from CTAN (the \texttt{nameref} package) via
+% \texttt{/macros/latex/contrib/hyperref/})
%
-% \bibitem[Rah01]{NAMEREF}
-% Sebastian Rahtz.
-% \newblock \emph{Section name references in LaTeX}.
-% \newblock January 2001.
-% \newblock (Available from CTAN in
-% \texttt{/macros/latex/contrib/hyperref})
%
-% \bibitem[Rah02]{HYPERREF}
-% Sebastian Rahtz.
-% \newblock \emph{Hypertext marks in LaTeX}.
-% \newblock March 2002.
-% \newblock (Available from CTAN in
-% \texttt{/macros/latex/contrib/hyperref})
+% \bibitem[Rahtz23b]{HYPERREF}
+% Sebastian Rahtz, Heiko Oberdiek, The \LaTeX3 Project.
+% \newblock \emph{Hypertext marks in LaTeX}.
+% \newblock 2023.
+% \newblock (Available from CTAN via
+% \texttt{/macros/latex/contrib/hyperref/})
%
-% \bibitem[Wil08]{MEMOIR}
+% \bibitem[Wil23]{MEMOIR}
% Peter Wilson.
% \newblock \emph{The LaTeX \Lpack{memoir} class for configurable
% typesetting: Source code}.
-% \newblock July 2008.
+% \newblock July 2023.
% \newblock (Available from CTAN in
% \texttt{macros/latex/contrib/memoir})
%
diff --git a/macros/latex/contrib/naive-ebnf/DEPENDS.txt b/macros/latex/contrib/naive-ebnf/DEPENDS.txt
index 6abbcb3ff6..9bae0232c3 100644
--- a/macros/latex/contrib/naive-ebnf/DEPENDS.txt
+++ b/macros/latex/contrib/naive-ebnf/DEPENDS.txt
@@ -1,2 +1,15 @@
hard pgfopts
-hard expl3 \ No newline at end of file
+soft docshots
+soft etoolbox
+soft filecontentsdef
+soft href-ul
+soft hypdoc
+soft iexec
+soft l3build
+soft libertine
+soft mathtools
+soft microtype
+soft newtx
+soft pgfopts
+soft scheme-basic
+soft xetex \ No newline at end of file
diff --git a/macros/latex/contrib/naive-ebnf/naive-ebnf.dtx b/macros/latex/contrib/naive-ebnf/naive-ebnf.dtx
index 804e2121b9..b3972202f6 100644
--- a/macros/latex/contrib/naive-ebnf/naive-ebnf.dtx
+++ b/macros/latex/contrib/naive-ebnf/naive-ebnf.dtx
@@ -50,7 +50,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{naive-ebnf}
%<*package>
-[2023-07-14 0.0.13 EBNF in Plain Text]
+[2023-08-08 0.0.14 EBNF in Plain Text]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -112,6 +112,7 @@
% \item |/.../| denotes a regular expression, like |/[a-z]+/|;
% \item |[...]| denotes an optional substitution;
% \item |{...}| denotes a zero or more times repetition;
+% \item |{...}+| denotes one or more times repetition;
% \item \texttt{\char`\|\char`\|} denotes an indented vertical bar at the beginning of the string.
% \end{itemize}
@@ -228,7 +229,7 @@
% % There is no meaning in this:
% <x> := ( "x" ( "y" | ( "z" | <z> ) ) ) \\
% <y> := [ [ "x1" ] { /[a-z]+/ } ] \\
-% <z> := { { { <x> } <y> } <z> } \\
+% <z> := { { { <x> }+ <y> } <z> } \\
% <t> := [ <x> ] [ <y> ] \\
% \end{ebnf}
% \end{document}
@@ -354,6 +355,8 @@
{\ebnf@color{gray}{[}#1\ebnf@color{gray}{]}}
\newcommand\ebnf@repetition[1]
{\ebnf@color{gray}{\{}#1\ebnf@color{gray}{\}}}
+\newcommand\ebnf@iteration[1]
+ {\ebnf@color{gray}{\{}#1\ebnf@color{gray}{\}\(^{\scriptscriptstyle +}\)}}
\newcommand\ebnf@grouping[1]
{\ebnf@color{gray}{(}#1\ebnf@color{gray}{)}}
\ExplSyntaxOn
@@ -388,6 +391,7 @@
% \begin{macro}{ebnf}
% \changes{0.0.4}{2023/02/03}{Any symbols are allowed inside \texttt{\char`\\EbnfNonTerminal} commands and inside the \texttt{ebnf} environment, where non-terminals are mentioned.}
% \changes{0.0.11}{2023/07/12}{Many bugs fixed in the area of regular expression matching.}
+% \changes{0.0.14}{2023/08/08}{One-or-more repetition introduced with \texttt{\char`\{...\char`\}+} syntax.}
% Then, we define the |ebnf| environment:
% \begin{macrocode}
\ExplSyntaxOn
@@ -410,6 +414,11 @@
\regex_replace_all:nnN
{ /(.+?)/ }%
{\c{ebnf@regexp}{\1}} \ebnf_tmp%
+ \cs_new:Npn\ebnf_iterated{%
+ \regex_replace_all:nnNT
+ { \{\s(([^\s]*(\s[^\}\{]|\s(\}|\{)[^\s])?)*)\s\}\+ }%
+ {\c{ebnf@iteration}{\1}} \ebnf_tmp \ebnf_iterated}%
+ \ebnf_iterated%
\cs_new:Npn\ebnf_curled{%
\regex_replace_all:nnNT
{ \{\s(([^\s]*(\s[^\}\{]|\s(\}|\{)[^\s])?)*)\s\} }%
diff --git a/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf b/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf
index ee1c39c6b9..8f70242c2a 100644
--- a/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf
+++ b/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf
Binary files differ
diff --git a/macros/luatex/latex/luacomplex/README.txt b/macros/luatex/latex/luacomplex/README.txt
index 359cb1edff..6445382ed6 100644
--- a/macros/luatex/latex/luacomplex/README.txt
+++ b/macros/luatex/latex/luacomplex/README.txt
@@ -1,3 +1,8 @@
+# The luacomplex package
+# version 1.3
+# Authors: Chetan Shirore and Ajit Kumar
+# Email: mathsbeauty@gmail.com
+
# Introduction
The luacomplex package is developed to define complex numbers and perform basic arithmetic on complex numbers in LaTeX.
It also loads the luamaths package.
@@ -14,6 +19,6 @@ Lua is available as a certified open-source software.
Its license is simple and liberal, which is compatible with GPL.
#Installation and Inclusion
-The installation of luagcd package is similar to plain latex package, where the .sty file is in LaTeX directory of texmf tree.
-The package can be included with \usepackage{luacomplex } command in the preamble of the LaTeX document.
+The installation of luacomplex package is similar to plain latex package, where the .sty file is in LaTeX directory of texmf tree.
+The package can be included with \usepackage{luacomplex} command in the preamble of the LaTeX document.
The TeX file is to be compiled using the LuaLaTeX engine. \ No newline at end of file
diff --git a/macros/luatex/latex/luacomplex/luacomplex.pdf b/macros/luatex/latex/luacomplex/luacomplex.pdf
index 332a6a59c4..fba9194c8d 100644
--- a/macros/luatex/latex/luacomplex/luacomplex.pdf
+++ b/macros/luatex/latex/luacomplex/luacomplex.pdf
Binary files differ
diff --git a/macros/luatex/latex/luacomplex/luacomplex.sty b/macros/luatex/latex/luacomplex/luacomplex.sty
index 5ff32a6176..c863f5cd0f 100644
--- a/macros/luatex/latex/luacomplex/luacomplex.sty
+++ b/macros/luatex/latex/luacomplex/luacomplex.sty
@@ -1,62 +1,66 @@
-% luacomplex package
-% version 1.2 Date: 14-Feb-2023
+% The luacomplex package
+% Version 1.3 Date: 08-Aug-2023
% Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt.
% Authors: Chetan Shirore and Ajit Kumar
-\ProvidesPackage{luacomplex}[1.2]
+\ProvidesPackage{luacomplex}[1.3]
\RequirePackage{xkeyval}
\RequirePackage{amsmath}
\RequirePackage{luacode}
\RequirePackage{luamaths}
\begin{luacode*}
-complex = {} -- global complex numbers registry
-M = {} -- the module
+complexZ = {} -- global complex numbers registry
+CM = {} -- the module
local mt = {} --metatable for complex numbers
-setmetatable(_ENV, {__index = complex})
- function new (r, i)
+setmetatable(_ENV, {__index = complexZ})
+ function CM.new (r, i)
local cp = {}
cp = {r=r, i=i}
return setmetatable(cp,mt)
end
- M.new = new -- add 'new' to the module
+
-- create constant 'i'
- M.i = new(0, 1)
+ CM.i = CM.new(0, 1)
- function M.add (c1, c2)
- return new(c1.r + c2.r, c1.i + c2.i)
+ function CM.add (c1, c2)
+ return CM.new(c1.r + c2.r, c1.i + c2.i)
end
- function M.sub (c1, c2)
- return new(c1.r - c2.r, c1.i - c2.i)
+ function CM.sub (c1, c2)
+ return CM.new(c1.r - c2.r, c1.i - c2.i)
+ end
+
+ function CM.minus (c1)
+ return CM.new(-c1.r, -c1.i)
end
- function M.mul (c1, c2)
- return new(c1.r*c2.r - c1.i*c2.i, c1.r*c2.i + c1.i*c2.r)
+ function CM.mul (c1, c2)
+ return CM.new(c1.r*c2.r - c1.i*c2.i, c1.r*c2.i + c1.i*c2.r)
end
- function M.inv (c)
+ function CM.inv (c)
local n = c.r^2 + c.i^2
- return new(c.r/n, -c.i/n)
+ return CM.new(c.r/n, -c.i/n)
end
- function M.div (c1, c2)
- return M.mul(c1, M.inv(c2))
+ function CM.div (c1, c2)
+ return CM.mul(c1, CM.inv(c2))
end
- function M.re (c)
- return new(c.r,0)
+ function CM.re (c)
+ return CM.new(c.r,0)
end
- function M.im (c)
- return new(c.i,0)
+ function CM.im (c)
+ return CM.new(c.i,0)
end
- function M.mod (c)
+ function CM.mod (c)
local n = c.r^2 + c.i^2
- return new(n,0)
+ return CM.new(n,0)
end
- function M.prinarg(c)
+ function CM.prinarg(c)
local arg
if c.r > 0 then
arg = math.atan(c.i/c.r)
@@ -71,14 +75,14 @@ setmetatable(_ENV, {__index = complex})
else
error("Principal argument not defined.")
end
- return arg
+ return CM.new(arg,0)
end
- function M.op (...)
+ function CM.op (...)
return ...
end
- function M.tostring (c,imgunit)
+ function CM.tostring (c,imgunit)
imgunit = "\\imgUnit"
if c.i ==0 then
return string.format("%g", c.r)
@@ -92,69 +96,70 @@ setmetatable(_ENV, {__index = complex})
end
--Setting Metatable operations.
- mt.__add = M.add
- mt.__mul = M.mul
- mt.__sub = M.sub
- mt.__tostring = M.tostring
+ mt.__add = CM.add
+ mt.__mul = CM.mul
+ mt.__sub = CM.sub
+ mt.__unm = CM.minus
+ mt.__tostring = CM.tostring
\end{luacode*}
\newcommand\cpxNew[2]{%
\directlua{%
- complex[\luastringN{#1}] = M.new(#2)
+ complexZ[\luastringN{#1}] = CM.new(#2)
}%
}
\newcommand\cpxPrint[1]{%
- \directlua{tex.sprint(tostring(complex[\luastringN{#1}]))}%
+ \directlua{tex.sprint(CM.tostring(complexZ[\luastringN{#1}]))}%
}
\newcommand\cpxAdd[3]{%
\directlua{%
- complex[\luastringN{#1}] = M.add(complex[\luastringN{#2}],complex[\luastringN{#3}])
+ complexZ[\luastringN{#1}] = CM.add(complexZ[\luastringN{#2}],complexZ[\luastringN{#3}])
}%
}
\newcommand\cpxSub[3]{%
\directlua{%
- complex[\luastringN{#1}] = M.sub(complex[\luastringN{#2}],complex[\luastringN{#3}])
+ complexZ[\luastringN{#1}] = CM.sub(complexZ[\luastringN{#2}],complexZ[\luastringN{#3}])
}%
}
\newcommand\cpxMul[3]{%
\directlua{%
- complex[\luastringN{#1}] = M.mul(complex[\luastringN{#2}],complex[\luastringN{#3}])
+ complexZ[\luastringN{#1}] = CM.mul(complexZ[\luastringN{#2}],complexZ[\luastringN{#3}])
}%
}
\newcommand\cpxDiv[3]{%
\directlua{%
- complex[\luastringN{#1}] = M.div(complex[\luastringN{#2}],complex[\luastringN{#3}])
+ complexZ[\luastringN{#1}] = CM.div(complexZ[\luastringN{#2}],complexZ[\luastringN{#3}])
}%
}
\newcommand\cpxInv[2]{%
\directlua{%
- complex[\luastringN{#1}] = M.inv(complex[\luastringN{#2}])
+ complexZ[\luastringN{#1}] = CM.inv(complexZ[\luastringN{#2}])
}%
}
\newcommand\cpxRe[2]{%
\directlua{%
- complex[\luastringN{#1}] = M.re(complex[\luastringN{#2}])
+ complexZ[\luastringN{#1}] = CM.re(complexZ[\luastringN{#2}])
}%
}
\newcommand\cpxIm[2]{%
\directlua{%
- complex[\luastringN{#1}] = M.im(complex[\luastringN{#2}])
+ complexZ[\luastringN{#1}] = CM.im(complexZ[\luastringN{#2}])
}%
}
\newcommand\cpxMod[2]{%
\directlua{%
- complex[\luastringN{#1}] = M.mod(complex[\luastringN{#2}])
+ complexZ[\luastringN{#1}] = CM.mod(complexZ[\luastringN{#2}])
}%
}
\newcommand\cpxPrinArg[2]{%
\directlua{%
- complex[\luastringN{#1}] = M.prinarg(complex[\luastringN{#2}])
+ complexZ[\luastringN{#1}] = CM.prinarg(complexZ[\luastringN{#2}])
}%
}
\newcommand\cpxOp[2]{%
\directlua{%
- complex[\luastringN{#1}] = M.op(#2)
+ complexZ[\luastringN{#1}] = CM.op(#2)
}%
}
diff --git a/macros/luatex/latex/luacomplex/luacomplex.tex b/macros/luatex/latex/luacomplex/luacomplex.tex
index 04bf4176a0..f7b38ac1a2 100644
--- a/macros/luatex/latex/luacomplex/luacomplex.tex
+++ b/macros/luatex/latex/luacomplex/luacomplex.tex
@@ -1,5 +1,5 @@
\documentclass{article}
-\usepackage{listings,color,booktabs,longtable,array,hyperref,multicol,framed}
+\usepackage{listings,color,booktabs,longtable,array,hyperref,multicol,framed,luacomplex}
\usepackage[ top=1in, bottom = 1in, left=1in, right=1in]{geometry}
\hypersetup{colorlinks,urlcolor=blue}
\lstset{frame=none,
@@ -20,7 +20,7 @@
\usepackage[backend=bibtex]{biblatex}
\begin{document}
\title{The luacomplex Package in LaTeX}
-\author{Chetan Shirore and Ajit Kumar}
+\author{Chetan Shirore\thanks{Email id: mathsbeauty@gmail.com} \space and Ajit Kumar}
\maketitle
\section{Introduction}\label{section:introduction}
The \verb|luacomplex| package is developed to define complex numbers and perform basic arithmetic on complex numbers in LaTeX. It also loads the \texttt{luamaths} package. It provides an easy way to define complex numbers and perform operations on complex numbers. The package has no particular environment for performing operations on complex numbers. The package commands can be used in any environment (including the mathematics environment). It is written in Lua, and the tex file is to be compiled with the LuaLatex engine. The time required for operations on complex numbers is not an issue while compiling with LuaLaTeX. There is no need to install Lua on the users' system as tex distributions (TeXLive or MikTeX) come bundled with LuaLaTeX. It may also save users' efforts to copy complex numbers from other software (which may not be in latex-compatible format) and to use them in a tex file.
@@ -149,11 +149,12 @@ The package has a command \verb|\imgUnit| which provides typesetting for the ima
\section{Examples and Usage}
-The latex document (Listing: \ref{code:illluacomplex}) makes use of various commands in \verb|luacomplex| package.
+The latex document (Listing: \ref{code:illluacomplex}) makes use of various commands in \verb|luacomplex| package.
\begin{lstlisting}[label={code:illluacomplex}, caption={LaTeX document with luacomplex package}]
\documentclass{article}
\usepackage{luacomplex}
\begin{document}
+\renewcommand{\imgUnit}{\mathrm{i}}
\cpxNew{a}{3,4}
\cpxNew{b}{1,3}
\(a=\cpxPrint{a}\) \\
@@ -180,21 +181,41 @@ The latex document (Listing: \ref{code:illluacomplex}) makes use of various com
\(p = prinArg(a) =\mathRound{\cpxPrint{p}}{4}\)
\end{document}
\end{lstlisting}
-This latex document (listing: \ref{code:illluacomplex}) outputs the following on compiling with the LuaLaTeX engine.
+
+This latex document (listing: \ref{code:illluacomplex}) outputs the following on compiling with the LuaLaTeX engine. \\
+\cpxNew{a}{3,4}
+\cpxNew{b}{1,3}
+
+ \begin{minipage}{0.4\textwidth}
\begin{framed}
-\noindent\(a = 3 + 4i\)\\
-\(b = 1 + 3i\)\\
-\(c = a + b = 4 + 7i\)\\
-\(d=a-b=2+i\)\\
-\(e = a.b = -9 + 13i\)\\
-\(f = ab = 1.5 - 0.5i\)\\
-\(g = a1 = 0.12 - 0.16i\)\\
-\(h = Re(a) = 3\)\\
-\(j = Im(a) = 4\)\\
-\(m = |a| = 25\)\\
-\(n =a+bc-d= -16 + 22i\)\\
-\(p = prinArg(a) = 0.9273\)
+\noindent\(a=\cpxPrint{a}\) \\
+\(b=\cpxPrint{b}\) \\
+\cpxAdd{c}{a}{b}
+\(c=a+b=\cpxPrint{c}\) \\
+\cpxSub{d}{a}{b}
+\(d=a-b=\cpxPrint{d}\) \\
+\cpxMul{e}{a}{b}
+\(e=a.b=\cpxPrint{e}\) \\
+\cpxDiv{f}{a}{b}
+\(f=\frac{a}{b}=\cpxPrint{f}\)
+\end{framed}
+\end{minipage}
+\begin{minipage}{0.4\textwidth}
+\begin{framed}
+\cpxInv{g}{a}
+\(g=\frac{1}{a}=\cpxPrint{g}\) \\
+\cpxRe{h}{a}
+\(h=Re(a)=\cpxPrint{h}\) \\
+\cpxIm{j}{a}
+\(j=Im(a)=\cpxPrint{j}\) \\
+\cpxMod{m}{a}
+\(m=|a|=\cpxPrint{m}\) \\
+\cpxOp{n}{a+b*c-d}
+\(n=a+bc-d=\cpxPrint{n}\) \\
+\cpxPrinArg{p}{a}
+\(p = prinArg(a) =\mathRound{\cpxPrint{p}}{4}\)
\end{framed}
+\end{minipage} \\
The package can be modified or extended by adding custom Lua programs.