How to change line spacing in LaTeX?
In LaTeX, you can change line spacing for the whole document or a specific part or paragraph. Also, you can set a specific amount of line spacing.
So in this tutorial, you will learn how to set line spacing of your document globally and locally with setspace
package.
Set line spacing globally
By default, LaTeX gives a default amount of line space for paragraphs or text. If you want to set double or a specific amount of line spacing, you can use \doublespacing or \linespread{<factor>}
command in the preamble of your document.
With \linespread{<factor>}
command you can set line space as you want, set the <factor>
2.0 to get double line spacing or you can set any amount like 1.5, 1.7, 2.5, etc. as you need. And don’t forget to load the setspace
package.
\documentclass{article} \usepackage{lipsum} \usepackage{setspace} \doublespacing % Or use \linespread{2.0} \begin{document} \begin{center} \underline{ Double Line spacing (2.0)} \end{center} \lipsum[1] \end{document}
Output:
Now, let’s take a look with \linespread{1.5}
\documentclass{article} \usepackage{lipsum} \usepackage{setspace} \linespread{1.5} \begin{document} \begin{center} \underline{Line spacing (1.5)} \end{center} \lipsum[1][1-6] \end{document}
Output:
Set line spacing locally
If you want to set line spacing for a specific part and rest of the part will not affected. In this case, you have to use the spacing
environment with setspace
package.
Syntax:
\begin{spacing}{<factor>}
% Your content goes here
\end{spacing}
The line spacing will be set to the specified factor
times the default line spacing.
\documentclass{article} \usepackage{lipsum} \usepackage{setspace} \begin{document} \begin{center} \underline{Line spacing (Default)} \end{center} \lipsum[1][1-6] \begin{center} \underline{Line spacing (1.5)} \end{center} \begin{spacing}{1.5} \lipsum[1][1-6] \end{spacing} \begin{center} \underline{Line spacing (2.0)} \end{center} \begin{spacing}{2.0} \lipsum[1][1-6] \end{spacing} \end{document}
Output:
Leave a Reply