]> AND Private Git Repository - LiCO.git/blob - PeCO-EO/amsmath.sty
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
avec reponse
[LiCO.git] / PeCO-EO / amsmath.sty
1 %%
2 %% This is file `amsmath.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% amsmath.dtx 
8 %% 
9 %%% ====================================================================
10 %%% @LaTeX-file{
11 %%%   filename  = "amsmath.dtx",
12 %%%   version   = "2.13",
13 %%%   date      = "2000/07/18",
14 %%%   time      = "08:16:41 EDT",
15 %%%   author    = "American Mathematical Society",
16 %%%   copyright = "Copyright 1995, 2000 American Mathematical Society,
17 %%%                all rights reserved.  Copying of this file is
18 %%%                authorized only if either:
19 %%%                (1) you make absolutely no changes to your copy,
20 %%%                including name; OR
21 %%%                (2) if you do make changes, you first rename it
22 %%%                to some other name.",
23 %%%   address   = "American Mathematical Society,
24 %%%                Technical Support,
25 %%%                Publications Technical Group,
26 %%%                P. O. Box 6248,
27 %%%                Providence, RI 02940,
28 %%%                USA",
29 %%%   telephone = "401-455-4080 or (in the USA and Canada)
30 %%%                800-321-4AMS (321-4267)",
31 %%%   FAX       = "401-331-3842",
32 %%%   checksum  = "38084 5829 21569 202795",
33 %%%   email     = "tech-support@ams.org (Internet)",
34 %%%   codetable = "ISO/ASCII",
35 %%%   keywords  = "latex, amslatex, math, amsmath",
36 %%%   supported = "yes",
37 %%%   abstract  = "This is a \LaTeX{} package that provides a variety of
38 %%%                extra mathematical features, largely derived from
39 %%%                AMS-\TeX{}.",
40 %%%   docstring = "The checksum field above contains a CRC-16 checksum
41 %%%                as the first value, followed by the equivalent of
42 %%%                the standard UNIX wc (word count) utility output of
43 %%%                lines, words, and characters.  This is produced by
44 %%%                Robert Solovay's checksum utility.",
45 %%% }
46 %%% ====================================================================
47 \NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX)
48 [1994/12/01]% LaTeX date must be December 1994 or later
49 \ProvidesPackage{amsmath}[2000/07/18 v2.13 AMS math features]
50 \edef\@temp{\catcode 96=\number\catcode 96 }
51 \catcode\string `\`=12
52 \def\do#1{\catcode\number`#1=\number\catcode`#1}
53 \edef\@temp{%
54   \noexpand\AtEndOfPackage{%
55     \@temp
56     \do\"\do\'\do\(\do\)\do\*\do\+\do\,\do\-\do\.%
57     \do\/\do\<\do\=\do\>\do\[\do\]\do\^\do\_\relax
58   }%
59 }
60 \@temp
61 \def\do#1{\catcode\number`#1=12 }
62 \do\"\do\'\do\(\do\)\do\*\do\+\do\,\do\-\do\.
63 \do\/\do\<\do\=\do\>\do\[\do\]
64 \catcode`\^=7 \catcode`\_=8
65 \DeclareOption{intlimits}{\let\ilimits@\displaylimits}
66 \DeclareOption{nointlimits}{\let\ilimits@\nolimits}
67 \DeclareOption{sumlimits}{\let\slimits@\displaylimits}
68 \DeclareOption{nosumlimits}{\let\slimits@\nolimits}
69 \DeclareOption{namelimits}{\PassOptionsToPackage{namelimits}{amsopn}}
70 \DeclareOption{nonamelimits}{%
71   \PassOptionsToPackage{nonamelimits}{amsopn}}
72 \newif\ifctagsplit@
73 \newif\iftagsleft@
74 \DeclareOption{leqno}{\tagsleft@true}
75 \DeclareOption{reqno}{\tagsleft@false}
76 \DeclareOption{centertags}{\ctagsplit@true}
77 \DeclareOption{tbtags}{\ctagsplit@false}
78 \DeclareOption{cmex10}{%
79   \ifnum\cmex@opt=\@ne \def\cmex@opt{0}%
80   \else \def\cmex@opt{10}\fi
81 }
82 \@ifundefined{cmex@opt}{\def\cmex@opt{7}}{}
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84 \newif\if@fleqn
85 \newskip\@mathmargin
86 \@mathmargin\@centering
87 \DeclareOption{fleqn}{%
88     \@fleqntrue
89     \@mathmargin = -1sp
90     \let\mathindent=\@mathmargin
91     \AtBeginDocument{%
92         \ifdim\@mathmargin= -1sp
93             \@mathmargin\leftmargini minus\leftmargini
94         \fi
95     }%
96 }
97 \DeclareOption{?}{}
98 \ExecuteOptions{nointlimits,sumlimits,namelimits,centertags}
99 \ProcessOptions\par
100 \@ifpackagewith{amsmath}{?}{%
101   \typeout{^^J%
102 Documentation for the amsmath package is found in amsldoc.dvi^^J%
103 (or .pdf or .tex).^^J%
104 ^^J%
105 See also http://www.ams.org/tex/amslatex.html.^^J%
106 ^^J%
107 Note: Using the first edition of The LaTeX Companion (1994) without^^J%
108 errata as a guide for amsmath use is not recommended.^^J%
109   }%
110 }{%
111   \typeout{%
112 For additional information on amsmath, use the \lq ?\rq\space option.%
113   }%
114 }
115 \ifnum\cmex@opt=7 \relax
116   \DeclareFontShape{OMX}{cmex}{m}{n}{%
117     <-8>cmex7<8>cmex8<9>cmex9%
118     <10><10.95><12><14.4><17.28><20.74><24.88>cmex10%
119   }{}%
120   \expandafter\let\csname OMX/cmex/m/n/10\endcsname\relax
121 \else
122   \ifnum\cmex@opt=\z@ % need to override cmex7 fontdef from amsfonts
123     \begingroup
124     \fontencoding{OMX}\fontfamily{cmex}%
125     \expandafter\let\csname OMX+cmex\endcsname\relax
126     \try@load@fontshape
127     \endgroup
128     \expandafter\let\csname OMX/cmex/m/n/10\endcsname\relax
129     \def\cmex@opt{10}%
130   \fi
131 \fi
132 \RequirePackage{amstext}[1995/01/25]
133 \RequirePackage{amsbsy}[1995/01/20]
134 \RequirePackage{amsopn}[1995/01/20]
135 \def\@amsmath@err{\PackageError{amsmath}}
136 \providecommand{\AmS}{{\protect\AmSfont
137   A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}
138 \newcommand{\AmSfont}{%
139   \usefont{OMS}{cmsy}{\if\@xp\@car\f@series\@nil bb\else m\fi}{n}}
140 \def\@mathmeasure#1#2#3{\setbox#1\hbox{\frozen@everymath\@emptytoks
141   \m@th$#2#3$}}
142 \@ifundefined{inf@bad}{%
143   \newcount\inf@bad \inf@bad=1000000 \relax
144 }{}
145 \DeclareRobustCommand{\tmspace}[3]{%
146   \ifmmode\mskip#1#2\else\kern#1#3\fi\relax}
147 \renewcommand{\,}{\tmspace+\thinmuskip{.1667em}}
148 \let\thinspace\,
149 \renewcommand{\!}{\tmspace-\thinmuskip{.1667em}}
150 \let\negthinspace\!
151 \renewcommand{\:}{\tmspace+\medmuskip{.2222em}}
152 \let\medspace\:
153 \newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}}
154 \renewcommand{\;}{\tmspace+\thickmuskip{.2777em}}
155 \let\thickspace\;
156 \newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}}
157 \newcommand{\mspace}[1]{\mskip#1\relax}
158 \def\@tempa#1#2\@nil{%
159   \ifx\delimiter#1\@tempcnta#2\relax\else\@tempcnta\z@\fi
160 }
161 \@xp\@tempa\vert\@empty\@nil
162 \ifnum\@tempcnta>\z@
163   \advance\@tempcnta "4000000
164   \xdef\lvert{\delimiter\number\@tempcnta\space }
165   \advance\@tempcnta "1000000
166   \xdef\rvert{\delimiter\number\@tempcnta\space }
167 \else
168   \ifx\@@undefined\lvert
169     % Fall back to cmex encoding since we don't know what else to do.
170     \DeclareMathDelimiter{\lvert}
171       {\mathopen}{symbols}{"6A}{largesymbols}{"0C}
172     \DeclareMathDelimiter{\rvert}
173       {\mathclose}{symbols}{"6A}{largesymbols}{"0C}
174   \fi
175 \fi
176 \@xp\@tempa\Vert\@empty\@nil
177 \ifnum\@tempcnta>\z@
178   \advance\@tempcnta "4000000
179   \xdef\lVert{\delimiter\number\@tempcnta\space }
180   \advance\@tempcnta "1000000
181   \xdef\rVert{\delimiter\number\@tempcnta\space }
182 \else
183   \ifx\@@undefined\lVert
184     \DeclareMathDelimiter{\lVert}
185       {\mathopen}{symbols}{"6B}{largesymbols}{"0D}
186     \DeclareMathDelimiter{\rVert}
187       {\mathclose}{symbols}{"6B}{largesymbols}{"0D}
188   \fi
189 \fi
190 \@saveprimitive\over\@@over
191 \@saveprimitive\atop\@@atop
192 \@saveprimitive\above\@@above
193 \@saveprimitive\overwithdelims\@@overwithdelims
194 \@saveprimitive\atopwithdelims\@@atopwithdelims
195 \@saveprimitive\abovewithdelims\@@abovewithdelims
196 \DeclareRobustCommand{\primfrac}[1]{%
197   \PackageWarning{amsmath}{%
198 Foreign command \@backslashchar#1;\MessageBreak
199 \protect\frac\space or \protect\genfrac\space should be used instead%
200 \MessageBreak
201   }
202   \global\@xp\let\csname#1\@xp\endcsname\csname @@#1\endcsname
203   \csname#1\endcsname
204 }
205 \renewcommand{\over}{\primfrac{over}}
206 \renewcommand{\atop}{\primfrac{atop}}
207 \renewcommand{\above}{\primfrac{above}}
208 \renewcommand{\overwithdelims}{\primfrac{overwithdelims}}
209 \renewcommand{\atopwithdelims}{\primfrac{atopwithdelims}}
210 \renewcommand{\abovewithdelims}{\primfrac{abovewithdelims}}
211 \DeclareRobustCommand{\frac}[2]{{\begingroup#1\endgroup\@@over#2}}
212 \newcommand{\dfrac}{\genfrac{}{}{}0}
213 \newcommand{\tfrac}{\genfrac{}{}{}1}
214 \DeclareRobustCommand{\binom}{\genfrac()\z@{}}
215 \newcommand{\dbinom}{\genfrac(){0pt}0}
216 \newcommand{\tbinom}{\genfrac(){0pt}1}
217 \DeclareRobustCommand{\genfrac}[4]{%
218   \def\@tempa{#1#2}%
219   \edef\@tempb{\@nx\@genfrac\@mathstyle{#4}%
220     \csname @@\ifx @#3@over\else above\fi
221     \ifx\@tempa\@empty \else withdelims\fi\endcsname}
222   \@tempb{#1#2#3}}
223 \def\@genfrac#1#2#3#4#5{{#1{\begingroup#4\endgroup#2#3\relax#5}}}
224 \def\@mathstyle#1{%
225   \ifx\@empty#1\@empty\relax
226   \else\ifcase#1\displaystyle % case 0
227     \or\textstyle\or\scriptstyle\else\scriptscriptstyle\fi\fi}
228 \begingroup
229 \edef\@tempa{\string\mathchar"}
230 \def\@tempb#1"#2\@nil{#1"}
231 \edef\@tempc{\expandafter\@tempb\meaning\coprod "\@nil}
232 \ifx\@tempa\@tempc
233   \global\let\coprod@\coprod
234   \gdef\coprod{\DOTSB\coprod@\slimits@}
235   \global\let\bigvee@\bigvee
236   \gdef\bigvee{\DOTSB\bigvee@\slimits@}
237   \global\let\bigwedge@\bigwedge
238   \gdef\bigwedge{\DOTSB\bigwedge@\slimits@}
239   \global\let\biguplus@\biguplus
240   \gdef\biguplus{\DOTSB\biguplus@\slimits@}
241   \global\let\bigcap@\bigcap
242   \gdef\bigcap{\DOTSB\bigcap@\slimits@}
243   \global\let\bigcup@\bigcup
244   \gdef\bigcup{\DOTSB\bigcup@\slimits@}
245   \global\let\prod@\prod
246   \gdef\prod{\DOTSB\prod@\slimits@}
247   \global\let\sum@\sum
248   \gdef\sum{\DOTSB\sum@\slimits@}
249   \global\let\bigotimes@\bigotimes
250   \gdef\bigotimes{\DOTSB\bigotimes@\slimits@}
251   \global\let\bigoplus@\bigoplus
252   \gdef\bigoplus{\DOTSB\bigoplus@\slimits@}
253   \global\let\bigodot@\bigodot
254   \gdef\bigodot{\DOTSB\bigodot@\slimits@}
255   \global\let\bigsqcup@\bigsqcup
256   \gdef\bigsqcup{\DOTSB\bigsqcup@\slimits@}
257 \fi
258 \endgroup
259 \newcommand{\leftroot}{\@amsmath@err{\Invalid@@\leftroot}\@eha}
260 \newcommand{\uproot}{\@amsmath@err{\Invalid@@\uproot}\@eha}
261 \newcount\uproot@
262 \newcount\leftroot@
263 \renewcommand{\root}{\relaxnext@
264   \DN@{\ifx\@let@token\uproot\let\next@\nextii@\else
265    \ifx\@let@token\leftroot\let\next@\nextiii@\else
266    \let\next@\plainroot@\fi\fi\next@}%
267   \def\nextii@\uproot##1{\uproot@##1\relax\FN@\nextiv@}%
268   \def\nextiv@{\ifx\@let@token\@sptoken\DN@. {\FN@\nextv@}\else
269    \DN@.{\FN@\nextv@}\fi\next@.}%
270   \def\nextv@{\ifx\@let@token\leftroot\let\next@\nextvi@\else
271    \let\next@\plainroot@\fi\next@}%
272   \def\nextvi@\leftroot##1{\leftroot@##1\relax\plainroot@}%
273    \def\nextiii@\leftroot##1{\leftroot@##1\relax\FN@\nextvii@}%
274   \def\nextvii@{\ifx\@let@token\@sptoken
275    \DN@. {\FN@\nextviii@}\else
276    \DN@.{\FN@\nextviii@}\fi\next@.}%
277   \def\nextviii@{\ifx\@let@token\uproot\let\next@\nextix@\else
278    \let\next@\plainroot@\fi\next@}%
279   \def\nextix@\uproot##1{\uproot@##1\relax\plainroot@}%
280   \bgroup\uproot@\z@\leftroot@\z@\FN@\next@}
281 \def\plainroot@#1\of#2{\setbox\rootbox\hbox{%
282  $\m@th\scriptscriptstyle{#1}$}%
283  \mathchoice{\r@@t\displaystyle{#2}}{\r@@t\textstyle{#2}}
284  {\r@@t\scriptstyle{#2}}{\r@@t\scriptscriptstyle{#2}}\egroup}
285
286 \@ifundefined{sqrtsign}{\let\sqrtsign\@@sqrt}{}
287 \def\r@@t#1#2{\setboxz@h{$\m@th#1\sqrtsign{#2}$}%
288  \dimen@\ht\z@\advance\dimen@-\dp\z@
289  \setbox\@ne\hbox{$\m@th#1\mskip\uproot@ mu$}%
290  \advance\dimen@ by1.667\wd\@ne
291  \mkern-\leftroot@ mu\mkern5mu\raise.6\dimen@\copy\rootbox
292  \mkern-10mu\mkern\leftroot@ mu\boxz@}
293 \@ifundefined{varGamma}{%
294   \DeclareMathSymbol{\varGamma}{\mathord}{letters}{"00}
295   \DeclareMathSymbol{\varDelta}{\mathord}{letters}{"01}
296   \DeclareMathSymbol{\varTheta}{\mathord}{letters}{"02}
297   \DeclareMathSymbol{\varLambda}{\mathord}{letters}{"03}
298   \DeclareMathSymbol{\varXi}{\mathord}{letters}{"04}
299   \DeclareMathSymbol{\varPi}{\mathord}{letters}{"05}
300   \DeclareMathSymbol{\varSigma}{\mathord}{letters}{"06}
301   \DeclareMathSymbol{\varUpsilon}{\mathord}{letters}{"07}
302   \DeclareMathSymbol{\varPhi}{\mathord}{letters}{"08}
303   \DeclareMathSymbol{\varPsi}{\mathord}{letters}{"09}
304   \DeclareMathSymbol{\varOmega}{\mathord}{letters}{"0A}
305 }{}
306 \@saveprimitive\overline\@@overline
307 \DeclareRobustCommand{\overline}[1]{\@@overline{#1}}
308 \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}}
309 \newcommand{\implies}{\DOTSB\;\Longrightarrow\;}
310 \newcommand{\impliedby}{\DOTSB\;\Longleftarrow\;}
311 \def\And{\DOTSB\;\mathchar"3026 \;}
312 \newcommand{\nobreakdash}{\leavevmode
313   \toks@\@emptytoks \def\@tempa##1{\toks@\@xp{\the\toks@-}\FN@\next@}%
314   \DN@{\ifx\@let@token-\@xp\@tempa
315        \else\setboxz@h{\the\toks@\nobreak}\unhbox\z@\fi}%
316   \FN@\next@
317 }
318 \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript
319   \mkern-\thinmuskip{:}\mskip6muplus1mu\relax}
320 \let\ifgtest@\iffalse                              % initial value
321 \def\gtest@true{\global\let\ifgtest@\iftrue}
322 \def\gtest@false{\global\let\ifgtest@\iffalse}
323 \let\DOTSI\relax
324 \let\DOTSB\relax
325 \let\DOTSX\relax
326 {\uccode`7=`\\ \uccode`8=`m \uccode`9=`a \uccode`0=`t \uccode`!=`h
327  \uppercase{%
328   \gdef\math@#1#2#3#4#5#6\math@{\gtest@false\ifx 7#1\ifx 8#2%
329   \ifx 9#3\ifx 0#4\ifx !#5\xdef\meaning@{#6}\gtest@true
330   \fi\fi\fi\fi\fi}}}
331 {\uccode`7=`c \uccode`8=`h \uccode`9=`\"
332  \uppercase{\gdef\mathch@#1#2#3#4#5#6\mathch@{\gtest@false
333   \ifx 7#1\ifx 8#2\ifx 9#5\gtest@true\xdef\meaning@{9#6}\fi\fi\fi}}}
334 \newcount\classnum@
335 \def\getmathch@#1.#2\getmathch@{\classnum@#1 \divide\classnum@4096
336  \ifcase\number\classnum@\or\or\gdef\thedots@{\dotsb@}\or
337  \gdef\thedots@{\dotsb@}\fi}
338 {\uccode`4=`b \uccode`5=`i \uccode`6=`n
339  \uppercase{\gdef\mathbin@#1#2#3{\relaxnext@
340   \def\nextii@##1\mathbin@{\ifx\@sptoken\@let@token\gtest@true\fi}%
341   \gtest@false\DN@##1\mathbin@{}%
342  \ifx 4#1\ifx 5#2\ifx 6#3\DN@{\FN@\nextii@}\fi\fi\fi\next@}}}
343 {\uccode`4=`r \uccode`5=`e \uccode`6=`l
344  \uppercase{\gdef\mathrel@#1#2#3{\relaxnext@
345   \def\nextii@##1\mathrel@{\ifx\@sptoken\@let@token\gtest@true\fi}%
346  \gtest@false\DN@##1\mathrel@{}%
347  \ifx 4#1\ifx 5#2\ifx 6#3\DN@{\FN@\nextii@}\fi\fi\fi\next@}}}
348 {\uccode`5=`m \uccode`6=`a \uccode`7=`c
349  \uppercase{\gdef\macro@#1#2#3#4\macro@{\gtest@false
350   \ifx 5#1\ifx 6#2\ifx 7#3\gtest@true
351   \xdef\meaning@{\macro@@#4\macro@@}\fi\fi\fi}}}
352 \def\macro@@#1->#2\macro@@{#2}
353 \newcount\DOTSCASE@
354 {\uccode`6=`\\ \uccode`7=`D \uccode`8=`O \uccode`9=`T \uccode`0=`S
355  \uppercase{\gdef\DOTS@#1#2#3#4#5{\gtest@false\DN@##1\DOTS@{}%
356   \ifx 6#1\ifx 7#2\ifx 8#3\ifx 9#4\ifx 0#5\let\next@\DOTS@@
357   \fi\fi\fi\fi\fi
358   \next@}}}
359 {\uccode`3=`B \uccode`4=`I \uccode`5=`X
360  \uppercase{\gdef\DOTS@@#1{\relaxnext@
361   \def\nextii@##1\DOTS@{\ifx\@sptoken\@let@token\gtest@true\fi}%
362   \DN@{\FN@\nextii@}%
363   \ifx 3#1\global\DOTSCASE@\z@\else
364   \ifx 4#1\global\DOTSCASE@\@ne\else
365   \ifx 5#1\global\DOTSCASE@\tw@\else\DN@##1\DOTS@{}%
366   \fi\fi\fi\next@}}}
367 {\uccode`5=`\\ \uccode`6=`n \uccode`7=`o \uccode`8=`t
368  \uppercase{\gdef\not@#1#2#3#4{\relaxnext@
369   \def\nextii@##1\not@{\ifx\@sptoken\@let@token\gtest@true\fi}%
370  \gtest@false\DN@##1\not@{}%
371  \ifx 5#1\ifx 6#2\ifx 7#3\ifx 8#4\DN@{\FN@\nextii@}\fi\fi\fi
372  \fi\next@}}}
373 \def\keybin@{\gtest@true
374  \ifx\@let@token+\else\ifx\@let@token=\else
375  \ifx\@let@token<\else\ifx\@let@token>\else
376  \ifx\@let@token-\else\ifx\@let@token*\else\ifx\@let@token:\else
377    \gtest@false\fi\fi\fi\fi\fi\fi\fi}
378 \@ifundefined{@ldots}{\def\@ldots{\mathellipsis}}{}
379 \DeclareRobustCommand{\ldots}{%
380   \ifmmode \mathellipsis \else \textellipsis \fi
381 }
382 \DeclareRobustCommand{\dots}{%
383   \ifmmode \@xp\mdots@\else \@xp\textellipsis \fi
384 }
385 \def\tdots@{\leavevmode\unskip\relaxnext@
386  \DN@{$\m@th\@ldots\,
387    \ifx\@let@token,\,$\else\ifx\@let@token.\,$\else
388    \ifx\@let@token;\,$\else\ifx\@let@token:\,$\else
389    \ifx\@let@token?\,$\else\ifx\@let@token!\,$\else
390      $ \fi\fi\fi\fi\fi\fi}%
391   \ \FN@\next@}
392 \def\mdots@{\FN@\mdots@@}
393 \def\mdots@@{\gdef\thedots@{\dotso@}%
394  \ifx\@let@token\boldsymbol \gdef\thedots@\boldsymbol{\boldsymboldots@}%
395  \else\ifx,\@let@token \gdef\thedots@{\dotsc}%
396  \else\ifx\not\@let@token \gdef\thedots@{\dotsb@}%
397  \else\keybin@
398  \ifgtest@\gdef\thedots@{\dotsb@}%
399  \else\xdef\meaning@{\meaning\@let@token..........}%
400    \xdef\meaning@@{\meaning@}%
401   \@xp\math@\meaning@\math@
402   \ifgtest@
403    \@xp\mathch@\meaning@\mathch@
404    \ifgtest@\@xp\getmathch@\meaning@\getmathch@\fi
405   \else\@xp\macro@\meaning@@\macro@
406   \ifgtest@
407    \@xp\not@\meaning@\not@\ifgtest@\gdef\thedots@{\dotsb@}%
408   \else\@xp\DOTS@\meaning@\DOTS@
409   \ifgtest@
410    \ifcase\number\DOTSCASE@\gdef\thedots@{\dotsb@}%
411     \or\gdef\thedots@{\dotsi}\else\fi
412   \else\@xp\math@\meaning@\math@
413   \ifgtest@\@xp\mathbin@\meaning@\mathbin@
414   \ifgtest@\gdef\thedots@{\dotsb@}%
415   \else\@xp\mathrel@\meaning@\mathrel@
416   \ifgtest@\gdef\thedots@{\dotsb@}%
417   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
418  \thedots@}
419 \def\boldsymboldots@#1{%
420   \bold@true\let\@let@token=#1\let\delayed@=#1\mdots@@
421   \boldsymbol#1\bold@false}
422 \def\@cdots{\mathinner{\cdotp\cdotp\cdotp}}
423 \newcommand{\dotsi}{\!\@cdots}
424 \let\dotsb@\@cdots
425 \def\rightdelim@{\gtest@true
426  \ifx\@let@token)\else
427  \ifx\@let@token]\else
428  \ifx\@let@token\rbrack\else
429  \ifx\@let@token\}\else
430  \ifx\@let@token\rbrace\else
431  \ifx\@let@token\rangle\else
432  \ifx\@let@token\rceil\else
433  \ifx\@let@token\rfloor\else
434  \ifx\@let@token\rgroup\else
435  \ifx\@let@token\rmoustache\else
436  \ifx\@let@token\right\else
437  \ifx\@let@token\bigr\else
438  \ifx\@let@token\biggr\else
439  \ifx\@let@token\Bigr\else
440  \ifx\@let@token\Biggr\else\gtest@false
441  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
442 \def\extra@{%
443  \rightdelim@\ifgtest@
444  \else\ifx\@let@token$\gtest@true
445  \else\xdef\meaning@{\meaning\@let@token..........}%
446  \@xp\macro@\meaning@\macro@\ifgtest@
447  \@xp\DOTS@\meaning@\DOTS@
448  \ifgtest@
449  \ifnum\DOTSCASE@=\tw@\gtest@true\else\gtest@false
450  \fi\fi\fi\fi\fi}
451 \newif\ifbold@
452 \def\dotso@{\relaxnext@
453  \ifbold@
454   \let\@let@token\delayed@
455   \def\nextii@{\extra@\@ldots\ifgtest@\,\fi}%
456  \else
457   \def\nextii@{\DN@{\extra@\@ldots\ifgtest@\,\fi}\FN@\next@}%
458  \fi
459  \nextii@}
460 \def\extrap@#1{%
461  \DN@{#1\,}%
462  \ifx\@let@token,\else
463  \ifx\@let@token;\else
464  \ifx\@let@token.\else\extra@
465  \ifgtest@\else
466  \let\next@#1\fi\fi\fi\fi\next@}
467 \DeclareRobustCommand{\cdots}{\DN@{\extrap@\@cdots}\FN@\next@}
468 \let\dotsb\cdots
469 \let\dotsm\cdots
470 \DeclareRobustCommand{\dotso}{\relax
471   \ifmmode \DN@{\extrap@\@ldots}%
472   \else \let\next@\tdots@\fi
473   \FN@\next@}
474 \DeclareRobustCommand{\dotsc}{%
475   \DN@{\ifx\@let@token;\@ldots\,%
476        \else \ifx\@let@token.\@ldots\,%
477        \else \extra@\@ldots \ifgtest@\,\fi
478        \fi\fi}%
479   \FN@\next@}
480 \renewcommand{\longrightarrow}{%
481   \DOTSB\protect\relbar\protect\joinrel\rightarrow}
482 \renewcommand{\Longrightarrow}{%
483   \DOTSB\protect\Relbar\protect\joinrel\Rightarrow}
484 \renewcommand{\longleftarrow}{%
485   \DOTSB\leftarrow\protect\joinrel\protect\relbar}
486 \renewcommand{\Longleftarrow}{%
487   \DOTSB\Leftarrow\protect\joinrel\protect\Relbar}
488 \renewcommand{\longleftrightarrow}{\DOTSB\leftarrow\joinrel\rightarrow}
489 \renewcommand{\Longleftrightarrow}{\DOTSB\Leftarrow\joinrel\Rightarrow}
490 \renewcommand{\mapsto}{\DOTSB\mapstochar\rightarrow}
491 \renewcommand{\longmapsto}{\DOTSB\mapstochar\longrightarrow}
492 \renewcommand{\hookrightarrow}{\DOTSB\lhook\joinrel\rightarrow}
493 \renewcommand{\hookleftarrow}{\DOTSB\leftarrow\joinrel\rhook}
494 \renewcommand{\iff}{\DOTSB\;\Longleftrightarrow\;}
495 \renewcommand{\doteq}{%
496   \DOTSB\mathrel{\mathop{\kern0pt =}\limits^{\textstyle.}}}
497 \newif\if@display
498 \everydisplay\@xp{\the\everydisplay \@displaytrue}
499 \renewcommand{\int}{\DOTSI\intop\ilimits@}
500 \renewcommand{\oint}{\DOTSI\ointop\ilimits@}
501 \def\intkern@{\mkern-6mu\mathchoice{\mkern-3mu}{}{}{}}
502 \def\intdots@{\mathchoice{\@cdots}%
503  {{\cdotp}\mkern1.5mu{\cdotp}\mkern1.5mu{\cdotp}}%
504  {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}%
505  {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}}
506 \newcommand{\iint}{\DOTSI\protect\MultiIntegral{2}}
507 \newcommand{\iiint}{\DOTSI\protect\MultiIntegral{3}}
508 \newcommand{\iiiint}{\DOTSI\protect\MultiIntegral{4}}
509 \newcommand{\idotsint}{\DOTSI\protect\MultiIntegral{0}}
510 \newcommand{\MultiIntegral}[1]{%
511   \edef\ints@c{\noexpand\intop
512     \ifnum#1=\z@\noexpand\intdots@\else\noexpand\intkern@\fi
513     \ifnum#1>\tw@\noexpand\intop\noexpand\intkern@\fi
514     \ifnum#1>\thr@@\noexpand\intop\noexpand\intkern@\fi
515     \noexpand\intop
516     \noexpand\ilimits@
517   }%
518   \futurelet\@let@token\ints@a
519 }
520 \def\ints@a{%
521   \ifx\limits\@let@token \ints@b
522   \else \ifx\displaylimits\@let@token \ints@b
523   \else\ifx\ilimits@\displaylimits \ints@b
524   \fi\fi\fi
525   \ints@c
526 }
527 \def\ints@b{%
528   \mkern-7mu\mathchoice{\mkern-2mu}{}{}{}%
529   \mathop\bgroup
530     \mkern7mu\mathchoice{\mkern2mu}{}{}{}%
531     \let\ilimits@\egroup
532 }%
533 \newbox\Mathstrutbox@
534 \setbox\Mathstrutbox@=\hbox{}
535 \def\Mathstrut@{\copy\Mathstrutbox@}
536 \def\resetMathstrut@{%
537   \setbox\z@\hbox{%
538     \mathchardef\@tempa\mathcode`\(\relax
539     \def\@tempb##1"##2##3{\the\textfont"##3\char"}%
540     \expandafter\@tempb\meaning\@tempa \relax
541   }%
542   \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@
543 }
544 \addto@hook\every@math@size{\resetMathstrut@}
545 \newbox\strutbox@
546 \def\strut@{\copy\strutbox@}
547 \def\reset@strutbox@{%
548   \global\setbox\strutbox@\hbox{%
549     \lower.5\normallineskiplimit
550        \vbox{\kern-\normallineskiplimit\copy\strutbox}}}
551 \addto@hook\every@math@size{\reset@strutbox@}
552 \AtBeginDocument{\reset@strutbox@}
553 \renewcommand{\big}{\bBigg@\@ne}
554 \renewcommand{\Big}{\bBigg@{1.5}}
555 \renewcommand{\bigg}{\bBigg@\tw@}
556 \renewcommand{\Bigg}{\bBigg@{2.5}}
557 \def\bBigg@#1#2{%
558   {\@mathmeasure\z@{\nulldelimiterspace\z@}%
559      {\left#2\vcenter to#1\big@size{}\right.}%
560    \box\z@}}
561 \addto@hook\every@math@size{%
562   \global\big@size 1.2\ht\Mathstrutbox@
563   \global\advance\big@size 1.2\dp\Mathstrutbox@ }
564 \newdimen\big@size
565 \def\accentclass@{7}
566 \def\noaccents@{\def\accentclass@{0}}
567 \DeclareFontEncoding{OML}{}{\noaccents@}
568 \DeclareFontEncoding{OMS}{}{\noaccents@}
569 \newcommand{\dddot}[1]{%
570   {\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@
571    \hbox{\normalfont ...}\vss}}}}
572 \newcommand{\ddddot}[1]{%
573   {\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@
574    \hbox{\normalfont....}\vss}}}}
575 \def\set@mathaccent#1#2#3#4{%
576   \xdef#2{\@nx\protect\@nx\mathaccentV
577     {\@xp\@gobble\string#2}\hexnumber@#1#4}%
578 }
579 \def\@tempa#1{\@xp\@tempb\meaning#1\@nil#1}
580 \def\@tempb#1>#2#3 #4\@nil#5{%
581   \@xp\ifx\csname#3\endcsname\mathaccent
582     \@tempc#4?"7777\@nil#5%
583   \else
584     \PackageWarningNoLine{amsmath}{%
585       Unable to redefine math accent \string#5}%
586   \fi
587 }
588 \def\@tempc#1"#2#3#4#5#6\@nil#7{%
589   \chardef\@tempd="#3\relax\set@mathaccent\@tempd{#7}{#2}{#4#5}}
590 \@tempa{\hat}
591 \@tempa{\check}
592 \@tempa{\tilde}
593 \@tempa{\acute}
594 \@tempa{\grave}
595 \@tempa{\dot}
596 \@tempa{\ddot}
597 \@tempa{\breve}
598 \@tempa{\bar}
599 \@tempa{\vec}
600 \@ifundefined{mathring}{%
601   \DeclareMathAccent{\mathring}{\mathalpha}{operators}{"17}
602 }{%
603   \@tempa{\mathring}
604 }
605 %%\@tempa\widetilde
606 %%\@tempa\widehat
607 \newcommand{\acc@check}{}
608 \newcommand{\acc@error}{}
609 \def\acc@check{\@ifnextchar\@empty\relax\acc@error}
610 \def\acc@error{%
611   \@amsmath@err{%
612     Improper argument for math accent:\MessageBreak
613     Extra braces must be added to prevent wrong output%
614   }\@ehc
615 }
616 \newcount\macc@depth
617 \long\def\@gobblethree#1#2#3{}
618 \def\mathaccentV#1#2#3#4#5{%
619   \ifmmode
620     \gdef\macc@tmp{\macc@depth\@ne}%
621     \setbox\z@\hbox{%
622       \let\mathaccentV\macc@test
623       \let\use@mathgroup\@gobbletwo \let\select@group\@gobblethree
624       \frozen@everymath{}$#5$%
625     }%
626     \macc@tmp
627     \ifnum\macc@depth=\@ne
628       \global\let\macc@nucleus\@empty
629       \mathaccent"\accentclass@
630     \else
631       \@xp\macc@nested
632     \fi
633     #2#3#4{#5}%
634     \macc@nucleus
635   \else
636     \@xp\nonmatherr@\csname#1\endcsname
637   \fi
638 }
639 \def\macc@test#1#2#3#4{\xdef\macc@tmp{\macc@tmp\advance\macc@depth\@ne}}
640 \def\macc@group{-1}
641 \def\macc@nested#1#2#3#4{%
642   \begingroup
643   \let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar
644   \mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}%
645   \macc@set@skewchar\relax
646   \let\mathaccentV\macc@nested@a
647   \macc@nested@a\relax#1#2#3{#4}%
648   \endgroup
649 }
650 \let\macc@palette\mathpalette
651 \def\macc@nested@a#1#2#3#4#5{%
652   \ifnum\macc@group=\mathgroup
653   \else \macc@set@skewchar\relax \edef\macc@group{\the\mathgroup}%
654   \fi
655   \mathchardef\macc@code "\accentclass@ #2#3#4\relax
656   \macc@palette\macc@a{#5}%
657 }
658 \def\macc@set@skewchar#1{%
659   \begingroup
660   \ifnum\mathgroup=\m@ne \let\@tempa\@ne
661   \else
662     \ifnum\skewchar\textfont\mathgroup=\m@ne \let\@tempa\@ne
663     \else \let\@tempa\mathgroup
664     \fi
665   \fi
666   \count@=\skewchar\textfont\@tempa
667   \advance\count@"7100
668   \edef\@tempa{\endgroup
669     \mathchardef\noexpand\macc@skewchar=\number\count@\relax}%
670   \@tempa
671   #1%
672 }
673 \def\macc@a#1#2{%
674   \begingroup
675   \let\macc@style#1\relax
676   \def\macc@palette##1{##1\macc@style}%
677   \advance\macc@depth\m@ne
678   \ifnum\macc@depth=\z@
679     \gdef\macc@nucleus{#2}%
680     \setbox\z@\hbox{$#1#2\@empty{}\macc@skewchar$}%
681     \setbox\tw@\hbox{$#1#2\@empty\macc@skewchar$}%
682     \dimen@\tw@\wd\tw@ \advance\dimen@-\tw@\wd\z@
683     \xdef\macc@kerna{\the\dimen@\relax}%
684     \setbox4\hbox{$#1#2\acc@check\@empty$}%
685     \global\setbox\@ne\hbox to\wd4{}%
686     \ht\@ne\ht4 \dp\@ne\dp4
687     \xdef\macc@kernb{\the\wd4\relax}%
688     \mathaccent\macc@code{\box\@ne\kern\macc@kerna}%
689   \else
690     \mathaccent\macc@code{\let\macc@adjust\@empty #1#2\@empty}%
691     \macc@adjust
692   \fi
693   \endgroup
694 }
695 \def\macc@adjust{%
696   \dimen@\macc@kerna\advance\dimen@\macc@kernb
697   \kern-\dimen@
698 }
699 \def\Hat{\hat}
700 \def\Check{\check}
701 \def\Tilde{\tilde}
702 \def\Acute{\acute}
703 \def\Grave{\grave}
704 \def\Dot{\dot}
705 \def\Ddot{\ddot}
706 \def\Breve{\breve}
707 \def\Bar{\bar}
708 \def\Vec{\vec}
709 \def\nonmatherr@#1{\@amsmath@err{\protect
710   #1 allowed only in math mode}\@ehd}
711 \renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin
712   {\operator@font mod}\penalty900
713   \mkern5mu\nonscript\mskip-\medmuskip}
714 \newcommand{\pod}[1]{\allowbreak
715   \if@display\mkern18mu\else\mkern8mu\fi(#1)}
716 \renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}}
717 \newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu
718   \else\mkern12mu\fi{\operator@font mod}\,\,#1}
719 \newcommand{\cfrac}[3][c]{{\displaystyle\frac{%
720   \strut\ifx r#1\hfill\fi#2\ifx l#1\hfill\fi}{#3}}%
721   \kern-\nulldelimiterspace}
722 \newcommand{\overset}[2]{\binrel@{#2}%
723   \binrel@@{\mathop{\kern\z@#2}\limits^{#1}}}
724 \newcommand{\underset}[2]{\binrel@{#2}%
725   \binrel@@{\mathop{\kern\z@#2}\limits_{#1}}}
726 \newcommand{\sideset}[3]{%
727   \@mathmeasure\z@\displaystyle{#3}%
728   \global\setbox\@ne\vbox to\ht\z@{}\dp\@ne\dp\z@
729   \setbox\tw@\box\@ne
730   \@mathmeasure4\displaystyle{\copy\tw@#1}%
731   \@mathmeasure6\displaystyle{#3\nolimits#2}%
732   \dimen@-\wd6 \advance\dimen@\wd4 \advance\dimen@\wd\z@
733   \hbox to\dimen@{}\mathop{\kern-\dimen@\box4\box6}%
734 }
735 \renewcommand{\smash}[1][tb]{%
736   \def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}%
737   \edef\finsm@sh{\csname mb@#1\endcsname\z@\z@ \box\z@}%
738   \ifmmode \@xp\mathpalette\@xp\mathsm@sh
739   \else \@xp\makesm@sh
740   \fi
741 }
742 \mathchardef\std@minus\mathcode`\-\relax
743 \mathchardef\std@equal\mathcode`\=\relax
744 \AtBeginDocument{%
745   \mathchardef\std@minus\mathcode`\-\relax
746   \mathchardef\std@equal\mathcode`\=\relax
747 }
748 \def\relbar{\mathrel{\mathpalette\mathsm@sh\std@minus}}
749 \def\Relbar{\mathrel\std@equal}
750 \def\arrowfill@#1#2#3#4{%
751   $\m@th\thickmuskip0mu\medmuskip\thickmuskip\thinmuskip\thickmuskip
752    \relax#4#1\mkern-7mu%
753    \cleaders\hbox{$#4\mkern-2mu#2\mkern-2mu$}\hfill
754    \mkern-7mu#3$%
755 }
756 \def\leftarrowfill@{\arrowfill@\leftarrow\relbar\relbar}
757 \def\rightarrowfill@{\arrowfill@\relbar\relbar\rightarrow}
758 \def\leftrightarrowfill@{\arrowfill@\leftarrow\relbar\rightarrow}
759 \def\Leftarrowfill@{\arrowfill@\Leftarrow\Relbar\Relbar}
760 \def\Rightarrowfill@{\arrowfill@\Relbar\Relbar\Rightarrow}
761 \def\Leftrightarrowfill@{\arrowfill@\Leftarrow\Relbar\Rightarrow}
762 \def\overarrow@#1#2#3{\vbox{\ialign{##\crcr#1#2\crcr
763  \noalign{\nointerlineskip}$\m@th\hfil#2#3\hfil$\crcr}}}
764 \renewcommand{\overrightarrow}{%
765   \mathpalette{\overarrow@\rightarrowfill@}}
766 \renewcommand{\overleftarrow}{%
767   \mathpalette{\overarrow@\leftarrowfill@}}
768 \newcommand{\overleftrightarrow}{%
769   \mathpalette{\overarrow@\leftrightarrowfill@}}
770 \def\underarrow@#1#2#3{%
771  \vtop{\ialign{##\crcr$\m@th\hfil#2#3\hfil$\crcr
772  \noalign{\nointerlineskip\kern1.3\ex@}#1#2\crcr}}}
773 \newcommand{\underrightarrow}{%
774   \mathpalette{\underarrow@\rightarrowfill@}}
775 \newcommand{\underleftarrow}{%
776   \mathpalette{\underarrow@\leftarrowfill@}}
777 \newcommand{\underleftrightarrow}{%
778   \mathpalette{\underarrow@\leftrightarrowfill@}}
779 \def\ext@arrow#1#2#3#4#5#6#7{%
780   \mathrel{\mathop{%
781     \setbox\z@\hbox{#5\displaystyle}%
782     \setbox\tw@\vbox{\m@th
783       \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}%
784       \hbox{$\scriptstyle\mkern#3mu{#7}\mkern#4mu$}%
785       \copy\z@
786     }%
787     \hbox to\wd\tw@{\unhbox\z@}}%
788   \limits
789     \@ifnotempty{#7}{^{\if0#1\else\mkern#1mu\fi
790                        #7\if0#2\else\mkern#2mu\fi}}%
791     \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi
792                        #6\if0#2\else\mkern#2mu\fi}}}%
793 }
794 \newcommand{\xrightarrow}[2][]{\ext@arrow 0359\rightarrowfill@{#1}{#2}}
795 \newcommand{\xleftarrow}[2][]{\ext@arrow 3095\leftarrowfill@{#1}{#2}}
796 \newenvironment{subarray}[1]{%
797   \vcenter\bgroup
798   \Let@ \restore@math@cr \default@tag
799   \baselineskip\fontdimen10 \scriptfont\tw@
800   \advance\baselineskip\fontdimen12 \scriptfont\tw@
801   \lineskip\thr@@\fontdimen8 \scriptfont\thr@@
802   \lineskiplimit\lineskip
803   \ialign\bgroup\ifx c#1\hfil\fi
804     $\m@th\scriptstyle##$\hfil\crcr
805 }{%
806   \crcr\egroup\egroup
807 }
808 \newcommand{\substack}[1]{\subarray{c}#1\endsubarray}
809 \newenvironment{smallmatrix}{\null\,\vcenter\bgroup
810   \Let@\restore@math@cr\default@tag
811   \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
812   \ialign\bgroup\hfil$\m@th\scriptstyle##$\hfil&&\thickspace\hfil
813   $\m@th\scriptstyle##$\hfil\crcr
814 }{%
815   \crcr\egroup\egroup\,%
816 }
817 \renewenvironment{matrix}{%
818   \matrix@check\matrix\env@matrix
819 }{%
820   \endarray \hskip -\arraycolsep
821 }
822 \def\env@matrix{\hskip -\arraycolsep
823   \let\@ifnextchar\new@ifnextchar
824   \array{*\c@MaxMatrixCols c}}
825 \newcount\c@MaxMatrixCols \c@MaxMatrixCols=10
826 \def\matrix@check#1{%
827   \@xp\ifx\csname\@currenvir\endcsname#1%
828   \else\matrix@error#1%
829     \@xp\@gobble
830   \fi
831 }
832 \def\matrix@error#1{%
833   \@amsmath@err{%
834 Old form `\string#1' should be \string\begin{\@xp\@gobble\string#1}%
835   }{%
836 `\string#1{...}' is old Plain-TeX syntax whose use is
837 ill-advised in LaTeX.%
838   }%
839 }
840 \renewenvironment{pmatrix}{%
841   \left(%
842   \matrix@check\pmatrix\env@matrix
843 }{
844   \endmatrix\right)%
845 }
846 \newenvironment{bmatrix}{\left[\env@matrix}{\endmatrix\right]}
847 \newenvironment{Bmatrix}{%
848   \left\lbrace\env@matrix
849 }{%
850   \endmatrix\right\rbrace
851 }
852 \newenvironment{vmatrix}{\left\lvert\env@matrix}{\endmatrix\right\rvert}
853 \newenvironment{Vmatrix}{\left\lVert\env@matrix}{\endmatrix\right\rVert}
854 \let\hdots\@ldots
855 \newcommand{\hdotsfor}[1]{%
856   \ifx[#1\@xp\shdots@for\else\hdots@for\@ne{#1}\fi}
857 \newmuskip\dotsspace@
858 \def\shdots@for#1]{\hdots@for{#1}}
859 \def\hdots@for#1#2{\multicolumn{#2}c%
860   {\m@th\dotsspace@1.5mu\mkern-#1\dotsspace@
861    \xleaders\hbox{$\m@th\mkern#1\dotsspace@.\mkern#1\dotsspace@$}%
862            \hfill
863    \mkern-#1\dotsspace@}%
864    }
865 \renewenvironment{cases}{%
866   \matrix@check\cases\env@cases
867 }{%
868   \endarray\right.%
869 }
870 \def\env@cases{%
871   \let\@ifnextchar\new@ifnextchar
872   \left\lbrace
873   \def\arraystretch{1.2}%
874   \array{@{}l@{\quad}l@{}}%
875 }
876 \newcounter{parentequation}% Counter for ``parent equation''.
877 \@ifundefined{ignorespacesafterend}{%
878   \def\ignorespacesafterend{\global\@ignoretrue}%
879 }{}
880 \newenvironment{subequations}{%
881   \refstepcounter{equation}%
882   \protected@edef\theparentequation{\theequation}%
883   \setcounter{parentequation}{\value{equation}}%
884   \setcounter{equation}{0}%
885   \def\theequation{\theparentequation\alph{equation}}%
886   \ignorespaces
887 }{%
888   \setcounter{equation}{\value{parentequation}}%
889   \ignorespacesafterend
890 }
891 \newcommand{\numberwithin}[3][\arabic]{%
892   \@ifundefined{c@#2}{\@nocounterr{#2}}{%
893     \@ifundefined{c@#3}{\@nocnterr{#3}}{%
894       \@addtoreset{#2}{#3}%
895       \@xp\xdef\csname the#2\endcsname{%
896         \@xp\@nx\csname the#3\endcsname .\@nx#1{#2}}}}%
897 }
898 \newcommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}}
899 \newcount\dspbrk@lvl
900 \dspbrk@lvl=-1
901 \interdisplaylinepenalty\@M
902 \newcommand{\allowdisplaybreaks}[1][4]{%
903   \interdisplaylinepenalty\getdsp@pen{#1}\relax
904 }
905 \def\getdsp@pen#1{%
906   \ifcase #1\@M \or 9999 \or 6999 \or 2999 \or \z@\fi
907 }
908 \newcommand{\displaybreak}{\new@ifnextchar[\dspbrk@{\dspbrk@[4]}}
909 \chardef\dspbrk@context=\sixt@@n
910 \def\dspbrk@[#1]{%
911   \ifmeasuring@
912   \else
913     \ifcase\dspbrk@context % case 0 --- OK
914       \global\dspbrk@lvl #1\relax
915     \or                    % case 1 --- inside a box
916       \nogood@displaybreak
917     \else                  % other cases --- outside of a display
918       \@amsmath@err{\Invalid@@\displaybreak}\@eha
919     \fi
920   \fi
921 }
922 \def\nogood@displaybreak{%
923   \@amsmath@err{\protect
924 \displaybreak\space cannot be applied here}%
925 {One of the enclosing environments creates an
926   unbreakable box\MessageBreak
927 (e.g., split, aligned, gathered, ...).}%
928 }
929 \def\math@cr{\relax\iffalse{\fi\ifnum0=`}\fi
930   \@ifstar{\global\@eqpen\@M\math@cr@}%
931           {\global\@eqpen
932              \ifnum\dspbrk@lvl <\z@ \interdisplaylinepenalty
933               \else -\@getpen\dspbrk@lvl \fi
934            \math@cr@}}
935 \def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}}
936 \def\math@cr@@[#1]{\ifnum0=`{\fi \iffalse}\fi\math@cr@@@
937   \noalign{\vskip#1\relax}}
938 \def\Let@{\let\\\math@cr}
939 \def\restore@math@cr{\def\math@cr@@@{\cr}}
940 \restore@math@cr
941 \newcommand{\intertext}{\@amsmath@err{\Invalid@@\intertext}\@eha}
942 \def\intertext@{%
943   \def\intertext##1{%
944     \ifvmode\else\\\@empty\fi
945     \noalign{%
946       \penalty\postdisplaypenalty\vskip\belowdisplayskip
947       \vbox{\normalbaselines
948         \ifdim\linewidth=\columnwidth
949         \else \parshape\@ne \@totalleftmargin \linewidth
950         \fi
951         \noindent##1\par}%
952       \penalty\predisplaypenalty\vskip\abovedisplayskip%
953     }%
954 }}
955 \newhelp\tag@help
956   {tag cannot be used at this point.\space
957    If you don't understand why^^Jyou should consult
958    the documentation.^^JBut don't worry: just continue, and I'll
959    forget what happened.}
960 \def\gobble@tag{\@ifstar\@gobble\@gobble}
961 \def\invalid@tag#1{\@amsmath@err{#1}{\the\tag@help}\gobble@tag}
962 \def\dft@tag{\invalid@tag{\string\tag\space not allowed here}}
963 \def\default@tag{\let\tag\dft@tag}
964 \default@tag
965 \def\maketag@@{\@ifstar\maketag@@@\tagform@}
966 \def\maketag@@@#1{\hbox{\m@th\normalfont#1}}
967 \def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}}
968 \iftagsleft@
969   \def\@eqnnum{\hbox to1sp{}\rlap{\normalfont\normalcolor
970     \hskip -\displaywidth\tagform@\theequation}}
971 \else
972   \def\@eqnnum{{\normalfont\normalcolor \tagform@\theequation}}
973 \fi
974 \newcommand{\thetag}{\leavevmode\tagform@}
975 \let\df@tag\@empty
976 \def\make@df@tag{\@ifstar\make@df@tag@@\make@df@tag@@@}
977 \def\make@df@tag@@#1{%
978   \gdef\df@tag{\maketag@@@{#1}\def\@currentlabel{#1}}}
979 \def\make@df@tag@@@#1{\gdef\df@tag{\tagform@{#1}%
980   \toks@\@xp{\p@equation{#1}}\edef\@currentlabel{\the\toks@}}}
981 \let\ltx@label\label
982 \def\label@in@display{%
983     \ifx\df@label\@empty\else
984         \@amsmath@err{Multiple \string\label's:
985             label '\df@label' will be lost}\@eha
986     \fi
987     \gdef\df@label
988 }
989 \toks@\@xp{\@arrayparboxrestore \let\label\ltx@label}%
990 \edef\@arrayboxrestore{\the\toks@}
991 \let\df@label\@empty
992 \def\make@display@tag{%
993   \if@eqnsw \incr@eqnum \print@eqnum
994   \else \iftag@ \df@tag \global\let\df@tag\@empty \fi
995   \fi
996   \ifmeasuring@
997   \else
998     \ifx\df@label\@empty
999     \else
1000       \@xp\ltx@label\@xp{\df@label}%
1001       \global\let\df@label\@empty
1002     \fi
1003   \fi
1004 }
1005 \def\tag@in@align{%
1006     \relax
1007     \iftag@
1008         \DN@{\invalid@tag{Multiple \string\tag}}%
1009     \else
1010     \global\tag@true
1011     \nonumber
1012         \let\next@\make@df@tag
1013     \fi
1014     \next@
1015 }
1016 \newcommand{\raisetag}[1]{\skip@#1\relax
1017   \xdef\raise@tag{\vskip\iftagsleft@\else-\fi\the\skip@\relax}%
1018 }
1019 \let\raise@tag\@empty
1020 \newcommand{\notag}{\nonumber}
1021 \renewcommand{\nonumber}{%
1022   \if@eqnsw
1023     \ifx\incr@eqnum\@empty \addtocounter{equation}\m@ne \fi
1024   \fi
1025   \let\print@eqnum\@empty \let\incr@eqnum\@empty
1026   \global\@eqnswfalse
1027 }
1028 \def\print@eqnum{\tagform@\theequation}
1029 \def\incr@eqnum{\refstepcounter{equation}\let\incr@eqnum\@empty}
1030 \newif\ifinalign@
1031 \newif\ifingather@
1032 \@xp\def\@xp\@arrayparboxrestore\@xp{\@arrayparboxrestore
1033   \ingather@false\inalign@false \default@tag
1034   \let\spread@equation\@spread@equation
1035   \let\reset@equation\@empty
1036   \def\print@eqnum{\tagform@\theequation}%
1037   \def\incr@eqnum{\refstepcounter{equation}\let\incr@eqnum\@empty}%
1038 }
1039 \newif\iftag@
1040 \newif\ifst@rred
1041 \newif\ifmeasuring@
1042 \newif\ifshifttag@
1043 \newcount\row@
1044 \newcount\column@
1045 \def\column@plus{%
1046     \global\advance\column@\@ne
1047 }
1048 \newcount\maxfields@
1049 \def\add@amp#1{\if m#1&\@xp\add@amp\fi}
1050 \def\add@amps#1{%
1051     \begingroup
1052     \count@#1\advance\count@-\column@
1053     \edef\@tempa{\endgroup
1054       \@xp\add@amp\romannumeral\number\count@ 000q}%
1055     \@tempa
1056 }
1057 \newhelp\andhelp@
1058 {An extra & here is so disastrous that you should probably exit^^J
1059 and fix things up.}
1060 \newdimen\eqnshift@
1061 \newdimen\alignsep@
1062 \newdimen\tagshift@
1063 \newcommand{\mintagsep}{.5\fontdimen6\textfont\tw@}
1064 \newcommand{\minalignsep}{10pt}
1065 \newdimen\tagwidth@
1066 \newdimen\totwidth@
1067 \newdimen\lineht@
1068 \def\tag@width#1{%
1069     \ifcase\@xp#1\tag@lengths\fi
1070 }
1071
1072 \def\savetaglength@{%
1073     \begingroup
1074         \let\or\relax
1075         \xdef\tag@lengths{\tag@lengths\or \the\wdz@}%
1076     \endgroup
1077 }
1078
1079 \def\shift@tag#1{%
1080     \ifcase\@xp#1\tag@shifts\fi\relax
1081 }
1082
1083 \let\tag@shifts\@empty
1084 \def\saveshift@#1{%
1085     \begingroup
1086         \let\or\relax
1087         \xdef\tag@shifts{\or#1\tag@shifts}%
1088     \endgroup
1089 }
1090 \def\spread@equation{\reset@strutbox@
1091   \openup\jot \let\spread@equation\@empty}
1092 \let\@spread@equation\spread@equation
1093 \def\displ@y{\@display@init{}}
1094 \def\@display@init#1{%
1095     \global\dt@ptrue \spread@equation
1096     \everycr{%
1097         \noalign{%
1098             #1%
1099             \ifdt@p
1100                 \global\dt@pfalse
1101                 \vskip-\lineskiplimit
1102                 \vskip\normallineskiplimit
1103             \else
1104                 \penalty\@eqpen \global\dspbrk@lvl\m@ne
1105             \fi
1106         }%
1107     }%
1108 }
1109 \def\displ@y@{\@display@init{%
1110   \global\column@\z@ \global\dspbrk@lvl\m@ne
1111   \global\tag@false \global\let\raise@tag\@empty
1112 }}
1113 \def\black@#1{%
1114     \noalign{%
1115         \ifdim#1>\displaywidth
1116             \dimen@\prevdepth
1117             \nointerlineskip
1118             \vskip-\ht\strutbox@
1119             \vskip-\dp\strutbox@
1120             \vbox{\noindent\hbox to#1{\strut@\hfill}}%
1121             \prevdepth\dimen@
1122         \fi
1123     }%
1124 }
1125 \def\savecounters@{%
1126     \begingroup
1127         \def\@elt##1{%
1128           \global\csname c@##1\endcsname\the\csname c@##1\endcsname}%
1129         \xdef\@gtempa{%
1130             \cl@@ckpt
1131             \let\@nx\restorecounters@\@nx\@empty
1132         }%
1133     \endgroup
1134     \let\restorecounters@\@gtempa
1135 }
1136 \let\restorecounters@\@empty
1137 \def\savealignstate@{%
1138     \begingroup
1139         \let\or\relax
1140         \xdef\@gtempa{%
1141             \global\totwidth@\the\totwidth@
1142             \global\row@\the\row@
1143             \gdef\@nx\tag@lengths{\tag@lengths}%
1144             \let\@nx\restorealignstate@\@nx\@empty
1145         }%
1146     \endgroup
1147     \let\restorealignstate@\@gtempa
1148 }
1149
1150 \let\restorealignstate@\@empty
1151 \def\savecolumn@{%
1152   \edef\restorecolumn@{%
1153     \global\column@\number\column@
1154     \let\@nx\restorecolumn@\@nx\@empty
1155   }%
1156 }
1157 \let\restorecolumn@\@empty
1158 \newtoks\@envbody
1159 \def\addto@envbody#1{\global\@envbody\@xp{\the\@envbody#1}}
1160 \def\collect@body#1{%
1161   \@envbody{\@xp#1\@xp{\the\@envbody}}%
1162   \edef\process@envbody{\the\@envbody\@nx\end{\@currenvir}}%
1163   \@envbody\@emptytoks \def\begin@stack{b}%
1164   \begingroup
1165   \@xp\let\csname\@currenvir\endcsname\collect@@body
1166   \edef\process@envbody{\@xp\@nx\csname\@currenvir\endcsname}%
1167   \process@envbody
1168 }
1169 \def\push@begins#1\begin#2{%
1170   \ifx\end#2\else b\@xp\push@begins\fi
1171 }
1172 \def\collect@@body#1\end#2{%
1173   \edef\begin@stack{\push@begins#1\begin\end \@xp\@gobble\begin@stack}%
1174   \ifx\@empty\begin@stack
1175     \endgroup
1176     \@checkend{#2}%
1177     \addto@envbody{#1}%
1178   \else
1179     \addto@envbody{#1\end{#2}}%
1180   \fi
1181   \process@envbody % A little tricky! Note the grouping
1182 }
1183 \def\math@cr@@@aligned{%
1184   \ifodd\column@ \let\next@\@empty
1185   \else \def\next@{&\kern-\alignsep@}%
1186   \fi
1187   \next@ \cr
1188 }
1189 \newcommand{\start@aligned}[2]{%
1190     \RIfM@\else
1191         \nonmatherr@{\begin{\@currenvir}}%
1192     \fi
1193     \savecolumn@ % Assumption: called inside a group
1194     \null\,%
1195     \if #1t\vtop \else \if#1b \vbox \else \vcenter \fi \fi \bgroup
1196         \maxfields@#2\relax
1197         \ifnum\maxfields@>\m@ne
1198             \multiply\maxfields@\tw@
1199             \let\math@cr@@@\math@cr@@@alignedat
1200             \alignsep@\z@skip
1201         \else
1202             \let\math@cr@@@\math@cr@@@aligned
1203             \alignsep@\minalignsep
1204         \fi
1205         \Let@ \chardef\dspbrk@context\@ne
1206         \default@tag
1207         \spread@equation % no-op if already called
1208         \global\column@\z@
1209         \ialign\bgroup
1210            &\column@plus
1211             \hfil
1212             \strut@
1213             $\m@th\displaystyle{##}$%
1214             \tabskip\z@skip
1215            &\column@plus
1216             $\m@th\displaystyle{{}##}$%
1217             \hfil
1218             \tabskip\alignsep@
1219             \crcr
1220 }
1221 \def\math@cr@@@alignedat{%
1222     \ifnum\column@>\maxfields@
1223         \begingroup
1224           \measuring@false
1225           \@amsmath@err{Extra & on this line}%
1226             {\the\andhelp@}% "An extra & here is disastrous"
1227         \endgroup
1228     \fi
1229     \global\column@\z@
1230     \cr
1231 }
1232 \def\alignsafe@testopt#1#2{%
1233   \relax\iffalse{\fi\ifnum`}=0\fi
1234   \@ifnextchar[%
1235     {\let\@let@token\relax \ifnum`{=\z@\fi\iffalse}\fi#1}%
1236     {\let\@let@token\relax \ifnum`{=\z@\fi\iffalse}\fi#1[#2]}%
1237 }
1238 \newenvironment{aligned}{%
1239   \let\@testopt\alignsafe@testopt
1240   \aligned@a
1241 }{%
1242   \crcr\egroup
1243   \restorecolumn@
1244   \egroup
1245 }
1246 \newcommand{\aligned@a}[1][c]{\start@aligned{#1}\m@ne}
1247 \newenvironment{alignedat}{%
1248   \let\@testopt\alignsafe@testopt
1249   \alignedat@a
1250 }{%
1251   \endaligned
1252 }
1253 \newcommand{\alignedat@a}[1][c]{\start@aligned{#1}}
1254 \newenvironment{gathered}[1][c]{%
1255     \RIfM@\else
1256         \nonmatherr@{\begin{gathered}}%
1257     \fi
1258     \null\,%
1259     \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi \bgroup
1260         \Let@ \chardef\dspbrk@context\@ne \restore@math@cr
1261         \spread@equation
1262         \ialign\bgroup
1263             \hfil\strut@$\m@th\displaystyle##$\hfil
1264             \crcr
1265 }{%
1266   \endaligned
1267 }
1268 \def\start@gather#1{%
1269     \RIfM@
1270         \nomath@env
1271         \DN@{\@namedef{end\@currenvir}{}\@gobble}%
1272     \else
1273         $$%
1274         #1%
1275         \ifst@rred \else \global\@eqnswtrue \fi
1276         \let\next@\gather@
1277     \fi
1278     \collect@body\next@
1279 }
1280 \newenvironment{gather}{%
1281   \start@gather\st@rredfalse
1282 }{%
1283   \math@cr \black@\totwidth@ \egroup
1284   $$\ignorespacesafterend
1285 }
1286
1287 \newenvironment{gather*}{%
1288   \start@gather\st@rredtrue
1289 }{%
1290   \endgather
1291 }
1292 \def\gather@#1{%
1293     \ingather@true \let\split\insplit@
1294     \let\tag\tag@in@align \let\label\label@in@display
1295     \chardef\dspbrk@context\z@
1296     \intertext@ \displ@y@ \Let@
1297     \let\math@cr@@@\math@cr@@@gather
1298     \gmeasure@{#1}%
1299     \global\shifttag@false
1300     \tabskip\z@skip
1301     \global\row@\@ne
1302     \halign to\displaywidth\bgroup
1303         \strut@
1304         \setboxz@h{$\m@th\displaystyle{##}$}%
1305         \calc@shift@gather
1306         \set@gather@field
1307         \tabskip\@centering
1308        &\setboxz@h{\strut@{##}}%
1309         \place@tag@gather
1310         \tabskip \iftagsleft@ \gdisplaywidth@ \else \z@skip \span\fi
1311         \crcr
1312         #1%
1313 }
1314 \def\gmeasure@#1{%
1315     \begingroup
1316         \measuring@true
1317         \totwidth@\z@
1318         \global\let\tag@lengths\@empty
1319         \savecounters@
1320         \setbox\@ne\vbox{%
1321             \everycr{\noalign{\global\tag@false
1322               \global\let\raise@tag\@empty \global\column@\z@}}%
1323             \let\label\@gobble
1324             \halign{%
1325                 \setboxz@h{$\m@th\displaystyle{##}$}%
1326                 \ifdim\wdz@>\totwidth@
1327                     \global\totwidth@\wdz@
1328                 \fi
1329                &\setboxz@h{\strut@{##}}%
1330                 \savetaglength@
1331                 \crcr
1332                 #1%
1333                 \math@cr@@@
1334             }%
1335         }%
1336         \restorecounters@
1337         \if@fleqn
1338             \global\advance\totwidth@\@mathmargin
1339         \fi
1340         \iftagsleft@
1341             \ifdim\totwidth@>\displaywidth
1342                 \global\let\gdisplaywidth@\totwidth@
1343             \else
1344                 \global\let\gdisplaywidth@\displaywidth
1345             \fi
1346         \fi
1347     \endgroup
1348 }
1349 \def\math@cr@@@gather{%
1350     \ifst@rred\nonumber\fi
1351    &\relax
1352     \make@display@tag
1353     \ifst@rred\else\global\@eqnswtrue\fi
1354     \global\advance\row@\@ne
1355     \cr
1356 }
1357 \def\calc@shift@gather{%
1358     \dimen@\mintagsep\relax
1359     \tagwidth@\tag@width\row@\relax
1360     \if@fleqn
1361         \global\eqnshift@\@mathmargin
1362         \ifdim\tagwidth@>\z@
1363             \advance\dimen@\tagwidth@
1364             \iftagsleft@
1365                 \ifdim\dimen@>\@mathmargin
1366                     \global\shifttag@true
1367                 \fi
1368             \else
1369                 \advance\dimen@\@mathmargin
1370                 \advance\dimen@\wdz@
1371                 \ifdim\dimen@>\displaywidth
1372                    \global\shifttag@true
1373                 \fi
1374             \fi
1375         \fi
1376     \else
1377         \global\eqnshift@\displaywidth
1378         \global\advance\eqnshift@-\wdz@
1379         \ifdim\tagwidth@>\z@
1380             \multiply\dimen@\tw@
1381             \advance\dimen@\wdz@
1382             \advance\dimen@\tagwidth@
1383             \ifdim\dimen@>\displaywidth
1384                 \global\shifttag@true
1385             \else
1386                 \ifdim\eqnshift@<4\tagwidth@
1387                     \global\advance\eqnshift@-\tagwidth@
1388                 \fi
1389             \fi
1390         \fi
1391         \global\divide\eqnshift@\tw@
1392         \iftagsleft@
1393             \global\eqnshift@-\eqnshift@
1394             \global\advance\eqnshift@\displaywidth
1395             \global\advance\eqnshift@-\wdz@
1396         \fi
1397         \ifdim\eqnshift@<\z@
1398             \global\eqnshift@\z@
1399         \fi
1400     \fi
1401 }
1402 \def\place@tag@gather{%
1403     \iftagsleft@
1404         \kern-\gdisplaywidth@
1405         \ifshifttag@
1406             \rlap{\vbox{%
1407                 \normalbaselines
1408                 \boxz@
1409                 \vbox to\lineht@{}%
1410                 \raise@tag
1411             }}%
1412             \global\shifttag@false
1413         \else
1414             \rlap{\boxz@}%
1415         \fi
1416     \else
1417         \ifdim\totwidth@>\displaywidth
1418             \dimen@\totwidth@
1419             \advance\dimen@-\displaywidth
1420             \kern-\dimen@
1421         \fi
1422         \ifshifttag@
1423             \llap{\vtop{%
1424                 \raise@tag
1425                 \normalbaselines
1426                 \setbox\@ne\null
1427                 \dp\@ne\lineht@
1428                 \box\@ne
1429                 \boxz@
1430             }}%
1431             \global\shifttag@false
1432         \else
1433             \llap{\boxz@}%
1434         \fi
1435     \fi
1436 }
1437 \def\set@gather@field{%
1438     \iftagsleft@
1439         \global\lineht@\ht\z@
1440     \else
1441         \global\lineht@\dp\z@
1442     \fi
1443     \kern\eqnshift@
1444     \boxz@
1445     \hfil
1446 }
1447 \newif\ifxxat@
1448
1449 \newif\ifcheckat@
1450
1451 \let\xatlevel@\@empty
1452 \def\start@align#1#2#3{%
1453     \let\xatlevel@#1% always \z@, \@ne, or \tw@
1454     \maxfields@#3\relax
1455     \ifnum\maxfields@>\m@ne
1456         \checkat@true
1457         \ifnum\xatlevel@=\tw@
1458             \xxat@true
1459         \fi
1460         \multiply\maxfields@\tw@
1461     \else
1462         \checkat@false
1463     \fi
1464     \ifingather@
1465         \iffalse{\fi\ifnum0=`}\fi
1466         \DN@{\vcenter\bgroup\savealignstate@\align@#2}%
1467     \else
1468         \ifmmode
1469           \if@display
1470              \DN@{\align@recover}%
1471           \else
1472             \nomath@env
1473             \DN@{\@namedef{end\@currenvir}{}\@gobble}%
1474           \fi
1475         \else
1476             $$%
1477             \let\split\insplit@
1478             \DN@{\align@#2}%
1479         \fi
1480     \fi
1481     \collect@body\next@
1482 }
1483 \def\align@recover#1#2#3{%
1484   \endgroup
1485   \@amsmath@err{%
1486 Erroneous nesting of equation structures;\MessageBreak
1487 trying to recover with `aligned'%
1488   }\@ehc
1489   \begin{aligned}\relax#1\end{aligned}%
1490 }
1491 \newenvironment{alignat}{%
1492   \start@align\z@\st@rredfalse
1493 }{%
1494   \endalign
1495 }
1496 \newenvironment{alignat*}{%
1497   \start@align\z@\st@rredtrue
1498 }{%
1499   \endalign
1500 }
1501 \newenvironment{xalignat}{%
1502   \start@align\@ne\st@rredfalse
1503 }{%
1504   \endalign
1505 }
1506 \newenvironment{xalignat*}{%
1507   \start@align\@ne\st@rredtrue
1508 }{%
1509   \endalign
1510 }
1511 \newenvironment{xxalignat}{%
1512   \start@align\tw@\st@rredtrue
1513 }{%
1514   \endalign
1515 }
1516 \newenvironment{align}{%
1517   \start@align\@ne\st@rredfalse\m@ne
1518 }{%
1519   \math@cr \black@\totwidth@
1520   \egroup
1521   \ifingather@
1522     \restorealignstate@
1523     \egroup
1524     \nonumber
1525     \ifnum0=`{\fi\iffalse}\fi
1526   \else
1527     $$%
1528   \fi
1529   \ignorespacesafterend
1530 }
1531 \newenvironment{align*}{%
1532   \start@align\@ne\st@rredtrue\m@ne
1533 }{%
1534   \endalign
1535 }
1536 \newenvironment{flalign}{%
1537   \start@align\tw@\st@rredfalse\m@ne
1538 }{%
1539   \endalign
1540 }
1541 \newenvironment{flalign*}{%
1542   \start@align\tw@\st@rredtrue\m@ne
1543 }{%
1544   \endalign
1545 }
1546 \def\align@#1#2{%
1547     \inalign@true \intertext@ \Let@ \chardef\dspbrk@context\z@
1548     \ifingather@\else\displ@y@\fi
1549     \let\math@cr@@@\math@cr@@@align
1550     \ifxxat@\else \let\tag\tag@in@align \fi
1551     \let\label\label@in@display
1552     #1% set st@r
1553     \ifst@rred\else \global\@eqnswtrue \fi
1554     \measure@{#2}%
1555     \global\row@\z@
1556     \tabskip\eqnshift@
1557     \halign\bgroup
1558         \span\align@preamble\crcr
1559         #2%
1560 }
1561 \def\math@cr@@@align{%
1562   \ifst@rred\nonumber\fi
1563   \if@eqnsw \global\tag@true \fi
1564   \global\advance\row@\@ne
1565   \add@amps\maxfields@
1566   \omit
1567   \kern-\alignsep@
1568   \iftag@
1569     \setboxz@h{\@lign\strut@{\make@display@tag}}%
1570     \place@tag
1571   \fi
1572   \ifst@rred\else\global\@eqnswtrue\fi
1573   \global\lineht@\z@
1574   \cr
1575 }
1576 \def\math@cr@@@align@measure{%
1577    &\omit
1578     \global\advance\row@\@ne
1579     \ifst@rred\nonumber\fi
1580     \if@eqnsw \global\tag@true \fi
1581     \ifnum\column@>\maxfields@
1582         \ifcheckat@
1583             \begingroup
1584               \measuring@false
1585               \@amsmath@err{Extra & on this line}%
1586                 {\the\andhelp@}% "An extra & here is disastrous"
1587             \endgroup
1588         \else
1589             \global\maxfields@\column@
1590         \fi
1591     \fi
1592     \setboxz@h{\@lign\strut@{%
1593         \if@eqnsw
1594             \stepcounter{equation}%
1595             \tagform@\theequation
1596         \else
1597             \iftag@\df@tag\fi
1598         \fi
1599     }}%
1600     \savetaglength@
1601     \ifst@rred\else\global\@eqnswtrue\fi
1602     \cr
1603 }
1604 \let\field@lengths\@empty
1605
1606 \def\savefieldlength@{%
1607     \begingroup
1608         \let\or\relax
1609         \xdef\field@lengths{%
1610             \field@lengths
1611             \ifnum\column@=0
1612                 \or
1613             \else
1614                 ,%
1615             \fi
1616             \the\wdz@
1617         }%
1618     \endgroup
1619 }
1620
1621 \def\fieldlengths@#1{%
1622     \ifcase\@xp#1\field@lengths\fi
1623 }
1624 \let\maxcolumn@widths\@empty
1625 \def\maxcol@width#1{%
1626     \ifcase\@xp#1\maxcolumn@widths\fi\relax
1627 }
1628 \def\measure@#1{%
1629     \begingroup
1630         \measuring@true
1631         \global\eqnshift@\z@
1632         \global\alignsep@\z@
1633         \global\let\tag@lengths\@empty
1634         \global\let\field@lengths\@empty
1635         \savecounters@
1636         \global\setbox0\vbox{%
1637             \let\math@cr@@@\math@cr@@@align@measure
1638             \everycr{\noalign{\global\tag@false
1639               \global\let\raise@tag\@empty \global\column@\z@}}%
1640             \let\label\@gobble
1641             \global\row@\z@
1642             \tabskip\z@
1643             \halign{\span\align@preamble\crcr
1644                 #1%
1645                 \math@cr@@@
1646                 \global\column@\z@
1647                 \add@amps\maxfields@\cr
1648             }%
1649         }%
1650         \restorecounters@
1651         \ifodd\maxfields@
1652             \global\advance\maxfields@\@ne
1653         \fi
1654         \ifnum\xatlevel@=\tw@
1655             \ifnum\maxfields@<\thr@@
1656                 \let\xatlevel@\z@
1657             \fi
1658         \fi
1659         \setbox\z@\vbox{%
1660           \unvbox\z@ \unpenalty \global\setbox\@ne\lastbox
1661         }%
1662         \global\totwidth@\wd\@ne
1663         \if@fleqn \global\advance\totwidth@\@mathmargin \fi
1664         \global\let\maxcolumn@widths\@empty
1665         \begingroup
1666           \let\or\relax
1667           \loop
1668             \global\setbox\@ne\hbox{%
1669               \unhbox\@ne \unskip \global\setbox\thr@@\lastbox
1670             }%
1671           \ifhbox\thr@@
1672            \xdef\maxcolumn@widths{ \or \the\wd\thr@@ \maxcolumn@widths}%
1673           \repeat
1674         \endgroup
1675         \dimen@\displaywidth
1676         \advance\dimen@-\totwidth@
1677         \ifcase\xatlevel@
1678             \global\alignsep@\z@
1679             \let\minalignsep\z@
1680             \@tempcntb\z@
1681             \if@fleqn
1682                 \@tempcnta\@ne
1683                 \global\eqnshift@\@mathmargin
1684             \else
1685                 \@tempcnta\tw@
1686                 \global\eqnshift@\dimen@
1687                 \global\divide\eqnshift@\@tempcnta
1688             \fi
1689         \or
1690             \@tempcntb\maxfields@
1691             \divide\@tempcntb\tw@
1692             \@tempcnta\@tempcntb
1693             \advance\@tempcntb\m@ne
1694             \if@fleqn
1695                 \global\eqnshift@\@mathmargin
1696                 \global\alignsep@\dimen@
1697                 \global\divide\alignsep@\@tempcnta
1698             \else
1699                 \global\advance\@tempcnta\@ne
1700                 \global\eqnshift@\dimen@
1701                 \global\divide\eqnshift@\@tempcnta
1702                 \global\alignsep@\eqnshift@
1703             \fi
1704         \or
1705             \@tempcntb\maxfields@
1706             \divide\@tempcntb\tw@
1707             \global\advance\@tempcntb\m@ne
1708             \global\@tempcnta\@tempcntb
1709             \global\eqnshift@\z@
1710             \global\alignsep@\dimen@
1711             \if@fleqn
1712                 \global\advance\alignsep@\@mathmargin\relax
1713             \fi
1714             \global\divide\alignsep@\@tempcntb
1715         \fi
1716         \ifdim\alignsep@<\minalignsep\relax
1717             \global\alignsep@\minalignsep\relax
1718             \ifdim\eqnshift@>\z@
1719                 \if@fleqn\else
1720                     \global\eqnshift@\displaywidth
1721                     \global\advance\eqnshift@-\totwidth@
1722                     \global\advance\eqnshift@-\@tempcntb\alignsep@
1723                     \global\divide\eqnshift@\tw@
1724                 \fi
1725             \fi
1726         \fi
1727         \ifdim\eqnshift@<\z@
1728             \global\eqnshift@\z@
1729         \fi
1730         \calc@shift@align
1731         \global\tagshift@\totwidth@
1732         \global\advance\tagshift@\@tempcntb\alignsep@
1733         \if@fleqn
1734             \ifnum\xatlevel@=\tw@
1735                 \global\advance\tagshift@-\@mathmargin\relax
1736             \fi
1737         \else
1738             \global\advance\tagshift@\eqnshift@
1739         \fi
1740         \iftagsleft@ \else
1741             \global\advance\tagshift@-\displaywidth
1742         \fi
1743         \dimen@\minalignsep\relax
1744         \global\advance\totwidth@\@tempcntb\dimen@
1745         \ifdim\totwidth@>\displaywidth
1746             \global\let\displaywidth@\totwidth@
1747         \else
1748             \global\let\displaywidth@\displaywidth
1749         \fi
1750     \endgroup
1751 }
1752 \iftagsleft@\if@fleqn
1753     \def\calc@shift@align{%
1754         \global\let\tag@shifts\@empty
1755         \begingroup
1756             \@tempdima\@mathmargin\relax
1757             \advance\@tempdima-\mintagsep\relax
1758             \loop
1759                 \ifnum\row@>0
1760                     \ifdim\tag@width\row@>\z@
1761                         \x@calc@shift@lf
1762                     \else
1763                         \saveshift@0%
1764                     \fi
1765                     \advance\row@\m@ne
1766             \repeat
1767         \endgroup
1768     }
1769     \def\x@calc@shift@lf{%
1770         \ifdim\eqnshift@=\z@
1771             \global\eqnshift@\@mathmargin\relax
1772             \alignsep@\displaywidth
1773             \advance\alignsep@-\totwidth@
1774             \global\divide\alignsep@\@tempcntb
1775             \ifdim\alignsep@<\minalignsep\relax
1776                 \global\alignsep@\minalignsep\relax
1777             \fi
1778         \fi
1779         \ifdim\tag@width\row@>\@tempdima
1780             \saveshift@1%
1781         \else
1782             \saveshift@0%
1783         \fi
1784     }
1785 \fi\fi
1786 \iftagsleft@\else\if@fleqn
1787     \def\calc@shift@align{%
1788         \global\let\tag@shifts\@empty
1789         \begingroup
1790             \loop
1791                 \ifnum\row@>0
1792                     \ifdim\tag@width\row@>\z@
1793                         \x@calc@shift@rf
1794                     \else
1795                         \saveshift@0%
1796                     \fi
1797                     \advance\row@\m@ne
1798             \repeat
1799         \endgroup
1800     }
1801     \def\x@calc@shift@rf{%
1802         \column@\z@
1803         \@tempdimb\z@
1804         \@tempdimc\z@
1805         \edef\@tempb{\fieldlengths@\row@}%
1806         \@for\@tempa:=\@tempb\do{%
1807             \advance\column@\@ne
1808             \x@rcalc@width
1809         }%
1810         \begingroup
1811             \advance\column@\m@ne
1812             \divide\column@\tw@
1813             \ifnum\@tempcntb>\column@
1814                 \advance\@tempcnta-\@tempcntb
1815                 \advance\@tempcnta\column@
1816                 \@tempcntb\column@
1817             \fi
1818             \tagwidth@\tag@width\row@\relax
1819             \@tempdima\eqnshift@
1820             \advance\@tempdima\@tempdimc\relax
1821             \advance\@tempdima\tagwidth@
1822             \dimen@\minalignsep\relax
1823             \multiply\dimen@\@tempcntb
1824             \advance\dimen@\mintagsep\relax
1825             \advance\dimen@\@tempdima
1826             \ifdim\dimen@>\displaywidth
1827                 \saveshift@1%
1828             \else
1829                 \saveshift@0%
1830                 \dimen@\alignsep@\relax
1831                 \multiply\dimen@\@tempcntb
1832                 \advance\dimen@\@tempdima
1833                 \advance\dimen@\tagwidth@
1834                 \ifdim\dimen@>\displaywidth
1835                     \dimen@\displaywidth
1836                     \advance\dimen@-\@tempdima
1837                     \ifnum\xatlevel@=\tw@
1838                         \advance\dimen@-\mintagsep\relax
1839                     \fi
1840                     \divide\dimen@\@tempcnta
1841                     \ifdim\dimen@<\minalignsep\relax
1842                         \global\alignsep@\minalignsep\relax
1843                     \else
1844                         \global\alignsep@\dimen@
1845                     \fi
1846                 \fi
1847             \fi
1848         \endgroup
1849     }
1850 \fi\fi
1851 \iftagsleft@\else\if@fleqn\else
1852     \def\calc@shift@align{%
1853         \global\let\tag@shifts\@empty
1854         \begingroup
1855             \loop
1856                 \ifnum\row@>0
1857                     \ifdim\tag@width\row@>\z@
1858                         \x@calc@shift@rc
1859                     \else
1860                         \saveshift@0%
1861                     \fi
1862                     \advance\row@\m@ne
1863             \repeat
1864         \endgroup
1865     }
1866     \def\x@calc@shift@rc{%
1867         \column@\z@
1868         \@tempdimb\z@
1869         \@tempdimc\z@
1870         \edef\@tempb{\fieldlengths@\row@}%
1871         \@for\@tempa:=\@tempb\do{%
1872             \advance\column@\@ne
1873             \x@rcalc@width
1874         }%
1875         \begingroup
1876             \advance\column@\m@ne
1877             \divide\column@\tw@
1878             \ifnum\@tempcntb>\column@
1879                 \advance\@tempcnta-\@tempcntb
1880                 \advance\@tempcnta\column@
1881                 \@tempcntb\column@
1882             \fi
1883             \tagwidth@\tag@width\row@\relax
1884             \@tempdima\@tempdimc
1885             \advance\@tempdima\tagwidth@
1886             \dimen@\minalignsep\relax
1887             \multiply\dimen@\@tempcntb
1888             \advance\dimen@\mintagsep\relax
1889             \ifnum\xatlevel@=\tw@ \else
1890                 \advance\dimen@\mintagsep\relax
1891             \fi
1892             \advance\dimen@\@tempdima
1893             \ifdim\dimen@>\displaywidth
1894                 \saveshift@1%
1895             \else
1896                 \saveshift@0%
1897                 \dimen@\eqnshift@
1898                 \advance\dimen@\@tempdima
1899                 \advance\dimen@\@tempcntb\alignsep@
1900                 \advance\dimen@\tagwidth@
1901                 \ifdim\dimen@>\displaywidth
1902                     \dimen@\displaywidth
1903                     \advance\dimen@-\@tempdima
1904                     \ifnum\xatlevel@=\tw@
1905                         \advance\dimen@-\mintagsep\relax
1906                     \fi
1907                     \divide\dimen@\@tempcnta
1908                     \ifdim\dimen@<\minalignsep\relax
1909                         \global\alignsep@\minalignsep\relax
1910                         \eqnshift@\displaywidth
1911                         \advance\eqnshift@-\@tempdima
1912                         \advance\eqnshift@-\@tempcntb\alignsep@
1913                         \global\divide\eqnshift@\tw@
1914                     \else
1915                         \ifdim\dimen@<\eqnshift@
1916                             \ifdim\dimen@<\z@
1917                                 \global\eqnshift@\z@
1918                             \else
1919                                 \global\eqnshift@\dimen@
1920                             \fi
1921                         \fi
1922                         \ifdim\dimen@<\alignsep@
1923                             \global\alignsep@\dimen@
1924                         \fi
1925                     \fi
1926                 \fi
1927             \fi
1928         \endgroup
1929     }
1930 \fi\fi
1931 \iftagsleft@\else
1932     \def\x@rcalc@width{%
1933         \ifdim\@tempa > \z@
1934             \advance\@tempdimc\@tempdimb
1935             \ifodd\column@
1936                 \advance\@tempdimc\maxcol@width\column@
1937                 \@tempdimb\z@
1938             \else
1939                 \advance\@tempdimc\@tempa\relax
1940                 \@tempdimb\maxcol@width\column@
1941                 \advance\@tempdimb-\@tempa\relax
1942             \fi
1943         \else
1944             \advance\@tempdimb\maxcol@width\column@\relax
1945         \fi
1946     }
1947 \fi
1948 \iftagsleft@\if@fleqn\else
1949     \def\calc@shift@align{%
1950         \global\let\tag@shifts\@empty
1951         \begingroup
1952             \loop
1953                 \ifnum\row@>\z@
1954                     \ifdim\tag@width\row@>\z@
1955                         \x@calc@shift@lc
1956                     \else
1957                         \saveshift@0%
1958                     \fi
1959                     \advance\row@\m@ne
1960             \repeat
1961         \endgroup
1962     }
1963     \def\x@calc@shift@lc{%
1964         \column@\z@
1965         \@tempdima\z@ % ``width of equation''
1966         \@tempdimb\z@ % ``indent of equation''
1967         \edef\@tempb{\fieldlengths@\row@}%
1968         \@for\@tempa:=\@tempb\do{%
1969             \advance\column@\@ne
1970             \x@lcalc@width
1971         }%
1972         \begingroup
1973             \tagwidth@\tag@width\row@\relax
1974             \@tempdima\totwidth@
1975             \advance\@tempdima-\@tempdimb
1976             \advance\@tempdima\tagwidth@
1977             \dimen@\minalignsep\relax
1978             \multiply\dimen@\@tempcntb
1979             \advance\dimen@\mintagsep\relax
1980             \ifnum\xatlevel@=\tw@ \else
1981                 \advance\dimen@\mintagsep\relax
1982             \fi
1983             \advance\dimen@\@tempdima
1984             \ifdim\dimen@>\displaywidth
1985                 \saveshift@1%
1986             \else
1987                 \saveshift@0%
1988                 \dimen@\alignsep@
1989                 \multiply\dimen@\count@
1990                 \advance\dimen@\eqnshift@
1991                 \advance\dimen@\@tempdimb
1992                 \ifdim\dimen@<2\tagwidth@
1993                     \dimen@\displaywidth
1994                     \advance\dimen@-\@tempdima
1995                     \ifnum\xatlevel@=\tw@
1996                         \advance\dimen@-\mintagsep\relax
1997                     \fi
1998                     \ifnum\@tempcnta>\z@
1999                       \divide\dimen@\@tempcnta
2000                     \else \dimen@\z@
2001                     \fi
2002                     \ifdim\dimen@<\minalignsep\relax
2003                         \global\alignsep@\minalignsep\relax
2004                         \dimen@\displaywidth
2005                         \advance\dimen@-\@tempdima
2006                         \advance\dimen@-\@tempcntb\alignsep@
2007                         \global\divide\dimen@\tw@
2008                     \else
2009                         \ifdim\dimen@<\alignsep@
2010                             \global\alignsep@\dimen@
2011                         \fi
2012                     \fi
2013                     \ifnum\xatlevel@=\tw@
2014                         \dimen@\mintagsep\relax
2015                     \fi
2016                     \advance\dimen@\tagwidth@
2017                     \advance\dimen@-\@tempdimb
2018                     \advance\dimen@-\count@\alignsep@
2019                     \ifdim\dimen@>\eqnshift@
2020                         \global\eqnshift@\dimen@
2021                     \fi
2022                 \fi
2023             \fi
2024         \endgroup
2025     }
2026     \def\x@lcalc@width{%
2027         \ifdim\@tempdima = \z@
2028             \ifdim\@tempa > \z@
2029                 \@tempdima\p@
2030                 \ifodd\column@
2031                     \advance\@tempdimb \maxcol@width\column@
2032                     \advance\@tempdimb-\@tempa
2033                 \fi
2034                 \count@\column@
2035                 \advance\count@\m@ne
2036                 \divide\count@\tw@
2037                 \advance\@tempcnta-\count@
2038                 \advance\@tempcntb-\count@
2039             \else
2040                 \advance\@tempdimb \maxcol@width\column@\relax
2041             \fi
2042         \fi
2043     }
2044 \fi\fi
2045 \def\place@tag{%
2046     \iftagsleft@
2047         \kern-\tagshift@
2048         \if1\shift@tag\row@\relax
2049             \rlap{\vbox{%
2050                 \normalbaselines
2051                 \boxz@
2052                 \vbox to\lineht@{}%
2053                 \raise@tag
2054             }}%
2055         \else
2056             \rlap{\boxz@}%
2057         \fi
2058         \kern\displaywidth@
2059     \else
2060         \kern-\tagshift@
2061         \if1\shift@tag\row@\relax
2062             \llap{\vtop{%
2063                 \raise@tag
2064                 \normalbaselines
2065                 \setbox\@ne\null
2066                 \dp\@ne\lineht@
2067                 \box\@ne
2068                 \boxz@
2069             }}%
2070         \else
2071             \llap{\boxz@}%
2072         \fi
2073     \fi
2074 }
2075 \def\align@preamble{%
2076    &\hfil
2077     \strut@
2078     \setboxz@h{\@lign$\m@th\displaystyle{##}$}%
2079     \ifmeasuring@\savefieldlength@\fi
2080     \set@field
2081     \tabskip\z@skip
2082    &\setboxz@h{\@lign$\m@th\displaystyle{{}##}$}%
2083     \ifmeasuring@\savefieldlength@\fi
2084     \set@field
2085     \hfil
2086     \tabskip\alignsep@
2087 }
2088 \def\set@field{%
2089     \column@plus
2090     \iftagsleft@
2091         \ifdim\ht\z@>\lineht@
2092             \global\lineht@\ht\z@
2093         \fi
2094     \else
2095         \ifdim\dp\z@>\lineht@
2096             \global\lineht@\dp\z@
2097         \fi
2098     \fi
2099     \boxz@
2100 }
2101 \edef\split@err#1{%
2102     \@nx\@amsmath@err{%
2103         \string\begin{split} won't work here%
2104     }{%
2105         \@xp\@nx\csname
2106   Did you forget a preceding \string\begin{equation}?^^J%
2107   If not, perhaps the `aligned' environment is what
2108   you want.\endcsname}%
2109 }
2110 \newenvironment{split}{%
2111   \if@display
2112     \ifinner
2113       \@xp\@xp\@xp\split@aligned
2114     \else
2115       \ifst@rred \else \global\@eqnswtrue \fi
2116     \fi
2117   \else \let\endsplit\@empty \@xp\collect@body\@xp\split@err
2118   \fi
2119   \collect@body\gather@split
2120 }{%
2121       \crcr
2122     \egroup
2123   \egroup
2124   \iftagsleft@ \@xp\lendsplit@ \else \@xp\rendsplit@ \fi
2125 }
2126 \let\split@tag\relax % init
2127 \def\gather@split#1#2#3{%
2128   \@xp\endgroup \reset@equation % math@cr will handle equation numbering
2129   \iftag@
2130      \toks@\@xp{\df@tag}%
2131      \edef\split@tag{%
2132        \gdef\@nx\df@tag{\the\toks@}%
2133        \global\@nx\tag@true \@nx\nonumber
2134      }%
2135   \else \let\split@tag\@empty
2136   \fi
2137   \spread@equation
2138   \vcenter\bgroup
2139     \gather@{\split@tag  \begin{split}#1\end{split}}%
2140     \def\endmathdisplay@a{%
2141       \math@cr \black@ \totwidth@ \egroup
2142       \egroup
2143     }%
2144 }
2145 \def\insplit@{%
2146   \global\setbox\z@\vbox\bgroup
2147     \Let@ \chardef\dspbrk@context\@ne \restore@math@cr
2148     \default@tag % disallow use of \tag here
2149     \ialign\bgroup
2150       \hfil
2151       \strut@
2152       $\m@th\displaystyle{##}$%
2153      &$\m@th\displaystyle{{}##}$%
2154       \hfill % Why not \hfil?---dmj, 1994/12/28
2155       \crcr
2156 }
2157 \def\rendsplit@{%
2158     \ifinalign@
2159         \global\setbox9 \vtop{%
2160             \unvcopy\z@
2161             \global\setbox8 \lastbox
2162             \unskip
2163         }%
2164         \setbox\@ne\hbox{%
2165             \unhcopy8
2166             \unskip
2167             \global\setbox\tw@\lastbox
2168             \unskip
2169             \global\setbox\thr@@\lastbox
2170         }%
2171         \ifctagsplit@
2172             \gdef\split@{%
2173                 \hbox to\wd\thr@@{}%
2174                &\vcenter{\vbox{\moveleft\wd\thr@@\boxz@}}%
2175             }%
2176         \else
2177             \global\setbox7 \hbox{\unhbox\tw@\unskip}%
2178             \gdef\split@{%
2179                 \global\@tempcnta\column@
2180                &\setboxz@h{}%
2181                 \savetaglength@
2182                 \global\advance\row@\@ne
2183                 \vbox{\moveleft\wd\thr@@\box9}%
2184                 \crcr
2185                 \noalign{\global\lineht@\z@}%
2186                 \add@amps\@tempcnta
2187                 \box\thr@@
2188                &\box7
2189             }%
2190         \fi
2191     \else
2192         \ifctagsplit@
2193             \gdef\split@{\vcenter{\boxz@}}%
2194         \else
2195             \gdef\split@{%
2196                 \boxz@
2197             }%
2198         \fi
2199     \fi
2200     \aftergroup\split@
2201 }
2202 \def\lendsplit@{%
2203     \global\setbox9\vtop{\unvcopy\z@}%
2204     \ifinalign@
2205         \setbox\@ne\vbox{%
2206             \unvcopy\z@
2207             \global\setbox8\lastbox
2208         }%
2209         \setbox\@ne\hbox{%
2210             \unhcopy8%
2211             \unskip
2212             \setbox\tw@\lastbox
2213             \unskip
2214             \global\setbox\thr@@\lastbox
2215         }%
2216         \ifctagsplit@
2217             \gdef\split@{%
2218                 \hbox to\wd\thr@@{}%
2219                &\vcenter{\vbox{\moveleft\wd\thr@@\box9}}%
2220             }%
2221         \else
2222             \gdef\split@{%
2223                 \hbox to\wd\thr@@{}%
2224                &\vbox{\moveleft\wd\thr@@\box9}%
2225             }%
2226         \fi
2227     \else
2228         \ifctagsplit@
2229             \gdef\split@{\vcenter{\box9}}%
2230         \else
2231             \gdef\split@{\box9}%
2232         \fi
2233     \fi
2234     \aftergroup\split@
2235 }
2236 \def\split@aligned#1#2{%
2237    \iffalse{\fi\ifnum0=`}\fi
2238    \collect@body\split@al@a}
2239 \def\split@al@a#1#2#3{%
2240   \split@warning
2241   \endgroup
2242   \toks@{\begin{aligned}}%
2243   \if@fleqn \split@al@tagcheck \fi
2244   \the\toks@\relax#1\end{aligned}%
2245   \ifnum0=`{\fi\iffalse}\fi
2246 }
2247 \def\split@al@tagcheck{%
2248    \ifctagsplit@
2249    \else
2250      \iftagsleft@ \toks@\@xp{\the\toks@ [t]}%
2251      \else \toks@\@xp{\the\toks@ [b]}%
2252      \fi
2253    \fi
2254 }
2255 \def\split@warning{%
2256   \PackageWarning{amsmath}{%
2257 Cannot use `split' here;\MessageBreak trying to recover with `aligned'}%
2258 }
2259 \newskip\multlinegap
2260 \multlinegap10pt
2261 \newskip\multlinetaggap
2262 \multlinetaggap10pt
2263 \def\start@multline#1{%
2264     \RIfM@
2265         \nomath@env
2266         \DN@{\@namedef{end\@currenvir}{}\@gobble}%
2267     \else
2268         $$%
2269         #1%
2270         \ifst@rred
2271             \nonumber
2272         \else
2273             \global\@eqnswtrue
2274         \fi
2275         \let\next@\multline@
2276     \fi
2277     \collect@body\next@
2278 }
2279 \newenvironment{multline}{%
2280   \start@multline\st@rredfalse
2281 }{%
2282   \iftagsleft@ \@xp\lendmultline@ \else \@xp\rendmultline@ \fi
2283   \ignorespacesafterend
2284 }
2285 \newenvironment{multline*}{\start@multline\st@rredtrue}{\endmultline}
2286 \def\multline@#1{%
2287     \Let@
2288     \@display@init{\global\advance\row@\@ne \global\dspbrk@lvl\m@ne}%
2289     \chardef\dspbrk@context\z@
2290     \restore@math@cr
2291     \let\tag\tag@in@align
2292     \global\tag@false \global\let\raise@tag\@empty
2293     \mmeasure@{#1}%
2294     \let\tag\gobble@tag \let\label\@gobble
2295     \tabskip \if@fleqn \@mathmargin \else \z@skip \fi
2296     \totwidth@\displaywidth
2297     \if@fleqn
2298         \advance\totwidth@-\@mathmargin
2299     \fi
2300     \halign\bgroup
2301         \hbox to\totwidth@{%
2302             \if@fleqn
2303                 \hskip \@centering \relax
2304             \else
2305                 \hfil
2306             \fi
2307             \strut@
2308             $\m@th\displaystyle{}##\endmultline@math
2309             \hfil
2310         }%
2311         \crcr
2312         \if@fleqn
2313             \hskip-\@mathmargin
2314             \def\multline@indent{\hskip\@mathmargin}% put it back
2315         \else
2316             \hfilneg
2317             \def\multline@indent{\hskip\multlinegap}%
2318         \fi
2319         \iftagsleft@
2320             \iftag@
2321                 \begingroup
2322                     \ifshifttag@
2323                         \rlap{\vbox{%
2324                                 \normalbaselines
2325                                 \hbox{%
2326                                     \strut@
2327                                     \make@display@tag
2328                                 }%
2329                                 \vbox to\lineht@{}%
2330                                 \raise@tag
2331                         }}%
2332                         \multline@indent
2333                     \else
2334                         \setbox\z@\hbox{\make@display@tag}%
2335                         \dimen@\@mathmargin \advance\dimen@-\wd\z@
2336                         \ifdim\dimen@<\multlinetaggap
2337                           \dimen@\multlinetaggap
2338                         \fi
2339                         \box\z@ \hskip\dimen@\relax
2340                     \fi
2341                 \endgroup
2342             \else
2343                 \multline@indent
2344             \fi
2345         \else
2346             \multline@indent
2347         \fi
2348     #1%
2349 }
2350 \def\endmultline@math{$}
2351 \def\lendmultline@{%
2352         \hfilneg
2353         \hskip\multlinegap
2354         \math@cr
2355     \egroup
2356     $$%
2357 }
2358 \def\rendmultline@{%
2359     \iftag@
2360         $\let\endmultline@math\relax
2361             \ifshifttag@
2362                 \hskip\multlinegap
2363                 \llap{\vtop{%
2364                     \raise@tag
2365                     \normalbaselines
2366                     \setbox\@ne\null
2367                     \dp\@ne\lineht@
2368                     \box\@ne
2369                     \hbox{\strut@\make@display@tag}%
2370                 }}%
2371             \else
2372                 \hskip\multlinetaggap
2373                 \make@display@tag
2374             \fi
2375     \else
2376         \hskip\multlinegap
2377     \fi
2378     \hfilneg
2379         \math@cr
2380     \egroup$$%
2381 }
2382 \def\mmeasure@#1{%
2383     \begingroup
2384         \measuring@true
2385         \def\label##1{%
2386           \begingroup\measuring@false\label@in@display{##1}\endgroup}%
2387         \def\math@cr@@@{\cr}%
2388         \let\shoveleft\@iden \let\shoveright\@iden
2389         \savecounters@
2390         \global\row@\z@
2391         \setbox\@ne\vbox{%
2392             \global\let\df@tag\@empty
2393             \halign{%
2394                 \setboxz@h{\@lign$\m@th\displaystyle{}##$}%
2395                 \iftagsleft@
2396                     \ifnum\row@=\@ne
2397                         \global\totwidth@\wdz@
2398                         \global\lineht@\ht\z@
2399                     \fi
2400                 \else
2401                     \global\totwidth@\wdz@
2402                     \global\lineht@\dp\z@
2403                 \fi
2404                 \crcr
2405                 #1%
2406                 \crcr
2407             }%
2408         }%
2409         \ifx\df@tag\@empty\else\global\tag@true\fi
2410         \if@eqnsw\global\tag@true\fi
2411         \iftag@
2412             \setboxz@h{%
2413                 \if@eqnsw
2414                     \stepcounter{equation}%
2415                     \tagform@\theequation
2416                 \else
2417                     \df@tag
2418                 \fi
2419             }%
2420             \global\tagwidth@\wdz@
2421             \dimen@\totwidth@
2422             \advance\dimen@\tagwidth@
2423             \advance\dimen@\multlinetaggap
2424             \iftagsleft@\else
2425                 \if@fleqn
2426                     \advance\dimen@\@mathmargin
2427                 \fi
2428             \fi
2429             \ifdim\dimen@>\displaywidth
2430                 \global\shifttag@true
2431             \else
2432                 \global\shifttag@false
2433             \fi
2434         \fi
2435         \restorecounters@
2436     \endgroup
2437 }
2438 \iftagsleft@
2439     \def\shoveright#1{%
2440         #1%
2441         \hfilneg
2442         \hskip\multlinegap
2443     }
2444 \else
2445     \def\shoveright#1{%
2446         #1%
2447         \hfilneg
2448         \iftag@
2449             \ifshifttag@
2450                 \hskip\multlinegap
2451             \else
2452                 \hskip\tagwidth@
2453                 \hskip\multlinetaggap
2454             \fi
2455         \else
2456             \hskip\multlinegap
2457         \fi
2458     }
2459 \fi
2460
2461 \if@fleqn
2462     \def\shoveleft#1{#1}%
2463 \else
2464     \iftagsleft@
2465         \def\shoveleft#1{%
2466             \setboxz@h{$\m@th\displaystyle{}#1$}%
2467             \setbox\@ne\hbox{$\m@th\displaystyle#1$}%
2468             \hfilneg
2469             \iftag@
2470                 \ifshifttag@
2471                     \hskip\multlinegap
2472                 \else
2473                     \hskip\tagwidth@
2474                     \hskip\multlinetaggap
2475                 \fi
2476             \else
2477                 \hskip\multlinegap
2478             \fi
2479             \hskip.5\wd\@ne
2480             \hskip-.5\wdz@
2481             #1%
2482         }
2483     \else
2484         \def\shoveleft#1{%
2485             \setboxz@h{$\m@th\displaystyle{}#1$}%
2486             \setbox\@ne\hbox{$\m@th\displaystyle#1$}%
2487             \hfilneg
2488             \hskip\multlinegap
2489             \hskip.5\wd\@ne
2490             \hskip-.5\wdz@
2491             #1%
2492         }
2493     \fi
2494 \fi
2495 \@saveprimitive\leqno\@@leqno
2496 \@saveprimitive\eqno\@@eqno
2497 \def\eqno{\@@eqno\let\eqno\relax\let\leqno\relax}
2498 \def\leqno{\@@leqno\let\leqno\relax\let\eqno\relax}
2499 \let\veqno=\@@eqno
2500 \iftagsleft@ \let\veqno=\@@leqno \fi
2501 \@ifundefined{SK@@label}{%
2502   \let\SK@@label\relax \let\SK@equationtrue\relax
2503 }{}
2504 \let\reset@equation\@empty
2505 \let\alt@tag\@empty
2506 \def\tag@in@display#1#{\relax\tag@in@display@a{#1}}
2507 \def\tag@in@display@a#1#2{%
2508   \iftag@
2509     \invalid@tag{Multiple \string\tag}\relax
2510   \else
2511     \global\tag@true \nonumber \reset@equation \st@rredtrue
2512     \if *\string#1%
2513       \gdef\alt@tag{\def\SK@tagform@{#2\@gobble}%
2514         \ifx\SK@@label\relax \let\tagform@\SK@tagform@ \fi
2515       }%
2516       \make@df@tag@@{#2}%
2517     \else
2518       \make@df@tag@@@{#2}%
2519     \fi
2520   \fi
2521 }
2522 \let\restore@hfuzz\@empty
2523 \def\mathdisplay#1{%
2524   \ifmmode \@badmath
2525   \else
2526     $$\def\@currenvir{#1}%
2527     \let\dspbrk@context\z@
2528     \let\tag\tag@in@display \let\label\label@in@display \SK@equationtrue
2529     \global\let\df@label\@empty \global\let\df@tag\@empty
2530     \global\tag@false
2531     \let\mathdisplay@push\mathdisplay@@push
2532     \let\mathdisplay@pop\mathdisplay@@pop
2533     \if@fleqn
2534       \edef\restore@hfuzz{\hfuzz\the\hfuzz\relax}%
2535       \hfuzz\maxdimen
2536       \setbox\z@\hbox to\displaywidth\bgroup
2537         \let\split@warning\relax \restore@hfuzz
2538         \everymath\@emptytoks \m@th $\displaystyle
2539     \fi
2540   \fi
2541 }
2542 \def\endmathdisplay#1{%
2543   \ifmmode \else \@badmath \fi
2544   \endmathdisplay@a
2545   $$%
2546   \global\let\df@label\@empty \global\let\df@tag\@empty
2547   \global\tag@false \global\let\alt@tag\@empty
2548   \global\@eqnswfalse
2549 }
2550 \def\endmathdisplay@a{%
2551   \if@eqnsw \gdef\df@tag{\tagform@\theequation}\fi
2552   \if@fleqn \@xp\endmathdisplay@fleqn
2553   \else \ifx\df@tag\@empty \else \veqno \alt@tag \df@tag \fi
2554     \ifx\df@label\@empty \else \@xp\ltx@label\@xp{\df@label}\fi
2555   \fi
2556   \ifnum\dspbrk@lvl>\m@ne
2557     \postdisplaypenalty -\@getpen\dspbrk@lvl
2558     \global\dspbrk@lvl\m@ne
2559   \fi
2560 }
2561 \let\too@wide\@ne
2562 \def\endmathdisplay@fleqn{%
2563   $\hfil\hskip\@mathmargin\egroup
2564   \ifnum\badness<\inf@bad \let\too@wide\@ne \else \let\too@wide\z@ \fi
2565   \ifx\@empty\df@tag
2566   \else
2567     \setbox4\hbox{\df@tag
2568       \ifx\df@label\@empty \else \@xp\ltx@label\@xp{\df@label}\fi
2569     }%
2570   \fi
2571   \csname emdf@%
2572     \ifx\df@tag\@empty U\else \iftagsleft@ L\else R\fi\fi
2573   \endcsname
2574 }
2575 \def\emdf@U{%
2576   \restore@hfuzz
2577   \ifodd\too@wide % not too wide: just need to swap the glue around
2578     \hbox to\displaywidth{\hskip\@mathmargin\unhbox\z@\unskip}%
2579   \else % M+B > displaywidth
2580     \emdf@Ua
2581   \fi
2582 }
2583 \def\emdf@Ua{%
2584   \hbox to\columnwidth{%
2585     \ifdim\displayindent>\z@
2586       \hskip\displayindent minus\displayindent
2587     \fi
2588     \hskip\@mathmargin \unhbox\z@ \unskip
2589   }%
2590   \displayindent\z@ \displaywidth\columnwidth
2591 }
2592 \def\emdf@R{%
2593   \setbox\tw@\hbox to\displaywidth{%
2594     \hskip\@mathmargin \unhcopy\z@\unskip\hfil\hskip\mintagsep\copy4
2595   }%
2596   \restore@hfuzz
2597   \ifnum\badness<\inf@bad \box\tw@ \else \emdf@Ra \fi
2598 }
2599 \def\emdf@Ra{%
2600   \skip@\displayindent minus\displayindent
2601   \displayindent\z@ \displaywidth\columnwidth
2602   \spread@equation \everycr{}\tabskip\z@skip
2603   \halign{\hbox to\displaywidth{##}\cr
2604     \relax
2605     \ifdim\skip@>\z@ \hskip\skip@ \fi
2606     \hskip\@mathmargin\unhbox\z@\unskip\hfil\cr
2607     \noalign{\raise@tag}%
2608     \hfil\box4 \cr}%
2609 }
2610 \def\emdf@L{%
2611   \@tempdima\@mathmargin
2612   \advance\@tempdima-\wd4 \advance\@tempdima-\mintagsep
2613   \skip@\@tempdima minus\@tempdima
2614   \setbox\tw@\hbox to\displaywidth{%
2615     \copy4\hskip\mintagsep
2616     \ifdim\skip@>\z@ \hskip\skip@\fi
2617     \unhcopy\z@\unskip
2618   }%
2619   \restore@hfuzz
2620   \ifnum\badness<\inf@bad \box\tw@ \else \emdf@La \fi
2621 }
2622 \def\emdf@La{%
2623   \spread@equation \everycr{}\tabskip\z@skip
2624   \halign{\hbox to\displaywidth{##}\cr
2625     \box4 \hfil \cr
2626     \noalign{\raise@tag}%
2627     \hskip\@mathmargin\unhbox\z@\unskip\hfil\cr}%
2628 }
2629 \newtoks\mathdisplay@stack
2630 \let\mathdisplay@push\@empty
2631 \def\mathdisplay@@push{%
2632   \begingroup
2633   \toks@\@xp{\df@label}\@temptokena\@xp{\df@tag}%
2634   \toks8\@xp{\alt@tag}%
2635   \edef\@tempa{%
2636     \global\if@eqnsw\@nx\@eqnswtrue\else\@nx\@eqnswfalse\fi
2637     \global\iftag@\@nx\tag@false\else\@nx\tag@true\fi
2638     \gdef\@nx\df@label{\the\toks@}\gdef\@nx\df@tag{\the\@temptokena}%
2639     \gdef\@nx\alt@tag{\the\toks8}%
2640     \global\mathdisplay@stack{\the\mathdisplay@stack}%
2641   }%
2642   \global\mathdisplay@stack\@xp{\@tempa}
2643   \endgroup
2644 }
2645 \let\mathdisplay@pop\@empty
2646 \def\mathdisplay@@pop{\the\mathdisplay@stack}
2647 \renewenvironment{equation}{%
2648   \incr@eqnum
2649   \mathdisplay@push
2650   \st@rredfalse \global\@eqnswtrue
2651   \mathdisplay{equation}%
2652 }{%
2653   \endmathdisplay{equation}%
2654   \mathdisplay@pop
2655   \ignorespacesafterend
2656 }
2657 \newenvironment{equation*}{%
2658   \mathdisplay@push
2659   \st@rredtrue \global\@eqnswfalse
2660   \mathdisplay{equation*}%
2661 }{%
2662   \endmathdisplay{equation*}%
2663   \mathdisplay@pop
2664   \ignorespacesafterend
2665 }
2666 \DeclareRobustCommand{\[}{\begin{equation*}}
2667 \DeclareRobustCommand{\]}{\end{equation*}}
2668 \endinput
2669 %%
2670 %% End of file `amsmath.sty'.