How to Do Paragraph Indentation in LaTeX
In LaTeX, you can control paragraph indentation using the \indent
command or by setting the \parindent
length. By default, LaTeX indents the first line of each paragraph.
The following examples show how to control paragraph indentation in LaTeX.
How to Indent a Paragraph
We can use the \indent
command to manually indent a paragraph in LaTeX document.
Suppose we want to indent a paragraph.
We can use the following LaTeX code to do so:
\documentclass{article}
\begin{document}
This is the first paragraph. It contains some text.
\indent This is the second paragraph. It is indented manually using the \texttt{\textbackslash indent} command.
\end{document}
Output: 👇️
This is the first paragraph. It contains some text.
This is the second paragraph. It is indented manually using the \indent command.
In this example, we use the \indent
command to manually indent the second paragraph.
How to Set Paragraph Indentation Length
We can also set the paragraph indentation length using the \setlength{\parindent}{length}
command.
Suppose we want to set a custom indentation length for all paragraphs.
We can use the following LaTeX code to do so:
\documentclass{article}
\begin{document}
\setlength{\parindent}{2em}
This is the first paragraph. It contains some text.
This is the second paragraph. It follows the custom indentation length set by \texttt{\textbackslash setlength\{\textbackslash parindent\}\{2em\}}.
\end{document}
Output: 👇️
In this example, we use the \setlength{\parindent}{2em}
command to set a custom indentation length for all paragraphs.
How to Remove Paragraph Indentation
Suppose, if we want to remove paragraph indentation, we can set the \parindent
length to zero.
Suppose we want to remove paragraph indentation, use the following LaTeX code to do so:
\documentclass{article}
\begin{document}
\setlength{\parindent}{0pt}
This is the first paragraph. It contains some text.
This is the second paragraph. It follows the no indentation setting.
\end{document}
Output: 👇️
In this example, we use the \setlength{\parindent}{0pt}
command to remove paragraph indentation.
Conclusion
We can use the \indent
command to manually indent paragraphs, set the \parindent
length to customize indentation, or set it to zero to remove indentation.