Difference between revisions of "Description"

From ConTeXt wiki
(example with mdwlist)
(changed to texcode instead of pre)
Line 2: Line 2:
  
 
LaTeX:
 
LaTeX:
<small><pre>
+
<texcode>
 
\documentclass{article}
 
\documentclass{article}
 
\begin{document}
 
\begin{document}
Line 12: Line 12:
 
\end{description}
 
\end{description}
 
\end{document}
 
\end{document}
</pre></small>
+
</texcode>
  
 
ConTeXt: <tt>\setupdescription</tt> with some special parameters
 
ConTeXt: <tt>\setupdescription</tt> with some special parameters
Line 18: Line 18:
 
<tt>margin=</tt><i>indentation</i>)
 
<tt>margin=</tt><i>indentation</i>)
  
<small><pre>
+
<texcode>
 
\definedescription[notation][
 
\definedescription[notation][
 
   headstyle=bold,style=normal,align=left,location=hanging,
 
   headstyle=bold,style=normal,align=left,location=hanging,
Line 35: Line 35:
  
 
\stoptext
 
\stoptext
</pre></small>
+
</texcode>
  
 
The empty lines (or <tt>\par</tt>) after each description
 
The empty lines (or <tt>\par</tt>) after each description
Line 43: Line 43:
 
distance for separation of label and text.
 
distance for separation of label and text.
  
<b>Description with minimal label width:</b>
+
 
 +
== Description with minimal label width: ==
 +
 
  
 
LaTeX:
 
LaTeX:
<small><pre>
+
<texcode>
 
\documentclass{article}
 
\documentclass{article}
 
\usepackage{mdwlist}
 
\usepackage{mdwlist}
Line 57: Line 59:
 
\end{basedescript}
 
\end{basedescript}
 
\end{document}
 
\end{document}
</pre></small>
+
</texcoed>
  
ConTeXt: ???
+
ConTeXt: ???</texcode>

Revision as of 18:17, 26 July 2005

< From LaTeX to ConTeXt

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.

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: ???