[XeTeX] Low-level diagnostic ("fwrite") generated by XeTeX

Ross Moore ross at ics.mq.edu.au
Tue Feb 2 19:11:51 CET 2010

Hi Jonathan, and Phil,

On 03/02/2010, at 4:46 AM, Jonathan Kew wrote:

> On 2 Feb 2010, at 16:43, Philip TAYLOR wrote:
>> If the PDF file to which XeTeX is to write
>> is already open in Adobe Acrobat, XeTeX
>> terminates with a low-level diagnostic
>> concerning "fwrite" :

Surely this is just a normal function of how the operating
system works, to maintain integrity of the file-system.
That is, preventing 2 different applications from the
possibility of making incompatible changes to the same file.

> Hmmm.... I guess the output driver (xdvipdfmx) is complaining that  
> it can't open its output file (because Acrobat has it locked), and  
> quitting - and then xetex fails when trying to send data to it.  
> Obviously this situation needs some better error handling.

This is no different to how it has always been with
other TeX engines and dvi-processors/pdf-generators,
such as  pdfTeX and Ghostscript.

Front-ends, such as TeXshop, recognise that a PDF file is being
changed, so send the appropriate event to the viewer asking
for the PDF to be released. Later a refresh event is sent.

But if you work entirely from the command-line, you need
to *remember* to close the PDF in Acrobat Reader before the
PDF is released for XeTeX + its driver to complete their job.

How can XeTeX, or xdvipdfmx, know what viewer is being used?

To me this is an issue for the human user to handle, not for
the driver software to try to solve. After all, that is what
front-ends are for.

>>> H:\TeX\Projects\Correspondence>xetex we-have-moved
>>> This is XeTeX, Version 3.1415926-2.2-0.9995.2 (Web2C 2009)
>>> entering extended mode
>>> (./we-have-moved.tex (./SL-Preamble.tex (./Sender.tex)) (./Amex.tex)
>>> (./SL-Body.tex) [1] (./SL-Preamble.tex (./Sender.tex)) (./Aviva.tex)
>>> (./SL-Body.tex) [2] (./SL-Preamble.tex (./Sender.tex)) (./ 
>>> Barclays-SB.tex)
>>> (./SL-Body.tex) [3] (./SL-Preamble.tex (./Sender.tex)) (./ 
>>> Citibank.tex)
>>> (./SL-Body.tex) [4] (./SL-Preamble.tex (./Sender.tex)) (./CSMA.tex)
>>> (./SL-Body.tex) [5] (./SL-Preamble.tex (
>>> ** ERROR ** Unable to open "we-have-moved.pdf".
>>> Output file removed.
>>> ./Sender.tex)) (./Sensura.tex)
>>> (./SL-Body.tex) [6] (./SL-Preamble.tex (./Sender.tex)) (./TUG.tex)
>>> (./SL-Body.tex) [7xetex.exe: fwrite: Invalid argument
>>> H:\TeX\Projects\Correspondence>
>> Philip Taylor

Hope this helps,


Ross Moore                                       ross at maths.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