[texhax] strange behavior of amsmath

jfbu jfbu at free.fr
Thu Dec 12 10:11:31 CET 2013


Le 12 déc. 2013 à 09:04, jfbu <jfbu at free.fr> a écrit :

> 
> Le 12 déc. 2013 à 00:43, Reinhard Kotucha <reinhard.kotucha at web.de> a écrit :
> 
>> Hi,
>> I would expect that the fleqn option of amsmath has only an impact on
>> horizontal glue.
>> 
>> Curiously, if the fleqn option is active, there is extra vertical glue
>> below the first formula of each paragraph and below the first formula
>> following ordinary text.
>> 
>> Here is a minimal example:
>> 
>> <testfleqn.tex.gz>
>> You get correct vertical spacing if you comment out the line
>> containing "[fleqn]".  The relevant part of the amsmath source code
>> looks quite innocent.  I can reproduce the problem with TeX Live 2003
>> too, the oldest TL release I've currently installed.
>> 
>> The vertical bar in the test file is an argument of \smash, hence
>> both, its height and depth is zero.  Its sole purpose is to make the
>> extra glue more visible.
>> 
>> Please also note that "some text" in the test file doesn't start a new
>> paragraph.
>> 
>> Where does the extra vertical space come from?  I doubt that it's
>> deliberate. 
>> 
>> Regards,
>> Reinhard
>> 
>> -- 
> 
> Examining the log with showoutput reveals that with [fleqn] the first
> formulas use of each block uses \abovedisplayskip and \belowdisplayskip
> and the others \abovedisplayshortskip and \belowdisplayshortskip,
> 
> whereas without [fleqn] all use \abovedisplayshortskip and \belowdisplayshortskip
> 
> at least this is the probable location of the extra vertical glue, then
> I have not looked at the amsmath code yet to find the spot where this
> is is decided,
> 
> Regards
> Jean-Francois
> 
> 
> 

After checking in TeX by Topic the explanations about TeX's native
processing, I tried the code below with Plain. It confirms that already
TeX treats very differently displays with right or left equation
numbers. The rule to use the short
skips is applied in particular
when there is \eqno or no equation number and
the display follows a previous display; but when \leqno is used
always the long skips are inserted, I presume out of consistency 
for the case
that the previous thing was not a display but a paragraph line; in
that case \leqno forces the use of the long skips, for perhaps
understandable reasons (which I don't understand because an
equation number does not occupy extreme vertical space, so I don't
see why it should be shifted down viz previous text), and perhaps
the rationale then is to be consistent.

[in fact I think vertical spacings in TeX are often too much
and LaTeX pushed this to the extreme with its treatment 
of enumerate, itemize, etc.. lists, including verbatim et al
using trivlist]

So with the [fleqno]{amsmath} situation, it appears that it acts
as Plain for the first equation but then use the short form for the
next equations, creating these in-consistencies.

The question now is: should [fleqno]{amsmath} do as Plain? 

Or rather it is the original TeX thing of pairing the skip above
to the skip below which is disputable? Why should the decision
for using a long or short vertical skip above influence the decision
for the skip below?

Regards
Jean-Francois

\tracingoutput1
\showboxdepth\maxdimen
\showboxbreadth\maxdimen

LEQNO

\hrule

$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\leqno{(1)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\leqno{(2)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\leqno{(3)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\leqno{(4)}$$

REQNO

\hrule

$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\eqno{(1)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\eqno{(2)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\eqno{(3)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\eqno{(4)}$$

NO EQNO

\hrule

$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }$$

MIXED

\hrule

$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\eqno{(1)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\leqno{(2)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\eqno{(3)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\eqno{(4)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\leqno{(5)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\leqno{(6)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\eqno{(7)}$$
$$\vartheta=2\pi\smash{\vrule height 4ex depth 0pt width .4pt }\eqno{(8)}$$



\bye


More information about the texhax mailing list