
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

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 On 2/10/25 14:07, Petr Olsak wrote:
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

On Sun, 16 Feb 2025 at 16:23, Petr Olsak
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
Hi Petr, this is the plan for TeX Live 2025: 1feb: candidate/final sources committed, test builds begin. 8feb: TL pretest starts, CTAN updates continue there and in tlnet. 22feb: code freeze for final build, major bug fixes only. 1mar: final updates from CTAN, final doc tweaks. 8mar: release TL and MacTeX. It seems that we are on the right track, and very likely we will reprise the usual development cycle at the end of this month. -- luigi

Hi Luigi, I thought someone might be interested and might want to fix it for version TeXlive 2025. At least \/ behavior fixing. I understand, that the question in general (if insert italic correction at almost each end of math list or not) needs more analysis and more discussion. But \/ question is simpler. Personally, I don't mind that it won't be right away. We can wait. --- Petr On 2/16/25 18:44, luigi scarso wrote:
On Sun, 16 Feb 2025 at 16:23, Petr Olsak
wrote: 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
Hi Petr, this is the plan for TeX Live 2025: 1feb: candidate/final sources committed, test builds begin. 8feb: TL pretest starts, CTAN updates continue there and in tlnet. 22feb: code freeze for final build, major bug fixes only. 1mar: final updates from CTAN, final doc tweaks. 8mar: release TL and MacTeX.
It seems that we are on the right track, and very likely we will reprise the usual development cycle at the end of this month.
-- luigi

On Mon, 17 Feb 2025 at 13:36, Petr Olsak
Hi Luigi,
I thought someone might be interested and might want to fix it for version TeXlive 2025. At least \/ behavior fixing. I understand, that the question in general (if insert italic correction at almost each end of math list or not) needs more analysis and more discussion. But \/ question is simpler.
Personally, I don't mind that it won't be right away. We can wait.
Out of curiosity: have you tried with context mkiv? -- luigi

Am Mon, 17 Feb 2025 16:33:47 +0100 schrieb luigi scarso:
On Mon, 17 Feb 2025 at 13:36, Petr Olsak
wrote: Hi Luigi,
I thought someone might be interested and might want to fix it for version TeXlive 2025. At least \/ behavior fixing. I understand, that the question in general (if insert italic correction at almost each end of math list or not) needs more analysis and more discussion. But \/ question is simpler.
Personally, I don't mind that it won't be right away. We can wait.
I agree with Petr that the handling of italic correction at the end of the math is a bit of a pain. It pops up in questions and discussions regularly. As luatex inserts it only if a character follows, we have experimented with zero width joiner and other options but nothing looks really natural. Eg \documentclass{article} \usepackage{unicode-math} \setmathfont{XITS Math} \begin{document} $\mathcal{P}x \mathcal{P}$x $\mathcal{P}\strut x \mathcal{P}\Uchar"200D$x \end{document} -- Ulrike Fischer http://www.troubleshooting-tex.de/

On Mon, 17 Feb 2025 at 16:45, Ulrike Fischer
Am Mon, 17 Feb 2025 16:33:47 +0100 schrieb luigi scarso:
On Mon, 17 Feb 2025 at 13:36, Petr Olsak
wrote: Hi Luigi,
I thought someone might be interested and might want to fix it for version TeXlive 2025. At least \/ behavior fixing. I understand, that the question in general (if insert italic correction at almost each end of math list or not) needs more analysis and more discussion. But \/ question is simpler.
Personally, I don't mind that it won't be right away. We can wait.
I agree with Petr that the handling of italic correction at the end of the math is a bit of a pain. It pops up in questions and discussions regularly. As luatex inserts it only if a character follows, we have experimented with zero width joiner and other options but nothing looks really natural. Eg
\documentclass{article} \usepackage{unicode-math} \setmathfont{XITS Math} \begin{document} $\mathcal{P}x \mathcal{P}$x
$\mathcal{P}\strut x \mathcal{P}\Uchar"200D$x \end{document}
-- Ulrike Fischer http://www.troubleshooting-tex.de/
So it's a bug even considering 7.5.5 Math italic mess of the reference luatex.pdf ? -- luigi

On Mon, 17 Feb 2025 at 17:13, luigi scarso
On Mon, 17 Feb 2025 at 16:45, Ulrike Fischer
wrote: Am Mon, 17 Feb 2025 16:33:47 +0100 schrieb luigi scarso:
On Mon, 17 Feb 2025 at 13:36, Petr Olsak
wrote: Hi Luigi,
I thought someone might be interested and might want to fix it for version TeXlive 2025. At least \/ behavior fixing. I understand, that the question in general (if insert italic correction at almost each end of math list or not) needs more analysis and more discussion. But \/ question is simpler.
Personally, I don't mind that it won't be right away. We can wait.
I agree with Petr that the handling of italic correction at the end of the math is a bit of a pain. It pops up in questions and discussions regularly. As luatex inserts it only if a character follows, we have experimented with zero width joiner and other options but nothing looks really natural. Eg
\documentclass{article} \usepackage{unicode-math} \setmathfont{XITS Math} \begin{document} $\mathcal{P}x \mathcal{P}$x
$\mathcal{P}\strut x \mathcal{P}\Uchar"200D$x \end{document}
-- Ulrike Fischer http://www.troubleshooting-tex.de/
So it's a bug even considering 7.5.5 Math italic mess of the reference luatex.pdf ?
Yes (or perhaps unfortunate design rather than bug) the mathitalicsmode parameter described in that section doesn't allow a specification of a behaviour compatible with other engines. As Ulrike says you have to try to force in an invisible character node or add the italic correction "by hand" for luatex. David
-- luigi _______________________________________________ dev-luatex mailing list -- dev-luatex@ntg.nl To unsubscribe send an email to dev-luatex-leave@ntg.nl

On 2/17/25 18:12, luigi scarso wrote:
So it's a bug even considering 7.5.5 Math italic mess of the reference luatex.pdf ?
-- luigi
Section 7.5.5 is very vague, its example of \mathitalicsmode=0 or 1 show no difference (more exactly: I am unable to see any difference). When we keep the example 1.$f!$, 2. $f$!, 3. $f\/$! and we say, that italic correction inserted is correct in all three cases (as XeTeX does it), then we can see: \mathitalicmode=0: 1. OK, 2 bad, 3. bad \mathitalicmode=1: 1. OK, 2 bad, 3. OK \mathitalicmode=2: 1. bad, 2 OK, 3. OK It is magic. Petr

On Tue, 18 Feb 2025 at 09:10, Petr Olsak
On 2/17/25 18:12, luigi scarso wrote:
So it's a bug even considering 7.5.5 Math italic mess of the reference luatex.pdf ?
-- luigi
Section 7.5.5 is very vague, its example of \mathitalicsmode=0 or 1 show no difference (more exactly: I am unable to see any difference).
When we keep the example 1.$f!$, 2. $f$!, 3. $f\/$! and we say, that italic correction inserted is correct in all three cases (as XeTeX does it), then we can see:
\mathitalicmode=0: 1. OK, 2 bad, 3. bad
\mathitalicmode=1: 1. OK, 2 bad, 3. OK
\mathitalicmode=2: 1. bad, 2 OK, 3. OK
It is magic.
Petr
nothing is magic, at most it is not well documented; the C code is the definitive reference. See https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/luatexdir/t... -- luigi
participants (4)
-
David Carlisle
-
luigi scarso
-
Petr Olsak
-
Ulrike Fischer