6

I am trying to remove warnings/errors from the document I am writing that includes underfull (and overfull) \hboxs from the code below. Why does \newline and \hfill\break produce this warning? Aren't these commands supposed to fill lines and remove this error?

I am new to LaTeX (and this forum), I have been searching through several (already asked) questions, and guides (including 'The Not So Short Introduction to LaTeX' (Oetiker 2015), and 'LaTeX' (en.wikibooks.org)), all of which say that this is supposed to remove this error, but it doesn't seem to be the case. I am using TeXstudio 2.10.8, and MiKTeX 2.9 if it makes any difference.

This is the code I tried:

\documentclass[12pt, twoside, onecolumn]{book} \begin{document} \noindent \emph{I want this text to act as a heading} \newline \newline By having it separated by a line \newline \end{document} 
5
  • 1
    Welcome to TeX.SX! Don't use \newline. Just leave an empty line! Commented May 8, 2016 at 9:00
  • 2
    Welcome, i suspect you want a paragraph break there with some vertical space, correct? If so, use something like \medbreak. Depending on what you want to do, setting up an extra sectioning comand might be a much better idea. Commented May 8, 2016 at 9:00
  • 2
    If you find yourself using \newline or \\ in a document then something is wrong, certainly never use two consecutive ones or use such a command at the end of a paragraph. Commented May 8, 2016 at 9:08
  • 1
    @Johannes_B good suggestion. But ChristianHupfer, and DavidCarlisle if I shouldn't use \newline, when should it be used, and why does it produce an Underfull \hbox? Commented May 8, 2016 at 10:30
  • 2
    Using \newline is a very common thing starters understand wrong. Best choice between using \\ or leaving space after each paragraph to end the paragraph and When to use \par and when \\ Commented May 8, 2016 at 10:35

1 Answer 1

2

Simply remove the \newline then the error will go. In comments you ask why adding a \newline at the end of the paragraph produces a warning.

\emph{I want this text to act as a heading} \newline 

forces a line break right at the end of the paragraph this produces a spurious empty line following this forced break with no content so it is very under full and produces the maximum badness of 10000.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.