5

I would like to have two lines for long description names in the description environment. The only help I could find is here. Where they have the following code.

\begin{description}
   % won't work
   \item[first line\\second line]
   % won't work
   \item[first line\newline second line]
   % will work
   \item[{\parbox[t]{3cm}{first line\\second line}}]
\end{description}

But this doesn't look nice, I have a long paragraph on the item and the second line of the paragraph starts below the second line of the item label.

1 Answers1

5

For single-line item data, use \stackunder{}{}. For multi-line item data, use \smash{\stackunder{}{}}.

Also shown is the use of \smash{\Longunderstack{...\\...\\...}} in the event the label gets to be longer than 2 lines.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\usepackage{lipsum}
\begin{document}
\renewcommand\stackalignment{r}% RIGHT ALIGNED STACKS
\renewcommand\stacktype{L}% MAKE STACKS OBEY FIXED BASELINESKIP
\strutlongstacks{T}% TO GET PROPER SPACING FOR SINGLE-LINE ITEMS
\begin{itemize}
   \item[\stackunder{first line}{second line}] blah blah
   \item[\smash{\stackunder{first line}{second line}}] \lipsum[4]
   \item[\smash{\Longunderstack{first\\second\\third}}] \lipsum[3]
\end{itemize}
\end{document}

enter image description here

You could add \bfseries before the stack, if you wanted it in boldface.

As Bernard notes, the title bleeds into the left margin, which is a standard behavior for itemize. The way to alleviate that is to select leftmargin that allows for the widest label:

\documentclass{article}
\usepackage[pass,showframe]{geometry}
\usepackage[usestackEOL]{stackengine}
\usepackage{lipsum,enumitem}
\begin{document}
\renewcommand\stackalignment{r}% RIGHT ALIGNED STACKS
\renewcommand\stacktype{L}% MAKE STACKS OBEY FIXED BASELINESKIP
\strutlongstacks{T}% TO GET PROPER SPACING FOR SINGLE-LINE ITEMS
\begin{itemize}[leftmargin=53pt]
   \item[\stackunder{first line}{second line}] blah blah
   \item[\smash{\stackunder{first line}{second line}}] \lipsum[4]
   \item[\smash{\Longunderstack{first\\second\\third}}] \lipsum[3]
\end{itemize}
\end{document}

enter image description here