[XeTeX] XeTeX/xdvipdfmx or the driver bug with eps images

Heiko Oberdiek heiko.oberdiek at googlemail.com
Wed May 28 19:53:03 CEST 2014


On 28.05.2014 19:31, Zdenek Wagner wrote:
> 2014-05-28 18:21 GMT+02:00 Joseph Wright
> <joseph.wright at morningstar2.co.uk
> <mailto:joseph.wright at morningstar2.co.uk>>:
> 
>     On 28/05/2014 16:14, Akira Kakuto wrote:
>     > Dear Vafa Karen-Pahlav
>     >
>     >> w.eps is taken from LaTeX graphics companion examples;
>     >> therefore I do not think there is anything wrong with the image
>     itself.
>     >>
>     >> What is wrong?
>     >
>     > It is sufficient to change the header of w.eps
>     > from
>     > %!PS-Adobe-2.0
>     > to
>     > %!PS-Adobe-2.0 EPSF-2.0
>     > in order to tell Ghostscript that w.eps is an
>     > eps file.
>     >
>     > Please try, then you will obtain an expected pdf.
>     >
>     > Thanks,
>     > Akira
> 
>     All true, but both latex + dvips and  pdflatex produce the expected
>     output, as do latex + dvipdfmx or xelatex with the older driver set up.
> 
> 
> dvips includes EPS directly, it does not need ghostscript, pdflatex is
> not able to insert EPS and if \write18 is allowed, epstopdf is called.
> Probably epstopdf invokes ghostscript in a different way than xdvipdfmx
> does.

`epstopdf' does not require that the PostScript file is a strict
Encapsulated PostScript file. It takes the BoundingBox it can find,
moves the graphics to the origin, sets the new media size
(setpagedevice) and calls ghostscript for the conversion to PDF.
In the case that the PostScript file is *not* an EPS file, this
might succeed or fail.

XeTeX/xdvipdfmx/dvipdfmx are using ghostscript with option `-dEPSCrop',
configured in TDS:dvipdfmx/dvipdfmx.cfg. This option *requires*
EPS files. It seems that ghostscript can be fooled by an EPSF header
line, e.g. %!PS-Adobe-2.0 EPSF-2.0

However, PostScript can use any PostScript operator, but EPS files are
restricted. Problematic operators such as setpagedevice are forbidden.
Renaming a file from .ps to .eps does *NOT* convert an PS file to
an EPS file.

It is much better to generate an EPS file in the first place
(setting an option to create EPS instead of PS in the driver/program
that generates the PostScript, ...).

Yours sincerely
  Heiko Oberdiek



More information about the XeTeX mailing list