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?

1

3 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}

Instead of forcing an underfull box with \newline, you could simply leave an empty line to start a new paragraph:

\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}
Task description:
blabla
\end{document}

A quick and nice solution is to use package parskip, and instead of using \newline or \\ for line breaks, simply insert an empty line

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{titling}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz}
\usepackage{parskip} %% <-- added
\setlength{\droptitle}{-3.5cm}
\setlength{\parindent}{0cm}
\newcommand{\squad}{\hspace{0.5em}}
\author{vladgovor77771}
\title{Some article}
\begin{document}
\maketitle
\textbf{Task 1}
Task description:
\end{document}

The warning will be gone.


By the way, to know why it happened, refer to this question on TeX Stack Exchange.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like