Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Underfull \hbox (badness 10000)" warning?

I have this small .tex file.

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{titling}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz}


\setlength{\droptitle}{-3.5cm}
\setlength{\parindent}{0cm}
\newcommand{\squad}{\hspace{0.5em}}

\author{vladgovor77771}
\title{Some article}

\begin{document}
\maketitle

\textbf{Task 1} \newline
Task description: \newline

\end{document}

When compiling, it warns about line

\textbf{Task 1} \newline

With the following message:

"Underfull \hbox (badness 10000)".

How do I fix this?

like image 795
Владимир Говорухин Avatar asked Sep 28 '20 17:09

Владимир Говорухин


People also ask

What does Underfull \hbox mean?

An underfull hbox means LaTeX couldn't space the line wide enough to fill the entire width of the page, without increasing word spacing beyond the allowed maximum; the opposite is an overfull hbox, where a line couldn't be broken and extends past the edge of the printable area.

What does badness mean in LaTeX?

For underfull boxes Overleaf will also report TeX's so-called “badness” ( badness <value> ) which is a measure of how much TeX has needed to “stretch” your content to fill space set aside to contain it. Badness values normally range from 0 to 10000.

How do I fix overfull hbox in LaTeX?

Correct the compile warning: overfull \hbox (or bad box). Whenever you see a \hbox message, you can either: rewrite the lines shown in the warning message so that the message disappears. insert \- (hyphenation) into a place of the word where causes overfull.

What is overfull hbox?

A overfull hbox means that an horizontal box (hbox) is "full", that is, some text/math/glyph is "leaking out" of the box assigned to it. In your case, what you wrote is larger than the paragraph's width, and TeX couldn't fix it on its own.


1 Answers

I had a similar issue, I solved it by removing any \newline or \\ at the and of every sentence that had nothing textual below.

For instance, two examples that causes that problem:

An example. \\
This is well used. \\
This line will cause the error. \\

(I'm a new paragraph) \\
Because there's nothing directly underneath.\\
The last line does NOT require a "newline".

This is a thid paragraph. \\
:D

The same is true for figures or similar

This is a line.
Putting a "newline", as here, before a \begin will cause the error. \\
\begin{figure}[h]
....
\end{figure}
like image 77
Marco Ottina Avatar answered Oct 21 '22 02:10

Marco Ottina