Changes

Jump to navigation Jump to search
3,052 bytes added ,  23:04, 29 December 2004
new
< [[Structurals]] | [[References]] > (It's also in the manual at "Registers")

=Basics=

Putting a word into the index as simple as <cmd>index</cmd><tt>{word}</tt>. (Always type <cmd>index</cmd> ''before'' the word you refer to!)

To sort e.g. <cmd>ConTeXt</cmd> under "C", you write <cmd>index</cmd><tt>[CONTEXT]{\ConTeXt}</tt>.

If you need multiple levels (up to three), use "+" or "&" separators like in <cmd>index</cmd><tt>{beans+baked}</tt>.

You get a cross reference in your index with <cmd>seeindex</cmd> like in <cmd>seeindex</cmd><tt>[CONTEXT]{\ConTeXt}{\TeX}</tt> (ConTeXt: see TeX).

To typeset the index, use <cmd>placeindex</cmd> (without title) or <cmd>completeindex</cmd> (with titling).

==Example==
<texcode>
My \index{dog}dog is a \index{dog+bullterrier}bullterrier named \seeindex{Dolly}{Underware}Dolly.
He doesn't like \index{cat}cats.
There are a lot of \index{cat+stray}stray cats, but only a few of them are \index{cat+Siamese}Siamese.

\placeindex
</texcode>
<context>
\tfx
My \index{dog}dog is a \index{dog+bullterrier}bullterrier named \seeindex{Dolly}{Underware}Dolly.
He doesn't like \index{cat}cats. There are a lot of \index{cat+stray}stray cats, but only a few of them are \index{cat+Siamese}Siamese.

\placeindex
</context>

=Styling the Index=

<cmd>setupregister</cmd><tt>[index]</tt> is your friend. <cmd>placeindex</cmd> and <cmd>completeindex</cmd> take the same options.

You can also style single entries with the :: syntax like this (from the manual):

<texcode>
\setupregister[index][form][pagestyle=bold,textstyle=slanted]
\setupregister[index][tb][textstyle=bold]
\setupregister[index][nb][pagestyle=bold]
\setupregister[index][hm][pagestyle=slanted]

\index{tb::foot+squarefoot} % text in "tb" style
\index[nb::]{squareroot} % number in "nb" style
\index[hm::root]{$\srqt{2}$} % number in "hm" style, sorted at "root"
</texcode>

=More Registers=

<cmd>index</cmd> is only one special case of <cmd>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]
\setupregister[mouse][style=\ss]

\mouse{rat}

\placemouse
</texcode>

(Don't know if the plural form is used anywhere...)

=Tricks=

* <cmd>startregister</cmd><tt>[mymouse]{mouse}</tt> ... <cmd>stopregister</cmd><tt>[mymouse]</tt>: to mark several pages for the same entry; becomes e.g. "mouse 12--16"
* <cmd>writetoregister</cmd> (sometimes needed to avoid macro expansion issues)
* A register per chapter: <cmd>placeregister</cmd><tt>[index][criterium=chapter]</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.!

==Coupled Registers==

This is a special feature for documents that are only used on screen: Make a word clickable to jump to the index, the first or last occurrence.

Enable it with <cmd>setupregister</cmd><tt>[index][coupling=yes]</tt>.
Substitute <cmd>index</cmd> with <cmd>coupledindex</cmd> and enjoy!

Navigation menu