ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* HOWTO: Add index entries within a macro.
@ 2002-04-06  6:08 Daniel Pittman
  2002-04-06 14:13 ` John Culleton
  2002-04-07  9:46 ` Hans Hagen
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Pittman @ 2002-04-06  6:08 UTC (permalink / raw)


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)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-04-08  7:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-06  6:08 HOWTO: Add index entries within a macro Daniel Pittman
2002-04-06 14:13 ` John Culleton
2002-04-07  9:30   ` Hans Hagen
2002-04-07  9:46 ` Hans Hagen
2002-04-08  7:04   ` Daniel Pittman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).