File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,19 @@ local mathGrammar = function (_ENV)
1818 local _ = WS ^ 0
1919 local eol = S " \r\n "
2020 local digit = R (" 09" )
21- local natural = digit ^ 1 / tostring
21+ local natural = (
22+ -- TeX doesn't really knows what a number in a formula is.
23+ -- It handles any sequence of "ordinary" characters, including period(s):
24+ -- See for instance The TeXbook, p. 132.
25+ -- When later converting to MathML, we'll ideally want <mn>0.0123</mn>
26+ -- instead of, say, <mn>0</mn><mo>.</mo><mn>0123</mn> (not only wrong
27+ -- in essence, but also taking the risk of using a <mo> operator, then
28+ -- considered as a punctuation, thus inserting a space)
29+ -- We cannot be general, but checking MathJax and TeMML's behavior, they
30+ -- are not general either in this regard.
31+ digit ^ 0 * P (" ." )^- 1 * digit ^ 1 + -- Decimal number (ex: 1.23, 0.23, .23)
32+ digit ^ 1 -- Integer (digits only, ex: 123)
33+ ) / tostring
2234 local pos_natural = R (" 19" ) * digit ^ 0 / tonumber
2335 local ctrl_word = R (" AZ" , " az" )^ 1
2436 local ctrl_symbol = P (1 ) - S " {}\\ "
You can’t perform that action at this time.
0 commit comments