127

What does the actual phrase above mean?

David Carlisle
  • 757,742

2 Answers2

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.

gernot
  • 49,614
David Carlisle
  • 757,742
  • 1
    @gernot oh I was out by a factor of 10, thanks:-) – David Carlisle Oct 15 '16 at 16:43
  • Thank you for that well and clearly explained answer to my question. – Charles Boehm Oct 16 '16 at 09:46
  • @CharlesBoehm Can you please explain this to me ? – user2925716 Oct 08 '19 at 19:11
  • What if I write \ , put a blank line and then write something?. In this scenario, there is something written after \, but I am still getting this error! – sreeraj t Mar 31 '20 at 04:05
  • 3
    @sreerajt that is exactly the case described here: it is always wrong to have a blank line after \\ – David Carlisle Mar 31 '20 at 07:48
  • what box? is a paragraph a box? I didn't start any hbox, but I have this message – serge May 04 '20 at 22:55
  • 1
    every line of a paragraph is a box and \\ at the end of a paragraph forces a spurious empty line – David Carlisle May 04 '20 at 23:40
  • I don't have any \\ at the end but still get the warning. It looks like the text is too long for being put on one line, but why doesn't it just get split without any warnings?... – ka3ak Dec 21 '20 at 09:17
  • 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. – David Carlisle Dec 21 '20 at 09:25
  • Then when should I use \? I "misused" it but it still typesets with no problem (except this message appears in the console) – user71207 Jun 19 '21 at 07:54
  • 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 – David Carlisle Jun 19 '21 at 08:08
  • Just a snippet of a comment. There are many reasons why underfull errors may occur, as mentioned here and ways to address them, but the overriding reason for me has been in paragraph construction, namely the writing. I found that while many overfull errors could be eliminated globally by using one command or another, fixing underfull errors in long documents was best accomplished during the editing phase. Consequently, I think of underfull errors, not as technical hurdles, but one offering an opportunity to create a more coherent and communicable presentation. – afrothetics Sep 10 '21 at 19:02
  • @afrothetics underfull boxes due to difficult line breaking are an oportunity to rewrite as you suggest but they are not normally 10000, underfull 10000 is almost always as described here, which is essentially a syntax error which is unfortunately just presented as a warning. – David Carlisle Sep 10 '21 at 19:05
  • Thanks for the feedback. – afrothetics Sep 11 '21 at 22:57
  • Would be good to have an alternative/solution, see comment in question – user3123159 Dec 09 '22 at 11:17
  • 1
    @user3123159 ? the comment leads to an answer which basically says the same, to remove this warning remove the \\ (that answer is also about \parskip but that is not really related to this question. Misplaced \\give the warning here whether or not parskip is used. – David Carlisle Dec 09 '22 at 11:39
  • once I got the warning with the 2 backslashes, but then the warning disappeared without intervention. – user3123159 Dec 09 '22 at 12:30
  • @user3123159 warnings never disappear without intervention. If the warning changed, the code changed somewhere – David Carlisle Dec 09 '22 at 12:33
-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!

  • 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 09 '23 at 08: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. – Sujit Bhattacharyya May 10 '23 at 10:38
  • 3
    For what do you want an example? For using parskip? → https://tex.stackexchange.com/questions/40429/how-to-use-the-parskip-package-space-in-between-paragraphs 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 '23 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. – barbara beeton May 10 '23 at 13:21
  • Thanks to both barbarabeeton and cabohah for the suggestions. – Sujit Bhattacharyya May 11 '23 at 05:28
  • 5
    sorry this answer is completely wrong, users should never use \\ in this way. – David Carlisle Jun 28 '23 at 10:10