Difference between revisions of "Description"

From ConTeXt wiki
(answered 'minimal label width' (perhaps))
m (fix some display problems)
Line 45: Line 45:
  
 
The result looks like this:
 
The result looks like this:
 +
 
<context>
 
<context>
 
\definedescription[notation][
 
\definedescription[notation][
Line 86: Line 87:
 
=== ConTeXt ===
 
=== ConTeXt ===
  
This sets the label width to 6em:
+
Using an explicit dimension as argument for the 'width' parameter
 +
sets the label to 6em:
  
 
<context>
 
<context>
Line 106: Line 108:
 
\stoptext
 
\stoptext
 
</context>
 
</context>
 
{{Howto}}
 

Revision as of 08:53, 4 September 2005

< From LaTeX to ConTeXt >

A Basic Description Environment

LaTeX

\documentclass{article}
\begin{document}
\begin{description}
\item[Short 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 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 bla bla
\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: