Changes

Jump to navigation Jump to search
10,419 bytes added ,  19:53, 10 March 2018
reverse numbering
< [[Structurals]] | [[Description]] >
 
= Overview of commands =
 
== \startitemize ==
 
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 <tt>\{{cmd|startitemize</tt> }} command takes optional parameters (see the documentation of <tt>\{{cmd|startitemgroup</tt> }} 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>
<tr><td><tt>a</tt></td><td>Items are numbered a., b., c., &hellip;</td></tr>
<tr><td><tt>A</tt></td><td>Items are numbered A., B., C., &hellip;</td></tr>
<tr><td><tt>AAK</tt></td><td>Items are numbered A., B., C., &hellip;, in small caps.</td></tr>
<tr><td><tt>r</tt></td><td>Items are numbered in lowercase Roman numerals.</td></tr>
<tr><td><tt>R</tt></td><td>Items are numbered in uppercase Roman numerals.</td></tr>
</table>
TODO: What It is also possible to define your own number conversions; see [[User-Defined Enumerations]]. If you have loaded the difference [[Chinese]] module, you can also use <tt>c</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>ninmargin</tt> (place enumeration symbols into the margin), and * <tt>Ntext</tt>?(paragraph enumerations, formats the items as a running text). == \setupitemize ==
Additional parameters include <tt>continue</tt> (start where To change the previous itemization general layout of enumerations, there is {{cmd|setupitemize}}. was finished, It accepts an integer as its first parameter to allow text injections), <tt>packed</tt> (less vertical space between items), and <tt>inmargin</tt> (place enumeration symbols into denote for which level of itemization the margin)subsequent settings should apply.
To change the general layout of enumerations, there is <tt>\You will find more about {{cmd|setupitemize</tt>. Itaccepts an integer as its first parameter to denote for which level of itemization the subsequent settings should apply. There is an example below}} at {{cmd|setupitemgroup}} and {{cmd|defineitemgroup}}.
== \defineitemgroup == For finer control, it is advisable to create new types of itemization, using the command <tt>\{{cmd|defineitemgroup</tt> (which unfortunately seems undocumented)}}. For example, something similar to the LaTeX <tt>itemize</tt> environment can be defined as follows:
{|
! width="45%"|
! width="10%"|
! width="45%"|
|-
| <texcode>
\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
</texcode>
|
| <context>
\defineitemgroup[ltxitm][levels=5]
%
%
\stoptext
</context>
|}
 
= Customization details and examples =
 
==Manual labels==
 
{|
! width="50%"|
! width="50%"|
|-
|<context>
\starttext
\setupitemize[left=(, right=), margin=4em, stopper=]
\startitemize[a, packed]
\item one item,
\item next item.
\stopitemize
\stoptext
</context>
| <texcode>
\setupitemize[left=(, right=), margin=4em, stopper=]
\startitemize[a]
\item one item,
\item next item.
\stopitemize
</texcode>
* <tt>margin</tt> is from left margin to start of item text
* <tt>stopper</tt> is the dot (or whatever) after the "number"
|-
|<context>
\starttext
\startitemize[R,fit][itemalign=flushright,stopper={ --- }]
\dorecurse{5}{\item blablabla}
\stopitemize
\stoptext
</context>
|<texcode>
\startitemize[R,fit][itemalign=flushright,stopper={ --- }]
\dorecurse{5}{\item blablabla}
\stopitemize
</texcode>
|-
|<context>
\starttext
\startitemize[n,packed][start=42,stopper={\space}]
\dorecurse{3}{\item Lorem ipsum}
\stopitemize
\stoptext
</context>
|
You can tell ConTeXt to begin item numbering at given offset [http://thread.gmane.org/gmane.comp.tex.context/61728/focus=61729]:
<texcode>
\startitemize[n,fit][start=42,stopper={\space}]
\dorecurse{3}{\item Lorem ipsum}
\stopitemize
</texcode>
|-
|<context>
\starttext
\startitemize[a,packed]
\item bar
\sym{1.} foo
\sym{2.} bar
\sym{3.} foo
\sym{5.} bar
\sym{8.} foo
\sym{13.} bar
\item foo
\stopitemize
\stoptext
</context>
|Irregular item types can be inserted via {{cmd|sym}}: <tt>\sym{#1}</tt> [http://article.gmane.org/gmane.comp.tex.context/61731]:
<texcode>
\startitemize[a]
\item bar
\sym{1.} foo
\sym{2.} bar
\sym{3.} foo
\sym{5.} bar
\sym{8.} foo
\sym{13.} bar
\item foo
\stopitemize
</texcode>
Note that the original (alphabetically enumerated) order is not affected by
these insertions: it continues after the last one as if they didn't exist.
|}
 
== Expanded subnumbers ==
 
To specify that item numbers should also be leading numbers in any subitemizations, use the {{code|repeat}} keyword.
 
<context source=yes>
% Indentation is a bit odd; cannot reproduce off-wiki.
 
\setupitemgroup[itemize][1][n,repeat]
\setupitemgroup[itemize][2][a,repeat]
\setupitemgroup[itemize][3][n]
 
This is our item list:
 
\startitemize
\item ... % 1
\startitemize
\item ... % 1.a
\startitemize
\item ... % 1.a.1
\stopitemize
\item ... % 1.b
\startitemize
\item ... % 1.b.1
\item ... % 1.b.2
\stopitemize
\stopitemize
\item ... % 1
\stopitemize
</context>
 
To add change the separator mark, you have to setup the {{code|numberseparatorset}} key of the {{code|itemgroup:itemize}} counter. This example removes the separator mark entirely.
 
<context source=yes mode=mkiv>
\setupitemgroup[itemize][1][n,repeat][width=1em]
\setupitemgroup[itemize][2][a,repeat][width=2em]
\setupitemgroup[itemize][3][n] [width=3em]
 
\defineseparatorset[none][][]
 
\setupcounter[itemgroup:itemize][numberseparatorset=none]
\startitemize
\item ... % 1
\startitemize
\item ... % 1a
\startitemize
\item ... % 1a1
\stopitemize
\stopitemize
\stopitemize
</context>
 
== Vertical spacing ==
 
This is the way how you can set spacing before and after itemize when working with
<texcode>
\setupwhitespace[big]
</texcode>
 
An option '''nowhite''' comes in handy:
 
<texcode>
paragraph before
 
\startitemize[joinedup,nowhite,after]
\item first
\item second
\stopitemize
 
paragraph after
</texcode>
 
These are all the four possible combinations of whitespace settings that you might want to use:
 
 
<context>
\setuplayout[scale=0.8,width=9cm]
\setupwhitespace[big]
\definesymbol[1][$\triangleright$]
\startcolumns
{\bf joinedup:} \par before \startitemize[joinedup] \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
{\bf joinedup,nowhite,after:} \par before \startitemize[joinedup,nowhite,after] \item test \item test \stopitemize after
\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.
 
 
 
To prevent an unwanted pagebreak before the list, there is an <tt>intro</tt> parameter :
<texcode>
The following list is on the same page as this paragraph :
\startitemize[intro]
\startitem foo \stopitem
\startitem bar \stopitem
\stopitemize
</texcode>
 
==Horizontal spacing==
{|
! width="45%"|
! width="10%"|
! width="45%"|
|-
|To control the space between the item symbol (bullet) and the item text
 
you can use eather the broad option
<texcode>
\startitemize[n*broad] %replace n with a number (e.g "3").
\item Test
\stopitemize
</texcode>
or you can use absolute values (for fine tuning):
<texcode>
\startitemize[width=1em,distance=0pt]
\item Test
\stopitemize
</texcode>
|
|<context>
\startitemize[width=1em,distance=0pt]
\item Using width=1em,distance=0pt
\stopitemize\setuplayout[scale=0.8,width=9cm]
\startitemize
\item {\bf Default} (no arguments)
\stopitemize
 
\startitemize[1*broad]
\item Using 1*broad
\stopitemize
\startitemize[3*broad]
\item Using 2*broad
\stopitemize
</context>
|}
 
==Multicolumn==
 
Hans posted a solution to the list for a multicolumn enumeration that counts across then down, instead of down then across. When he posted it (Dec 21, 2005), he said the joinedup option does not work, but he would fix that. This is a version without the tufte and zapf text
 
{|
! width="45%"|
! width="10%"|
! width="45%"|
|-
| <texcode>
\starttext
 
Some previous sentence before the list
 
\startitemize[columns,n,joinedup]
\item one
\item two
\stopitemize
\startitemize[continue,columns,joinedup]
\item one
\item two
\stopitemize
\startitemize[continue,columns,joinedup]
\item one
\item two
\stopitemize
 
And the text continues after the list
 
\stoptext
</texcode>
|
|<context>
\starttext
 
Some previous sentence before the list
 
\startitemize[columns,n,joinedup]
\item one
\item two
\stopitemize
\startitemize[continue,columns,joinedup]
\item one
\item two
\stopitemize
\startitemize[continue,columns,joinedup]
\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</cmd> and <cmd>stopitem</cmd>, using <cmd>item</cmd> 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>
\starttext
 
Some previous sentence before the list
 
\startitemize[a,horizontal,two]
\startitem first \stopitem
\startitem second \stopitem
\startitem third \stopitem
\startitem fourth \stopitem
\stopitemize
 
And the text continues after the list
 
\stoptext
 
</context>
|}
 
= Other considerations =
 
== 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 caveats:
# 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:
 
{|
! width="45%"|
! width="10%"|
! width="45%"|
|-
| <texcode>
\nextrandom
\startitemize[random]
\startitem A \stopitem
\startitem B \stopitem
\startitem C \stopitem
%\startitem F \stopitem
\stopitemize
</texcode>
|
| <context>
\nextrandom
\startitemize[random]
\startitem A \stopitem
\startitem B \stopitem
\startitem C \stopitem
%\startitem F \stopitem
\stopitemize
</context>
|}
 
== Referring to items ==
You can also use a reference to an item, just like a chapter or section. See also [[References]].
 
{|
! width="45%"|
! width="10%"|
! width="45%"|
|-
| <texcode>
\starttext
\startitemize[n]
\item A
\item[foo] B
\item C
\stopitemize
\dots
As seen in \in{item}[foo] on page \at{page}[foo], B is teh shizzle.
\stoptext
</texcode>
|
| <context>
\starttext
\startitemize[n]
\item A
\item[foo] B
\item C
\stopitemize
\dots
As seen in \in{item}[foo] on page \at{page}[foo], B is teh shizzle.
\stoptext
</context>
|}
 
=Further Reading=
 
* [[\startitemize]]
* The source: {{src|strc-itm.mkvi}}
* [[Description]] (definition lists)
57

edits

Navigation menu