2

Is there a package or something that allows me to create a list (like description) that looks like a glossaries list, where the descriptions are indented the same length? Like it is if the glossary-superragged style is used in the glossaries package.

I know this could be achieved by creating a two column table, but I think that is cumbersome.

This thread describes how to do such a description list with or without bullets, but it doesn't say if it is possible to get the right "column" indented...

swenedo
  • 297

1 Answers1

3

The glossary-superragged style reserves 0.6\hsize for the description text. Using enumitem we can set the label width to 0.4\hsize and indent the description this far, as follows:

Sample output

\documentclass{article}

\usepackage{enumitem}
\usepackage{etoolbox}
\let\bulletdescriptionlabel\descriptionlabel
\patchcmd\bulletdescriptionlabel
  {#1}
  {{\normalfont\textbullet\ }#1\hfil}
  {}{}

\newlist{mydescription}{description}{1}
\setlist[mydescription]
  {before=\let\makelabel\bulletdescriptionlabel,leftmargin=0.4\hsize,labelindent=0em,itemindent=!,labelwidth=!}

\begin{document}

\begin{mydescription}
\item[First heading] A description text that is long enough to
  spread on to the next line, and saying absolutely nothing.
\item[Second heading] A description text that is long enough to
  spread on to the next line, and saying absolutely nothing.
\item[Third rather longer heading] A description text that is long enough to
  spread on to the next line, and saying absolutely nothing.
\end{mydescription}

\end{document}

This builds on @egreg's last solution in the question you link to (https://tex.stackexchange.com/a/60282/15925). A final \hfil has been added to the labels to make them left-aligned. The main indentation is acheived by setting leftmarigin to 0.4\hsize and labelindent to zero. The remaining parameters are computed by enumitem via the ! options, so that labelwidth+labelsep equals our leftmargin.

Andrew Swann
  • 95,762
  • I get a "Underfull \hbox (badness 10000) detected at line .." warning each time I use this. Can that be avoided? – swenedo Jul 09 '13 at 14:20
  • The code above produces not such warning for me. Check first that you are using the latest versions of the packages. Otherwise, perhaps you should post a separate question with your sample code. – Andrew Swann Jul 18 '13 at 13:42