5

I want to make a two column list of items and descriptions in which the item name is allowed to spill over to the description column, but will then force the description to the next line.

I see this all the time in programming manuals, but can't find how to code it.

E.g.

...

enter image description here

...

PS: I have heard about texinfo and believe that this might be one of the native commands there, but I want to use it with an ordinary LaTeX document. If it is possible to set the first column (function names) to \texttt too that would be perfect!

1
  • enumitem can pull this and many more off. – percusse Nov 26 '13 at 5:54
9

As mentioned by percusse, this is easy with the package enumitem.

enter image description here

Code

\documentclass{article}
\usepackage{enumitem}
\setlist[description]{font=\ttfamily,leftmargin=2cm,style=nextline}

\begin{document}

\begin{description}
  \item[exception unhandled] An exception that was raised but it is not handled by the program.
  \item[assert] A failed Ada assertion.
  \item[exec] A call to \texttt{exec}. This is currently only available for HP-UX and \textsc{gnu}-Linux.
\end{description}

\end{document} 

The command \setlist allows you to define global options for enumerate-like environments (description in your case).

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.