Changes

Jump to navigation Jump to search
2,556 bytes added ,  13:50, 13 January 2021
m
syntax of methods
< [[Structurals]] | [[References]] > (It's also in the manual at "Registers")
 
=Basics=
<context mode=mkiv source=yes>
\setuppapersize[A10][A7,landscape]
 
\setuppaper[nx=4, ny=2]
\setuplayout[location=middle,marking=on]
\setuparranging [XY]
 
\definefontfeature [textfigures] [onum=yes]
finally, ''pagestyle'' sets the page number references (slanted).
=== Individiual Individual Entries ===
Better granularity regarding the formatting of individual entries can
be achieved through the ''three-argument'' version of
=More Registers=
<{{cmd>|index</cmd> }} is only one special case of <cmd>{{gen|register</cmd>}}. You can define as much different registers as you like:
<{{cmd>|defineregister</cmd>}}<tt>[singular name][plural name]</tt>, e.g.
<texcode>
\defineregister[mouse][mice]
=Tricks=
* {{cmd|writetoregister}} (sometimes needed to avoid macro expansion issues)
* A register per chapter: {{cmd|placeregister}}<tt>[index][criterium=chapter]</tt>
* Uppercase-letter index heads: {{cmd|setupregister}}<tt>[index][n=2,command=\Word,style=normal]</tt>
* Place a word in text ''and'' index: <tt>\def\Tindex#1{\index{#1}#1}</tt> -- Please someone enhance this to get space correction, [] sorting etc.!
* Get uppercase-letter heads: {{cmd|setupregisterwritetoregister}}<tt>[index][n=2(sometimes needed to avoid macro expansion issues,command=\Word,style=normal]</tt>'''MkII only''') 
== Collapse Page Numbers ==
The vertical spaces between the entry groups for subsequent letters is governed by the parameter <tt>before</tt> in the same command (default: <tt>\blank</tt>, change to <tt>before={}</tt> to get no additional space).
=Sorting=
The sorting of the index is influenced by the current [[Languages#Language_tags|language tag]]. You can override that with the {{key|language}} key of {{cmd|setupregister}}.
There are a few additional "languages" for sorting, as defined in {{src|sort-lan.mkiv}}:
* <tt>DIN 5007-1</tt> (German) normal sorting, ß = ss
* <tt>DIN 5007-2</tt> (German) phonebook sorting, ä = ae, ö = oe, ü = ue, ß = ss
* <tt>Duden</tt> (German) ß = s
* <tt>de-AT</tt> (Austrian German) phonebook sorting; umlauts after base vocal (a, ä, o, ö, u, ü)
* <tt>cu</tt> (Church Slavonic)
* <tt>ocs-scn</tt> (Scientific Old Slavonic transcription)
* <tt>ru-iso9</tt> (Russian transcription)
 
Additionally, there’s the {{key|method}} key that influences the order of upper-/lowercase and diacritics:
 
The details lay in a rather obscure set of methods (see {{src|sort-ini.lua|source}}), for which the following presets are defined:
 
* {{key|method}}<tt>=default</tt> <tt>{zc,pc,zm,pm,uc}</tt> uppercase like lowercase, diacritics separate
* {{key|method}}<tt>=before</tt> <tt>{mm,mc,uc}</tt> upper before lower, diacritics ignored
* {{key|method}}<tt>=after</tt> <tt>{pm,mc,uc}</tt> lower before upper, diacritics ignored
* {{key|method}}<tt>=first</tt> <tt>{pc,mm,uc}</tt> lower before upper, diacritics separate
* {{key|method}}<tt>=last</tt> <tt>{mc,mm,uc}</tt> upper before lower, diacritics separate
* If you don’t set the sorting method, the preset <tt>first</tt> ist used (and not <tt>default</tt>).
* There’s no preset for the combination "uppercase like lowercase, diacritics ignored", use {{key|method}}<tt>={zm,pm,zc,zm,uc}</tt>.
* The sorting is also influenced by the current language or the language setting in {{cmd|setupregister}}.
 
e.g.
<texcode>
\setupregister[index][
n=1,
language=Duden,
method={zm,pm,zc,zm,uc},
]
</texcode>
=Coupled Registers=
Note the two possible definitions, and the pitfalls with each one. If you are still having trouble with specific {{cmd|index}} commands, try using the alternative definition. When they are used in the right context, these three possible ways of placing an index term (the plain {{cmd|index}}, or it wrapped in one of the two possible {{cmd|doflushatpar}}s, should solve any problem.
 
=Impact on hyphenation, and on line breaking as a consequence=
 
{{cmd|index}} is attached to a word, so it modifies the word boundaries. That influences its hyphenation and likely the paragraph's line breaking. To prevent that, you can write:
 
<texcode>
This is an indexed term\wordboundary\index{Term}. % instead of simply ... term\index{Term}.
</texcode>
 
That way, ConTeXt knows that the word "term" is ended by the "m" and not by something attached to it by {{cmd|index}}, and the effect on hyphenation and line breaking is the same as if we wrote:
 
<texcode>
This is an indexed term.
</texcode>
 
[[Category:Basics]]
138

edits

Navigation menu