Changes

Jump to navigation Jump to search
686 bytes added ,  15:03, 12 September 2004
added pretty printing and sample
The most basic form of using enumerations in ConTeXt is
<texcode>
\startitemize
\item here we list the points,
\item one after the other.
\stopitemize
</texcode>
The <ttcmd>\startitemize</ttcmd> command takes optional parameters (see the documentation of <ttcmd>\startitemgroup</ttcmd> for a complete list), for example a number conversion may be given, with the following predefined types:
<table>
<tr><td><tt>n </tt> or <tt>N</tt></td><td>Usually the default: a numbered list</td></tr>
<tr><td><tt>m</tt></td><td>A numbered list, with lowercase (&ldquo;medieval&rdquo;, aka &ldquo;oldstyle&rdquo;) numbers.</td></tr>
<tr><td><tt>1</tt> &hellip; <tt>8</tt></td><td>Different kinds of bullets. All items get the same symbol.</td></tr>
</table>
Additional parameters include * <tt>continue</tt> (start where the previous itemization was finished, to allow text injections), * <tt>packed</tt> (less vertical space between items), and * <tt>inmargin</tt> (place enumeration symbols into the margin).
To change the general layout of enumerations, there is <ttcmd>\setupitemize</ttcmd>. Itaccepts an integer as its first parameter to denote for which level of itemization the subsequent settings should apply. There is an example below.
For finer control, it is advisable to create new types of itemization, using the command <tt>\defineitemgroup</tt> (which unfortunately seems undocumented). For example, something similar to the LaTeX <tt>itemize</tt> environment can be defined as follows:
<texcode>
\defineitemgroup[ltxitm][levels=5]
%
%
\stoptext
</texcode>
 
gives
 
<context>
\defineitemgroup[ltxitm][levels=5]
%
\setupitemgroup[ltxitm][1][1]
\setupitemgroup[ltxitm][2][2]
\setupitemgroup[ltxitm][3][3,packed]
\setupitemgroup[ltxitm][4][4,packed]
\setupitemgroup[ltxitm][5][5,packed]
%
\starttext
%
\startltxitm
\item Consider
\startltxitm
\item this part
\item and also these subpoints:
\startltxitm
\item one
\item two
\item three
\startltxitm
\item threeandahalf
\stopltxitm
\item four
\stopltxitm
\stopltxitm
\stopltxitm
%
\stoptext
</context>

Navigation menu