3

I'm trying to format a description list with small caps for the labels and have the body text a standard distance from the left margin. When I use capitals in the labels (in the real list they are abbreviations and acronyms) and try to force lowercase and then small caps, I only get the first letter in small caps. Also, the "leftmargin" option seems only to apply if there is a second line (i.e., like a hanging indent). I'd like all the body text to be indented the same amount from the left margin, regardless of the size of the label.

\documentclass[11pt]{memoir}   
\usepackage{enumitem}   

\begin{document}   

\begin{description}[leftmargin=4cm,font=\normalfont\scshape\MakeLowercase]   
   \item[FIRST] My definition here   
   \item[NEXT] and another one   
   \item[AFTER] This is the third   
\end{description}   

\end{document}  
2
  • 1
    I think the problem is that \MakeLowerCase works like \textsc{} not like \scshape i.e. it needs an argument, so can't be used like a font declaration.
    – Seamus
    Feb 1, 2011 at 20:47
  • A possibly relevant link
    – Seamus
    Feb 1, 2011 at 20:48

2 Answers 2

4

To change to lowercase case, you can use the before=... key of enumitem to redefine \makelabel in order to apply \MakeLowercase to the whole label text:

\newcommand{\descriptionmakelabel}[1]{\scshape\MakeLowercase{#1}}
\begin{description}[before=\renewcommand{\makelabel}{\descriptionmakelabel}]

To set the leftmargin automatically to the largest description label, you can use the package eqparbox which allows to make all boxes sharing a same label the same width (requires two compilations). You need of course to make the eqparbox label unique to a particular description, which may be done with a counter. Here's the full code with its result:

result of the code

\documentclass[11pt]{memoir}

\usepackage{enumitem}
\usepackage{eqparbox}

\newcounter{desc}
\newcommand{\descriptionmakelabel}[1]{\eqparbox{descnb\romannumeral\value{desc}}{\scshape\MakeLowercase{#1}\hfill}}

\begin{document}

\begin{description}[before=\refstepcounter{desc}\renewcommand{\makelabel}{\descriptionmakelabel},leftmargin=\eqboxwidth{descnb\romannumeral\numexpr\value{desc}+1\relax}]
   \item[FIRST] My definition here
   \item[NEXT] and another one   
   \item[AFTER] This is the third which is very very very very very very very very very very very very very long
\end{description}

\begin{description}[before=\refstepcounter{desc}\renewcommand{\makelabel}{\descriptionmakelabel},leftmargin=\eqboxwidth{descnb\romannumeral\numexpr\value{desc}+1\relax}]
   \item[A] a short text
   \item[B] a very very very very very very very very very very very very very very very very very very very very long text
\end{description}

\end{document}
1

use a tabular, it makes more sense here:

enter image description here

\documentclass[11pt]{memoir}   
\usepackage{tabularx}   
\def\MyLowercase!#1!{\scshape\MakeLowercase{#1}}
\begin{document}   

\noindent
\begin{tabularx}{\textwidth}{@{}>{\MyLowercase!}p{4cm}<{!}X@{}}   
  FIRST & My definition here\\   
  NEXT  & and another one  and the line can be long as you like it
           there will be a linebreak if needed \\
  AFTER & This is the third   \\
\end{tabularx}   

\end{document} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .