1

I used to write equations in the following way:

Text 
%Empty line
\[
 code  
\]  
%Empty line
 Text

I have noticed that with this syntax there is more space above the maths than beneath them. Is that a bad practice or contrary to the "rules" of TeX?

ado sar
  • 203
  • 1
    Bad practice. After 20 years of latex editing I can usually spot then in the output. Not that one liner construction like this has a build it space saving feature if the eqn and the text before is short. That does not kick in if there is a blank line above. – daleif Apr 02 '22 at 16:47
  • 1
    It is always wrong to have a blank line (but of course it is OK to have a comment as you show that has no effect at all) – David Carlisle Apr 02 '22 at 16:47
  • 1
    Additionally, since a blank line starts a new paragraph, it is also semantically wrong as one never starts a paragraph with displayed math – daleif Apr 02 '22 at 16:48
  • 1
    if you mean that your document really has a blank line and not a comment I suggest you edit the example shown. The blank line above is wrong a blank line below is right or wrong depending whether you intend a new paragraph to start after the equation. – David Carlisle Apr 02 '22 at 16:50
  • How can we retain readability though? I mean imagine that we write equation, align environments one after the other. Personally, the whitespace makes the code more clear to me. Is there any workaround? – ado sar Nov 11 '22 at 16:01

1 Answers1

3

It is definitely bad practice and you've already noticed that, didn't you?

Consider the following example:

\documentclass{article}
\usepackage{amsmath}

\usepackage{lipsum} % for mock text

\begin{document}

\lipsum*[1][1-6] [ a+b=c ] \lipsum[2][1-6]

\lipsum*[1][1-6]

[ a+b=c ]

\lipsum[2][1-6]

\end{document}

enter image description here

In the first case, TeX uses \abovedisplayskip and \belowdisplayskip above and below the equation and you get a symmetric spacing.

In the second case, there is an empty line above the equation, followed by \abovedisplayshortskip and the equation is followed by \belowdisplayshortskip, making the spacing very asymmetric.

The empty line after the equation is not bad practice per se, but you only use it when the text after the equation starts a new paragraph. Which can happen or not, depending on the full text.

egreg
  • 1,121,712