After and before a math environment like $$1+1$$ a space is created to separate text from math. But if the math environment has no text after it, an unnecesary space is created like in:

lorem ipsum dolor
\section{new section}

The unnecesary space is in between $$1+1$$ and \section.

This can be due to I am using parskip to automatically go to another paragraph by pressing enter. I am wondering if this last space could be removed manually or automatically.

  • 4
    (1) Why do you think that is bad space? (2) $$...$$ should not be used in LaTeX as it does not follow the LaTeX settings. (3) Always provide a full but minimal exmaple others can copy and test as is. When we know exactly what you are doing. Here we have no idea about your setup.
    – daleif
    Oct 3 at 11:48
  • 1
    parskip is not what you think. You always get a new paragraph by leaving a blank line in the TeX file. The difference is that with parskip you get vertical space in the output instead of indentation, which is a stylistic decision. Look in the books you have and count how many of them use this style: few, if any.
    – egreg
    Oct 3 at 12:20
  • For example TeXbook naruby petr.olsak.net/ftp/olsak/tbn/tbn.pdf uses this stylistic decision.
    – wipet
    Oct 3 at 19:57
  • maybe try \vspace{-3pt} (or some other number of points) between $$1$$ and \section without any blank lines.
    – Nate
    Oct 5 at 9:32

1 Answer 1


I do not follow your claim that

The[re is] unnecesary space ... between $$1+1$$ and \section.

First off, let's posit that you should never use $$ in a LaTeX document to initiate and terminate single-line display math mode. Instead, do use \[ and \]. For more information on this subject, please see the posting Why is \[ ... \] preferable to $$ ... $$?

Second, please compare the amounts of vertical whitespace in the following two-column example:

enter image description here

The only difference is the use of \[ ... \] on the left and of $ ... $, i.e., of inline math mode within text mode, on the right. Observe that the vertical distance between the math expressions and the subsequent section headers is the same. This vertical distance is controlled by the specification of the \section command, not by whether the final preceding material is typeset in text mode or display-math mode.

Addendum: If one were to modify the preceding example by loading the parskip package, there would be more whitespace at the first paragraph break, i.e., between ldkjfal;sdfkj and $1+1=2$. However, the vertical space between the math-y expressions and the subsequent sectioning header lines would be the same as in the example shown above. Conclusion: LaTeX does not insert "unnecessary" space between a displayed equation and a subsequent \section directive.


% left-hand column:


\section{A new section}

\newpage % force a column break

% right-hand column:



\section{Another new section}

  • 1
    +1 due to nice explanation and added comment.
    – Zarko
    Oct 3 at 13:14
  • @cfr - So done . :-)
    – Mico
    Oct 3 at 20:14
  • 2
    @Mico Thanks. (Can't upvote again!)
    – cfr
    Oct 3 at 21:08

You must log in to answer this question.

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