A robust way of detecting ConTeXt from LaTeX3
Dear ConTeXt developers, in the l3file module of LaTeX3, we need to detect whether we are using the ConTeXt format, so that we can correctly decide which input and output streams are reserved by the format, and whether we need to \relax a control sequence before using \newread and \newwrite with it. At the moment, we detect ConTeXt by checking that the \normalend command is defined. However, this can produce false positives outside iniTeX when LaTeX3 is loaded from the expl3-generic.tex macro package and a \normalend user command is defined. Furthermore, this can produce false negatives if a future version of ConTeXt does not define \normalend. Can you suggest alternative internal command(s) that we can use to detect ConTeXt? Here are the desiderata: - No false negatives: All past versions of ConTeXt define these commands. All future versions of ConTeXt are likely to define these commands. - No false positives: The commands are long / contain characters that don't have letter catcode in the normal regime and therefore are unlikely to be defined by users. The text of the commands contains ConTeXt-specific terminology that makes them unlikely to be defined by other formats. Looking forward to your helpful suggestions. Best, Vit
On Fri, 2022-07-15 at 18:37 +0200, Vít Novotný wrote:
Dear ConTeXt developers,
in the l3file module of LaTeX3, we need to detect whether we are using the ConTeXt format, so that we can correctly decide which input and output streams are reserved by the format, and whether we need to \relax a control sequence before using \newread and \newwrite with it.
At the moment, we detect ConTeXt by checking that the \normalend command is defined. However, this can produce false positives outside iniTeX when LaTeX3 is loaded from the expl3-generic.tex macro package and a \normalend user command is defined. Furthermore, this can produce false negatives if a future version of ConTeXt does not define \normalend.
Can you suggest alternative internal command(s) that we can use to detect ConTeXt? Here are the desiderata:
- No false negatives: All past versions of ConTeXt define these commands. All future versions of ConTeXt are likely to define these commands.
- No false positives: The commands are long / contain characters that don't have letter catcode in the normal regime and therefore are unlikely to be defined by users. The text of the commands contains ConTeXt-specific terminology that makes them unlikely to be defined by other formats.
How about \contextversion? Cheers, Henri
Looking forward to your helpful suggestions.
Best, Vit _______________________________________________ dev-context mailing list dev-context@ntg.nl https://mailman.ntg.nl/mailman/listinfo/dev-context
Dear Henri, thank you for your suggestion. Hans already reached out to me and his suggestion matches yours. I think \contextversion is what we have been looking for. Best, Vit On Sun, Jul 17, 2022 at 07:59:02PM +0200, Henri Menke wrote:
On Fri, 2022-07-15 at 18:37 +0200, Vít Novotný wrote:
Dear ConTeXt developers,
in the l3file module of LaTeX3, we need to detect whether we are using the ConTeXt format, so that we can correctly decide which input and output streams are reserved by the format, and whether we need to \relax a control sequence before using \newread and \newwrite with it.
At the moment, we detect ConTeXt by checking that the \normalend command is defined. However, this can produce false positives outside iniTeX when LaTeX3 is loaded from the expl3-generic.tex macro package and a \normalend user command is defined. Furthermore, this can produce false negatives if a future version of ConTeXt does not define \normalend.
Can you suggest alternative internal command(s) that we can use to detect ConTeXt? Here are the desiderata:
- No false negatives: All past versions of ConTeXt define these commands. All future versions of ConTeXt are likely to define these commands.
- No false positives: The commands are long / contain characters that don't have letter catcode in the normal regime and therefore are unlikely to be defined by users. The text of the commands contains ConTeXt-specific terminology that makes them unlikely to be defined by other formats.
How about \contextversion?
Cheers, Henri
Looking forward to your helpful suggestions.
Best, Vit _______________________________________________ dev-context mailing list dev-context@ntg.nl https://mailman.ntg.nl/mailman/listinfo/dev-context
_______________________________________________ dev-context mailing list dev-context@ntg.nl https://mailman.ntg.nl/mailman/listinfo/dev-context
Dear all, however, `\fmtname` also seems to return `cont-en` consistently across different versions of ConTeXt. Since we already parse and expose `\fmtname` in LaTeX3, perhaps that would be preferable over `\contextversion` (and hopefully equally as robust)? Best, Vit On Mon, Jul 18, 2022 at 11:49:00AM +0200, Vítek Novotný wrote:
Dear Henri,
thank you for your suggestion. Hans already reached out to me and his suggestion matches yours. I think \contextversion is what we have been looking for.
Best, Vit
On Sun, Jul 17, 2022 at 07:59:02PM +0200, Henri Menke wrote:
On Fri, 2022-07-15 at 18:37 +0200, Vít Novotný wrote:
Dear ConTeXt developers,
in the l3file module of LaTeX3, we need to detect whether we are using the ConTeXt format, so that we can correctly decide which input and output streams are reserved by the format, and whether we need to \relax a control sequence before using \newread and \newwrite with it.
At the moment, we detect ConTeXt by checking that the \normalend command is defined. However, this can produce false positives outside iniTeX when LaTeX3 is loaded from the expl3-generic.tex macro package and a \normalend user command is defined. Furthermore, this can produce false negatives if a future version of ConTeXt does not define \normalend.
Can you suggest alternative internal command(s) that we can use to detect ConTeXt? Here are the desiderata:
- No false negatives: All past versions of ConTeXt define these commands. All future versions of ConTeXt are likely to define these commands.
- No false positives: The commands are long / contain characters that don't have letter catcode in the normal regime and therefore are unlikely to be defined by users. The text of the commands contains ConTeXt-specific terminology that makes them unlikely to be defined by other formats.
How about \contextversion?
Cheers, Henri
Looking forward to your helpful suggestions.
Best, Vit _______________________________________________ dev-context mailing list dev-context@ntg.nl https://mailman.ntg.nl/mailman/listinfo/dev-context
_______________________________________________ dev-context mailing list dev-context@ntg.nl https://mailman.ntg.nl/mailman/listinfo/dev-context
On Thu, 21 Jul 2022 at 21:45, Vítek Novotný wrote:
Dear all,
however, `\fmtname` also seems to return `cont-en` consistently across different versions of ConTeXt.
Unless you are using the Czech interface, that is ;) In that case you would probably get cont-cz (or cont-cs, not sure). Mojca PS: I'm not really sure if that's still a thing nowadays, but cont-nl was definitely "widely" used in the past.
Dear Mojca (and also Hans, off-list), thank you for your helpful feedback. We updated LaTeX3, so that it detects ConTeXt by the existence of the `\contextversion` command: - https://github.com/latex3/latex3/pull/1114 - https://github.com/latex3/latex3/pull/1117 Best, Vit On Sat, Jul 23, 2022 at 10:59:11AM +0200, Mojca Miklavec wrote:
On Thu, 21 Jul 2022 at 21:45, Vítek Novotný wrote:
Dear all,
however, `\fmtname` also seems to return `cont-en` consistently across different versions of ConTeXt.
Unless you are using the Czech interface, that is ;) In that case you would probably get cont-cz (or cont-cs, not sure).
Mojca
PS: I'm not really sure if that's still a thing nowadays, but cont-nl was definitely "widely" used in the past.
participants (4)
-
Henri Menke
-
Mojca Miklavec
-
Vít Novotný
-
Vítek Novotný