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

Bruno Le Floch blflatex at gmail.com
Thu Apr 15 16:41:11 CEST 2021


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.



On 4/15/21 4:31 PM, Jonathan Kew wrote:
> On 15/04/2021 15:24, David Carlisle wrote:
>> The command is scanning ahead for keywords such as  page 2 in the unhboxed case 
> 
> Shouldn't the \relax stop it scanning ahead anyway?
> 
>> but in the boxed case the } stops the scan but it seems having decided that 
>> test is not a keyword it is inserting a space before it which seems wrong.
>> More surprising is that it eats ! here even though  ! isn't part of the
>> allowed syntax as far as I can see
>>
>>
>> \def\imga{\hbox{\XeTeXpdffile "image.pdf"\relax!}}
>> \def\imgb{\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
>> \imga
>> 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
>>
>>
>> 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
>> \imgb
>> 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
>>
>>
>> The effect on linebreaking is more or less accidental "test" can't be
>> hyphenated so it's not surprising that some lines can not be justified, and
>> the extra space or not space after the image is changing the linebreaking in
>> the paragraph.
>>
>> David
>>
>>
>>
>> On Thu, 15 Apr 2021 at 14:24, Gavin Smith wrote:
>>
>>     If I XeTeX to display an image in text, like
>>
>>     \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
>>     \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
>>
>>     and then process with "xetex test.tex" on the command line, then the
>>     line
>>     after the image is too long and goes into the margin.  You can see this
>>     in the attached file.
>>
>>     I found wrapping the \XeTeXpdffile in an \hbox, thus:
>>
>>     \def\img{\hbox{\XeTeXpdffile "image.pdf"\relax}}
>>
>>     fixed the problem, but I don't see why this should be necessary.
>>
>>     Is this a bug?
>>
>>     XeTeX reports its version as follows:
>>
>>     $ xetex test.texi
>>     This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017/Debian)
>>     (preloaded format=xetex)
>>       restricted \write18 enabled.
>>     entering extended mode
>>     (./test.texi [1] )
>>     Output written on test.pdf (1 page).
>>     Transcript written on test.log.
>>
> 



More information about the XeTeX mailing list.