# [dev-context] A robust way of detecting ConTeXt from LaTeX3

Vít Novotný witiko at mail.muni.cz
Fri Jul 15 18:37:34 CEST 2022

```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.