[NTG-context] Switch number and enumeration text

2024-05-03 Thread Jethro Djan
Dear List,

I would like to get something like:

1.1 Theorem instead of Theorem 1.1.

Seems simple enough but can't figure out how to switch the number and the
text. I have the following MWE:

\defineenumeration[theorem][
  prefix=chapter,
  text=Theorem,
  style=italic,
  headstyle=bold,
  headcommand=\groupedcommand{}{.},
]
\starttext

\chapter{}
\section{}
\starttheorem
This is a theorem
\stoptheorem
\stoptext

Many thanks,
Jethro
___
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
___


[NTG-context] Re: more register questions!

2024-05-03 Thread Thomas A. Schmitz

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]

  
Dummy text.Dummy footnote.
  
  
Dummy text.Dummy footnote.
  
  

\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
___


[NTG-context] regular online meet-up

2024-05-03 Thread Henning Hraban Ramm

You’re invited to our regular online meet-up, this upcoming
Wednesday, May 8th, 19:00 CEST (UTC+2!)

at https://lecture.senfcall.de/hen-rbr-rku-oke
(same, but shorter: https://u.mtxrun.eu/ctxmtg)

ConTeXt users of all levels are welcome!

Do you have a subject that you’d like to talk about?

I’m hoping to hear about BachoTeX (have fun, everyone who’s there)!

Looking forward to seeing you,
Hraban


(Same blurb as always:)

[Howto]
* No special software installation required; most modern browsers should 
work (WebRTC required).

* Open the URL above, accept the privacy statement,
* enter your name,
* click "join" (or "start" if you’re the first),
* click "with microphone", allow your browser to access it, check the audio.
* Your microphone is muted if you join. Activate microphone and/or 
camera with the buttons at the bottom.

* Minimize the default presentation with the "screen" button, bottom right.

* If you’d like to share your screen or upload a file, you can make 
yourself the presenter: Click on your user name, change the setting, 
then you’ll see the "screen sharing" button beside the camera button; 
also there’s now "manage presentations" behind the "plus" button.
Beware there is only one presenter at a time, so don’t kill someone 
else’s presentation.


[Technical hints]
* Sound is usually better if you use a headset (less noise for everyone).
* Connection problems are mostly due to low bandwidth or high latency on 
your side, e.g. with mobile connections.

* Sometimes leaving and re-entering helps.
* If audio/video doesn’t work for you, you can still use the text chat.
* Screen sharing needs a lot of bandwidth.
* BigBlueButton documentation applies: 
https://bigbluebutton.org/teachers/tutorials/


[Netiquette]
* Please use a name that we recognize from here. Some feel uncomfortable 
with anonymous lurkers.

* Mute your microphone while you’re not talking.
* It’s nice to show your face at least when you join.
* If there are connection problems, stop camera sharing.
* The room is set to “everyone’s a moderator“, I trust you...
___
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
___


[NTG-context] Re: more register questions!

2024-05-03 Thread Henning Hraban Ramm

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  
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
___


[NTG-context] Re: more register questions!

2024-05-03 Thread Thomas A. Schmitz

Hi Massi,

yes, that was a very good idea! I can detect if the element  
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
___


[NTG-context] Re: more register questions!

2024-05-03 Thread Wolfgang Schuster

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
___