latex

How To Indent in LaTeX

Indentation is the process of reducing or increasing the space between a paragraph’s left and right margins. Indenting means to separate the margin from the text when writing. Adding an indent in the specific text highlights the important information in the document.

Therefore, document processors, such as LaTeX, provide simple source code to indent text. However, many new users don’t know how to add indentations. In this tutorial, we will briefly explain ways to indent in LaTeX.

How To Indent in LaTeX

First, let’s start with the simple source code that includes indentfirst \usepackage and \indent code to indent text:

\documentclass{article}
\usepackage{indentfirst}
\begin{document}
Linux OS names: \\
\indent Ubuntu \\
\indent Fedora \\
\indent CentOS \\
\indent Kali Linux \\
There are some lightweight Linux operating systems such as Linux Mint, Arch Linux, Rocky Linux, etc.
\end{document}

Output

Similarly, if you want to change the indents, as per your requirements, then please use the \setlength\parindent code:

\documentclass{article}
\begin{document}
\setlength\parindent{24pt}
Linux OS names: \\
Ubuntu \\
Fedora \\
CentOS \\
Kali Linux \\
There are some lightweight Linux operating systems such as Linux Mint, Arch Linux, Rocky Linux, etc.
\end{document}

Output

In case you want to indent from a specific line, please use the following source code:

\documentclass{article}
\begin{document}
\setlength\parindent{24pt}
Linux OS names: \\
Ubuntu \\
Fedora \\
\-\hspace{5cm} CentOS \\
Kali Linux \\
There are some lightweight Linux operating systems such as Linux Mint, Arch Linux, Rocky Linux, etc.
\end{document}

Output

Conclusion

This article provided brief information on the simple methods to indent in LaTeX. Indentation or indent decreases or increases the distance or space between a paragraph’s left and right margin. It is essential to use the sources correctly, or else you may get an error. Hence, we recommend checking the code before compiling it in LaTeX.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.