Debian Codegraph @

texmf-dist/source/latex/base/ltmath.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 1993-2025
4 % The LaTeX Project and any individual authors listed elsewhere
5 % in this file.
6 %
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
9 %
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % https://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2008 or later.
17 %
18 % This file has the LPPL maintenance status "maintained".
19 %
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
22 % information.
23 %
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
27 %
28 % \fi
29 % \iffalse
30 %%% From File: ltmath.dtx
31 %
32 %<leqno>\ProvidesFile{leqno.clo}
33 %<fleqn>\ProvidesFile{fleqn.clo}
34 %<leqno,fleqn> [2016/12/29 v1.2b Standard LaTeX option
35 %<leqno> (left equation numbers)]
36 %<fleqn> (flush left equations)]
37 %
38 %<*driver>
39 % \fi
40 \ProvidesFile{ltmath.dtx}
41 [2025/06/05 v1.2p LaTeX Kernel (Math Setup)]
42 % \iffalse
43 %</driver>
44 %
45 %<*driver>
46 \documentclass{ltxdoc}
47 \GetFileInfo{ltmath.dtx}
48 \title{\filename}
49 \date{\filedate}
50 \author{%
51 Johannes Braams\and
52 David Carlisle\and
53 Alan Jeffrey\and
54 Leslie Lamport\and
55 Frank Mittelbach\and
56 Chris Rowley\and
57 Rainer Sch\"opf}
58 \begin{document}
59 \MaintainedByLaTeXTeam{latex}
60 \maketitle
61 \DocInput{\filename}
62 \end{document}
63 %</driver>
64 % \fi
65 %
66 %
67 % \changes{v1.1b}{1996/07/26}{Removed \cs{global} before
68 % \cs{@ignoretrue} in various places.}
69 % \changes{v1.1c}{1998/08/17}{(RmS) Minor documentation fixes.}
70 % \changes{v1.1g}{2005/11/10}{(MH) Minor documentation fixes.}
71 %
72 % \section{Math setup}
73 %
74 % This file contains a lot of the original plain \TeX{} code, as well
75 % as the \LaTeX{} environments for math. It still needs sorting out.
76 %
77 % \MaybeStop{}
78 %
79 % \begin{macrocode}
80 %<*2ekernel>
81 \message{math definitions,}
82 % \end{macrocode}
83 %
84 %
85 %
86 % \subsection{Math commands based on plain \TeX}
87 %
88 % \subsubsection{The log-like functions}
89 %
90 % \changes{1.0m}{1994/10/29}{ASAJ: Added \cs{DeclareMathOperator}.}
91 % \changes{v1.0o}{1994/11/17}
92 % {\cs{@tempa} to \cs{reserved@a}}
93 % \changes{1.0q}{1994/11/30}{ASAJ: \cs{DeclareMathOperator} moved to
94 % AMS\LaTeX.}
95 % \changes{v1.0r}{1995/05/07}{Use \cs{hb@xt@}}
96 % \changes{v1.0r}{1995/05/21}{Update some plain macros}
97 % \changes{v1.0t}{1995/06/28}{minor doc edits}
98 % \changes{v1.2c}{2019/08/27}{Make various commands robust}
99 %
100 % \begin{macro}{\log}
101 % The standard operators:
102 % \begin{macrocode}
103 \DeclareRobustCommand\log{\mathop{\operator@font log}\nolimits}
104 \DeclareRobustCommand\lg{\mathop{\operator@font lg}\nolimits}
105 \DeclareRobustCommand\ln{\mathop{\operator@font ln}\nolimits}
106 \DeclareRobustCommand\lim{\mathop{\operator@font lim}}
107 \DeclareRobustCommand\limsup{\mathop{\operator@font lim\,sup}}
108 \DeclareRobustCommand\liminf{\mathop{\operator@font lim\,inf}}
109 \DeclareRobustCommand\sin{\mathop{\operator@font sin}\nolimits}
110 \DeclareRobustCommand\arcsin{\mathop{\operator@font arcsin}\nolimits}
111 \DeclareRobustCommand\sinh{\mathop{\operator@font sinh}\nolimits}
112 \DeclareRobustCommand\cos{\mathop{\operator@font cos}\nolimits}
113 \DeclareRobustCommand\arccos{\mathop{\operator@font arccos}\nolimits}
114 \DeclareRobustCommand\cosh{\mathop{\operator@font cosh}\nolimits}
115 \DeclareRobustCommand\tan{\mathop{\operator@font tan}\nolimits}
116 \DeclareRobustCommand\arctan{\mathop{\operator@font arctan}\nolimits}
117 \DeclareRobustCommand\tanh{\mathop{\operator@font tanh}\nolimits}
118 \DeclareRobustCommand\cot{\mathop{\operator@font cot}\nolimits}
119 \DeclareRobustCommand\coth{\mathop{\operator@font coth}\nolimits}
120 \DeclareRobustCommand\sec{\mathop{\operator@font sec}\nolimits}
121 \DeclareRobustCommand\csc{\mathop{\operator@font csc}\nolimits}
122 \DeclareRobustCommand\max{\mathop{\operator@font max}}
123 \DeclareRobustCommand\min{\mathop{\operator@font min}}
124 \DeclareRobustCommand\sup{\mathop{\operator@font sup}}
125 \DeclareRobustCommand\inf{\mathop{\operator@font inf}}
126 \DeclareRobustCommand\arg{\mathop{\operator@font arg}\nolimits}
127 \DeclareRobustCommand\ker{\mathop{\operator@font ker}\nolimits}
128 \DeclareRobustCommand\dim{\mathop{\operator@font dim}\nolimits}
129 \DeclareRobustCommand\hom{\mathop{\operator@font hom}\nolimits}
130 \DeclareRobustCommand\det{\mathop{\operator@font det}}
131 \DeclareRobustCommand\exp{\mathop{\operator@font exp}\nolimits}
132 \DeclareRobustCommand\Pr{\mathop{\operator@font Pr}}
133 \DeclareRobustCommand\gcd{\mathop{\operator@font gcd}}
134 \DeclareRobustCommand\deg{\mathop{\operator@font deg}\nolimits}
135 % \end{macrocode}
136 % \end{macro}
137 %
138 % \begin{macro}{\bmod}
139 % And some operators have to be done by hand:
140 % \begin{macrocode}
141 \DeclareRobustCommand\bmod{%
142 \nonscript\mskip-\medmuskip\mkern5mu%
143 \mathbin{\operator@font mod}\penalty900\mkern5mu%
144 \nonscript\mskip-\medmuskip}
145 % \end{macrocode}
146 % \end{macro}
147 %
148 % \begin{macro}{\pmod}
149 % \begin{macrocode}
150 \DeclareRobustCommand\pmod[1]{%
151 \allowbreak\mkern18mu({\operator@font mod}\,\,#1)}
152 % \end{macrocode}
153 % \end{macro}
154 %
155 % \subsubsection{Biggggg}
156 %
157 % \begin{macro}{\big}
158 % Variants on |\big| and friends for use with delimiters:
159 % \begin{macrocode}
160 \DeclareRobustCommand\bigl{\mathopen\big}
161 \DeclareRobustCommand\bigm{\mathrel\big}
162 \DeclareRobustCommand\bigr{\mathclose\big}
163 \DeclareRobustCommand\Bigl{\mathopen\Big}
164 \DeclareRobustCommand\Bigm{\mathrel\Big}
165 \DeclareRobustCommand\Bigr{\mathclose\Big}
166 \DeclareRobustCommand\biggl{\mathopen\bigg}
167 \DeclareRobustCommand\biggm{\mathrel\bigg}
168 \DeclareRobustCommand\biggr{\mathclose\bigg}
169 \DeclareRobustCommand\Biggl{\mathopen\Bigg}
170 \DeclareRobustCommand\Biggm{\mathrel\Bigg}
171 \DeclareRobustCommand\Biggr{\mathclose\Bigg}
172 % \end{macrocode}
173 % \end{macro}
174 %
175 % \subsubsection{The UNSORTED Rest}
176 %
177 % The other math commands are lifted from plain \TeX.
178 %
179 % \begin{macro}{\jot}
180 % \begin{macrocode}
181 \newdimen\jot
182 \jot=3pt
183 % \end{macrocode}
184 % \end{macro}
185 %
186 % \begin{macro}{\interdisplaylinepenalty}
187 % \begin{macrocode}
188 \newcount\interdisplaylinepenalty
189 \interdisplaylinepenalty=100
190 % \end{macrocode}
191 % \end{macro}
192 %
193 % \begin{macro}{\choose}
194 % \begin{macrocode}
195 \def\choose{\atopwithdelims()}
196 % \end{macrocode}
197 % \end{macro}
198 %
199 % \begin{macro}{\brack}
200 % \begin{macrocode}
201 \def\brack{\atopwithdelims[]}
202 % \end{macrocode}
203 % \end{macro}
204 %
205 % \begin{macro}{\brace}
206 % \begin{macrocode}
207 \def\brace{\atopwithdelims\{\}}
208 % \end{macrocode}
209 % \end{macro}
210 %
211 % \begin{macro}{\mathpalette}
212 % \begin{macrocode}
213 \def\mathpalette#1#2{%
214 \mathchoice
215 {#1\displaystyle{#2}}%
216 {#1\textstyle{#2}}%
217 {#1\scriptstyle{#2}}%
218 {#1\scriptscriptstyle{#2}}}
219 % \end{macrocode}
220 % \end{macro}
221 %
222 % \begin{macro}{\root}
223 % \changes{v1.1d}{1997/01/08}
224 % {(DPC) Remove spurious space tokens from
225 % plain \TeX\ definition /2359}
226 % \begin{macro}{\rootbox}
227 % \begin{macro}{\r@@t}
228 % \changes{v1.0r}{1995/05/21}{Use \cs{sqrtsign} instead of
229 % \cs{sqrt}}
230 % \begin{macrocode}
231 \newbox\rootbox
232 % \end{macrocode}
233 %
234 % \begin{macrocode}
235 \def\root#1\of{%
236 \setbox\rootbox\hbox{$\m@th\scriptscriptstyle{#1}$}%
237 \mathpalette\r@@t}
238 % \end{macrocode}
239 %
240 % \begin{macrocode}
241 \def\r@@t#1#2{%
242 \setbox\z@\hbox{$\m@th#1\sqrtsign{#2}$}%
243 \dimen@\ht\z@ \advance\dimen@-\dp\z@
244 \mkern5mu\raise.6\dimen@\copy\rootbox
245 \mkern-10mu\box\z@}
246 % \end{macrocode}
247 % \end{macro}
248 % \end{macro}
249 % \end{macro}
250 %
251 % \begin{macro}{\phantom}
252 % \changes{v1.0p}{1994/11/18}
253 % {(DPC) use \cs{expandafter} instead of \cs{next}}
254 % \changes{v1.0p}{1994/11/18}
255 % {(DPC) colour support}
256
257 % \begin{macro}{\hphantom}
258 % \begin{macro}{\vphantom}
259 % \begin{macrocode}
260 \newif\ifv@
261 \newif\ifh@
262 % \end{macrocode}
263 %
264 %
265 %
266 %
267 % \begin{macrocode}
268 %</2ekernel>
269 %<*2ekernel|latexrelease>
270 %<latexrelease>\IncludeInRelease{2019/10/01}%
271 %<latexrelease> {\vphantom}{Make commands robust}%
272 % \end{macrocode}
273 %
274 % \begin{macrocode}
275 \DeclareRobustCommand\vphantom{\v@true\h@false\ph@nt}
276 % \end{macrocode}
277 %
278 % \begin{macrocode}
279 \DeclareRobustCommand\hphantom{\v@false\h@true\ph@nt}
280 % \end{macrocode}
281 %
282 % \begin{macrocode}
283 \DeclareRobustCommand\phantom{\v@true\h@true\ph@nt}
284 % \end{macrocode}
285 %
286 % \begin{macro}{\mathstrut}
287 % \begin{macrocode}
288 \DeclareRobustCommand\mathstrut{\vphantom(}
289 % \end{macrocode}
290 % \end{macro}
291 %
292 % \begin{macrocode}
293 %</2ekernel|latexrelease>
294 %<latexrelease>\EndIncludeInRelease
295 %<latexrelease>\IncludeInRelease{0000/00/00}%
296 %<latexrelease> {\vphantom}{Make commands robust}%
297 %<latexrelease>
298 %<latexrelease>\kernel@make@fragile\vphantom
299 %<latexrelease>\kernel@make@fragile\hphantom
300 %<latexrelease>\kernel@make@fragile\phantom
301 %<latexrelease>\kernel@make@fragile\mathstrut
302 %<latexrelease>
303 %<latexrelease>\EndIncludeInRelease
304 %<*2ekernel>
305 % \end{macrocode}
306 %
307 % \begin{macrocode}
308 \def\ph@nt{%
309 \ifmmode
310 \expandafter\mathpalette\expandafter\mathph@nt
311 \else
312 \expandafter\makeph@nt
313 \fi}
314 % \end{macrocode}
315 %
316 % \begin{macrocode}
317 \def\makeph@nt#1{%
318 \setbox\z@\hbox{\color@begingroup#1\color@endgroup}\finph@nt}
319 % \end{macrocode}
320 %
321 % \begin{macrocode}
322 \def\mathph@nt#1#2{%
323 \setbox\z@\hbox{$\m@th#1{#2}$}\finph@nt}
324 % \end{macrocode}
325 %
326 % \begin{macrocode}
327 %</2ekernel>
328 %<*2ekernel|latexrelease>
329 %<latexrelease>\IncludeInRelease{2018/12/01}%
330 %<latexrelease> {\finph@nt}{Start LR-mode}%
331 \def\finph@nt{%
332 \setbox\tw@\null
333 \ifv@ \ht\tw@\ht\z@ \dp\tw@\dp\z@\fi
334 \ifh@ \wd\tw@\wd\z@\fi
335 % \end{macrocode}
336 % \changes{v1.2b}{2018/09/24}{Start LR-mode if necessary (gh/49)}
337 % \begin{macrocode}
338 \leavevmode@ifvmode\box\tw@}
339 %</2ekernel|latexrelease>
340 %<latexrelease>\EndIncludeInRelease
341 %<latexrelease>\IncludeInRelease{0000/00/00}%
342 %<latexrelease> {\finph@nt}{Start LR-mode}%
343 %<latexrelease>\def\finph@nt{%
344 %<latexrelease> \setbox\tw@\null
345 %<latexrelease> \ifv@ \ht\tw@\ht\z@ \dp\tw@\dp\z@\fi
346 %<latexrelease> \ifh@ \wd\tw@\wd\z@\fi \box\tw@}
347 %<latexrelease>\EndIncludeInRelease
348 %<*2ekernel>
349 % \end{macrocode}
350 % \end{macro}
351 % \end{macro}
352 % \end{macro}
353 %
354 %
355 % \begin{macro}{\smash}
356 % \changes{v1.0p}{1994/11/18}
357 % {(DPC) use \cs{expandafter} instead of \cs{next}}
358 % \changes{v1.0p}{1994/11/18}
359 % {(DPC) colour support}
360 % \begin{macrocode}
361 \DeclareRobustCommand\smash{%
362 \relax % \relax, in case this comes first in \halign
363 \ifmmode
364 \expandafter\mathpalette\expandafter\mathsm@sh
365 \else
366 \expandafter\makesm@sh
367 \fi}
368 % \end{macrocode}
369 %
370 % \begin{macrocode}
371 \def\makesm@sh#1{%
372 \setbox\z@\hbox{\color@begingroup#1\color@endgroup}\finsm@sh}
373 % \end{macrocode}
374 %
375 % \begin{macrocode}
376 %</2ekernel>
377 %<*2ekernel|latexrelease>
378 %<latexrelease>\IncludeInRelease{2022/11/01}%
379 %<latexrelease> {\mathsm@sh}{Guard against reboxing}%
380 \def\mathsm@sh#1#2{%
381 \setbox\z@\hbox{$\m@th#1{#2}$}%
382 % \end{macrocode}
383 % The empty brace groups in front of the smashed box (which is
384 % placed by \cs{finsm@sh}) ensures that a \cs{smash} in math is not
385 % just producing a single box with its dimensions altered, but a
386 % box plus this second ord atom. The reason is that \TeX{} sometimes reboxes a
387 % box if its the only thing in a place like the denominator of a
388 % fraction. This would then undo the smashing and the additional
389 % ord atom prevents that. Two ord atoms in a row do not alter the
390 % horizontal spacing in a formula so this is otherwise transparent.
391 % \changes{v1.2m}{2022/09/03}{Guard against reboxing in fractions (gh/517)}
392 % \begin{macrocode}
393 {}\finsm@sh}
394 % \end{macrocode}
395 % \begin{macrocode}
396 %</2ekernel|latexrelease>
397 %<latexrelease>\EndIncludeInRelease
398 %<latexrelease>\IncludeInRelease{0000/00/00}%
399 %<latexrelease> {\mathsm@sh}{Guard against reboxing}%
400 %<latexrelease>\def\mathsm@sh#1#2{%
401 %<latexrelease> \setbox\z@\hbox{$\m@th#1{#2}$}\finsm@sh}
402 %<latexrelease>\EndIncludeInRelease
403 %<*2ekernel>
404 % \end{macrocode}
405 %
406 % \changes{v1.2b}{2018/09/24}{Start LR-mode if necessary (gh/49)}
407 % \begin{macrocode}
408 %</2ekernel>
409 %<*2ekernel|latexrelease>
410 %<latexrelease>\IncludeInRelease{2018/12/01}%
411 %<latexrelease> {\finsm@sh}{Start LR-mode}%
412 \def\finsm@sh{\ht\z@\z@ \dp\z@\z@ \leavevmode@ifvmode\box\z@}
413 %</2ekernel|latexrelease>
414 %<latexrelease>\EndIncludeInRelease
415 %<latexrelease>\IncludeInRelease{0000/00/00}%
416 %<latexrelease> {\finsm@sh}{Start LR-mode}%
417 %<latexrelease>\def\finsm@sh{\ht\z@\z@ \dp\z@\z@ \box\z@}
418 %<latexrelease>\EndIncludeInRelease
419 %<*2ekernel>
420 % \end{macrocode}
421 % \end{macro}
422 %
423 % \begin{macro}{\buildrel}
424 % \begin{macrocode}
425 \def\buildrel#1\over#2{\mathrel{\mathop{\kern\z@#2}\limits^{#1}}}
426 % \end{macrocode}
427 % \end{macro}
428 %
429 %
430 % \begin{macrocode}
431 %</2ekernel>
432 %<*2ekernel|latexrelease>
433 %<latexrelease>\IncludeInRelease{2019/10/01}%
434 %<latexrelease> {\cases}{Make commands robust}%
435 % \end{macrocode}
436 %
437 % \begin{macro}{\cases}
438 % \changes{LaTeX2.09}{1991/08/14}
439 % {(RmS) inserted extra braces around entry for NFSS}
440 % \changes{v1.2g}{2020/07/27}{Don't make the command \cs{long} (gh/354)}
441 % \begin{macrocode}
442 \DeclareRobustCommand*\cases[1]{\left\{\,\vcenter{\normalbaselines\m@th
443 \ialign{$##\hfil$&\quad{##}\hfil\crcr#1\crcr}}\right.}
444 % \end{macrocode}
445 % \end{macro}
446 %
447 % \begin{macro}{\matrix}
448 % \changes{v1.2g}{2020/07/27}{Don't make the command \cs{long} (gh/354)}
449 % \begin{macrocode}
450 \DeclareRobustCommand*\matrix[1]{\null\,\vcenter{\normalbaselines\m@th
451 \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
452 \mathstrut\crcr\noalign{\kern-\baselineskip}
453 #1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,}
454 % \end{macrocode}
455 % \end{macro}
456 %
457 % \begin{macro}{\pmatrix}
458 % \changes{v1.2g}{2020/07/27}{Don't make the command \cs{long} (gh/354)}
459 % \begin{macrocode}
460 \DeclareRobustCommand*\pmatrix[1]{\left(\matrix{#1}\right)}
461 % \end{macrocode}
462 % \end{macro}
463 %
464 % \begin{macrocode}
465 %</2ekernel|latexrelease>
466 %<latexrelease>\EndIncludeInRelease
467 %<latexrelease>\IncludeInRelease{0000/00/00}%
468 %<latexrelease> {\cases}{Make commands robust}%
469 %<latexrelease>
470 %<latexrelease>\kernel@make@fragile\cases
471 %<latexrelease>\kernel@make@fragile\matrix
472 %<latexrelease>\kernel@make@fragile\pmatrix
473 %<latexrelease>
474 %<latexrelease>\EndIncludeInRelease
475 %<*2ekernel>
476 % \end{macrocode}
477 %
478 %
479 % \begin{macro}{\bordermatrix}
480 % \changes{LaTeX2e}{1994/01/25}{Removed \cs{p@renwd}.}
481 % \begin{macrocode}
482 \def\bordermatrix#1{\begingroup \m@th
483 \@tempdima 8.75\p@
484 \setbox\z@\vbox{%
485 \def\cr{\crcr\noalign{\kern2\p@\global\let\cr\endline}}%
486 \ialign{$##$\hfil\kern2\p@\kern\@tempdima&\thinspace\hfil$##$\hfil
487 &&\quad\hfil$##$\hfil\crcr
488 \omit\strut\hfil\crcr\noalign{\kern-\baselineskip}%
489 #1\crcr\omit\strut\cr}}%
490 \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
491 \setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
492 \setbox\tw@\hbox{$\kern\wd\@ne\kern-\@tempdima\left(\kern-\wd\@ne
493 \global\setbox\@ne\vbox{\box\@ne\kern2\p@}%
494 \vcenter{\kern-\ht\@ne\unvbox\z@\kern-\baselineskip}\,\right)$}%
495 \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
496 % \end{macrocode}
497 % \end{macro}
498 %
499 % \begin{macro}{\openup}
500 % \changes{v1.2k}{2022/04/08}{Make \cs{protected} (gh/123)}
501 % \begin{macrocode}
502 \protected\def\openup{\afterassignment\@penup\dimen@}
503 % \end{macrocode}
504 %
505 % \begin{macrocode}
506 \def\@penup{\advance\lineskip\dimen@
507 \advance\baselineskip\dimen@
508 \advance\lineskiplimit\dimen@}
509 % \end{macrocode}
510 % \end{macro}
511 %
512 % \begin{macro}{\displaylines}
513 % \begin{macrocode}
514 \newif\ifdt@p
515 % \end{macrocode}
516 %
517 % \begin{macrocode}
518 \def\displ@y{\global\dt@ptrue\openup\jot\m@th
519 \everycr{\noalign{\ifdt@p \global\dt@pfalse \ifdim\prevdepth>-1000\p@
520 \vskip-\lineskiplimit \vskip\normallineskiplimit \fi
521 \else \penalty\interdisplaylinepenalty \fi}}}
522 % \end{macrocode}
523 %
524 % \begin{macrocode}
525 \def\@lign{\tabskip\z@skip\everycr{}} % restore inside \displ@y
526 % \end{macrocode}
527 %
528 % \begin{macrocode}
529 \def\displaylines#1{\displ@y \tabskip\z@skip
530 \halign{\hb@xt@\displaywidth{$\@lign\hfil\displaystyle##\hfil$}\crcr
531 #1\crcr}}
532 % \end{macrocode}
533 % \end{macro}
534 %
535 % \changes{v1.0r}{1995/05/21}{Remove \cs{mathhexbox} from this file}
536 %
537 % \begin{macro}{\sp}
538 % \begin{macro}{\sb}
539 % \begin{macrocode}
540 \let\sp=^
541 \let\sb=_
542 % \end{macrocode}
543 % \end{macro}
544 % \end{macro}
545 %
546
547
548 %
549 % \begin{macro}{\tmspace}
550 % \begin{macro}{\,}
551 % \begin{macro}{\thinspace}
552 % \begin{macro}{\!}
553 % \begin{macro}{\negthinspace}
554 % \begin{macro}{\:}
555 % \begin{macro}{\medspace}
556 % \begin{macro}{\negmedspace}
557 % \begin{macro}{\;}
558 % \begin{macro}{\thickspace}
559 % \begin{macro}{\negthickspace}
560 %
561 % Originally \LaTeX{} only provided a small set of spacing commands
562 % for use in text and math, some of the commands like \cs{;} were
563 % only supported in math mode. \texttt{amsmath} normalized and
564 % provided all of them in text and math. This code has now been
565 % moved to the kernel so that it is generally available.
566 %
567 %
568 % \begin{macrocode}
569 %</2ekernel>
570 %<*2ekernel|latexrelease>
571 %<latexrelease>\IncludeInRelease{2020/10/01}%
572 %<latexrelease> {\tmspace}{amsmath spacing commands}%
573 % \end{macrocode}
574 % \cs{tmspace} is really meant to be an internal command so it
575 % doesn't necessarily has to be robust but it was robust in
576 % \texttt{amsmath} so we leave it like that.
577 % \changes{v1.2e}{2020/03/07}{Add \texttt{amsmath} math/text spacing
578 % commands to the kernel (gh/303)}
579 % \begin{macrocode}
580 \DeclareRobustCommand\tmspace[3]{%
581 \ifmmode\mskip#1#2\else\leavevmode@ifvmode\kern#1#3\fi\relax}
582 % \end{macrocode}
583 % In \texttt{amsmath} the text kern is \texttt{.1667em}. For
584 % compatibility reasons we keep the longer one.
585 % \begin{macrocode}
586 \DeclareRobustCommand\,{\tmspace+\thinmuskip{.16667em}}
587 \let\thinspace\,
588 % \end{macrocode}
589 %
590 % \begin{macrocode}
591 \DeclareRobustCommand\!{\tmspace-\thinmuskip{.16667em}}
592 \let\negthinspace\!
593 % \end{macrocode}
594 %
595 % \begin{macrocode}
596 \DeclareRobustCommand\:{\tmspace+\medmuskip{.2222em}}
597 \let\medspace\:
598 % \end{macrocode}
599 % \LaTeX{} has a second name for this in its manual:
600 % \begin{macrocode}
601 \let\>=\:
602 \DeclareRobustCommand\negmedspace{\tmspace-\medmuskip{.2222em}}
603 % \end{macrocode}
604 %
605 % \begin{macrocode}
606 \DeclareRobustCommand\;{\tmspace+\thickmuskip{.2777em}}
607 \let\thickspace\;
608 \DeclareRobustCommand\negthickspace{\tmspace-\thickmuskip{.2777em}}
609 %</2ekernel|latexrelease>
610 %<latexrelease>\EndIncludeInRelease
611 % \end{macrocode}
612 %
613 % \begin{macrocode}
614 %<latexrelease>\IncludeInRelease{0000/00/00}%
615 %<latexrelease> {\tmspace}{amsmath spacing commands}%
616 %<latexrelease>
617 %<latexrelease>\let\tmspace\@undefined
618 %<latexrelease>\DeclareRobustCommand{\,}{%
619 %<latexrelease> \relax\ifmmode\mskip\thinmuskip\else\thinspace\fi}
620 %<latexrelease>\DeclareRobustCommand\thinspace{\leavevmode@ifvmode\kern .16667em }
621 %<latexrelease>\DeclareRobustCommand\negthinspace{\leavevmode@ifvmode\kern-.16667em }
622 %<latexrelease>\def\>{\mskip\medmuskip}
623 %<latexrelease>\let\:=\>
624 %<latexrelease>\def\;{\mskip\thickmuskip}
625 %<latexrelease>\def\!{\mskip-\thinmuskip}
626 %<latexrelease>
627 % \end{macrocode}
628 % \changes{v1.2h}{2020/11/09}{\cs{negmedspace} and \cs{negthickspace}
629 % have been only in amsmath, so we need to undefine for rollback (gh/423)}
630 % \begin{macrocode}
631 %<latexrelease>\let\negmedspace\@undefined
632 %<latexrelease>\let\negthickspace\@undefined
633 %<latexrelease>
634 %<latexrelease>\EndIncludeInRelease
635 %<*2ekernel>
636 % \end{macrocode}
637 % \end{macro}
638 % \end{macro}
639 % \end{macro}
640 % \end{macro}
641 % \end{macro}
642 % \end{macro}
643 % \end{macro}
644 % \end{macro}
645 % \end{macro}
646 % \end{macro}
647 % \end{macro}
648 %
649 %
650 %
651 % \begin{macro}{\*}
652 % \begin{macrocode}
653 \DeclareRobustCommand\*{\discretionary{\thinspace\the\textfont2\char2}{}{}}
654 % \end{macrocode}
655 % \end{macro}
656 %
657 % \begin{macro}{\:}
658 % Nickname for the medium space since |\>| is not available inside
659 % \texttt{tabbing}.
660 % \begin{macrocode}
661 %\let\:=\>
662 % \end{macrocode}
663 % \end{macro}
664 %
665 % \begin{macro}{\active@math@prime}
666 % \changes{v1.1e}{1999/10/09}{Macro added, see PR 3104.}
667 % This is the definition of the active math prime.
668 % \begin{macrocode}
669 \def\active@math@prime{^\bgroup\prim@s}
670 % \end{macrocode}
671 % \end{macro}
672 %
673 % \begin{macro}{\prime@s}
674 % \changes{v1.0p}{1994/11/18}
675 % {(DPC) use \cs{@let@token} instead of \cs{next}
676 % and \cs{expandafter} instead of \cs{nxt}}
677 % \changes{v1.1e}{1999/10/09}{Introduce \cs{active@math@prime}.}
678 % \begin{macrocode}
679 {\catcode`\'=\active \global\let'\active@math@prime}
680 % \end{macrocode}
681 %
682 % \begin{macrocode}
683 \def\prim@s{%
684 \prime\futurelet\@let@token\pr@m@s}
685 % \end{macrocode}
686 %
687 % \begin{macrocode}
688 \def\pr@m@s{%
689 \ifx'\@let@token
690 \expandafter\pr@@@s
691 \else
692 \ifx^\@let@token
693 \expandafter\expandafter\expandafter\pr@@@t
694 \else
695 \egroup
696 \fi
697 \fi}
698 % \end{macrocode}
699 %
700 % \begin{macrocode}
701 \def\pr@@@s#1{\prim@s}
702 % \end{macrocode}
703 %
704 % \begin{macrocode}
705 \def\pr@@@t#1#2{#2\egroup}
706 % \end{macrocode}
707 % \end{macro}
708 %
709 % \changes{v1.0i}{1994/05/17}{Replaced \cs{let} by \cs{gdef}, for
710 % indirect definition.}
711 % \begin{macrocode}
712 {\catcode`\_=\active \gdef_{\_}} % _ in math is
713 % either subscript or \_
714 % \end{macrocode}
715 %
716 %
717 % \changes{v1.0m}{1994/10/29}{ASAJ: Removed \cs{dag}, \cs{ddag}.}
718 % \changes{v1.0m}{1994/10/29}{ASAJ: Renamed \cs{S} and \cs{P} to
719 % \cs{mathsection} and \cs{mathparagraph} and made them
720 % \cs{mathchardef}s.}
721 % \changes{v1.0m}{1994/10/29}{ASAJ: Added \cs{mathellipsis},
722 % \cs{mathdollar} and \cs{mathsterling}.}
723 % \changes{v1.0n}{1994/10/30}{ASAJ: Moved the new commands to ltoutenc.}
724 %
725 % \subsection{Math Environments}
726 %
727 % \changes{1.0m}{1994/10/29}{ASAJ: Tidied up documentation.}
728 %
729 % \begin{macro}{\(}
730 % \begin{macro}{\)}
731 % Produces |$...$| with checks that |\(| isn't used in math mode, and
732 % that |\)| is only used in math mode begun with |\(|.
733 % \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
734 % \begin{macrocode}
735 %</2ekernel>
736 %<latexrelease>\IncludeInRelease{2015/01/01}{\(}{Make \( robust}%
737 %<*2ekernel|latexrelease>
738 \DeclareRobustCommand\({%
739 \relax\ifmmode\@badmath\else$\fi}%
740 \DeclareRobustCommand\){%
741 \relax\ifmmode\ifinner$\else\@badmath\fi\else \@badmath\fi}%
742 %</2ekernel|latexrelease>
743 %<latexrelease>\EndIncludeInRelease
744 %<latexrelease>\IncludeInRelease{0000/00/00}{\(}{Make \( robust}%
745 %<latexrelease>\def\({%
746 %<latexrelease> \relax\ifmmode\@badmath\else$\fi}%
747 %<latexrelease>\expandafter\let\csname\string( \endcsname\@undefined
748 %<latexrelease>\def\){%
749 %<latexrelease> \relax\ifmmode\ifinner$\else\@badmath\fi\else \@badmath\fi}%
750 %<latexrelease>\expandafter\let\csname\string) \endcsname\@undefined
751 %<latexrelease>\EndIncludeInRelease
752 %<*2ekernel>
753 % \end{macrocode}
754 % \end{macro}
755 % \end{macro}
756 %
757 %
758 %
759 % \begin{macro}{\dollardollar@begin,\dollardollar@end}
760 % Two commands for starting and ending display math formulas to be used
761 % in the kernel and by packages. They
762 % are needed for tagging support and should be used by all display
763 % math environments so that these environments can be used when accessible PDFs
764 % are produced. We
765 % pretend that they have been always available, so that rollback
766 % doesn't break packages that have not set up their own rollback.
767 % \changes{v1.2o}{2025/03/08}{\cs{dollardollar@begin} and
768 % \cs{dollardollar@end} introduced for tagging}
769 % \begin{macrocode}
770 %</2ekernel>
771 %<*2ekernel|latexrelease>
772 %<latexrelease>\IncludeInRelease{2025/06/01}%
773 %<latexrelease> {\dollardollar@begin}{Start and end display math}%
774 % \end{macrocode}
775 %
776 % \begin{macrocode}
777 \def\dollardollar@begin{$$}
778 \def\dollardollar@end{$$}
779 %</2ekernel|latexrelease>
780 % \end{macrocode}
781 %
782 % \begin{macrocode}
783 %<latexrelease>\EndIncludeInRelease
784 %<latexrelease>\IncludeInRelease{0000/00/00}%
785 %<latexrelease> {\dollardollar@begin}{Start and end display math}%
786 %<latexrelease>
787 %<latexrelease>\def\dollardollar@begin{$$}
788 %<latexrelease>\def\dollardollar@end{$$}
789 %<latexrelease>\EndIncludeInRelease
790 %<*2ekernel>
791
792
793 % \end{macrocode}
794 % \end{macro}
795 %
796 %
797 %
798 % \begin{macro}{\[}
799 % \changes{v1.1g}{2005/11/10}
800 % {(MH) Fixed potential problem in \cs{[} (pr/3399).}
801 % \begin{macro}{\]}
802 % Produces |$$...$$| with checks that |\[| isn't used in math mode,
803 % and that |\]| is only used in display math mode (though there is no
804 % real test that this display math started with |\[| and not with |$$|).
805 % \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
806 % \changes{v1.2o}{2025/03/08}{\cs{dollardollar@begin} and
807 % \cs{dollardollar@end} introduced for tagging}
808 % \begin{macrocode}
809 %</2ekernel>
810 %<latexrelease>\IncludeInRelease{2015/01/01}{\[}{Make \[ robust}%
811 %<*2ekernel|latexrelease>
812 \DeclareRobustCommand\[{%
813 \relax\ifmmode
814 \@badmath
815 \else
816 \ifvmode
817 \nointerlineskip
818 \makebox[.6\linewidth]{}%
819 \fi
820 $$% % amsthm tries to patch this and expects a $
821 % \dollardollar@begin % in the def so we can't hide it for now
822 % will be adjusted when amsthm changes
823 \fi
824 }%
825 % \end{macrocode}
826 %
827 % \begin{macrocode}
828 \DeclareRobustCommand\]{%
829 \relax\ifmmode
830 \ifinner
831 \@badmath
832 \else
833 \dollardollar@end
834 \fi
835 \else
836 \@badmath
837 \fi
838 \ignorespaces
839 }%
840 % \end{macrocode}
841 %
842 % \begin{macrocode}
843 %</2ekernel|latexrelease>
844 %<latexrelease>\EndIncludeInRelease
845 %<latexrelease>\IncludeInRelease{2015/01/01}{\[}{Make \[ robust}%
846 %<latexrelease>\DeclareRobustCommand\[{%
847 %<latexrelease> \relax\ifmmode
848 %<latexrelease> \@badmath
849 %<latexrelease> \else
850 %<latexrelease> \ifvmode
851 %<latexrelease> \nointerlineskip
852 %<latexrelease> \makebox[.6\linewidth]{}%
853 %<latexrelease> \fi
854 %<latexrelease> $$%%$$ BRACE MATCH HACK
855 %<latexrelease> \fi
856 %<latexrelease>}%
857 %<latexrelease>\DeclareRobustCommand\]{%
858 %<latexrelease> \relax\ifmmode
859 %<latexrelease> \ifinner
860 %<latexrelease> \@badmath
861 %<latexrelease> \else
862 %<latexrelease> $$%%$$ BRACE MATCH HACK
863 %<latexrelease> \fi
864 %<latexrelease> \else
865 %<latexrelease> \@badmath
866 %<latexrelease> \fi
867 %<latexrelease> \ignorespaces
868 %<latexrelease>}%
869 %<latexrelease>\EndIncludeInRelease
870 % \end{macrocode}
871 %
872 % \begin{macrocode}
873 %<latexrelease>\IncludeInRelease{0000/00/00}{\[}{Make \[ robust}%
874 %<latexrelease>\def\[{%
875 %<latexrelease> \relax\ifmmode
876 %<latexrelease> \@badmath
877 %<latexrelease> \else
878 %<latexrelease> \ifvmode
879 %<latexrelease> \nointerlineskip
880 %<latexrelease> \makebox[.6\linewidth]{}%
881 %<latexrelease> \fi
882 %<latexrelease> $$%%$$ BRACE MATCH HACK
883 %<latexrelease> \fi
884 %<latexrelease>}%
885 %<latexrelease>\expandafter\let\csname\string[ \endcsname\@undefined
886 % \end{macrocode}
887 %
888 % \begin{macrocode}
889 %<latexrelease>\def\]{%
890 %<latexrelease> \relax\ifmmode
891 %<latexrelease> \ifinner
892 %<latexrelease> \@badmath
893 %<latexrelease> \else
894 %<latexrelease> $$%%$$ BRACE MATCH HACK
895 %<latexrelease> \fi
896 %<latexrelease> \else
897 %<latexrelease> \@badmath
898 %<latexrelease> \fi
899 %<latexrelease> \ignorespaces
900 %<latexrelease>}%
901 %<latexrelease>\expandafter\let\csname\string] \endcsname\@undefined
902 %<latexrelease>\EndIncludeInRelease
903 %<*2ekernel>
904 % \end{macrocode}
905 % \end{macro}
906 % \end{macro}
907 %
908 % \begin{environment}{math}
909 % \begin{environment}{displaymath}
910 % Disguises for |\(...\)| and |\[...\]|.
911 % \begin{macrocode}
912 \let\math=\(
913 \let\endmath=\)
914 % \end{macrocode}
915 %
916 % \begin{macrocode}
917 \def\displaymath{\[}
918 \def\enddisplaymath{\]\@ignoretrue}
919 % \end{macrocode}
920 % \end{environment}
921 % \end{environment}
922 %
923 %
924 % \begin{environment}{equation}
925 % \changes{LaTeX2.09}{1992/01/10}{RmS: put \cs{hbox} around \cs{@eqnnum}
926 % to typeset the equation number in text mode
927 % (as in the eqnarray env.)}
928 % \begin{macro}{\c@equation}
929 % Numbered equations, using the counter |\c@equation|.
930 % \emph{Note}: The document style must define |\theequation| etc., and
931 % do the appropriate |\@addtoreset|. It should also redefine |\@eqnnum|
932 % if another format for the equation number is desired other than the
933 % standard (...), or to move the equation numbers to the flushleft.
934 % (See comment on the |\def| of |\@eqnnum|.)
935 % \changes{v1.2o}{2025/03/08}{\cs{dollardollar@begin} and
936 % \cs{dollardollar@end} introduced for tagging}
937 % \begin{macrocode}
938 \@definecounter{equation}
939 % \end{macrocode}
940 %
941 % \begin{macrocode}
942 %</2ekernel>
943 %<*2ekernel|latexrelease>
944 %<latexrelease>\IncludeInRelease{2025/06/01}%
945 %<latexrelease> {\equation}{Tagging support}%
946 \def\equation{\dollardollar@begin
947 \refstepcounter{equation}}
948 \def\endequation{\eqno \hbox{\@eqnnum}\dollardollar@end\@ignoretrue}
949 %</2ekernel|latexrelease>
950 %<latexrelease>\EndIncludeInRelease
951 %<latexrelease>\IncludeInRelease{0000/00/00}%
952 %<latexrelease> {\equation}{Tagging support}%
953 %<latexrelease>
954 %<latexrelease>\def\equation{$$\refstepcounter{equation}}
955 %<latexrelease>\def\endequation{\eqno \hbox{\@eqnnum}$$\@ignoretrue}
956 %<latexrelease>\EndIncludeInRelease
957 %<*2ekernel>
958 % \end{macrocode}
959 % \end{macro}
960 % \end{environment}
961 %
962 % \begin{macro}{\@eqnnum}
963 % \changes{LaTeX2.09}{1991/09/29}{RmS: \cs{reset@font} added.}
964 % \changes{v1.0l}{1994/10/23}{Added \cs{normalcolor} since \cs{eqno}
965 % introduces a subgroup of the displayed math group}
966 %
967 % Produces the equation number for equation and
968 % eqnarray environments. The following definition is for
969 % flushright numbers; for flushleft numbers, see leqno.clo.
970 % The equation number is set in black roman type even
971 % if an eqnarray environment appears in an italic environment.
972 % \changes{v1.0s}{1995/05/26}{Removed \cs{rmfamily} (PR 1578),
973 % replaced \cs{reset@font} with \cs{normalfont}}
974 % \begin{macrocode}
975 \def\@eqnnum{{\normalfont \normalcolor (\theequation)}}
976 % \end{macrocode}
977 % \end{macro}
978 %
979 % \begin{macro}{\stackrel}
980 % A disguise for plain \TeX's buildrel.
981 % \begin{macrocode}
982 \DeclareRobustCommand\stackrel[2]{\mathrel{\mathop{#2}\limits^{#1}}}
983 % \end{macrocode}
984 % \end{macro}
985 %
986 % \changes{v0.9g}{1993/12/11}{Added a group around the first argument
987 % of \cs{frac} to prevent
988 % changes (for example font changes) from modifying the contents of
989 % the second argument.}
990 %
991 % \begin{macro}{\frac}
992 % A disguise for plain \TeX's |\over|.
993 % \begin{macrocode}
994 \DeclareRobustCommand\frac[2]{{\begingroup#1\endgroup\over#2}}
995 % \end{macrocode}
996 % \end{macro}
997 %
998 % \begin{macro}{\sqrt}
999 % \changes{v1.0y}{1995/10/16}{(DPC) Make robust /1808}
1000 % \begin{macro}{\@sqrt}
1001 % Add an optional argument to plain's |\sqrt| to give the $n$th root
1002 % of an expression $\sqrt[n]{e}$.
1003 % \changes{v1.0r}{1995/05/21}{Use \cs{sqrtsign}}
1004 % \begin{macrocode}
1005 \DeclareRobustCommand\sqrt{\@ifnextchar[\@sqrt\sqrtsign}
1006 \def\@sqrt[#1]{\root #1\of}
1007 % \end{macrocode}
1008 % \end{macro}
1009 % \end{macro}
1010 %
1011 % \changes{LaTeX2.09}{1985/11/04}{produce warning message if line
1012 % extends into margin. Doesn't warn about formula
1013 % overprinting equation number.}
1014 % \changes{LaTeX2.09}{1993/11/02}{RmS:
1015 % Corrected description of \cs{@eqnsel}, moved \cs{@eqnsel}
1016 % accordingly and removed extra \cs{tabskip} assignment.}
1017 % \changes{LaTeX2e}{1993/11/03}{RmS: Initialized \cs{everycr} to empty}
1018 % \changes{v0.9i}{1993/12/16}
1019 % {use \cs{refstepcounter} instead of shortcut}
1020 % \changes{v0.9o}{1994/01/13}{correcting 0.9i}
1021 %
1022 % \begin{environment}{eqnarray}
1023 % \begin{macro}{\@eqcnt}
1024 % \begin{macro}{\@eqpen}
1025 % \begin{macro}{\if@eqnsw}
1026 % \begin{macro}{\@eqnsel}
1027 % Here's the eqnarray environment:
1028 % Default is for left-hand side of equations to be flushright.
1029 % To make them flushleft, |\let\@eqnsel = \hfil|.
1030 % \begin{macrocode}
1031 \newcount\@eqcnt
1032 \newcount\@eqpen
1033 \newif\if@eqnsw\@eqnswtrue
1034 \newskip\@centering
1035 \@centering = 0pt plus 1000pt
1036 % \end{macrocode}
1037 % To get a proper \cs{@currentlabel} we have to redefine it for the
1038 % whole display. Note that we can't use \cs{refstepcounter} as this
1039 % results in |\@currentlabel| getting restored at the wrong and
1040 % thus always writing the first label to the \texttt{.aux} file.
1041 % \changes{v1.2j}{2021/10/14}
1042 % {Explicitly set \cs{@currentcounter} (gh/687)}
1043 % \changes{v1.2o}{2025/03/08}{\cs{dollardollar@begin} and
1044 % \cs{dollardollar@end} introduced for tagging}
1045 % \begin{macrocode}
1046 %</2ekernel>
1047 %<*2ekernel|latexrelease>
1048 %<latexrelease>\IncludeInRelease{2025/06/01}%
1049 %<latexrelease> {\eqnarray}{Support for tagging}%
1050 % \end{macrocode}
1051 %
1052 % \begin{macrocode}
1053 \def\eqnarray{%
1054 \stepcounter{equation}%
1055 \def\@currentlabel{\p@equation\theequation}%
1056 \def\@currentcounter{equation}%
1057 \global\@eqnswtrue
1058 \m@th
1059 \global\@eqcnt\z@
1060 \tabskip\@centering
1061 \let\\\@eqncr
1062 \dollardollar@begin\everycr{}\halign to\displaywidth\bgroup
1063 \hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel
1064 &\global\@eqcnt\@ne\hskip \tw@\arraycolsep \hfil${##}$\hfil
1065 &\global\@eqcnt\tw@ \hskip \tw@\arraycolsep
1066 $\displaystyle{##}$\hfil\tabskip\@centering
1067 &\global\@eqcnt\thr@@ \hb@xt@\z@\bgroup\hss##\egroup
1068 \tabskip\z@skip
1069 \cr
1070 }
1071 % \end{macrocode}
1072 %
1073 % \changes{v1.2o}{2025/03/08}{\cs{dollardollar@begin} and
1074 % \cs{dollardollar@end} introduced for tagging}
1075 % \begin{macrocode}
1076 \def\endeqnarray{%
1077 \@@eqncr
1078 \egroup
1079 \global\advance\c@equation\m@ne
1080 \dollardollar@end\@ignoretrue
1081 }
1082 %</2ekernel|latexrelease>
1083 %<latexrelease>\EndIncludeInRelease
1084 %<latexrelease>\IncludeInRelease{0000/00/00}%
1085 %<latexrelease> {\eqnarray}{Support for tagging}%
1086 %<latexrelease>
1087 %<latexrelease>\def\eqnarray{%
1088 %<latexrelease> \stepcounter{equation}%
1089 %<latexrelease> \def\@currentlabel{\p@equation\theequation}%
1090 %<latexrelease> \def\@currentcounter{equation}%
1091 %<latexrelease> \global\@eqnswtrue
1092 %<latexrelease> \m@th
1093 %<latexrelease> \global\@eqcnt\z@
1094 %<latexrelease> \tabskip\@centering
1095 %<latexrelease> \let\\\@eqncr
1096 %<latexrelease> $$\everycr{}\halign to\displaywidth\bgroup
1097 %<latexrelease> \hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel
1098 %<latexrelease> &\global\@eqcnt\@ne\hskip \tw@\arraycolsep \hfil${##}$\hfil
1099 %<latexrelease> &\global\@eqcnt\tw@ \hskip \tw@\arraycolsep
1100 %<latexrelease> $\displaystyle{##}$\hfil\tabskip\@centering
1101 %<latexrelease> &\global\@eqcnt\thr@@ \hb@xt@\z@\bgroup\hss##\egroup
1102 %<latexrelease> \tabskip\z@skip
1103 %<latexrelease> \cr
1104 %<latexrelease>}
1105 %<latexrelease>\def\endeqnarray{%
1106 %<latexrelease> \@@eqncr
1107 %<latexrelease> \egroup
1108 %<latexrelease> \global\advance\c@equation\m@ne
1109 %<latexrelease> $$\@ignoretrue
1110 %<latexrelease>}
1111 %<latexrelease>\EndIncludeInRelease
1112 %<*2ekernel>
1113 % \end{macrocode}
1114 %
1115 % \begin{macrocode}
1116 \let\@eqnsel=\relax
1117 % \end{macrocode}
1118 % \end{macro}
1119 % \end{macro}
1120 % \end{macro}
1121 % \end{macro}
1122 % \end{environment}
1123 %
1124 % \begin{macro}{\nonumber}
1125 % Switches off equation numbering.
1126 % \begin{macrocode}
1127 \def\nonumber{\global\@eqnswfalse}
1128 % \end{macrocode}
1129 % \end{macro}
1130 %
1131 % \begin{macro}{\@eqncr}
1132 % \changes{v1.2i}{2021/04/20}{Use \cs{protected} for \cs{\bslash} variant (gh/548)}
1133 % \begin{macro}{\@xeqncr}
1134 % \begin{macro}{\@yeqncr}
1135 % \changes{v1.0y}{1995/10/16}{(DPC) Use \cs{@testopt} /1911}
1136 % \begin{macrocode}
1137 \protected\def\@eqncr{%
1138 {\ifnum0=`}\fi
1139 \@ifstar{%
1140 \global\@eqpen\@M\@yeqncr
1141 }{%
1142 \global\@eqpen\interdisplaylinepenalty \@yeqncr
1143 }%
1144 }
1145 % \end{macrocode}
1146 %
1147 % \begin{macrocode}
1148 \def\@yeqncr{\@testopt\@xeqncr\z@skip}
1149 % \end{macrocode}
1150 %
1151 % \changes{v1.2f}{2020/04/21}{Support calc syntax (gh/152)}
1152 % \begin{macrocode}
1153 %</2ekernel>
1154 %<*2ekernel|latexrelease>
1155 %<latexrelease>\IncludeInRelease{2020/10/01}%
1156 %<latexrelease> {\@xeqncr}{eqnarray support calc syntax}%
1157 \def\@xeqncr[#1]{%
1158 \ifnum0=`{\fi}%
1159 \@@eqncr
1160 \noalign{\penalty\@eqpen\vskip\jot\@vspace@calcify{#1}}%
1161 }
1162 %</2ekernel|latexrelease>
1163 %<latexrelease>\EndIncludeInRelease
1164 % \end{macrocode}
1165 %
1166 % \begin{macrocode}
1167 %<latexrelease>\IncludeInRelease{0000/00/00}%
1168 %<latexrelease> {\@xeqncr}{eqnarray support calc syntax}%
1169 %<latexrelease>
1170 %<latexrelease>\def\@xeqncr[#1]{%
1171 %<latexrelease> \ifnum0=`{\fi}%
1172 %<latexrelease> \@@eqncr
1173 %<latexrelease> \noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}%
1174 %<latexrelease>}
1175 %<latexrelease>\EndIncludeInRelease
1176 %<*2ekernel>
1177 % \end{macrocode}
1178 %
1179 % \end{macro}
1180 % \end{macro}
1181 % \end{macro}
1182 %
1183 % \begin{macro}{\@@eqncr}
1184 % \changes{v0.9i}{1993/12/16}{use \cs{refstepcounter} instead of shortcut}
1185 % \changes{v0.9o}{1994/01/13}{correcting 0.9i}
1186 %
1187 % \begin{macrocode}
1188 \def\@@eqncr{\let\reserved@a\relax
1189 \ifcase\@eqcnt \def\reserved@a{& & &}\or \def\reserved@a{& &}%
1190 \or \def\reserved@a{&}\else
1191 \let\reserved@a\@empty
1192 \@latex@error{Too many columns in eqnarray environment}\@ehc\fi
1193 \reserved@a \if@eqnsw\@eqnnum\stepcounter{equation}\fi
1194 \global\@eqnswtrue\global\@eqcnt\z@\cr}
1195 % \end{macrocode}
1196 % \end{macro}
1197 %
1198 % \begin{environment}{eqnarray*}
1199 % \begin{macro}{\@seqncr}
1200 % Here's the eqnarray* environment:
1201 % \begin{macrocode}
1202 \let\@seqncr=\@eqncr
1203 % \end{macrocode}
1204 %
1205 % \changes{v1.2i}{2021/04/20}{Use \cs{protected} for \cs{\bslash} variant (gh/548)}
1206 % \begin{macrocode}
1207 \@namedef{eqnarray*}{\protected\def\@eqncr{\nonumber\@seqncr}\eqnarray}
1208 % \end{macrocode}
1209 %
1210 % \begin{macrocode}
1211 \@namedef{endeqnarray*}{\nonumber\endeqnarray}
1212 % \end{macrocode}
1213 % \end{macro}
1214 % \end{environment}
1215 %
1216 % \begin{macro}{\lefteqn}
1217 % |\lefteqn{FORMULA}| typesets |FORMULA| in display math style
1218 % flushleft in a box of width zero.
1219 % \changes{v1.0r}{1995/05/21}{Use \cs{rlap}}
1220 % \begin{macrocode}
1221 \def\lefteqn#1{\rlap{$\displaystyle #1$}}
1222 % \end{macrocode}
1223 % \end{macro}
1224 %
1225 % \begin{macro}{\ensuremath}
1226 % In math mode, |\ensuremath{text}| is equivalent to text; in LR or
1227 % paragraph mode, it is equivalent to |$|text|$|.
1228 % |\relax| is not needed
1229 % in front of the |\ifmmode| as |\protect| will be |\let| to |\relax|.
1230 % This version (due to Donald Arseneau) avoids duplicating its
1231 % argument in the `then' and `else' part of the |\ifmath| which is
1232 % necessary in nested `tabular' like environments. See amslatex/2104.
1233 % \changes{v1.0k}{1994/05/16}
1234 % {Use \cs{DeclareRobustCommand} and add extra braces in math mode}
1235 % \changes{v1.0l}{1994/10/23}{Remove extra braces: but see p 168 of
1236 % Leslie's book}
1237 % \changes{v1.1a}{1996/03/25}{Reimplement for amslatex/2104}
1238 % \begin{macrocode}
1239 \DeclareRobustCommand{\ensuremath}{%
1240 \ifmmode
1241 \expandafter\@firstofone
1242 \else
1243 \expandafter\@ensuredmath
1244 \fi}
1245 % \end{macrocode}
1246 % \end{macro}
1247 %
1248 % \begin{macro}{\@ensuredmath}
1249 % \changes{v1.1a}{1996/03/25}{Macro added for amslatex/2104}
1250 % \changes{v1.1c}{1996/11/09}{Made long, as it was before. /2104}
1251 % The |\relax| stops |\ensuremath{}| starting display math.
1252 % \begin{macrocode}
1253 \long\def\@ensuredmath#1{$\relax#1$}
1254 % \end{macrocode}
1255 % \end{macro}
1256 %
1257 % \changes{v1.2l}{2022/05/08}{Use consistent math styles under \LuaTeX}
1258 % \LuaTeX\ contains new math primitives to place expression over or under
1259 % horizontally extensible glyphs. Before \LuaTeX\ 1.14 these did not work
1260 % correctly with the |\mathstyle| primitive and sometimes did not use
1261 % cramped style in consistent ways. For newer version, we opt into the
1262 % corrected behavior.
1263 % \begin{macrocode}
1264 \ifx\mathdefaultsmode\@undefined\else
1265 \mathdefaultsmode=1
1266 \fi
1267 % \end{macrocode}
1268 %
1269 % \begin{macro}{\eqno}
1270 % \begin{macro}{\leqno}
1271 % \changes{v1.2n}{2023/05/13}{add \cs{ignorespaces} gh/1059}
1272 % \changes{v1.2p}{2025/05/29}{Ensure saved version is primitive gh/1747}
1273 % Ensure the (deprecated) \verb|$$..\eqno 1 $$| ignores spaces.
1274 % \begin{macrocode}
1275 %</2ekernel>
1276 %<*2ekernel|latexrelease>
1277 %<latexrelease>\IncludeInRelease{2023/06/01}%
1278 %<latexrelease> {\eqno}{add ignorespaces to eqno}%
1279 \expandafter\let\expandafter\@kernel@eqno\csname tex_eqno:D\endcsname
1280 \expandafter\let\expandafter\@kernel@leqno\csname tex_leqno:D\endcsname
1281 \protected\def\eqno{\@kernel@eqno\aftergroup\ignorespaces}
1282 \protected\def\leqno{\@kernel@leqno\aftergroup\ignorespaces}
1283 %</2ekernel|latexrelease>
1284 %<latexrelease>\EndIncludeInRelease
1285 %<latexrelease>\IncludeInRelease{0000/00/00}%
1286 %<latexrelease> {\eqno}{add ignorespaces to eqno}%
1287 %<latexrelease>\let\eqno\@kernel@eqno
1288 %<latexrelease>\let\leqno\@kernel@leqno
1289 %<latexrelease>\EndIncludeInRelease
1290 % \end{macrocode}
1291 % \end{macro}
1292 % \end{macro}
1293 %
1294 %
1295 %
1296 % \subsection{External options to the standard document classes}
1297 %
1298 % \changes{v1.0u}{1995/08/09}
1299 % {Added code for class options leqno and fleqn}
1300 %
1301 % \subsubsection{Left equation numbering}
1302 %
1303 % \begin{macro}{\@eqnnum}
1304 % To put the equation number on the left side of an equation we
1305 % have to use a little trick. The number is shifted |\displaywidth|
1306 % to the left inside a box of (approximately) zero width. This
1307 % fails when the equation is too wide, the equation number than may
1308 % overprint the equation itself.
1309 % \changes{v1.2y classes}{1995/01/12}{Added \cs{normalcolor}}
1310 % \changes{v1.3c classes}{1995/05/25}
1311 % {replace \cs{reset@font}\cs{rmfamily} with \cs{normalfont}
1312 % (PR 1578)}
1313 % \begin{macrocode}
1314 %<*leqno>
1315 \renewcommand\@eqnnum{\hb@[email protected]\p@{}%
1316 \rlap{\normalfont\normalcolor
1317 \hskip -\displaywidth(\theequation)}}
1318 %</leqno>
1319 % \end{macrocode}
1320 % \end{macro}
1321 %
1322 % \subsubsection{Flush left equations}
1323 %
1324 % To get the displayed math environments to print the contents
1325 % flush left (with an indentation) we have to redefine all of
1326 % \LaTeXe's displayed math environments.
1327 %
1328 % \begin{macro}{\mathindent}
1329 % The amount of indentation of the equations is stored in a register.
1330 % \changes{v1.2d}{2020/02/18}{Make \cs{mathindent} a skip register to match
1331 % amsmath (gh/252)}
1332 % \begin{macrocode}
1333 %<*fleqn>
1334 \newskip\mathindent
1335 % \end{macrocode}
1336 % The setting of |\mathindent| has to be deferred until the class
1337 % file has been processed, because |\leftmargini| is still 0pt
1338 % wide at the moment \texttt{fleqn.clo} is read in.
1339 % \changes{v1.0n classes}
1340 % {1994/01/19}{Deferred setting of \cs{mathindent}}
1341 % \changes{v1.2t classes}
1342 % {1994/06/22}{Set \cs{mathindent} at the end of the
1343 % class instead of at begin document}
1344 % \begin{macrocode}
1345 \AtEndOfClass{\mathindent\leftmargini}
1346 % \end{macrocode}
1347 % \end{macro}
1348 %
1349 % \begin{macro}{\[}
1350 % Begin display math;
1351 % \begin{macrocode}
1352 \IncludeInRelease{2015/01/01}{\[}{Make \[ robust}%
1353 \DeclareRobustCommand\[{\relax
1354 \ifmmode\@badmath
1355 \else
1356 \begin{trivlist}%
1357 \@beginparpenalty\predisplaypenalty
1358 \@endparpenalty\postdisplaypenalty
1359 \item[]\leavevmode
1360 \hb@xt@\linewidth\bgroup $\m@th\displaystyle %$
1361 \hskip\mathindent\bgroup
1362 \fi}
1363 \EndIncludeInRelease
1364 % \end{macrocode}
1365 %
1366 % \begin{macrocode}
1367 \IncludeInRelease{0000/00/00}{\[}{Make \[ robust}%
1368 \renewcommand\[{\relax
1369 \ifmmode\@badmath
1370 \else
1371 \begin{trivlist}%
1372 \@beginparpenalty\predisplaypenalty
1373 \@endparpenalty\postdisplaypenalty
1374 \item[]\leavevmode
1375 \hb@xt@\linewidth\bgroup $\m@th\displaystyle %$
1376 \hskip\mathindent\bgroup
1377 \fi}
1378 \EndIncludeInRelease
1379 % \end{macrocode}
1380 % \end{macro}
1381 %
1382 % \begin{macro}{\]}
1383 % end display math;
1384 % \begin{macrocode}
1385 \IncludeInRelease{2015/01/01}{\]}{Make \] robust}%
1386 \DeclareRobustCommand\]{\relax
1387 \ifmmode
1388 \egroup $\hfil% $
1389 \egroup
1390 \end{trivlist}%
1391 \else \@badmath
1392 \fi}
1393 \EndIncludeInRelease
1394 % \end{macrocode}
1395 %
1396 % \begin{macrocode}
1397 \IncludeInRelease{0000/00/00}{\]}{Make \] robust}%
1398 \renewcommand\]{\relax
1399 \ifmmode
1400 \egroup $\hfil% $
1401 \egroup
1402 \end{trivlist}%
1403 \else \@badmath
1404 \fi}
1405 \EndIncludeInRelease
1406 % \end{macrocode}
1407 % \end{macro}
1408 %
1409 % \begin{environment}{equation}
1410 % The \textsf{equation} environment
1411 % \begin{macrocode}
1412 \renewenvironment{equation}%
1413 {\@beginparpenalty\predisplaypenalty
1414 \@endparpenalty\postdisplaypenalty
1415 \refstepcounter{equation}%
1416 \trivlist \item[]\leavevmode
1417 \hb@xt@\linewidth\bgroup $\m@th% $
1418 \displaystyle
1419 \hskip\mathindent}%
1420 % \end{macrocode}
1421 % Ensure that there is at least a space between formula and
1422 % equation number so that they don't bump in each other.
1423 % \changes{v1.2d}{2020/02/18}{Separate formula and eqn number by at
1424 % least a space in fleqn option}
1425 % \begin{macrocode}
1426 {$\hskip .3em minus.3em\hfil % $
1427 \displaywidth\linewidth\hbox{\@eqnnum}%
1428 \egroup
1429 \endtrivlist}
1430 % \end{macrocode}
1431 % \end{environment}
1432 %
1433 % \begin{environment}{eqnarray}
1434 % The \textsf{eqnarray} environment
1435 % \changes{v1.2j}{2021/10/14}
1436 % {Explicitly set \cs{@currentcounter} (gh/687)}
1437 % \begin{macrocode}
1438 \renewenvironment{eqnarray}{%
1439 \stepcounter{equation}%
1440 \def\@currentlabel{\p@equation\theequation}%
1441 \def\@currentcounter{equation}%
1442 \global\@eqnswtrue\m@th
1443 \global\@eqcnt\z@
1444 \tabskip\mathindent
1445 \let\\=\@eqncr
1446 \setlength\abovedisplayskip{\topsep}%
1447 \ifvmode
1448 \addtolength\abovedisplayskip{\partopsep}%
1449 \fi
1450 % \end{macrocode}
1451 % When the documentclass uses a non-zero |\parskip| setting the
1452 % |\topsep| might have a negative value to compensate for
1453 % that. Therefore we add |\parskip| to |\abovedisplayskip|.
1454 % \changes{v1.2v classes}{1994/11/10}{Added value of \cs{parskip} to
1455 % \cs{abovedisplayskip} to compensate for negative \cs{topsep}}
1456 % \changes{v1.2o}{2025/03/08}{\cs{dollardollar@begin} and
1457 % \cs{dollardollar@end} introduced for tagging}
1458 % \begin{macrocode}
1459 \addtolength\abovedisplayskip{\parskip}%
1460 \setlength\belowdisplayskip{\abovedisplayskip}%
1461 \setlength\belowdisplayshortskip{\abovedisplayskip}%
1462 \setlength\abovedisplayshortskip{\abovedisplayskip}%
1463 \dollardollar@begin\everycr{}\halign to\linewidth%
1464 \bgroup
1465 \hskip\@centering
1466 $\displaystyle\tabskip\z@skip{##}$\@eqnsel&%
1467 \global\@eqcnt\@ne \hskip \tw@\arraycolsep \hfil${##}$\hfil&%
1468 \global\@eqcnt\tw@ \hskip \tw@\arraycolsep
1469 $\displaystyle{##}$\hfil \tabskip\@centering&%
1470 \global\@eqcnt\thr@@
1471 \hb@xt@\z@\bgroup\hss##\egroup\tabskip\z@skip\cr}%
1472 {\@@eqncr
1473 \egroup
1474 \global\advance\c@equation\m@ne\dollardollar@end
1475 \@ignoretrue
1476 }
1477 %</fleqn>
1478 % \end{macrocode}
1479 % \end{environment}
1480 %
1481 %
1482 % \Finale
1483 %