2

I am trying to make a description list in which an item has quite a long name and the text goes off of the page to the right instead of wrapping to the next line.

\documentclass[12pt]{article}

\begin{document}

\begin{description}
    \item[The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy dog] Lorem me some ipsum yo
\end{description}

\end{document}

enter image description here

I have tried putting \\, \hfill, \newline, \linebreak, and \break inside the square brackets between the words, but nothing seems to work.

1 Answer 1

4

The optional argument of \item[] inside a description list is set in a box in bold. This box doesn't care for any of \\, \hfill, \newline, linebreak or \break, hence the output.

This may be a special case of your item, so you may want to handle it in that way:

enter image description here

\documentclass[12pt]{article}

\begin{document}

\begin{description}
    \item[The quick brown fox jumps over the lazy dog 
      The quick brown fox jumps over the lazy dog 
      The quick brown fox jumps over the lazy dog]
      Lorem me some ipsum yo

    \item\hspace*{-\labelsep}{\bfseries The quick brown fox jumps over the lazy dog 
      The quick brown fox jumps over the lazy dog 
      The quick brown fox jumps over the lazy dog}\hspace*{\labelsep}
      Lorem me some ipsum yo

\end{description}

\end{document}

The idea is to set the regular label as part of the item but compensating for the \labelsep gap. The above is the default output when using the style=sameline option with enumitem:

\documentclass[12pt]{article}
\usepackage{enumitem}
\begin{document}

\begin{description}[style=sameline]
    \item[The quick brown fox jumps over the lazy dog 
      The quick brown fox jumps over the lazy dog 
      The quick brown fox jumps over the lazy dog]
      Lorem me some ipsum yo
\end{description}

\end{document}

You could also manipulate the paragraph shape, depending on the type out output you're interested in:

enter image description here

\documentclass[12pt]{article}

\begin{document}

\begin{description}
    \item[The quick brown fox jumps over the lazy dog 
      The quick brown fox jumps over the lazy dog 
      The quick brown fox jumps over the lazy dog]
      Lorem me some ipsum yo

    \item \parshape 4 \dimexpr\leftmargin-\labelsep\relax \dimexpr\linewidth-\leftmargin+\labelsep\relax
                      0pt \linewidth
                      0pt \linewidth
                      \leftmargin \dimexpr\linewidth-\leftmargin\relax%
      {\bfseries The quick brown fox jumps over the lazy dog 
      The quick brown fox jumps over the lazy dog 
      The quick brown fox jumps over the lazy dog}\hspace*{\labelsep}
      Lorem me some ipsum yo Lorem me some ipsum yo Lorem me some ipsum yo Lorem me some ipsum yo Lorem me some ipsum yo

\end{description}

\end{document}
1
  • Worked perfectly; thank you for your timely response.
    – WaTermeloN
    Commented Nov 19, 2014 at 1:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .