ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] index entry with sorting and processor
@ 2024-08-25 18:33 Henning Hraban Ramm
  2024-09-27  4:02 ` [NTG-context] " Marcus Vinicius Mesquita
  0 siblings, 1 reply; 6+ messages in thread
From: Henning Hraban Ramm @ 2024-08-25 18:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi again,

the page number of register entries from a glossary should have a 
different color:

\defineprocessor[glossar][color=green]
\define[1]\GlIndex{\index[glossar->]{#1}}

This works, but I’d like to apply a macro to the text, and then I need 
to set the sort order:

\define[1]\GlIndex{\index[glossar->#1]{\Word{#1}}}

This also works, but I get separate index entries from
\index{Something}
and
\GlIndex{something}

Glossary entries may be lowercase, but in the index I’d like to 
normalize to uppercase initials. (The index command is part of a lemma 
setup.)

How can I combine the entries?

I also tried \setregisterentry but didn’t find out how to use a 
processor for the page number. In the wiki, the (generally working) 
processor option is undocumented, so if there’s another option, it’s 
also missing.
In the source, I found processors for entry & page, but not how to 
address the latter.

MWE:
"""
\defineprocessor[glossar][color=green]
\define[1]\GlIndex{\index[glossar->#1]{\Word{#1}}}

\starttext

\samplefile{ward}
\index{something}
\index{anything}
\page

\samplefile{tufte}
\GlIndex{something}
\GlIndex{anything}

\page
\placeindex
\stoptext

"""

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

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: index entry with sorting and processor
  2024-08-25 18:33 [NTG-context] index entry with sorting and processor Henning Hraban Ramm
@ 2024-09-27  4:02 ` Marcus Vinicius Mesquita
  2024-09-27 14:56   ` Bruce Horrocks
  2024-09-27 15:09   ` Wolfgang Schuster
  0 siblings, 2 replies; 6+ messages in thread
From: Marcus Vinicius Mesquita @ 2024-09-27  4:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear List,

If it is possible, I would also like to know how to use a processor
for the page number in the \setregisterentry command. If not, could it
be implemented?

Regards

Marcus Vinicius

