1

This is a question dealing with underfull \hbox badness when newlines are entered using \\.



\documentclass[12pt]{memoir}
\usepackage{lipsum}
\usepackage{polyglossia} % the multilingual support package

\setromanfont[Ligatures=TeX]{Linux Libertine O}
\def\mverse{\ifhmode \par \fi
   \goodbreak \addvspace{3ex} \refstepcounter{section}
   \centerline{\textbf{Verse \arabic{section}}}\medskip}

\newenvironment{customtext}%
  {\leftskip=1em \rightskip=1em }%
  {\ifhmode \par \fi}
\newcommand\mstyle[1]{\begin{customtext}\setlength{\parindent}{0pt}{\large
    \textbf{#1}} \\
    {\sffamily #1}\end{customtext}\medskip}

\begin{document}

\mverse
\mstyle{This is a custom verse}
\lipsum

The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.

\mverse
\mstyle{
This is verse 2 line 1\\
The is verse 2 line that is a long line in for one type of fonts and can be accommodated in a single line %adding a \\ at the end of line will cause hbox badness
}

The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.

\end{document}

the mstyle macro can take more one than one line of verse separated by \\ and then correspondingly display in multiple languages. That's the intent. However this produces widespread underfull \hbox.

How can hbox badness be avoided in such cases? The discussion: How to properly code a TeX file, or at least avoid `badness 10000` offered some insight that a multline environment may prevent it. I am unable to wrap them in a multline begin/end block. Are there alternatives?

7
  • 1
    You should never get an underfull hbox from \\ If you are getting that message your input is wrong. Usually the underfull badness 10000 message means that you have used \\ at the end of a paragraph, where it should never be used. It is hard to give specific help as you have shown no code. Oct 2 '15 at 21:35
  • I did not want to repeat the code. It is the same as in previous post : tex.stackexchange.com/questions/270540/…
    – jayr
    Oct 2 '15 at 21:39
  • that question is not at all clear and this reference to it is even less so, I just tried the example in that question and it produces no underfull box warnings just two overfull ones because of the pseudo-Latin used with english hyphenation patterns. How does that relate to this question about underfull hbox warnings? Oct 2 '15 at 21:42
  • please add an example document to this question that generates an underfull box message. Otherwise I can't see how it can be answered so would be closed as unclear. Oct 2 '15 at 21:49
  • Problem seem to be solved. Your initial comment helped. It was the final `\\` that was entered at the end of the last line of the verse which caused the badness. As to example, the principle is same; my actual situation using sanskrit fonts and requires some setup to successfully reproduce. In my example code, the verses were simple one line verses.
    – jayr
    Oct 2 '15 at 21:52