[Tex/LaTex] When can I safely add an empty line

line-breakingparagraphssourcecode

I really like spacing my LaTeX to stay organized, but I'm always scared that adding a space will affect the output when all I really wanted to do was separate the "code" a bit.

So most of the time I insert a "%" in the empty lines just to be safe, or I experiment. For example, I know (by playing with it) that the empty lines in the following are not doing any harm:

\documentclass{article}
\begin{document}

\title{My title}
\author{My author}
\date{\today}
\maketitle

\begin{abstract}
This is my abstract!
\end{abstract}

\section{Introduction}
Bla bla bla.
\end{document}

But I'm wondering, is there a steadfast rule that I can use to know right away if an empty line will affect output?

Best Answer

Basically, given that an empty line produces a \par token, the one rule I know is this: Empty lines are harmless when you know they (or the implied \par) will only be encountered in vertical mode. TeX starts in vertical mode, and it is in vertical mode between paragraphs, as well as at the top of many environments such as all the list environments, minipage, and floats. Also immediately after these environments (but not after a displayed equation, usually).

Related Question