Difference between revisions of "Description"
Jump to navigation
Jump to search
m (fix some display problems) |
(Added improved explanation (after looking this up in the LaTeX manual), example.) |
||
Line 4: | Line 4: | ||
=== LaTeX === | === LaTeX === | ||
+ | |||
+ | LaTeX provides a <tt>description</tt> environment, which works just like an itemized or enumerated list except that the item labels are specified by an (optional) argument to the <tt>\item</tt> command, rather than being automatically generated. This is useful for making lists of definitions and other sorts of descriptions that are headed by a keyword. | ||
+ | |||
<texcode> | <texcode> | ||
\documentclass{article} | \documentclass{article} | ||
\begin{document} | \begin{document} | ||
\begin{description} | \begin{description} | ||
− | \item[Short label | + | \item[Short] This is a shorter item label, and some text that talks about it. |
− | + | The text is wrapped into a paragraph, with successive lines indented. | |
− | \item[ | + | \item[Rather longer label] This is a longer item label. As you can see, the |
− | + | text is not started a specified distance in -- unlike with other lists -- but | |
+ | is spaced a fixed distance from the end of the label. | ||
\end{description} | \end{description} | ||
\end{document} | \end{document} |
Revision as of 19:14, 4 September 2005
Contents
A Basic Description Environment
LaTeX
LaTeX provides a description environment, which works just like an itemized or enumerated list except that the item labels are specified by an (optional) argument to the \item command, rather than being automatically generated. This is useful for making lists of definitions and other sorts of descriptions that are headed by a keyword.
\documentclass{article} \begin{document} \begin{description} \item[Short] This is a shorter item label, and some text that talks about it. The text is wrapped into a paragraph, with successive lines indented. \item[Rather longer label] This is a longer item label. As you can see, the text is not started a specified distance in -- unlike with other lists -- but is spaced a fixed distance from the end of the label. \end{description} \end{document}
ConTeXt
\setupdescription with some special parameters (location=hanging, width=broad, margin=indentation)
\definedescription[notation][ headstyle=bold,style=normal,align=left,location=hanging, width=broad,margin=1cm] \starttext \notation{A very very very very long item} bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla \notation{i} bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla \stoptext
The empty lines (or \par) after each description (here notation) are necessary.
The result looks like this:
Hint: This solution uses the distance=dimension distance for separation of label and text.
Description with minimal label width:
LaTeX
\documentclass{article} \usepackage{mdwlist} \begin{document} \begin{basedescript}{\desclabelstyle{\pushlabel}\desclabelwidth{6em}} \item[Label] bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla \item[Very long label] bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla \end{basedescript} \end{document}
ConTeXt
Using an explicit dimension as argument for the 'width' parameter sets the label to 6em: