0

So this has always bothered me, and I'd like to find out how to fix it once and for all. How can I prevent additional lines before and after equations, align environments, etc., from adding additional vertical space in the resulting PDF? For example, the following looks fine and dandy when compiled,

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}


In lectures, the following formula was derived using residues:
\begin{align*} 
    \sum_{i=1}^n \frac{1}{n^2} = \frac{\pi^2}{6}
\end{align*}
Euler found this in 1735, 90 years before Cauchy introduced residues. 

\end{document}

yielding: desired result whereas a small change to the code,

In lectures, the following formula was derived using residues:

\begin{align*} 
    \sum_{i=1}^n \frac{1}{n^2} = \frac{\pi^2}{6}
\end{align*}

Euler found this in 1735, 90 years before Cauchy introduced residues.

yields this hot garbage: garbage

This also happens when I use the \[\] delimiters in the particular environment I use, but not in this clean slate. Anywho, any help appreciated. Cheers.

Edit: I like to space my .tex file like this for organization.

  • Welcome to TeX.SX! So what do you want? The first spacing, also if you put paragragraph breaks in between? – TeXnician Nov 24 '17 at 5:26
  • 3
    You can add % sign ti the beginning if the lines. That way there are no empty lines for TeX, but the code is more readable – Michael Fraiman Nov 24 '17 at 5:37
  • @TeXnician I would like to have the first spacing, even if I have paragraph breaks in between. – Möbius Dickus Nov 24 '17 at 5:40
  • @MichaelFraiman I would prefer a solution that wouldn't require additional code every time I require an equation --- preferably, a more global solution. – Möbius Dickus Nov 24 '17 at 5:41
  • 4
    You may blithely claim that adding two paragraph breaks -- remember: a fully-blank line creates a paragraph break -- is "a small change", but this belief is both unwarranted and misguided. Paragraphs are absolutely fundamental to the way TeX builds up the elements of a page and assembles them into a page. In your first example, TeX finds a single paragraph; in the second example, in constrast, TeX finds three paragraphs, the middle paragraph consisting of a displayed equation that's not tethered to the material that precedes it. Do please read up on the importance of paragraphs. – Mico Nov 24 '17 at 5:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.