LaTeX warning "Underfull \hbox (badness 10000) in paragraph at lines 3--4": cause and fix
A line has more white space than TeX accepts: the spaces had to stretch too far, or the line is not filled at all. Badness is the measure for that, from 0 for a line that fits to 10000 for the worst case; LaTeX reports lines above 1000. It is a warning, and the PDF is still written.
Why it happens
- A paragraph ends with
\\and a blank line follows. The\\starts a new line, and the end of the paragraph leaves that line empty. \\is typed twice in a row to get a vertical gap.\linebreakforces a break in a line that is not full. Unlike\\, it stretches the line to the full width.- Justified text runs in a narrow column, for example in a
\parbox, and long words leave few places to break.
How to fix it
- End a paragraph with a blank line only, without
\\. - Make vertical space with
\vspace{1em},\medskipor\bigskipinstead of empty lines built from\\. - Use
\\or\newlineinside a paragraph where a line should end early. They do not stretch the line. - Set narrow columns ragged right with
\raggedright.
A document that produces the message
\documentclass{article}
\begin{document}
First paragraph.\\
Second paragraph.
\end{document}The corrected document
\documentclass{article}
\begin{document}
First paragraph.
Second paragraph.
\end{document}Both documents were compiled with pdfLaTeX from TeX Live 2023. The first produces the message, the second compiles without an error.
Finding the line in the editor
The editor lists every error and warning of a compile run with file and line. Select an entry and the cursor jumps to that line. See Error list with jump to the line.