Difference between revisions of "Description"

From ConTeXt wiki
m (Added a typeset example.)
m (Added some better section headings.)
Line 1: Line 1:
< [[From LaTeX to ConTeXt]]
+
< [[From LaTeX to ConTeXt]] >
  
LaTeX:
+
== A Basic Description Environment ==
 +
 
 +
=== LaTeX ===
 
<texcode>
 
<texcode>
 
\documentclass{article}
 
\documentclass{article}
Line 14: Line 16:
 
</texcode>
 
</texcode>
  
ConTeXt: <tt>\setupdescription</tt> with some special parameters
+
=== ConTeXt ===
 +
 
 +
<tt>\setupdescription</tt> with some special parameters
 
(<tt>location=hanging</tt>, <tt>width=broad</tt>,
 
(<tt>location=hanging</tt>, <tt>width=broad</tt>,
 
<tt>margin=</tt><i>indentation</i>)
 
<tt>margin=</tt><i>indentation</i>)
Line 66: Line 70:
 
== Description with minimal label width: ==
 
== Description with minimal label width: ==
  
 
+
=== LaTeX ===
LaTeX:
 
 
<texcode>
 
<texcode>
 
\documentclass{article}
 
\documentclass{article}
Line 79: Line 82:
 
\end{basedescript}
 
\end{basedescript}
 
\end{document}
 
\end{document}
</texcoed>
+
</texcode>
 +
 
 +
=== ConTeXt ===
  
ConTeXt: ???</texcode>
+
{{Howto}}

Revision as of 23:42, 3 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


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