Hello list, please consider this MWE:

\definenumber[p]
\setnumber[p][1]
\def\PageLeft{ p.~}
\def\TextCommand#1{\getnumber[p] #1\doif{\rawcountervalue[p]}{2}{\def\PageLeft{ P.~}}\incrementnumber[p]}
\setupindex[n=1,pageleft=\PageLeft,pageright=,textcommand=\TextCommand]
\starttext
Foo\index{foo}.
\page
Bar\index{bar}.
\page
Baz\index{baz}.
\page
\placeindex
\stoptext

The pageleft parameter of \setupindex (\setupregister) is normally set to " p.~", but it gets redefined to " P.~" for the second term in the index ("baz").

Here i'm using a counter and i check when it is 2, but i'd like to check if the term is "baz" (and i don't know how to do that test).

If you use deeptextcommand instead of textcommand, the pageleft parameter can't be redefined.

The following variation compiles, but it does not work, because pageleft is always " p.~":

\definenumber[p]
\setnumber[p][1]
\def\PageLeft{ p.~}
\def\TextCommand#1{\getnumber[p] #1\doif{\rawcountervalue[p]}{2}{\def\PageLeft{ P.~}}\incrementnumber[p]}
\setupindex[n=1,pageleft=\PageLeft,pageright=,deeptextcommand=\TextCommand]
\starttext
Foo\index{foo}.
\page
Bar\index{bar}.
\page
Baz\index{baz}.
\page
\placeindex
\stoptext

In my setup i must use deeptextcommand, and i want to set the pageleft and pageright parameters to a different value for some particular terms of the index.

Since the argument passed to deeptextcommand is not the text of the term (it's actually an id used to retrieve a much longer text), i can discriminate the terms by their id, but i can't setup pageleft and pageright accordingly from the command specified by deeptextcommand.

On the other hand, textcommand would let me set pageleft and pageright, but its argument is not pure text, and i don't know how to get the id from it.

How can i solve this problem?

Thanks,

Massimiliano

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

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

Reply via email to