Difference between revisions of "Description"

From ConTeXt wiki
(Suggestion for description solution)
m (\starttext and \stoptext added)
Line 2: Line 2:
  
 
LaTeX:
 
LaTeX:
<pre>
+
<small><pre>
 
\documentclass{article}
 
\documentclass{article}
 
\begin{document}
 
\begin{document}
Line 12: Line 12:
 
\end{description}
 
\end{description}
 
\end{document}
 
\end{document}
</pre>
+
</pre></small>
  
 
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>)
  
<pre>
+
<small><pre>
 
\definedescription[notation][
 
\definedescription[notation][
   headstyle=bold,style=normal,
+
   headstyle=bold,style=normal,align=left,location=hanging,
  align=left,
+
   width=broad,margin=1cm]
  location=hanging,
 
   width=broad,
 
  margin=1cm,
 
  ]
 
  
 +
\starttext
 
\notation{A very very very very long item}
 
\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 bla bla bla bla bla bla bla bla bla bla 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}
 
\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 bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
+
   bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
 +
  bla bla bla bla
  
</pre>
+
\stoptext
 +
</pre></small>
  
 
The empty lines (or <tt>\par</tt>) after each description
 
The empty lines (or <tt>\par</tt>) after each description
Line 41: Line 41:
  
 
<b>Hint:</b> This solution uses the <tt>distance=</tt><i>dimension</i>
 
<b>Hint:</b> This solution uses the <tt>distance=</tt><i>dimension</i>
distance for separation of label and text. I could not find a solution
+
distance for separation of label and text. I could not find a
yet, which aligns the text in the first line with that of the other
+
solution yet, which aligns the text in the first line with that of the other lines, if the label is short enough.
lines, if the label is short enough.
 

Revision as of 06:24, 30 July 2004

< 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) seem to be necessary.

Hint: This solution uses the distance=dimension distance for separation of label and text. I could not find a solution yet, which aligns the text in the first line with that of the other lines, if the label is short enough.