Learn how to indent in LaTeX


By default, LaTeX leaves no vertical separation between different paragraphs. Instead, it indents the first line of the new paragraph. In this tutorial, we are going to see how to control this indentation: how to change the amount new paragraphs are indented by default, and how to add manual indentation to a given paragraph.

1. Change (remove) indentation

The vertical separation between paragraphs is determined by the \parskip length (more detailsOpens in a new tab.); as it has been said, by default this length is 0pt. Similarly, the indentation of the first line of a new paragraph is controlled by the length \parindent which, by default, is 20pt for the article and book classes.

These default values can be changed using the \setlength command. This command is used to change the value of already existing LaTeX lengths, and it gets passed:

  • as a first mandatory argument the length to be set and
  • as a second mandatory argument the TeX dimension to which you want to set it.

For example, using the following declaration in the preamble of your document:

\setlenght{\parindent}{0pt}

will cause the paragraphs of your document not to be indented.

2. Change (remove) indent for a specific paragraph

However, if what you want is to insert more space at the beginning of a given line, and not for the whole document, you will have to use a spacing command for that given line. If you try to do this directly, you may be faced with the LaTeX system ignoring your space. This is due to the fact that the underlying system TeX prevents blank space from appearing at the beginning of the line, and this behavior is respected by most LaTeX processors (although not for all of them).

In case your system is ignoring the blank space at the start of a new line, you will have to make this space breakable, using the \- command before the declaration that inserts the space. For example, the line produced by

\-\hspace{2cm} My line.

will have 2cm of extra space before the text. Another option is using the \hspace* command, which isn’t ignored either.

For more details, I deeply invite you to read this full tutorial “LaTeX Space Guide: vertical, horizontal, text and math modes, and much more!Opens in a new tab.

We reached the end of this short tutorial, If you have any remarks or suggestions, please feel free to reach us via email at admin@latex-tutorial.comOpens in a new tab.

Recent Posts