[XeTeX] \XeTeXpdffile causes over-long line unless wrapped in \hbox

Bruno Le Floch blflatex at gmail.com
Thu Apr 15 22:36:20 CEST 2021


> On Thu, 15 Apr 2021 at 15:42, Bruno Le Floch wrote:
> 
>     David got mislead.  The truth is rather stranger: it seems the width of the
>     image used when placing glyphs of a given hlist on the page is different from
>     (and larger than) the width of the image used when measuring the total box size.
> 
>     For instance "!" does not get eaten: it overlaps with the following "t".  What
>     happens in David's \imga is that the hbox is seen ("from the outside") as being
>     a bit smaller than it really is, as if there was a space after
>     \XeTeXpdffile...\relax and the same negative at the end of the \hbox.
> 
>     Adding a space to the line with \hbox{\img} in the original test code does not
>     give an overfull line: there are plenty enough spaces to set the line a bit
>     tighter and make it fit.
> 
>     No idea where in the code that comes from.
> 

This is even more bizarre.  It is clearly at a very late stage, and it seems
that any collection of horizontal spaces in the hlist before the image end up
being copied after the image itself, even when there are some types of
intervening material such as boxes or penalties: in the following code, the \img
ends up being followed by a copy of all the \quad on the line before \img.  And
the line overruns the margin by a corresponding amount, without any warning.
I'm too busy to dig further, but hopefully this helps someone find the root cause.

\def\img{\XeTeXpdffile "image.pdf"\relax}

test test test test test test test test test test test test test
test test test test test test test test test test test test test
test test test test test test test test test test test test test
test test test test test test test test test test test test test
\quad\quad\hbox{abc}\quad\quad\hbox{def}\relax
\img
test test test test test test test test test test test test test
test test test test test test test test test test test test test
test test test test test test test test test test test test test
test test test test test test test test test test test test test

\end



More information about the XeTeX mailing list.