* [NTG-context] more register questions!
@ 2024-05-02 15:01 Thomas A. Schmitz
2024-05-02 15:55 ` [NTG-context] " mf
2024-05-03 10:18 ` Wolfgang Schuster
0 siblings, 2 replies; 7+ messages in thread
From: Thomas A. Schmitz @ 2024-05-02 15:01 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
making wonderful progress on my registers and translating from xml.
There is one thing I can't figure out (and I or some other good soul may
have asked in the past...). Is it possible to mark occurrences in
footnotes? Ideally, the entry in the register would look like
p. 100\high{20}
to show that the term occurs in note 20 on p. 100. But if that's asking
too much, I would be content with applying a processor (say, italic) to
these register entries. From the looks of the tuc file, Context doesn't
appear to "know" that a register entry is within a footnote. But Hans
never ceases to amaze me, so maybe there is a way (short of applying
special markup to these notes in the source)?
All best
Thomas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: more register questions!
2024-05-02 15:01 [NTG-context] more register questions! Thomas A. Schmitz
@ 2024-05-02 15:55 ` mf
2024-05-03 20:24 ` Thomas A. Schmitz
2024-05-03 10:18 ` Wolfgang Schuster
1 sibling, 1 reply; 7+ messages in thread
From: mf @ 2024-05-02 15:55 UTC (permalink / raw)
To: ntg-context
Il 02/05/24 17:01, Thomas A. Schmitz ha scritto:
> Hi,
>
> making wonderful progress on my registers and translating from xml.
> There is one thing I can't figure out (and I or some other good soul may
> have asked in the past...). Is it possible to mark occurrences in
> footnotes? Ideally, the entry in the register would look like
>
> p. 100\high{20}
>
> to show that the term occurs in note 20 on p. 100. But if that's asking
> too much, I would be content with applying a processor (say, italic) to
> these register entries. From the looks of the tuc file, Context doesn't
> appear to "know" that a register entry is within a footnote. But Hans
> never ceases to amaze me, so maybe there is a way (short of applying
> special markup to these notes in the source)?
>
I did something like that, with a processor that added a "n" after the
occurrence page number.
Since you typeset XML, maybe you can detect that an index (register)
reference happens inside a note from the DOM element you are typesetting.
Then you use a command like this:
\index[NoteProcessor->sortkey]{index term}
where NoteProcessor is defined like this:
\defineprocessor[NoteProcessor][right={\itx n}]
In this case I'm adding a smaller "n" to the right of the page number of
the occurrence.
Adding the \high style is not difficult:
\defineprocessor[NoteProcessor][right=\high{n}]
but replacing a fixed "n" with the footnote number is quite challenging.
The second argument of \defineprocessor has a "command=\...##1" option
that could be exploited, but I don't know exactly what gets passed to
that custom command as ##1; maybe the page number of the occurrence.
In that case, I'd look for a way to store the association between that
occurrence and the footnote number, and retrieve that in the custom command.
Massi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: more register questions!
2024-05-02 15:01 [NTG-context] more register questions! Thomas A. Schmitz
2024-05-02 15:55 ` [NTG-context] " mf
@ 2024-05-03 10:18 ` Wolfgang Schuster
2024-05-03 21:12 ` Thomas A. Schmitz
2024-05-08 2:22 ` Rik Kabel
1 sibling, 2 replies; 7+ messages in thread
From: Wolfgang Schuster @ 2024-05-03 10:18 UTC (permalink / raw)
To: mailing list for ConTeXt users, Thomas A. Schmitz
Thomas A. Schmitz schrieb am 02.05.2024 um 17:01:
> Hi,
>
> making wonderful progress on my registers and translating from xml.
> There is one thing I can't figure out (and I or some other good soul
> may have asked in the past...). Is it possible to mark occurrences in
> footnotes? Ideally, the entry in the register would look like
>
> p. 100\high{20}
>
> to show that the term occurs in note 20 on p. 100. But if that's
> asking too much, I would be content with applying a processor (say,
> italic) to these register entries. From the looks of the tuc file,
> Context doesn't appear to "know" that a register entry is within a
> footnote. But Hans never ceases to amaze me, so maybe there is a way
> (short of applying special markup to these notes in the source)?
You can play with the following example, the main point use to use the
\setregisterentry command and pass the footnote counter with the third
(optional) argument.
\def\IndexPageCommand#1%
{#1\doifsomething
{\currentregisterpageuserdata{footnote}}
{\high{\currentregisterpageuserdata{footnote}}}}
\setupregister[index][pagecommand=\IndexPageCommand]
\starttext
\dorecurse{200}
{\samplefile{lorem}\expanded{\setregisterentry[index][entries=\recurselevel]}%
\samplefile{lorem}\footnote{xxx\expanded{\setregisterentry[index][entries=\recurselevel][footnote={\rawcountervalue[footnote]}]}}%
\samplefile{lorem}}
\page \placeindex
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: more register questions!
2024-05-02 15:55 ` [NTG-context] " mf
@ 2024-05-03 20:24 ` Thomas A. Schmitz
2024-05-03 20:36 ` Henning Hraban Ramm
0 siblings, 1 reply; 7+ messages in thread
From: Thomas A. Schmitz @ 2024-05-03 20:24 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi Massi,
yes, that was a very good idea! I can detect if the element <indexentry>
occurs within a footnote by testing
\xmldoiftext {#1} {ancestor::footnote}
and then apply a processor to these entries. That would be a good
solution for the time being.
Thanks and all best
Thomas
On 5/2/24 17:55, mf wrote:
>
> I did something like that, with a processor that added a "n" after the
> occurrence page number.
>
> Since you typeset XML, maybe you can detect that an index (register)
> reference happens inside a note from the DOM element you are typesetting.
>
> Then you use a command like this:
>
> \index[NoteProcessor->sortkey]{index term}
>
> where NoteProcessor is defined like this:
>
> \defineprocessor[NoteProcessor][right={\itx n}]
>
> In this case I'm adding a smaller "n" to the right of the page number of
> the occurrence.
>
> Adding the \high style is not difficult:
>
> \defineprocessor[NoteProcessor][right=\high{n}]
>
> but replacing a fixed "n" with the footnote number is quite challenging.
>
> The second argument of \defineprocessor has a "command=\...##1" option
> that could be exploited, but I don't know exactly what gets passed to
> that custom command as ##1; maybe the page number of the occurrence.
>
> In that case, I'd look for a way to store the association between that
> occurrence and the footnote number, and retrieve that in the custom
> command.
>
> Massi
--
Prof. Dr. Thomas A. Schmitz
Institut für Klassische und Romanische Philologie
Universität Bonn
Rabinstr. 8
53111 Bonn
http://www.philologie.uni-bonn.de/de/personal/schmitz
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: more register questions!
2024-05-03 20:24 ` Thomas A. Schmitz
@ 2024-05-03 20:36 ` Henning Hraban Ramm
0 siblings, 0 replies; 7+ messages in thread
From: Henning Hraban Ramm @ 2024-05-03 20:36 UTC (permalink / raw)
To: ntg-context
Am 03.05.24 um 22:24 schrieb Thomas A. Schmitz:
> Hi Massi,
>
> yes, that was a very good idea! I can detect if the element <indexentry>
> occurs within a footnote by testing
>
> \xmldoiftext {#1} {ancestor::footnote}
>
> and then apply a processor to these entries. That would be a good
> solution for the time being.
Would you contribute the complete solution to the wiki?
I find the case quite interesting.
Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: more register questions!
2024-05-03 10:18 ` Wolfgang Schuster
@ 2024-05-03 21:12 ` Thomas A. Schmitz
2024-05-08 2:22 ` Rik Kabel
1 sibling, 0 replies; 7+ messages in thread
From: Thomas A. Schmitz @ 2024-05-03 21:12 UTC (permalink / raw)
To: Wolfgang Schuster, mailing list for ConTeXt users
Hi Wolfgang,
powerful and elegant, as always! I think I have a solution with xml; I
will have to test it more extensively with my complex real file; but
here comes, also for Hraban (if it works in real life, I'll add it to
the wiki...).
Thanks a lot!
Thomas
\startbuffer[test]
<document>
<chapter>
<p>Dummy text.<indexentry key="Dummy1"/><footnote
id="chapter1:ftn1">Dummy footnote.<indexentry
key="footnote1"/></footnote></p>
</chapter>
<chapter>
<p>Dummy text.<indexentry key="Dummy2"/><footnote
id="chapter1:ftn1">Dummy footnote.<indexentry
key="footnote2"/></footnote></p>
</chapter>
<index/>
</document>
\stopbuffer
\startxmlsetups xml:testsetups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{document|chapter|p|footnote|indexentry|index}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:testsetups}
\startxmlsetups xml:document
\xmlflush {#1}
\stopxmlsetups
\startxmlsetups xml:chapter
\xmlflush {#1} \page
\stopxmlsetups
\startxmlsetups xml:p
\xmlflush {#1} \par
\stopxmlsetups
\startxmlsetups xml:footnote
\footnote[\xmlatt{#1}{id}]{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:indexentry
\xmldoiftext {#1} {ancestor::footnote}
{\setregisterentry
[index][keys:1=\xmlatt{#1}{key},entries:1=\xmlatt{#1}{key}][footnote={\rawcountervalue[footnote]}]}
{\setregisterentry[index][keys:1=\xmlatt{#1}{key},entries:1=\xmlatt{#1}{key}]}
\stopxmlsetups
\startxmlsetups xml:index
\page \placeregister [index]
\stopxmlsetups
\def\IndexPageCommand#1%
{#1\doifsomething
{\currentregisterpageuserdata{footnote}}
{\high{\currentregisterpageuserdata{footnote}}}}
\setupregister[index][pagecommand=\IndexPageCommand]
\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext
On 5/3/24 12:18, Wolfgang Schuster wrote:
> You can play with the following example, the main point use to use the
> \setregisterentry command and pass the footnote counter with the third
> (optional) argument.
>
> \def\IndexPageCommand#1%
> {#1\doifsomething
> {\currentregisterpageuserdata{footnote}}
> {\high{\currentregisterpageuserdata{footnote}}}}
>
> \setupregister[index][pagecommand=\IndexPageCommand]
>
> \starttext
>
> \dorecurse{200}
> {\samplefile{lorem}\expanded{\setregisterentry[index][entries=\recurselevel]}%
> \samplefile{lorem}\footnote{xxx\expanded{\setregisterentry[index][entries=\recurselevel][footnote={\rawcountervalue[footnote]}]}}%
> \samplefile{lorem}}
>
> \page \placeindex
>
> \stoptext
>
> Wolfgang
--
Prof. Dr. Thomas A. Schmitz
Institut für Klassische und Romanische Philologie
Universität Bonn
Rabinstr. 8
53111 Bonn
http://www.philologie.uni-bonn.de/de/personal/schmitz
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: more register questions!
2024-05-03 10:18 ` Wolfgang Schuster
2024-05-03 21:12 ` Thomas A. Schmitz
@ 2024-05-08 2:22 ` Rik Kabel
1 sibling, 0 replies; 7+ messages in thread
From: Rik Kabel @ 2024-05-08 2:22 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 2371 bytes --]
Hello Wolfgang and all,
I have been trying to extend this to handle endnotes. So far, I have not
succeeded; the number is always that of the last endnote.
I could possibly increment a counter for each endnote processed, but
that seems a hack.
--
Rik
On 2024-05-03 06:18, Wolfgang Schuster wrote:
> Thomas A. Schmitz schrieb am 02.05.2024 um 17:01:
>> Hi,
>>
>> making wonderful progress on my registers and translating from xml.
>> There is one thing I can't figure out (and I or some other good soul
>> may have asked in the past...). Is it possible to mark occurrences in
>> footnotes? Ideally, the entry in the register would look like
>>
>> p. 100\high{20}
>>
>> to show that the term occurs in note 20 on p. 100. But if that's
>> asking too much, I would be content with applying a processor (say,
>> italic) to these register entries. From the looks of the tuc file,
>> Context doesn't appear to "know" that a register entry is within a
>> footnote. But Hans never ceases to amaze me, so maybe there is a way
>> (short of applying special markup to these notes in the source)?
>
> You can play with the following example, the main point use to use the
> \setregisterentry command and pass the footnote counter with the third
> (optional) argument.
>
> \def\IndexPageCommand#1%
> {#1\doifsomething
> {\currentregisterpageuserdata{footnote}}
> {\high{\currentregisterpageuserdata{footnote}}}}
>
> \setupregister[index][pagecommand=\IndexPageCommand]
>
> \starttext
>
> \dorecurse{200}
> {\samplefile{lorem}\expanded{\setregisterentry[index][entries=\recurselevel]}%
>
> \samplefile{lorem}\footnote{xxx\expanded{\setregisterentry[index][entries=\recurselevel][footnote={\rawcountervalue[footnote]}]}}%
>
> \samplefile{lorem}}
>
> \page \placeindex
>
> \stoptext
>
> Wolfgang
>
> ___________________________________________________________________________________
>
> If your question is of interest to others as well, please add an entry
> to the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net
> (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___________________________________________________________________________________
>
[-- Attachment #1.2: Type: text/html, Size: 3766 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-05-08 2:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-02 15:01 [NTG-context] more register questions! Thomas A. Schmitz
2024-05-02 15:55 ` [NTG-context] " mf
2024-05-03 20:24 ` Thomas A. Schmitz
2024-05-03 20:36 ` Henning Hraban Ramm
2024-05-03 10:18 ` Wolfgang Schuster
2024-05-03 21:12 ` Thomas A. Schmitz
2024-05-08 2:22 ` Rik Kabel
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).