* [NTG-context] Procedurally adding annotations to a base text.
@ 2026-02-10 18:15 gbsolisb
2026-02-10 19:00 ` [NTG-context] " Pablo Rodriguez via ntg-context
0 siblings, 1 reply; 5+ messages in thread
From: gbsolisb @ 2026-02-10 18:15 UTC (permalink / raw)
To: ntg-context
Hello all,
I have a base document typeset in ConTeXt, on top of which I'd like to add some comments and word definitions (as footnotes, etc.).
I'd much like to be able to keep these extra notes separately in an external file, and only add them to the text at compile-time.
I've managed to get something like that working by defining a custom lua function and registering it via `resolvers.installinputlinehandler(...)`, but it's quite brittle, completely ignoring macro expansions, etc.
Is there a better way to do that? Perhaps it's been even done before?
Thanks for the help,
Gabriel
___________________________________________________________________________________
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] 5+ messages in thread
* [NTG-context] Re: Procedurally adding annotations to a base text.
2026-02-10 18:15 [NTG-context] Procedurally adding annotations to a base text gbsolisb
@ 2026-02-10 19:00 ` Pablo Rodriguez via ntg-context
2026-02-10 19:35 ` gbsolisb
0 siblings, 1 reply; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2026-02-10 19:00 UTC (permalink / raw)
To: ntg-context; +Cc: Pablo Rodriguez
On 2/10/26 19:15, gbsolisb@gmail.com wrote:
> Hello all,
>
> I have a base document typeset in ConTeXt, on top of which I'd like
> to add some comments and word definitions (as footnotes, etc.).
> I'd much like to be able to keep these extra notes separately in an>
> external file, and only add them to the text at compile-time.
> […]
> Is there a better way to do that? Perhaps it's been even done before?
Hi Gabriel,
how about just plain (TeX) `\input{my_file.tex}`?
I hope it helps,
Pablo
___________________________________________________________________________________
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] 5+ messages in thread
* [NTG-context] Re: Procedurally adding annotations to a base text.
2026-02-10 19:00 ` [NTG-context] " Pablo Rodriguez via ntg-context
@ 2026-02-10 19:35 ` gbsolisb
2026-02-10 20:03 ` Hans Hagen via ntg-context
0 siblings, 1 reply; 5+ messages in thread
From: gbsolisb @ 2026-02-10 19:35 UTC (permalink / raw)
To: ntg-context
Hello Pablo, thanks for the reply.
What I want is to dynamically attach notes and comments to my base text. For example, say I have a base ConTeXt file
```
\starttext
Foo, bar
baz, quux
\stoptext
```
and an external "glossary" file (the details don't matter much):
```
bar : <definition>
baz: <definition>
```
I'd to rig the document compilation so that, e.g., the definition for the words listed in the glossary get automatically added to the source, so what actually gets compiled is something like:
```
\starttext
Foo, \Definition[<definition>]{bar}
\Definition[<definition>]{baz}, quux
\stoptext
```
Thus keeping the base text and the annotations cleanly separate. I've already managed to get it to work (using `resolvers.installinputlinehandlers`), but I wonder if there's a better way.
___________________________________________________________________________________
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] 5+ messages in thread
* [NTG-context] Re: Procedurally adding annotations to a base text.
2026-02-10 19:35 ` gbsolisb
@ 2026-02-10 20:03 ` Hans Hagen via ntg-context
2026-02-13 3:20 ` gbsolisb
0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen via ntg-context @ 2026-02-10 20:03 UTC (permalink / raw)
To: ntg-context; +Cc: Hans Hagen
On 2/10/2026 8:35 PM, gbsolisb@gmail.com wrote:
> Hello Pablo, thanks for the reply.
>
> What I want is to dynamically attach notes and comments to my base text. For example, say I have a base ConTeXt file
> ```
> \starttext
> Foo, bar
> baz, quux
> \stoptext
> ```
> and an external "glossary" file (the details don't matter much):
> ```
> bar : <definition>
> baz: <definition>
> ```
>
> I'd to rig the document compilation so that, e.g., the definition for the words listed in the glossary get automatically added to the source, so what actually gets compiled is something like:
> ```
> \starttext
> Foo, \Definition[<definition>]{bar}
> \Definition[<definition>]{baz}, quux
> \stoptext
> ```
> Thus keeping the base text and the annotations cleanly separate. I've already managed to get it to work (using `resolvers.installinputlinehandlers`), but I wonder if there's a better way.
you can put this in some file:
\definesynonyms
[whatever]
[whatevers]
[\fullwhatever]
[\usewhatever]
\setupsynonyms[whatever][command=no]
\whatever [foo] {FOO} {what a foo}
\whatever [oof] {OOF} {oof or foo}
and after loading do:
\starttext
\usewhatever{foo}: \fullwhatever{foo}
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 5+ messages in thread
* [NTG-context] Re: Procedurally adding annotations to a base text.
2026-02-10 20:03 ` Hans Hagen via ntg-context
@ 2026-02-13 3:20 ` gbsolisb
0 siblings, 0 replies; 5+ messages in thread
From: gbsolisb @ 2026-02-13 3:20 UTC (permalink / raw)
To: ntg-context
Hello Hans, thanks for the reply.
If I understand correctly, these synonyms would still require me to modify the source text, namely to add the appropriate synonym macros.
What I'm trying to do is to make this code injection happen completely non-intrusively, during compilation only; not modifying the main source code at all, otherwise.
While this is probably a nightmare to deal with in the general case (having to deal with arbitrary macros, etc.), it makes sense for my use case: large bodies of plain, easy to parse, text (save for an occasional \italic{...}, etc., simple stuff), and ready-made glossary files.
If I end up producing something a bit more robust I might link it here, in case it interests someone else.
Thank you for the suggestions.
___________________________________________________________________________________
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] 5+ messages in thread
end of thread, other threads:[~2026-02-13 3:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-10 18:15 [NTG-context] Procedurally adding annotations to a base text gbsolisb
2026-02-10 19:00 ` [NTG-context] " Pablo Rodriguez via ntg-context
2026-02-10 19:35 ` gbsolisb
2026-02-10 20:03 ` Hans Hagen via ntg-context
2026-02-13 3:20 ` gbsolisb
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).