[Dev-luatex] Duplicated italic correction in do_delimiter

Marcel Fabian Kr├╝ger tex at 2krueger.de
Sat Jan 30 14:33:31 CET 2021


Hi,

take the following document:

\font\extend ntxexx at 10pt
\textfont3=\extend

\showboxdepth\maxdimen
\showboxbreadth\maxdimen

\setbox0=\hbox{$ \big) $}
\showbox0
\bye

It writes to the log:

> \box0=
\hbox(8.5+3.1125)x4.72997, direction TLT
.\mathon
.\hbox(8.5+3.1125)x4.72997, direction TLT
..\mathon
..\hbox(8.5+3.1125)x4.72997, direction TLT
...\hbox(0.56+10.665)x4.72997, shifted -7.55249, direction TLT
....\extend ^A
...\vbox(8.5+0.0)x0.0, direction TLT
...\hbox(0.0+0.0)x0.0, direction TLT
..\mathoff
.\mathoff

Particularly note the width 4.72997 of the hbox with the delimiter.
If we look at the relevant part of the tfm file (in pl format), we find
the dimensions of the glyph as

(CHARACTER O 1
   (CHARWD R 0.313)
   (CHARHT R 0.056)
   (CHARDP R 1.0665)
   (CHARIC R 0.08)
   (NEXTLARGER O 21)
   )

We would expect the width of the box to be
10pt*(CHARWD+CHARIC)=10pt*(0.313+0.08)=3.93pt.
Instead we get
10pt*(CHARWD+2*CHARIC)=10pt*(0.313+2*0.08)=4.73pt~4.72997.

The cause of this is in mlist.c, do_delimiter (around line 1652):

            b = char_box(f, c, att);
            if (!do_new_math(f)) {
                /*tex Italic gets added to width. */
                width(b) += char_italic(f, c);
            }

The char_box function already adds the italic correction to the box
width if new math isn't used, therefore the additionally added
char_italic leads to the duplicated value.

This can be fixed by removing the if block:

diff --git a/source/texk/web2c/luatexdir/tex/mlist.c b/source/texk/web2c/luatexdir/tex/mlist.c
index c34dee488..e9df7b13f 100644
--- a/source/texk/web2c/luatexdir/tex/mlist.c
+++ b/source/texk/web2c/luatexdir/tex/mlist.c
@@ -1649,11 +1649,8 @@ static pointer do_delimiter(pointer q, pointer d, int s, scaled v, boolean flat,
             if (same != NULL && x == c) {
                 *same = emas;
             }
+            /*tex italic gets added to width */
             b = char_box(f, c, att);
-            if (!do_new_math(f)) {
-                /*tex Italic gets added to width. */
-                width(b) += char_italic(f, c);
-            }
             if (delta != NULL) {
                 /*tex This used to be (f, x). */
                 *delta = char_italic(f, c);
--

Best regards,
Marcel


More information about the dev-luatex mailing list