You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In mhchem, the charge is propertly displayed when it follows an element with a numerical subscript.
E.g. in \ce{HCO3- + H+ <-> H2CO3} the negative charge of the HCO3 molecule is rendered as a minus sign, not a negative charge, while the positive charge after the H molecule is rendered properly.
In the mhchem filter, a Charge can only follow a letter (AZ or az) or a bracket/brace/parenthesis, not a number. I think changing line 108 and 109 to the line below (adding R"09") fixes the issue, but I'm not well-versed enough in Lua/Lpeg to see whether this adds problems down the line.
That seems reasonable to me.
Maybe you could modify your filter along these lines, use it for a while, and inspect the results to make sure nothing unexpected happens. It could also be useful to add a new test case for this to test.txt, and to run the modified filter on test.txt to make sure nothing changes for the other formulas.
If you can test it out in this way, I'd be happy to incorporate the change.
I will try it out in my current project. I will also add test cases (copied from the mhchem LaTeX package documentation) and check the current test cases. If it seems OK, I will create a pull request.
In mhchem, the charge is propertly displayed when it follows an element with a numerical subscript.
E.g. in
\ce{HCO3- + H+ <-> H2CO3}
the negative charge of the HCO3 molecule is rendered as a minus sign, not a negative charge, while the positive charge after the H molecule is rendered properly.In the mhchem filter, a Charge can only follow a letter (AZ or az) or a bracket/brace/parenthesis, not a number. I think changing line 108 and 109 to the line below (adding
R"09"
) fixes the issue, but I'm not well-versed enough in Lua/Lpeg to see whether this adds problems down the line.The text was updated successfully, but these errors were encountered: