Updated with properly minimalistic example..

I've been wrestling with this for a while now. I had a setup using pdfLaTeX with epstopdf that works nicely, but I need mathspec so I've moved to XeLaTeX. All of my figures are now causing problems. Example below:

\setmainfont{Linux Libertine}
\setmathsfont(Digits,Latin,Greek){Neo Euler}

\section*{A heading}

Some maths.


And a figure.

\caption{A graph in EPS format}


plotd calls a graph in EPS. File is available here http://ge.tt/4W5Mxsb1/v/0

It's not anything special, was created by Gnuplot. The error I'm getting out of XeLaTeX is as follows (the section where I think the error is likely to be:

LaTeX Font Warning: Font shape `EU1/NeoEuler(0)/m/it' undefined
(Font)              using `EU1/NeoEuler(0)/m/n' instead on input line 13.

Overfull \hbox (16.34999pt too wide) in paragraph at lines 20--21
[1] ("C:\Users\Li'lOne\Documents\p1l2\minim.aux")MiKTeX GPL Ghostscript 9.05: **** Could not open the file C:/Users/LilOne/AppData/Local/Temp//xdvipdfmx.b3cf3efa229c343a1415f680eef8e9a9 C:/Users/LilOne/Documents/p1l2/plotd.eps .
**** Unable to open the initial device, quitting.

** WARNING ** Couldn't open font map file "kanjix.map".
** WARNING ** Filtering file via command -->mgs.exe -q -dNOPAUSE -dBATCH -dEPSCrop -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -sOutputFile="C:/Users/Li'lOne/AppData/Local/Temp//xdvipdfmx.b3cf3efa229c343a1415f680eef8e9a9" "C:/Users/Li'lOne/Documents/p1l2/plotd.eps" -c quit<-- failed.
** WARNING ** Image format conversion for "C:/Users/Li'lOne/Documents/p1l2/plotd.eps" failed...
** ERROR ** pdf_ref_obj(): passed invalid object.

Output file removed.

Full log available here: http://pastebin.com/ymNYwsYn

Whilst I can use epstopdf by hand and convert each document, that will be a time consuming and not viable long term process. I have tried this on both Windows 7 using MikTeX 2.9 and Linux Mint 15 using the latest version of TeXLive (the above logs came from Windows but the errors are the same). My scripts are set to execute system commands so that isn't the issue.

I'd be very grateful for any advice you can offer.

  • 1
    Try to minimize your problem. As it is now it contains a lot stuff which is not relevant and makes testing difficult. Also if the eps is the source of the problem you should made it available for download somewhere. Apr 18 '14 at 9:56
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Apr 18 '14 at 10:34
  • It's all updated now. With a much simpler example and the EPS is available.
    – Goobley
    Apr 18 '14 at 15:37
  • The kanjix.map error seems to mean a faulty installation.
    – egreg
    Apr 20 '14 at 13:32
  • @Goobley Any news on this? I just got the same error.
    – remus
    Feb 16 '15 at 14:53

The problem is that you are doing an \includegraphics{} on a EPS file that is invalid. When this happened to me, the EPS file hadn't changed in a year, so I have to assume it was the newer version of XeLaTeX that I was using (either a new bug, or the new version is less tolerant of sloppy EPS files.

How to find the EPS that causes this problem:

Sadly the error message doesn't indicate which EPS is to blame. You can comment out all the \includegraphics{} statements and add them back in until you narrow down the problem. I commented them all out to make use the the xelatex works, then I added them back a few at a time until I found the problem.

A more automatic way is: Instead of having xelatex generate the PDF file directly, have it generate the .xdv file, then use xdvipdfmx to generate the PDF. For some reason, breaking it down into two steps reveals the file name.

xelatex -no-pdf thefile
xdvipdfmx -V5 thefile

You'll see output like:

xdvipdfmx:warning: Error locating image file "02_aw_regthisprod.eps"
xdvipdfmx:warning: Failed to read image file: 02_aw_regthisprod.eps
xdvipdfmx:warning: Interpreting special command PSfile (ps:) failed.
xdvipdfmx:warning: >> at page="1111" position="(142.227, 70.2613)" (in PDF)
xdvipdfmx:warning: >> xxx "PSfile="02_aw_regthisprod.eps" llx=0 lly=0 urx=361 ury=583 rwi="

In this case 02_aw_regthisprod.eps was the problem.

NOTE: In my case, there were 3 EPS files that caused the problem. All 3 were full-page inserts. It may be the dimensions of the image that causes the problem.

How to fix the problem:

For me, it was a matter of converting the EPS to PDF.

Step 1: Convert the file:

epspdf 02_aw_regthisprod.eps

Step 2: Edit the filename used for the \includegraphics{} statement:

OLD: \includegraphics{03_Informit_ad.eps}
NEW: \includegraphics{03_Informit_ad.pdf}

That solved the problem for me. I hope it works for you!

  • Wow, thanks, I haven't been logged in here for ages. Unsurprisingly I found a different solution in the meantime, but I still had my original test documents around. I tested your method and it worked!
    – Goobley
    Jul 22 '15 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.