[latex3-commits] [git/LaTeX3-latex3-latex2e] everymath: add math adaption files (9ec7dc60)
Ulrike Fischer
fischer at troubleshooting-tex.de
Sat Jan 7 01:15:38 CET 2023
Repository : https://github.com/latex3/latex2e
On branch : everymath
Link : https://github.com/latex3/latex2e/commit/9ec7dc600e2f63dec2e471fa66e61f694d6565f5
>---------------------------------------------------------------
commit 9ec7dc600e2f63dec2e471fa66e61f694d6565f5
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Sat Jan 7 01:15:38 2023 +0100
add math adaption files
>---------------------------------------------------------------
9ec7dc600e2f63dec2e471fa66e61f694d6565f5
required/latex-lab/latex-lab-amsmath.dtx | 131 +++++++++++++++++
required/latex-lab/latex-lab-mathpkg.dtx | 102 +++++++++++++
required/latex-lab/latex-lab-mathtools.dtx | 223 +++++++++++++++++++++++++++++
required/latex-lab/latex-lab.ins | 9 +-
4 files changed, 464 insertions(+), 1 deletion(-)
diff --git a/required/latex-lab/latex-lab-amsmath.dtx b/required/latex-lab/latex-lab-amsmath.dtx
new file mode 100644
index 00000000..f4b1b522
--- /dev/null
+++ b/required/latex-lab/latex-lab-amsmath.dtx
@@ -0,0 +1,131 @@
+% \iffalse meta-comment
+%
+%% File: latex-lab-amsmath.dtx
+%
+% Copyright (C) 2022,2023 The LaTeX Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% https://www.latex-project.org/lppl.txt
+%
+%
+% The development version of the bundle can be found below
+%
+% https://github.com/latex3/latex2e/required/latex-lab
+%
+% for those people who are interested or want to report an issue.
+%
+%<*driver>
+\documentclass{l3doc}
+\EnableCrossrefs
+\CodelineIndex
+\begin{document}
+ \DocInput{latex-lab-amsmath.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+%
+% \title{The \texttt{latex-lab-amsmath} code\thanks{}}
+% \author{\LaTeX{} Project}
+%
+% \maketitle
+%
+% \newcommand\fmi[1]{\begin{quote} TODO: \itshape #1\end{quote}}
+% \newcommand\NEW[1]{\marginpar{\mbox{}\hfill\fbox{New: #1}}}
+% \providecommand\class[1]{\texttt{#1.cls}}
+% \providecommand\pkg[1]{\texttt{#1}}
+% \providecommand\hook[1]{\texttt{#1}}
+%
+% \begin{abstract}
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \section{Introduction}
+%
+% This file implements adaptions to the \pkg{amsmath} package needed for
+% the tagging project.
+%
+% \MaybeStop{\setlength\IndexMin{200pt} \PrintIndex }
+%
+% \section{The Implementation}
+%
+% \begin{macrocode}
+%<@@=math>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*kernel>
+% \end{macrocode}
+%
+% \subsection{File declaration}
+% \begin{macrocode}
+\ProvidesFile{latex-lab-amsmath.ltx}
+ [2023-01-05 v0.1a amsmath adaptions]
+% \end{macrocode}
+% \subsection{Tagpdf support}
+% To make the code independent from tagging being loaded and active
+% we load the \pkg{tagpdf-base} package:
+%
+% \begin{macrocode}
+\RequirePackage{tagpdf-base}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\ExplSyntaxOn
+% \end{macrocode}
+%
+% \subsection{\cs{intertext}}
+% The \cs{intertext} command errors with active tagging as it is processed twice
+% which leads to duplicated structures.
+% \begin{macrocode}
+\AddToHook{package/amsmath/after}
+ {
+ \def\intertext@{%
+ \def\intertext##1{%
+ \ifvmode\else\\\@empty\fi
+ \noalign{%
+ \penalty\postdisplaypenalty\vskip\belowdisplayskip
+ \vbox{
+% \end{macrocode}
+% Stop tagging when measuring:
+% \begin{macrocode}
+ \ifmeasuring@\tag_stop:\fi
+ \normalbaselines
+ \ifdim\linewidth=\columnwidth
+ \else \parshape\@ne \@totalleftmargin \linewidth
+ \fi
+% \end{macrocode}
+% End the previous mc:
+% \begin{macrocode}
+ \tag_mc_end_push:
+% \end{macrocode}
+% We are already in a par so we change now to Span:
+% \begin{macrocode}
+ \tagpdfsetup{paratag=Span}%
+ \noindent\ignorespaces##1\par
+% \end{macrocode}
+% Restart the MC
+% \begin{macrocode}
+ \tag_mc_begin_pop:n{}}%
+ \penalty\predisplaypenalty\vskip\abovedisplayskip%
+ }%
+ }}
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\ExplSyntaxOff
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</kernel>
+% \end{macrocode}
+%
+% \Finale
+%
diff --git a/required/latex-lab/latex-lab-mathpkg.dtx b/required/latex-lab/latex-lab-mathpkg.dtx
new file mode 100644
index 00000000..36c6ed87
--- /dev/null
+++ b/required/latex-lab/latex-lab-mathpkg.dtx
@@ -0,0 +1,102 @@
+% \iffalse meta-comment
+%
+%% File: latex-lab-mathpkg.dtx
+%
+% Copyright (C) 2022,2023 The LaTeX Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% https://www.latex-project.org/lppl.txt
+%
+%
+% The development version of the bundle can be found below
+%
+% https://github.com/latex3/latex2e/required/latex-lab
+%
+% for those people who are interested or want to report an issue.
+%
+%<*driver>
+\documentclass{l3doc}
+\EnableCrossrefs
+\CodelineIndex
+\begin{document}
+ \DocInput{latex-lab-mathpkg.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+%
+% \title{The \texttt{latex-lab-mathpkg} code\thanks{}}
+% \author{\LaTeX{} Project}
+%
+% \maketitle
+%
+% \newcommand\fmi[1]{\begin{quote} TODO: \itshape #1\end{quote}}
+% \newcommand\NEW[1]{\marginpar{\mbox{}\hfill\fbox{New: #1}}}
+% \providecommand\class[1]{\texttt{#1.cls}}
+% \providecommand\pkg[1]{\texttt{#1}}
+% \providecommand\hook[1]{\texttt{#1}}
+%
+% \begin{abstract}
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \section{Introduction}
+%
+% This file implements adaptions to various math packages needed for
+% the tagging project.
+%
+% \MaybeStop{\setlength\IndexMin{200pt} \PrintIndex }
+%
+% \section{The Implementation}
+%
+% \begin{macrocode}
+%<@@=math>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*kernel>
+% \end{macrocode}
+%
+% \subsection{File declaration}
+% \begin{macrocode}
+\ProvidesFile{latex-lab-mathpkg.ltx}
+ [2023-01-05 v0.1a mathpkg adaptions]
+% \end{macrocode}
+% \subsection{Tagpdf support}
+% To make the code independent from tagging being loaded and active
+% we load the \pkg{tagpdf-base} package:
+%
+% \begin{macrocode}
+\RequirePackage{tagpdf-base}
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</kernel>
+% \end{macrocode}
+% \subsection{Wrapper files for testphase key}
+% \begin{macrocode}
+%<*latex-lab>
+\ProvidesFile{math-latex-lab-testphase.ltx}
+ [2023-01-07 v0.8 code related to the math tagging]
+\RequirePackage{latex-lab-testphase-math}
+%</latex-lab>
+% \end{macrocode}
+% \begin{macrocode}
+%<*package>
+\ProvidesPackage{latex-lab-testphase-math}
+ [2023-01-07 v0.8 code related to the math tagging]
+\input{latex-lab-mathcapture.ltx}
+\input{latex-lab-amsmath.ltx}
+\input{latex-lab-mathtools.ltx}
+\input{latex-lab-mathpkg.ltx}
+%</package>
+% \end{macrocode}
+
+% \Finale
+%
diff --git a/required/latex-lab/latex-lab-mathtools.dtx b/required/latex-lab/latex-lab-mathtools.dtx
new file mode 100644
index 00000000..c3f43243
--- /dev/null
+++ b/required/latex-lab/latex-lab-mathtools.dtx
@@ -0,0 +1,223 @@
+% \iffalse meta-comment
+%
+%% File: latex-lab-mathtools.dtx
+%
+% Copyright (C) 2022,2023 The LaTeX Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% https://www.latex-project.org/lppl.txt
+%
+%
+% The development version of the bundle can be found below
+%
+% https://github.com/latex3/latex2e/required/latex-lab
+%
+% for those people who are interested or want to report an issue.
+%
+%<*driver>
+\documentclass{l3doc}
+\EnableCrossrefs
+\CodelineIndex
+\begin{document}
+ \DocInput{latex-lab-amsmath.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+%
+% \title{The \texttt{latex-lab-mathtools} code\thanks{}}
+% \author{\LaTeX{} Project}
+%
+% \maketitle
+%
+% \newcommand\fmi[1]{\begin{quote} TODO: \itshape #1\end{quote}}
+% \newcommand\NEW[1]{\marginpar{\mbox{}\hfill\fbox{New: #1}}}
+% \providecommand\class[1]{\texttt{#1.cls}}
+% \providecommand\pkg[1]{\texttt{#1}}
+% \providecommand\hook[1]{\texttt{#1}}
+%
+% \begin{abstract}
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \section{Introduction}
+%
+% This file implements adaptions to the \pkg{mathtools} package needed for
+% the tagging project.
+%
+% \MaybeStop{\setlength\IndexMin{200pt} \PrintIndex }
+%
+% \section{The Implementation}
+%
+% \begin{macrocode}
+%<@@=math>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*kernel>
+% \end{macrocode}
+%
+% \subsection{File declaration}
+% \begin{macrocode}
+\ProvidesFile{latex-lab-mathtools.ltx}
+ [2023-01-05 v0.1a mathtools adaptions]
+% \end{macrocode}
+% \subsection{Tagpdf support}
+% To make the code independent from tagging being loaded and active
+% we load the \pkg{tagpdf-base} package:
+%
+% \begin{macrocode}
+\RequirePackage{tagpdf-base}
+% \end{macrocode}
+%
+% \subsection{\cs{shortintertext}}
+% Similar to the \cs{intertext} command from amsmath,
+% \cs{shortintertext} errors with active tagging as it is processed twice
+% which leads to duplicated structures.
+% The fix is similar but is complicated as \pkg{mathtools} defines two version (and
+% an additional \cs{intertext} version) and package options to switch between the variants.
+%
+% At first we redefine all the internal commands
+% \begin{macrocode}
+\ExplSyntaxOn
+\tl_new:N\l_@@_mathtools_init_tl
+\AddToHook{package/mathtools/after}
+ {%
+ \cs_if_eq:NNTF\intertext@ \MT_intertext:
+ {
+ \tl_set:Nn \l_@@_mathtools_init_tl {\MT_orig_intertext_false:}
+ }
+ {
+ \tl_set:Nn \l_@@_mathtools_init_tl {\MT_orig_intertext_true:}
+ }
+ \cs_if_eq:NNTF\shortintertext@ \MT_shortintertext:n
+ {
+ \tl_put_right:Nn \l_@@_mathtools_init_tl
+ {\MT_orig_shortintertext_false:}
+ }
+ {
+ \tl_put_right:Nn \l_@@_mathtools_init_tl
+ {\MT_orig_shortintertext_true:}
+ }
+ \def\MT_intertext: {%
+ \def\intertext##1{%
+ \ifvmode\else\\\@empty\fi
+ \noalign{%
+ \penalty\postdisplaypenalty\vskip\belowdisplayskip
+ \vskip-\lineskiplimit % CCS
+ \vskip\normallineskiplimit % CCS
+ \vskip\l_MT_above_intertext_sep
+ \vbox{%
+% \end{macrocode}
+% Stop tagging when measuring:
+% \begin{macrocode}
+ \ifmeasuring@\tag_stop:\fi
+ \normalbaselines
+ \ifdim
+ \ifdim\@totalleftmargin=\z@
+ \linewidth
+ \else
+ -\maxdimen
+ \fi
+ =\columnwidth
+ \else \parshape\@ne \@totalleftmargin \linewidth
+ \fi
+% \end{macrocode}
+% End the previous mc:
+% \begin{macrocode}
+ \tag_mc_end_push:
+% \end{macrocode}
+% We are already in a par so we change now to Span:
+% \begin{macrocode}
+ \tagpdfsetup{paratag=Span}
+ \noindent\ignorespaces##1\par
+% \end{macrocode}
+% Restart the MC
+% \begin{macrocode}
+ \tag_mc_begin_pop:n{}}%
+ \penalty\predisplaypenalty\vskip\abovedisplayskip%
+ \vskip-\lineskiplimit % CCS
+ \vskip\normallineskiplimit % CCS
+ \vskip\l_MT_below_intertext_sep
+ }%
+ }%
+ \MH_let:NwN \shortintertext \shortintertext@
+ }
+% \end{macrocode}
+% \begin{macrocode}
+ \def\MT_orig_shortintertext:n #1{%
+ \ifvmode\else\\\@empty\fi
+ \noalign{%
+ \penalty\postdisplaypenalty\vskip\abovedisplayshortskip
+ \vbox{%
+ \ifmeasuring@\tag_stop:\fi
+ \normalbaselines
+ \MH_if_dim:w
+ \MH_if_dim:w \@totalleftmargin=\z@
+ \linewidth
+ \MH_else:
+ -\maxdimen
+ \MH_fi:
+ =\columnwidth
+ \MH_else:
+ \parshape\@ne \@totalleftmargin \linewidth
+ \MH_fi:
+ \tag_mc_end_push:
+ \tagpdfsetup{paratag=Span}
+ \noindent\ignorespaces#1\par
+ \tag_mc_begin_pop:n{}}
+ \penalty\predisplaypenalty\vskip\abovedisplayshortskip%
+ }%
+ }
+
+ \def\MT_shortintertext:n #1{%
+ \ifvmode\else\\\@empty\fi
+ \noalign{%
+ \penalty\postdisplaypenalty\vskip\abovedisplayshortskip
+ \vskip-\lineskiplimit
+ \vskip\normallineskiplimit
+ \vskip\l_MT_above_shortintertext_sep
+ \vbox{%
+ \ifmeasuring@\tag_stop:\fi
+ \normalbaselines
+ \MH_if_dim:w
+ \MH_if_dim:w \@totalleftmargin=\z@
+ \linewidth
+ \MH_else:
+ -\maxdimen
+ \MH_fi:
+ =\columnwidth
+ \MH_else:
+ \parshape\@ne \@totalleftmargin \linewidth
+ \MH_fi:
+ \tag_mc_end_push:
+ \tagpdfsetup{paratag=Span}
+ \noindent\ignorespaces#1\par
+ \tag_mc_begin_pop:n{}}%
+ \penalty\predisplaypenalty\vskip\abovedisplayshortskip%
+ \vskip-\lineskiplimit
+ \vskip\normallineskiplimit
+ \vskip\l_MT_below_shortintertext_sep
+ }%
+ }
+
+% \end{macrocode}
+% end hook
+% \begin{macrocode}
+ \l_@@_mathtools_init_tl
+}
+\ExplSyntaxOff
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</kernel>
+% \end{macrocode}
+%
+% \Finale
+%
diff --git a/required/latex-lab/latex-lab.ins b/required/latex-lab/latex-lab.ins
index 994a46d3..418694bf 100644
--- a/required/latex-lab/latex-lab.ins
+++ b/required/latex-lab/latex-lab.ins
@@ -79,5 +79,12 @@ where one can also log issues in case there are any.
\generate{\file{latex-lab-footnotes.ltx}{\from{latex-lab-footnotes.dtx}{kernel}}}
\generate{\file{latex-lab-mathcapture.ltx}{\from{latex-lab-mathcapture.dtx}{kernel}}}
-
+\generate{\file{latex-lab-amsmath.ltx}{\from{latex-lab-amsmath.dtx}{kernel}}}
+\generate{\file{latex-lab-mathtools.ltx}{\from{latex-lab-mathtools.dtx}{kernel}}}
+\generate{\file{latex-lab-mathpkg.ltx}{\from{latex-lab-mathpkg.dtx}{kernel}}}
+
+\generate{\file{math-latex-lab-testphase.ltx}{%
+ \from{latex-lab-mathpkg.dtx}{latex-lab}}}
+\generate{\file{latex-lab-testphase-math.sty}{%
+ \from{latex-lab-mathpkg.dtx}{package}}}
\endbatchfile
More information about the latex3-commits
mailing list.