summaryrefslogtreecommitdiff
path: root/macros/latex-dev/required/latex-lab/latex-lab-amsmath.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex-dev/required/latex-lab/latex-lab-amsmath.dtx')
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-amsmath.dtx131
1 files changed, 131 insertions, 0 deletions
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-amsmath.dtx b/macros/latex-dev/required/latex-lab/latex-lab-amsmath.dtx
new file mode 100644
index 0000000000..e1f95730fa
--- /dev/null
+++ b/macros/latex-dev/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 adaptations 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
+%