Understanding how LaTeX handles paragraphs and line breaks is essential for controlling your document’s appearance. LaTeX has its own rules for formatting text, which might surprise you if you’re coming from word processors.
Key concept: LaTeX decides line breaks for you to create optimal text flow. You control paragraph breaks, and LaTeX handles the rest.
How LaTeX Handles Paragraphs
Creating Paragraphs
In LaTeX, a blank line creates a new paragraph:
\documentclass{article}
\begin{document}
This is the first paragraph. It can span multiple lines in your source file, but LaTeX will format it as one continuous paragraph in the output.
This is the second paragraph. Notice the blank line above - that's what tells LaTeX to start a new paragraph. LaTeX automatically indents the first line.
\end{document}
Multiple Spaces and Line Breaks
LaTeX treats multiple spaces as one and ignores single line breaks:
This has multiple spaces.
This is on
multiple lines
in the source.
This is a new paragraph.
LaTeX ignores extra whitespace to give you flexibility in formatting your source code without affecting the output.
Manual Line Breaks
Using Double Backslash
Force a line break within a paragraph using \\:
\documentclass{article}
\begin{document}
First line\\
Second line\\
Third line
This is still the same paragraph, but with forced line breaks.
This is a new paragraph.
\end{document}
Add vertical space after a line break:
First line\\[10pt]
Second line with 10pt gap\\[0.5cm]
Third line with 0.5cm gap
Normal line break:\\
Next line
The \newline Command
Alternative to \\:
This is one line\newline
This is the next line
Preventing Line Breaks
Non-breaking Space
Use ~ to prevent line breaks between words:
% Prevent breaks in names
Dr.~Smith wrote Chapter~5.
% Keep units together
The temperature is 25~°C.
% Prevent awkward breaks
See Figure~\ref{fig:example} on page~\pageref{fig:example}.
\mbox Command
Keep text together on one line:
The URL is \mbox{www.example.com/very-long-path}.
Paragraph Indentation
Control first-line indentation:
\documentclass{article}
% Remove indentation globally
\setlength{\parindent}{0pt}
% Or set custom indentation
% \setlength{\parindent}{1cm}
\begin{document}
This paragraph has no indentation because we set parindent to 0pt.
This paragraph also has no indentation. All paragraphs follow the global setting.
\indent This paragraph is manually indented using the indent command.
\noindent This paragraph has no indentation even if parindent is set.
\end{document}
Paragraph Spacing
Control space between paragraphs:
\documentclass{article}
% Add space between paragraphs
\setlength{\parskip}{1em}
% Remove indent when using parskip
\setlength{\parindent}{0pt}
\begin{document}
First paragraph with spacing after it.
Second paragraph with spacing before and after it.
Third paragraph.
\end{document}
Special Paragraph Commands
\par Command
Explicitly end a paragraph:
This is a paragraph.\par
This is another paragraph.
Centered Text
\begin{center}
This text is centered.\\
Multiple lines\\
can be centered.
\end{center}
% Or for short text:
{\centering This is also centered.\par}
Flush Left and Right
\begin{flushleft}
This text is\\
aligned to\\
the left.
\end{flushleft}
\begin{flushright}
This text is\\
aligned to\\
the right.
\end{flushright}
Advanced Line Breaking
Preventing Hyphenation
% Prevent hyphenation for specific words
\hyphenation{LaTeX JavaScript Python}
% Prevent hyphenation in a word
\mbox{unbreakableword}
% Allow hyphenation at specific points
super\-cali\-fragi\-listic
Line Breaking Commands
| Command | Effect | Usage |
|---|
\\ | Line break | Most common |
\\* | Line break (no page break) | Keeps lines together |
\newline | Line break | Alternative to \\ |
\linebreak | Suggests line break | LaTeX decides |
\nolinebreak | Prevents line break | Keeps on same line |
Page Breaking
Control where pages break:
\newpage % Start new page
\pagebreak % Suggest page break
\nopagebreak % Prevent page break
\clearpage % New page after floats
Common Patterns
John Smith\\
123 Main Street\\
Anytown, ST 12345\\
USA
Poetry or Verses
\begin{verse}
Roses are red,\\
Violets are blue,\\
LaTeX is awesome,\\
And so are you!
\end{verse}
Quotations
\begin{quote}
This is a short quotation. It's indented from both margins and has no paragraph indentation.
\end{quote}
\begin{quotation}
This is a longer quotation that might span multiple paragraphs. The first line of each paragraph is indented.
This is the second paragraph of the quotation.
\end{quotation}
Best Practices
Paragraph and line break tips:
- Let LaTeX decide - Don’t force line breaks unless necessary
- Use blank lines - Clear paragraph separation in source
- Be consistent - Choose either indentation or spacing
- Use non-breaking spaces - Keep related items together
- Avoid
\\ at paragraph ends - Use blank lines instead
Common Mistakes
Avoid these errors:
- Using
\\ for paragraph breaks - Use blank lines
- Multiple
\\ in a row - Use \\[space] instead
- Ending paragraphs with
\\ - Creates underfull hbox warnings
- Too many manual breaks - Trust LaTeX’s algorithm
Troubleshooting
Underfull/Overfull hbox
If you get these warnings:
- Let LaTeX handle line breaking
- Use
\sloppy for problematic paragraphs
- Rewrite sentences if needed
Unwanted Page Breaks
% Keep content together
\begin{samepage}
This content stays together on one page.
\end{samepage}
Inconsistent Spacing
Check these settings:
\setlength{\parindent}{15pt} % First line indent
\setlength{\parskip}{0pt} % Between paragraphs
\setlength{\baselineskip}{12pt} % Between lines
Quick Reference
| What you want | How to do it | Example |
|---|
| New paragraph | Blank line | text\n\ntext |
| Line break | \\ | line\\line |
| No indentation | \noindent | \noindent Text |
| Keep together | ~ | Fig.~1 |
| Center text | \begin{center} | Centered |
| Extra space | \\[1cm] | With gap |