Let's create a package that tests for ExplSyntax mode:
\begin{filecontents}[overwrite]{myexplpackage.sty}
\ProvidesExplPackage{myexplpackage}{2026-06-24}{1}{description}
\newcommand{\explstatus}{
\bool_if:NTF\l__kernel_expl_bool
{\typeout{EXPLSYNTAX~IS~ON}}
{\typeout{EXPLSYNTAX~IS~OFF}}
}
\explstatus % should be on
\end{filecontents}
\begin{filecontents*}[overwrite]{myexplpackage.sty.ltxml}
use strict;
use warnings;
use LaTeXML::Package;
InputDefinitions('myexplpackage', type=>'sty', noltxml => 1);
\end{filecontents*}
\documentclass{article}
\usepackage{myexplpackage}
\explstatus % should be off
\begin{document}
content
\end{document}
If I compile, LaTeX has a log file saying "EXPLSYNTAX IS ON" (while the package is being read) and then two lines later "EXPLSYNTAX IS OFF" (after the package has finished). LaTeXML does the same thing. So far so good.
If I compile with --preload=myexplpackage.sty, however, then both lines say "EXPLSYNTAX IS ON", and we are now in expl syntax mode.
Let's create a package that tests for ExplSyntax mode:
If I compile, LaTeX has a log file saying "EXPLSYNTAX IS ON" (while the package is being read) and then two lines later "EXPLSYNTAX IS OFF" (after the package has finished). LaTeXML does the same thing. So far so good.
If I compile with
--preload=myexplpackage.sty, however, then both lines say "EXPLSYNTAX IS ON", and we are now in expl syntax mode.