On Mon, 15 May 2023 09:40:22 +0200
Hans Hagen via ntg-context <ntg-context@ntg.nl> wrote:

> \starttexdefinition tolerant protected IndexB[#1]#:#*#2
>      \index{#2}
>      \doloopoverlist {#1} {
>          \index{##1+#2}
>      }
> \stoptexdefinition

Awesome!

However, I think that Joel was looking for a solution closer to what
Hraban suggested, creating automatic subcategories. I would do that
through a additional macros:

\starttexdefinition protected Animals#1
    \index{#1}
    \index{animals+#1}
    #1
)
\starttexdefinition protected Plants#1
    \index{#1}
    \index{plants+#1}
    #1
)
\Animals{dogs}
\Plants{trees}





I use as a general indexing macro:

\starttexdefinition tolerant protected Index[#1]#:#*#2
     \index[#1]{#2}
     #2
\stoptexdefinition

Alan
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

Reply via email to