Windows installer: update Gnuplot
[maxima.git] / interfaces / emacs / imaxima / breqn097a / breqn.sty
blobfd4893e5734cd53aa31c1f1f55219afeb51dd1c4
1 %%
2 %% This is file `breqn.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% breqn.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright (C) 1997-2003 by Michael J. Downes
12 %% Copyright (C) 2007 by Morten Hoegholm <mh.ctan@gmail.com>
13 %%
14 %% This work may be distributed and/or modified under the
15 %% conditions of the LaTeX Project Public License, either
16 %% version 1.3 of this license or (at your option) any later
17 %% version. The latest version of this license is in
18 %% http://www.latex-project.org/lppl.txt
19 %% and version 1.3 or later is part of all distributions of
20 %% LaTeX version 2005/12/01 or later.
21 %%
22 %% This work has the LPPL maintenance status "maintained".
23 %%
24 %% This Current Maintainer of this work is Morten Hoegholm.
25 %%
26 %% This work consists of the main source file breqn.dtx
27 %% and the derived files
28 %% breqn.sty, breqn.pdf, breqn.ins, breqn.drv.
29 %%
30 \NeedsTeXFormat{LaTeX2e}
31 \ProvidesPackage{breqn}[2007/12/22 v0.97a]
32 \edef\breqnpopcats{%
33 \catcode\number`\"=\number\catcode`\"
34 \relax}
35 \AtEndOfPackage{\breqnpopcats}%
36 \catcode`\^=7 \catcode`\_=8 \catcode`\"=12 \relax
37 \DeclareOption{mathstyleoff}{%
38 \PassOptionsToPackage{mathstyleoff}{flexisym}%
40 \ProcessOptions\relax
41 \@ifpackageloaded{flexisym}{}{%
42 \RequirePackage{flexisym}[2007/12/19]
43 \edef\breqnpopcats{\breqnpopcats
44 \catcode\number`\^=\number\catcode`\^
45 \catcode\number`\_=\number\catcode`\_
47 \catcode`\^=7 \catcode`\_=8 \catcode`\"=12 \relax
49 \RequirePackage{keyval,calc}\relax
50 \@ifundefined{options}{%
51 \newcommand{\options}[2]{%
52 \expandafter\options@a\csname opt@#1.sty\endcsname{#2}%
53 \setkeys{#1}{#2}%
55 \def\options@a#1#2{%
56 \edef\@tempa{\options@b#2,\@empty\@nil}%
57 \ifx#1\relax \let#1\@empty\fi
58 \xdef#1{#1\ifx#1\@empty\@xp\@gobble\@tempa\@empty\else\@tempa \fi}%
60 \def\options@b#1,#2#3\@nil{%
61 \options@c#1 \@nil
62 \ifx#2\@empty \else\options@b#2#3\@nil\fi
64 \def\options@c#1 #2\@nil{\options@d#1=\@nil}
65 \def\options@d#1=#2\@nil{\ifx\@empty #1\@empty\else,\fi#1}
66 }{}% end @ifundefined test
67 \let\@nx\noexpand
68 \let\@xp\expandafter
69 \@ifundefined{@emptytoks}{\newtoks\@emptytoks}{}
70 \chardef\f@ur=4
71 \newcount\inf@bad \inf@bad=1000000
72 \newcount\maxint \maxint=2147483647
73 \let\int@a=\@tempcnta
74 \let\int@b=\@tempcntb
75 \let\int@c=\count@
76 \let\dim@a\@tempdima
77 \let\dim@b\@tempdimb
78 \let\dim@c\@tempdimc
79 \let\dim@d\dimen@
80 \let\dim@e\dimen@ii
81 \let\dim@A\dimen@i
82 \let\skip@a\@tempskipa
83 \let\skip@b\@tempskipb
84 \let\skip@c\skip@
85 \let\toks@a\@temptokena
86 \let\toks@b\toks@
87 \toksdef\toks@c=2
88 \toksdef\toks@d=4
89 \toksdef\toks@e=6
90 \toksdef\toks@f=8
91 \def\abs@num#1{\ifnum#1<\z@-\fi#1}
92 \def\@ifnext#1#2#3{%
93 \let\@tempd= #1\def\@tempa{#2}\def\@tempb{#3}%
94 \futurelet\@tempc\@ifnexta
96 \def\@ifnexta{\ifx\@tempc\@tempd \let\@tempb\@tempa \fi \@tempb}
97 \def\@ifstar#1#2{%
98 \let\@tempd*\def\@tempa*{#1}\def\@tempb{#2}%
99 \futurelet\@tempc\@ifnexta
101 \def\@optarg#1#2{\@ifnext[{#1}{#1[#2]}}
102 \def\@True{00}
103 \def\@False{01}
104 \def\@Not#1{0\ifcase#11 \or\@xp 1\else \@xp 0\fi}
105 \def\@And#1#2{0\ifcase#1#2 \@xp 0\else \@xp 1\fi}
106 \def\@Or#1#2{0\ifnum#1#2<101 \@xp 0\else \@xp 1\fi}
107 \def\theb@@le#1{\if#1 True\else False\fi}
108 \def\freeze@glue#1{#11#1\relax}
109 \def\z@rule{\vrule\@width\z@}% no \relax ! use with care
110 \def\keep@glue{\z@rule\relax}
111 \begingroup \catcode`\&=11
112 \gdef\replicate#1{%
113 \csname &\expandafter\replicate@a\romannumeral\number\number#1 000q\endcsname
115 \endgroup
116 \long\def\replicate@a#1#2\endcsname#3{#1\endcsname{#3}#2}
117 \begingroup \catcode`\&=11
118 \long\gdef\&m#1#2{#1\csname &#2\endcsname{#1}}
119 \endgroup
120 \@xp\let\csname\string &q\endcsname\@gobble
121 \g@addto@macro\mathchars@reset{%
122 \let\@symRel\@secondoftwo \let\@symBin\@secondoftwo
123 \let\@symDeL\@secondoftwo \let\@symDeR\@secondoftwo
124 \let\@symDeB\@secondoftwo
126 \def\eq@cons#1#2{%
127 \begingroup \let\@elt\relax \xdef#1{\@elt{#2}#1}\endgroup
129 \providecommand{\@saveprimitive}[2]{%
130 \begingroup
131 \edef\@tempa{\string#1}\edef\@tempb{\meaning#1}%
132 \ifx\@tempa\@tempb \global\let#2#1%
133 \else
134 \edef\@tempb{\meaning#2}%
135 \ifx\@tempa\@tempb
136 \else \@saveprimitive@a#1#2%
139 \endgroup
141 \providecommand\@saveprimitive@a[2]{%
142 \begingroup
143 \def\@tempb##1#1##2{\edef\@tempb{##2}\@car{}}%
144 \@tempb\nullfont{select font nullfont}%
145 \topmark{\string\topmark:}%
146 \firstmark{\string\firstmark:}%
147 \botmark{\string\botmark:}%
148 \splitfirstmark{\string\splitfirstmark:}%
149 \splitbotmark{\string\splitbotmark:}%
150 #1{\string#1}%
151 \edef\@tempa{\expandafter\strip@prefix\meaning\@tempb}%
152 \edef\@tempb{\meaning#1}%
153 \ifx\@tempa\@tempb \global\let#2#1%
154 \else
155 \PackageError{breqn}%
156 {Unable to properly define \string#2; primitive
157 \noexpand#1no longer primitive}\@eha
160 \endgroup
162 \begingroup \catcode`\$=\thr@@ % just to make sure
163 \global\let\@@math=$ \gdef\@@display{$$}% $$$
164 \endgroup
165 \let\@@endmath=\@@math
166 \let\@@enddisplay=\@@display
167 \@saveprimitive\vadjust\@@vadjust
168 \@saveprimitive\insert\@@insert
169 \@saveprimitive\mark\@@mark
170 \@ifundefined{listwidth}{\newdimen\listwidth}{}
171 \listwidth=\z@
172 \def\eqfontsize{} % Inherit from context [NOT USED?]
173 \def\eqcolor{black} % Default to black [NOT USED?]
174 \newdimen\eqnumsep \eqnumsep=10pt % Min space between equ number and body
175 \newdimen\eqmargin \eqmargin=8pt % For `multline' gap emulation
176 \def\eqindent{C}% % C or I, centered or indented
177 \def\eqnumside{R}% % R or L, right or left
178 \def\eqnumplace{M}% % M or T or B, middle top or bottom
179 \def\eqnumfont{}% % Null for easier debugging [mjd,1997/09/26]
180 \def\eqnumform#1{(#1\@@italiccorr)} % Add parens
181 \def\eqnumsize{} % Allow numbers to have different typesize ...
182 \def\eqnumcolor{} % ... or color than eq body e.g. \color{blue}
183 \newlength\eqlinespacing \eqlinespacing=14pt plus2pt % Base-to-base space between lines
184 \newlength\eqlineskip \eqlineskip=3pt plus2pt % Min space if eqlinespacing too small
185 \newdimen\eqlineskiplimit \eqlineskiplimit=2pt % Threshold for switching to eqlineskip
186 \newmuskip \eqbinoffset \eqbinoffset=15mu minus-3mu % Offset from mathrel alignment pt for mathbins
187 \newmuskip\eqdelimoffset \eqdelimoffset=2mu % Additional offset for break inside delims
188 \newdimen\eqindentstep \eqindentstep=8pt % Indent used when LHS wd is n/a or too large
189 \newtoks\eqstyle % Customization hook
190 \newcount\eqbreakdepth \eqbreakdepth=2 % Allow breaks within delimiters to this depth
191 \newcount \eqinterlinepenalty \eqinterlinepenalty=10000 % No page breaks between equation lines
192 \newcount \intereqpenalty \intereqpenalty=1000 % Pagebreak penalty between equations [BRM: Was \@M]
193 \newlength \intereqskip \intereqskip=3pt plus2pt % Additional vert space between equations
194 \newcount\prerelpenalty \prerelpenalty=-\@M % Linebreak penalty before mathrel symbols
195 \newcount\prebinoppenalty \prebinoppenalty=888 % Linebreak penalty before mathbins
196 \newmuskip \Dmedmuskip \Dmedmuskip=4mu minus 3mu % medmuskip in displays
197 \newmuskip \Dthickmuskip \Dthickmuskip=5mu minus 2mu % thickmuskip in displays
198 \def\eq@number{} % Internal variable
199 \newlength\eqleftskip \eqleftskip=\@centering % Space on the left [NOT USED?]
200 \newlength\eqrightskip \eqrightskip=\@centering % Space on the right [NOT USED?]
201 \newlength\eq@vspan \eq@vspan=\z@skip % Glue used to vcenter the eq number
202 \newmuskip\eq@binoffset \eq@binoffset=\eqbinoffset % Roughly, \eqbinoffset + \eqdelimoffset
203 \newsavebox\EQ@box % Storage for equation body
204 \newsavebox\EQ@copy % For eq body sans vadjust/insert/mark material
205 \newsavebox\EQ@numbox % For equation number
206 \newdimen\eq@wdNum % width of number + separation [NEW]
207 \newsavebox\GRP@numbox % For group number [NEW]
208 \newdimen\grp@wdNum % width of number + separation [NEW]
209 %%B\EQ@vimbox % Vadjust, insert, or mark material
210 %%B\EQ@vimcopy % Spare copy of same
211 %%B\eq@impinging % Temporary box for measuring number placement
212 \newcount \eq@lines % Internal counter, actual number of lines
213 \newcount \eq@curline % Loop counter
214 \newcount \eq@badness % Used in testing for overfull lines
215 \newcount \EQ@vims % For bookkeeping
216 \def\@eq@numbertrue{\let\eq@hasNumber\@True}%
217 \def\@eq@numberfalse{\let\eq@hasNumber\@False}%
218 \let\eq@hasNumber\@False
219 \newdimen\eq@dp % Depth of last line
220 \newdimen\eq@wdL % Width of the left-hand-side
221 \newdimen\eq@wdT % Total width for framing
222 \newdimen\eq@wdMin % Width of narrowest line in equation
223 \newdimen\grp@wdL % Max width of LHS's in a group
224 \newdimen\grp@wdR % Max RHS of all equations in a group
225 \newdimen\grp@wdT
226 \newdimen\eq@wdRmax
227 \newdimen\eq@firstht % Height of first line
228 \newdimen\eq@wdCond
229 \newdimen\eq@indentstep % Indent amount when LHS is not present
230 \newdimen\eq@linewidth % Width actually used for display
231 \newdimen\grp@linewidth % Max eq@linewidth over a group
232 \newdimen\eq@hshift
233 \let\eq@isIntertext\@False
234 \eq@indentstep=\maxdimen
235 \newdimen\eq@given@sidespace
236 \def\eq@overrun{0pt}
237 \@ifpackagewith{amsmath}{leqno}{%
238 \@ifpackagewith{amsmath}{reqno}{}{\def\eqnumside{L}}%
240 \def\@tempa#1,leqno.clo,#2#3\@nil{%
241 \ifx @#2\relax\else \def\eqnumside{L}\fi
243 \@xp\@tempa\@filelist,leqno.clo,@\@nil
244 \if L\eqnumside
245 \else
246 \@ifundefined{iftagsleft@}{}{%
247 \edef\eqnumside{%
248 \if TT\csname fi\endcsname\csname iftagsleft@\endcsname
249 L\else R\fi
254 \@ifpackagewith{amsmath}{fleqn}{%
255 \def\eqindent{I}%
257 \def\@tempa#1,fleqn.clo,#2#3\@nil{%
258 \ifx @#2\relax\else \def\eqindent{I}\fi
260 \@xp\@tempa\@filelist,fleqn.clo,@\@nil
261 \if I\eqindent
262 \else
263 \@ifundefined{if@fleqn}{}{%
264 \edef\eqindent{%
265 \if TT\csname fi\endcsname\csname if@fleqn\endcsname
266 I\else C\fi
271 \@ifundefined{mathindent}{%
272 \newdimen\mathindent
274 \@ifundefined{@mathmargin}{}{%
275 \mathindent\@mathmargin
278 \let\EQ@hasLHS=\@False
279 \let\EQ@QED=\@empty
280 \def\mark@lhs#1{%
281 \ifnum\lr@level<\@ne
282 \let\mark@lhs\relax
283 \global\let\EQ@hasLHS=\@True
284 \global\let\EQ@prebin@space\EQ@prebin@space@a
285 \mark@lhs@a
286 \penalty9999 % instead of normal \rel@break
287 % else no penalty = forbid break
290 \def\mark@lhs@a{%
291 \mskip\thickmuskip \@@vadjust{\penalty\tw@}\penalty-\@Mi\@@vadjust{}%
293 \newcommand\hiderel[1]{\mathrel{\advance\lr@level\@ne#1}}
294 \let\m@@Bin\m@Bin
295 \let\m@@Rel\m@Rel
296 \let\EQ@prebin@space\relax
297 \def\EQ@prebin@space@a{\mskip-\eq@binoffset \keep@glue \mskip\eq@binoffset}
298 \def\bin@break{\ifnum\lastpenalty=\z@\penalty\prebinoppenalty\fi
299 \EQ@prebin@space}
300 \def\rel@break{%
301 \ifnum\abs@num\lastpenalty <\abs@num\prerelpenalty
302 \penalty\prerelpenalty
305 \def\d@@Bin{\bin@break \m@@Bin}
306 \def\d@@Rel{\mark@lhs \rel@break \m@@Rel}
307 \let\m@@symRel\@symRel \def\d@@symRel{\mark@lhs \rel@break \m@@symRel}
308 \let\m@@symBin\@symBin \def\d@@symBin{\bin@break \m@@symBin}
309 \let\m@@symDel\@symDel
310 \let\m@@symDeR\@symDeR
311 \let\m@@symDeB\@symDeB
312 \let\m@@symDeA\@symDeA
313 \def\display@setup{%
314 \medmuskip\Dmedmuskip \thickmuskip\Dthickmuskip
315 \let\m@Bin\d@@Bin \let\m@Rel\d@@Rel
316 \let\@symRel\d@@symRel \let\@symBin\d@@symBin
317 \let\m@DeL\d@@DeL \let\m@DeR\d@@DeR \let\m@DeB\d@@DeB
318 \let\m@DeA\d@@DeA
319 \let\@symDeL\d@@symDeL \let\@symDeR\d@@symDeR
320 \let\@symDeB\d@@symDeB \let\@symDeA\d@@symDeA
321 \let\left\eq@left \let\right\eq@right \global\lr@level\z@
322 \global\eq@wdCond\z@ %BRM: new
323 \everyhbox{\everyhbox\@emptytoks
324 \let\display@setup\relax \textmath@setup \let\textmath@setup\relax
326 \everyvbox{\everyvbox\@emptytoks
327 \let\display@setup\relax \textmath@setup \let\textmath@setup\relax
330 \def\dseries@display@setup{%
331 \medmuskip\Dmedmuskip \thickmuskip\Dthickmuskip
332 \let\m@Bin\d@@Bin
333 \let\@symBin\d@@symBin
334 \let\m@DeL\d@@DeL \let\m@DeR\d@@DeR \let\m@DeB\d@@DeB
335 \let\m@DeA\d@@DeA
336 \let\@symDeL\d@@symDeL \let\@symDeR\d@@symDeR
337 \let\@symDeB\d@@symDeB \let\@symDeA\d@@symDeA
338 \let\left\eq@left \let\right\eq@right \global\lr@level\z@
339 \everyhbox{\everyhbox\@emptytoks
340 \let\display@setup\relax \textmath@setup \let\textmath@setup\relax
342 \everyvbox{\everyvbox\@emptytoks
343 \let\display@setup\relax \textmath@setup \let\textmath@setup\relax
345 \displaystyle
347 \def\textmath@setup{%
348 \let\m@Bin\m@@Bin \let\m@Rel\m@@Rel
349 \let\@symRel\m@@symRel \let\@symBin\m@@symBin
350 \let\m@DeL\m@@DeL \let\m@DeR\m@@DeR \let\m@DeB\m@@DeB
351 \let\m@DeA\m@@DeA
352 \let\@symDeL\m@@symDeL \let\@symDeR\m@@symDeR
353 \let\@symDeB\m@@symDeB \let\@symDeA\m@@symDeA
354 \let\left\@@left \let\right\@@right
356 \@ifundefined{@displaytrue}{%
357 \@xp\newif\csname if@display\endcsname
358 \everydisplay\@xp{\the\everydisplay \@displaytrue}%
360 \define@key{breqn}{label}{\def\next@label{\label{#1}}}
361 \global\let\next@label\@empty
362 \define@key{breqn}{number}{\def\eq@number{#1}%
363 \let\@currentlabel\eq@number
365 \define@key{breqn}{shiftnumber}{\let\eq@shiftnumber\@True}
366 \define@key{breqn}{holdnumber}{\let\eq@holdnumber\@True}
367 \define@key{breqn}{density}{\def\eq@density@factor{#1}}
368 \define@key{breqn}{indentstep}{\eqindentstep#1\relax}
369 \define@key{breqn}{compact}[-99]{\prerelpenalty=#1\relax}
370 \define@key{breqn}{layout}[?]{%
371 \edef\eq@layout{\@car#1?\@nil}%
373 \define@key{breqn}{spread}{%
374 \addtolength\eqlinespacing{#1}%
375 \addtolength\eqlineskip{#1}%
376 \eqlineskiplimit\eqlineskip
378 \define@key{breqn}{sidespace}{%
379 \setlength\eq@given@sidespace{#1}%
381 \define@key{breqn}{style}{\eqstyle\@xp{\the\eqstyle #1}}
382 \define@key{breqn}{shortskiplimit}{\def\eq@shortskiplimit{#1}}
383 \def\eq@shortskiplimit{2em}
384 \define@key{breqn}{frame}[\fboxrule]{\def\eq@frame{T}%
385 \dim@a#1\relax\edef\eq@framewd{\the\dim@a}%
386 \freeze@glue\eqlinespacing \freeze@glue\eqlineskip
388 \define@key{breqn}{fullframe}[]{\def\eq@frame{U}%
389 \freeze@glue\eqlinespacing \freeze@glue\eqlineskip
391 \def\eq@frame{F} % no frame
392 \def\eq@framewd{\fboxrule}
393 \define@key{breqn}{framesep}[\fboxsep]{%
394 \if\eq@frame F\def\eq@frame{T}\fi
395 \dim@a#1\relax \edef\eq@framesep{\the\dim@a}%
396 \freeze@glue\eqlinespacing \freeze@glue\eqlineskip
398 \def\eq@framesep{\fboxsep}
399 \define@key{breqn}{background}{\def\eq@background{#1}%
400 \freeze@glue\eqlinespacing \freeze@glue\eqlineskip
402 \define@key{breqn}{color}{\def\eq@foreground{#1}}
403 \define@key{breqn}{center}[]{\let\eq@centerlines\@True}
404 \define@key{breqn}{nocenter}[]{\let\eq@centerlines\@False}
405 \let\eq@centerlines\@False
406 \define@key{breqn}{noalign}[]{\let\grp@aligned\@False}
407 \let\grp@aligned\@True % default
408 \define@key{breqn}{breakdepth}{\eqbreakdepth#1\relax}
409 \define@key{breqn}{cols}{\global\let\@preamble\@empty
410 \darray@mkpream#1\@percentchar
412 \newenvironment{dmath}{%
413 \let\eq@hasNumber\@True \@optarg\@dmath{}}{}
414 \def\@dmath[#1]{%
415 \everydisplay\expandafter{\the\everydisplay \display@setup}%
416 \if@noskipsec \leavevmode \fi
417 \if@inlabel \leavevmode \global\@inlabelfalse \fi
418 \if\eq@group\else\eq@prelim\fi
419 \setkeys{breqn}{#1}%
420 \the\eqstyle
421 \eq@setnumber
422 \begingroup
423 \eq@setup@a
424 \eq@startup
426 \def\enddmath#1{\check@punct@or@qed}
427 \def\end@dmath{%
428 \gdef\EQ@setwdL{}% Occasionally undefined ???
429 \eq@capture
430 \endgroup
431 \EQ@setwdL
432 \eq@measure
433 \if\eq@group \grp@push \else \eq@finish\fi
435 \newenvironment{dmath*}{%
436 \let\eq@hasNumber\@False \@optarg\@dmath{}%
438 \@namedef{end@dmath*}{\end@dmath}
439 \@namedef{enddmath*}#1{\check@punct@or@qed}
440 \def\eq@prelim{%
441 \if@inlabel \indent \par \fi
442 \if@nobreak \global\@nobreakfalse \predisplaypenalty\@M \fi
443 \everypar\@emptytoks
444 \noindent
445 \eq@nulldisplay
446 \par %% \eq@saveparinfo %% needs work
447 \let\intertext\breqn@intertext
449 \def\breqn@parshape@warning{%
450 \PackageWarning{breqn}{%
451 Complex paragraph shape cannot be followed by this equation}%
453 \let\eq@prevshape\@empty
454 \def\eq@saveparinfo{%
455 \count@\prevgraf \advance\count@-\thr@@ % for the null display
456 \edef\eq@prevshape{\prevgraf\the\count@\space}%
457 \ifcase\parshape
458 % case 0: no action required
459 \or \edef\eq@prevshape{\eq@prevshape
460 \parshape\@ne\displayindent\displaywidth\relax
462 \else
463 \breqn@parshape@warning
466 \def\eq@setnumber{%
467 \eq@wdNum\z@
468 \if\eq@hasNumber
469 \ifx\eq@number\@empty
470 \stepcounter{equation}\let\eq@number\theequation
472 % This sets up numbox, etc, even if unnumbered?????
473 \ifx\eq@number\@empty
474 \else
475 \set@label{equation}\eq@number
476 \global\sbox\EQ@numbox{%
477 \next@label \global\let\next@label\@empty
478 \eqnumcolor\eqnumsize\eqnumfont{\eqnumform{\eq@number}}%
480 \global\eq@wdNum\wd\EQ@numbox\global\advance\eq@wdNum\eqnumsep
484 \newcount\eq@final@linecount
485 \let\eq@GRP@first@dmath\@True
486 \def\eq@finish{%
487 \begingroup
488 \if F\eq@frame\else
489 \freeze@glue\eqlinespacing \freeze@glue\eqlineskip
491 \csname eq@\eqindent @setsides\endcsname % Compute \leftskip,\rightskip
492 \adjust@parshape\eq@parshape% Final adjustment of parshape for left|right skips
493 \if\eq@group
494 \if\eq@GRP@first@dmath
495 \global\let\eq@GRP@first@dmath\@False
496 \xdef\dmath@first@leftskip{\leftskip=\the\leftskip\relax}%
497 \else
498 \eq@topspace{\vskip\parskip}% Set top spacing
500 \else
501 \eq@topspace{\vskip\parskip}% Set top spacing
503 \afterassignment\remove@to@nnil
504 \eq@final@linecount=\expandafter\@gobble\eq@parshape\@nnil
505 \if\eq@hasNumber
506 \if\eq@shiftnumber
507 \csname eq@typeset@\eqnumside Shifted\endcsname
508 \else
509 \ifnum\eq@final@linecount=\@ne
510 \csname eq@typeset@\eqnumside @single\endcsname
511 \else
512 \csname eq@typeset@\eqnumside\eqnumplace\endcsname
515 \else
516 \eq@typeset@Unnumbered
518 \endgroup
519 \eq@botspace
521 \def\eq@typeset@L@single{%
522 \nobreak
523 \eq@params\eq@parshape
524 \nointerlineskip\noindent
525 \add@grp@label
526 \rlap{\kern-\leftskip\box\EQ@numbox}%
527 \if F\eq@frame
528 \else
529 \rlap{\raise\eq@firstht\hbox to\z@{\eq@addframe\hss}}%
531 \eq@dump@box\unhbox\EQ@box \@@par
533 \def\eq@typeset@R@single{%
534 \nobreak
535 \eq@params\eq@parshape
536 \nointerlineskip\noindent
537 \add@grp@label
538 \if F\eq@frame
539 \else
540 \rlap{\raise\eq@firstht\hbox to\z@{\eq@addframe\hss}}%
542 \rlap{\kern-\leftskip\kern\linewidth\kern-\wd\EQ@numbox\copy\EQ@numbox}%
543 \eq@dump@box\unhbox\EQ@box
544 \@@par
546 \def\peek@branch#1#2{%
547 \let\peek@b#1\let\peek@space#2\futurelet\@let@token\peek@a
549 \def\peek@skipping@spaces#1{\peek@branch#1\peek@skip@space}
550 \def\peek@a{%
551 \ifx\@let@token\@sptoken \expandafter\peek@space
552 \else \expandafter\peek@b\fi
554 \lowercase{\def\peek@skip@space} {\futurelet\@let@token\peek@a}%
555 \def\check@punct{\futurelet\@let@token\check@punct@a}
556 \def\check@punct@a{%
557 \edef\@tempa{%
558 \ifx\@let@token\@sptoken\@nx\finish@end
559 \else\ifx\@let@token ,\@nx\check@qed
560 \else\ifx\@let@token .\@nx\check@qed
561 \else\check@punct@b % check the less common possibilities
562 \fi\fi\fi
564 \@tempa
566 \begingroup
567 \toks@a{%
568 \ifx\@let@token ;\@nx\check@qed
569 \else\ifx\@let@token ?\@nx\check@qed
570 \else\ifx\@let@token !\@nx\check@qed
572 \toks@c{\fi\fi\fi}% matching with \toks@a
573 \catcode`\.=\active \catcode`\,=\active \catcode`\;=\active
574 \catcode`\?=\active \catcode`\!=\active
575 \toks@b{%
576 \else\ifx\@let@token ,\@nx\check@qed
577 \else\ifx\@let@token .\@nx\check@qed
578 \else\ifx\@let@token ;\@nx\check@qed
579 \else\ifx\@let@token ?\@nx\check@qed
580 \else\ifx\@let@token !\@nx\check@qed
581 \else\@nx\finish@end
582 \fi\fi\fi\fi\fi
584 \xdef\check@punct@b{%
585 \the\toks@a\the\toks@b\the\toks@c
587 \endgroup
588 \let\found@punct\@empty
589 \def\check@qed#1{%
590 \gdef\found@punct{#1}%
591 \peek@skipping@spaces\check@qed@a
593 \def\check@qed@a{%
594 \ifx\end\@let@token \@xp\check@qed@b
595 \else \@xp\finish@end
598 \def\check@qed@b#1#2{%
599 \@ifundefined{#2qed}{}{%
600 \toks@\@xp{\found@punct\csname#2qed\endcsname}%
601 \xdef\found@punct{\the\toks@}%
603 \finish@end
604 \end{#2}%
606 \def\@tempa#1\endcsname#2\@nil{\def\latex@end##1{#2}}
607 \expandafter\@tempa\end{#1}\@nil
608 \def\end#1{\csname end#1\endcsname \latex@end{#1}}%
609 \def\check@punct@or@qed#1{%
610 \xdef\found@punct{\@empty}% BRM: punctuation was being remembered past this eqn.
611 \def\finish@end{\csname end@#1\endcsname\latex@end{#1}}%
612 \check@punct
614 \newcommand\eqpunct[1]{\thinspace#1}
615 \providecommand\set@label[2]{\protected@edef\@currentlabel{#2}}
616 \def\eq@topspace#1{%
617 \begingroup
618 \global\let\EQ@shortskips\@False
619 \if\@And{\eq@group}{\@Not\eq@GRP@first@dmath}%
620 \parskip\intereqskip \penalty\intereqpenalty
621 \else
622 \eq@check@shortskip
623 \if\EQ@shortskips
624 \parskip\abovedisplayshortskip
625 \aftergroup\belowdisplayskip\aftergroup\belowdisplayshortskip
626 \ifdim\predisplaysize>\z@\nointerlineskip\fi
627 \else
628 \parskip\abovedisplayskip
631 \if F\eq@frame
632 \else
633 \addtolength\parskip{\eq@framesep+\eq@framewd}%
636 \endgroup
638 \def\eq@check@shortskip {%
639 \global\let\EQ@shortskips\@False
640 \setlength\dim@a{\abovedisplayskip+\ht\EQ@numbox}%
641 \ifdim\leftskip<\predisplaysize
642 \else
643 \ifdim -\maxdimen=\predisplaysize
644 \else
645 \if R\eqnumside
646 \global\let\EQ@shortskips\@True
647 \else
648 \if\eq@shiftnumber
649 \else
650 \if T\eqnumplace
651 \ifdim\dim@a<\eq@firstht
652 \global\let\EQ@shortskips\@True
654 \else
655 \setlength\dim@b{\eq@vspan/2}%
656 \ifdim\dim@a<\dim@b
657 \global\let\EQ@shortskips\@True
665 \def\eq@botspace{%
666 \penalty\postdisplaypenalty
667 \if F\eq@frame
668 \else
669 \addtolength\belowdisplayskip{\eq@framesep+\eq@framewd}%
671 \vskip\belowdisplayskip
672 \@endpetrue % kill parindent if current paragraph continues
673 \global\@ignoretrue % ignore following spaces
674 \eq@resume@parshape
676 \def\eq@resume@parshape{}
677 \def\eq@startup{%
678 \global\let\EQ@hasLHS\@False
679 \setbox\z@\vbox\bgroup
680 \noindent \@@math \displaystyle
681 \penalty-\@Mi
683 \def\eq@setup@a{%
684 \everymath\everydisplay
685 %\let\@newline\eq@newline % future possibility?
686 \let\\\eq@newline
687 \let\insert\eq@insert \let\mark\eq@mark \let\vadjust\eq@vadjust
688 \hsize\maxdimen \pretolerance\@M
689 \linepenalty\@m
690 \rightskip\z@\@plus\@M\p@ \leftskip\z@skip \parfillskip\z@skip
691 \clubpenalty\@ne \widowpenalty\z@ \interlinepenalty\z@
692 \global\let\EQ@prebin@space\relax
693 \binoppenalty\@M \relpenalty\@M
695 \newdimen\eq@wdR\eq@wdR\z@%BRM
696 \def\eq@capture{%
697 \ifnum\lastpenalty>-\@M \penalty-\@Mi \fi
698 \keep@glue\@@endmath
699 \eq@addpunct
700 \@@par
701 \eq@wdL\z@
702 \setbox\tw@\lastbox
703 \global\setbox\EQ@box\hbox{\unhbox\tw@\unskip\unskip\unpenalty}%
704 \unskip\unpenalty
705 \global\setbox\EQ@copy\copy\EQ@box
706 %% \global\setbox\EQ@vimcopy\copy\EQ@vimbox
707 \clubpenalty\z@
708 \eq@wdR\z@%BRM: eq@wdL patch
709 \eq@repack % recursive
710 \setbox\tw@\lastbox
711 \global\setbox\EQ@box\hbox{\unhcopy\tw@\unskip\unpenalty \unhbox\EQ@box}%
712 \global\setbox\EQ@copy\hbox{\unhbox\tw@\unskip\unpenalty \unhbox\EQ@copy}%
713 \ifdim\eq@wdR>\z@% BRM: eq@wdL patch
714 \setlength\dim@a{\wd\EQ@box-\eq@wdR
715 % Apparently missing a \thickmuskip = 5mu = 5/18em=0.27777777777.. ?
716 + 0.2777777777777em}% FUDGE??!?!?!
717 \ifdim\dim@a>\eq@wdL
718 \eq@wdL\dim@a
719 \xdef\EQ@setwdL{\eq@wdL\the\eq@wdL\relax}%
722 \egroup % end vbox started earlier
724 \def\eq@addpunct{%
725 \ifx\found@punct\@empty
726 \else \eqpunct{\found@punct}%
728 % BRM: Added; the punctuation kept getting carried to following environs
729 \xdef\found@punct{\@empty}%
730 \EQ@afterspace
732 \global\let\EQ@afterspace\@empty
733 \def\eq@repack{%
734 \ifcase\lastpenalty
735 % case 0: normal case
736 \setbox\tw@\lastbox
737 \eq@repacka\EQ@copy \eq@repacka\EQ@box
738 \unskip
739 \or % case 1: finished recursing
740 \unpenalty
741 \setbox\tw@\lastbox
742 \eq@repacka\EQ@copy \eq@repacka\EQ@box
743 \@xp\@gobble
744 \or % case 2: save box width = LHS width
745 \unpenalty
746 \setbox\tw@\lastbox
747 \setbox\z@\copy\tw@ \setbox\z@\hbox{\unhbox\z@\unskip\unpenalty}%
748 \addtolength\eq@wdL{\wd\z@}
749 \setlength\eq@wdR{\wd\EQ@box}% BRM: eq@wdL patch
750 \xdef\EQ@setwdL{\eq@wdL\the\eq@wdL\relax}%
751 \global\setbox\EQ@copy\hbox{%
752 \hbox{\unhcopy\tw@\unskip\unpenalty\unskip}%
753 \box\EQ@copy
755 \global\setbox\EQ@box\hbox{%
756 \hbox{\unhbox\tw@\unskip\unpenalty\unskip}%
757 \box\EQ@box
759 \unskip
760 \or % case 3: unpack left-right box
761 \unpenalty
762 \eq@lrunpack
763 \else
764 \breqn@repack@err
766 \eq@repack % RECURSE
768 \def\breqn@repack@err{%
769 \PackageError{breqn}{eq@repack penalty neq 0,1,2,3}\relax
771 \def\eq@repacka#1{%
772 \global\setbox#1\hbox{\unhcopy\tw@ \unskip
773 \count@-\lastpenalty
774 \ifnum\count@<\@M \else \advance\count@-\@M \fi
775 \unpenalty
776 \ifx\EQ@copy#1\ifnum\count@>\thr@@ \count@\@ne\fi\fi
777 \ifcase\count@
778 % case 0, normal line break
779 \penalty-\@M % put back the linebreak penalty
780 \or % case 1, do nothing (end of equation)
781 \relax
782 \or % case 2, no-op (obsolete case)
783 \or % case 3, transfer vspace and/or penalty
784 \ifx#1\EQ@box \eq@revspace \else \eq@revspaceb \fi
785 \or % case 4, put back an insert
786 \eq@reinsert
787 \or % case 5, put back a mark
788 \eq@remark
789 \or % case 6, put back a vadjust
790 \eq@readjust
791 \else % some other break penalty
792 \penalty-\count@
794 \unhbox#1}%
796 \def\eq@nulldisplay{%
797 \begingroup \frozen@everydisplay\@emptytoks
798 \@@display
799 \predisplaypenalty\@M \postdisplaypenalty\@M
800 \abovedisplayskip\z@skip \abovedisplayshortskip\z@skip
801 \belowdisplayskip\z@skip \belowdisplayshortskip\z@skip
802 \xdef\EQ@displayinfo{%
803 \prevgraf\the\prevgraf \predisplaysize\the\predisplaysize
804 \displaywidth\the\displaywidth \displayindent\the\displayindent
805 \listwidth\the\linewidth
806 \ifdim\displayindent>\z@
807 \advance\listwidth\the\leftmargin
808 \advance\listwidth\the\rightmargin
810 \relax}%
811 \halign{##\cr}%
812 \@@enddisplay
813 \par
814 \endgroup
815 \EQ@displayinfo
817 \def\eq@newline{%
818 \@ifstar{\eq@newlinea\@M}{\eq@newlinea\eqinterlinepenalty}}
819 \def\eq@newlinea#1{%
820 \@ifnext[{\eq@newlineb{#1}}{\eq@newlineb{#1}[\maxdimen]}}
821 \def\eq@newlineb#1[#2]{\penalty-\@M}
822 \def\eq@revspace{%
823 \global\setbox\EQ@vimbox\vbox{\unvbox\EQ@vimbox
824 \unpenalty
825 \global\setbox\@ne\lastbox}%
826 \@@vadjust{\unvbox\@ne}%
827 \penalty-\@M
829 \def\eq@revspaceb{%
830 \global\setbox\EQ@vimcopy\vbox{\unvbox\EQ@vimcopy
831 \unpenalty
832 \global\setbox\@ne\lastbox}%
833 \@@vadjust{\unvbox\@ne}%
834 \penalty-\@M
836 \def\eq@break#1{\penalty-1000#1 \keep@glue}
837 \let\@parshape\@empty
838 \def\eq@measure{%
839 \ifdim\eq@indentstep=\maxdimen \eq@indentstep\eqindentstep \fi
840 \ifdim\eq@linewidth=\z@ \else \edef\eq@linewidths{{\the\eq@linewidth}}\fi
841 \begingroup \eq@params
842 \leftskip\z@skip
843 \rightskip\z@\@plus\columnwidth\@minus\hfuzz
844 \global\EQ@continue{\eq@trial}%
845 \eq@trial % uses \eq@linewidths
846 \eq@failout % will be a no-op if the trial succeeded
847 \endgroup
848 \EQ@trial
850 \let\EQ@trial\@empty
851 \newtoks\EQ@continue
852 \let\EQ@widths\@empty
853 \let\EQ@fallback\@empty
854 \def\eq@linewidths{\displaywidth\linewidth\columnwidth}
855 \def\eq@trial{%
856 \ifx\@empty\eq@linewidths
857 \global\EQ@continue{}%
858 \else
859 \iffalse{\fi \@xp\eq@trial@a \eq@linewidths}%
861 \the\EQ@continue
863 \def\eq@trial@a#1{%
864 \dim@c#1\relax
865 \if T\eq@frame \eq@frame@adjust\dim@c \fi
866 \ifdim\dim@c>\eq@linewidth
867 \eq@linewidth\dim@c
868 \let\eq@trial@b\eq@trial@d
869 \csname eq@try@layout@\eq@layout\endcsname
871 \edef\eq@linewidths{\iffalse}\fi
873 \def\eq@frame@adjust#1{%
874 %\addtolength#1{-2\eq@framewd-2\eq@framesep}%
875 \dim@a\eq@framewd \advance\dim@a\eq@framesep
876 \advance#1-2\dim@a
878 \def\eq@trial@succeed{%
879 \aftergroup\@gobbletwo % cancel the \EQ@fallback code; see \eq@trial@c (?)
880 \global\EQ@continue{\eq@trial@done}%
882 \def\eq@trial@done{%
883 \let\eq@failout\relax
885 \def\eq@trial@init{\global\let\EQ@fallback\eq@nextlayout}
886 \def\eq@nextlayout#1{%
887 \endgroup
888 \begingroup #1%
890 \def\eq@failout{%
891 \global\let\EQ@trial\EQ@last@trial
893 \def\eq@trial@save#1{%
894 \xdef#1{%
895 \eq@linewidth\the\eq@linewidth
896 % save info about the fit
897 \eq@lines\the\eq@lines \eq@badness\the\eq@badness \def\@nx\eq@badline{\eq@badline}%
898 % save size info
899 \eq@wdT\the\eq@wdT \eq@wdMin\the\eq@wdMin
900 \eq@vspan\the\eq@vspan \eq@dp\the\eq@dp \eq@firstht\the\eq@firstht
901 % save info about the LHS
902 \eq@wdL\the\eq@wdL \def\@nx\EQ@hasLHS{\EQ@hasLHS}%
903 % save info about the numbering
904 \def\@nx\eq@hasNumber{\eq@hasNumber}%
905 % save info about the chosen layout
906 \def\@nx\eq@layout{\eq@layout}%
907 \def\@nx\eq@parshape{\@parshape}%
908 \def\@nx\eq@measurements{\eq@measurements}%
909 \def\@nx\adjust@rel@penalty{\adjust@rel@penalty}%
910 \def\@nx\eq@shiftnumber{\eq@shiftnumber}%
911 \def\@nx\eq@isIntertext{\@False}%
914 \def\eq@trial@b{\eq@trial@c}
915 \def\eq@trial@c#1#2{%
916 \begingroup
917 \eq@trial@init
918 \def\eq@layout{#1}%
919 \setbox\z@\vbox{%
920 \hfuzz\maxdimen
921 \eq@trial@p % run the given parshape
922 \if\@Not{\eq@badline}%
923 \eq@trial@save\EQ@trial
924 \if\eq@hasNumber\eq@retry@with@number\fi
925 \if L\eq@layout \eq@check@density
926 \else
927 \if\@Not{\eq@badline}%
928 \eq@trial@succeed
931 \else
932 \eq@trial@save\EQ@last@trial
935 \EQ@fallback{#2}%
936 \endgroup
938 \def\eq@trial@d#1#2{\eq@trial@c{#1}{}}
939 \def\eq@check@density{%
940 \if\@Or{\@Not\EQ@hasLHS}{\eq@shortLHS}%
941 \eq@trial@succeed
942 \else\if\eq@dense@enough
943 \eq@trial@succeed
944 \fi\fi
946 \def\eq@shortLHS{\ifdim\eq@wdL>.44\eq@wdT 1\else 0\fi 0}
947 \def\eq@trial@p{%
948 \@parshape %
949 \eq@dump@box\unhcopy\EQ@copy
950 {\@@par}% leave \parshape readable
951 \eq@lines\prevgraf
952 \eq@fix@lastline
953 \let\eq@badline\@False
954 \if i\eq@layout \ifnum\eq@lines>\@ne \let\eq@badline\@True \fi\fi
955 \eq@curline\eq@lines % loop counter for eq@measure@lines
956 \let\eq@measurements\@empty
957 \eq@ml@record@indents
958 \eq@measure@lines
959 \eq@recalc
961 \let\adjust@rel@penalty\@empty
962 \def\eq@fix@lastline{%
963 \setbox\tw@\lastbox \dim@b\wd\tw@
964 \eq@dp\dp\tw@
965 \nointerlineskip\hbox to\dim@b{\unhbox\tw@
966 \skip@c\lastskip \unskip\unskip\hskip\skip@c
969 \def\eq@recalc{%
970 \eq@wdT\z@ \eq@wdMin\maxdimen \eq@vspan\z@skip \eq@badness\z@
971 \let\@elt\eq@recalc@a \eq@measurements \let\@elt\relax
973 \def\eq@recalc@a#1x#2+#3\@endelt{%
974 \eq@firstht#2\relax
975 \let\@elt\eq@recalc@b
976 \@elt#1x#2+#3\@endelt
978 \def\eq@recalc@b#1X#2,#3x#4+#5@#6\@endelt{%
979 \setlength\dim@a{#2+#3}%
980 \ifdim\dim@a>\eq@wdT \eq@wdT\dim@a \fi
981 \ifdim\dim@a<\eq@wdMin \eq@wdMin\dim@a \fi
982 \eq@dp#5\relax
983 \addtolength\eq@vspan{#1+#4+\eq@dp}%
984 \ifnum#6>\eq@badness \eq@badness#6\relax\fi
986 \def\eq@layout{?}
987 \@namedef{eq@try@layout@?}{%
988 \let\eq@trial@b\eq@trial@c
989 \edef\@parshape{\parshape 1 0pt \the\eq@linewidth\relax}%
990 \setlength\dim@a{\wd\EQ@copy-2em}% Fudge; can't shrink more than this?
991 % if we're in a numbered group, try hard to fit within the numbers
992 \dim@b\eq@linewidth
993 \if\eq@shiftnumber\else\if\eq@group
994 \if\eq@hasNumber\addtolength\dim@b{-\wd\EQ@numbox-\eqnumsep}%
995 \else\if\grp@hasNumber\addtolength\dim@b{-\wd\GRP@numbox-\eqnumsep}%
996 \fi\fi\fi\fi
997 \ifdim\dim@a<\dim@b% Do we even have a chance of fitting to one line?
998 \setlength\dim@b{\columnwidth-\dim@a+\eq@wdCond}%
999 \rightskip\z@\@plus\dim@b\@minus\hfuzz
1000 \eq@trial@b{i}{\eq@try@layout@multi}%
1001 \else
1002 \eq@try@layout@multi
1005 \def\eq@try@layout@multi{%
1006 \if\EQ@hasLHS
1007 \ifdim\eq@wdL>\eq@linewidth
1008 \setlength\dim@a{\wd\EQ@copy-\eq@wdL}%
1009 \ifdim\dim@a<.25\eq@linewidth \eq@try@layout@S
1010 \else \eq@try@layout@l
1012 % BRM: Originally .7: Extreme for L since rhs has to wrap within the remaining 30+%!
1013 \else\ifdim\eq@wdL>.50\eq@linewidth
1014 \eq@try@layout@D
1015 \else
1016 \eq@try@layout@L
1017 \fi\fi
1018 \else
1019 \eq@try@layout@S % (already checked case i)
1022 \def\eq@try@layout@D{%
1023 \setlength\dim@a{\eq@linewidth -\eq@indentstep}%
1024 \edef\@parshape{\parshape 2
1025 0pt \the\eq@wdL\space \the\eq@indentstep\space \the\dim@a\relax
1027 \def\adjust@rel@penalty{\penalty-99 }%
1028 \eq@trial@b{D}{\eq@try@layout@A}%
1030 \def\eq@try@layout@L{%
1031 \setlength\dim@b{\eq@linewidth-\eq@wdL}%
1032 \edef\@parshape{\parshape 2 0pt \the\eq@linewidth\space
1033 \the\eq@wdL\space \the\dim@b\relax
1035 \eq@trial@b{L}{\eq@try@layout@D}%
1037 \def\eq@try@layout@S{%
1038 \setlength\dim@b{\eq@linewidth-2\eqmargin}% \advance\dim@b-1em%
1039 \int@a\wd\EQ@copy \divide\int@a\dim@b
1040 \addtolength\dim@b{-\int@a\eq@indentstep}%
1041 \if\eq@hasNumber
1042 \ifdim\dim@b>15em%
1043 \addtolength\dim@b{-\eq@wdNum}%
1046 \int@b\z@
1047 \def\@tempa{\dim}%
1048 \edef\@parshape{\parshape 2 0pt \the\dim@b\space
1049 \the\eqmargin\space\the\dim@b\relax}%
1050 \eq@trial@b{S}{\eq@try@layout@A}%
1052 \def\eq@try@layout@l{%
1053 \setlength\dim@a{\eq@linewidth -\eq@indentstep}%
1054 \int@a\eq@wdL \divide\int@a\dim@a
1055 \advance\int@a\tw@
1056 \edef\@parshape{\parshape \number\int@a\space
1057 0pt \the\eq@linewidth
1059 \advance\int@a-\tw@
1060 \setlength\dim@b{2\eq@indentstep}%
1061 \setlength\dim@c{\eq@linewidth -\dim@b}%
1062 \edef\@parshape{\@parshape
1063 \replicate{\int@a}{\space\the\eq@indentstep\space\the\dim@a}%
1064 \space\the\dim@b\space\the\dim@c\relax
1066 \eq@trial@b{l}{\eq@try@layout@A}%
1068 \def\eq@try@layout@A{%
1069 \edef\@parshape{\parshape 1 0pt \the\eq@linewidth\relax}%
1070 \if\EQ@hasLHS \def\adjust@rel@penalty{\penalty-99 }\fi
1071 \eq@trial@b{A}{}%
1073 \let\eq@shiftnumber\@False
1074 \def\eq@retry@with@number{%
1075 \if\eq@shiftnumber
1076 \else
1077 \ifdim\eq@wdCond>\z@\if R\eqnumside
1078 \let\eq@shiftnumber\@True
1079 \fi\fi
1080 \dim@b\eq@wdNum
1081 \if L\eqnumside
1082 \ifdim\@totalleftmargin>\dim@b\dim@b\@totalleftmargin\fi
1083 \else
1084 \addtolength\dim@b{\@totalleftmargin}%
1086 \setlength\dim@a{\eq@linewidth-\dim@b}%\advance\dim@a1em\relax% Allowance for shrink?
1087 \int@a\@ne\if\eq@group\int@a\maxint\fi
1088 \if\eq@shiftnumber % Already know we need to shift
1089 \else\ifdim\eq@wdT<\dim@a % Fits!
1090 \else
1091 \setlength\leftskip{\eq@wdNum}%
1092 \setlength\rightskip{\z@\@plus\dim@a}%
1093 \adjust@parshape\@parshape
1094 \nointerlineskip
1095 \edef\eq@prev@lines{\the\eq@lines}%
1096 \edef\eq@prev@badness{\the\eq@badness}% BRM
1097 \eq@trial@p
1098 \int@a\eq@prev@badness\relax\advance\int@a 50\relax%?
1099 \int@b\eq@prev@lines \if\eq@group\advance\int@b\@ne\fi% Allow 1 extra line in group
1100 \ifnum\eq@lines>\int@b % \eq@prev@lines
1101 \let\eq@shiftnumber\@True
1102 \else\if\eq@badline
1103 \let\eq@shiftnumber\@True
1104 \else\ifnum\eq@badness>\int@a % BRM: New case
1105 \let\eq@shiftnumber\@True
1106 \else
1107 \fi\fi%\fi
1108 \fi\fi\fi
1109 \if\eq@shiftnumber
1110 \EQ@trial% Restore parshape & other params,
1111 \leftskip\z@\let\eq@shiftnumber\@True % But set shift & leftskip
1112 \edef\@parshape{\eq@parshape}% And copy saved parshape back to `working copy' !?!?
1114 \eq@trial@save\EQ@trial % Either way, save the trial state.
1117 \def\adjust@parshape#1{%
1118 \@xp\adjust@parshape@a#1\relax
1119 \edef#1{\temp@a}%
1121 \def\adjust@parshape@a#1 #2\relax{%
1122 \setlength\dim@a{\leftskip+\rightskip}%
1123 \edef\temp@a{#1}%
1124 \adjust@parshape@b#2 @ @ \relax
1126 \def\adjust@parshape@b#1 #2 {%
1127 \ifx @#1\edef\temp@a{\temp@a\relax}%
1128 \@xp\@gobble
1129 \else
1130 \dim@b#1\relax
1131 \dim@c#2\relax
1132 \addtolength\dim@c{\dim@a+\dim@b}%
1133 \ifdim\dim@c>\eq@linewidth\setlength\dim@c{\eq@linewidth}\fi
1134 \addtolength\dim@c{-\dim@b}%
1135 \edef\temp@a{\temp@a\space\the\dim@b\space\the\dim@c}%
1137 \adjust@parshape@b
1139 \def\eq@ml@record@indents{%
1140 \int@a\z@
1141 \def\@tempa{%
1142 \advance\int@a\@ne
1143 \@xp\edef\csname eq@i\number\int@a\endcsname{\the\dim@a}%
1144 \ifnum\int@a<\int@b \afterassignment\@tempb \fi
1145 \dim@a
1147 \def\@tempb{\afterassignment\@tempa \dim@a}%
1148 \def\@tempc##1##2 {\int@b##2\afterassignment\@tempa\dim@a}%
1149 \@xp\@tempc\@parshape
1151 \chardef\@endelt=`\?
1152 \def\eq@measurements{%
1153 \@elt 4.5pt/5.0pt,66.0ptx6.8pt+2.4pt@27\@endelt
1156 \def\eq@measure@lines{%
1157 \let\eq@ml@continue\eq@measure@lines
1158 \setbox\tw@\lastbox \dim@b\wd\tw@ % find target width of line
1159 \setbox\z@\hbox to\dim@b{\unhbox\tw@}% check for overfull
1160 \eq@badness\badness
1161 \ifnum\eq@badness<\inf@bad \else \let\eq@badline\@True \fi
1162 \eq@ml@a \eq@ml@continue
1164 \def\eq@ml@a{%
1165 \setbox\tw@\hbox{\unhbox\z@ \unskip}% find natural width
1166 \ifdim\dim@b<\wd\tw@ \setlength\dim@a{\dim@b}% shrunken line
1167 \else \setlength\dim@a{\wd\tw@}% OK to use natural width
1169 \addtolength\dim@a{-\leftskip}% BRM: Deduct the skip if we're retrying w/number
1170 \skip@a\lastskip \unskip \unpenalty
1171 \ifdim\skip@a=\z@
1172 \let\eq@ml@continue\relax % end the recursion
1173 \else
1174 % Sum repeated vskips if present
1175 \def\@tempa{%
1176 \ifdim \lastskip=\z@
1177 \else \addtolength\skip@a{\lastskip}\unskip\unpenalty \@xp\@tempa
1181 \edef\eq@measurements{\@elt
1182 \the\skip@a\space X% extra space to facilitate extracting only the
1183 % dimen part later
1184 \csname eq@i%
1185 \ifnum\eq@curline<\parshape \number\eq@curline
1186 \else\number\parshape
1188 \endcsname,\the\dim@a x\the\ht\tw@+\the\dp\tw@ @\the\eq@badness\@endelt
1189 \eq@measurements
1191 \advance\eq@curline\m@ne
1192 \ifnum\eq@curline=\z@ \let\eq@ml@continue\relax\fi
1194 \def\eq@ml@vspace{%
1195 \global\advance\eq@vspan\lastskip \unskip\unpenalty
1196 \ifdim\lastskip=\z@ \else \@xp\eq@ml@vspace \fi
1198 \def\eq@dense@enough{%
1199 \ifnum\eq@lines<\thr@@
1200 \@True
1201 \else
1202 \ifdim\eq@wdL >.7\eq@wdT
1203 \@False
1204 \else \@xp\@xp\@xp\eq@dense@enough@a
1208 \def\true@false@true{\fi\fi\iftrue\iffalse\iftrue}
1209 \def\false@false@false{\fi\fi\iffalse\iffalse\iffalse}
1210 \def\false@true@false{\fi\fi\iffalse\iftrue\iffalse}
1211 \def\eq@density@factor{.475}
1212 \def\eq@dense@enough@a{%
1213 \@True \fi
1214 \ifnum\eq@lines>\sixt@@n
1215 \eq@dense@enough@b
1216 \else
1217 \dim@b\z@ \let\@elt\eq@delt \eq@measurements
1218 \dim@c\eq@density@factor\eq@wdT \multiply\dim@c\eq@lines
1219 \ifdim\dim@b>\dim@c \true@false@true \else \false@false@false \fi
1222 \def\eq@delt#1X#2,#3x#4+#5@#6\@endelt{\addtolength\dim@b{#3}}%
1223 \def\eq@dense@enough@b{%
1224 \int@b\eq@wdT \divide\int@b\p@
1225 \dim@b\eq@wdL \divide\dim@b\int@b
1226 \dim@c\eq@lines\p@ \multiply\dim@c\f@ur
1227 \int@b\eq@lines \multiply\int@b 9 \advance\int@b -10%
1228 \divide\dim@c\int@b
1229 \ifdim\dim@b<\dim@c \true@true@true \else \false@true@false \fi
1231 \let\eq@parshape\@empty
1232 \def\eq@params{%
1233 \baselineskip\eqlinespacing
1234 \lineskip\eqlineskip \lineskiplimit\eqlineskiplimit
1235 \clubpenalty\@M \widowpenalty\@M \interlinepenalty\eqinterlinepenalty
1236 \linepenalty199 \exhyphenpenalty5000 % was 9999: make breaks at, eg. \* a bit easier.
1237 \ifdim\hfuzz<\p@ \hfuzz\p@ \fi
1238 \parfillskip\z@skip
1239 \tolerance9999 \pretolerance\m@ne
1241 \def\eq@dump@box#1#2{%
1242 \noindent #1#2\setbox\f@ur\lastbox \setbox\tw@\lastbox
1243 \if L\eq@layout \box\tw@ \else\unhbox\tw@\fi
1244 \adjust@rel@penalty \unhbox\f@ur
1246 \def\eq@typeset@Unnumbered{%
1247 \eq@typeset@frame
1248 \eq@typeset@equation
1250 \def\eq@typeset@LM{%
1251 \setlength\dim@a{(\eq@vspan+\ht\EQ@numbox-\dp\EQ@numbox)/2}%
1252 \eq@typeset@leftnumber
1253 \eq@typeset@frame
1254 \eq@typeset@equation
1256 \def\eq@typeset@LT{%
1257 \dim@a\eq@firstht
1258 \eq@typeset@leftnumber
1259 \eq@typeset@frame
1260 \eq@typeset@equation
1262 \def\eq@typeset@LShifted{%
1263 % place number
1264 \copy\EQ@numbox \penalty\@M
1265 \dim@a\eqlineskip
1266 \if F\eq@frame\else
1267 \setlength\dim@a{\eq@framesep+\eq@framewd}%
1269 \kern\dim@a
1270 \eq@typeset@frame
1271 \eq@typeset@equation
1273 \def\eq@typeset@RM{%
1274 \setlength\dim@a{(\eq@vspan+\ht\EQ@numbox-\dp\EQ@numbox)/2}%
1275 \eq@typeset@rightnumber
1276 \eq@typeset@frame
1277 \eq@typeset@equation
1279 \def\eq@typeset@RB{%
1280 % NOTE: is \eq@dp useful here
1281 \setlength\dim@a{\eq@vspan-\ht\EQ@numbox-\dp\EQ@numbox}%
1282 \eq@typeset@rightnumber
1283 \eq@typeset@frame
1284 \eq@typeset@equation
1286 \def\eq@typeset@RShifted{%
1287 % place number
1288 \eq@typeset@frame
1289 \eq@typeset@equation
1290 \penalty\@M
1291 \dim@a\eqlineskip
1292 \if F\eq@frame\else
1293 \addtolength\dim@a{\eq@framesep+\eq@framewd}%
1295 \parskip\dim@a
1296 \hbox to\hsize{\hfil\copy\EQ@numbox}\@@par%
1298 \def\eq@C@setsides{%
1299 % \dim@c = space for number, if any, and not shifted.
1300 \dim@c\z@
1301 \if\eq@hasNumber\if\eq@shiftnumber\else
1302 \dim@c\eq@wdNum
1303 \fi\fi
1304 % \dim@e = space for condition(on right), if any and formula is only a single line.(to center nicely)
1305 % but only count it as being right-aligned if we're not framing, since the frame must enclose it.
1306 \dim@e\z@
1307 \if F\eq@frame
1308 \ifnum\eq@lines=\@ne\ifdim\eq@wdCond>\z@
1309 \setlength\dim@e{\eq@wdCond+\conditionsep}%
1310 \fi\fi\fi
1311 % \dim@b = minimum needed on left max(totalleftmargin, left number space)
1312 \dim@b\z@
1313 \if L\eqnumside\ifdim\dim@b<\dim@c
1314 \dim@b\dim@c
1315 \fi\fi
1316 \ifdim\dim@b<\@totalleftmargin
1317 \dim@b\z@
1318 \else
1319 \addtolength\dim@b{-\@totalleftmargin}%
1321 % \dim@d = minimum needed on right max(condition, right number space)
1322 \dim@d\dim@e
1323 \if R\eqnumside\ifdim\dim@d<\dim@c
1324 \dim@d\dim@c
1325 \fi\fi
1326 % \dim@a = left margin; initially half available space
1327 % \dim@c = right margin; ditto
1328 \setlength\dim@a{(\eq@linewidth-\eq@wdT+\dim@e+\@totalleftmargin)/2}%
1329 \dim@c=\dim@a
1330 % If too far to the left
1331 \ifdim\dim@a<\dim@b
1332 \addtolength\dim@c{\dim@a-\dim@b}%
1333 \ifdim\dim@c<\z@\dim@c=\z@\fi
1334 \dim@a=\dim@b
1335 % Or if too far to the right
1336 \else\ifdim\dim@c<\dim@d
1337 \addtolength\dim@a{\dim@c-\dim@d}%
1338 \ifdim\dim@a<\z@\dim@a=\z@\fi
1339 \dim@c=\dim@d
1340 \fi\fi
1341 % Now, \dim@d,\dim@e is the left & right glue to center each line for centerlines
1342 \setlength\dim@e{\eq@wdT-\eq@wdMin}\dim@d=\z@
1343 \dim@d\z@
1344 \if\eq@centerlines
1345 \divide\dim@e2\relax
1346 \dim@d=\dim@e
1348 \setlength\leftskip{\dim@a\@plus\dim@d}%
1349 \addtolength\dim@e{\dim@c}%
1350 \setlength\rightskip{\z@\@plus\dim@e}%\@minus5\p@
1351 % Special case: if framing, reduce the stretchiness of the formula (eg. condition)
1352 % Or if we have a right number, FORCE space for it
1353 \dim@b\z@
1354 \if F\eq@frame\else
1355 \dim@b\dim@c
1357 \if\@And{\eq@hasNumber}{\@Not{\eq@shiftnumber}}%
1358 \if R\eqnumside
1359 \dim@c\eq@wdNum
1360 \ifdim\dim@c>\dim@b
1361 \dim@b\dim@c
1365 % If either of those cases requires hard rightskip, move that part from glue.
1366 \ifdim\dim@b>\z@
1367 \addtolength\dim@e{-\dim@c}%
1368 \rightskip\dim@b\@plus\dim@e%\@minus5\p@
1370 % And peculiar further special case: in indented environs, width isn't where it would seem
1371 \ifdim\eq@wdCond>\z@
1372 \addtolength\rightskip{-\@totalleftmargin}%
1374 \parfillskip\z@skip
1376 \def\eq@I@setsides{%
1377 \leftskip\mathindent
1378 \if\eq@shiftnumber
1379 \setlength\dim@a{\eq@linewidth-\eq@wdT-\mathindent}%
1380 \ifdim\dim@a<\z@
1381 \leftskip=\z@ % Or something minimal?
1384 \dim@a=\z@
1385 \setlength\dim@b{\eq@linewidth-\leftskip-\eq@wdMin}%
1386 \if F\eq@frame
1387 \else
1388 \setlength\dim@a{\eq@linewidth-\leftskip-\eq@wdT}
1389 \addtolength\dim@b{-\dim@a}%
1391 % Or force the space for right number, if needed
1392 \if\@And{\eq@hasNumber}{\@Not{\eq@shiftnumber}}%
1393 \if R\eqnumside
1394 \dim@c=\eq@wdNum
1395 \if\dim@c>\dim@a
1396 \addtolength\dim@b{-\dim@c}%
1397 \dim@a=\dim@c
1401 \setlength\rightskip{\dim@a\@plus\dim@b \@minus\hfuzz }%\hfuzz\z@
1402 \parfillskip\z@skip
1404 \def\eq@typeset@leftnumber{%
1405 \setlength\skip@c{\dim@a-\ht\EQ@numbox}%
1406 \vglue\skip@c% NON discardable
1407 \copy\EQ@numbox \penalty\@M
1408 \kern-\dim@a
1410 \def\eq@typeset@rightnumber{%
1411 \setlength\skip@c{\dim@a-\ht\EQ@numbox}%
1412 \vglue\skip@c% NON discardable
1413 \hbox to \hsize{\hfil\copy\EQ@numbox}\penalty\@M
1414 \kern-\dim@a
1416 \def\eq@typeset@equation{%
1417 \nobreak
1418 \eq@params\eq@parshape
1419 \nointerlineskip\noindent
1420 \add@grp@label
1421 \eq@dump@box\unhbox\EQ@box\@@par
1423 \newcommand\eqframe[2]{%
1424 \begingroup
1425 \fboxrule=\eq@framewd\relax\fboxsep=\eq@framesep\relax
1426 \framebox{\z@rule\@height#2\kern#1}%
1427 \endgroup
1429 \def\eq@addframe{%
1430 \hbox to\z@{%
1431 \setlength\dim@a{\eq@framesep+\eq@framewd}%
1432 \kern-\dim@a
1433 \vbox to\z@{\kern-\dim@a
1434 \hbox{\eqframe{\eq@wdT}{\eq@vspan}}%
1435 \vss
1437 \hss
1440 \def\eq@typeset@frame{%
1441 \if F\eq@frame\else
1442 % Tricky: put before \noindent, so it's not affected by glue in \leftskip
1443 \nobreak\nointerlineskip
1444 \vbox to\eq@firstht{\moveright\leftskip\hbox to\z@{\eq@addframe\hss}\vss}%
1445 \kern-\eq@firstht
1448 \@saveprimitive\left\@@left
1449 \@saveprimitive\right\@@right
1450 \newcount\lr@level
1451 \def\eq@left{%
1452 \@ifnext .{\eq@nullleft}{\begingroup \let\delimiter\eq@left@a}%
1454 \def\eq@right{%
1455 \@ifnext .{\eq@nullright}{\begingroup \let\delimiter\eq@right@a}%
1457 \def\eq@left@a#1 #2{\endgroup\@@left\delimiter#1 \after@open}
1458 \def\eq@right@a#1 #2{\endgroup
1459 \@@right\delimiter#1 \after@close \ss@scan{#1}%
1461 \def\eq@nullleft#1{\@@left#1\after@open}
1462 \def\eq@nullright#1{\@@right#1\after@close}
1463 % For paren matching: )
1464 \def\delim@reset{%
1465 \let\after@open\relax \let\after@close\relax
1466 \let\left\@@left \let\right\@@right
1468 \@ifundefined{bBigg@}{% not defined
1469 \let\big@size\p@
1470 \def\big{\bBigg@{8.5}}\def\Big{\bBigg@{11.5}}%
1471 \def\bigg{\bBigg@{14.5}}\def\Bigg{\bBigg@{17.5}}%
1472 \def\biggg{\bBigg@{20.5}}\def\Biggg{\bBigg@{23.5}}%
1474 \def\bBigg@#1#2{%
1475 {\delim@reset
1476 \left#2%
1477 \vrule\@height#1\big@size\@width-\nulldelimiterspace
1478 \right.
1481 \def\bigl#1{\mathopen\big{#1}\after@open}
1482 \def\Bigl#1{\mathopen\Big{#1}\after@open}
1483 \def\biggl#1{\mathopen\bigg{#1}\after@open}
1484 \def\Biggl#1{\mathopen\Bigg{#1}\after@open}
1485 \def\bigggl#1{\mathopen\biggg{#1}\after@open}
1486 \def\Bigggl#1{\mathopen\Biggg{#1}\after@open}
1488 \def\bigr#1{\mathclose\big{#1}\after@close}
1489 \def\Bigr#1{\mathclose\Big{#1}\after@close}
1490 \def\biggr#1{\mathclose\bigg{#1}\after@close}
1491 \def\Biggr#1{\mathclose\Bigg{#1}\after@close}
1492 \def\bigggr#1{\mathclose\biggg{#1}\after@close}
1493 \def\Bigggr#1{\mathclose\Biggg{#1}\after@close}
1495 %% No change needed, I think. [mjd,1998/12/04]
1496 %%\def\bigm{\mathrel\big}
1497 %%\def\Bigm{\mathrel\Big}
1498 %%\def\biggm{\mathrel\bigg}
1499 %%\def\Biggm{\mathrel\Bigg}
1500 %%\def\bigggm{\mathrel\biggg}
1501 %%\def\Bigggm{\mathrel\Biggg}
1502 \let\m@@DeL\m@DeL \let\m@@DeR\m@DeR \let\m@@DeB\m@DeB
1503 \def\d@@DeL#1#2#3{%
1504 \delimiter"4\@xp\delim@a\csname sd@#1#2#3\endcsname #1#2#3 \after@open
1506 \def\d@@DeR#1#2#3{%
1507 \delimiter"5\@xp\delim@a\csname sd@#1#2#3\endcsname #1#2#3 \after@close
1509 \def\d@@DeB#1#2#3{%
1510 \delimiter"0\@xp\delim@a\csname sd@#1#2#3\endcsname #1#2#3 \after@bidir
1512 %%BRM: These weren't defined, but apparently should be.
1513 \let\m@@DeA\m@DeA\let\d@@DeA\m@DeA%
1514 \let\after@bidir\@empty
1515 \mathchardef\zero@bop=888 \relax
1516 \mathchardef\bop@incr=4444 \relax
1517 \def\after@open{%
1518 \global\advance\lr@level\@ne
1519 \prebinoppenalty\bop@incr \multiply\prebinoppenalty\lr@level
1520 \advance\prebinoppenalty\zero@bop
1521 \ifnum\eqbreakdepth<\lr@level
1522 \let\m@Bin\m@@Bin
1523 \else
1524 \eq@binoffset=\eqbinoffset
1525 \advance\eq@binoffset\lr@level\eqdelimoffset plus1fill\relax
1526 \def\dt@fill@cancel{\hskip\z@ minus1fill\relax}%
1528 \penalty\@M % BRM: discourage break after an open fence?
1530 \def\after@close{%
1531 \global\advance\lr@level\m@ne
1532 \prebinoppenalty\bop@incr \multiply\prebinoppenalty\lr@level
1533 \advance\prebinoppenalty\zero@bop
1534 \ifnum\eqbreakdepth<\lr@level
1535 \else \let\m@Bin\d@@Bin
1537 \ifnum\lr@level<\@ne \eq@binoffset=\eqbinoffset\relax \fi
1539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1541 \let\subsup@flag=\count@
1542 \def\ss@delim@a#1#2#3#4{\xdef\right@delim@code{\number"#2#3#4}}
1543 \def\ss@scan#1{%
1544 \begingroup
1545 \let\delim@a\ss@delim@a \@tempcnta#1\relax
1546 \endgroup
1547 \subsup@flag\@M \afterassignment\ss@scan@a \let\@let@token=}
1548 \def\ss@scan@a{%
1549 \ifx\@let@token\sb \advance\subsup@flag\@ne\else
1550 \ifx\@let@token\sp \advance\subsup@flag\tw@\else
1551 \ss@finish
1552 \expandafter\@firstoftwo % gobble \ss@scan@b
1553 \fi\fi
1554 \ss@scan@b\@let@token
1556 \def\ss@scan@b#1#2{#1{%
1557 \let\m@Bin\m@@Bin \let\m@Rel\m@@Rel
1558 #2}\afterassignment\ss@scan@a \let\@let@token=}%
1559 \def\ss@finish{%
1560 \@@vadjust{\penalty\thr@@}%
1561 \penalty\right@delim@code \penalty-\subsup@flag \keep@glue
1563 \def\eq@lrunpack{\setbox\z@\lastbox
1564 \unskip \nointerlineskip
1565 \noindent\unhbox\z@ \unskip
1566 \subsup@flag-\lastpenalty \unpenalty
1567 \xdef\right@delim@code{\number\lastpenalty}%
1568 \unpenalty
1569 \ifnum\subsup@flag>\@M
1570 \advance\subsup@flag-\@M
1571 \setbox\tw@\lastbox
1572 \else \setbox\tw@\box\voidb@x
1574 \setbox\z@\lastbox
1575 \ifvoid\tw@ \unhbox\z@
1576 \else \lrss@reattach % uses \subsup@flag, box\z@, box\tw@
1578 \penalty-\@Mi\z@rule\@@par
1579 \setbox\z@\lastbox \unskip\unpenalty
1580 %%{\showboxbreadth\maxdimen\showboxdepth99\showlists}%
1582 \dimendef\sub@depth=8 \dimendef\sup@base=6
1583 \dimendef\prelim@sub@depth=4 \dimendef\prelim@sup@base=2
1584 \def\sym@xheight{\fontdimen5\textfont\tw@}
1585 \def\sup@base@one{\fontdimen13\textfont\tw@}
1586 \def\sub@base@one{\fontdimen16\textfont\tw@}
1587 \def\sub@base@two{\fontdimen17\textfont\tw@}
1588 \def\sup@drop{\fontdimen18\scriptfont\tw@}
1589 \def\sub@drop{\fontdimen19\scriptfont\tw@}
1590 \providecommand{\mathaxis}{\fontdimen22\textfont\tw@}
1591 \def\lrss@reattach{%
1592 \begingroup
1593 % "The TeXbook" Appendix G step 18:
1594 \setlength\prelim@sup@base{\ht\z@-\sup@drop}%
1595 \setlength\prelim@sub@depth{\dp\z@ +\sub@drop}%
1596 \unhbox\z@
1597 \ifcase\subsup@flag % case 0: this can't happen
1598 \or \lr@subscript % case 1: subscript only
1599 \or \lr@superscript % case 2: superscript only
1600 \else \lr@subsup % case 3: sub and superscript both
1602 \endgroup
1604 \def\lr@subscript{%
1605 \sub@depth\sub@base@one
1606 \ifdim\prelim@sub@depth>\sub@depth \sub@depth\prelim@sub@depth\fi
1607 \setlength\dim@a{\ht\tw@ -.8\sym@xheight}%
1608 \ifdim\dim@a>\sub@depth \sub@depth=\dim@a \fi
1609 \twang@adjust\sub@depth
1610 \lower\sub@depth\box\tw@
1612 \def\lr@superscript{%
1613 \sup@base\sup@base@one
1614 \ifdim\prelim@sup@base>\sup@base \sup@base\prelim@sup@base\fi
1615 \setlength\dim@a{\dp\tw@ -.25\sym@xheight}%
1616 \ifdim\dim@a>\sup@base \sup@base\dim@a \fi
1617 \twang@adjust\sup@base
1618 \raise\sup@base\box\tw@
1620 \def\lr@subsup{%
1621 \sub@depth\sub@base@two
1622 \ifdim\prelim@sub@depth>\sub@depth \sub@depth\prelim@sub@depth \fi
1623 \twang@adjust\sub@depth
1624 \lower\sub@depth\box\tw@
1626 \def\twang@adjust#1{%
1627 \begingroup
1628 \@ifundefined{twang@\right@delim@code}{}{%
1629 \setlength\dim@d{#1-\mathaxis}%
1630 % put an upper limit on the adjustment
1631 \ifdim\dim@d>1em \dim@d 1em \fi
1632 \kern\csname twang@\right@delim@code\endcsname\dim@d
1634 \endgroup
1636 \newcommand{\DeclareTwang}[2]{%
1637 \ifcat.\@nx#1\begingroup
1638 \lccode`\~=`#1\lowercase{\endgroup \DeclareTwang{~}}{#2}%
1639 \else
1640 \@xp\decl@twang#1?\@nil{#2}%
1643 \def\decl@twang#1#2#3#4#5#6#7\@nil#8{%
1644 \@namedef{twang@\number"#4#5#6}{#8}%
1646 \DeclareTwang{\rangle}{-.4}
1647 \DeclareTwang{)}{-.33}
1648 \DeclareTwang{\rbrace}{-.25}
1649 \newenvironment{dseries}{\let\eq@hasNumber\@True \@optarg\@dseries{}}{}%
1650 \def\enddseries#1{\check@punct@or@qed}%
1651 \newenvironment{dseries*}{\let\eq@hasNumber\@False \@optarg\@dseries{}}{}%
1652 \@namedef{enddseries*}#1{\check@punct@or@qed}%
1653 \@namedef{end@dseries*}{\end@dseries}%
1654 \def\@dseries[#1]{%
1655 \let\display@setup\dseries@display@setup
1656 % Question: should this be the default for dseries???
1657 \global\eq@wdCond\z@
1658 \@dmath[layout={M},#1]%
1659 \mathsurround\z@\@@math \penalty\@Mi
1660 \let\endmath\ends@math
1661 \def\premath{%
1662 \ifdim\lastskip<.3em \unskip
1663 \else\ifnum\lastpenalty<\@M \dquad\fi\fi
1665 \def\postmath{\unpenalty\eq@addpunct \penalty\intermath@penalty \dquad \@ignoretrue}%
1666 \ignorespaces
1668 \def\end@dseries{%
1669 \unskip\unpenalty
1670 \@@endmath \mathsurround\z@ \end@dmath
1672 \def\eq@try@layout@M{%
1673 \edef\@parshape{\parshape 1 0pt \the\eq@linewidth\relax}%
1674 \eq@trial@b{M}{}%
1676 \def\intermath@penalty{-221}%
1677 \newcommand\dquad{\hskip0.6em minus.3em}
1678 \newcommand\premath{}\newcommand\postmath{}
1679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1680 \renewenvironment{math}{%
1681 \leavevmode \premath
1682 \ifmmode\@badmath\else\@@math\fi
1684 \ifmmode\@@endmath\else\@badmath\fi
1686 \def\ends@math#1{\check@punct@or@qed}
1687 \def\end@math{%
1688 \ifmmode\@@endmath\else\@badmath\fi
1689 \postmath
1691 \let\eq@group\@False
1692 \let\grp@shiftnumber\@False
1693 \let\grp@hasNumber\@False
1694 \let\grp@eqs@numbered\@False
1695 \let\grp@aligned\@True
1696 \newenvironment{dgroup}{%
1697 \let\grp@hasNumber\@True\@optarg\@dgroup{}%
1699 \end@dgroup
1701 \newtoks\GRP@queue
1702 \newenvironment{dgroup*}{%
1703 \let\grp@hasNumber\@False\@optarg\@dgroup{}%
1705 \end@dgroup
1707 \def\@dgroup[#1]{%
1708 \let\eq@group\@True \global\let\eq@GRP@first@dmath\@True
1709 \global\GRP@queue\@emptytoks \global\setbox\GRP@box\box\voidb@x
1710 \global\let\GRP@label\@empty
1711 \global\grp@wdL\z@\global\grp@wdR\z@\global\grp@wdT\z@
1712 \global\grp@linewidth\z@\global\grp@wdNum\z@
1713 \global\let\grp@eqs@numbered\@False
1714 \global\let\grp@aligned\@True
1715 \global\let\grp@shiftnumber\@False
1716 \eq@prelim
1717 \setkeys{breqn}{#1}%
1718 \if\grp@hasNumber \grp@setnumber \fi
1720 \def\end@dgroup{%
1721 \EQ@displayinfo \grp@finish
1722 \if\grp@hasNumber\grp@resetnumber\fi
1724 \@ifundefined{c@parentequation}{\newcounter{parentequation}}{}
1725 \global\let\GRP@label\@empty
1726 \def\add@grp@label{%
1727 \ifx\@empty\GRP@label
1728 \else \GRP@label \global\let\GRP@label\@empty
1731 \def\grp@setnumber{%
1732 \global\let\GRP@label\next@label \global\let\next@label\@empty
1733 % Trick \eq@setnumber to doing our work for us.
1734 \let\eq@hasNumber\@True
1735 \eq@setnumber
1736 \global\sbox\GRP@numbox{\unhbox\EQ@numbox}%
1737 \grp@wdNum\eq@wdNum
1738 \let\eq@hasNumber\@False
1739 \let\eq@number\@empty
1740 \eq@wdNum\z@
1741 \protected@edef\theparentequation{\theequation}%
1742 \setcounter{parentequation}{\value{equation}}%
1743 \setcounter{equation}{0}%
1744 \def\theequation{\theparentequation\alph{equation}}%
1746 \def\grp@resetnumber{%
1747 \setcounter{equation}{\value{parentequation}}%
1749 \newbox\GRP@box
1750 \newbox\GRP@wholebox
1751 \def\grp@push{%
1752 \global\GRP@queue\@xp\@xp\@xp{\@xp\the\@xp\GRP@queue
1753 \@xp\@elt\@xp{\EQ@trial}%
1755 \global\setbox\GRP@box\vbox{%
1756 \hbox{\box\EQ@box\box\EQ@copy\penalty\@ne\copy\EQ@numbox}%
1757 \unvbox\GRP@box
1759 \EQ@trial
1760 \if\eq@isIntertext\else
1761 \ifdim\eq@wdL>\grp@wdL \global\grp@wdL\eq@wdL \fi
1762 \ifdim\eq@wdT>\grp@wdT \global\grp@wdT\eq@wdT \fi
1763 \setlength\dim@a{\eq@wdT-\eq@wdL}%
1764 \ifdim\dim@a>\grp@wdR \global\grp@wdR\dim@a \fi
1765 \ifdim\eq@linewidth>\grp@linewidth \global\grp@linewidth\eq@linewidth\fi
1766 \if\eq@hasNumber
1767 \global\let\grp@eqs@numbered\@True
1768 \ifdim\eq@wdNum>\grp@wdNum\global\grp@wdNum\eq@wdNum\fi
1770 \if\EQ@hasLHS\else\global\let\grp@aligned\@False\fi
1771 \if D\eq@layout \global\let\grp@aligned\@False\fi % Layout D (usually) puts rel on 2nd line.
1772 \if\eq@shiftnumber\global\let\grp@shiftnumber\@True\fi % One eq shifted forces all.
1775 \def\grp@finish{%
1776 \setlength\dim@a{\grp@wdL+\grp@wdR-4em}% Allowance for shrink?
1777 \if\grp@aligned
1778 \ifdim\dim@a>\grp@linewidth
1779 \global\let\grp@aligned\@False
1782 \addtolength\dim@a{\grp@wdNum }% Effective length
1783 \if\grp@shiftnumber
1784 \else
1785 \if\@And{\grp@hasNumber}{\@Not\grp@eqs@numbered}
1786 \ifdim\dim@a>\grp@linewidth
1787 \global\let\grp@shiftnumber\@True
1791 \if\grp@aligned
1792 \global\grp@wdT\grp@wdL
1793 \global\advance\grp@wdT\grp@wdR
1795 \setbox\GRP@wholebox\vbox{%
1796 \let\@elt\eqgrp@elt
1797 \the\GRP@queue
1799 \global\let\eq@GRP@first@dmath\@True
1800 \begingroup
1801 \dmath@first@leftskip
1802 \eq@topspace{\vskip\parskip}%
1803 \endgroup
1804 \if\@And{\grp@hasNumber}{\@Not{\grp@eqs@numbered}}%
1805 \if\grp@shiftnumber
1806 \copy\GRP@numbox \penalty\@M
1807 \kern\eqlineskip
1808 \else
1809 \setlength\dim@a{%
1810 (\ht\GRP@wholebox+\dp\GRP@wholebox+\ht\GRP@numbox-\dp\GRP@numbox)/2}%
1811 \setlength\skip@c{\dim@a-\ht\GRP@numbox}%
1812 \vglue\skip@c% NON discardable
1813 \copy\GRP@numbox \penalty\@M
1814 \kern-\dim@a
1815 \kern-\abovedisplayskip % To cancel the topspace above the first eqn.
1818 \unvbox\GRP@wholebox
1819 \let\@elt\relax
1820 \eq@botspace % not needed unless bottom number?
1822 \def\eqgrp@elt#1{%
1823 \global\setbox\GRP@box\vbox{%
1824 \unvbox\GRP@box
1825 \setbox\z@\lastbox
1826 \setbox\tw@\hbox{\unhbox\z@
1827 \ifnum\lastpenalty=\@ne
1828 \else
1829 \global\setbox\EQ@numbox\lastbox
1831 \unpenalty
1832 \global\setbox\EQ@copy\lastbox
1833 \global\setbox\EQ@box\lastbox
1836 \begingroup \let\eq@botspace\relax
1838 \if\eq@isIntertext
1839 \vskip\belowdisplayskip
1840 \unvbox\EQ@copy
1841 \else
1842 \grp@override
1843 \eq@finish
1845 \endgroup
1847 \def\grp@override{%
1848 \def\eqindent{I}%
1849 \setlength\dim@a{(\grp@linewidth-\grp@wdT)/2}%
1850 \ifdim\dim@a<\z@\dim@a=\z@\fi
1851 \dim@b\if L\eqnumside\grp@wdNum\else\z@\fi
1852 \if\grp@shiftnumber\else
1853 \ifdim\dim@b>\dim@a\dim@a\dim@b\fi
1855 \if\grp@aligned
1856 \addtolength\dim@a{\grp@wdL-\eq@wdL}%
1858 \mathindent\dim@a
1859 \ifdim\dim@b>\dim@a
1860 \let\eq@shiftnumber\@True
1863 \newskip\darraycolsep \darraycolsep 20pt plus1fil minus12pt
1864 \newcount\cur@row \newcount\cur@col
1865 \def\@tempa#1#2#3{%
1866 \cur@col#1 \hfil
1867 \setbox\z@\hbox{$\displaystyle####\m@th$}\@nx\col@box
1868 \tabskip\z@skip
1869 &\cur@col#2 \hfil
1870 \setbox\z@\hbox{$\displaystyle\mathord{}####\mathord{}\m@th$}\@nx\col@box
1871 \hfil
1872 &\cur@col#3 \setbox\z@\hbox{$\displaystyle####\m@th$}\@nx\col@box
1873 \hfil\tabskip\darraycolsep
1875 \xdef\darray@preamble{%
1876 \@tempa 123&\@tempa 456&\@tempa 789%
1877 &\@tempa{10}{11}{12}&\@tempa{13}{14}{15}&\@tempa{16}{17}{18}%
1880 \@ifundefined{Mathstrut@}{\let\Mathstrut@\strut}{}
1881 \def\darray@cr{\Mathstrut@\cr}
1882 \def\col@box{%
1883 \unhbox\z@
1885 \newenvironment{darray}{\@optarg\@darray{}}{}
1886 \def\@darray[#1]{%
1887 \if\eq@group\else\eq@prelim\fi
1888 \global\let\@preamble\@empty
1889 \setkeys{breqn}{#1}%
1890 \the\eqstyle \eq@setnumber
1891 \ifx\@preamble\@empty \global\let\@preamble\darray@preamble \fi
1892 \check@mathfonts
1893 % \let\check@mathfonts\relax % tempting, but too risky
1894 \@xp\let\csname\string\ \endcsname\darray@cr
1895 \setbox\z@\vbox\bgroup
1896 \everycr{\noalign{\global\advance\cur@row\@ne}}%
1897 \tabskip\z@skip \cur@col\z@
1898 \global\cur@row\z@
1899 \penalty\@ne % flag for \dar@repack
1900 \halign\@xp\bgroup\@preamble
1902 \def\enddarray#1{\check@punct@or@qed}
1903 \def\end@darray{%
1904 \ifvmode\else \eq@addpunct \Mathstrut@\fi\crcr \egroup
1905 \dar@capture
1906 \egroup
1908 \def\dar@capture{%
1909 %% \showboxbreadth\maxdimen\showboxdepth99\showlists
1910 \eq@wdL\z@ \eq@wdRmax\z@
1911 \dar@repack
1913 \def\dar@repack{%
1914 \unpenalty
1915 \setbox\tw@\lastbox
1916 \global\setbox\EQ@box\hbox{%
1917 \hbox{\unhcopy\tw@\unskip}\penalty-\@M \unhbox\EQ@box}%
1918 \global\setbox\EQ@copy\hbox{%
1919 \hbox{\unhbox\tw@\unskip}\penalty-\@M \unhbox\EQ@copy}%
1920 \unskip
1921 \ifcase\lastpenalty \else\@xp\@gobble\fi
1922 \dar@repack
1924 \newskip\conditionsep \conditionsep=10pt minus5pt%
1925 \newcommand{\conditionpunct}{,}
1926 \let\cond@gobble\@firstofone
1927 \newcommand\condition{%
1928 \begingroup\@tempswatrue
1929 \@ifstar{\@tempswafalse \condition@a}\condition@a
1931 \newcommand\condition@a[2][\conditionpunct]{%
1932 \unpenalty\unskip\unpenalty\unskip % BRM Added
1933 \hbox{#1}%
1934 \penalty -201\relax\hbox{}% Penalty to allow breaks here.
1935 \hskip\conditionsep
1936 \if@tempswa \@xp\hbox \else \@xp\condition@b\fi
1937 {#2}%
1938 \endgroup
1939 \setbox\z@\if@tempswa\hbox{#2}\else\hbox{\textmath@setup #2}\fi
1940 \global\eq@wdCond\wd\z@
1941 \let\cond@gobble\@gobble
1943 \newcommand\condition@b[1]{%
1944 \cond@gobble{\hskip\conditionsep}%
1945 \textmath@setup #1%
1947 \newenvironment{XXXXdsuspend}{%
1948 \global\setbox\EQ@box\vbox\bgroup \@parboxrestore
1949 \parshape 1 \displayindent \displaywidth\relax
1950 \hsize=\columnwidth \noindent\ignorespaces
1952 \par\egroup
1953 \global\setbox\GRP@box\vbox{%
1954 \vbox{\copy\EQ@box\vtop{\unvbox\EQ@box}}%
1955 \unvbox\GRP@box
1957 \global\GRP@queue\@xp{\the\GRP@queue
1958 \@elt{\gdef\EQ@trial{}}%
1961 \newenvironment{dsuspend}{%
1962 \global\setbox\EQ@box\vbox\bgroup \@parboxrestore
1963 \parshape 1 \displayindent \displaywidth\relax
1964 \hsize=\columnwidth \noindent\ignorespaces
1966 \par\egroup
1967 \global\setbox\GRP@box\vbox{%
1968 \hbox{\copy\EQ@box\vtop{\unvbox\EQ@box}}%
1969 \unvbox\GRP@box
1971 \global\GRP@queue\@xp{\the\GRP@queue
1972 \@elt{\let\eq@isIntertext\@True}%
1975 \newcommand\breqn@intertext[1]{\dsuspend#1\enddsuspend}
1976 \renewcommand{\*}{%
1977 \if@display
1978 \setbox\z@\hbox{\mathsurround\z@$\mkern\eq@binoffset$}%
1979 \discretionary{}{%
1980 \kern\the\wd\z@ \textchar\discretionarytimes
1981 }{}%
1982 \thinspace
1983 \else
1984 \discretionary{\thinspace\textchar\discretionarytimes}{}{}%
1987 \newcommand{\discretionarytimes}{\times}
1988 \def\nref#1{\@xp\@nref\csname r@#1\endcsname}
1989 \def\@nref#1#2{\ifx\relax#1??\else \@xp\@firstoftwo#1\fi}
1990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1991 \endinput
1993 %% End of file `breqn.sty'.