127

What does the actual phrase above mean?

1
  • 2
    Package parskip can resolve most of such warnings, you can refer to this answer for more details.
    – zyy
    May 27, 2021 at 15:42

2 Answers 2

106

99 times out of 100 it means you have \\ incorrectly placed at the end of a paragraph. But to dissect the message:

Underfull \hbox (badness 10000) in paragraph at lines 4--5

A box is underfull if there is not enough content to fill its stated size.

If you go \hbox to 5cm{A} then it makes a horizontal box (\hbox) 5cm wide just containing an A so it is underfull and will generate a warning, the exact amount of badness depends how much any white space is over-stretched, but here there is no white space so it is infinitely bad, which is arbitrarily truncated to the maximum value, 10000.

By placing \\ at the end of a paragraph you force a line break but there is nothing at all in the forced final line of the paragraph so it is a box that is \textwidth wide with no content. It appears a bit like vertical space but it is not it is a spurious line at the end of the paragraph. So for example it does not stretch and is not dropped at the start of a page.

18
  • 1
    @gernot oh I was out by a factor of 10, thanks:-) Oct 15, 2016 at 16:43
  • 3
    @sreerajt that is exactly the case described here: it is always wrong to have a blank line after \\ Mar 31, 2020 at 7:48
  • 1
    every line of a paragraph is a box and \\ at the end of a paragraph forces a spurious empty line May 4, 2020 at 23:40
  • 1
    @ka3ak don't ask new questions as comments on old posts, ask a new question referencing this one. It is anyway impossible to answer without seeing the example code, there are many reasons why the line may or may not break at a particular place. Dec 21, 2020 at 9:25
  • 5
    It is making an empy white line of text so if a page break happens you will get a blank line at the of the page, it is not vertical space it is a line of text with no text. You should (almost) only ever use \\ in alignment constructs like tabular or align. You vary rarely need to use it mid-paragraph to force a line break but never use it at the end of a paragraph. It does not "typeset with no problem" it makes essentially broken output and tex warns you about it with good reason. @user71207 Jun 19, 2021 at 8:08
-5

I just find out that using new line command \\ in latex (overleaf) causes the problem.

If you end a line with \\ and start with a nonempty line then it works fine.

Example:

\begin{document}
Hello this is the first line.\\
This is the second line.\\ 
\end{document}

But when I need to skip one line (like pressing enter twice) I must use \\ \\ (i.e. \\ twice). Since we are putting \\ at the end of an empty line this causes the problem.

Example:

\begin{document} 
Hello this is the first line.\\
\\ %This is an empty line
This is the third line.
\end{document}

Solution: Use a text in white color between \\ and \\ to resolve this, though xcolor package will be required for this. Here is the code.

\begin{article}
\usepackage{xcolor} 
Hello this is the first line.\\
{\color{white}-}\\ % This line will now show in pdf and no error will be generated.
This is the third line.
\end{article}

Hope this works!

6
  • 9
    Please use neither \\ nor\\ \\ to make a vertical distance. If you want paragraph skip instead of paragraph indent, configure paragraphs, e.g., using package parskip and use either an empty line in the source code or \par. If you want a vertical distance for another reason use a vertical distance command like \bigskip or \vspace{…} between paragraphs. If you want a vertical distance in a special environment like a tabular use the optional argument of \\[…]. See also David's answer and the comments to it for more information.
    – cabohah
    May 9, 2023 at 8:37
  • 1
    Thanks! Can you provide a sample code for that? I am also not fully satisfied with my answer (I was using this because it was working). I am not very fluent in latex so a code would be really great. May 10, 2023 at 10:38
  • 3
    For what do you want an example? For using parskip? → tex.stackexchange.com/questions/40429/… and many other questions about parskip etc. If you need more help, you should ask a question wit a real minimal working example and a concrete question. BTW: Your shown code does usually not work, because article is not an environment but a class and text requires \begin{document} and \end{document}. You really should delete the answer or improve it.
    – cabohah
    May 10, 2023 at 11:35
  • 4
    The answers to this question When to use \par and when \\ should tell you why using \\ isn't a good idea. May 10, 2023 at 13:21
  • 5
    sorry this answer is completely wrong, users should never use \\ in this way. Jun 28, 2023 at 10:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .