From 601c2e4c3bad50e15775fd47fd7f9b808d05454b Mon Sep 17 00:00:00 2001 From: disidrosi Date: Mon, 23 Jun 2025 11:33:11 +0200 Subject: [PATCH] fix: replace quarks in stroichiometry parsing Replace `\q_mark` with `\s_stop` in `\__chemformula_parse_stoich:w` and `l__chemformula_stoich_tl` to prevent infinite expansion loops during chemical formula compilation. Scan marks are safer as they expand to `\scan_stop:` rather than themselves. Fixes compilation error: "Argument of \use_non:n has an extra }" Credit: Fix provided by jlab on Stack Exchange https://tex.stackexchange.com/a/746654/148997 --- chemformula.sty | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chemformula.sty b/chemformula.sty index 3a7b1d9..c16ba3a 100644 --- a/chemformula.sty +++ b/chemformula.sty @@ -2324,7 +2324,7 @@ { \tl_if_blank:VF \l__chemformula_stoich_tl { - \tl_put_left:Nn \l__chemformula_stoich_tl { \q_mark } + \tl_put_left:Nn \l__chemformula_stoich_tl { \s_stop } \__chemformula_sanitize:NV \l__chemformula_stoich_tl \l__chemformula_stoich_tl @@ -2355,7 +2355,7 @@ \group_end: } -\cs_new_protected:Npn \__chemformula_parse_stoich:w \q_mark #1 \q_nil +\cs_new_protected:Npn \__chemformula_parse_stoich:w \s_stop #1 \q_nil { \__chemformula_bool_set_if_first_last:Nnnn \l__chemformula_stoich_is_iupac_bool {#1} { ( } { ) }