# How can I get rid of indentation after an equation?

I'm a total newbie to LaTeX and I get very annoyed about this. Every time I write an equation, the text following the equation has some indentation but I don't want it to be there!

Look at the following formula

$$K_BT_k=Dexp\left\lbrace -\frac{1}{2N(E_F)|J|}\right\rbrace$$

where $Dexp$ is a ...


The line starting with "where ..." is indented and looks horrible. Some people told me about \noindent but do I really have to write this command after every single equation?

-
This question just popped up for some reason and I did a double take to see who asked it. It's amazing that Juan literally started out with LaTeX here three years ago and has got so much reputation since then. – Ryan Reich Jun 2 '13 at 3:58
Thanks @RyanReich :) Although for full disclaimer, I was actually pretending to be a novice user when I wrote this question. I was very involved with the site at the beginning, from area51 and through the early beta. – Juan A. Navarro Jun 3 '13 at 9:52
I knew something was wrong! You are apparently a good actor as well :P – Ryan Reich Jun 3 '13 at 14:11

Remove the blank lines, either by actually removing them or adding '%'s:

Look at the following formula
%
$$K_BT_k=Dexp\left\lbrace -\frac{1}{2N(E_F)|J|}\right\rbrace$$
%
where $Dexp$ is a long sentence guaranteed to take us over the
end of this line and well into the next.


Simple, but subtle!

The indentation is created by the fact that, as far as TeX is concerned, the word 'where' begins a new paragraph and you've decided that new paragraphs should be indented (or rather, you haven't decided that new paragraphs shouldn't be indented). TeX detects this by the presence of the blank line (well, actually by the double newline, but what it considers a double newline is a little complicated so "blank line" is best for now). So to tell TeX that there isn't a new paragraph there, I simply remove the blank line. As I like to keep my source code with lots of visual spaces between things, I do this by putting the comment marker '%' on the blank line. Deleting it (as in Caramdir's answer) would be equivalent as far as TeX is concerned. In fact (as Caramdir pointed out in his answer), both the blank line before and after should be removed. As originally written, there are three paragraphs where there should (according to the wording) be just one. Although the fact that the equation starts a new paragraph is less obvious, it still can have an effect.

Note that although it may have almost the same effect, using the \noindent command here would be wrong. Using \noindent says "This is a new paragraph, but I don't want it indented." whereas putting in the % says "This isn't a new paragraph.".

-
Could you explain why?? I'm a total newbie!! – Juan A. Navarro Jul 29 '10 at 11:36
The space you have after the signals a new paragraph (that's what empty lines mean.) Commenting out the empty line (with a % means that effectively there is no empty line, but visually you still get the separation that you seem to want in the source between the equation environment and the rest of the text. – Yossi Farjoun Jul 29 '10 at 11:39
@Juan A. Navarro: Caramdir suggests removing the line before as well. I agree (well, I'd put in the comment character) as it's all syntactically the same paragraph; I was concentrating on the afterwards and missed the before. – Loop Space Jul 29 '10 at 11:45
Explanation for removing the empty line above the equation: spacing. Try compiling Look at $$a$$ with and without an empty line. – Caramdir Jul 29 '10 at 11:54
This answer has helped with a similar situation when using \foreignblockquote of the package csquotes. – ischeriad Aug 24 '11 at 18:08

Just remove the empty lines before and after the equation.

-
But you got the "before" as well so +1. – Loop Space Jul 29 '10 at 11:45
+1 I just hate using comments for anything more than commenting. – mbq Jul 29 '10 at 13:29
why? why should I remove those empty lines? could you elaborate? I insist because this answer is getting a lot of votes, but I don't think it answers the question see meta.tex.stackexchange.com/questions/172/… – Juan A. Navarro Jul 30 '10 at 5:42
@Juan I'll try; in (La)Tex not all whitespaces are ignored; one or more empty lines form "begin new paragraph" command. So you can just not write it, as in this solution, or comment out this command writing % in the empty line as in Andrew's solution. (Which IMO is a bad practice, still just works.) – mbq Jul 30 '10 at 6:01
@mbq: With most languages, I'd agree with you. I hope, though, that you'd agree that the decision on how much to spread out ones code is largely a matter of personal taste. I find that grouping and separating things helps me understand my own source code and that blank lines are visually the easiest way for me to do this. However, since blank lines have special meaning in LaTeX, the equivalent in LaTeX of a blank line in, say, a perl script is a line beginning with a %. So, for me, a line with just a percent character on it is not a comment line. – Loop Space Jul 30 '10 at 9:41

For comparision, in ConTeXt, the relation between blank lines in input and indentation in output can be controlled using the indentnext key. For example, if you set

\setupformula[indentnext=no]


then, there is no indent after an equation (irrespective of whether the input has blank lines or not). Similarly, if you set

\setupformula[indentnext=yes]


then th next line is always indented. To get the default LaTeX-like behavior (indent if the input has blank line), usé

\setupformula[indentnext=auto]


The same logic works for other environments like descriptions, itemize, enumerate, etc.

-

I always put a

\setlength{\parindent}{0pt}


in the preamble of the document (i.e. before \begin{document}). Of course, then all indentations are supressed and if you want something to be indented, you have to do this manually.

-
Using the parskip package (rather than setting the lengths \parskip and/or \parindent separately) is sometimes preferred. – Werner Jun 7 '12 at 17:03