[texhax] strange behavior of amsmath

jfbu jfbu at free.fr
Thu Dec 12 19:56:33 CET 2013


Le 12 déc. 2013 à 19:05, 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
>> 
>> -- 
> 

forgot to post to the list

> With this in the preamble
> 
> \makeatletter
> \@tfor\x:=\normalsize\small\footnotesize\do
> {\expandafter\g at addto@macro\x{\belowdisplayskip\belowdisplayshortskip}}
> \let\@normalsize\normalsize
> \makeatother

> 
> the standard classes should, as far as I can evaluate,
> consistently have \belowdisplayskip=\belowdisplayshortskip
> which should give more consistent vertical behavior.

> 
> at least it solves it for your test file (with or without fleqn)
> and also with the same code without amsmath but with or 
> without fleqn as article class option

but as this creates an asymmetry and
the standard classes always have \belowdisplayskip=\abovedisplayskip
one then feels compelled to do  something like

\makeatletter
\@tfor\x:=\normalsize\small\footnotesize\do
{\expandafter\g at addto@macro\x
    {\belowdisplayskip\belowdisplayshortskip
     \abovedisplayskip\belowdisplayskip}}
\let\@normalsize\normalsize
\makeatother

The values of \belowdisplayshortskip are

<10pt>: \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
<11pt>: \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
<12pt>: \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@

The above patches however will reduce the initial vertical
spacing when \abovedisplayskip is used

On this matter, there is something I don't quite understand
with LaTeX \[ = \begin{displaymath} 

Try

\documentclass{article}
\begin{document}
\begin{displaymath}
\vartheta=2\pi\smash{\rule{.4pt}{4ex}}  
\end{displaymath}
\begin{displaymath}
\vartheta=2\pi\smash{\rule{.4pt}{4ex}}  
\end{displaymath}
\begin{displaymath}
\vartheta=2\pi\smash{\rule{.4pt}{4ex}}  
\end{displaymath}

$$\vartheta=2\pi\smash{\rule{.4pt}{4ex}}$$
\begin{displaymath}
\vartheta=2\pi\smash{\rule{.4pt}{4ex}}  
\end{displaymath}
\begin{displaymath}
\vartheta=2\pi\smash{\rule{.4pt}{4ex}}  
\end{displaymath}

\begin{displaymath}
\vartheta=2\pi\smash{\rule{.4pt}{4ex}}  
\end{displaymath}
\begin{displaymath}
\vartheta=2\pi\smash{\rule{.4pt}{4ex}}  
\end{displaymath}
\begin{displaymath}
\vartheta=2\pi\smash{\rule{.4pt}{4ex}}  
\end{displaymath}

\end{document}

and one discovers that LaTeX \[ breaks the
rule explained in TeX by Topic
 ... The \predisplaysize is taken to be -\maxdimen if there
was no previous line, that is, the display started the paragraph, or it followed another
display;...

which commands to always use the short skips in such a case

The code demonstrates that LaTeX uses the long skips in such
a case and this brings inconsistencies in vertical spacings


Regards,
Jean-Francois


More information about the texhax mailing list