7

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

  • 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
5

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.

  • 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. – yo' Feb 1 '13 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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