-
-
Notifications
You must be signed in to change notification settings - Fork 102
Description
Issue found by @pekkavaa
Observed
The following math formula...
$`\mathbf{x_i}`
.... crashes with an error.
Workaround
One can use \mathbf{x}_\mathbf{i} i.e. mathxxx variant-changing commands only on identifiers.
Analysis
It is due to our interpretation of \mathbf (and other similar commands) as very simple macro definition, only working on final identifiers (i.e. as MathML <mi>), not around full expressions:
\def{mathbf}{\mi[mathvariant=bold]{#1}} % ---> so %1 here has to be a string/symbol identifier
For the record, MathJax supports it, but by propagating the property recursively down to the inner MathML identifiers and operators (if I understand well how it does it):
This would require a higher-level hard-coded logic in the LPEG parser, probably, to get it right (e.g. perhaps not wrapping anything, but handling a stack for applying the math variant on inner <mi>'s and mo's (if they have none explicit) -- that's just a wild guess...)
Extracted from #2291
Metadata
Metadata
Assignees
Labels
Type
Projects
Status