3

The following MCE points out an extra vertical space before display equations in case of fleqn option given at \documentclass level.

Do you know what's going on?

% Workflow if this file is named `test.tex`:
% pdflatex test
% pdflatex without-fleqn
% pdflatex with-fleqn
% 
\begin{filecontents*}{without-fleqn.tex}
\documentclass{article}
\input{maths}
\end{filecontents*}

\begin{filecontents*}{with-fleqn.tex}
\documentclass[fleqn]{article}
\input{maths}
\end{filecontents*}

\documentclass{article}
\usepackage{filecontents}
%
\begin{filecontents*}{maths.tex}
\usepackage[papersize={15cm,3cm}]{geometry}
\usepackage[step=1cm]{pagegrid}
\usepackage{amsmath}
\begin{document}
Foo :
\[
y=Ce^{-\int a(x)dx}\int b(x)e^{\int a(x)dx}dx
\]
\end{document}
\end{filecontents*}
%
\begin{document}
\end{document}

enter image description here

11
  • 2
    i think this question/answer is relevant: tex.stackexchange.com/a/235111/579 . unfortunately, the actual reason is not obvious. Commented Mar 28, 2018 at 18:28
  • @barbarabeeton isn't a design choice (even without amsmath)?
    – touhami
    Commented Mar 28, 2018 at 19:09
  • 1
    @barbarabeeton Indeed, in the sense that using gather environment instead of \[...\] (or equationenvironment) does the trick, but still strange. I guess this is a bug (maybe the same as in this question/answer). Should it be reported? Commented Mar 28, 2018 at 19:17
  • 1
    @DenisBitouzé -- when i first read your question, i thought the extra space might be there to accommodate a (nonexistent in this case) equation number, but looking further, i found the existing report with a link to the question i already cited. i've added this report to that record. but, as before, i can't say when it might get addressed. sigh. Commented Mar 28, 2018 at 19:42
  • @DenisBitouzé did you try without amsmath?
    – touhami
    Commented Mar 28, 2018 at 20:17

1 Answer 1

3

enter image description here

enter image description here

fleqn doesn't (and can't really) use the \abovedisplayshortskip length, if you set this to \abovedisplayskip you get the same space in both cases.

\documentclass
%[fleqn]
{article}
\usepackage[papersize={15cm,3cm}]{geometry}
\usepackage[step=1cm]{pagegrid}
\usepackage{amsmath}

\begin{document}
\abovedisplayshortskip=\abovedisplayskip
Foo :
\[
y=Ce^{-\int a(x)dx}\int b(x)e^{\int a(x)dx}dx
\]
\end{document}
2
  • Nice! But why fleqn can't really use the \abovedisplayshortskip length? Commented Mar 28, 2018 at 20:10
  • 2
    @DenisBitouzé as your image shows, the short version is used when the equation is small and the last line of the paragraph is short so you can use a smaller vertical space as the last line above "fits" in the space to the left of the equation. fleqn equations never have that space. Commented Mar 28, 2018 at 20:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .