Changes

Jump to navigation Jump to search
3,532 bytes added ,  12:03, 16 April 2022
< [[Structurals]]
 
= Overview of commands =
</table>
It is also possible to define your own number conversions; see [[User-Defined Enumerations]]. If you have loaded the [[Chinese]] module, you You can also use <tt>ccn</tt> (and some more) for Chinese numbers. When the selected language is Slovenian or Spanish, items are numbered using their proper alphabets (the Slovenian enumeration includes č, š and ž; the Spanish enumeration includes ñ). You can change to the international enumeration with <code>alphabetic</code>, <code>Alphabetic</code>.
Additional parameters include
* <tt>continue</tt> (start where the previous itemization was finished, to allow text injections),
* <tt>reverse</tt> (numbers the items in reverse, i.e. descending, order),
* <tt>packed</tt> (less vertical space between items),
* <tt>inmargin</tt> (place enumeration symbols into the margin), and
You will find more about {{cmd|setupitemize}} at {{cmd|setupitemgroup}} and {{cmd|defineitemgroup}}.
 
== \item (and friends) ==
 
* {{cmd|item}} to print ordinary items
* {{cmd|sym}} to print an item with a custom symbol
* {{cmd|mar}} to print an item with margin text
* {{cmd|sub}} to print an item with a continuation mark
* {{cmd|its}} to print an item with a row of marks (for response ranges)
* {{cmd|ran}} to print a range for the {{cmd|its}} row
* {{cmd|head}} to print a head within the list
* {{cmd|but}} to print an item whose mark is an interactive button
== \defineitemgroup ==
|
| <context>
\setuppapersize[A7]
\defineitemgroup[ltxitm][levels=5]
%
|-
|<context>
\setuppapersize[A8,landscape]
\starttext
\setupitemize[left=(, right=), margin=4em, stopper=]
|-
|<context>
\setuppapersize[A8,landscape]
\starttext
\startitemize[R,fit][itemalign=flushright,stopper={ --- }]
|-
|<context>
\setuppapersize[A8,landscape]
\starttext
\startitemize[n,packed][start=42,stopper={\space}]
|-
|<context>
\setuppapersize[A8,landscape]
\starttext
\startitemize[a,packed]
<context source=yes>
\setuppapersize[A7]
 
% Indentation is a bit odd; cannot reproduce off-wiki.
<context source=yes mode=mkiv>
\setuppapersize[A7]
 
\setupitemgroup[itemize][1][n,repeat][width=1em]
\setupitemgroup[itemize][2][a,repeat][width=2em]
<context>
\setuppapersize[A7]
\setuplayout[scale=0.8,width=9cm]
\setupwhitespace[big]
\startcolumns
{\bf joinedup:} \par before \startitemize[joinedup] \item test \item test \stopitemize after \par
{\bf nowhite:} \par before \startitemize[nowhite] \item test \item test \stopitemize after \par
{\bf joinedup,nowhite:} \par before \startitemize[joinedup,nowhite] \item test \item test \stopitemize after \column
{\bf joinedup,nowhite,before:} \par before \startitemize[joinedup,nowhite,before] \item test \item test \stopitemize after \par
\stopcolumns
</context>
 
 
 
It is also (at least in mkiv) possible to do
<texcode>
Text before
\startitemize[before={\blank[small]},after={\blank[small]},inbetween={\blank[medium]}]
\item test
\item test
\stopitemize
Text after
</texcode>
to control the vertical space.
 
|
|<context>
\setuppapersize[A7]
\startitemize[width=1em,distance=0pt]
\item Using width=1em,distance=0pt
|
|<context>
\setuppapersize[A8,landscape]
\starttext
\item one
\item two
\stopitemize
 
And the text continues after the list
 
\stoptext
 
</context>
|}
 
From a discussion on the mailing list, the following was suggested (note that you have to enclose your items in {{cmd|startitem}} and {{cmd|stopitem}}, using {{cmd|item}} only does not work):
 
{|
! width="35%"|
! width="5%"|
! width="60%"|
|-
| <texcode>
\starttext
 
Some previous sentence before the list
 
\startitemize[a,horizontal,three]
\startitem first \stopitem
\startitem second \stopitem
\startitem third \stopitem
\startitem fourth \stopitem
\startitem fifth \stopitem
\startitem sixth \stopitem
\stopitemize
 
And the text continues after the list
 
\stoptext
</texcode>
|
|<context>
\setuppapersize[A8,landscape]
\starttext
 
Some previous sentence before the list
 
\startitemize[a,horizontal,two]
\startitem first \stopitem
\startitem second \stopitem
\startitem third \stopitem
\startitem fourth \stopitem
\stopitemize
== Randomizing items ==
It is possible to make ConTeXt randomize the items in enumerations; this can come handy when, e.g., typesetting tests. You have to add a <tt>random</tt> option to <{{cmd>|startitemize</cmd>}}. There are two caveatsis a caveat:# You have to say <{{cmd>|startitem</cmd> }} ... <{{cmd>|stopitem</cmd> }} instead of <{{cmd>|item</cmd> ..}} . .# Somehow the first item does not get randomized. (I learned from the mailing list - thanks, Aditya! - that adding a <cmd>nextrandom</cmd> somewhere earlier helps.)
Example:
|-
| <texcode>
\nextrandom
\startitemize[random]
\startitem A \stopitem
|
| <context>
\nextrandom
\startitemize[random]
\startitem A \stopitem
|
| <context>
\setuppapersize[A8,landscape]
\starttext
\startitemize[n]
As seen in \in{item}[foo] on page \at{page}[foo], B is teh shizzle.
\stoptext
</context>
|}
 
== Associative lists ==
Wolfgang suggested [https://mailman.ntg.nl/pipermail/ntg-context/2022/105437.html] a clever use of alignment options using which one can create associative lists (for example, to pose associative questions):
{|
! width="50%"|
! width="5%"|
! width="45%"|
|-
| <texcode>
\bTABLE
[frame=off,
width=.4\textwidth,
columndistance=.2\textwidth,
align={normal,lohi}]
\bTR
\bTD
\startitemize[8,random][align=righttoleft]
\startitem {\lefttoright One} \stopitem
\startitem {\lefttoright Two} \stopitem
\startitem {\lefttoright Three} \stopitem
\stopitemize
\eTD
\bTD
\startitemize[8,random]
\startitem First \stopitem
\startitem Second \stopitem
\startitem Third \stopitem
\startitem Foruth \stopitem
\stopitemize
\eTD
\eTR
\eTABLE
</texcode>
|
| <context>
\setuppapersize[A8,landscape]
\bTABLE[frame=off,width=.4\textwidth,columndistance=.2\textwidth,align={normal,lohi}]
\bTR
\bTD
\startitemize[8,random][align=righttoleft]
\startitem {\lefttoright One} \stopitem
\startitem {\lefttoright Two} \stopitem
\startitem {\lefttoright Three} \stopitem
\stopitemize
\eTD
\bTD
\startitemize[8,random]
\startitem First \stopitem
\startitem Second \stopitem
\startitem Third \stopitem
\startitem Foruth \stopitem
\stopitemize
\eTD
\eTR
\eTABLE
</context>
|}
=Further Reading=
* [[\User-Defined Enumerations]]: Defining a new numbering scheme.* [[Command/startitemize]]
* The source: {{src|strc-itm.mkvi}}
* [[Description]] (definition lists)
 
[[Category:Basics]]
107

edits

Navigation menu