Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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...

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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 (http://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.

share|improve this answer
    
I get a "Underfull \hbox (badness 10000) detected at line .." warning each time I use this. Can that be avoided? –  swenedo Jul 9 '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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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