mhchem vs expl3 bug
The code \bool_if:NT \l__mhchem_cg_isScript_bool {...}
was added in version 4.04 of mhchem.sty
. However, the addressed boolean variable is nowhere defined.
With previous versions of expl3
, such a case was dealt with by considering the boolean as false, now it is not so any longer.
By the way, as there obviously is no way to toggle the boolean's value, the code is completely useless (and it would be so even if the boolean was defined).
Here's a temporary fix, which wouldn't be invalid even after the package author defines the boolean variable.
\documentclass{article}
\usepackage[version=4]{mhchem}
\ExplSyntaxOn
\bool_if_exist:NF \l__mhchem_cg_isScript_bool
{
\bool_new:N \l__mhchem_cg_isScript_bool
}
\ExplSyntaxOff
\begin{document}
$\ce{NO_$x$}$
$\ce{NO_$x+y$}$
\end{document}
mhchem
v4.07 fixes this bug.
Thanks a lot for reporting this and all your research into that matter. Thanks @egreg! This seems indeed to be a leftover of an experiment I did once and did not completely reverse. And my (wrong) code stopped working with an expl3
update. I will publish an update of mhchem
during the next couple of days.