[Tex/LaTex] underfull \hbox (badness 10000) in paragraph

line-breakingspacingwarnings

Why do I get the message:

Underfull \hbox (badness 10000) in paragraph at lines 107–108

I want a blank line between the problem name and the table, but if I use \\ or \newline along with a blank space, or if I use two \newline, I get the "underfull \hbox" message.

\begin{solution}{1.2}\newline % Line 107

    \newlength{\mylen}\settowidth{\mylen}{$p \to q$}% Widest element
        \begin{tabular}{*{5}{|>{\centering\arraybackslash\rule{0pt}{1.05em}}m{\mylen}}|}
            \hline
            $p$ & $q$ & $p \land q$ & $p \lor q$ & $p \to q$\\
            \hline
            T & T & T & T & T\\
            \hline
            T & F & F & T & F\\
            \hline
            F & T & F & T & T\\
            \hline
            F & F & F & F & T\\
            \hline
        \end{tabular}
    \end{solution}

Best Answer

Inserting \par\vspace{\baselineskip} would provide you with a single line gap between two paragraphs. In the following minimal example, a mock-up of a solution environment adds \par\nobreak\vspace{\baselineskip} after every \begin{solution}{<stuff>} (the \nobreak addition discourages page breaking after printing the environment header). If you don't want it this way, you can add the gap manually by removing \par\vspace{\baselineskip} from the definition of \begin{solution}:

enter image description here

\documentclass{article}
\usepackage{array}% http://ctan.org/pkg/array

\newenvironment{solution}[1] % solution environment
  {\par\textbf{Solution\ #1}:\par\nobreak\vspace{\baselineskip}}% \begin{solution}
  {}% \end{solution}

\begin{document}
\begin{solution}{1.2} % Line 107
  \newlength{\mylen}\settowidth{\mylen}{$p \to q$}% Widest element
  \begin{tabular}{*{5}{|>{\centering\arraybackslash\rule{0pt}{1.05em}}m{\mylen}}|}
    \hline
    $p$ & $q$ & $p \land q$ & $p \lor q$ & $p \to q$\\
    \hline
    T & T & T & T & T \\
    \hline
    T & F & F & T & F \\
    \hline
    F & T & F & T & T \\
    \hline
    F & F & F & F & T \\
    \hline
  \end{tabular}
\end{solution}
\end{document}

You might also consider using \smallskip, \medskip or \bigskip, each of which allows for some stretching/shrinking within the text.