[NTG-context] Solved, was Re: Register customization for backmatter page numbers

Rik Kabel context at rik.users.panix.com
Sun Aug 2 03:28:39 CEST 2015

On 2015-08-01 14:42, Rik Kabel wrote:
> On 2015-08-01 13:54, Pablo Rodriguez wrote:
>> Hi Rik,
>> sorry for top-posting, but I’m not sure whether I understand your request.
>> I wonder whether the following sample points in the right direction:
>>      \setuppapersize[A6]
>>      \setuppagenumber[way=bypart, prefix=yes, prefixset=chapter]
>>      \startsectionblockenvironment[bodypart]
>>          \setuppagenumber[number=1]
>>      \stopsectionblockenvironment
>>      \startsectionblockenvironment[appendix]
>>          \setuppagenumber[number=1]
>>      \stopsectionblockenvironment
>>      \starttext
>>      \completecontent
>>      \startbodymatter
>>      \dorecurse{5}{\chapter{Chapter}\recurselevel\index{bar}}
>>      \stopbodymatter
>>      \startappendices
>>      \dorecurse{5}{\chapter{Appendix}\recurselevel\index{foo}}
>>      \title{Index}
>>      \placeindex
>>      \stopappendices
>>      \stoptext
>> Just in case it helps,
>> Pablo
>> On 08/01/2015 04:20 AM, Rik wrote:
>>> List,
>>> I have a book with frontmatter, bodymatter, and backmatter. The
>>> frontmatter is pagenumbered with lc roman, and the bodymatter and
>>> backmatter are numbered, all by block.
>>> The backmatter contain a glossary, pagenotes, bibliography, and an
>>> index. In addition to the frontmatter and the bodymatter, both the
>>> glossary and the pagenotes contain items that are indexed.
>>> I need to distinguish pagenumbers that appear in the index so that the
>>> reader can identify where in the book the page is located. For the
>>> frontmatter, that is not a problem. For items that appear in the
>>> bodymatter or backmatter, however, page numbers are not unique.
>>> One method that has been suggested is to prefix the pagenumber displayed
>>> in the index with a mark to indicate that the page is in the backmatter,
>>> or to italicize it, or to use an alternate font. I have looked at the
>>> defineconversionset and defineprocessor documentation and find no way to
>>> mark index entries appropriately.
>>> Can anyone suggest a way to do this, or some other method? Perhaps a
>>> pagecommand that compares the register item real page number to the
>>> highest real page number of the body? I would prefer a solution that
>>> does not require changing the register commands (\index) in the text.
>>> Continuous numbering across the frontmatter, bodymatter, and backmatter
>>> is not wanted, although as a last resort I might be able to argue for
>>> continuous numbering in the bodymatter and backmatter.
> Thank you, Pablo. That does meet the requirements as stated, but 
> having the chapter number as a prefix for the body entries is overly 
> verbose and will not pass muster. (Failure of my specifications.)
> I have found a solution, however. By placing these in the environment:
>     \defineprocessor[Back][style=slanted,right=n]
>     \defineprocessor[Front][style=normal]
>     \def\Where{Front}
>     \def\Index{\index[\Where->]}
> And this at the start of the backmatter:
>     \def\Where{Back}
> I can index items with \Index{item} and the value of \Where when the 
> entry is processed will be used. This meets the requirement that no 
> change to the indexing is required in the text (except to change 
> \index to \Index), and I can further distinguish notes from glossary 
> entries if needed. I could even eliminate that last change by defining 
> my own register Index and using \def\index{\Index[\Where->] (and an 
> appropriate \placeregister).
> I still haven't played with this a lot, so I don't know yet if it will 
> handle all the optional bits of register entries, but it should 
> suffice for my current needs.
And a more robust solution that takes into account index sort keys:

    % macros=mkvi
    \starttexdefinition unexpanded index
    \starttexdefinition doStartindex [#sortkey]
    \defineprocessor[Back]    [style=slanted,right=n]
    \defineprocessor[notBack] [style=normal]
    \defineregister [Index]
    \setupregister  [Index]   [n=2,command=\Word,balance=no,compress=yes]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150801/d0ee3567/attachment.html>

More information about the ntg-context mailing list