0

When using custom list

\newenvironment{questions}{
    \begin{list}{}{
            \let\makelabel=\questionlabel
            \setlength{\labelwidth}{1.5em}
            \setlength{\labelsep}{0.1em}
            \setlength{\leftmargin}{\labelwidth+\labelsep+0.5em}
            \setlength{\itemsep}{\baselineskip}
            \setlength{\listparindent}{1em}
            \setlength{\parsep}{0pt}
            \setlength{\topsep}{0pt}
        } 
    }{ 
    \end{list}
}

Inside multicol environment I get a warning Underfull \hbox (badness 10000) detected at line 38. If I use enumerate instead, there is no warnings.

MWE

\documentclass[10pt]{book}


\usepackage{calc}
\usepackage{enumitem}
\usepackage{multicol}

\newcounter{qcounter}

\makeatletter
\newcommand*\questionlabel[1]{\refstepcounter{qcounter}%
    \global\let\@currentlabel=\@currentlabel
    \normalfont\bfseries\arabic{qcounter}.#1}

\newenvironment{questions}{
    \begin{list}{}{
            \let\makelabel=\questionlabel
            \setlength{\labelwidth}{1.5em}
            \setlength{\labelsep}{0.1em}
            \setlength{\leftmargin}{\labelwidth+\labelsep+0.5em}
            \setlength{\itemsep}{\baselineskip}
            \setlength{\listparindent}{1em}
            \setlength{\parsep}{0pt}
            \setlength{\topsep}{0pt}
        } 
    }{ 
    \end{list}
}

\newcommand{\TT}{\item[]}


\begin{document}

        \begin{multicols}{2}
            \begin{questions}

                \TT Some text

                \TT Some text

                \TT Some text

                \TT Some text

            \end{questions}
        \end{multicols}


\end{document}

How can I get rid of this warning?

1 Answer 1

1

You have a fixed width label but no stretchy glue so every label is infinitely underfull as it can not strtech:

add \hfill:

\newcommand*\questionlabel[1]{\refstepcounter{qcounter}%
    \global\let\@currentlabel=\@currentlabel
    \normalfont\bfseries\arabic{qcounter}.#1\hfill}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.