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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the following example, the space after the red equation is much larger than the space after the black one.

\[ a = b \]

The quick brown fox jumps over the lazy dog.
\[ a = b \]

The quick brown fox jumps over the lazy dog.

It appears to me that the presence of \color{black} fools TeX into thinking there is something on the line after the equation, so the paragraph break causes a spurious blank line before the text. Section 3.7 of grfguide mentions spacing problems, but doesn't really explain the situation. What is on the line after the red equation?

Note that there is already a question asking how to deal with this problem; I want to understand what is going on.

share|improve this question
I don't think this has to do with the color command. If you replace \color{black} with, for example, \marginpar{test} you get the same result, regardless of how much colour changing occurs. – cmhughes Mar 6 '12 at 22:13
@cmhughes not just color but the fact that color (unlike a font change) acts by putting an item in the list. You get similar effects from other things: floats and marginpars put \inserts there, \label would put a \write there, all these nodes can affect vertical positioning, – David Carlisle Mar 7 '12 at 9:29
@DavidCarlisle thanks for the details! :) Is it another occurrence of a trivlist? – cmhughes Mar 7 '12 at 16:58
up vote 15 down vote accepted

TeX puts a \special (or pdftex colour primitive which is equivalent) which inserts the commands to switch the colour, however unlike a font change this is an actual item on the vertical list, so it "hides" boxes and spaces that occur immediately before it so that decisions made by the vertical display code do not see the same detail of the preceding paragraph. It's normally better to try to get the color switch in to horizontal mode, for example

The quick brown fox jumps over the lazy dog.\color{red}
\[ a = b \]


One way to see what is happening is to put \showoutput into the document and then compare the log file a) without colour b) with color commands in vertical mode c) with colour commands just in horizontal mode.

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.