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.

As the title says: labelsep setting in the enumitem package ignores the stretch part. I would be happy to have a stretch there (in the end actually the current font's interword stretch achieved by \fontdimen2\font plus 5em minus\fontdimen4\font).

See the MWE (the value 0pt plus 400pt is of course extreme, but it nicely shows what happes):

enter image description here

\documentclass{article}

\usepackage[textwidth=4cm,textheight=5cm]{geometry}
\usepackage{showframe}

\usepackage{enumitem}

\newskip\mydescskip
\mydescskip0pt plus 400pt

% TRY EITHER ONE OF THESE TWO OPTIONS
\setlist[description]{labelsep=\mydescskip, leftmargin=0pt}
%\setlist[description]{labelsep=0pt plus 400pt, leftmargin=0pt}

\begin{document}

\texttt{REAL OUTPUT:}

\begin{description}
\item[X]
AAA\hspace{\mydescskip}BBB xxxxxxxxxxxxxxxx
\end{description}

\texttt{DESIRED OUTPUT:}

\noindent\textbf{X}\hspace{\mydescskip}%
AAA\hspace{\mydescskip}BBB xxxxxxxxxxxxxxxx

\end{document}

Since it is a part of a class, the solution must be as clean as possible (and surely mustn't require any change in UI).

share|improve this question
3  
it sets latex's \labelsep register but that is a dimen not a skip, so allowing stretch there would take you deep into latex list internals. might be easier to patch item add an additional skip after the \item (no time now:-) –  David Carlisle Jan 31 '13 at 18:13
add comment

1 Answer

up vote 5 down vote accepted

The parameter \labelsep is a \dimen and LaTeX uses it as such, so no matter how much stretch you specify it will be ignored. Probably the best is to change the meaning of \item so that it adds the skip after it; this shouldn't be a problem as you don't \label description items.

\setlist[description]{
  leftmargin=0pt,
  labelsep=0pt,
  before=\let\item\descitem,
}

\let\oriitem\item
\newcommand\descitem[1][]{\oriitem[#1]\hspace{\mydescskip}\ignorespaces}

The result is the following:

enter image description here

I don't think it's a good idea to have a stretchable labelsep, though.

share|improve this answer
    
ad "not a good idea": It is IMHO useful for description where all the spaces in \item[...] and all the spaces in the latter text are stretchable. The space after \item is there quite naturally an interword (or an interseqence) space. –  tohecz Feb 1 '13 at 11:13
add comment

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.