Update LuaTeX testfiles for ^@ change
[latex2e.git] / trunk / base / ltmath.dtx
blobf0080e385687dae0675a8f6bc917603434ef9c96
1 % \iffalse meta-comment
3 % Copyright 1993-2016
4 % The LaTeX3 Project and any individual authors listed elsewhere
5 % in this file.
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
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 %    http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
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.
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.
28 % \fi
29 % \iffalse
30 %%% From File: ltmath.dtx
32 %<leqno>\ProvidesFile{leqno.clo}
33 %<fleqn>\ProvidesFile{fleqn.clo}
34 %<leqno,fleqn>        [2016/12/29 v1.2a Standard LaTeX option
35 %<leqno>                                   (left equation numbers)]
36 %<fleqn>                                   (flush left equations)]
38 %<*driver>
39 % \fi
40 \ProvidesFile{ltmath.dtx}
41               [2016/12/29 v1.2a LaTeX Kernel (Math Setup)]
42 % \iffalse
43 %</driver>
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
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.}
72 % \section{Math setup}
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.
77 % \StopEventually{}
79 %    \begin{macrocode}
80 %<*2ekernel>
81 \message{math definitions,}
82 %    \end{macrocode}
86 % \subsection{Math commands based on plain \TeX}
88 % \subsubsection{The log-like functions}
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}
99 % \begin{macro}{\log}
100 % The standard operators:
101 %    \begin{macrocode}
102 \def\log{\mathop{\operator@font log}\nolimits}
103 \def\lg{\mathop{\operator@font lg}\nolimits}
104 \def\ln{\mathop{\operator@font ln}\nolimits}
105 \def\lim{\mathop{\operator@font lim}}
106 \def\limsup{\mathop{\operator@font lim\,sup}}
107 \def\liminf{\mathop{\operator@font lim\,inf}}
108 \def\sin{\mathop{\operator@font sin}\nolimits}
109 \def\arcsin{\mathop{\operator@font arcsin}\nolimits}
110 \def\sinh{\mathop{\operator@font sinh}\nolimits}
111 \def\cos{\mathop{\operator@font cos}\nolimits}
112 \def\arccos{\mathop{\operator@font arccos}\nolimits}
113 \def\cosh{\mathop{\operator@font cosh}\nolimits}
114 \def\tan{\mathop{\operator@font tan}\nolimits}
115 \def\arctan{\mathop{\operator@font arctan}\nolimits}
116 \def\tanh{\mathop{\operator@font tanh}\nolimits}
117 \def\cot{\mathop{\operator@font cot}\nolimits}
118 \def\coth{\mathop{\operator@font coth}\nolimits}
119 \def\sec{\mathop{\operator@font sec}\nolimits}
120 \def\csc{\mathop{\operator@font csc}\nolimits}
121 \def\max{\mathop{\operator@font max}}
122 \def\min{\mathop{\operator@font min}}
123 \def\sup{\mathop{\operator@font sup}}
124 \def\inf{\mathop{\operator@font inf}}
125 \def\arg{\mathop{\operator@font arg}\nolimits}
126 \def\ker{\mathop{\operator@font ker}\nolimits}
127 \def\dim{\mathop{\operator@font dim}\nolimits}
128 \def\hom{\mathop{\operator@font hom}\nolimits}
129 \def\det{\mathop{\operator@font det}}
130 \def\exp{\mathop{\operator@font exp}\nolimits}
131 \def\Pr{\mathop{\operator@font Pr}}
132 \def\gcd{\mathop{\operator@font gcd}}
133 \def\deg{\mathop{\operator@font deg}\nolimits}
134 %    \end{macrocode}
135 % \end{macro}
137 % \begin{macro}{\bmod}
138 % And some operators have to be done by hand:
139 %    \begin{macrocode}
140 \def\bmod{%
141   \nonscript\mskip-\medmuskip\mkern5mu%
142   \mathbin{\operator@font mod}\penalty900\mkern5mu%
143   \nonscript\mskip-\medmuskip}
144 %    \end{macrocode}
145 % \end{macro}
147 % \begin{macro}{\pmod}
148 %    \begin{macrocode}
149 \def\pmod#1{%
150   \allowbreak\mkern18mu({\operator@font mod}\,\,#1)}
151 %    \end{macrocode}
152 % \end{macro}
154 % \subsubsection{Biggggg}
156 % \begin{macro}{\big}
157 % Variants on |\big| and friends for use with delimiters:
158 %    \begin{macrocode}
159 \def\bigl{\mathopen\big}
160 \def\bigm{\mathrel\big}
161 \def\bigr{\mathclose\big}
162 \def\Bigl{\mathopen\Big}
163 \def\Bigm{\mathrel\Big}
164 \def\Bigr{\mathclose\Big}
165 \def\biggl{\mathopen\bigg}
166 \def\biggm{\mathrel\bigg}
167 \def\biggr{\mathclose\bigg}
168 \def\Biggl{\mathopen\Bigg}
169 \def\Biggm{\mathrel\Bigg}
170 \def\Biggr{\mathclose\Bigg}
171 %    \end{macrocode}
172 % \end{macro}
174 % \subsubsection{The UNSORTED Rest}
176 % The other math commands are lifted from plain \TeX.
178 % \begin{macro}{\jot}
179 %    \begin{macrocode}
180 \newdimen\jot
181 \jot=3pt
182 %    \end{macrocode}
183 % \end{macro}
185 % \begin{macro}{\interdisplaylinepenalty}
186 %    \begin{macrocode}
187 \newcount\interdisplaylinepenalty
188 \interdisplaylinepenalty=100
189 %    \end{macrocode}
190 % \end{macro}
192 % \begin{macro}{\choose}
193 %    \begin{macrocode}
194 \def\choose{\atopwithdelims()}
195 %    \end{macrocode}
196 % \end{macro}
198 % \begin{macro}{\brack}
199 %    \begin{macrocode}
200 \def\brack{\atopwithdelims[]}
201 %    \end{macrocode}
202 % \end{macro}
204 % \begin{macro}{\brace}
205 %    \begin{macrocode}
206 \def\brace{\atopwithdelims\{\}}
207 %    \end{macrocode}
208 % \end{macro}
210 % \begin{macro}{\mathpalette}
211 %    \begin{macrocode}
212 \def\mathpalette#1#2{%
213   \mathchoice
214     {#1\displaystyle{#2}}%
215     {#1\textstyle{#2}}%
216     {#1\scriptstyle{#2}}%
217     {#1\scriptscriptstyle{#2}}}
218 %    \end{macrocode}
219 % \end{macro}
221 % \begin{macro}{\root}
222 % \changes{v1.1d}{1997/01/08}
223 %      {(DPC) Remove spurious space tokens from
224 %              plain \TeX\ definition /2359}
225 % \begin{macro}{\rootbox}
226 % \begin{macro}{\r@@t}
227 % \changes{v1.0r}{1995/05/21}{Use \cs{sqrtsign} instead of
228 %                             \cs{sqrt}}
229 %    \begin{macrocode}
230 \newbox\rootbox
231 %    \end{macrocode}
233 %    \begin{macrocode}
234 \def\root#1\of{%
235   \setbox\rootbox\hbox{$\m@th\scriptscriptstyle{#1}$}%
236   \mathpalette\r@@t}
237 %    \end{macrocode}
239 %    \begin{macrocode}
240 \def\r@@t#1#2{%
241   \setbox\z@\hbox{$\m@th#1\sqrtsign{#2}$}%
242   \dimen@\ht\z@ \advance\dimen@-\dp\z@
243   \mkern5mu\raise.6\dimen@\copy\rootbox
244   \mkern-10mu\box\z@}
245 %    \end{macrocode}
246 % \end{macro}
247 % \end{macro}
248 % \end{macro}
250 % \begin{macro}{\phantom}
251 % \changes{v1.0p}{1994/11/18}
252 %         {(DPC) use \cs{expandafter} instead of \cs{next}}
253 % \changes{v1.0p}{1994/11/18}
254 %         {(DPC) colour support}
255 % \begin{macro}{\hphantom}
256 % \begin{macro}{\vphantom}
257 %    \begin{macrocode}
258 \newif\ifv@
259 \newif\ifh@
260 %    \end{macrocode}
262 %    \begin{macrocode}
263 \def\vphantom{\v@true\h@false\ph@nt}
264 %    \end{macrocode}
266 %    \begin{macrocode}
267 \def\hphantom{\v@false\h@true\ph@nt}
268 %    \end{macrocode}
270 %    \begin{macrocode}
271 \def\phantom{\v@true\h@true\ph@nt}
272 %    \end{macrocode}
274 %    \begin{macrocode}
275 \def\ph@nt{%
276   \ifmmode
277     \expandafter\mathpalette\expandafter\mathph@nt
278   \else
279     \expandafter\makeph@nt
280   \fi}
281 %    \end{macrocode}
283 %    \begin{macrocode}
284 \def\makeph@nt#1{%
285   \setbox\z@\hbox{\color@begingroup#1\color@endgroup}\finph@nt}
286 %    \end{macrocode}
288 %    \begin{macrocode}
289 \def\mathph@nt#1#2{%
290   \setbox\z@\hbox{$\m@th#1{#2}$}\finph@nt}
291 %    \end{macrocode}
293 %    \begin{macrocode}
294 \def\finph@nt{%
295   \setbox\tw@\null
296   \ifv@ \ht\tw@\ht\z@ \dp\tw@\dp\z@\fi
297   \ifh@ \wd\tw@\wd\z@\fi \box\tw@}
298 %    \end{macrocode}
299 % \end{macro}
300 % \end{macro}
301 % \end{macro}
303 % \begin{macro}{\mathstrut}
304 %    \begin{macrocode}
305 \def\mathstrut{\vphantom(}
306 %    \end{macrocode}
307 % \end{macro}
309 % \begin{macro}{\smash}
310 % \changes{v1.0p}{1994/11/18}
311 %         {(DPC) use \cs{expandafter} instead of \cs{next}}
312 % \changes{v1.0p}{1994/11/18}
313 %         {(DPC) colour support}
314 %    \begin{macrocode}
315 \def\smash{%
316   \relax % \relax, in case this comes first in \halign
317   \ifmmode
318     \expandafter\mathpalette\expandafter\mathsm@sh
319   \else
320     \expandafter\makesm@sh
321   \fi}
322 %    \end{macrocode}
324 %    \begin{macrocode}
325 \def\makesm@sh#1{%
326   \setbox\z@\hbox{\color@begingroup#1\color@endgroup}\finsm@sh}
327 \def\mathsm@sh#1#2{%
328   \setbox\z@\hbox{$\m@th#1{#2}$}\finsm@sh}
329 \def\finsm@sh{\ht\z@\z@ \dp\z@\z@ \box\z@}
330 %    \end{macrocode}
331 % \end{macro}
333 % \begin{macro}{\buildrel}
334 %    \begin{macrocode}
335 \def\buildrel#1\over#2{\mathrel{\mathop{\kern\z@#2}\limits^{#1}}}
336 %    \end{macrocode}
337 % \end{macro}
340 % \begin{macro}{\cases}
341 % \changes{LaTeX2.09}{1991/08/14}
342 %         {(RmS) inserted extra braces around entry for NFSS}
343 %    \begin{macrocode}
344 \def\cases#1{\left\{\,\vcenter{\normalbaselines\m@th
345     \ialign{$##\hfil$&\quad{##}\hfil\crcr#1\crcr}}\right.}
346 %    \end{macrocode}
347 % \end{macro}
349 % \begin{macro}{\matrix}
350 %    \begin{macrocode}
351 \def\matrix#1{\null\,\vcenter{\normalbaselines\m@th
352     \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
353       \mathstrut\crcr\noalign{\kern-\baselineskip}
354       #1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,}
355 %    \end{macrocode}
356 % \end{macro}
358 % \begin{macro}{\pmatrix}
359 %    \begin{macrocode}
360 \def\pmatrix#1{\left(\matrix{#1}\right)}
361 %    \end{macrocode}
362 % \end{macro}
365 % \begin{macro}{\bordermatrix}
366 % \changes{LaTeX2e}{1994/01/25}{Removed \cs{p@renwd}.}
367 %    \begin{macrocode}
368 \def\bordermatrix#1{\begingroup \m@th
369   \@tempdima 8.75\p@
370   \setbox\z@\vbox{%
371     \def\cr{\crcr\noalign{\kern2\p@\global\let\cr\endline}}%
372     \ialign{$##$\hfil\kern2\p@\kern\@tempdima&\thinspace\hfil$##$\hfil
373       &&\quad\hfil$##$\hfil\crcr
374       \omit\strut\hfil\crcr\noalign{\kern-\baselineskip}%
375       #1\crcr\omit\strut\cr}}%
376   \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
377   \setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
378   \setbox\tw@\hbox{$\kern\wd\@ne\kern-\@tempdima\left(\kern-\wd\@ne
379     \global\setbox\@ne\vbox{\box\@ne\kern2\p@}%
380     \vcenter{\kern-\ht\@ne\unvbox\z@\kern-\baselineskip}\,\right)$}%
381   \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
382 %    \end{macrocode}
383 % \end{macro}
385 % \begin{macro}{\openup}
386 %    \begin{macrocode}
387 \def\openup{\afterassignment\@penup\dimen@}
388 %    \end{macrocode}
390 %    \begin{macrocode}
391 \def\@penup{\advance\lineskip\dimen@
392   \advance\baselineskip\dimen@
393   \advance\lineskiplimit\dimen@}
394 %    \end{macrocode}
395 % \end{macro}
397 % \begin{macro}{\displaylines}
398 %    \begin{macrocode}
399 \newif\ifdt@p
400 %    \end{macrocode}
402 %    \begin{macrocode}
403 \def\displ@y{\global\dt@ptrue\openup\jot\m@th
404   \everycr{\noalign{\ifdt@p \global\dt@pfalse \ifdim\prevdepth>-1000\p@
405       \vskip-\lineskiplimit \vskip\normallineskiplimit \fi
406       \else \penalty\interdisplaylinepenalty \fi}}}
407 %    \end{macrocode}
409 %    \begin{macrocode}
410 \def\@lign{\tabskip\z@skip\everycr{}} % restore inside \displ@y
411 %    \end{macrocode}
413 %    \begin{macrocode}
414 \def\displaylines#1{\displ@y \tabskip\z@skip
415   \halign{\hb@xt@\displaywidth{$\@lign\hfil\displaystyle##\hfil$}\crcr
416     #1\crcr}}
417 %    \end{macrocode}
418 % \end{macro}
420 % \changes{v1.0r}{1995/05/21}{Remove \cs{mathhexbox} from this file}
422 % \begin{macro}{\sp}
423 % \begin{macro}{\sb}
424 %    \begin{macrocode}
425 \let\sp=^
426 \let\sb=_
427 %    \end{macrocode}
428 % \end{macro}
429 % \end{macro}
431 % \begin{macro}{\>}
432 % \begin{macro}{\;}
433 % \begin{macro}{\!}
434 %    \begin{macrocode}
435 %\def\,{\mskip\thinmuskip}      % already defined in ltspace
436 \def\>{\mskip\medmuskip}
437 \def\;{\mskip\thickmuskip}
438 \def\!{\mskip-\thinmuskip}
439 %    \end{macrocode}
440 % \end{macro}
441 % \end{macro}
442 % \end{macro}
444 % \begin{macro}{\*}
445 %    \begin{macrocode}
446 \def\*{\discretionary{\thinspace\the\textfont2\char2}{}{}}
447 %    \end{macrocode}
448 % \end{macro}
450 % \begin{macro}{\:}
451 %    Nickname for the medium space since |\>| is not available inside
452 %    \texttt{tabbing}.
453 %    \begin{macrocode}
454 \let\:=\>
455 %    \end{macrocode}
456 % \end{macro}
458 % \begin{macro}{\active@math@prime}
459 % \changes{v1.1e}{1999/10/09}{Macro added, see PR 3104.}
460 %    This is the definition of the active math prime.
461 %    \begin{macrocode}
462 \def\active@math@prime{^\bgroup\prim@s}
463 %    \end{macrocode}
464 % \end{macro}
466 % \begin{macro}{\prime@s}
467 % \changes{v1.0p}{1994/11/18}
468 %         {(DPC) use \cs{@let@token} instead of \cs{next}
469 %           and \cs{expandafter} instead of \cs{nxt}}
470 % \changes{v1.1e}{1999/10/09}{Introduce \cs{active@math@prime}.}
471 %    \begin{macrocode}
472 {\catcode`\'=\active \global\let'\active@math@prime}
473 %    \end{macrocode}
475 %    \begin{macrocode}
476 \def\prim@s{%
477   \prime\futurelet\@let@token\pr@m@s}
478 %    \end{macrocode}
480 %    \begin{macrocode}
481 \def\pr@m@s{%
482   \ifx'\@let@token
483     \expandafter\pr@@@s
484   \else
485     \ifx^\@let@token
486       \expandafter\expandafter\expandafter\pr@@@t
487     \else
488       \egroup
489     \fi
490   \fi}
491 %    \end{macrocode}
493 %    \begin{macrocode}
494 \def\pr@@@s#1{\prim@s}
495 %    \end{macrocode}
497 %    \begin{macrocode}
498 \def\pr@@@t#1#2{#2\egroup}
499 %    \end{macrocode}
500 % \end{macro}
502 % \changes{v1.0i}{1994/05/17}{Replaced \cs{let} by \cs{gdef}, for
503 %            indirect definition.}
504 %    \begin{macrocode}
505 {\catcode`\_=\active \gdef_{\_}} % _ in math is
506                                  % either subscript or \_
507 %    \end{macrocode}
510 % \changes{v1.0m}{1994/10/29}{ASAJ: Removed \cs{dag}, \cs{ddag}.}
511 % \changes{v1.0m}{1994/10/29}{ASAJ: Renamed \cs{S} and \cs{P} to
512 %    \cs{mathsection} and \cs{mathparagraph} and made them
513 %    \cs{mathchardef}s.}
514 % \changes{v1.0m}{1994/10/29}{ASAJ: Added \cs{mathellipsis},
515 %    \cs{mathdollar} and \cs{mathsterling}.}
516 % \changes{v1.0n}{1994/10/30}{ASAJ: Moved the new commands to ltoutenc.}
518 % \subsection{Math Environments}
520 % \changes{1.0m}{1994/10/29}{ASAJ: Tidied up documentation.}
522 % \begin{macro}{\(}
523 % \begin{macro}{\)}
524 %    Produces |$...$| with checks that |\(| isn't used in math mode, and
525 %    that |\)| is only used in math mode begun with |\(|.
526 % \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
527 %    \begin{macrocode}
528 %</2ekernel>
529 %<latexrelease>\IncludeInRelease{2015/01/01}{\(}{Make \( robust}%
530 %<*2ekernel|latexrelease>
531 \DeclareRobustCommand\({%
532   \relax\ifmmode\@badmath\else$\fi}%
533 \DeclareRobustCommand\){%
534   \relax\ifmmode\ifinner$\else\@badmath\fi\else \@badmath\fi}%
535 %</2ekernel|latexrelease>
536 %<latexrelease>\EndIncludeInRelease
537 %<latexrelease>\IncludeInRelease{0000/00/00}{\(}{Make \( robust}%
538 %<latexrelease>\def\({%
539 %<latexrelease>  \relax\ifmmode\@badmath\else$\fi}%
540 %<latexrelease>\expandafter\let\csname\string( \endcsname\@undefined
541 %<latexrelease>\def\){%
542 %<latexrelease>  \relax\ifmmode\ifinner$\else\@badmath\fi\else \@badmath\fi}%
543 %<latexrelease>\expandafter\let\csname\string) \endcsname\@undefined
544 %<latexrelease>\EndIncludeInRelease
545 %<*2ekernel>
546 %    \end{macrocode}
547 % \end{macro}
548 % \end{macro}
550 % \begin{macro}{\[}
551 % \changes{v1.1g}{2005/11/10}
552 %                {(MH) Fixed potential problem in \cs{[} (pr/3399).}
553 % \begin{macro}{\]}
554 %    Produces |$$...$$| with checks that |\[| isn't used in math mode,
555 %    and that |\]| is only used in display math mode (though there is no 
556 %    real test that this display math started with |\[| and not with |$$|).
557 % \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
558 %    \begin{macrocode}
559 %</2ekernel>
560 %<latexrelease>\IncludeInRelease{2015/01/01}{\[}{Make \[ robust}%
561 %<*2ekernel|latexrelease>
562 \DeclareRobustCommand\[{%
563    \relax\ifmmode
564       \@badmath
565    \else
566       \ifvmode
567          \nointerlineskip
568          \makebox[.6\linewidth]{}%
569       \fi
570       $$%%$$ BRACE MATCH HACK
571    \fi
573 %    \end{macrocode}
575 %    \begin{macrocode}
576 \DeclareRobustCommand\]{%
577    \relax\ifmmode
578       \ifinner
579          \@badmath
580       \else
581          $$%%$$ BRACE MATCH HACK
582       \fi
583    \else
584       \@badmath
585    \fi
586    \ignorespaces
588 %    \end{macrocode}
590 %    \begin{macrocode}
591 %</2ekernel|latexrelease>
592 %<latexrelease>\EndIncludeInRelease
593 %<latexrelease>\IncludeInRelease{0000/00/00}{\[}{Make \[ robust}%
594 %<latexrelease>\def\[{%
595 %<latexrelease>   \relax\ifmmode
596 %<latexrelease>      \@badmath
597 %<latexrelease>   \else
598 %<latexrelease>      \ifvmode
599 %<latexrelease>         \nointerlineskip
600 %<latexrelease>         \makebox[.6\linewidth]{}%
601 %<latexrelease>      \fi
602 %<latexrelease>      $$%%$$ BRACE MATCH HACK
603 %<latexrelease>   \fi
604 %<latexrelease>}%
605 %<latexrelease>\expandafter\let\csname\string[ \endcsname\@undefined
606 %    \end{macrocode}
608 %    \begin{macrocode}
609 %<latexrelease>\def\]{%
610 %<latexrelease>   \relax\ifmmode
611 %<latexrelease>      \ifinner
612 %<latexrelease>         \@badmath
613 %<latexrelease>      \else
614 %<latexrelease>         $$%%$$ BRACE MATCH HACK
615 %<latexrelease>      \fi
616 %<latexrelease>   \else
617 %<latexrelease>      \@badmath
618 %<latexrelease>   \fi
619 %<latexrelease>   \ignorespaces
620 %<latexrelease>}%
621 %<latexrelease>\expandafter\let\csname\string] \endcsname\@undefined
622 %<latexrelease>\EndIncludeInRelease
623 %<*2ekernel>
624 %    \end{macrocode}
625 % \end{macro}
626 % \end{macro}
628 % \begin{environment}{math}
629 % \begin{environment}{displaymath}
630 %    Disguises for |\(...\)| and |\[...\]|.
631 %    \begin{macrocode}
632 \let\math=\(
633 \let\endmath=\)
634 %    \end{macrocode}
636 %    \begin{macrocode}
637 \def\displaymath{\[}
638 \def\enddisplaymath{\]\@ignoretrue}
639 %    \end{macrocode}
640 % \end{environment}
641 % \end{environment}
644 % \begin{environment}{equation}
645 % \changes{LaTeX2.09}{1992/01/10}{RmS: put \cs{hbox} around \cs{@eqnnum}
646 %    to typeset the equation number in text mode
647 %    (as in the eqnarray env.)}
648 % \begin{macro}{\c@equation}
649 %  Numbered equations, using the counter |\c@equation|.
650 %  \emph{Note}: The document style must define |\theequation| etc., and
651 %  do the appropriate |\@addtoreset|. It should also redefine |\@eqnnum|
652 %  if another format for the equation number is desired other than the
653 %  standard (...), or to move the equation numbers to the flushleft.
654 %   (See comment on the |\def| of |\@eqnnum|.)
655 %    \begin{macrocode}
656 \@definecounter{equation}
657 \def\equation{$$\refstepcounter{equation}}
658 \def\endequation{\eqno \hbox{\@eqnnum}$$\@ignoretrue}
659 %    \end{macrocode}
660 % \end{macro}
661 % \end{environment}
663 % \begin{macro}{\@eqnnum}
664 % \changes{LaTeX2.09}{1991/09/29}{RmS: \cs{reset@font} added.}
665 % \changes{v1.0l}{1994/10/23}{Added \cs{normalcolor} since \cs{eqno}
666 %    introduces a subgroup of the displayed math group}
668 %     Produces the equation number for equation and
669 %     eqnarray environments.  The following definition is for
670 %     flushright numbers; for flushleft numbers, see leqno.clo.
671 %     The equation number is set in black roman type even
672 %     if an eqnarray environment appears in an italic environment.
673 % \changes{v1.0s}{1995/05/26}{Removed \cs{rmfamily} (PR 1578),
674 % replaced \cs{reset@font} with \cs{normalfont}}
675 %    \begin{macrocode}
676 \def\@eqnnum{{\normalfont \normalcolor (\theequation)}}
677 %    \end{macrocode}
678 % \end{macro}
680 % \begin{macro}{\stackrel}
681 %    A disguise for plain \TeX's buildrel.
682 %    \begin{macrocode}
683 \def\stackrel#1#2{\mathrel{\mathop{#2}\limits^{#1}}}
684 %    \end{macrocode}
685 % \end{macro}
687 %  \changes{v0.9g}{1993/12/11}{Added a group around the first argument
688 %    of \cs{frac} to prevent
689 %    changes (for example font changes) from modifying the contents of
690 %     the second argument.}
692 %  \begin{macro}{\frac}
693 %    A disguise for plain \TeX's |\over|.
694 %    \begin{macrocode}
695 \def\frac#1#2{{\begingroup#1\endgroup\over#2}}
696 %    \end{macrocode}
697 %  \end{macro}
699 % \begin{macro}{\sqrt}
700 % \changes{v1.0y}{1995/10/16}{(DPC) Make robust /1808}
701 % \begin{macro}{\@sqrt}
702 %    Add an optional argument to plain's |\sqrt| to give the $n$th root
703 %    of an expression $\sqrt[n]{e}$.
704 % \changes{v1.0r}{1995/05/21}{Use \cs{sqrtsign}}
705 %    \begin{macrocode}
706 \DeclareRobustCommand\sqrt{\@ifnextchar[\@sqrt\sqrtsign}
707 \def\@sqrt[#1]{\root #1\of}
708 %    \end{macrocode}
709 % \end{macro}
710 % \end{macro}
712 % \changes{LaTeX2.09}{1985/11/04}{produce warning message if line
713 %      extends into margin.  Doesn't warn about formula
714 %      overprinting equation number.}
715 % \changes{LaTeX2.09}{1993/11/02}{RmS:
716 %        Corrected description of \cs{@eqnsel}, moved \cs{@eqnsel}
717 %        accordingly and removed extra \cs{tabskip} assignment.}
718 % \changes{LaTeX2e}{1993/11/03}{RmS: Initialized \cs{everycr} to empty}
719 % \changes{v0.9i}{1993/12/16}
720 %     {use \cs{refstepcounter} instead of shortcut}
721 % \changes{v0.9o}{1994/01/13}{correcting 0.9i}
723 % \begin{environment}{eqnarray}
724 % \begin{macro}{\@eqcnt}
725 % \begin{macro}{\@eqpen}
726 % \begin{macro}{\if@eqnsw}
727 % \begin{macro}{\@eqnsel}
728 %    Here's the eqnarray environment:
729 %    Default is for left-hand side of equations to be flushright.
730 %    To make them flushleft, |\let\@eqnsel = \hfil|.
731 %    \begin{macrocode}
732 \newcount\@eqcnt
733 \newcount\@eqpen
734 \newif\if@eqnsw\@eqnswtrue
735 \newskip\@centering
736 \@centering = 0pt plus 1000pt
737 %    \end{macrocode}
738 %    To get a proper \cs{@currentlabel} we have to redefine it for the
739 %    whole display. Note that we can't use \cs{refstepcounter} as this
740 %    results in |\@currentlabel| getting restored at the wrong and
741 %    thus always writing the first label to the \texttt{.aux} file.
742 %    \begin{macrocode}
743 \def\eqnarray{%
744    \stepcounter{equation}%
745    \def\@currentlabel{\p@equation\theequation}%
746    \global\@eqnswtrue
747    \m@th
748    \global\@eqcnt\z@
749    \tabskip\@centering
750    \let\\\@eqncr
751    $$\everycr{}\halign to\displaywidth\bgroup
752        \hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel
753       &\global\@eqcnt\@ne\hskip \tw@\arraycolsep \hfil${##}$\hfil
754       &\global\@eqcnt\tw@ \hskip \tw@\arraycolsep
755          $\displaystyle{##}$\hfil\tabskip\@centering
756       &\global\@eqcnt\thr@@ \hb@xt@\z@\bgroup\hss##\egroup
757          \tabskip\z@skip
758       \cr
760 %    \end{macrocode}
762 %    \begin{macrocode}
763 \def\endeqnarray{%
764       \@@eqncr
765       \egroup
766       \global\advance\c@equation\m@ne
767    $$\@ignoretrue
769 %    \end{macrocode}
771 %    \begin{macrocode}
772 \let\@eqnsel=\relax
773 %    \end{macrocode}
774 % \end{macro}
775 % \end{macro}
776 % \end{macro}
777 % \end{macro}
778 % \end{environment}
780 % \begin{macro}{\nonumber}
781 %    Switches off equation numbering.
782 %    \begin{macrocode}
783 \def\nonumber{\global\@eqnswfalse}
784 %    \end{macrocode}
785 % \end{macro}
787 % \begin{macro}{\@eqncr}
788 % \begin{macro}{\@xeqncr}
789 % \begin{macro}{\@yeqncr}
790 % \changes{v1.0y}{1995/10/16}{(DPC) Use \cs{@testopt} /1911}
791 %    \begin{macrocode}
792 \def\@eqncr{%
793    {\ifnum0=`}\fi
794    \@ifstar{%
795       \global\@eqpen\@M\@yeqncr
796    }{%
797       \global\@eqpen\interdisplaylinepenalty \@yeqncr
798    }%
800 %    \end{macrocode}
802 %    \begin{macrocode}
803 \def\@yeqncr{\@testopt\@xeqncr\z@skip}
804 %    \end{macrocode}
806 %    \begin{macrocode}
807 \def\@xeqncr[#1]{%
808    \ifnum0=`{\fi}%
809    \@@eqncr
810    \noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}%
812 %    \end{macrocode}
814 % \end{macro}
815 % \end{macro}
816 % \end{macro}
818 %  \begin{macro}{\@@eqncr}
819 % \changes{v0.9i}{1993/12/16}{use \cs{refstepcounter} instead of shortcut}
820 % \changes{v0.9o}{1994/01/13}{correcting 0.9i}
822 %    \begin{macrocode}
823 \def\@@eqncr{\let\reserved@a\relax
824     \ifcase\@eqcnt \def\reserved@a{& & &}\or \def\reserved@a{& &}%
825      \or \def\reserved@a{&}\else
826        \let\reserved@a\@empty
827        \@latex@error{Too many columns in eqnarray environment}\@ehc\fi
828      \reserved@a \if@eqnsw\@eqnnum\stepcounter{equation}\fi
829      \global\@eqnswtrue\global\@eqcnt\z@\cr}
830 %    \end{macrocode}
831 %  \end{macro}
833 % \begin{environment}{eqnarray*}
834 % \begin{macro}{\@seqncr}
835 %    Here's the eqnarray* environment:
836 %    \begin{macrocode}
837 \let\@seqncr=\@eqncr
838 %    \end{macrocode}
840 %    \begin{macrocode}
841 \@namedef{eqnarray*}{\def\@eqncr{\nonumber\@seqncr}\eqnarray}
842 %    \end{macrocode}
844 %    \begin{macrocode}
845 \@namedef{endeqnarray*}{\nonumber\endeqnarray}
846 %    \end{macrocode}
847 % \end{macro}
848 % \end{environment}
850 % \begin{macro}{\lefteqn}
851 %  |\lefteqn{FORMULA}| typesets |FORMULA| in display math style
852 %  flushleft in a box of width zero.
853 % \changes{v1.0r}{1995/05/21}{Use \cs{rlap}}
854 %    \begin{macrocode}
855 \def\lefteqn#1{\rlap{$\displaystyle #1$}}
856 %    \end{macrocode}
857 % \end{macro}
859 % \begin{macro}{\ensuremath}
860 %   In math mode, |\ensuremath{text}| is equivalent to text; in LR or
861 %   paragraph mode, it is equivalent to |$|text|$|.
862 %   |\relax| is not needed
863 %   in front of the |\ifmmode| as |\protect| will be |\let| to |\relax|.
864 %   This version (due to Donald Arseneau) avoids duplicating its
865 %   argument in the `then' and `else' part of the |\ifmath| which is
866 %   necessary in nested  `tabular' like environments. See amslatex/2104.
867 % \changes{v1.0k}{1994/05/16}
868 %     {Use \cs{DeclareRobustCommand} and add extra braces in math mode}
869 % \changes{v1.0l}{1994/10/23}{Remove extra braces: but see p 168 of
870 %      Leslie's book}
871 % \changes{v1.1a}{1996/03/25}{Reimplement for amslatex/2104}
872 %    \begin{macrocode}
873 \DeclareRobustCommand{\ensuremath}{%
874   \ifmmode
875     \expandafter\@firstofone
876   \else
877     \expandafter\@ensuredmath
878   \fi}
879 %    \end{macrocode}
880 % \end{macro}
882 % \begin{macro}{\@ensuredmath}
883 % \changes{v1.1a}{1996/03/25}{Macro added for amslatex/2104}
884 % \changes{v1.1c}{1996/11/09}{Made long, as it was before. /2104}
885 % The |\relax| stops |\ensuremath{}| starting display math.
886 %    \begin{macrocode}
887 \long\def\@ensuredmath#1{$\relax#1$}
888 %    \end{macrocode}
889 % \end{macro}
891 %    \begin{macrocode}
892 %</2ekernel>
893 %    \end{macrocode}
897 % \subsection{External options to the standard document classes}
899 % \changes{v1.0u}{1995/08/09}
900 %    {Added code for class options leqno and fleqn}
902 % \subsubsection{Left equation numbering}
904 %  \begin{macro}{\@eqnnum}
905 %    To put the equation number on the left side of an equation we
906 %    have to use a little trick. The number is shifted |\displaywidth|
907 %    to the left inside a box of (approximately) zero width. This
908 %    fails when the quation is too wide, the equation number than may
909 %    overprint the equation itself.
910 % \changes{v1.2y classes}{1995/01/12}{Added \cs{normalcolor}}
911 % \changes{v1.3c classes}{1995/05/25}
912 %    {replace \cs{reset@font}\cs{rmfamily} with \cs{normalfont}
913 %      (PR 1578)}
914 %    \begin{macrocode}
915 %<*leqno>
916 \renewcommand\@eqnnum{\hb@xt@.01\p@{}%
917                       \rlap{\normalfont\normalcolor
918                         \hskip -\displaywidth(\theequation)}}
919 %</leqno>
920 %    \end{macrocode}
921 %  \end{macro}
923 % \subsubsection{Flush left equations}
925 %    To get the displayed math environments to print the contents
926 %    flush left (with an indentation) we have to redefine all of
927 %    \LaTeXe's displayed math environments.
929 %  \begin{macro}{\mathindent}
930 %    The amount of indentation of the equations is stored in a register.
931 %    \begin{macrocode}
932 %<*fleqn>
933 \newdimen\mathindent
934 %    \end{macrocode}
935 %    The setting of |\mathindent| has to be deferred until the class
936 %    file has been processed, because |\leftmargini| is still 0pt
937 %    wide at the moment \texttt{fleqn.clo} is read in.
938 % \changes{v1.0n classes}
939 %    {1994/01/19}{Deferred setting of \cs{mathindent}}
940 % \changes{v1.2t classes}
941 %    {1994/06/22}{Set \cs{mathindent} at the end of the
942 %    class instead of at begin document}
943 %    \begin{macrocode}
944 \AtEndOfClass{\mathindent\leftmargini}
945 %    \end{macrocode}
946 % \end{macro}
948 %  \begin{macro}{\[}
949 %    Begin display math;
950 %    \begin{macrocode}
951 \IncludeInRelease{2015/01/01}{\[}{Make \[ robust}%
952 \DeclareRobustCommand\[{\relax
953                 \ifmmode\@badmath
954                 \else
955                   \begin{trivlist}%
956                     \@beginparpenalty\predisplaypenalty
957                     \@endparpenalty\postdisplaypenalty
958                     \item[]\leavevmode
959                     \hb@xt@\linewidth\bgroup $\m@th\displaystyle %$
960                       \hskip\mathindent\bgroup
961                 \fi}
962 \EndIncludeInRelease
963 %    \end{macrocode}
965 %    \begin{macrocode}
966 \IncludeInRelease{0000/00/00}{\[}{Make \[ robust}%
967 \renewcommand\[{\relax
968                 \ifmmode\@badmath
969                 \else
970                   \begin{trivlist}%
971                     \@beginparpenalty\predisplaypenalty
972                     \@endparpenalty\postdisplaypenalty
973                     \item[]\leavevmode
974                     \hb@xt@\linewidth\bgroup $\m@th\displaystyle %$
975                       \hskip\mathindent\bgroup
976                 \fi}
977 \EndIncludeInRelease
978 %    \end{macrocode}
979 % \end{macro}
981 %  \begin{macro}{\]}
982 %    end display math;
983 %    \begin{macrocode}
984 \IncludeInRelease{2015/01/01}{\]}{Make \] robust}%
985 \DeclareRobustCommand\]{\relax
986                 \ifmmode
987                       \egroup $\hfil% $
988                     \egroup
989                   \end{trivlist}%
990                 \else \@badmath
991                 \fi}
992 \EndIncludeInRelease
993 %    \end{macrocode}
995 %    \begin{macrocode}
996 \IncludeInRelease{0000/00/00}{\]}{Make \] robust}%
997 \renewcommand\]{\relax
998                 \ifmmode
999                       \egroup $\hfil% $
1000                     \egroup
1001                   \end{trivlist}%
1002                 \else \@badmath
1003                 \fi}
1004 \EndIncludeInRelease
1005 %    \end{macrocode}
1006 % \end{macro}
1008 %  \begin{environment}{equation}
1009 %    The \textsf{equation} environment
1010 %    \begin{macrocode}
1011 \renewenvironment{equation}%
1012     {\@beginparpenalty\predisplaypenalty
1013      \@endparpenalty\postdisplaypenalty
1014      \refstepcounter{equation}%
1015      \trivlist \item[]\leavevmode
1016        \hb@xt@\linewidth\bgroup $\m@th% $
1017          \displaystyle
1018          \hskip\mathindent}%
1019         {$\hfil % $
1020          \displaywidth\linewidth\hbox{\@eqnnum}%
1021        \egroup
1022      \endtrivlist}
1023 %    \end{macrocode}
1024 % \end{environment}
1026 % \begin{environment}{eqnarray}
1027 %    The \textsf{eqnarray} environment
1028 %    \begin{macrocode}
1029 \renewenvironment{eqnarray}{%
1030     \stepcounter{equation}%
1031     \def\@currentlabel{\p@equation\theequation}%
1032     \global\@eqnswtrue\m@th
1033     \global\@eqcnt\z@
1034     \tabskip\mathindent
1035     \let\\=\@eqncr
1036     \setlength\abovedisplayskip{\topsep}%
1037     \ifvmode
1038       \addtolength\abovedisplayskip{\partopsep}%
1039     \fi
1040 %    \end{macrocode}
1041 %    When the documentclass uses a non-zero |\parskip| setting the
1042 %    |\topsep| might have a negative value to compensate for
1043 %    that. Therefore we add |\parskip| to |\abovedisplayskip|.
1044 % \changes{v1.2v classes}{1994/11/10}{Added value of \cs{parskip} to
1045 %    \cs{abovedisplayskip} to compensate for negative \cs{topsep}}
1046 %    \begin{macrocode}
1047     \addtolength\abovedisplayskip{\parskip}%
1048     \setlength\belowdisplayskip{\abovedisplayskip}%
1049     \setlength\belowdisplayshortskip{\abovedisplayskip}%
1050     \setlength\abovedisplayshortskip{\abovedisplayskip}%
1051     $$\everycr{}\halign to\linewidth% $$
1052     \bgroup
1053       \hskip\@centering
1054       $\displaystyle\tabskip\z@skip{##}$\@eqnsel&%
1055       \global\@eqcnt\@ne \hskip \tw@\arraycolsep \hfil${##}$\hfil&%
1056       \global\@eqcnt\tw@ \hskip \tw@\arraycolsep
1057         $\displaystyle{##}$\hfil \tabskip\@centering&%
1058       \global\@eqcnt\thr@@
1059         \hb@xt@\z@\bgroup\hss##\egroup\tabskip\z@skip\cr}%
1060       {\@@eqncr
1061     \egroup
1062     \global\advance\c@equation\m@ne$$% $$
1063     \@ignoretrue
1064     }
1065 %</fleqn>
1066 %    \end{macrocode}
1067 % \end{environment}
1071 % \Finale