]> git.lyx.org Git - features.git/commit
Before this patch, each character within InsetMathClass was output separately, withou...
authorThibaut Cuvelier <dourouc05@gmail.com>
Thu, 27 Jul 2023 05:21:46 +0000 (01:21 -0400)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Thu, 27 Jul 2023 05:22:30 +0000 (01:22 -0400)
commit98d1b04160c938ddca4b73809fc72c7bcb762635
treea7700774ebf4d4ccc0484395166a40823654e4bb
parentcc22d766a93a2cea097f1da227ef9fc5861f25a3
Before this patch, each character within InsetMathClass was output separately, without understanding their meaning, using the default text output (with [] around each character). This commit changes the behaviour to skip the InsetMathClass during the MathML output. This effectively renders the inset useless for MathML (instead of controlling spacing), as expected, because the MathML processor is supposed to handle the spacing itself.

Another implementation would have been to use the lspace and rspace attributes in MathML, but they require to give the exact spacing before and after the operator instead of relying on rules like TeX.

For instance, `$a\mathbin{+}b$` resulted in this MathML output before the patch:

```
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
 <mi>a</mi><!--  -->
 <mi>[mathbin [char + mathalpha]]</mi>
 <mi>b</mi>
</mrow>
</math>
```

For comparison, this was the output with LyX 2.3.7

```
<math xmlns="http://www.w3.org/1998/Math/MathML">
 <mrow>
  <mrow><mi>a</mi><!--  -->
   <mi>[mathbin [char + mathalpha]]
   </mi><mi>b</mi>
  </mrow>
 </mrow></math>
 ```

 After this patch, it looks like:

 ```
 <math xmlns='http://www.w3.org/1998/Math/MathML'>
 <mstyle class='math'>
  <mrow>
   <mi>a</mi>
   <mo>+</mo>
   <mi>b</mi>
  </mrow>
 </mstyle>
 </math>
 ```
src/mathed/InsetMathClass.cpp
src/mathed/InsetMathClass.h
src/mathed/MathClass.h