ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: jbf via ntg-context <ntg-context@ntg.nl>
To: Robert via ntg-context <ntg-context@ntg.nl>
Cc: jbf <roma83537@gmail.com>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: sorting for particular sub entries to register
Date: Wed, 2 Feb 2022 08:36:51 +1100	[thread overview]
Message-ID: <d56697d8-4aa2-08f1-6a3f-8cb3a966a32a@gmail.com> (raw)
In-Reply-To: <7898B757-2A47-45B8-9B52-BC36BEB231D5@hccnet.nl>


[-- Attachment #1.1: Type: text/plain, Size: 6434 bytes --]

Thanks Robert,

Initially I thought it would probably be Lua which could come up with a 
simple solution, though Hans had made it clear that 'messing with' the 
key was the way to go, and, as always, he was proven correct. I simply 
had to find out the best way to do the messing! But when time allows I 
will take a closer look at the Lua possibilities.

Julian

On 1/2/22 18:49, Robert via ntg-context wrote:
> Hi Julian,
>
> Another solution could be to use Lua.
>
> I have a multilingual document in which some elements to be printed 
> bold (Language 1), and collected in an index (trk) arranged according 
> their (verbal) stems. Elements from Language 2 are to be printed in 
> italics in the text and collected in a separate index.
>
> In the present example the morphemes from Language 2 are separated by 
> ::, the verbal stem ends in -.
>
> In \\textbf the input is reproduced as is. Then interesting things 
> happen in the index (trk).
>
> The first element (until the first ::) is taken as an main entry in 
> the index (hence !). Then the complete input is retained as the 
> secondary entry. Note that in the index - separates the morphemes.
>
> I use LuaLatex, but I am quite sure this is also possible in Context.
>
> It is quite complex, but it works.
>
> Robert
>
>
> \newcommand{\TWI}[1]{\directlua{twi_help(\luastring{#1})}}
>
> \begin{luacode}
> function twi_help ( s )
>    s = unicode.utf8.gsub (s, 
> '^([^:]+)::([^:]+)::([^:]+)::([^:]+)::([^:]+)$' , 
> '\\textbf{%1::%2::%3%::%4::%5}\\sindex%[trk%]{%#%1!%1%-%2%-%3%-%4-%5}’ )
>
>   s = unicode.utf8.gsub … other action
>
> \end{luacode}
>
> \begin{document}
>
> text text text text \TWI{dī-::dū::kin::dah} text text text text text
>
> \end{document}
>
>
>
>> Op 1 feb. 2022, om 01:41 heeft jbf via ntg-context 
>> <ntg-context@ntg.nl> het volgende geschreven:
>>
>> Yes, Adam, that works. Though it can be a laborious solution, since 
>> it means creating keys for everything in a sub entry list (and I have 
>> many instances, 40 or more in some cases). However, I did not ask for 
>> a 'simple' solution, just a solution! Thank you.
>>
>> Julian
>>
>> On 1/2/22 11:09, Adam Reviczky wrote:
>>> Hi Julian,
>>>
>>> How about using the keys in every instance?
>>>
>>> \setupregister[index][n=1,method={zc,pc,zm,pm,uc},style=WORD]
>>> \defineprocessor[special][style=italic]
>>>
>>> \starttext
>>> P\index[Plenary+periti]{Plenary Council+{\it periti} (experts)}
>>> B\index[Plenary+beriti]{Plenary Council+{\it beriti} (experts)}
>>> A\index[Plenary+aeriti]{Plenary Council+aeriti (experts)}
>>>
>>> S\index[animals+special]{animals+‘special kinds’}
>>> B\index[animals+bpecial]{animals+bpecial}
>>> A\index[animals+apecial]{animals+‘apecial’}
>>> U\index[animals+upecial]{animals+‘upecial’}
>>> T\index[animals+tpecial]{animals+tpecial}
>>>
>>> \placeindex
>>> \stoptext
>>>
>>> See result in: 
>>> https://live.contextgarden.net/cgi-bin/result.cgi?id=j46XhZ
>>>
>>> Adam
>>>
>>> On Mon, Jan 31, 2022 at 10:38 PM jbf via ntg-context 
>>> <ntg-context@ntg.nl> wrote:
>>>
>>>     Let me come back to the unresolved (for me) question of two
>>>     situations in sub entries to a book index (register). Sub
>>>     entries that have formatting or sub entries that are surrounded
>>>     by quote marks (straight or curly, it makes no difference) do
>>>     not appear in the correct alphabetical order.
>>>
>>>     Two attempts on my part:
>>>
>>>     text before \index[Plenary+periti]{Plenary Council+{\it periti}
>>>     (experts)} text after.
>>>
>>>     text before \index{animals+‘special kinds’} text after. Or
>>>     alternatively, \index[animals+special]{animals+‘special kinds’}
>>>
>>>     The setup for my register is a pretty standard one. The
>>>     processor is not for the 'periti' case above but I use it for
>>>     book titles.
>>>
>>>     \setupregister[index][n=1,method={zc,pc,zm,pm,uc},style=WORD]
>>>
>>>     \defineprocessor[special][style=italic]
>>>
>>>     In the periti case it is the \it command that clearly interferes
>>>     with correct alphabetic positioning in the sub entry list.
>>>     Placing +periti in the key does not overcome that problem.
>>>
>>>     In the ‘special kinds’ case it is the initial single quote mark
>>>     (‘) that causes the problem. The item comes last in the sub
>>>     entry list. And if i include a key [special], then it comes
>>>     first in the sub entry list. Either way, it is out of the
>>>     desired sorting order.
>>>
>>>     I believe I have followed the helpful suggestions of various
>>>     ones, but it is always possible that I have not fully understood
>>>     those suggestions. The reality is that at the moment the issue
>>>     remains unresolved for me. Any further wisdom out there to offer me?
>>>
>>>     Julian
>>>
>>>     ___________________________________________________________________________________
>>>     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
>>>     ___________________________________________________________________________________
>>>
>> ___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 15756 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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	other threads:[~2022-02-01 21:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31 22:35 jbf via ntg-context
2022-02-01  0:09 ` Adam Reviczky via ntg-context
2022-02-01  0:41   ` jbf via ntg-context
2022-02-01  7:49     ` Robert via ntg-context
2022-02-01 21:36       ` jbf via ntg-context [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d56697d8-4aa2-08f1-6a3f-8cb3a966a32a@gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=roma83537@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).