Difference between revisions of "Description"

From ConTeXt wiki
m (Added some better section headings.)
(answered 'minimal label width' (perhaps))
Line 85: Line 85:
  
 
=== ConTeXt ===
 
=== ConTeXt ===
 +
 +
This sets the label width to 6em:
 +
 +
<context>
 +
\definedescription[notation][
 +
  headstyle=bold,style=normal,align=left,location=hanging,
 +
  width=6em]
 +
 +
\starttext
 +
\notation{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
 +
 +
\notation{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 bla bla
 +
 +
\stoptext
 +
</context>
  
 
{{Howto}}
 
{{Howto}}

Revision as of 08:50, 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

This sets the label width to 6em:


The author of this entry is looking for a solution for the described problem. (See: How to?)