Debian Codegraph @

texmf-dist/tex/latex/mathtools/mathtools.sty

raw
1 %%
2 %% This is file `mathtools.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% mathtools.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright (C) 2002-2011 by Morten Hoegholm
12 %% Copyright (C) 2012-2019 by Lars Madsen
13 %% Copyright (C) 2020- by Lars Madsen, the LaTeX3 project
14 %%
15 %%
16 %% This work may be distributed and/or modified under the
17 %% conditions of the LaTeX Project Public License, either
18 %% version 1.3c of this license or (at your option) any later
19 %% version. The latest version of this license is in
20 %% http://www.latex-project.org/lppl.txt
21 %% and version 1.3c or later is part of all distributions of
22 %% LaTeX version 2008/05/04 or later.
23 %%
24 %% This work has the LPPL maintenance status "maintained".
25 %%
26 %% This Current Maintainer of this work is
27 %% Lars Madsen and the LaTeX3 project
28 %%
29 %% This work consists of the main source file mathtools.dtx
30 %% and the derived files
31 %% mathtools.sty, mathtools.pdf, mathtools.ins, mathtools.drv.
32 %%
33
34 \ProvidesPackage{mathtools}%
35 [2024/10/04 v1.31 mathematical typesetting tools]
36 \RequirePackage{keyval,calc}
37 \RequirePackage{mhsetup}[2021/03/18]
38 \MHInternalSyntaxOn
39 % borrowed from fixltx2e
40 \def\EQ_MakeRobust#1{%
41 \@ifundefined{\expandafter\@gobble\string#1}{%
42 \@latex@error{The~control~sequence~`\string#1'~is~undefined!%
43 \MessageBreak There~is~nothing~here~to~make~robust}%
44 \@eha
45 }%
46 {%
47 \@ifundefined{\expandafter\@gobble\string#1\space}%
48 {%
49 \expandafter\let\csname
50 \expandafter\@gobble\string#1\space\endcsname=#1%
51 \edef\reserved@a{\string#1}%
52 \def\reserved@b{#1}%
53 \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}%
54 \edef#1{%
55 \ifx\reserved@a\reserved@b
56 \noexpand\x@protect\noexpand#1%
57 \fi
58 \noexpand\protect\expandafter\noexpand
59 \csname\expandafter\@gobble\string#1\space\endcsname}%
60 }%
61 {\@latex@info{The~control~sequence~`\string#1'~is~already~robust}}%
62 }%
63 }
64 \def\forced_EQ_MakeRobust#1{%
65 \@ifundefined{\expandafter\@gobble\string#1}{%
66 \@latex@error{The~control~sequence~`\string#1'~is~undefined!%
67 \MessageBreak There~is~nothing~here~to~make~robust}%
68 \@eha
69 }%
70 {%
71 % \@ifundefined{\expandafter\@gobble\string#1\space}%
72 % {%
73 \expandafter\let\csname
74 \expandafter\@gobble\string#1\space\endcsname=#1%
75 \edef\reserved@a{\string#1}%
76 \def\reserved@b{#1}%
77 \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}%
78 \edef#1{%
79 \ifx\reserved@a\reserved@b
80 \noexpand\x@protect\noexpand#1%
81 \fi
82 \noexpand\protect\expandafter\noexpand
83 \csname\expandafter\@gobble\string#1\space\endcsname}%
84 % }%
85 % {\@latex@info{The control sequence `\string#1' is already robust}}%
86 }%
87 }
88 \def\MT_options_name:{mathtools}
89 \newcommand*\mathtoolsset[1]{\setkeys{\MT_options_name:}{#1}}
90 \MH_new_boolean:n {fixamsmath}
91 \DeclareOption{fixamsmath}{
92 \MH_set_boolean_T:n {fixamsmath}
93 }
94 \DeclareOption{donotfixamsmathbugs}{
95 \MH_set_boolean_F:n {fixamsmath}
96 }
97 \DeclareOption{allowspaces}{
98 \MH_let:NwN \MaybeMHPrecedingSpacesOff
99 \relax
100 \MH_let:NwN \MH_maybe_nospace_ifnextchar:Nnn \kernel@ifnextchar
101 }
102 \DeclareOption{disallowspaces}{
103 \MH_let:NwN \MaybeMHPrecedingSpacesOff
104 \MHPrecedingSpacesOff
105 \MH_let:NwN \MH_maybe_nospace_ifnextchar:Nnn \MH_nospace_ifnextchar:Nnn
106 }
107 \MH_new_boolean:n {robustify}
108 \MH_set_boolean_T:n {robustify}
109 \DeclareOption{nonrobust}{
110 \MH_set_boolean_F:n {robustify}
111 }
112 \MH_new_boolean:n {legacycolonsymbols}
113 \MH_set_boolean_F:n {legacycolonsymbols}
114 \DeclareOption{legacycolonsymbols}{
115 \MH_set_boolean_T:n {legacycolonsymbols}
116 }
117 \DeclareOption*{
118 \PassOptionsToPackage{\CurrentOption}{amsmath}
119 }
120 \ExecuteOptions{fixamsmath,disallowspaces}
121 \ProcessOptions\relax
122 \MHInternalSyntaxOff
123 \RequirePackage{amsmath}[2016/11/05]
124 \@ifpackageloaded{unicode-math}{
125 \PackageWarning{mathtools}{For best results, please load mathtools
126 *before* \MessageBreak unicode-math}
127 }{}
128 \MHInternalSyntaxOn
129 \AtEndOfPackage{\MHInternalSyntaxOff}
130 \def\MT_true_false_error:{
131 \PackageError{mathtools}
132 {You~ have~ to~ select~ either~ `true'~ or~ `false'}
133 {I'll~ assume~ you~ chose~ `false'~ for~ now.}
134 }
135 \def\MT_define_tagform:nwnn #1[#2]#3#4{
136 \@namedef{MT_tagform_#1:n}##1
137 {\maketag@@@{#3\ignorespaces{#2{##1}}\unskip\@@italiccorr#4}}
138 }
139 \providecommand*\newtagform[1]{%
140 \@ifundefined{MT_tagform_#1:n}
141 {\@ifnextchar[%
142 {\MT_define_tagform:nwnn #1}%
143 {\MT_define_tagform:nwnn #1[]}%
144 }{\PackageError{mathtools}
145 {The~ tag~ form~ `#1'~ is~ already~ defined\MessageBreak
146 You~ probably~ want~ to~ look~ up~ \@backslashchar renewtagform~
147 instead}
148 {I~ will~ just~ ignore~ your~ wish~ for~ now.}}
149 }
150 \newtagform{default}{(}{)}
151 \providecommand*\renewtagform[1]{%
152 \@ifundefined{MT_tagform_#1:n}
153 {\PackageError{mathtools}
154 {The~ tag~ form~ `#1'~ is~ not~ defined\MessageBreak
155 You~ probably~ want~ to~ look~ up~ \@backslashchar newtagform~ instead}
156 {I~ will~ just~ ignore~ your~ wish~ for~ now.}}
157 {\@ifnextchar[%
158 {\MT_define_tagform:nwnn #1}%
159 {\MT_define_tagform:nwnn #1[]}%
160 }
161 }
162 \providecommand*\usetagform[1]{%
163 \@ifundefined{MT_tagform_#1:n}
164 {
165 \PackageError{mathtools}{%
166 You~ have~ chosen~ the~ tag~ form~ `#1'\MessageBreak
167 but~ it~ appears~ to~ be~ undefined}
168 {I~ will~ use~ the~ default~ tag~ form~ instead.}%
169 \@namedef{tagform@}{\@nameuse{MT_tagform_default:n}}
170 }
171 { \@namedef{tagform@}{\@nameuse{MT_tagform_#1:n}} }
172 \MH_if_boolean:nT {show_only_refs}{
173 \MH_let:NwN \MT_prev_tagform:n \tagform@
174 \def\tagform@##1{\MT_extended_tagform:n {##1}}
175 }
176 }
177 \MH_new_boolean:n {manual_tag}
178 \MH_new_boolean:n {raw_maketag}
179 \MH_let:NwN \MT_AmS_tag_in_align: \tag@in@align
180 \def\tag@in@align{
181 \global\MH_set_boolean_T:n {manual_tag}
182 \MT_AmS_tag_in_align:
183 }
184 \def\tag@in@display#1#{
185 \relax
186 \global\MH_set_boolean_T:n {manual_tag}
187 \tag@in@display@a{#1}
188 }
189 \def\MT_extended_tagform:n #1{
190 \MH_set_boolean_F:n {raw_maketag}
191 \MH_if_meaning:NN \df@label\@empty
192 \MH_if_boolean:nTF {manual_tag}% this was \MH_if_boolean:nT before
193 { \MH_if_boolean:nTF {show_manual_tags}
194 { \MT_prev_tagform:n {#1} }
195 { \stepcounter{equation} }
196 }{\kern1sp}% this last {\kern1sp} is new.
197 \MH_else:
198 \MH_if_boolean:nTF {manual_tag}
199 { \MH_if_boolean:nTF {show_manual_tags}
200 { \MT_prev_tagform:n {#1} }
201 { \@safe@activestrue
202 \@ifundefined{MT_r_\df@label}
203 { \global\MH_set_boolean_F:n {manual_tag} \kern1sp } % kern added 2020
204 { \MT_prev_tagform:n {#1} }
205 \@safe@activesfalse
206 }
207 }
208 {
209 \@safe@activestrue
210 \@ifundefined{MT_r_\df@label}
211 { \kern1sp }% kern added 2020
212 { \refstepcounter{equation}\MT_prev_tagform:n {#1} }
213 \@safe@activesfalse
214 }
215 \MH_fi:
216 \global\MH_set_boolean_T:n {raw_maketag}
217 }
218 \def\MT_extended_maketag:n #1{
219 \ifx\df@label\@empty
220 \MT_maketag:n {#1}
221 \MH_else:
222 \MH_if_boolean:nTF {raw_maketag}
223 {
224 \MH_if_boolean:nTF {show_manual_tags}
225 { \MT_maketag:n {#1} }
226 { \@safe@activestrue
227 \@ifundefined{MT_r_\df@label}
228 { }
229 { \MT_maketag:n {#1} }
230 \@safe@activesfalse
231 }
232 }
233 { \MT_maketag:n {#1} }
234 \MH_fi:
235 \global\MH_set_boolean_F:n {manual_tag}
236 }
237 \def\MT_extended_eqref:n #1{
238 \protected@write\@auxout{}
239 {\string\MT@newlabel{#1}}
240 \textup{\let\df@label\@empty\MT_prev_tagform:n {\ref{#1}}}
241 }
242 \EQ_MakeRobust\MT_extended_eqref:n
243 \newcommand*\refeq[1]{
244 \textup{\ref{#1}}
245 }
246 \def\MT_extended_refeq:n #1{
247 \protected@write\@auxout{}
248 {\string\MT@newlabel{#1}}
249 \textup{\ref{#1}}
250 }
251 \newcommand*\MT@newlabel[1]{ \global\@namedef{MT_r_#1}{} }
252 \MH_new_boolean:n {show_only_refs}
253 \MH_new_boolean:n {show_manual_tags}
254 \define@key{\MT_options_name:}{showmanualtags}[true]{
255 \@ifundefined{MH_boolean_show_manual_tags_#1:}
256 { \MT_true_false_error:
257 \@nameuse{MH_boolean_show_manual_tags_false:}
258 }
259 { \@nameuse{MH_boolean_show_manual_tags_#1:} }
260 }
261 \newcommand*\MT_showonlyrefs_true:{
262 \MH_if_boolean:nF {show_only_refs}{
263 \MH_set_boolean_T:n {show_only_refs}
264 \MH_let:NwN \MT_incr_eqnum: \incr@eqnum
265 \MH_let:NwN \incr@eqnum \@empty
266 \MH_let:NwN \MT_array_parbox_restore: \@arrayparboxrestore
267 \@xp\def\@xp\@arrayparboxrestore\@xp{\@arrayparboxrestore
268 \MH_let:NwN \incr@eqnum \@empty
269 }
270 \MH_let:NwN \MT_prev_tagform:n \tagform@
271 \MH_let:NwN \MT_eqref:n \eqref
272 \MH_let:NwN \MT_refeq:n \refeq
273 \MH_let:NwN \MT_maketag:n \maketag@@@
274 \MH_let:NwN \maketag@@@ \MT_extended_maketag:n
275 \def\tagform@##1{\MT_extended_tagform:n {##1}}
276 \MH_let:NwN \eqref \MT_extended_eqref:n
277 \MH_let:NwN \refeq \MT_extended_refeq:n
278 }
279 }
280 \def\MT_showonlyrefs_false: {
281 \MH_if_boolean:nT {show_only_refs}{
282 \MH_set_boolean_F:n {show_only_refs}
283 \MH_let:NwN \tagform@ \MT_prev_tagform:n
284 \MH_let:NwN \eqref \MT_eqref:n
285 \MH_let:NwN \refeq \MT_refeq:n
286 \MH_let:NwN \maketag@@@ \MT_maketag:n
287 \MH_let:NwN \incr@eqnum \MT_incr_eqnum:
288 \MH_let:NwN \@arrayparboxrestore \MT_array_parbox_restore:
289 }
290 }
291 \define@key{\MT_options_name:}{showonlyrefs}[true]{
292 \@nameuse{MT_showonlyrefs_#1:}
293 }
294 \renewcommand\nonumber{
295 \if@eqnsw
296 \MH_if_meaning:NN \incr@eqnum\@empty
297 \MH_if_boolean:nF {show_only_refs}
298 {\addtocounter{equation}\m@ne}
299 \MH_fi:
300 \MH_fi:
301 \MH_let:NwN \print@eqnum\@empty \MH_let:NwN \incr@eqnum\@empty
302 \global\@eqnswfalse
303 }
304 \MHInternalSyntaxOff
305 \newcommand\noeqref[1]{\@bsphack%
306 \@for\@tempa:=#1\do{%
307 \@safe@activestrue%
308 \edef\@tempa{\expandafter\@firstofone\@tempa}%
309 \@ifundefined{r@\@tempa}{%
310 \protect\G@refundefinedtrue%
311 \@latex@warning{Reference `\@tempa' on page \thepage \space
312 undefined (\string\noeqref)}%
313 }{}%
314 \if@filesw\protected@write\@auxout{}%
315 {\string\MT@newlabel{\@tempa}}\fi%
316 \@safe@activesfalse}%
317 \@esphack}
318
319 \providecommand\@safe@activestrue{}%
320 \providecommand\@safe@activesfalse{}%
321
322 \MHInternalSyntaxOn
323 \providecommand*\xleftrightarrow[2][]{%
324 \ext@arrow 3095\MT_leftrightarrow_fill:{#1}{#2}}
325 \def\MT_leftrightarrow_fill:{%
326 \arrowfill@\leftarrow\relbar\rightarrow}
327 \providecommand*\xLeftarrow[2][]{%
328 \ext@arrow 0055{\Leftarrowfill@}{\ #1}{\ #2}}
329 \providecommand*\xRightarrow[2][]{%
330 \ext@arrow 0055{\Rightarrowfill@}{#1\ }{#2\ }}
331 \providecommand*\xLeftrightarrow[2][]{%
332 \ext@arrow 0055{\Leftrightarrowfill@}{\ #1\ }{\ #2\ }}
333 \def\MT_rightharpoondown_fill:{%
334 \arrowfill@\relbar\relbar\rightharpoondown}
335 \def\MT_rightharpoonup_fill:{%
336 \arrowfill@\relbar\relbar\rightharpoonup}
337 \def\MT_leftharpoondown_fill:{%
338 \arrowfill@\leftharpoondown\relbar\relbar}
339 \def\MT_leftharpoonup_fill:{%
340 \arrowfill@\leftharpoonup\relbar\relbar}
341 \def\MT_longrightarrow_fill:{%
342 \arrowfill@\relbar\relbar\longrightarrow}
343 \def\MT_longleftarrow_fill:{%
344 \arrowfill@\longleftarrow\relbar\relbar}
345 \providecommand*\xrightharpoondown[2][]{%
346 \ext@arrow 0359\MT_rightharpoondown_fill:{#1}{#2}}
347 \providecommand*\xrightharpoonup[2][]{%
348 \ext@arrow 0359\MT_rightharpoonup_fill:{#1}{#2}}
349 \providecommand*\xleftharpoondown[2][]{%
350 \ext@arrow 3095\MT_leftharpoondown_fill:{#1}{#2}}
351 \providecommand*\xleftharpoonup[2][]{%
352 \ext@arrow 3095\MT_leftharpoonup_fill:{#1}{#2}}
353 \providecommand*\xleftrightharpoons[2][]{\mathrel{%
354 \raise.22ex\hbox{%
355 $\ext@arrow 3095\MT_leftharpoonup_fill:{\phantom{#1}}{#2}$}%
356 \setbox0=\hbox{%
357 $\ext@arrow 0359\MT_rightharpoondown_fill:{#1}{\phantom{#2}}$}%
358 \kern-\wd0 \lower.22ex\box0}}
359 \providecommand*\xrightleftharpoons[2][]{\mathrel{%
360 \raise.22ex\hbox{%
361 $\ext@arrow 0359\MT_rightharpoonup_fill:{\phantom{#1}}{#2}$}%
362 \setbox0=\hbox{%
363 $\ext@arrow 3095\MT_leftharpoondown_fill:{#1}{\phantom{#2}}$}%
364 \kern-\wd0 \lower.22ex\box0}}
365 \providecommand*\xlongrightarrow[2][]{%
366 \ext@arrow 0359\MT_longrightarrow_fill:{#1}{#2}}
367 \providecommand*\xlongleftarrow[2][]{%
368 \ext@arrow 3095\MT_longleftarrow_fill:{#1}{#2}}
369 \providecommand*\xhookleftarrow[2][]{%
370 \ext@arrow 3095\MT_hookleft_fill:{#1}{#2}}
371 \def\MT_hookleft_fill:{%
372 \arrowfill@\leftarrow\relbar{\relbar\joinrel\rhook}}
373 \providecommand*\xhookrightarrow[2][]{%
374 \ext@arrow 3095\MT_hookright_fill:{#1}{#2}}
375 \def\MT_hookright_fill:{%
376 \arrowfill@{\lhook\joinrel\relbar}\relbar\rightarrow}
377 \providecommand*\xmapsto[2][]{%
378 \ext@arrow 0395\MT_mapsto_fill:{#1}{#2}}
379 \def\MT_mapsto_fill:{%
380 \arrowfill@{\mapstochar\relbar}\relbar\rightarrow}
381 \def\MT_Longrightarrow_fill:{%
382 \arrowfill@\Relbar\Relbar\Longrightarrow}
383 \def\MT_Longleftarrow_fill:{%
384 \arrowfill@\Longleftarrow\Relbar\Relbar}
385
386 \providecommand*\xLongrightarrow[2][]{%
387 \ext@arrow 0359\MT_Longrightarrow_fill:{#1\ }{#2\ }}
388 \providecommand*\xLongleftarrow[2][]{%
389 \ext@arrow 3095\MT_Longleftarrow_fill:{\ #1}{\ #2}}
390
391 \providecommand*\underbracket{
392 \@ifnextchar[
393 {\MT_underbracket_I:w}
394 {\MT_underbracket_I:w[\l_MT_bracketheight_fdim]}}
395 \def\MT_underbracket_I:w[#1]{
396 \@ifnextchar[
397 {\MT_underbracket_II:w[#1]}
398 {\MT_underbracket_II:w[#1][.7\fontdimen5\textfont2]}}
399 \def\MT_underbracket_II:w[#1][#2]#3{%
400 \mathop{\vtop{\m@th\ialign{##
401 \crcr
402 $\hfil\displaystyle{#3}\hfil$%
403 \crcr
404 \noalign{\kern .2\fontdimen5\textfont2 \nointerlineskip}%
405 \upbracketfill {#1}{#2}%
406 \crcr}}}
407 \limits}
408 \def\upbracketfill#1#2{%
409 \sbox\z@{$\braceld$}
410 \edef\l_MT_bracketheight_fdim{\the\ht\z@}%
411 \upbracketend{#1}{#2}
412 \leaders \vrule \@height \z@ \@depth #1 \hfill
413 \upbracketend{#1}{#2}%
414 }
415 \def\upbracketend#1#2{\vrule \@height #2 \@width #1\relax}
416 \providecommand*\overbracket{
417 \@ifnextchar[
418 {\MT_overbracket_I:w}
419 {\MT_overbracket_I:w[\l_MT_bracketheight_fdim]}}
420 \def\MT_overbracket_I:w[#1]{
421 \@ifnextchar[
422 {\MT_overbracket_II:w[#1]}
423 {\MT_overbracket_II:w[#1][.7\fontdimen5\textfont2]}}
424 \def\MT_overbracket_II:w[#1][#2]#3{%
425 \mathop{\vbox{\m@th\ialign{##
426 \crcr
427 \downbracketfill{#1}{#2}%
428 \crcr
429 \noalign{\kern .2\fontdimen5\textfont2 \nointerlineskip}%
430 $\hfil\displaystyle{#3}\hfil$
431 \crcr}}}%
432 \limits}
433 \def\downbracketfill#1#2{%
434 \sbox\z@{$\braceld$}\edef\l_MT_bracketheight_fdim{\the\ht\z@}
435 \downbracketend{#1}{#2}
436 \leaders \vrule \@height #1 \@depth \z@ \hfill
437 \downbracketend{#1}{#2}%
438 }
439 \def\downbracketend#1#2{\vrule \@width #1\@depth #2\relax}
440 \MH_let:NwN \LaTeXunderbrace \underbrace
441 \def\underbrace#1{\mathop{\vtop{\m@th\ialign{##\crcr
442 $\hfil\displaystyle{#1}\hfil$\crcr
443 \noalign{\kern.7\fontdimen5\textfont2\nointerlineskip}%
444 \upbracefill\crcr\noalign{\kern.5\fontdimen5\textfont2}}}}\limits}
445 \MH_let:NwN \LaTeXoverbrace \overbrace
446 \def\overbrace#1{\mathop{\vbox{\m@th\ialign{##\crcr
447 \noalign{\kern.5\fontdimen5\textfont2}%
448 \downbracefill\crcr
449 \noalign{\kern.7\fontdimen5\textfont2\nointerlineskip}%
450 $\hfil\displaystyle{#1}\hfil$\crcr}}}\limits}
451 \providecommand*\lparen{(}
452 \providecommand*\rparen{)}
453
454 \def\vcentcolon{\mathrel{\mathop\ordinarycolon}}
455 \providecommand\ordinarycolon{:}
456 \begingroup
457 \catcode`\:=\active
458 \lowercase{\endgroup
459 \def\MT_activate_colon{%
460 \ifnum\mathcode`\:=32768\relax
461 \let\ordinarycolon= :%
462 \else
463 \mathchardef\ordinarycolon\mathcode`\: %
464 \fi
465 \let :\vcentcolon
466 }
467 }
468 \MH_new_boolean:n {center_colon}
469 \define@key{\MT_options_name:}{centercolon}[true]{
470 \@ifundefined{MT_active_colon_#1:}
471 { \MT_true_false_error:n
472 \@nameuse{MT_active_colon_false:}
473 }
474 { \@nameuse{MT_active_colon_#1:} }
475 }
476 \def\MT_active_colon_true: {
477 \MT_activate_colon
478 \MH_if_boolean:nF {center_colon}{
479 \MH_set_boolean_T:n {center_colon}
480 \edef\MT_active_colon_false:
481 {\mathcode`\noexpand\:=\the\mathcode`\:\relax}
482 \mathcode`\:=32768
483 }
484 }
485 \def\MT_active_colon_false:{}
486 \newcommand*\MATHT@dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon}
487 \newcommand*\MATHT@coloneq{\vcentcolon\mathrel{\mkern-1.2mu}=}
488 \newcommand*\MATHT@dblcoloneq{\dblcolon\mathrel{\mkern-1.2mu}=}
489 \newcommand*\MATHT@colondash{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
490 \newcommand*\MATHT@dblcolondash{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
491 \newcommand*\MATHT@eqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon}
492 \newcommand*\MATHT@eqdblcolon{=\mathrel{\mkern-1.2mu}\dblcolon}
493 \newcommand*\MATHT@dashcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon}
494 \newcommand*\MATHT@dashdblcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon}
495 \newcommand*\MATHT@colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx}
496 \newcommand*\MATHT@dblcolonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx}
497 \newcommand*\MATHT@approxcolon{\approx\mathrel{\mkern-1.2mu}\vcentcolon}
498 \newcommand*\MATHT@approxdblcolon{\approx\mathrel{\mkern-1.2mu}\dblcolon}
499 \newcommand*\MATHT@colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim}
500 \newcommand*\MATHT@dblcolonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim}
501 \newcommand*\MATHT@simcolon{\sim\mathrel{\mkern-1.2mu}\vcentcolon}
502 \newcommand*\MATHT@simdblcolon{\sim\mathrel{\mkern-1.2mu}\dblcolon}
503 \MH_if_boolean:nTF {legacycolonsymbols}{
504 \AtBeginDocument{
505 \providecommand*\dblcolon{\MATHT@dblcolon}
506 \providecommand*\coloneqq{\MATHT@coloneq}
507 \providecommand*\Coloneqq{\MATHT@dblcoloneq}
508 \providecommand*\coloneq{\MATHT@colondash}
509 \providecommand*\Coloneq{\MATHT@dblcolondash}
510 \providecommand*\eqqcolon{\MATHT@eqcolon}
511 \providecommand*\Eqqcolon{\MATHT@eqdblcolon}
512 \providecommand*\eqcolon{\MATHT@dashcolon}
513 \providecommand*\Eqcolon{\MATHT@dashdblcolon}
514 \providecommand*\colonapprox{\MATHT@colonapprox}
515 \providecommand*\Colonapprox{\MATHT@dblcolonapprox}
516 \providecommand*\colonsim{\MATHT@colonsim}
517 \providecommand*\Colonsim{\MATHT@dblcolonsim}
518 % new
519 \providecommand*\approxcolon{\MATHT@approxcolon}
520 \providecommand*\Approxcolon{\MATHT@approxdblcolon}
521 \providecommand*\simcolon{\MATHT@simcolon}
522 \providecommand*\Simcolon{\MATHT@simdblcolon}
523 \providecommand*\colondash{\MATHT@colondash}
524 \providecommand*\Colondash{\MATHT@dblcolondash}
525 \providecommand*\dashcolon{\MATHT@dashcolon}
526 \providecommand*\Dashcolon{\MATHT@dashdblcolon}
527 }
528 }{
529 \AtBeginDocument{
530 \providecommand*\dblcolon{\MATHT@dblcolon}
531 \providecommand*\coloneqq{\MATHT@coloneq} % duplet
532 \providecommand*\Coloneqq{\MATHT@dblcoloneq}% duplet
533 \providecommand*\coloneq{\MATHT@coloneq} % changed
534 \providecommand*\Coloneq{\MATHT@dblcoloneq} % changed
535 \providecommand*\eqqcolon{\MATHT@eqcolon} % duplet
536 \providecommand*\Eqqcolon{\MATHT@eqdblcolon}% duplet
537 \providecommand*\eqcolon{\MATHT@eqcolon} % changed
538 \providecommand*\Eqcolon{\MATHT@eqdblcolon} % changed
539 \providecommand*\colonapprox{\MATHT@colonapprox}
540 \providecommand*\Colonapprox{\MATHT@dblcolonapprox}
541 \providecommand*\colonsim{\MATHT@colonsim}
542 \providecommand*\Colonsim{\MATHT@dblcolonsim}
543 % new
544 \providecommand*\approxcolon{\MATHT@approxcolon}
545 \providecommand*\Approxcolon{\MATHT@approxdblcolon}
546 \providecommand*\simcolon{\MATHT@simcolon}
547 \providecommand*\Simcolon{\MATHT@simdblcolon}
548 \providecommand*\colondash{\MATHT@colondash}
549 \providecommand*\Colondash{\MATHT@dblcolondash}
550 \providecommand*\dashcolon{\MATHT@dashcolon}
551 \providecommand*\Dashcolon{\MATHT@dashdblcolon}
552 }
553 }
554 \let \AMS@math@cr@@ \math@cr@@
555 \MH_new_boolean:n {mult_firstline}
556 \MH_new_boolean:n {outer_mult}
557 \newcount\g_MT_multlinerow_int
558 \newdimen\l_MT_multwidth_dim
559 \newcommand*\MT_test_for_tcb_other:nnnnn [1]{
560 \MH_if:w t#1\relax
561 \expandafter\MH_use_choice_i:nnnn
562 \MH_else:
563 \MH_if:w c#1\relax
564 \expandafter\expandafter\expandafter\MH_use_choice_ii:nnnn
565 \MH_else:
566 \MH_if:w b#1\relax
567 \expandafter\expandafter\expandafter
568 \expandafter\expandafter\expandafter\expandafter
569 \MH_use_choice_iii:nnnn
570 \MH_else:
571 \expandafter\expandafter\expandafter
572 \expandafter\expandafter\expandafter\expandafter
573 \MH_use_choice_iv:nnnn
574 \MH_fi:
575 \MH_fi:
576 \MH_fi:
577 }
578 \def\MT_mult_invisible_line: {
579 \crcr
580 \global\MH_set_boolean_F:n {mult_firstline}
581 \hbox to \l_MT_multwidth_dim{}\crcr
582 \noalign{\vskip-\baselineskip \vskip-\normallineskip}
583 }
584 \def\MT_mult_mathcr_atat:w [#1]{%
585 \MH_if_num:w 0=`{\MH_fi: \iffalse}\MH_fi:
586 \MH_if_boolean:nT {mult_firstline}{
587 \kern\l_MT_mult_left_fdim
588 \MT_mult_invisible_line:
589 }
590 \crcr
591 \noalign{\vskip#1\relax}
592 \global\advance\g_MT_multlinerow_int\@ne
593 \MH_if_num:w \g_MT_multlinerow_int=\l_MT_multline_lastline_fint
594 \MH_let:NwN \math@cr@@\MT_mult_last_mathcr:w
595 \MH_fi:
596 }
597 \def\MT_mult_firstandlast_mathcr:w [#1]{%
598 \MH_if_num:w 0=`{\MH_fi: \iffalse}\MH_fi:
599 \kern\l_MT_mult_left_fdim
600 \MT_mult_invisible_line:
601 \noalign{\vskip#1\relax}
602 \kern\l_MT_mult_right_fdim
603 }
604 \def\MT_mult_last_mathcr:w [#1]{
605 \MH_if_num:w 0=`{\MH_fi: \iffalse}\MH_fi:\math@cr@@@
606 \noalign{\vskip#1\relax}
607 \kern\l_MT_mult_right_fdim}
608 \newcommand\MT_start_mult:N [1]{
609 \MT_test_for_tcb_other:nnnnn {#1}
610 { \MH_let:NwN \MT_next:\vtop }
611 { \MH_let:NwN \MT_next:\vcenter }
612 { \MH_let:NwN \MT_next:\vbox }
613 {
614 \PackageError{mathtools}
615 {Invalid~ position~ specifier.~ I'll~ try~ to~ recover~ with~
616 `c'}\@ehc
617 }
618 \collect@body\MT_mult_internal:n
619 }
620 \newcommand*\MT_shoveright:wn [2][0pt]{%
621 #2\hfilneg
622 \setlength\@tempdima{#1}
623 \kern\@tempdima
624 }
625 \newcommand*\MT_shoveleft:wn [2][0pt]{%
626 \hfilneg
627 \setlength\@tempdima{#1}
628 \kern\@tempdima
629 #2
630 }
631 \newcommand*\MT_mult_internal:n [1]{
632 \MH_if_boolean:nF {outer_mult}{\alignedspace@left} %<-- requires amsmath 2016/11/05
633 \MT_next:
634 \bgroup
635 \Let@
636 \def\l_MT_multline_lastline_fint{0 }
637 \chardef\dspbrk@context\@ne \restore@math@cr
638 \MH_let:NwN \math@cr@@\MT_mult_mathcr_atat:w
639 \MH_let:NwN \shoveleft\MT_shoveleft:wn
640 \MH_let:NwN \shoveright\MT_shoveright:wn
641 \spread@equation
642 \MH_set_boolean_F:n {mult_firstline}
643 \MT_measure_mult:n {#1}
644 \MH_if_dim:w \l_MT_multwidth_dim<\l_MT_multline_measure_fdim
645 \MH_setlength:dn \l_MT_multwidth_dim{\l_MT_multline_measure_fdim}
646 \fi
647 \MH_set_boolean_T:n {mult_firstline}
648 \MH_if_num:w \l_MT_multline_lastline_fint=\@ne
649 \MH_let:NwN \math@cr@@ \MT_mult_firstandlast_mathcr:w
650 \MH_fi:
651 \ialign\bgroup
652 \hfil\strut@$\m@th\displaystyle{}##$\hfil
653 \crcr
654 \hfilneg
655 #1
656 }
657 \newcommand\MT_measure_mult:n [1]{
658 \begingroup
659 \measuring@true
660 \g_MT_multlinerow_int\@ne
661 \MH_let:NwN \label\MT_gobblelabel:w
662 \MH_let:NwN \tag\gobble@tag
663 \setbox\z@\vbox{
664 \ialign{\strut@$\m@th\displaystyle{}##$
665 \crcr
666 #1
667 \crcr
668 }
669 }
670 \xdef\l_MT_multline_measure_fdim{\the\wdz@}
671 \advance\g_MT_multlinerow_int\m@ne
672 \xdef\l_MT_multline_lastline_fint{\number\g_MT_multlinerow_int}
673 \endgroup
674 \g_MT_multlinerow_int\@ne
675 }
676 \MaybeMHPrecedingSpacesOff
677 \newcommand*\MT_multlined_second_arg:w [1][\@empty]{
678 \MT_test_for_tcb_other:nnnnn {#1}
679 {\def\MT_mult_default_pos:{#1}}
680 {\def\MT_mult_default_pos:{#1}}
681 {\def\MT_mult_default_pos:{#1}}
682 {
683 \MH_if_meaning:NN \@empty#1\@empty
684 \MH_else:
685 \setlength \l_MT_multwidth_dim{#1}
686 \MH_fi:
687 }
688 \MT_start_mult:N \MT_mult_default_pos:
689 }
690 \ifx\directlua\@undefined
691 % THIS IS NORMAL
692 \newcommand\MultlinedHook{
693 \renewenvironment{subarray}[1]{%
694 \vcenter\bgroup
695 \Let@ \restore@math@cr \default@tag
696 \let\math@cr@@\AMS@math@cr@@ % <--- the fix
697 \baselineskip\fontdimen10 \scriptfont\tw@
698 \advance\baselineskip\fontdimen12 \scriptfont\tw@
699 \lineskip\thr@@\fontdimen8 \scriptfont\thr@@
700 \lineskiplimit\lineskip
701 \ialign\bgroup\ifx c##1\hfil\fi
702 $\m@th\scriptstyle####$\hfil\crcr
703 }{%
704 \crcr\egroup\egroup
705 }
706 \renewenvironment{crampedsubarray}[1]{%
707 \vcenter\bgroup
708 \Let@ \restore@math@cr \default@tag
709 \let\math@cr@@\AMS@math@cr@@ % <--- the fix
710 \baselineskip\fontdimen10 \scriptfont\tw@
711 \advance\baselineskip\fontdimen12 \scriptfont\tw@
712 \lineskip\thr@@\fontdimen8 \scriptfont\thr@@
713 \lineskiplimit\lineskip
714 \ialign\bgroup\ifx c##1\hfil\fi
715 \span\MT_cramped_internal:Nn \scriptstyle {####}%
716 \hfil\crcr
717 }{%
718 \crcr\egroup\egroup
719 }
720 % from mathtools
721 \def\MT_smallmatrix_begin:N ##1{%
722 \Let@\restore@math@cr\default@tag
723 \let\math@cr@@\AMS@math@cr@@ % <--- the fix
724 \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
725 \csname MT_smallmatrix_##1_begin:\endcsname
726 }
727 % from amsmath
728 \renewenvironment{smallmatrix}{\null\,\vcenter\bgroup
729 \Let@\restore@math@cr\default@tag
730 \let\math@cr@@\AMS@math@cr@@ % <--- the fix
731 \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
732 \ialign\bgroup\hfil$\m@th\scriptstyle####$\hfil&&\thickspace\hfil
733 $\m@th\scriptstyle####$\hfil\crcr
734 }{%
735 \crcr\egroup\egroup\,%
736 }
737 }
738 \else
739 % THIS IS LUALATEX
740 \newcommand\MultlinedHook{
741 % from amsmath
742 \renewenvironment{subarray}[1]{%
743 \vcenter\bgroup
744 \Let@ \restore@math@cr \default@tag
745 \let\math@cr@@\AMS@math@cr@@ % <--- the fix
746 \baselineskip \Umathstacknumup \scriptstyle
747 \advance\baselineskip \Umathstackdenomdown \scriptstyle
748 \lineskip \Umathstackvgap \scriptstyle
749 \lineskiplimit \lineskip
750 \ialign\bgroup\ifx c##1\hfil\fi
751 \Ustartmath
752 \m@th\scriptstyle####
753 \Ustopmath
754 \hfil\crcr
755 }{%
756 \crcr\egroup\egroup
757 }
758 % from mathtools
759 \renewenvironment{crampedsubarray}[1]{%
760 \vcenter\bgroup
761 \Let@ \restore@math@cr \default@tag
762 \let\math@cr@@\AMS@math@cr@@ % <--- the fix
763 \baselineskip \Umathstacknumup \scriptstyle
764 \advance\baselineskip \Umathstackdenomdown \scriptstyle
765 \lineskip \Umathstackvgap \scriptstyle
766 \lineskiplimit \lineskip
767 \ialign\bgroup\ifx c##1\hfil\fi
768 \Ustartmath
769 \crampedscriptstyle{####}
770 \Ustopmath
771 \hfil\crcr
772 }{%
773 \crcr\egroup\egroup
774 }
775 % from mathtools
776 \def\MT_smallmatrix_begin:N ##1{%
777 \Let@\restore@math@cr\default@tag
778 \let\math@cr@@\AMS@math@cr@@ % <--- the fix
779 \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
780 \csname MT_smallmatrix_##1_begin:\endcsname
781 }
782 % from amsmath
783 \renewenvironment{smallmatrix}{\null\,\vcenter\bgroup
784 \Let@\restore@math@cr\default@tag
785 \let\math@cr@@\AMS@math@cr@@ % <--- the fix
786 \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
787 \ialign\bgroup\hfil$\m@th\scriptstyle####$\hfil&&\thickspace\hfil
788 $\m@th\scriptstyle####$\hfil\crcr
789 }{%
790 \crcr\egroup\egroup\,%
791 }
792 }
793 \fi
794
795 \newenvironment{multlined}[1][]
796 {\MH_group_align_safe_begin:
797 \MultlinedHook
798 \MT_test_for_tcb_other:nnnnn {#1}
799 {\def\MT_mult_default_pos:{#1}}
800 {\def\MT_mult_default_pos:{#1}}
801 {\def\MT_mult_default_pos:{#1}}
802 {
803 \MH_if_meaning:NN \@empty#1\@empty
804 \MH_else:
805 \setlength \l_MT_multwidth_dim{#1}
806 \MH_fi:
807 }
808 \MT_multlined_second_arg:w
809 }
810 {
811 \hfilneg \endaligned \MH_group_align_safe_end:
812 }
813 \MHPrecedingSpacesOn
814 \define@key{\MT_options_name:}
815 {firstline-afterskip}{\def\l_MT_mult_left_fdim{#1}}
816 \define@key{\MT_options_name:}
817 {lastline-preskip}{\def\l_MT_mult_right_fdim{#1}}
818 \define@key{\MT_options_name:}
819 {multlined-width}{\setlength \l_MT_multwidth_dim{#1}}
820 \define@key{\MT_options_name:}
821 {multlined-pos}{\def\MT_mult_default_pos:{#1}}
822 \setkeys{\MT_options_name:}{
823 firstline-afterskip=\multlinegap,
824 lastline-preskip=\multlinegap,
825 multlined-width=0pt,
826 multlined-pos=c,
827 }
828 \def\MT_gobblelabel:w #1{}
829 \newcommand\MT_delim_default_inner_wrappers:n [1]{
830 \@namedef{MT_delim_\MH_cs_to_str:N #1 _star_wrapper:nnn}##1##2##3{
831 \mathopen{}\mathclose\bgroup ##1 ##2 \aftergroup\egroup ##3
832 }
833 \@namedef{MT_delim_\MH_cs_to_str:N #1 _nostarscaled_wrapper:nnn}##1##2##3{
834 \mathopen{##1}##2\mathclose{##3}
835 }
836 \@namedef{MT_delim_\MH_cs_to_str:N #1 _nostarnonscaled_wrapper:nnn}##1##2##3{
837 \ifx.##1\else\mathopen##1\fi##2\ifx.##3\else\mathclose##3\fi
838 }
839 }
840
841 \newcommand\reDeclarePairedDelimiterInnerWrapper[3]{
842 \@ifundefined{MT_delim_\MH_cs_to_str:N #1 _ #2 _wrapper:nnn}{
843 \PackageError{mathtools}{
844 Wrapper~not~found~for~\string#1~and~option~'#2'.\MessageBreak
845 Either~\string#1~is~ not~ defined,~or~ you~ are~using~ the~
846 \MessageBreak
847 'nostar'~ option,~which~ is~ no~ longer~ supported.~
848 \MessageBreak
849 Please~ use~ 'nostarnonscaled'~ or~ 'nostarscaled~
850 \MessageBreak instead.~
851 }{See the manual}
852 }{
853 \@namedef{MT_delim_\MH_cs_to_str:N #1 _ #2 _wrapper:nnn}##1##2##3{
854 #3
855 }
856 }
857 }
858
859 \def\MT_etb_ifdefempty_x:nnn #1{
860 \expandafter\expandafter\expandafter
861 \MT_etb_ifblank:nnn
862 \expandafter\expandafter\expandafter{%
863 \expandafter\strip@prefix\meaning#1}
864 }
865 \def\MT_etb_ifblank:nnn #1{
866 \expandafter\ifx\expandafter\relax\detokenize\expandafter{\@gobble#1?}\relax
867 \expandafter\@firstoftwo
868 \else
869 \expandafter\@secondoftwo
870 \fi
871 }
872
873 \newcommand*\DeclarePairedDelimiter[3]{%
874 \@ifdefinable{#1}{
875 \MT_delim_default_inner_wrappers:n{#1} % define the wrappers
876 \@namedef{MT_delim_\MH_cs_to_str:N #1 _star:}##1
877 { \@nameuse{MT_delim_\MH_cs_to_str:N #1 _star_wrapper:nnn}%
878 {\left#2}{##1}{\right#3} }%
879 \@xp\@xp\@xp
880 \newcommand
881 \@xp\csname MT_delim_\MH_cs_to_str:N #1 _nostar:\endcsname
882 [2][\\@gobble]
883 {
884 \def\@tempa{\\@gobble}
885 \def\@tempb{##1}
886 \ifx\@tempa\@tempb
887 \@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostarnonscaled_wrapper:nnn}%
888 {#2}
889 {##2}
890 {#3}
891 \else
892 \MT_etb_ifblank:nnn {##1}{
893 \@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostarnonscaled_wrapper:nnn}%
894 {#2}
895 {##2}
896 {#3}
897 }{
898 \@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostarscaled_wrapper:nnn}%
899 {\@nameuse {\MH_cs_to_str:N ##1 l} #2}
900 {##2}
901 {\@nameuse {\MH_cs_to_str:N ##1 r} #3}
902 }
903 \fi
904 }
905 \DeclareRobustCommand{#1}{
906 \@ifstar
907 {\@nameuse{MT_delim_\MH_cs_to_str:N #1 _star:}}
908 {\@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostar:}}
909 }
910 }
911 }
912 \def\MT_paired_delimx_arg_test:n #1{
913 \ifnum#1>9\relax
914 \PackageError{mathtools}{No~ more~ than~ 9~ arguments}{}
915 \else
916 \ifnum#1<1\relax
917 \PackageError{mathtools}{Macro~ need~ 1~ or~ more~
918 arguments.\MessageBreak Please~ change~ [#1]~ to~ [1]~ ... [9]}{}
919 \fi
920 \fi
921 }
922
923 \def\@MHempty{}
924 \newcommand\MT_delim_inner_generator:nnnnnnn [7]{
925 \@xp\@xp\@xp
926 \newcommand
927 \@xp\csname MT_delim_\MH_cs_to_str:N #1 _nostar_inner:\endcsname
928 [#2]
929 {
930 #3
931 \def\@tempa{\@MHempty}
932 \@xp\def\@xp\@tempb\@xp{\delimsize}
933 \ifx\@tempa\@tempb
934 \@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostarnonscaled_wrapper:nnn}
935 {#4}{#7}{#5}
936 \else
937 \MT_etb_ifdefempty_x:nnn {\delimsize}{
938 \@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostarnonscaled_wrapper:nnn}
939 {#4}{#7}{#5}
940 }{
941 \@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostarscaled_wrapper:nnn}
942 {
943 \@xp\@xp\@xp\csname\@xp\MH_cs_to_str:N \delimsize l\endcsname #4
944 }
945 {#7}
946 {
947 \@xp\@xp\@xp\csname\@xp\MH_cs_to_str:N \delimsize r\endcsname #5
948 }
949 }
950 \fi
951 #6
952 \endgroup
953 }
954 }
955
956 \def\DeclarePairedDelimiterXPP#1[#2]#3#4#5#6#7{%
957 \@ifdefinable{#1}{
958 \MT_paired_delimx_arg_test:n{#2}
959 \MT_delim_default_inner_wrappers:n{#1}
960 \@xp\@xp\@xp
961 \newcommand
962 \@xp\csname MT_delim_\MH_cs_to_str:N #1 _star:\endcsname
963 [#2]
964 {
965 \begingroup
966 \def\delimsize{\middle}
967 #3
968 \@nameuse{MT_delim_\MH_cs_to_str:N #1 _star_wrapper:nnn}
969 {\left#4}{#7}{\right#5}
970 #6
971 \endgroup
972 }
973 \@xp\@xp\@xp
974 \newcommand
975 \@xp\csname MT_delim_\MH_cs_to_str:N #1 _nostar:\endcsname
976 [1][\@MHempty]
977 {
978 \begingroup
979 \def\delimsize{##1}
980 \@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostar_inner:}
981 }
982 \MT_delim_inner_generator:nnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}{#7}
983 \DeclareRobustCommand{#1}{
984 \@ifstar
985 {\@nameuse{MT_delim_\MH_cs_to_str:N #1 _star:}}
986 {\@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostar:}}
987 }
988 }
989 }
990
991 \def\DeclarePairedDelimiterX#1[#2]#3#4#5{
992 \DeclarePairedDelimiterXPP{#1}[#2]{}{#3}{#4}{}{#5}
993 }
994
995 \def\MT_start_cases:nnnn #1#2#3#4{ % #1=sep,#2=lpreamble,#3=rpreamble,#4=delim
996 \RIfM@\else
997 \nonmatherr@{\begin{\@currenvir}}
998 \fi
999 \MH_group_align_safe_begin:
1000 \left#4
1001 \vcenter \bgroup
1002 \Let@ \chardef\dspbrk@context\@ne \restore@math@cr
1003 \let \math@cr@@\AMS@math@cr@@
1004 \spread@equation
1005 \ialign\bgroup
1006 \strut@#2 &#1\strut@
1007 #3
1008 \crcr
1009 }
1010 \def\MH_end_cases:{\crcr\egroup
1011 \restorecolumn@
1012 \egroup
1013 \MH_group_align_safe_end:
1014 }
1015 \newcommand*\newcases[6]{% #1=name, #2=sep, #3=preamble, #4=left, #5=right
1016 \newenvironment{#1}
1017 {\MT_start_cases:nnnn {#2}{#3}{#4}{#5}}
1018 {\MH_end_cases:\right#6}
1019 }
1020 \newcommand*\renewcases[6]{
1021 \renewenvironment{#1}
1022 {\MT_start_cases:nnnn {#2}{#3}{#4}{#5}}
1023 {\MH_end_cases:\right#6}
1024 }
1025 \newcases{dcases}{\quad}{%
1026 $\m@th\displaystyle##$\hfil}{$\m@th\displaystyle##$\hfil}{\lbrace}{.}
1027 \newcases{dcases*}{\quad}{%
1028 $\m@th\displaystyle##$\hfil}{##\hfil}{\lbrace}{.}
1029 \newcases{rcases}{\quad}{%
1030 $\m@th##$\hfil}{$\m@th##$\hfil}{.}{\rbrace}
1031 \newcases{rcases*}{\quad}{%
1032 $\m@th##$\hfil}{##\hfil}{.}{\rbrace}
1033 \newcases{drcases}{\quad}{%
1034 $\m@th\displaystyle##$\hfil}{$\m@th\displaystyle##$\hfil}{.}{\rbrace}
1035 \newcases{drcases*}{\quad}{%
1036 $\m@th\displaystyle##$\hfil}{##\hfil}{.}{\rbrace}
1037 \newcases{cases*}{\quad}{%
1038 $\m@th##$\hfil}{##\hfil}{\lbrace}{.}
1039 \def\MT_matrix_begin:N #1{%
1040 \hskip -\arraycolsep
1041 \MH_let:NwN \@ifnextchar \MH_nospace_ifnextchar:Nnn
1042 \array{*\c@MaxMatrixCols #1}}
1043 \def\MT_matrix_end:{\endarray \hskip -\arraycolsep}
1044 \MaybeMHPrecedingSpacesOff
1045 \newenvironment{matrix*}[1][c]
1046 {\MT_matrix_begin:N #1}
1047 {\MT_matrix_end:}
1048 \newenvironment{pmatrix*}[1][c]
1049 {\left(\MT_matrix_begin:N #1}
1050 {\MT_matrix_end:\right)}
1051 \newenvironment{bmatrix*}[1][c]
1052 {\left[\MT_matrix_begin:N #1}
1053 {\MT_matrix_end:\right]}
1054 \newenvironment{Bmatrix*}[1][c]
1055 {\left\lbrace\MT_matrix_begin:N #1}
1056 {\MT_matrix_end:\right\rbrace}
1057 \newenvironment{vmatrix*}[1][c]
1058 {\left\lvert\MT_matrix_begin:N #1}
1059 {\MT_matrix_end:\right\rvert}
1060 \newenvironment{Vmatrix*}[1][c]
1061 {\left\lVert\MT_matrix_begin:N #1}
1062 {\MT_matrix_end:\right\lVert}
1063 \def\MT_smallmatrix_begin:N #1{%
1064 \Let@\restore@math@cr\default@tag
1065 \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
1066 \csname MT_smallmatrix_#1_begin:\endcsname
1067 }
1068 \def\MT_smallmatrix_end:{\crcr\egroup\egroup\MT_smallmatrix_inner_space:}
1069 \def\MT_smallmatrix_l_begin:{\null\MT_smallmatrix_inner_space:\vcenter\bgroup
1070 \ialign\bgroup$\m@th\scriptstyle##$\hfil&&\thickspace
1071 $\m@th\scriptstyle##$\hfil\crcr
1072 }
1073 \def\MT_smallmatrix_c_begin:{\null\MT_smallmatrix_inner_space:\vcenter\bgroup
1074 \ialign\bgroup\hfil$\m@th\scriptstyle##$\hfil&&\thickspace\hfil
1075 $\m@th\scriptstyle##$\hfil\crcr
1076 }
1077 \def\MT_smallmatrix_r_begin:{\null\MT_smallmatrix_inner_space:\vcenter\bgroup
1078 \ialign\bgroup\hfil$\m@th\scriptstyle##$&&\thickspace\hfil
1079 $\m@th\scriptstyle##$\crcr
1080 }
1081 \newenvironment{smallmatrix*}[1][\MT_smallmatrix_default_align:]
1082 {\MT_smallmatrix_begin:N #1}
1083 {\MT_smallmatrix_end:}
1084 \def\MT_fenced_sm_generator:nnn #1#2#3{%
1085 \@ifundefined{#1}{%
1086 \newenvironment{#1}
1087 {\@nameuse{#1hook}\mathopen{}\mathclose\bgroup\left#2\MT_smallmatrix_begin:N c}%
1088 {\MT_smallmatrix_end:\aftergroup\egroup\right#3}%
1089 }{}%
1090 \@ifundefined{#1*}{%
1091 \newenvironment{#1*}[1][\MT_smallmatrix_default_align:]%
1092 {\@nameuse{#1hook}\mathopen{}\mathclose\bgroup\left#2\MT_smallmatrix_begin:N ##1}%
1093 {\MT_smallmatrix_end:\aftergroup\egroup\right#3}%
1094 }{}%
1095 }
1096 \MT_fenced_sm_generator:nnn{psmallmatrix}()
1097 \MT_fenced_sm_generator:nnn{bsmallmatrix}[]
1098 \MT_fenced_sm_generator:nnn{Bsmallmatrix}\lbrace\rbrace
1099 \MT_fenced_sm_generator:nnn{vsmallmatrix}\lvert\rvert
1100 \MT_fenced_sm_generator:nnn{Vsmallmatrix}\lVert\rVert
1101 \define@key{\MT_options_name:}
1102 {smallmatrix-align}{\def\MT_smallmatrix_default_align:{#1}}
1103 \define@key{\MT_options_name:}
1104 {smallmatrix-inner-space}{\def\MT_smallmatrix_inner_space:{#1}}
1105 \setkeys{\MT_options_name:}{
1106 smallmatrix-align=c,
1107 smallmatrix-inner-space=\,
1108 }
1109
1110 \MHPrecedingSpacesOn
1111 \newcommand*\smashoperator[2][lr]{
1112 \@ifundefined{MT_smop_smash_#1:NNNNN}{
1113 \PackageError{mathtools}{Opt~ arg~ '#1'~ for~ \@backslashchar smashoperator~
1114 is~ not~ supported.\MessageBreak Use~ l,~r~or~lr~ (default)}{}
1115 }{
1116 \def\MT_smop_use:NNNNN {\@nameuse{MT_smop_smash_#1:NNNNN}}
1117 \toks@{#2}
1118 \expandafter\MT_smop_get_args:wwwNnNn
1119 \the\toks@\@nil\@nil\@nil\@nil\@nil\@nil\@@nil
1120 }
1121 }
1122 \def\MT_smop_remove_nil_vi:N #1\@nil\@nil\@nil\@nil\@nil\@nil{#1}
1123 \def\MT_smop_mathop:n {\mathop}
1124 \def\MT_smop_limits: {\limits}
1125 \MH_new_boolean:n {smop_one}
1126 \MH_new_boolean:n {smop_two}
1127 \def\MT_smop_get_args:wwwNnNn #1#2#3#4#5#6#7\@@nil{%
1128 \begingroup
1129 \def\MT_smop_arg_A: {#1} \def\MT_smop_arg_B: {#2}
1130 \def\MT_smop_arg_C: {#3} \def\MT_smop_arg_D: {#4}
1131 \def\MT_smop_arg_E: {#5} \def\MT_smop_arg_F: {#6}
1132 \def\MT_smop_arg_G: {#7}
1133 \MH_if_meaning:NN \MT_smop_arg_A: \MT_smop_mathop:n
1134 \MH_if_meaning:NN \MT_smop_arg_C:\MT_smop_limits:
1135 \def\MT_smop_final_arg_A:{#1{#2}}%
1136 \MH_if_meaning:NN \MT_smop_arg_D: \@nnil
1137 \MH_else:
1138 \MH_set_boolean_T:n {smop_one}
1139 \MH_let:NwN \MT_smop_final_arg_B: \MT_smop_arg_D:
1140 \MH_let:NwN \MT_smop_final_arg_C: \MT_smop_arg_E:
1141 \MH_if_meaning:NN \MT_smop_arg_F: \@nnil
1142 \MH_else:
1143 \MH_set_boolean_T:n {smop_two}
1144 \MH_let:NwN \MT_smop_final_arg_D: \MT_smop_arg_F:
1145 \edef\MT_smop_final_arg_E:
1146 {\expandafter\MT_smop_remove_nil_vi:N \MT_smop_arg_G: }
1147 \MH_fi:
1148 \MH_fi:
1149 \MH_else:
1150 \def\MT_smop_final_arg_A:{#1{#2}}%
1151 \MH_if_meaning:NN \MT_smop_arg_D: \@nnil
1152 \MH_else:
1153 \MH_set_boolean_T:n {smop_one}
1154 \MH_let:NwN \MT_smop_final_arg_B: \MT_smop_arg_C:
1155 \MH_let:NwN \MT_smop_final_arg_C: \MT_smop_arg_D:
1156 \MH_if_meaning:NN \MT_smop_arg_F: \@nnil
1157 \MH_else:
1158 \MH_set_boolean_T:n {smop_two}
1159 \MH_let:NwN \MT_smop_final_arg_D: \MT_smop_arg_E:
1160 \MH_let:NwN \MT_smop_final_arg_E: \MT_smop_arg_F:
1161 \MH_fi:
1162 \MH_fi:
1163 \MH_fi:
1164 \MH_else:
1165 \MH_if_meaning:NN \MT_smop_arg_B:\MT_smop_limits:
1166 \def\MT_smop_final_arg_A:{#1}%
1167 \MH_if_meaning:NN \MT_smop_arg_D: \@nnil
1168 \MH_else:
1169 \MH_set_boolean_T:n {smop_one}
1170 \MH_let:NwN \MT_smop_final_arg_B: \MT_smop_arg_C:
1171 \MH_let:NwN \MT_smop_final_arg_C: \MT_smop_arg_D:
1172 \MH_if_meaning:NN \MT_smop_arg_F: \@nnil
1173 \MH_else:
1174 \MH_set_boolean_T:n {smop_two}
1175 \MH_let:NwN \MT_smop_final_arg_D: \MT_smop_arg_E:
1176 \MH_let:NwN \MT_smop_final_arg_E: \MT_smop_arg_F:
1177 \MH_fi:
1178 \MH_fi:
1179 \MH_else:
1180 \def\MT_smop_final_arg_A:{#1}%
1181 \MH_if_meaning:NN \MT_smop_arg_C: \@nnil
1182 \MH_else:
1183 \MH_set_boolean_T:n {smop_one}
1184 \MH_let:NwN \MT_smop_final_arg_B: \MT_smop_arg_B:
1185 \MH_let:NwN \MT_smop_final_arg_C: \MT_smop_arg_C:
1186 \MH_if_meaning:NN \MT_smop_arg_D: \@nnil
1187 \MH_else:
1188 \MH_set_boolean_T:n {smop_two}
1189 \MH_let:NwN \MT_smop_final_arg_D: \MT_smop_arg_D:
1190 \MH_let:NwN \MT_smop_final_arg_E: \MT_smop_arg_E:
1191 \MH_fi:
1192 \MH_fi:
1193 \MH_fi:
1194 \MH_fi:
1195 \MH_if_boolean:nT {smop_one}{
1196 \MT_smop_measure:NNNNN
1197 \MT_smop_final_arg_A: \MT_smop_final_arg_B: \MT_smop_final_arg_C:
1198 \MT_smop_final_arg_D: \MT_smop_final_arg_E:
1199 }
1200 \MT_smop_use:NNNNN
1201 \MT_smop_final_arg_A: \MT_smop_final_arg_B: \MT_smop_final_arg_C:
1202 \MT_smop_final_arg_D: \MT_smop_final_arg_E:
1203 \endgroup
1204 }
1205 \def\MT_smop_needed_args:NNNNN #1#2#3#4#5{%
1206 \displaystyle #1
1207 \MH_if_boolean:nT {smop_one}{
1208 \limits#2{\MT_cramped_clap_internal:Nn \scriptstyle{#3}}
1209 \MH_if_boolean:nT {smop_two}{
1210 #4{\MT_cramped_clap_internal:Nn \scriptstyle{#5}}
1211 }
1212 }
1213 }
1214 \def\MT_smop_measure:NNNNN #1#2#3#4#5{%
1215 \MH_let:NwN \MT_saved_mathclap:Nn \MT_cramped_clap_internal:Nn
1216 \MH_let:NwN \MT_cramped_clap_internal:Nn \@secondoftwo
1217 \sbox\z@{$\m@th\MT_smop_needed_args:NNNNN #1#2#3#4#5$}
1218 \MH_let:NwN \MT_cramped_clap_internal:Nn \MT_saved_mathclap:Nn
1219 \sbox\tw@{$\m@th\displaystyle#1$}
1220 \@tempdima=.5\wd0
1221 \advance\@tempdima-.5\wd2
1222 }
1223 \def\MT_smop_smash_l:NNNNN #1#2#3#4#5{
1224 \MT_smop_needed_args:NNNNN #1#2#3#4#5\kern\@tempdima
1225 }
1226 \def\MT_smop_smash_r:NNNNN #1#2#3#4#5{
1227 \kern\@tempdima\MT_smop_needed_args:NNNNN #1#2#3#4#5
1228 }
1229 \def\MT_smop_smash_lr:NNNNN #1#2#3#4#5{
1230 \MT_smop_needed_args:NNNNN #1#2#3#4#5
1231 }
1232 \MH_let:NwN \MT_smop_smash_rl:NNNNN \MT_smop_smash_lr:NNNNN
1233 \def\MT_vphantom:Nn {\v@true\h@false\MT_internal_phantom:N}
1234 \def\MT_hphantom:Nn {\v@false\h@true\MT_internal_phantom:N}
1235 \def\MT_phantom:Nn {\v@true\h@true\MT_internal_phantom:N}
1236 \def\MT_internal_phantom:N #1{
1237 \ifmmode
1238 \expandafter\mathph@nt\expandafter#1
1239 \else
1240 \expandafter\makeph@nt
1241 \fi
1242 }
1243 \newcommand*\adjustlimits[6]{
1244 \sbox\z@{$\m@th \displaystyle #1$}
1245 \sbox\tw@{$\m@th \displaystyle #4$}
1246 \@tempdima=\dp\z@ \advance\@tempdima-\dp\tw@
1247 \MH_if_dim:w \@tempdima>\z@
1248 \mathop{#1}\limits#2{#3}
1249 \MH_else:
1250 \mathop{#1\MT_vphantom:Nn \displaystyle{#4}}\limits
1251 #2{
1252 \def\finsm@sh{\ht\z@\z@ \box\z@}
1253 \mathsm@sh\scriptstyle{\MT_cramped_internal:Nn \scriptstyle{#3}}
1254 \MT_vphantom:Nn \scriptstyle
1255 {\MT_cramped_internal:Nn \scriptstyle{#6}}
1256 }
1257 \MH_fi:
1258 \MH_if_dim:w \@tempdima>\z@
1259 \mathop{#4\MT_vphantom:Nn \displaystyle{#1}}\limits
1260 #5
1261 {
1262 \MT_vphantom:Nn \scriptstyle
1263 {\MT_cramped_internal:Nn \scriptstyle{#3}}
1264 \def\finsm@sh{\ht\z@\z@ \box\z@}
1265 \mathsm@sh\scriptstyle{\MT_cramped_internal:Nn \scriptstyle{#6}}
1266 }
1267 \MH_else:
1268 \mathop{#4}\limits#5{#6}
1269 \MH_fi:
1270 }
1271 \newcommand\SwapAboveDisplaySkip{%
1272 \noalign{\vskip-\abovedisplayskip\vskip\abovedisplayshortskip}
1273 }
1274
1275 \newcommand\MoveEqLeft[1][2]{\kern #1em & \kern -#1em}
1276 \newcommand\Aboxed[1]{\let\bgroup{\romannumeral-`}\@Aboxed#1&&\ENDDNE}
1277 \def\@Aboxed#1&#2&#3\ENDDNE{%
1278 \ifnum0=`{}\fi \setbox \z@
1279 \hbox{$\displaystyle#1{}\m@th$\kern\fboxsep \kern\fboxrule }%
1280 \edef\@tempa {\kern \wd\z@ &\kern -\the\wd\z@
1281 \fboxsep\the\fboxsep \fboxrule \the\fboxrule }\@tempa \boxed {#1#2}%
1282 }
1283 \newcommand\MakeAboxedCommand[2]{
1284 % #1: command to create
1285 % #2: box command to use
1286 \newcommand#1[1]{\let\bgroup{\romannumeral-`}%
1287 \@nameuse{@@\MH_cs_to_str:N #1}##1&&\ENDDNE}
1288 \@namedef{@@\MH_cs_to_str:N #1}##1&##2&##3\ENDDNE{%
1289 \settowidth\@tempdimc{#2{}}%
1290 \ifnum0=`{}\fi \setbox \z@
1291 \hbox{$\displaystyle##1{}\m@th$\kern0.5\@tempdimc}%
1292 \edef\@tempa{\kern\wd\z@&\kern-\the\wd\z@%
1293 \fboxsep\the\fboxsep \fboxrule \the\fboxrule}%
1294 \@tempa%
1295 #2{\m@th$\displaystyle ##1##2$}%
1296 }
1297 }
1298
1299 \MHInternalSyntaxOff
1300 \def\ArrowBetweenLines{\relax
1301 \iffalse{\fi\ifnum0=`}\fi
1302 \@ifstar{\ArrowBetweenLines@auxI{00}}{\ArrowBetweenLines@auxI{01}}}
1303 \def\ArrowBetweenLines@auxI#1{%
1304 \@ifnextchar[%
1305 {\ArrowBetweenLines@auxII{#1}}%
1306 {\ArrowBetweenLines@auxII{#1}[\Updownarrow]}}
1307 \def\ArrowBetweenLines@auxII#1[#2]{%
1308 \ifnum0=`{\fi \iffalse}\fi
1309 \expandafter\in@\expandafter{\@currenvir}%
1310 {alignedat,aligned,gathered}%
1311 \ifin@ \else
1312 \notag
1313 \fi%
1314 \\
1315 \noalign{\nobreak\vskip-\baselineskip\vskip-\lineskip}%
1316 \noalign{\expandafter\in@\expandafter{\@currenvir}%
1317 {alignedat,aligned,gathered}%
1318 \ifin@ \else\notag\fi%
1319 }%
1320 \if#1 &&\quad #2\else #2\quad\fi
1321 \\\noalign{\nobreak\vskip-\lineskip}}
1322
1323 \MHInternalSyntaxOn
1324 \newcommand\vdotswithin[1]{%
1325 {\mathmakebox[\widthof{\ensuremath{{}#1{}}}][c]{{\vdots}}}}
1326 \newlength\origjot
1327 \setlength\origjot{\jot}
1328 \newdimen\l_MT_shortvdotswithinadjustabove_dim
1329 \newdimen\l_MT_shortvdotswithinadjustbelow_dim
1330 \define@key{\MT_options_name:}
1331 {shortvdotsadjustabove}{\setlength\l_MT_shortvdotswithinadjustabove_dim{#1}}
1332 \define@key{\MT_options_name:}
1333 {shortvdotsadjustbelow}{\setlength\l_MT_shortvdotswithinadjustbelow_dim{#1}}
1334 \setkeys{\MT_options_name:}{
1335 shortvdotsadjustabove=2.15\origjot,
1336 shortvdotsadjustbelow=\origjot
1337 }
1338 \def\shortvdotswithin{\relax
1339 \@ifstar{\MT_svwi_aux:nn{00}}{\MT_svwi_aux:nn{01}}}
1340 \def\MT_svwi_aux:nn #1#2{
1341 \MTFlushSpaceAbove
1342 \if#1 \vdotswithin{#2}& \else &\vdotswithin{#2} \fi
1343 \MTFlushSpaceBelow
1344 }
1345 \def\MT_remove_tag_unless_inner:n #1{%
1346 \begingroup
1347 \def\etb@tempa##1|#1|##2\MT@END{\endgroup
1348 \ifx\@empty##2\@empty\notag\fi}%
1349 \expandafter\etb@tempa\expandafter|alignedat|aligned|split|#1|\MT@END}
1350 %| emacs
1351 \newcommand\MTFlushSpaceAbove{
1352 \expandafter\MT_remove_tag_unless_inner:n\expandafter{\@currenvir}
1353 \\
1354 \noalign{%
1355 \nobreak\vskip-\baselineskip\vskip-\lineskip%
1356 \vskip-\l_MT_shortvdotswithinadjustabove_dim
1357 \vskip-\origjot
1358 \vskip\jot
1359 }%
1360 \noalign{
1361 \expandafter\MT_remove_tag_unless_inner:n\expandafter{\@currenvir}
1362 }
1363 }
1364 \newcommand\MTFlushSpaceBelow{
1365 \\\noalign{%
1366 \nobreak\vskip-\lineskip
1367 \vskip-\l_MT_shortvdotswithinadjustbelow_dim
1368 \vskip-\origjot
1369 \vskip\jot
1370 }
1371 }
1372
1373 \def\MH_nrotarrow:NN #1#2{%
1374 \setbox0=\hbox{$\m@th#1\uparrow$}\dimen0=\dp0
1375 \setbox0=\hbox{%
1376 \reflectbox{\rotatebox[origin=c]{90}{$\m@th#1\mkern2.22mu #2$}}}%
1377 \dp0=\dimen0 \box0 \mkern2.3965mu
1378 }
1379 \def\MH_nuparrow: {%
1380 \mathrel{\mathpalette\MH_nrotarrow:NN\nrightarrow} }
1381 \def\MH_ndownarrow: {%
1382 \mathrel{\mathpalette\MH_nrotarrow:NN\nleftarrow} }
1383 \AtBeginDocument{%
1384 \RequirePackage{graphicx}%
1385 \@ifundefined{nrightarrow}{%
1386 \providecommand\nuparrow{%
1387 \PackageError{mathtools}{\string\nuparrow\space~ is~
1388 constructed~ from~ \string\nrightarrow,~ which~ is~ not~
1389 provided.~ Please~ load~ the~ amssymb~ package~ or~ similar}{}
1390 }}{ \providecommand\nuparrow{\MH_nuparrow:}}
1391 \@ifundefined{nleftarrow}{%
1392 \providecommand\ndownarrow{%
1393 \PackageError{mathtools}{\string\ndownarrow\space~ is~
1394 constructed~ from~ \string\nleftarrow,~ which~ is~ not~
1395 provided.~ Please~ load~ the~ amssymb~ package~ or~ similar}{}
1396 }}{ \providecommand\ndownarrow{\MH_ndownarrow:}} }
1397 \def\MH_bigtimes_scaler:N #1{%
1398 \vcenter{\hbox{#1$\m@th\mkern-2mu\times\mkern-2mu$}}}
1399 \def\MH_bigtimes_inner: {
1400 \mathchoice{\MH_bigtimes_scaler:N \huge} % display style
1401 {\MH_bigtimes_scaler:N \LARGE} % text style
1402 {\MH_bigtimes_scaler:N {}} % script style
1403 {\MH_bigtimes_scaler:N \footnotesize} % script script style
1404 }
1405 \def\MH_csym_bigtimes: {\mathop{\MH_bigtimes_inner:}\displaylimits}
1406 \AtBeginDocument{
1407 \providecommand\bigtimes{\MH_csym_bigtimes:}
1408 }
1409 \MH_let:NwN \MT_orig_intertext: \intertext@
1410 \newdimen\l_MT_above_intertext_sep
1411 \newdimen\l_MT_below_intertext_sep
1412 \define@key{\MT_options_name:}
1413 {aboveintertextdim}{\setlength\l_MT_above_intertext_sep{#1}}
1414 \define@key{\MT_options_name:}
1415 {belowintertextdim}{\setlength\l_MT_below_intertext_sep{#1}}
1416 \define@key{\MT_options_name:}
1417 {above-intertext-dim}{\setlength\l_MT_above_intertext_sep{#1}}
1418 \define@key{\MT_options_name:}
1419 {below-intertext-dim}{\setlength\l_MT_below_intertext_sep{#1}}
1420 \define@key{\MT_options_name:}
1421 {above-intertext-sep}{\setlength\l_MT_above_intertext_sep{#1}}
1422 \define@key{\MT_options_name:}
1423 {below-intertext-sep}{\setlength\l_MT_below_intertext_sep{#1}}
1424 \def\MT_intertext: {%
1425 \def\intertext##1{%
1426 \ifvmode\else\\\@empty\fi
1427 \noalign{%
1428 \penalty\postdisplaypenalty\vskip\belowdisplayskip
1429 \vskip-\lineskiplimit % CCS
1430 \vskip\normallineskiplimit % CCS
1431 \vskip\l_MT_above_intertext_sep
1432 \vbox{\normalbaselines
1433 \ifdim
1434 \ifdim\@totalleftmargin=\z@
1435 \linewidth
1436 \else
1437 -\maxdimen
1438 \fi
1439 =\columnwidth
1440 \else \parshape\@ne \@totalleftmargin \linewidth
1441 \fi
1442 \noindent\ignorespaces##1\par}%
1443 \penalty\predisplaypenalty\vskip\abovedisplayskip%
1444 \vskip-\lineskiplimit % CCS
1445 \vskip\normallineskiplimit % CCS
1446 \vskip\l_MT_below_intertext_sep
1447 }%
1448 }%
1449 % also activate \shortintertext, such that is is only available when
1450 % \intertext is
1451 \MH_let:NwN \shortintertext \shortintertext@
1452 }
1453 \def\MT_orig_intertext_true: {
1454 \MH_let:NwN \intertext@ \MT_orig_intertext:
1455 \MH_let:NwN \shortintertext \shortintertext@
1456 }
1457 \def\MT_orig_intertext_false: { \MH_let:NwN \intertext@ \MT_intertext: }
1458 \define@key{\MT_options_name:}{original-intertext}[true]{
1459 \@nameuse{MT_orig_intertext_#1:}
1460 }
1461 \setkeys{\MT_options_name:}{
1462 original-intertext=false
1463 }
1464 \def\MT_orig_shortintertext:n #1{%
1465 \ifvmode\else\\\@empty\fi
1466 \noalign{%
1467 \penalty\postdisplaypenalty\vskip\abovedisplayshortskip
1468 \vbox{\normalbaselines
1469 \MH_if_dim:w
1470 \MH_if_dim:w \@totalleftmargin=\z@
1471 \linewidth
1472 \MH_else:
1473 -\maxdimen
1474 \MH_fi:
1475 =\columnwidth
1476 \MH_else:
1477 \parshape\@ne \@totalleftmargin \linewidth
1478 \MH_fi:
1479 \noindent\ignorespaces#1\par}%
1480 \penalty\predisplaypenalty\vskip\abovedisplayshortskip%
1481 }%
1482 }
1483 \newdimen\l_MT_above_shortintertext_sep
1484 \newdimen\l_MT_below_shortintertext_sep
1485 \define@key{\MT_options_name:}
1486 {aboveshortintertextdim}{\setlength \l_MT_above_shortintertext_sep{#1}}
1487 \define@key{\MT_options_name:}
1488 {belowshortintertextdim}{\setlength \l_MT_below_shortintertext_sep{#1}}
1489 \define@key{\MT_options_name:}
1490 {above-short-intertext-dim}{\setlength \l_MT_above_shortintertext_sep{#1}}
1491 \define@key{\MT_options_name:}
1492 {below-short-intertext-dim}{\setlength \l_MT_below_shortintertext_sep{#1}}
1493 \define@key{\MT_options_name:}
1494 {above-short-intertext-sep}{\setlength \l_MT_above_shortintertext_sep{#1}}
1495 \define@key{\MT_options_name:}
1496 {below-short-intertext-sep}{\setlength \l_MT_below_shortintertext_sep{#1}}
1497 \define@key{\MT_options_name:}
1498 {above-shortintertext-sep}{\setlength \l_MT_above_shortintertext_sep{#1}}
1499 \define@key{\MT_options_name:}
1500 {below-shortintertext-sep}{\setlength \l_MT_below_shortintertext_sep{#1}}
1501 \setkeys{\MT_options_name:}{
1502 aboveshortintertextdim=3pt,
1503 belowshortintertextdim=3pt
1504 }
1505 \def\MT_shortintertext:n #1{%
1506 \ifvmode\else\\\@empty\fi
1507 \noalign{%
1508 \penalty\postdisplaypenalty\vskip\abovedisplayshortskip
1509 \vskip-\lineskiplimit
1510 \vskip\normallineskiplimit
1511 \vskip\l_MT_above_shortintertext_sep
1512 \vbox{\normalbaselines
1513 \MH_if_dim:w
1514 \MH_if_dim:w \@totalleftmargin=\z@
1515 \linewidth
1516 \MH_else:
1517 -\maxdimen
1518 \MH_fi:
1519 =\columnwidth
1520 \MH_else:
1521 \parshape\@ne \@totalleftmargin \linewidth
1522 \MH_fi:
1523 \noindent\ignorespaces#1\par}%
1524 \penalty\predisplaypenalty\vskip\abovedisplayshortskip%
1525 \vskip-\lineskiplimit
1526 \vskip\normallineskiplimit
1527 \vskip\l_MT_below_shortintertext_sep
1528 }%
1529 }
1530 \def\MT_orig_shortintertext_true: { \MH_let:NwN \shortintertext@ \MT_orig_shortintertext:n }
1531 \def\MT_orig_shortintertext_false: { \MH_let:NwN \shortintertext@ \MT_shortintertext:n }
1532 \newcommand{\shortintertext}{\@amsmath@err{\Invalid@@\shortintertext}\@eha}
1533 \define@key{\MT_options_name:}{original-shortintertext}[true]{
1534 \@nameuse{MT_orig_shortintertext_#1:}
1535 }
1536 \setkeys{\MT_options_name:}{
1537 original-shortintertext=false
1538 }
1539 \providecommand*\clap[1]{\hb@xt@\z@{\hss#1\hss}}
1540 \providecommand*\mathllap[1][\@empty]{
1541 \relax\ifx\@empty#1\@empty
1542 \expandafter \mathpalette \expandafter \MT_mathllap:Nn
1543 \else
1544 \expandafter \MT_mathllap:Nn \expandafter #1
1545 \fi
1546 }
1547 \providecommand*\mathrlap[1][\@empty]{
1548 \relax\ifx\@empty#1\@empty
1549 \expandafter \mathpalette \expandafter \MT_mathrlap:Nn
1550 \else
1551 \expandafter \MT_mathrlap:Nn \expandafter #1
1552 \fi
1553 }
1554 \providecommand*\mathclap[1][\@empty]{
1555 \relax\ifx\@empty#1\@empty
1556 \expandafter \mathpalette \expandafter \MT_mathclap:Nn
1557 \else
1558 \expandafter \MT_mathclap:Nn \expandafter #1
1559 \fi
1560 }
1561 \def\MT_mathllap:Nn #1#2{{}\llap{$\m@th#1{#2}$}}
1562 \def\MT_mathrlap:Nn #1#2{{}\rlap{$\m@th#1{#2}$}}
1563 \def\MT_mathclap:Nn #1#2{{}\clap{$\m@th#1{#2}$}}
1564 \providecommand*\mathmbox{\mathpalette\MT_mathmbox:nn}
1565 \def\MT_mathmbox:nn #1#2{\mbox{$\m@th#1#2$}}
1566 \providecommand*\mathmakebox{
1567 \@ifnextchar[ \MT_mathmakebox_I:w
1568 \mathmbox}
1569 \def\MT_mathmakebox_I:w[#1]{%
1570 \@ifnextchar[ {\MT_mathmakebox_II:w[#1]}
1571 {\MT_mathmakebox_II:w[#1][c]}}
1572 \def\MT_mathmakebox_II:w[#1][#2]{
1573 \mathpalette{\MT_mathmakebox_III:w[#1][#2]}}
1574 \def\MT_mathmakebox_III:w[#1][#2]#3#4{%
1575 \@begin@tempboxa\hbox{$\m@th#3#4$}%
1576 \setlength\@tempdima{#1}%
1577 \hbox{\hb@xt@\@tempdima{\csname bm@#2\endcsname}}%
1578 \@end@tempboxa}
1579 \def\mathsm@sh#1#2{%
1580 \setbox\z@\hbox{$\m@th#1{#2}$}{}\finsm@sh}
1581 \providecommand*\cramped[1][\@empty]{
1582 \relax\ifx\@empty#1\@empty
1583 \expandafter \mathpalette \expandafter \MT_cramped_internal:Nn
1584 \else
1585 \expandafter \MT_cramped_internal:Nn \expandafter #1
1586 \fi
1587 }
1588 \def\MT_cramped_internal:Nn #1#2{
1589 %% \sbox\z@{$\m@th#1\kern-\nulldelimiterspace\radical\z@{#2}$}
1590 \setbox\z@\hbox{$\m@th#1\kern-\nulldelimiterspace\radical\z@{#2}$}
1591 \ifx#1\displaystyle
1592 \dimen@=\fontdimen8\textfont3
1593 \advance\dimen@ .25\fontdimen5\textfont2
1594 \else
1595 \dimen@=1.25\fontdimen8
1596 \ifx#1\textstyle\textfont
1597 \else
1598 \ifx#1\scriptstyle
1599 \scriptfont
1600 \else
1601 \scriptscriptfont
1602 \fi
1603 \fi
1604 3
1605 \fi
1606 \advance\dimen@-\ht\z@ \ht\z@=-\dimen@
1607 \ifvmode\leavevmode\fi
1608 {}\box\z@
1609 }
1610 \ifx\directlua\@undefined\else
1611 \def\MT_cramped_internal:Nn #1#2{
1612 {
1613 \ensuremath {
1614 \use:c { cramped \cs_to_str:N #1 } #2
1615 }
1616 }
1617 }
1618 \fi
1619
1620 \providecommand*\crampedllap[1][\@empty]{
1621 \relax\ifx\@empty#1\@empty
1622 \expandafter \mathpalette \expandafter \MT_cramped_llap_internal:Nn
1623 \else
1624 \expandafter \MT_cramped_llap_internal:Nn \expandafter #1
1625 \fi
1626 }
1627 \def\MT_cramped_llap_internal:Nn #1#2{
1628 {}\llap{\MT_cramped_internal:Nn #1{#2}}
1629 }
1630 \providecommand*\crampedclap[1][\@empty]{
1631 \relax\ifx\@empty#1\@empty
1632 \expandafter \mathpalette \expandafter \MT_cramped_clap_internal:Nn
1633 \else
1634 \expandafter \MT_cramped_clap_internal:Nn \expandafter #1
1635 \fi
1636 }
1637 \def\MT_cramped_clap_internal:Nn #1#2{
1638 {}\clap{\MT_cramped_internal:Nn #1{#2}}
1639 }
1640 \providecommand*\crampedrlap[1][\@empty]{
1641 \relax\ifx\@empty#1\@empty
1642 \expandafter \mathpalette \expandafter \MT_cramped_rlap_internal:Nn
1643 \else
1644 \expandafter \MT_cramped_rlap_internal:Nn \expandafter #1
1645 \fi
1646 }
1647 \def\MT_cramped_rlap_internal:Nn #1#2{
1648 {}\rlap{\MT_cramped_internal:Nn #1{#2}}
1649 }
1650 \ifx\directlua\@undefined
1651 \newenvironment{crampedsubarray}[1]{%
1652 \vcenter\bgroup
1653 \Let@ \restore@math@cr \default@tag
1654 \baselineskip\fontdimen10 \scriptfont\tw@
1655 \advance\baselineskip\fontdimen12 \scriptfont\tw@
1656 \lineskip\thr@@\fontdimen8 \scriptfont\thr@@
1657 \lineskiplimit\lineskip
1658 \ialign\bgroup\ifx c#1\hfil\fi
1659 %%$\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{##}$% <-- changed line
1660 \span\MT_cramped_internal:Nn \scriptstyle {##}%
1661 \hfil\crcr
1662 }{%
1663 \crcr\egroup\egroup
1664 }
1665 \else
1666 \newenvironment{crampedsubarray}[1]{%
1667 \vcenter\bgroup
1668 \Let@ \restore@math@cr \default@tag
1669 \baselineskip \Umathstacknumup \scriptstyle
1670 \advance\baselineskip \Umathstackdenomdown \scriptstyle
1671 \lineskip \Umathstackvgap \scriptstyle
1672 \lineskiplimit \lineskip
1673 \ialign\bgroup\ifx c#1\hfil\fi
1674 \Ustartmath
1675 \crampedscriptstyle{##}
1676 \Ustopmath
1677 \hfil\crcr
1678 }{%
1679 \crcr\egroup\egroup
1680 }
1681 \fi
1682 \newcommand{\crampedsubstack}[1]{\crampedsubarray{c}#1\endcrampedsubarray}
1683 \newcommand{\MT_prescript_inner:}[4]{
1684 \@mathmeasure\z@#4{\MT_prescript_sup:{#1}}
1685 \@mathmeasure\tw@#4{\MT_prescript_sub:{#2}}
1686 \MH_if_dim:w \wd\tw@>\wd\z@
1687 \setbox\z@\hbox to\wd\tw@{\hfil\unhbox\z@}
1688 \MH_else:
1689 \setbox\tw@\hbox to\wd\z@{\hfil\unhbox\tw@}
1690 \MH_fi:
1691 \mathop{}
1692 \mathopen{\vphantom{\MT_prescript_arg:{#3}}}^{\box\z@}\sb{\box\tw@}
1693 \MT_prescript_arg:{#3}
1694 }
1695 \DeclareRobustCommand{\prescript}[3]{
1696 \mathchoice
1697 {\MT_prescript_inner:{#1}{#2}{#3}{\scriptstyle}}
1698 {\MT_prescript_inner:{#1}{#2}{#3}{\scriptstyle}}
1699 {\MT_prescript_inner:{#1}{#2}{#3}{\scriptscriptstyle}}
1700 {\MT_prescript_inner:{#1}{#2}{#3}{\scriptscriptstyle}}
1701 }
1702 \define@key{\MT_options_name:}
1703 {prescript-sup-format}{\def\MT_prescript_sup:{#1}}
1704 \define@key{\MT_options_name:}
1705 {prescript-sub-format}{\def\MT_prescript_sub:{#1}}
1706 \define@key{\MT_options_name:}
1707 {prescript-arg-format}{\def\MT_prescript_arg:{#1}}
1708 \setkeys{\MT_options_name:}{
1709 prescript-sup-format={},
1710 prescript-sub-format={},
1711 prescript-arg-format={},
1712 }
1713 \ifx\e@alloc\@undefined% kernel thus older than 2015
1714 \def\@DeclareMathSizes #1#2#3#4#5{%
1715 \@defaultunits\dimen@ #2pt\relax\@nnil
1716 \MH_if:w $#3$%
1717 \MH_let:cN {S@\strip@pt\dimen@}\math@fontsfalse
1718 \MH_else:
1719 \@defaultunits\dimen@ii #3pt\relax\@nnil
1720 \@defaultunits\@tempdima #4pt\relax\@nnil
1721 \@defaultunits\@tempdimb #5pt\relax\@nnil
1722 \toks@{#1}%
1723 \expandafter\xdef\csname S@\strip@pt\dimen@\endcsname{%
1724 \gdef\noexpand\tf@size{\strip@pt\dimen@ii}%
1725 \gdef\noexpand\sf@size{\strip@pt\@tempdima}%
1726 \gdef\noexpand\ssf@size{\strip@pt\@tempdimb}%
1727 \the\toks@
1728 }%
1729 \MH_fi:
1730 }
1731 \fi
1732 \def\MT_mathic_true: {
1733 \MH_if_boolean:nF {math_italic_corr}{
1734 \MH_set_boolean_T:n {math_italic_corr}
1735 \MH_if_boolean:nTF {robustify}{
1736 \MH_let:NwN \MT_mathic_redeffer: \DeclareRobustCommand
1737 }{
1738 \MH_let:NwN \MT_mathic_redeffer: \renewcommand
1739 }
1740 \MH_let:NwN \MT_begin_inlinemath: \(
1741 %\renewcommand*\({
1742 \MT_mathic_redeffer:*\({
1743 \relax\ifmmode\@badmath\else
1744 \ifhmode
1745 \MH_if_dim:w \fontdimen\@ne\font>\z@
1746 \MH_if_dim:w \lastskip>\z@
1747 \skip@\lastskip\unskip
1748 \MH_if_num:w \lastpenalty>\z@
1749 \count@\lastpenalty\unpenalty
1750 \MH_else:
1751 \count@\z@
1752 \MH_fi:
1753 \@@italiccorr
1754 \MH_if_num:w \count@>\z@
1755 \penalty\count@
1756 \MH_fi:
1757 \hskip\skip@
1758 \MH_else:
1759 \@@italiccorr
1760 \MH_fi:
1761 \MH_fi:
1762 \fi
1763 $\fi
1764 }
1765 }
1766 }
1767 \def\MT_mathic_false: {
1768 \MH_if_boolean:nT {math_italic_corr}{
1769 \MH_set_boolean_F:n {math_italic_corr}
1770 \MH_if_boolean:nTF {robustify}{
1771 \edef\({\MT_begin_inlinemath:}%
1772 \forced_EQ_MakeRobust\(%
1773 }{
1774 \MH_let:NwN \( \MT_begin_inlinemath:
1775 }
1776 }
1777 }
1778 \MH_new_boolean:n {math_italic_corr}
1779 \define@key{\MT_options_name:}{mathic}[true]{
1780 \@ifundefined{MT_mathic_#1:}
1781 { \MT_true_false_error:
1782 \@nameuse{MT_mathic_false:}
1783 }
1784 { \@nameuse{MT_mathic_#1:} }
1785 }
1786 \newenvironment{spreadlines}[1]{
1787 \setlength{\jot}{#1}
1788 \ignorespaces
1789 }{ \ignorespacesafterend }
1790 \MaybeMHPrecedingSpacesOff
1791 \newenvironment{MT_gathered_env}[1][c]{%
1792 \RIfM@\else
1793 \nonmatherr@{\begin{\@currenvir}}%
1794 \fi
1795 %\null\,%
1796 \alignedspace@left%
1797 \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi \bgroup
1798 \Let@ \chardef\dspbrk@context\@ne \restore@math@cr
1799 \spread@equation
1800 \ialign\bgroup
1801 \MT_gathered_pre:
1802 \strut@$\m@th\displaystyle##$
1803 \MT_gathered_post:
1804 \crcr
1805 }{%
1806 \endaligned
1807 \MT_gathered_env_end:
1808 }
1809 \MHPrecedingSpacesOn
1810 \newcommand*\newgathered[4]{
1811 \newenvironment{#1}
1812 { \def\MT_gathered_pre:{#2}
1813 \def\MT_gathered_post:{#3}
1814 \def\MT_gathered_env_end:{#4}
1815 \MT_gathered_env
1816 }{\endMT_gathered_env}
1817 }
1818 \newcommand*\renewgathered[4]{
1819 \renewenvironment{#1}
1820 { \def\MT_gathered_pre:{#2}
1821 \def\MT_gathered_post:{#3}
1822 \def\MT_gathered_env_end:{#4}
1823 \MT_gathered_env
1824 }{\endMT_gathered_env}
1825 }
1826 \newgathered{lgathered}{}{\hfil}{}
1827 \newgathered{rgathered}{\hfil}{}{}
1828 \renewgathered{gathered}{\hfil}{\hfil}{}
1829 \newcommand*\splitfrac[2]{%
1830 \genfrac{}{}{0pt}{1}%
1831 {\textstyle#1\quad\hfill}%
1832 {\textstyle\hfill\quad\mathstrut#2}%
1833 }
1834 \newcommand*\splitdfrac[2]{%
1835 \genfrac{}{}{0pt}{0}{#1\quad\hfill}{\hfill\quad\mathstrut #2}%
1836 }
1837 \MH_if_boolean:nT {fixamsmath}{
1838 \def\place@tag{%
1839 \iftagsleft@
1840 \kern-\tagshift@
1841 \if@fleqn
1842 \MH_if_num:w \xatlevel@=\tw@
1843 \kern-\@mathmargin
1844 \MH_fi:
1845 \MH_fi:
1846 \MH_if:w 1\shift@tag\row@\relax
1847 \rlap{\vbox{%
1848 \normalbaselines
1849 \boxz@
1850 \vbox to\lineht@{}%
1851 \raise@tag
1852 }}%
1853 \MH_else:
1854 \rlap{\boxz@}%
1855 \MH_fi:
1856 \kern\displaywidth@
1857 \MH_else:
1858 \kern-\tagshift@
1859 \MH_if:w 1\shift@tag\row@\relax
1860 \llap{\vtop{%
1861 \raise@tag
1862 \normalbaselines
1863 \setbox\@ne\null
1864 \dp\@ne\lineht@
1865 \box\@ne
1866 \boxz@
1867 }}%
1868 \MH_else:
1869 \llap{\boxz@}%
1870 \MH_fi:
1871 \MH_fi:
1872 }
1873 \def\x@calc@shift@lf{%
1874 \MH_if_dim:w \eqnshift@=\z@
1875 \global\eqnshift@\@mathmargin\relax
1876 \alignsep@\displaywidth
1877 \advance\alignsep@-\totwidth@
1878 \MH_if_num:w \@tempcntb=0
1879 \MH_else:
1880 \global\divide\alignsep@\@tempcntb % original line
1881 \MH_fi:
1882 \MH_if_dim:w \alignsep@<\minalignsep\relax
1883 \global\alignsep@\minalignsep\relax
1884 \MH_fi:
1885 \MH_fi:
1886 \MH_if_dim:w \tag@width\row@>\@tempdima
1887 \saveshift@1%
1888 \MH_else:
1889 \saveshift@0%
1890 \MH_fi:}%
1891 }
1892 \MaybeMHPrecedingSpacesOff
1893 \renewcommand\aligned@a[1][c]{\start@aligned{#1}\m@ne}
1894 \MHPrecedingSpacesOn
1895 \newbox\xmathstrut@box
1896 \newdimen\xmathstrut@dim
1897 \def\xmathstrut{\@dblarg\xmathstrut@}
1898 \def\xmathstrut@[#1]#2{%
1899 \def\xmathstrut@dp{#1}%
1900 \vphantom{\mathpalette\xmathstrut@do{#2}}%
1901 }
1902 \def\xmathstrut@do#1#2{%
1903 \setbox\xmathstrut@box\hbox{$#1($}%)%emacs
1904 \xmathstrut@dim\dimexpr\ht\xmathstrut@box+\dp\xmathstrut@box\relax
1905 \ht\xmathstrut@box\dimexpr\ht\xmathstrut@box
1906 +#2\xmathstrut@dim
1907 \relax
1908 \dp\xmathstrut@box\dimexpr\dp\xmathstrut@box
1909 +\xmathstrut@dp\xmathstrut@dim
1910 \relax
1911 \box\xmathstrut@box}
1912
1913 \endinput
1914 %%
1915 %% End of file `mathtools.sty'.