[Tex/LaTex] Underfull hbox error using \newline and \hfill\break

line-breaking

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}

Best Answer

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.