[NTG-context] Index items

Robert Blackstone blackstone.robert at gmail.com
Thu Apr 16 20:08:36 CEST 2015

On 16 Apr 2015, at 15:38 , Hans Hagen <pragma at wxs.nl> wrote
> To: mailing list for ConTeXt users <ntg-context at ntg.nl>
> Subject: Re: [NTG-context] Index items
> Message-ID: <552FBB35.9050707 at wxs.nl>
> Content-Type: text/plain; charset=utf-8; format=flowed
> On 4/15/2015 11:41 PM, Robert Blackstone wrote:
>> On 15 Apr 2015, at 19:51 ,  Alan BRASLAU <alan.braslau at cea.fr> wrote
>>> Hans Hagen <pragma at wxs.nl> wrote:
>>>> On 4/14/2015 1:48 PM, Robert Blackstone wrote:
>>>>> Dear all,
>>>>> The book I am typesetting contains a very extensive and detailed
>>>>> index. The number of index items is probably around 1200, 16 pages.
>>>>> A fair number of them occur in more than one chapter.
>>>>> Like bibliography items, and for the sake of consistency, I have
>>>>> stored them in some auxiliary files and it is a matter of copy and
>>>>> paste to get them into the text in the proper place and way. (With
>>>>> always a risk of accidentally deleting or adding a spurious brace
>>>>> or bracket, with nasty results.)
>>>>> I wonder therefore whether it would be possible to handle them like
>>>>> bibliography items, by means of a key, and leave their expansion to
>>>>> ConTeXt.
>>>>> Would it be possible?
>>>>> And if it is not (yet) possible, how could I perhaps tackle it?
>>>> so you want to remap given index entries to new ones? at what moment?
>>> We index pretty heavily now in the new bibliography dataset subsystem,
>>> that is one can create an index of authors, an index of keywords, an
>>> index of titles, etc. as well as index the pages on which a reference
>>> is cited. All of the information is there.
>>> So say that you want to create a database of anything: words, images,
>>> phrases. You can put these into the database structure and then insert
>>> them or any associated information wherever you want in your text,
>>> later producing lists and indexes.
>>> Can you give an example of what type of information you extensively
>>> index with detail?
>>> Alan
>> Hi Alan,
>>  I realize that I have not yet reacted to Hans’ reply. So let me do that first (it was written but not yet sent).
>>  Hi Hans,
>> Do I want to remap given index entries? Assuming I understand your reply correctly the answer is: Yes, in principle. I would want to be able to change them if there are errors, or if some publisher has different views about the presentation of titles of items that are in the index (titles of songs, for instance). And also when (parts of) the text has (have) to be reused for other purposes. Change them in one operation, that is, not by digging up all occurrences in the book of the item that has to be changed.
>> In answer to Alan’s question: names, theoretical treatises and manuscripts, musical works, musical terms. Nearly all examples in the book have several features that have to be indexed: composer’s name, title of the published work (an opera for instance), title of the particular aria of which the example shows a fragment, and the special features that are shown in the example, parallel 7ths, for example.
>> The not-so-minimal example below (best processed iwth mkiv) gives an impression, also of the optical clumsiness that makes the unprocessed text practically unreadable. That is another reason why I would like to be able to call an index entry by means of some sort of key, like in bibliographic items for footnotes.
> \startluacode
>     document.indexentries = {
>         ["rule"]          = [[Rule(s)]],
>         ["ruleimperfect"] = [[+ \quote{imperfect to perfect, from}]],
>         ["galilei"]       = [[Galilei, Vincenzo]],
>     }
>     function document.getindexentry(n)
>         context("\\index[%s]{%s}",n,document.indexentries[n] or ("<" .. 
> n .. ">"))
>     end
> \stopluacode
> \unexpanded\def\InEn[#1]%
>   {\ctxlua{document.getindexentry("#1")}}
> \starttext
> That this rule
> \InEn[rule]
> \InEn[ruleimperfect] was not applied by everybody is for example shown 
> in {\em Fronimo}%
> \InEn[galilei]
> etc etc

Wow, this is super! Great improvement, also for the readability of the text.
Thank you very much, Hans.

Kind regards,

More information about the ntg-context mailing list