[XeTeX] Problem: Beamer+xelatex+\XeTeXdefaultencoding

Ross Moore ross.moore at mq.edu.au
Tue Jun 22 01:49:26 CEST 2010

Hi Heiko,

On 22/06/2010, at 9:26 AM, Heiko Oberdiek wrote:

>> When reading the input stream, a single line-end character might 
>> be generated at the start ?
>> But that still leaves open the question of how it picks up
>> the character string '@safe at act' .
>> Maybe it all happens internally and there is a buffer overrun?
> I came to the same conclusion, see my answer to Josephs mail.

> The problem is not related to hyperref:
> \documentclass{article}
> \XeTeXdefaultencoding "UTF-8"
> \AtBeginDocument{%
>  \InputIfFileExists{t003.out}{}{}
> }
> \begin{document}
> \end{document}
> It shows the string "OT1/cm".


The problem is perhaps really within LaTeX's  
 \IfFileExists  command.

It doesn't use TeX's  \immediate  qualifier
when calling  \openin  and  \closein for the preliminary
check to see whether the file exists or not.
The need for this primitive is discussed in the TeXbook ,
and surely the preliminary check is precisely a place
where it should be used.

Fixing it in the preamble makes the problem go away.

>>> \makeatletter
>>> \def\IfFileExists#1#2#3{%
>>>  \immediate\openin\@inputcheck #1%
>>>  \ifeof\@inputcheck 
>>>   \ifx\input at path\@undefined
>>>    \def\reserved at a{#3}%
>>>   \else 
>>>    \def\reserved at a{\@iffileonpath{#1}{#2}{#3}}%
>>>   \fi 
>>>  \else
>>>   \immediate\closein\@inputcheck 
>>>   \edef\@filef at und{#1 }%
>>>   \def\reserved at a{#2}%
>>>  \fi 
>>>  \reserved at a
>>> }
>>> \makeatother

Of course there may still be a need for XeTeX to
be cleaned up a bit, as it is rather weird that it 
only happens when  \XeTeXdefaultencoding  is used.

> Yours sincerely
>  Heiko Oberdiek



Ross Moore                                       ross.moore at mq.edu.au 
Mathematics Department                           office: E7A-419      
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114

More information about the XeTeX mailing list