Error Parsing the `\data{}` HTML Tag
Issue Summary
According to the documentation of the HTML Extnesion one can use \data{} to embed data information for the element.
I tried using it in a RevealJS and it didn't work, hence I tried on your demo and still it doesn't work. I guess my case triggers a parsing error.
Steps to Reproduce:
Try to render on the official demo the following:
$$\begin{align}
(x+1)^2
&= \class{fragment}{\data{fragment-index=5}{(x+1)(x+1)}} \\
&\class{fragment}{{}= x(x+1) + 1(x+1)} \\
&\class{fragment}{{}= (x^2+x) + (x+1)} \\
&\class{fragment}{{}= x^2 + (x + x) + 1} \\
&\class{fragment}{{}= x^2 + 2x + 1} \\
\end{align}$$
I get the parsing of:
Technical details:
- MathJax Version: 3.2
- Client OS: Windows 10
- Browser: Firefox 118.0.1
I am using the following MathJax configuration: As in demo.
By the way, it would be great if documentation would show example of adding 2-3 properties when using \style{}.
By the way, the extra {} is needed to properly align the equations.
Related to https://github.com/quarto-dev/quarto-cli/discussions/3224.
The \data macro is being added to the html extension in v4, so isn't in the v3 extension. The documentation was updated to include \data accidentally, so it is in error. You would need to use the beta version of v4 to get \data. That is why you re seeing the \data in red (indicating an undefined macro).
Note: you don't need the double dollars around the align environment, as that is a top-level environment that will start math mode all on its own (unless you have configured MathJax not to do so).
By the way, the extra
{}is needed to properly align the equations.
Yes, that is correct in this case. The table layout macros automatically insert the {} when the first item after the & is a relation (like =), but in your case, the \class macro effectively wraps its contents in an extra pair of braces that carry the class id, and the equal sign is inside of that. So the = is inside braces, and that means that the first thing after the & is the braces, not the =, and adjustment is made. This is also what would happen in actual LaTeX if you had used something like \color{red} in places of \class{fragment}, so this is consistent with actual LaTeX in that way.
By the way, it would be great if documentation would show example of adding 2-3 properties when using
\style{}.
I have added this to my list for the documentation update that will be done for v4. Thanks for the suggestion.
@dpvc , I guess I always catch expected behavior :-). Sometime from the future and sometime from the past.
As always, appreciate the time and effort to explain things so clearly.
Regarding the documentation, also an example adding 2 classes at once would also be a great services for beginners.
I guess I always catch expected behavior :-).
Sometimes the "expected behavior" label may seem not so expected, but the meaning is really that that's the way MathJax works, and it is a feature not a bug.
Regarding the documentation, also an example adding 2 classes at once would also be a great services for beginners.
I've added that to my list as well. Thanks.