Changes

Jump to navigation Jump to search
2,804 bytes added ,  17:38, 2 April 2013
→‎MkII: expand mkii instructions
== MkII ==
<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 === General Setup ===The interface for register styling is {{cmd|setupregister}}.For settings that apply to the :: syntax like this (from register as a whole use the manual)two-argumentversion:
<texcode>
\setupregisterdefineregister[indexthing][form][pagestyle=bold,textstyle=slantedstuff]\setupregister[indexthing][tb][textstyle style=bold]boldslanted, %% headings\setupregister[index][nb][pagestyle textstyle=bold], %% items\setupregister[index][hm][ pagestyle=slanted, %% page numbers]</texcode>
Here we first initialize a register ''thing''.Then we assign a different[[Style_Alternatives|style]]to each of the three elements:the option ''style'' refers to index section headings (letters), whichwill be typeset in bold slanted;''textstyle'' means the item (indexed string, here bold);finally, ''pagestyle'' sets the page number references (slanted). === Individiual Entries ===Better granularity regarding the formatting of individual entries canbe achieved through the ''three-argument'' version of{{cmd|setupregister}}.Its second argument is an identifier by means of which a sub-style canbe applied later. <texcode>\indexsetupregister[thing][important] [textstyle=bold, pagestyle=boldslanted]\setupregister[thing][nonsense] [textstyle=\tfxx, pagestyle=\tfd]</texcode> This creates the substyles ''important'' and ''nonsense'' for theregister ''thing''.To apply a sub-style, it has to be specified when an entry is added tothe register.If we wanted to highlight an entry as important, we would call themacro {{cmd|thing|link=no}} as follows: <texcode>text before \thing{important::entry} text after</texcode> Note the double colon (<tt>::</tt>) that serves as delimiter betweenstyle directive (left hand side) and entry text (right).To highlight the page number instead: <texcode>text before \thing[important::]{entry} text after</texcode> Note that the '''<tt>::</tt> is non-optional'''!If the double colon is omitted, ''important'' would instead refer tothe string used for register sorting.Of course, both elements can be styled at once: <texcode>text before \thing[important::]{nonsense::entry} text after</texcode> This produces an entry whose text is highlighted according to thedefinition of ''nonsense'' with a pagenumber styled as ''important''. The syntax for an MkII-style register entry has the schematic: <pre>\<registercmd> [<pagestyle>::<sortkey>] {tb<textstyle>::foot<category>+squarefoot<entry>}</pre> where only <code><entry></code> is mandatory. === Example === A complete working example demonstrating the highlighting capabilities: <texcode>\defineregister[thing][things]%%% 2-arg\setupregister[thing][ style=boldslanted, textstyle=normal, pagestyle=slanted,] %%% 3-arg\setupregister[thing][important] [textstyle=bold, pagestyle=boldslanted]\setupregister[thing][nonsense] [textstyle=\tfxx, pagestyle=\tfd]  \starttext Ordinary entries: \thing{one}\thing{two}  Just a \thing {important::three} test. %% text in "tb" style-> “important” Yet another \thing {nonsense::four}test. %% text -> “nonsense” Again, nothing but a \indexthing [nbimportant::]{squarerootfive} test. %% number in "nb" stylepage -> “important” Old story: this is a \indexthing [hmimportant::root]{$important::five}test. %% both -> “important” Get it? A \sqrtthing [important::] {2important::six}$test. %% both -> “important” Plain and simple: \thing [nonsense::] {nonsense::seven} test. %% number in "hm" style, sorted at "root"both -> “nonsense”  \placething\stoptext
</texcode>
188

edits

Navigation menu