As part of the cookbook that I am working on, I have a fair bit of
information available as part of the typesetting process that I would
like to use to create automatic index (register)[1] entries.
So, given that I have these various bits of information available, I
would like to write information to the index automatically, placing
items for the dish in an alphabetical index, indexing by some major
ingredients or ingredient types and the like.
I tried \index{\Category+\RecipeTitle}, which didn't work -- the
indexing blew up because '\RecipeTitle' and '\Category' were unknown
control sequences.
Looking through 'core-reg.tex' didn't shed much light on it -- the few
things that looked like they might work were, unfortunately, prone to
exactly the same failure cases.
The only way I could find that actually worked was, in a minimal
example:
\def\MyTitle{Mango Bread} \def\MyCategory{Bread}
\edef\LocalDoIndex{\noexpand\index{\MyCategory+\MyTitle}}
\LocalDoIndex
I can obviously pretty that up a little by wrapping it into a
'ExpandedIndex' macro or such that will do the expansion, etc, and write
the final index note.
Is there a better way of achieving this result, though?
Finally, as a note on improving the documentation of ConTeXt, it would
be extremely helpful to include an entry in the manual index that would
direct people to 'registers' when they looked for 'index'. That would
have saved me some headache when I first went looking for them. :)
Daniel
Footnotes:
[1] I use the English "index" name, not the (to me, at least) next to
unknown "register" naming that the ConTeXt manual uses.
--
I was twenty-five, and too old to be unusual.
-- James D. Watson, _The Double Helix_, (1968)