The default for the Latex paragraph format is fine for many applications, but sometimes format changes are required.
New Paragraph in LaTeX
To start a new paragraph, you have to insert a blank line between them.
1 2 3 4 5 6 7 8 9 10 11 |
\documentclass{article} \usepackage{parskip} \setlength{\parindent}{4em} \setlength{\parskip}{1em} \renewcommand{\baselinestretch}{2.0} \begin{document} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis gravida metus. Curabitur aliquam mollis aliquet. Mauris ac augue id nisi viverra iaculis. Vestibulum faucibus ligula et congue pulvinar. Integer pretium nulla ut urna suscipit, a gravida odio hendrerit. Nulla facilisis, nisi vitae luctus aliquet, tellus felis mattis ligula, et malesuada metus mauris vitae ipsum. In a cursus dui. \end{document} |
In this example the indentation at the first line of a paragraph, the line spacing, and the paragraph spacing are manually set in the preamble (as explained below). Meanwhile, there is another way to start a new paragraph using the \par command.
1 2 |
This is the first sentence. This is the second. And this is the third. Now, lets define a new paragraph.\par The command starts the second paragraph in the absence of a line space. Its a handy command, but complicates editing and ${\LaTeX}$ code management. |
Manual Line Breaks in LaTeX
A number of commands exist to force manual line breaks with format options:
- \\[…]: The command to start a new line. It has an optional argument in brackets, extra-space, that specifies how much extra vertical space is to be inserted before the next line. This can be a negative amount.
- \newline: The command breaks the line right where it is. The \newline command can be used only in paragraph mode.
- \linebreak: The \linebreak command breaks the current line at the point of the command. The \linebreak command causes
to stretch the line so it extends to the right margin.
- \nolinebreak: The \nolinebreak command prevents
from breaking the current line at the point of the command.
- \newpage: The command ends the current page.
- \pagebreak: Breaks the current page at the point of the command.
- \nopagebreak: Prevents breaking the current page at the point of the command.
Paragraph Format: Text Justification
Paragraphs in are usually fully justified, i.e. flush with both the left and right margins. To alter the justification of a paragraph, there are three environments listed first below, and also
command equivalents.
- left justified: flushleft \raggedright
- centered: center \centering
- right justified flushright \raggedleft
The environment and alignment command are used as follows:
1 2 3 4 5 |
\begin{center} The following paragraph is an example of center alignment using the center environment. \end{center} {\centering The following paragraph is an example of center alignment using the center environment.} |
The command is enclosed into a group, as indicated by the braces {…}, so the rest of the document will not be affected.
Paragraph Format: Tab Commands
The tabbing environment provides a way to align text in columns. It works by setting tab stops and tabbing much the way you do with an ordinary typewriter. The first line of the tabbing environment is used to set tab stops using the \= command. Subsequent lines declare tabs and advance text using the \> command.
1 2 3 4 5 6 |
\begin{tabbing} text \= more text \= still more text \= last text \\ second row \> \> more \\ .... .... \end{tabbing} |
The \hspace{} command is useful for controlling horizontal space in the tabbing environment. Simply declare the horizontal space per tab in brackets. The following example sets a 1 inch tab:
1 2 3 4 5 |
\begin{tabbing} Bold: \= \hspace{1in} \= \textbf{Test 1234} \\[2ex] Italics: \> \> \textit{Test 1234} \\[2ex] Underline: \> \> \underline{Test 1234} \\[2ex] \end{tabbing} |
Paragraph Format: Indentation
By default, does not indent the first paragraph of a section or a chapter. The size of the subsequent paragraph indents is determined by \setlength and \parindent (assumes the parskip package is loaded in the preamble):
1 2 3 4 5 6 7 8 |
\setlength{\parindent}{4em} \begin{document} Sed quis ante adipiscing, placerat odio quis, blandit nisi. Ut sollicitudin pulvinar eros, ac mollis neque bibendum sed. Pellentesque viverra velit et quam hendrerit tincidunt. Cras ut ornare massa. Curabitur fringilla luctus vehicula. Nulla pretium scelerisque libero, vitae gravida neque aliquet a. Nam in sollicitudin urna. ... \end{document} |
It’s recommended to put this command in the preamble of the document, but it can be set anywhere.
If you want to create a non-indented paragraph, put the command \noindent at the beginning of the paragraph. If you want the whole document not to be indented, set the indentation length to zero with \setlength{\parindent}{0pt}
.
Alternatively, if you want to indent a paragraph with no indentation, you can use \indent right above it. This command will only have an effect when \parindent equals zero.
Paragraph Format: Spacing Between Text Blocks
The //[…] can be used to set space before a paragraph. Default spacing is set using \setlength with \parskip. Extra vertical space can also be changed to have a default dimension plus an amount of expansion minus an amount of contraction:
1 2 |
\setlength{\parskip}{1em} \setlength{\parskip}{1cm plus4mm minus3mm} |
Paragraph Format: Line Spacing
There are three commands that control the line spacing, below an example redefining the length of \baselinestretch in the preamble:
1 2 3 4 5 6 7 8 9 |
\documentclass{article} \setlength{\parindent}{4em} \setlength{\parskip}{1em} \renewcommand{\baselinestretch}{1.5} \begin{document} Vestibulum at ligula nec nunc cursus volutpat id sed justo. Morbi ultricies purus a ipsum rhoncus ornare. Nam id neque nunc. Sed scelerisque turpis eleifend accumsan venenatis. Maecenas vel lectus eu ante elementum interdum eu et orci.... \end{document} |
There are two other commands that change line spacing:
- \baselineskip=value: The minimum space between the bottom of two successive lines in a paragraph; it may be changed (in the preamble) by
setlength{\baselineskip}{value}
, where value is set using standard length measures. - \linespread{value}: where value determine line spacing. This value is somewhat confusing, because:
- 1.0: single spacing
- 1.3: one-and-half spacing
- 1.6: double spacing