On Sun, Aug 25, 2024 at 3:37 PM Henning Hraban Ramm <texml@fiee.net> wrote:
>
> Hi again,
>
> the page number of register entries from a glossary should have a
> different color:
>
> \defineprocessor[glossar][color=green]
> \define[1]\GlIndex{\index[glossar->]{#1}}
>
> This works, but I’d like to apply a macro to the text, and then I need
> to set the sort order:
>
> \define[1]\GlIndex{\index[glossar->#1]{\Word{#1}}}
>
> This also works, but I get separate index entries from
> \index{Something}
> and
> \GlIndex{something}
>
> Glossary entries may be lowercase, but in the index I’d like to
> normalize to uppercase initials. (The index command is part of a lemma
> setup.)
>
> How can I combine the entries?
>
> I also tried \setregisterentry but didn’t find out how to use a
> processor for the page number. In the wiki, the (generally working)
> processor option is undocumented, so if there’s another option, it’s
> also missing.
> In the source, I found processors for entry & page, but not how to
> address the latter.
>
> MWE:
> """
> \defineprocessor[glossar][color=green]
> \define[1]\GlIndex{\index[glossar->#1]{\Word{#1}}}
>
> \starttext
>
> \samplefile{ward}
> \index{something}
> \index{anything}
> \page
>
> \samplefile{tufte}
> \GlIndex{something}
> \GlIndex{anything}
>
> \page
> \placeindex
> \stoptext
>
> """
>
> Hraban
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
> ___________________________________________________________________________________



-- 
Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o
corpo nem seus membros, por ser descanso da alma, primavera do
coração, distração do aflito, entretenimento do solitário, e viático
do viajante.

Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: index entry with sorting and processor
  2024-09-27  4:02 ` [NTG-context] " Marcus Vinicius Mesquita
@ 2024-09-27 14:56   ` Bruce Horrocks
  2024-09-27 15:09   ` Wolfgang Schuster
  1 sibling, 0 replies; 6+ messages in thread
From: Bruce Horrocks @ 2024-09-27 14:56 UTC (permalink / raw)
  To: ntg-context mailing list


> On 27 Sep 2024, at 05:02, Marcus Vinicius Mesquita <marcusvinicius.mesquita@gmail.com> wrote:
> 
> If it is possible, I would also like to know how to use a processor
> for the page number in the \setregisterentry command. If not, could it
> be implemented?

Not for \setregisterentry, afaik, but there is \dosetfastregisterentry which allows the entry and page number styles to be controlled independently.

usage: \dosetfastregisterentry{register}{entry}{key}{entry processor}{page processor}

example:

\defineregister [MyIndex] [style=tfb, alternative=A, n=1]
\defineprocessor [myRed] [color=red]
\defineprocessor [myGreen] [color=green]
\starttext
 \placeMyIndex
 \page Text \dosetfastregisterentry{MyIndex}{plain}{}{}{} text
 \page Text \dosetfastregisterentry{MyIndex}{plain+green page}{}{}{myGreen} text
 \page Text \dosetfastregisterentry{MyIndex}{plain+red entry}{}{myRed}{myGreen} text
\stoptext


Regards,
—
Bruce Horrocks
Hampshire, UK

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

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: index entry with sorting and processor
  2024-09-27  4:02 ` [NTG-context] " Marcus Vinicius Mesquita
  2024-09-27 14:56   ` Bruce Horrocks
@ 2024-09-27 15:09   ` Wolfgang Schuster
  2024-09-27 17:55     ` Henning Hraban Ramm
  1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2024-09-27 15:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Marcus Vinicius Mesquita

Marcus Vinicius Mesquita schrieb am 27.09.2024 um 06:02:
> Dear List,
> 
> If it is possible, I would also like to know how to use a processor
> for the page number in the \setregisterentry command. If not, could it
> be implemented?

Try the following example which tries to cover a few of the question 
asked by Hraban. When you uncomment the first part you notice a few 
processors are ignored when you use the same entry with and without 
formatting.

%%%% begin example
\defineprocessor [henning] [command=\Word]
\defineprocessor [hraban]  [color=red]

\starttext

% anything\setregisterentry[index][entries=anything]
%
% something\setregisterentry[index][entries=something]
%
% \page

Anything\setregisterentry[index][keys=hraban->,entries=henning->anything]

Something\setregisterentry[index][keys=hraban->,entries=henning->something]

\page

\placeindex

\stoptext
%%%% end example

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

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: index entry with sorting and processor
  2024-09-27 15:09   ` Wolfgang Schuster
@ 2024-09-27 17:55     ` Henning Hraban Ramm
  2024-09-27 19:18       ` Marcus Vinicius Mesquita
  0 siblings, 1 reply; 6+ messages in thread
From: Henning Hraban Ramm @ 2024-09-27 17:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 27.09.24 um 17:09 schrieb Wolfgang Schuster:
> Try the following example which tries to cover a few of the question 
> asked by Hraban. When you uncomment the first part you notice a few 
> processors are ignored when you use the same entry with and without 
> formatting.

Thank you, Wolfgang!

I still didn’t manage to combine "Anything" and "\Word{anything}", they 
become separate entries that look the same.

"""
\defineprocessor [Titling] [command=\Word]
\defineprocessor [Red]  [color=red]

\starttext

anything\setregisterentry[index][entries=Anything]

something\setregisterentry[index][entries=Something]

\page

Anything\setregisterentry[index][keys=Red->Anything,entries=Titling->anything]

Something\setregisterentry[index][keys=Red->Something,entries=Titling->something]

\page

\placeindex

\stoptext
"""

Hraban

(WRT processors: I still need to process your other answers, bear with me…)


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

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: index entry with sorting and processor
  2024-09-27 17:55     ` Henning Hraban Ramm
@ 2024-09-27 19:18       ` Marcus Vinicius Mesquita
  0 siblings, 0 replies; 6+ messages in thread
From: Marcus Vinicius Mesquita @ 2024-09-27 19:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thank you, Bruce and Wolfgang

I did not know the \dosetfastregisterentry command. And with the
example given by Wolfgang I was able to understand better the
\setregistryentry command.

Regards

Marcus Vinicius

On Fri, Sep 27, 2024 at 2:57 PM Henning Hraban Ramm <texml@fiee.net> wrote:
>
> Am 27.09.24 um 17:09 schrieb Wolfgang Schuster:
> > Try the following example which tries to cover a few of the question
> > asked by Hraban. When you uncomment the first part you notice a few
> > processors are ignored when you use the same entry with and without
> > formatting.
>
> Thank you, Wolfgang!
>
> I still didn’t manage to combine "Anything" and "\Word{anything}", they
> become separate entries that look the same.
>
> """
> \defineprocessor [Titling] [command=\Word]
> \defineprocessor [Red]  [color=red]
>
> \starttext
>
> anything\setregisterentry[index][entries=Anything]
>
> something\setregisterentry[index][entries=Something]
>
> \page
>
> Anything\setregisterentry[index][keys=Red->Anything,entries=Titling->anything]
>
> Something\setregisterentry[index][keys=Red->Something,entries=Titling->something]
>
> \page
>
> \placeindex
>
> \stoptext
> """
>
> Hraban
>
> (WRT processors: I still need to process your other answers, bear with me…)
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
> ___________________________________________________________________________________



-- 
Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o
corpo nem seus membros, por ser descanso da alma, primavera do
coração, distração do aflito, entretenimento do solitário, e viático
do viajante.

Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2024-09-27 19:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-25 18:33 [NTG-context] index entry with sorting and processor Henning Hraban Ramm
2024-09-27  4:02 ` [NTG-context] " Marcus Vinicius Mesquita
2024-09-27 14:56   ` Bruce Horrocks
2024-09-27 15:09   ` Wolfgang Schuster
2024-09-27 17:55     ` Henning Hraban Ramm
2024-09-27 19:18       ` Marcus Vinicius Mesquita

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).