Debian Codegraph @

texmf-dist/source/latex/latex-lab/latex-lab-mathpkg.dtx

raw
1 % \iffalse meta-comment
2 %
3 %% File: latex-lab-mathpkg.dtx
4 %
5 % Copyright (C) 2022-2025 The LaTeX Project
6 %
7 % It may be distributed and/or modified under the conditions of the
8 % LaTeX Project Public License (LPPL), either version 1.3c of this
9 % license or (at your option) any later version. The latest version
10 % of this license is in the file
11 %
12 % https://www.latex-project.org/lppl.txt
13 %
14 %
15 % The development version of the bundle can be found below
16 %
17 % https://github.com/latex3/latex2e/required/latex-lab
18 %
19 % for those people who are interested or want to report an issue.
20 %
21 %<*driver>
22 \DocumentMetadata{tagging=on,pdfstandard=ua-2}
23 \documentclass[kernel]{l3doc}
24 \usepackage{latex-lab-testphase-l3doc}
25 \EnableCrossrefs
26 \CodelineIndex
27 \begin{document}
28 \DocInput{latex-lab-mathpkg.dtx}
29 \end{document}
30 %</driver>
31 %
32 % \fi
33 %
34 %
35 % \title{The \texttt{latex-lab-mathpkg} code\thanks{}}
36 % \author{\LaTeX{} Project}
37 %
38 % \maketitle
39 %
40 % \newcommand\fmi[1]{\begin{quote} TODO: \itshape #1\end{quote}}
41 % \newcommand\NEW[1]{\marginpar{\mbox{}\hfill\fbox{New: #1}}}
42 % \providecommand\class[1]{\texttt{#1.cls}}
43 % \providecommand\pkg[1]{\texttt{#1}}
44 % \providecommand\hook[1]{\texttt{#1}}
45 %
46 % \begin{abstract}
47 % \end{abstract}
48 %
49 % \tableofcontents
50 %
51 % \section{Introduction}
52 %
53 % This file implements adaptions to various math packages needed for
54 % the tagging project.
55 %
56 % \MaybeStop{\setlength\IndexMin{200pt} \PrintIndex }
57 %
58 % \section{The Implementation}
59 %
60 % \begin{macrocode}
61 %<@@=math>
62 % \end{macrocode}
63 %
64 % \begin{macrocode}
65 %<*kernel>
66 % \end{macrocode}
67 %
68 % \subsection{File declaration}
69 % \begin{macrocode}
70 \ProvidesFile{latex-lab-mathpkg.ltx}
71 [2025-06-20 v0.1c mathpkg adaptions]
72 % \end{macrocode}
73 %
74 % \subsection{breqn}
75 % \begin{macrocode}
76 \AddToHook{package/breqn/after}{
77 \RegisterMathEnvironment{dmath}
78 \RegisterMathEnvironment{dgroup*}
79 \AddToHook{env/dmath/begin}{\tagpdfparaOff}
80 \AddToHook{env/dgroup*/begin}{\tagpdfparaOff}
81 }
82 % \end{macrocode}
83 %
84 % \subsection{cases}
85 % Force loading of \pkg{amsmath} before \pkg{cases}.
86 % \begin{macrocode}
87 \AddToHook{package/cases/before}{\RequirePackage{amsmath}}
88 \AddToHook{package/cases/after}{
89 \RegisterMathEnvironment{subnumcases}
90 }
91 % \end{macrocode}
92 %
93 % \subsection{bm}
94 % Similar to the amsbsy code in latex-lab-amsmath for \cs{pmb} we need to mark up
95 % copies as artifact:
96 %
97 % \begin{macrocode}
98 \ExplSyntaxOn
99 \AddToHook{package/bm/after}
100 {
101 \def\bm@pmb@@@@#1#2#3{{%
102 \hbox_set:Nn\l_@@_tmpa_box{$\m@th#1#3$}%
103 \dimen@#2\wd\tw@
104 \rlap{\box_use:N\l_@@_tmpa_box}%
105 \tag_mc_end:\tag_mc_begin:n{artifact}
106 \tag_mc_reset_box:N\l_@@_tmpa_box
107 \kern\dimen@
108 \raise1.5\dimen@\rlap{\box_use:N\l_@@_tmpa_box}%
109 \kern\dimen@
110 \box_use_drop:N\l_@@_tmpa_box
111 \tag_mc_end:\tag_mc_begin:n{}%
112 }}
113 }
114 \ExplSyntaxOff
115 % \end{macrocode}
116 % \subsection{amsmath timing}
117 % These packages error or lose their function if loaded before \pkg{amsmath}.
118 % \begin{macrocode}
119 \AddToHook{package/accents/before}{\RequirePackage{amsmath}}
120 \AddToHook{package/cleveref/before}{\RequirePackage{amsmath}}
121 \AddToHook{package/esint/before}{\RequirePackage{amsmath}}
122 \AddToHook{package/grmath/before}{\RequirePackage{amsmath}}
123 \AddToHook{package/mathabx/before}{\RequirePackage{amsmath}}
124 \AddToHook{package/wasysym/before}{\RequirePackage{amsmath}}
125 % \end{macrocode}
126 % \begin{macrocode}
127 %</kernel>
128 % \end{macrocode}
129 % \subsection{Wrapper files for testphase key}
130 % \Finale
131 %