Closed lyxabymxlc closed 4 years ago
MathJax does not process macros or special characters inside \text{}
or other text-mode macros, except for math delimiters and a few escaped characters like \$
and \{
. All other characters are shown verbatim. This is because MathJax doesn't process text-mode, only math mode. You are correct that this is not consistent with LaTeX, but it is how MathJax is currently implemented.
There is a pull request that adds a new MathJax extension that supports more text-mode macros and special characters. It would handle this situation for you. You could download the extension file from the pull request and use the technique given in this comment for loading the extension into MathJax node.
@dpvc Thank you. I'll try it.
@dpvc It solved my problem perfectly. Thank you very much.
@dpvc After using the new plug-in'text-macros', there is a new problem.
For example: {{P}_\text{L{\text{max}}}}={{U}_\text{L}}{{I}_\text{L}}=3\text{V}\times 0.3\text{A}=0.9\text{W}
Error reporting when converting mathml:
TeX parse error: '\text' is only supported in math mode
How can I repair it? Thank you.
For example:{A} '. The brackets '{}' on both sides of 'A' are redundant.
How can I repair it? Thank you.
$${\text{{A}}_{2}}$$
The code for converting to MathML is as follows:<math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\text{{A}}_{2}}">
<mrow class="MJX-TeXAtom-ORD">
<msub>
<mtext>{A}</mtext>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msub>
</mrow>
</math>
But it's wrong, It should not be'