# [NTG-context] styling part of an index entry

Jairo A. del Rio jairoadelrio6 at gmail.com
Fri Jan 8 02:19:45 CET 2021

Oh, I would do it another way, as processors aren't very happy with
commands which split "strings". The drawback of my quick and dirty method
is the need for additional commands, but I hope this will be useful.

\defineregister[myindex]

%Sorry for the funny names

\def\myindexspaced#1{%

\splitstring{#1}\at{ }\to\myindexoneone\and\myindexonetwo%

\myindex[\myindexonetwo,\myindexoneone]{\myindexonetwo,\space\emph{\myindexoneone}}%

}

\def\myindexcomma#1{%

\splitstring{#1}\at,\to\myindextwoone\and\myindextwotwo%

\myindex[#1]{\myindextwoone,\emph{\myindextwotwo}}%

}

\starttext

In \myindexspaced{The Observer}{\em The Observer} of 31 July 2018...

In \myindexcomma{Onion, The}{\em The Onion} of 31 July 2018...

\placemyindex%

\stoptext

Maybe someone else in the list has a cleaner alternative?

Cordially,

Jairo

El jue, 7 de ene. de 2021 a la(s) 18:01, jbf (roma83537 at gmail.com) escribió:

> Thanks Jairo, with some tweaking I now have it working ( I had \placeindex
> instead of \placemyindex! And altered the 'style' name to something else as
> you hinted I should).
>
> Now, this might be asking too much of ConTeXt, but some Newspaper names
> don't italicise the 'The', only the main name. Is it possible, do you
> think, to get the -> operator to work only on, say 'Observer' and not
> 'The', and for that matter not on the page number as well? Perhaps not, but
> worth asking the question anyway!
>
> Julian
> On 8/1/21 9:46 am, Jairo A. del Rio wrote:
>
> Hi. In latest LMTX (2021.01.07 16:59), your example works as expected:
>
> \defineregister[myindex]
>
> \defineprocessor[style][style=italic]%Isn't another name available?
>
> \starttext
>
> In \myindex{style->Observer, The}{\em The Observer} of 31 July 2018
>
> \placemyindex%
>
> \stoptext
>
> Jairo
>
> El jue, 7 de ene. de 2021 a la(s) 17:29, jbf (roma83537 at gmail.com)
> escribió:
>
>> I'm wondering if further progress has been made in Mk IV on styling parts
>> of an index (register) entry? I have followed the explanation on the wiki,
>> but do not seem to be able to achieve what I need.
>>
>> And what I need is to be able to italicise entries that refer to
>> newspaper names, e.g. The Observer
>>
>> MWE
>>
>> \defineregister[myindex]
>> \defineprocessor[style][style=italic]
>>
>> \starttext
>>
>> In \myindex{style->Observer, The} {\em The Observer} of 31 July 2018
>>
>> \stoptext
>>
>> The only result I am getting is:
>>
>> ->Observer, The   223
>>
>> But what I want is *Observer, The* (in other words, in italics).
>>
>> Clearly I am doing something wrong, or not enough, or... maybe there is
>> another way to achieve waht I need?
>>
>> Julian
>>
>> ___________________________________________________________________________________
>> the Wiki!
>>
>> maillist : ntg-context at 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
>>
>> ___________________________________________________________________________________
>>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context at 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
> ___________________________________________________________________________________
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20210107/aaaf3e0d/attachment.htm>