Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Ideally, I would like to be able to skip lines before and after \section, before and after many environments (theorem, itemize, enumerate, etc.), between \items in a list, before and after display-style math, and in several other places. It helps me keep my source code organized.

Unfortunately for me, Donald Knuth decided that a skipped line should have semantic meaning in the source code. I am sure he had good reasons for this, but I personally would be much happier if starting a new paragraph required a \par command.

I am aware that the conventional solution for code organization is to put a % symbol at the beginning of lines skipped for non-semantic reasons; however, I find that these extra % symbols clutter my code and are less useful than purely skipped lines.

The question:

What places, if any, in a conventional LaTeX document can one or more lines be skipped without affecting the output? I recognize that no place can be completely safe if redefinitions are allowed, so assume that one of the standard or AMS document classes is in use, that no additional packages have been loaded, and that the only definitions in the preamble are defining theorem types.

One additional constraint, to distinguish this question from When can I safely add an empty line?: Assume I have no idea how various commands and environments affect vertical mode. If you will, my question is asking for a (not necessarily comprehensive) list of what commands/environments affect vertical mode in such a way that a skipped line before and/or afterwards will have no effect.

share|improve this question
Could this be related to setting the \catcode of ^^L to \active and redefining it as \outer\def^^L{\par} in latex.ltx? –  Werner May 8 at 23:14
Any environments made by the use of trivlist will end in vmode. –  1010011010 May 9 at 0:07
@1010011010 that is true but not directly related to the question –  David Carlisle May 9 at 0:11
\par ends a paragraph, not starts oone. –  David Carlisle May 9 at 0:27
Just to add to the answer below: before and after \section is safe since you are starting a new paragraph then anyway so the line makes no difference. Similarly, you can put a blank line between \items in a list but not before or after the list or within a single item. –  cfr May 9 at 1:23

2 Answers 2

The answer in the linked question is a bit misleading as being in vertical mode is a technical implementation detail that isn't as closely tied to the user behaviour as implied. For example you are in vertical mode after a list but latex goes to a lot of effort to make a blank line have an effect so that list behaviour matches display math behaviour (where you are in horizontal mode after the display).

Firstly the behaviour is not baked in to TeX, it depends on the current catcode settings.

TeX strips all white space including the system dependent end of line marker from each line (this part is not customisable) It then inserts the \endlinechar if that is set. Normally in LaTeX that is ^M. Then the catcode of the \endlinechar is used just as if it had been a normal character in the file. Normally it is catcode 5 which is the special catcode that makes a single ^M act like a space but two ^M act like \par (omitting a few details). But you could instead make ^M have catcode 10 when it would act like a space, or set \endlinechar=32 then a single space (and no line end) would be generated at each line end.

enter image description here



One two    three




\item one

two \item




However if you don't want to do that and keep the standard settings, the rule should really be simple, use a blank line where you want to end the current paragraph.

So blank lines are an error in math mode.

Blank lines make a \par end of paragraph marker in vertical (par mode) (but as a \par is ignored at the start of a vertical list it is OK to have a blank line at the start of \parbox, minipage etc as well as after each of the paragraphs,

You should never put a blank line before display math (TeX believes that display math should always be inside a paragraph not between paragraphs, so if you use a blank line before \[ or anything else that uses $$ internally, then TeX will insert code equivalent to \indent$$ as a recovery action and you get a spurious white line consisting of an indentation box but no text which looks like spurious vertical space before the display.

You should put a blank line after a display math environment or not, depending on whether the following text is a new paragraph or the continuation of the paragraph before the display.

If you put a blank line before or after a latex list environment then the text following the environment starts a new paragraph and so is typically indented, if you do not place a blank line before or after the list, the following text is considered a continuation of the paragraph before the list.

Almost all latex constructs are positioned the same way as the letter X. People often ask how to make included images go side by side or one above the other. The answer is like X:


Puts two X side by side



puts the X one above the other in separate paragraphs. You can replace X by \includegraphics or \fbox or \parbox or \begin{tabular}...\end{tabular} and the same interaction with a blank line applies.

share|improve this answer

I learned to organize my sources by splitting lines after phrases, i.e., after punctuation. That way most editing becomes shuffling lines around, text editors usually have good support for this. As an added bonus, version control systems also work on a changed lines basis, so this is a good match (e.g. adding a word doesn't lead to a dozen changes due to refilling paragraphs; changes are easy to spot). Keeping e.g. articles and bound together makes mistakes like an dog or the the error easy to spot (out search for).

I write equations mostly in the same way, lining up equals (if there are several), splitting and indenting longish terms, if long factors show up, indent them again, and so on.

In summary, I strive to keep the source indented much like you'd indent a program given very tight margins (LaTeX is quite a bit more verbose than math expressions written in e.g. C). Only very rarely does the natural source whitespace create unwanted paragraph breaks, occasionally a line has to be ended with % for a logical split that doesn't lead to unwanted whitespace.

In any case, this is source code. It is meant to be read by people, specially not just the writer. Anything non-standard makes the document difficult to read, harder to reuse or integrate with other texts, and next to impossible to share with others.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.