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.

I have the following LaTeX code:

\documentclass{article}
\begin{document}
\begin{description}

\item[foo]
bar

\item[baz]

bang

\end{description}

\end{document}

and it produces the following PDF:

enter image description here

I want the definition of the item (in this case the "bar" and the "bang") to be on a separate line from the item (eg the "foo" and the "baz").

However this is part of a system that autogenerates documention, so I can't change the source code. I can put style things in the header of each documention, so I need some sort of LaTeX command that will make all definition list (in LaTeX speak, a "descripition list") go onto a new line.

share|improve this question

migrated from stackoverflow.com Nov 20 '11 at 15:33

This question came from our site for professional and enthusiast programmers.

5 Answers 5

up vote 61 down vote accepted

You can do that with a \hfill, and no extra package or multiple lines of code are needed :)

\begin{description}
  \item[First] \hfill \\
  The first item
  \item[Second] \hfill \\
  The second item
  \item[Third] \hfill \\
  The third etc \ldots
\end{description}

Also contributed here: http://en.wikibooks.org/wiki/LaTeX/List_Structures#Description

share|improve this answer

Will Robertson's answer can affect all the description environments in the entire document. To apply the desired setting to a particular description, you may use [style=nextline] appended to \begin{description}

\usepackage{enumitem}

\begin{description}[style=nextline]
   \item[foo] bar
   \item[baz] bang
\end{description}

This will apply your style only to that particular description. Other descriptions will work with default behavior.

share|improve this answer

With this the label of the first level (of description environment) is aligned with the rest of the text and description texts are aligned with labels. I hope this is about what you want.

\let\origdescription\description
\renewenvironment{description}{
  \setlength{\leftmargini}{0em}
  \origdescription
  \setlength{\itemindent}{0em}
  \setlength{\labelsep}{\textwidth}
}
{\endlist}
share|improve this answer

You could try something like

\usepackage{enumitem}
\setdescription{labelsep=\textwidth}

but a little more massaging is needed with the values of labelindent, etc., to avoid overfull boxes. To first order, however, this gives you the output you're looking for.

share|improve this answer
3  
this causes overfull hbox errors, you should use style=nextline –  jterrace Sep 8 '12 at 20:44

If you are using enumitem, the correct way to set the default style is like this:

\usepackage{enumitem}
\setlist[description]{style=nextline}
share|improve this answer
    
This appears to be the most elegant solution. –  Evgeni Sergeev Jul 26 '13 at 3:25
    
I have to say, the enumitem documentation does a poor job of explaining this behaviour: "nextline: if the label does not fit in the margin, the text continues in the next line" I read this and disregarded it because I wanted a line break regardless of the label width. Well, good thing I found your answer, thanks! –  Christian Apr 16 at 21:18

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.