## LaTeX forum ⇒ General ⇒ Alignment of Description List

LaTeX specific issues not fitting into one of the other forums of this category.
spee
Posts: 4
Joined: Thu Jan 28, 2010 5:50 pm

### Alignment of Description List

I want to change the alignment of a description list so I get the following.
Label is long   text
lab2            blalballalaa
possible second rule
label3          hello world

Guess it's a \renewcommand option, but can't find it.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm
Hi,

you can use some of the features provided by the enumitem package.
1,1,2,3,5,8,13,21,34,55,89,144,233,...

spee
Posts: 4
Joined: Thu Jan 28, 2010 5:50 pm
Probably, but I prefer not adding an package (if possible).

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm
Hi,

you can use a list environment to define a new environment that behaves as you describe. Take a look at the following example code (a slight modification of an example given in The LaTeX Companion):

\documentclass{article}

\newenvironment{mydescription}[1]
{\begin{list}{}%
{\renewcommand\makelabel[1]{##1:\hfill}%
\settowidth\labelwidth{\makelabel{#1}}%
\setlength\leftmargin{\labelwidth}
{\end{list}}

\begin{document}

\begin{mydescription}{longest label}
\item[label1] text text text.
\item[longest label] text text text.
\item[lab2] text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text.
\end{mydescription}

\end{document}

The argument of the mydescription environment specifies the width of the label field (in your case, it corresponds to the widest entry).
1,1,2,3,5,8,13,21,34,55,89,144,233,...

hkarl
Posts: 3
Joined: Mon Jan 09, 2012 7:28 pm
Hi,

I've been trying to replicate this very behavior using enumitem (version 3.5.2), but abysmally. (Very confused by the enumitem manual).

This should be possible, shouldn't it?

Thanks a lot,

Holger
(Too ashamed to post my own trials, non worked...)

Stefan Kottwitz
Posts: 9768
Joined: Mon Mar 10, 2008 9:44 pm
Hi Holger,

I guess it's easier with the mdwlist package.

Stefan

localghost
Site Moderator
Posts: 9203
Joined: Fri Feb 02, 2007 12:06 pm
Stefan_K wrote:[…] I guess it's easier with the mdwlist package. […]

The enumitem package should be preferred as mentioned in the CTAN entry of mdwlist.

Thorsten
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1