Hello,
I am currently typesetting documents with pdfTeX as well as with LuaTeX. The documents use Latin Modern with font expansion and protrusion. While pdfTeX typesets them without any overfull/underfull boxes, LuaTeX produces quite a few overfull boxes (one of them above).
Can you send me a small test file?
As promised, I looked into the phenomenon. Follows the test file (using Computer Modern instead of Latin Modern) as well as some observations (you might want to skip to my conclusion/theory at the end first). pdfTeX is 3.141592-1.40.3, LuaTeX 3.141592-beta-0.11.2-2007091918. Format is, as usual, PlainTeX. ------------------------------------------------------------------------ \pdfoutput1 \pdffontexpand\tenrm 10 10 10 autoexpand\relax % A % \pdffontexpand\tenrm 10 20 10 autoexpand\relax % B % \pdffontexpand\tenrm 10 30 10 autoexpand\relax % C % \pdffontexpand\tenrm 10 40 10 autoexpand\relax % D % \pdffontexpand\tenrm 10 50 10 autoexpand\relax % E % \pdffontexpand\tenrm 10 60 10 autoexpand\relax % F % \pdffontexpand\tenrm 60 10 10 autoexpand\relax % G % \pdffontexpand\tenrm 0 10 10 autoexpand\relax % H % \pdffontexpand\tenrm 0 20 10 autoexpand\relax % I % \pdffontexpand\tenrm 0 30 10 autoexpand\relax % J % \pdffontexpand\tenrm 0 40 10 autoexpand\relax % K % \pdffontexpand\tenrm 0 50 10 autoexpand\relax % L % \pdffontexpand\tenrm 60 110 10 autoexpand\relax % M % Can be set to 1, no change in the result \pdfadjustspacing2 % Is 56.9055pt in pdfTeX as well as LuaTeX: \hsize=2cm % \message{\the\hsize} \tenrm nnnnnnn \bye ---------------------------------------------------------------- A side-note: I do not know if this is due to an error in logging, but compare pdfTeX and LuaTeX:
This is pdfTeX, Version 3.141592-1.40.3 (Web2C 7.5.6) entering extended mode (./OverfullBoxTest.tex Overfull \hbox (1.5946pt too wide) in paragraph at lines 10--11 []\tenrm (-10) nnnnnnn | <<<
The (-10) is missing in LuaTeX:
This is luaTeX, Version 3.141592-beta-0.11.2-2007091918 (Web2C 7.5.6) (OverfullBoxTest.tex Overfull \hbox (1.97966pt too wide) in paragraph at lines 10--11 [][]\tenrm nnnnnnn | <<<
Looking at the results below, I would guess that this is a logging problem. Or a side-effect of the `fixed' expansion (see below). ---------------------------------------------------------------- Typesetting the document: No expansion + \pdfadjustspacing=2, pdfTeX: Overfull \hbox (1.9835pt too wide) in paragraph at lines 20--21 []\tenrm nnnnnnn | No expansion + \pdfadjustspacing=2, LuaTeX: Overfull \hbox (1.9835pt too wide) in paragraph at lines 20--21 [][]\tenrm nnnnnnn | ****** No expansion + \pdfadjustspacing=0, pdfTeX: Overfull \hbox (1.9835pt too wide) in paragraph at lines 20--21 []\tenrm nnnnnnn | No expansion + \pdfadjustspacing=0, LuaTeX: Overfull \hbox (1.9835pt too wide) in paragraph at lines 20--21 [][]\tenrm nnnnnnn | ****** Expansion A + \pdfadjustspacing=0, pdfTeX: Overfull \hbox (1.9835pt too wide) in paragraph at lines 20--21 []\tenrm nnnnnnn | Expansion A + \pdfadjustspacing=0, LuaTeX: Overfull \hbox (1.97966pt too wide) in paragraph at lines 20--21 [][]\tenrm nnnnnnn | ****** Typesetting the document with one of the lines A-M active: A, pdfTeX: Overfull \hbox (1.5946pt too wide) in paragraph at lines 14--15 []\tenrm (-10) nnnnnnn | (0.3889pt less than no expansion) A, LuaTeX: Overfull \hbox (1.97966pt too wide) in paragraph at lines 14--15 [][]\tenrm nnnnnnn | (0.00384pt less than no expansion) ****** B, pdfTeX: Overfull \hbox (1.2057pt too wide) in paragraph at lines 14--15 []\tenrm (-20) nnnnnnn | (0.3889pt less than A) B, LuaTeX: Overfull \hbox (1.5868pt too wide) in paragraph at lines 14--15 [][]\tenrm nnnnnnn | (0.39286pt less than A) ****** C, pdfTeX: Overfull \hbox (0.8168pt too wide) in paragraph at lines 14--15 []\tenrm (-30) nnnnnnn | (0.3889pt less than B) C, LuaTeX: Overfull \hbox (1.19406pt too wide) in paragraph at lines 14--15 [][]\tenrm nnnnnnn | (0.39274pt less than B) ****** D, pdfTeX: Overfull \hbox (0.4279pt too wide) in paragraph at lines 14--15 []\tenrm (-40) nnnnnnn | (0.3889pt less than C) D, LuaTeX: Overfull \hbox (0.80132pt too wide) in paragraph at lines 14--15 [][]\tenrm nnnnnnn | (0.39274pt less than C) ****** E, pdfTeX: (no overfull boxes) E, LuaTeX: Overfull \hbox (0.40846pt too wide) in paragraph at lines 15--16 [][]\tenrm nnnnnnn | (0.30286pt less than D) ****** F, pdfTeX: (no overfull boxes) F, LuaTeX: (no overfull boxes) ****** G, pdfTeX: Overfull \hbox (1.5946pt too wide) in paragraph at lines 21--22 []\tenrm (-10) nnnnnnn | (as expected, see A) G, LuaTeX: Overfull \hbox (3.90462pt too wide) in paragraph at lines 21--22 [][]\tenrm nnnnnnn | (1.92112pt wider than the overfull box when no expansion is used, and 1.92496pt wider than the overfull box when expansion `10 10 10' is used) ****** H, pdfTeX: Overfull \hbox (1.5946pt too wide) in paragraph at lines 22--23 []\tenrm (-10) nnnnnnn | (as expected, see A) H, LuaTeX: Overfull \hbox (1.5946pt too wide) in paragraph at lines 22--23 [][]\tenrm nnnnnnn | (the same result as pdfTeX) ****** I, pdfTeX: Overfull \hbox (1.2057pt too wide) in paragraph at lines 26--27 []\tenrm (-20) nnnnnnn | (as expected, see B) I, LuaTeX: Overfull \hbox (1.2057pt too wide) in paragraph at lines 26--27 [][]\tenrm nnnnnnn | (the same result as pdfTeX) ****** J, pdfTeX: Overfull \hbox (0.8168pt too wide) in paragraph at lines 26--27 []\tenrm (-30) nnnnnnn | (as expected, see C) J, LuaTeX: Overfull \hbox (0.8168pt too wide) in paragraph at lines 26--27 [][]\tenrm nnnnnnn | (the same result as pdfTeX) ***** K, pdfTeX: Overfull \hbox (0.4279pt too wide) in paragraph at lines 26--27 []\tenrm (-40) nnnnnnn | (as expected, see D) K, LuaTeX: Overfull \hbox (0.4279pt too wide) in paragraph at lines 26--27 [][]\tenrm nnnnnnn | (the same result as pdfTeX) ****** L, pdfTeX: (no overfull boxes, see E) L, LuaTeX: (no overfull boxes, the same result as pdfTeX) ****** M, pdfTeX: (no overfull boxes) M, LuaTeX: (no overfull boxes) -------------------------------------------------------------------- Observations (in chronological order): - LuaTeX creates wider overfull boxes than pdfTeX (thus requiring more shrinking to fit the text onto the line). - This is only true when expansion is used. - When a font is expanded in LuaTeX, the overfull box is slightly smaller, even if \pdfadjustspacing is zero. In fact, it seems that LuaTeX ignores \pdfadjustspacing (using what value instead?). - Using pdfTeX, the overfull boxes shrink a constant amount, in LuaTeX the amount varies (quite considerably, when comparing the first step and the other ones). - Increasing the stretch for a font seems to stretch the font even if this is not necessary (case G). - If a font has no stretch (cases H-L), the result is identical to pdfTeX. - As shown in case M, increasing the maximum shrink finally cancels out even a (more or less) big stretch. - Stretch and shrink to not cancel each other out exactly, as shown in case A: Stretch 10 - shrink 10 should give the same result as no expansion, but the overfull box is slightly less overfull. - Not shown in the log, but when examining the PDF (see OverfullBoxTest_N_110.pdf and OverfullBoxTest_N_1000.pdf): Larger shrink values (i.e. 1000) make LuaTeX shrink the font further, even if not required, resulting in lines which are too short. Note: expansion for the two PDFs was `60 110 10' and `60 1000 10', respectively. Theory: When shrinking a font, LuaTeX first stretches it as far as the \pdffontexpand parameters will allow, and then shrinks it, again as far as allowed. ------------------------------------------------------------------------
Best wishes, Taco
I hope this helps, Jonathan