LaTeX warning · Warnings: references, floats and boxes
Overfull \hbox (51.91441pt too wide) in paragraph at lines 3--5
Quick answer
LaTeX could not find a good place to break a line, so it set the line too wide and it sticks into the margin by the amount shown. The usual culprits are long words it cannot hyphenate: URLs, file paths, code in \texttt, long formulas. Let the text break (load xurl for URLs, rephrase, or add a hyphenation hint with \-), move the long item onto its own line, or load microtype, which removes many small overfull boxes. A few points too wide is invisible and can be ignored.
The warning in the log
This is how the message appears in the .log file (and in the compile output). The line starting with l. is the line number where TeX noticed the problem; the real mistake is there or just before it.
Overfull \hbox (51.91441pt too wide) in paragraph at lines 3--5
[]\OT1/cmr/m/n/10 Install the pack-age with \OT1/cmtt/m/n/10 pip install transformers-accelerate-datasets-evaluate
[]Why it happens
- A long unbreakable string: a URL, a file path, a command in
\texttt(typewriter text is never hyphenated), an email address or a DOI. - Display or inline math that is wider than the line, or a table or image wider than
\textwidth. - Words LaTeX does not know how to hyphenate, typically in a language not loaded with babel or polyglossia.
How to fix it
The log line shows the offending text with its font codes; the line numbers point to the paragraph. For URLs use \url{} with \usepackage{xurl}, which allows breaks anywhere. For code, set it on its own line or in a verbatim or lstlisting block. For prose, \usepackage{microtype} fixes many cases by itself.
As a last resort, \sloppy or the sloppypar environment lets LaTeX stretch the spaces instead of overflowing. For images and tables, scale them to \linewidth.
Broken: reproduces the warning
\documentclass{article}
\begin{document}
Install the package with \texttt{pip install transformers-accelerate-datasets-evaluate}
and restart the kernel before you run the notebook.
\end{document}Try this in Octree — free LaTeX editor with AI, compiles in your browser
Fixed: compiles cleanly
\documentclass{article}
\begin{document}
Install the package with
\begin{center}
\texttt{pip install transformers-accelerate-datasets-evaluate}
\end{center}
and restart the kernel before you run the notebook.
\end{document}Underfull \hbox (badness 10000) in paragraph at lines 3--5
Underfull \hbox (badness 10000) in paragraph at lines 3--5The opposite problem: LaTeX had to stretch the spaces in a line far beyond what looks good. Badness 10000 is the maximum. The most common cause is \\ at the end of a paragraph or used to make vertical space, or \\ right after a blank line; use a blank line for a new paragraph and \vspace or \bigskip for space instead. In narrow columns and table cells (p{2cm}), use \raggedright so lines do not have to be justified.
Underfull boxes do not change the content and are usually only cosmetic. Fix the ones you can see as gappy lines in the PDF and ignore the rest.
Related errors
- Token not allowed in a PDF string – Math or a command in a section title cannot be copied into the PDF bookmarks.
- Too many unprocessed floats – Figures or tables pile up behind one that LaTeX cannot place, until it runs out of float slots.
- There's no line here to end – A
\\or\newlinewhere no line of text has started. - All LaTeX errors and warnings – The full list, grouped by cause
Frequently Asked Questions
Can I ignore Overfull \hbox warnings?
Small ones, yes: anything under a couple of points is invisible. Large ones mean text runs into the margin and may be cut off when printed, so look at the page in question and fix those.
How do I stop URLs going into the margin?
Write them with \url{...} and load \usepackage{xurl} (or \usepackage[hyphens]{url} before hyperref). Both let LaTeX break the URL at more places, including after slashes and letters.
What does "Underfull \hbox (badness 10000)" mean?
A line was stretched as far as possible because there was not enough text to fill it. It is usually caused by \\ used to end a paragraph or to make space; replace it with a blank line or \vspace.
How do I find where the overfull box is in the PDF?
The warning gives the source line numbers ("at lines 3--5"). Adding \overfullrule=5pt to the preamble also draws a black bar next to every overfull line in the PDF.
Paste your document into Octree — compile errors get a Fix with AI button
When a compile fails, Octree shows the error next to the line that caused it and offers a one-click fix that you can review before applying. Free, nothing to install.
Fix it in Octree →