Begin forwarded message:
*From: *Rik Kabel via ntg-context <ntg-cont...@ntg.nl
<mailto:ntg-cont...@ntg.nl>>
*Subject: **Re: [NTG-context] Indexing redux*
*Date: *26 August 2021 at 22:46:23 CEST
*To: *mailing list for ConTeXt users <ntg-cont...@ntg.nl
<mailto:ntg-cont...@ntg.nl>>
*Cc: *Rik Kabel <cont...@rik.users.panix.com
<mailto:cont...@rik.users.panix.com>>
*Reply-To: *mailing list for ConTeXt users <ntg-cont...@ntg.nl
<mailto:ntg-cont...@ntg.nl>>
On 8/26/2021 03:26, Taco Hoekwater wrote:
Hi Rik,
On 26 Aug 2021, at 03:14, Rik Kabel via ntg-context<ntg-cont...@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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry
to the Wiki!
maillist : ntg-cont...@ntg.nl <mailto:ntg-cont...@ntg.nl> /
http://www.ntg.nl/mailman/listinfo/ntg-context
<http://www.ntg.nl/mailman/listinfo/ntg-context>
webpage : http://www.pragma-ade.nl <http://www.pragma-ade.nl> /
http://context.aanhet.net <http://context.aanhet.net>
archive : https://bitbucket.org/phg/context-mirror/commits/
<https://bitbucket.org/phg/context-mirror/commits/>
wiki : http://contextgarden.net <http://contextgarden.net>
___________________________________________________________________________________