0

I know there's many questions on indenting, but I couldn't find an answer to a question that's been bugging me for days: How can you tell LaTeX to indent a paragraph if and only if this paragraph comes immediately after another paragraph? This way, you don't have indentions at the beginning of sections, after environments, pictures etc. Here is an example of how I want it to look like:

The way I want it to be1

Can anyone of you help me out?

5
  • 1
    After environments: unless the environment definition explicitly issues \par at its conclusion: just make sure you don't have extra "blank lines" between the environment and surrounding text. This should work for most mathematics, table, figure environments. (The one that stands out is how amsthm handle theorem environments: the AMS takes the position that every theorem is an individual paragraph.) Jun 16 at 22:04
  • 1
    What you want is the default behavior in LaTeX, as far as you don't leave empty lines, which will be converted to \par, before and after floats and equations. Jun 16 at 22:05
  • 1
    For the default article class etc. there should be no paragraph indentations after sections. (Most document classes issue \@afterheading as part of the call to \section or other sectioning headings, which suppresses paragraph indentation.) Jun 16 at 22:08
  • 2
    If you are seeing "non-standard" behavior: please create a minimum document that shows which document class and packages you are using and that shows the output. Jun 16 at 22:09
  • 3
    latex will not indent after a non floating image or a math display unless you start a new paragraph at that point, As you have not shown your input I would guess you are starting paragraphs with blank lines, so explicitly requesting an indent at those points. Jun 16 at 22:19
0

Thanks to the comments below I now know the answer to my question: LaTeX only indents a paragraph if it comes after another one - at least if you use the documentclass article. It is as simple as that. However, if you insert an empty line after an environment or a graphic, LaTeX will insert a line break and with that line break indent the text that comes after the environment/graphic. Here is an example:

    \documentclass[leqno]{article}
    \usepackage{amsmath}
    \begin{document}
    \section{Some section}
    Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem 
    ipsum. Lorem ipsum. Lorem ipsum.
    \begin{align}
    2+2=4
    \end{align}

    Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem 
    ipsum. Lorem ipsum. Lorem ipsum.
    \end{document}

Since there is an empty line after \end{align}, LaTeX will indent the following text. If you, however, omit the empty line, you also prevent the linebreak and with it, the indentation.

    \documentclass[leqno]{article}
    \usepackage{amsmath}
    \begin{document}
    \section{Some section}
    Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem 
    ipsum. Lorem ipsum. Lorem ipsum.
    \begin{align}
    2+2=4
    \end{align}
    Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem 
    ipsum. Lorem ipsum. Lorem ipsum.
    \end{document}

Notice thre's no empty line after \end{align}. This way, the indentation works as intended. As Willie Wong pointed out, though, some environments have \par built-in at the end. In this case, you will have to modify the command.

Your Answer

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

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