New lines and blank lines in LaTeX


For those new to the LaTeX system, it may surprise you that new lines in the input code are not translated to new lines in the output. In fact, the new line character is treated exactly like a space character when LaTeX processes your source code file. This is due to the fact that the line breaking in LaTeX is done automatically with an algorithm, so that the text looks justified and that just the right amount of space is left between words to do it.

1. Add a new paragraph in LaTeX

When you want to start a new paragraph, you will have to leave a blank line in the input file. However, if you don’t believe in the algorithm used to break the lines, you can also produce your own line breaks with the special command \\. Let me illustrate all of this with an example:

% New lines and paragraphs in LaTeX
\documentclass{book}

% Remove Indentation
\setlength{\parindent}{0cm}

\begin{document}

You can see that line breaks are treated just like normal spaces.

A blank line, however, has the effect of starting a new paragraph.

You can also force\\ line breaks, although\\ I discourage you to do so.

\end{document}

which produces the following output:

new line new paragraph latex

2. Modify Indentation and space between paragraphs

You can see in general LaTeX documents that, by default, no space is left between paragraphs; instead, the first line of the new paragraph is indented. You can change this by editing the:

  • \parskip length which determines the length of the skip between paragraphs and
  • \parindent length which determines the length of the indent.

This can be done with the \setlength command, which gets passed as a first argument the length to be changed, and as a second argument the new value of this length, which has to be a valid TeX dimension. From the above example, we have:

% Remove Indentation
\setlength{\parindent}{0cm}

3. Local modifikation of space between paragraphs

However, if you don’t want to change these lengths globally, but rather make a big skip at a certain point, you can use the \smallskip, \medskip, and \bigskip commands, which produce vertical spaces of different lengths.

Even further, you can use the command \vspace, which gets past a certain dimension and produces a vertical skip of the dimension specified.

For instance, if our goal is to leave just the space of a blank line, the command \vspace{\baselineskip} (which is roughly the same as \bigskip) will do the trick, since the dimension \baselineskip corresponds with the space left between the bottom of two consecutive lines. For more details, I deeply invite you to check this postOpens 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