ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Rik Kabel via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Rik Kabel <ConTeXt@rik.users.panix.com>
Subject: Re: Indexing redux
Date: Thu, 26 Aug 2021 16:46:23 -0400	[thread overview]
Message-ID: <338559e1-98ac-3ccd-3409-e6744656119a@rik.users.panix.com> (raw)
In-Reply-To: <F760CBA8-719C-418E-9FEE-6A88D5BB29F4@bittext.nl>


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


On 8/26/2021 03:26, Taco Hoekwater wrote:
> Hi Rik,
>
>> On 26 Aug 2021, at 03:14, Rik Kabel via ntg-context<ntg-context@ntg.nl>  wrote:
>>
>> List,
>>
>> I am trying to create an index with both "see" and "see also" cross-reference entries.[1] At this point, ConTeXt provides basic support for "see" entries via the \seeREGISTER command (it does not properly support references to sub-entries) and it provides no support at all for "see also" entries.
>>
>> Can somebody suggest a way to generate these entries? Perhaps a way of inserting entries into the index before it is formatted, in the     manner of \writetolist or \writebetweenlist? (MkII has \writetoregister, but that did not carry forward and I do not know if it would have helped here.)
>
> Since strc-reg.mkiv starts with a number of ’todo’ comments, I think your best bet is to create an
> actual functional example along with an explanation of what you want the typeset result to look
> like in the cases where it is not doing what you want.
>
> Generally, explicit examples / test files are the best way to get replies to questions
> (either by Hans or anyone else).

The following produces what I am looking for, and a bit more. Page 3 of 
the output shows what I would like to see, page 4 is the generated 
index. I don't really need the "see under" and "see also under" 
variants, but they would be nice to have. I am indifferent to having 
stops before "see also"s. I would like to be able to turn checking on or 
off, so that generic directives (in the example, see also specific 
breeds) will not generate an error, while the Ford Prefect example will 
generate an error.


        \defineprocessor[also][color=blue]
        \defineprocessor[under][color=green]
        \defineprocessor[alsounder][color=orange]
        \define\seealsoindex\seeindex
        \define\seealsounderindex\seeindex
        \define\seeunderindex\seeindex
        \setupinteraction [state=start]
        \setupregister    [index][balance=no,check=no]

    %% seeindex entries may start on the same line as their head entry
        \seeindex         {dog breeds+Wiener dog}{dog breeds+Dachshund}
    %%  The next example should not work,
    %%    since there is no main entry /Adams, Douglas/
        \seeindex         {Prefect, Ford}{Adams, Douglas}

    %%  When referring to a subentry, the target must be a subentry,
    %%    but should display as if a main entry. The next example
    %%    should point to the /Adams+Douglas/ subentry, but it
    %%    should be formatted as if it were /Adams, Douglas/
        \seeindex         {Dent, Arthur}{Adams+Douglas}

    %% The following two work as expected
        \seeindex         {Matilda effect}{obliteration}
        \seeindex         {Marut, Ret}{Traven, B.}

    %% seealso should be placed after as a subentry after real page
    references
    %% seealso should have an appropriate label (default English /see also/)
        \seealsoindex     {pseudepigraphy}{also->obliteration}
        \seealsoindex     {dog breeds}{also->breeding programs}
        \seealsoindex     {dog breeds}{also->specific breeds}
    %% seealsounder is like seealso except that it refers to a main entry
        \seealsounderindex{Coton de Tulear}{alsounder->dog breeds}
    %% seeunder also is like seealso except that it refers to a main entry
        \seeunderindex    {Weimaraner}{under->dog breeds}
        \starttext
          Stuff
          \index{obliteration}
          \index{Adams+Douglas}\index{Adams+John}
          \index{Beagle}
          \index{dog breeds+Beagle}
          \index{dog breeds+Coton de Tulear}
          \index{dog breeds+Dachshund}
          \index{dog breeds+Weimaraner}
        \page
          More stuff
          \index{Adams+John Quincy}
          \index{misquotation}
          \index{pseudepigraphy}
          \index{Traven, B.}
          \index{Beagle}
          \index{Coton de Tulear}
          \index{breeding programs}
        \page
    \definedescription[Index][headstyle=bold,alternative=top,inbetween=]
        \startIndex{a}
          Adams\par
          \quad \reference[AdamsDouglas]{Adams, Douglas}Douglas\quad 1\par
          \quad John\quad 1\par
          \quad John Quincy\quad 2\par
        \stopIndex
        \startIndex{b}
          Beagle\quad 1, 2\par
          \reference[breedingprograms]{breeding programs}breeding
    programs\quad 2
        \stopIndex
        \startIndex{c}
          Coton de Tulear\quad 2.\par
          \quad {\em See also under} \in[dogbreeds]
        \stopIndex
        \startIndex{d}
          \reference[DentArthur]{Dent, Arthur}Dent, Arthur {\em see}
    \in[AdamsDouglas]\par
          \reference[dogbreeds]{dog breeds}dog breeds\par
          \quad \reference[dbBeagle]{dog breeds, Beagle}Beagle\quad 1\par
          \quad \reference[dbCoton]{dog breeds, Coton}Coton de
    Tulear\quad 1\par
          \quad \reference[dbDachshund]{dog breeds,
    Dachshund}Dachshund\quad 1\par
          \quad \reference[dbWeimaraner]{dog breeds,
    Weimaraner}Weimaraner\quad 1\par
          \quad Wiener dog\quad {\em see} \in[dbDachshund]\par
          \quad{\em See also} \in[breedingprograms] {\em and specific
    breeds}
        \stopIndex
        \startIndex{m}
          Marut, Ret\quad {\em see} \in[TravenB]\par
          Matilda effect\quad {\em see} \in[obliteration]\par
          \reference[misquotation]{misquotation}misquotation\quad 2
        \stopIndex
        \startIndex{o}
          \reference[obliteration]{obliteration}obliteration\quad 1\par
          \quad{\em See also} \in[misquotation] {\em and}
    \in[pseudepigraphy]
        \stopIndex
        \startIndex{p}
          Prefect, Ford\quad {\em see Adams, Douglas}\par
    \reference[pseudepigraphy]{pseudepigraphy}pseudepigraphy\quad 2\par
          \quad {\em See also} \in[obliteration]
        \stopIndex
        \startIndex{t}
          \reference[TravenB]{Traven, B.}Traven, B.\quad 2
        \stopIndex
        \startIndex{w}
          Weimaraner\quad {\em see under} \in[dogbreeds]
        \stopIndex
        \page
        \placeindex
        \stoptext

-- 
Rik

[-- Attachment #1.2: Type: text/html, Size: 8458 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:[~2021-08-26 20:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26  1:14 Rik Kabel via ntg-context
2021-08-26  7:26 ` Taco Hoekwater via ntg-context
2021-08-26 20:46   ` Rik Kabel 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=338559e1-98ac-3ccd-3409-e6744656119a@rik.users.panix.com \
    --to=ntg-context@ntg.nl \
    --cc=ConTeXt@rik.users.panix.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).