Page MenuHomePhabricator

texvcjs - Find solution for other commands within \ce
Closed, ResolvedPublic

Description

The (strict) \ce syntax I provided allowed "other" LaTeX commands to be included in \ce only if they were surrounded by $.
Example: <chem>A B C $\cdots$</chem>

However, there are quite a lot of usages out there that include these commands directly into the tag. <chem>A B C \cdots</chem>.

It seems like you allow that, but you parse everything in another mode (for instance, removing whitespace), so that the result will be not as expected. The will render differently in <chem>A B C</chem> and <chem>A B C \cdots</chem>, just because \cdots is present. This is not what a user would expect.

In general, I don't like the idea of two parsing modes. Same input should lead to the same output.

mhchem does support the sloppy syntax (without $), so it could be enabled if you want to include it into your grammar. I guess this will make things a little bit more complicated.

How should we go about this?

Event Timeline

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?

The dollar sign was problematic. There is the begin{math} end{math} workaround.

To summarize it

original mhchem syntax:
<chem>A B C $\cdots$</chem>
workaround:
<chem>A B C \begin{math}\cdots\end{math}</chem>

original mhchem syntax:
<chem>NO_$x$</chem>
workaround (after mhchem is updated)
<chem>NO_\begin{math}x\end{math}</chem>

I don't like it very much, but at least there is a workaround.