User Details
- User Since
- Jul 14 2016, 9:38 AM (406 w, 3 h)
- Availability
- Available
- LDAP User
- Unknown
- MediaWiki User
- Mhchem [ Global Accounts ]
Nov 19 2023
@mhchem what do you think?
Apr 27 2023
Mar 11 2023
I suggest these test cases. https://github.com/mhchem/mhchemParser/blob/master/test/test.html
So, what exactly do you need? An mhchem to MathML parser, right?
I wrote a TypeScript parser, so I would say I have a bit of experience. https://github.com/mhchem/mhchemParser
May 11 2020
To summarize it
that's secure enough
I am not sure what security implications you have in mind. MathJax cannot write to the hard-disk like good-old LaTeX could.
This was also asked for in the first comment of T140217
A have to admit that the wrong rendering of \ce{H - C} (as if it were \ce{H-C}) is not the fault of texvcjs removing spaces, any more. It is because the mhchem "legacy" version is still being used. (So, this would indeed be another ticket. Looking forward to switching to MathJax3 T237516).
But formulas with $ are still being modified by texvcjs, as mentioned in the first comment.
May 5 2020
Let me observe that despite this ticket being "resolved", most of the examples in the first post still do not render properly.
Feb 19 2020
Jul 24 2018
@Physikerwelt How exactly does that work? What are these "warning information from restbase"?
Jun 10 2018
@Debenben Thank you for the mhchem list. Does this include all <chem> and <ce> tags? And all math including \ce{}? (It probably doesn't include <math>\ce H</math>, but they are a no-brainer to me, so we don't need them.) BTW, equations are still cut-off before a containing >. I guess I can't easily run that extraction on my own but would need to ask you if I need an updated list in a year's time?
Jun 7 2018
@Pkra Exactly! That's why I was asking what update strategy you see.
@Debenben Your estimation might be right if you compare 'texvcjs + legacy mhchem' (current) with 'legacy mhchem'. I compared 'texvcjs + legacy mhchem' (current) with 'up-to-date mhchem'. The issue is, that users added quite a lot of braces to pass through texvcjs. But braces in mhchem syntax have a (rarely used) special meaning that was not properly implemented in legacy mhchem. I'd be fine to approach this step by step. But the goal should be to use the current mhchem version, at the end.
Jun 6 2018
Thanks for the <chem> examples. They might not be the best choice semantically, but they show that we have a severe issue with <chem>. I estimate that 90% of all usages will render differently without texvcjs. Users really were creative in their attempts to circumvent unexpected output. I don't see a chance to create an automatic conversion tool (except this tool contains a few generic rules and 900 replacements that fit just one instance). So, I would be very interested, what update strategy you see. If it would be possible to have old and new renderings active at the same time, we could auto-rename all <chem> to <chemold> and then, in a manual process, I (hopefully with a little bit of help by the community) could convert them until there is no <chemold> remaining, at which point it could be switched off.
May 30 2018
I am in!
Jan 16 2018
Jan 14 2018
Is the wrong rendering of <chem>X + Y + {\alpha}-Z</chem> (where the presence of alpha modifies the rendering of the +) related or is this a separate bug?
Weirdly enough, this is not reset by opening a new \ce. I strongly suggest, each \ce starts its own grammar parsing.
Example: <math chem>\ce{A + B ->[\text{a}] C + D} \quad \ce{C + D}</math> Both ocurrences of C + D are rendered wrongly.
Jan 13 2018
<math chem>T_{\ce{H2O}}</math> works. (Now, we just have to solve the $ issue and apply an update (legacy=false)).
Jan 12 2018
How can we resolve these gaps?
Jan 11 2018
Thanks for the new parser. It works fine on Wikipedia.
Jan 6 2018
This is an interesting usage of mhchem's \ce. It is semantically wrong, but the result might be okay.
Jul 14 2017
@Pkra Sorry for the confusion. One can use \color, of course. But the option to use it unescaped inside \ce, like in \ce{\color{red}{H2}O}, that's an undocumented feature of mhchem for MathJax. It is undocumented, rarely used, not well tested, possibly inconsistent between different implementations (MathJax, LaTeX, color.js etc.) I'd just omit it for the time being. One can always escape to math mode \ce{$\color{red}{\ce{H2}}$O}.
Jul 13 2017
To be honest, I am not sure yet, what the best solution would be. As \color was an undocumented feature anyway, I would leave it out of texvcjx, for now.
Jul 5 2017
@manfredschaefer
You mean the line <single macro> ::= '\alpha' | '\delta' | '\mu' | '\eta' | '\gamma' ! ToDo - Complete the list? Just insert all lower and uppercase greek letters.
Jun 11 2017
@Physikerwelt @manfredschaefer Could you please contact me via e-mail? I think I could contribute with some valuable hints.
Jun 7 2017
If you tell me what you're up to, I could give some feedback. You can contact me via e-mail.
Feb 12 2017
To have all options on the table (but I don't know if I would like it):
- duplicate the mhchem parser into the texvcjs code base
(The core of MathJax/mhchem is a parser that takes mhchem/ce syntax and converts it into LaTeX syntax. So instead of having "input -> texvcjs -> mhchem.js -> MathJax", one could have "input -> mhchem.js -> texvcjs -> MathJax)
Thanks for the effort. Please be aware that this is not just about whitespace. While whitespace might be the most important issue here, there are a lot of other cases where texvcjs makes it impossible to enter mhchem syntax, e.g. $\ce{^227_90Th+}$.
Jul 19 2016
Hi @Physikerwelt! Please be aware that the Grammar I provided is for checking validity of the input, only. I assumed that you are interested in "active" LaTeX tokens (like ^ _ & $ { } \macros etc.), so I focussed on these. But I simplified much by merging letters and digits. So the grammar isn't really a semantic grammar. It doesn't give you the typographic parsing of \ce{CO2 + C -> 2 CO}. In fact, for this particular example, having no active token, the grammar would just find spaces, letters and non-letters and say that it is valid (= whitelisted) input.
Jul 18 2016
This issue is now handled in https://phabricator.wikimedia.org/T140217
@Physikerwelt @csteipp
I created a grammar for checking the validity of \ce arguments.
https://raw.githubusercontent.com/mhchem/MathJax-mhchem-validity-syntax/master/mhchem-strict-simplified.grm
Jul 14 2016
@Physikerwelt Seems I have to learn quite a lot here. I did not even know that texvc's purpose is security. Can you point me to documentation? What threats are you protecting against by removing whitespace as input for a JS package?
The description is quite correct. mhchem input syntax is not LaTeX syntax.
- $\ce{^227_90Th+}$
- $\ce{X_$i$^$x$}$
Whitespace has a syntactic meaning.
- $\ce{H-C}$ differs from $\ce{H - O} differs from $\ce{H-}$ (- becoming a bond, a minus operator or negative charge)
Even braces have a synactic meaning.