Hello,
Can I remind you of this problem?
It would be great if they could at least fix the bug with ignoring the explicit kern \/ command at the end of the math list.
Thanks
Petr Olsak
Hello
I suppose that the luatex binary is fixed for TeXlive 2025, so I can open an additional problem and I won't disturb you while finalizing the binaries:).
Use this test file:
-------------------
\input luaotfload.sty
\font\f=[latinmodern-math]:mode=base;script=math;
\textfont0=\f \Umathcode `f= 0 0 "1D453 % italic f from Unicode math font
$f!$, $f$!, $f\/$!
\showboxbreadth=100 \batchmode \showlists
\bye
---------------------
When luatex processes it, we get italic correction only in the first case:
\mathon
.\f đ
.\kern0.9 (italic)
.\f !
.\mathoff
.\tenrm ,
.\glue(\spaceskip) 3.33333 plus 2.08331 minus 0.88889
.\mathon
.\f đ
.\mathoff
.\tenrm !
.\tenrm ,
.\glue(\spaceskip) 3.33333 plus 2.08331 minus 0.88889
.\mathon
.\f đ
.\kern0.0 (font)
.\mathoff
.\tenrm !
Yes, fontforge shows that latinmodern-math italic f has italic correction 90, i.e. 0.9pt for the font at 10pt. And the italic correction is inserted in the first case according to rule 17 of appendix G of TeXbook, where we only need to add: "if the symbol is not a text symbol or if \fontdimen2 is zero **or if script=math fontfeature is used** then insert italic correction". It sounds OK, it is natural extension of the original Knuth's idea: his math scripts were in fonts cmmi10 and cmsy10 where \fontdimen2=0pt.
But:
A) why the italic correction isn't inserted in case 2? The rule 17 in appendix G of TeXbook says that "if the single-char atom isn't a text symbol (i.e. it isn't followed by a next specific atom) then the italic correction is inserted". The condition is obviously true for the last single-char atom of the math list. But luatex with Unicode math font doesn't respect this rule. Why?
B) why there is \kern0.0 in the third case where we want to insert explicit italic correction (which is 0.9pt as fontforge says)?
When we comment out the third line in our example (\textfont0=...), i.e. the classical plain TeX setting with 7bit tfm fonts is used, then luatex inserts italic correction in all three cases. It means that explicit \/ works and rule 17 from appendix G is respected.
OK, maybe it is a decision of somebody who implemented Unicode math because missing italic corrections at the end of math list looks better, for example at the end of a sentence (ef-dot): $f$. I.e. the rule 17 from TeXbook will be not respected. But if our sentence ends by $f$! or by $f$? then the result looks very bad and user is unable to do local corrections by explicit \/.
The problem is not due to simplification of the example here. If you try lualatex with unicode-math macros or OpTeX, you get the same results.
Note that xetex puts correctly italic corrections in all three cases even though a Unicode math font is loaded.
Can someone explain me this confusing behavior?
Thanks
Petr Olsak