Changes

Jump to navigation Jump to search
2,817 bytes added ,  21:00, 12 November 2011
Added summary tables
Besides allowing user-definable modes, ConTeXt provides some system
modes. These modes start with a <code>*</code> character. Here I will explainonly the more commonly used system modesare explained; see the ConTeXt [http://pragma-ade.com/general/manuals/mmodes.pdf modes manual]
for a complete list.
 
 
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"
|'''*mkii'''
| Enabled when running [[MkII]]
|-
| '''*mkiv'''
| Enabled when running [[MkIV]]
|}
 
Perhaps the most useful system modes are <code>*mkii</code> and <code>*mkiv</code> which
Other modes are useful for very specific situations. Some of these are described
below.
 
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"
| '''*first'''
| Enabled during the first compile run
|}
A document must be run multiple times to get the cross referencing,
<code>*first</code> mode is handy&mdash;it is active only on the first run of the
document.
 
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"
|'''*project'''
| Enabled when inside <code>\startproject</code> ... <code>\stopproject</code>
|-
|'''*component'''
| Enabled when inside <code>\startcomponent</code>...<code>\stopcomponent</code>
|-
| '''*environment'''
| Enabled when inside <code>\startenvironment</code> ... <code>\stopenvironment</code>
|-
| '''*text'''
| Enabled when inside <code>\starttext</code> ... <code>\stoptext</code>.
|}
You can use the project-product-component structure for managing large projects
encountered. Similarly, a mode <code>*text</code> is enabled when
<code>\starttext</code> is encountered, and likewise for the others.
 
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"
|'''*frontpart'''
| Enabled when inside <code>\startfrontmatter</code> ... <code>\stopforntmatter</code>
|-
| '''*bodypart'''
| Enabled when inside <code>\startbodymatter</code> ... <code>\stopbodymatter</code>
|-
| '''*backpart'''
| Enabled when inside <code>\startbackmatter</code> ... <code>\stopbackmatter</code>
|}
A large document is typically broken down into different section blocks:
if you want macros that work differently in different section blocks, you can
check for modes <code>*frontpart</code>, <code>*bodypart</code>, and so on.
 
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"
|'''*list'''
| Enabled inside a list entry
|-
|'''*marking'''
| Enabled inside a marking
|-
|'''*register'''
| Enabled inside a register
|-
|'''*chapter''', '''*section''', etc.
| Enabled inside the corresponding section head.
|}
 
 
Sometimes you want a macro to behave differently if it is part of a section head, a section number, a list, a marking, or a register. For section heads, you can check for modes <code>*chapter</code>, <code>*section</code>, <code>*subsection</code>, etc. Similarly, <code>*list<code> is enabled inside a list, <code>*marking</code> is enabled inside a marking, and <code>*register</code> is enabled inside a register.
 
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"
|'''*en-us''', '''*nl''', etc.
| Enabled when the current <code>\language</code> is <code>en-us</code>, <code>nl</code>, etc.
|-
|'''**en-us''', '''**nl''', etc.
| Enabled when the <code>\mainlanguage</code> is <code>en-us</code>, <code>nl</code>, etc.
|}
ConTeXt provides support for multiple languages. Languages are recognized by
English and the current language is Dutch, the modes <code>**en-us</code> and
<code>*nl</code> are set (notice the extra <code>*</code> in <code>**en-us</code>).
 
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"
|'''*figure'''
| Enabled when a graphic is found
|-
|'''*interaction'''
| Enabled when interaction is enabled
|-
|'''*grid'''
| Enabled when grid typesetting is enabled
|}
 
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"
|'''*pdf'''
| Enabled when the main output is pdf
|-
|'''*dvi'''
| Enabled when the main output is dvi
|}
Other system modes: <code>*figure</code> is set when a graphic is found,

Navigation menu