# Make the lines of a description item line up

I am trying to line up the lines of a single description item. When I introduce a line-break or when the line becomes to long, the new line isn't lined up with the first one. I'm aware of the fact that the first line has to deal with the space that is taken by the label, but I want other lines to start a the same position (horizontally) no matter what. Here is an exemplary code which illustrates my problem:

\documentclass[12pt,a4paper]{article}
\begin{document}
\begin{description}
\item [Label]Here is a long item that requires a line break. The second line of this item
won't line up with the first word. I can achieve this manually\\ \hspace*{2mm} by forcing a
line break and setting an apropriate value in \textbackslash hspace*, but I want this to be
\end{description}

\end{document}


It comes out looking like this:

I appreciate any help on this. It is driving me nuts.

• Welcome to TeX.SX! It's rather complicated to align as you want a description, because the labels can have varying width. Could you be more specific? Jan 22, 2014 at 17:04
• Maybe the environment labeling from the koma-script package might be an alternative. Jan 22, 2014 at 17:09
• I asked something similar here: tex.stackexchange.com/q/56809/10898 Jan 22, 2014 at 18:58
• I have no problem whatoever with alignments in such a situation. Is there something I didn't grasp? Jan 22, 2014 at 19:22

If i did understand you correctly, the labeling environment provided by the KOMA-script package does the job you want:

\documentclass[12pt,a4paper]{article}
\usepackage{scrextend}
\usepackage{blindtext}
\setkomafont{labelinglabel}{\bfseries}
\usepackage{showframe}
\begin{document}
\begin{labeling}{A long long label}%Giving the longest label for alignment
\item [Label]
Here is a long item that requires a line break. The second
line of this item won't line up with the first word. I can
achieve this manually\\
by forcing a line break and setting an apropriate value in
\textbackslash hspace*, but I want this to be automised.
\item [A long long label]
a manual linebreak, though not
recommended \\
\blindtext
\end{labeling}
\end{document}


Here package scrextend provides all you need, switching to a koma class (scrartcl) could be an advantage. The labeling environment takes the longest label as the argument, needed for the right alignment. This argument can also be shorter, just play a bit.

As an alternative to a KOMA class or to scrextend, you can use the enumitem package, setting the key labelwidth to the width of your label.

I got this solution by combining (a) Bernard's answer to Simple chronology using the description environment and (b) Bernard's answer to How to set leftmargin of description to width of a particular label in enumitem?. You can find the same solution in Gonzalo Medina's answer to Description list with aligned descriptions.

\documentclass[12pt,a4paper]{article}
\usepackage{enumitem}
\begin{document}
\begin{description}[%
labelwidth=3cm,%
leftmargin=!%
]
\item [Label]Here is a long item that requires a line break. The second line of this item
won't line up with the first word. I no longer need to achieve this manually by forcing a
line break and setting an appropriate value in \textbackslash hspace*.

Here's a second paragraph of the same item.
\item [A longer label]Here is a second item. It has a longer label, necessitating a larger labelwidth.
\end{description}
\end{document}


Here's the output:

You can also calculate the width of the widest label by adding the calc package and using its \widthof command:

\documentclass[12pt,a4paper]{article}
\usepackage{enumitem}
\usepackage{calc}% Supports \widthof command
\begin{document}
\begin{description}[%
labelwidth=\widthof{\bfseries A longer label},%
leftmargin=!%
]
\item [Label]Here is a long item that requires a line break. The second line of this item
won't line up with the first word. I no longer need to achieve this manually by forcing a
line break and setting an appropriate value in \textbackslash hspace*.

Here's a second paragraph of the same item.
\item [A longer label]Here is a second item. It has a longer label, necessitating a larger labelwidth.
\end{description}
\end{document}


This gives essentially the same output. Note in \widthof{\bfseries A longer label}, the necessity of specifying \bfseries: The label is typeset as bold. You need to make sure that the text whose width you measure with \widthof is also typeset as bold.

You can go a step further in automation by having the environment automatically determine which label is widest. See Gonzalo Medina's answer to Automatically set description list labelwidth based on widest label?.