7

I am confused why XeLaTeX can produce a pdf output from an input file that contains PSTricks codes, PNG, JPEG, PDF, EPS images. It is the first time I use XeLaTeX and I am really surprised that I can import images from many different format in the same input file.

Usually I use latex-dvips-ps2pdf to compile my input file that contains PSTricks codes and only EPS images. If I have PNG, JPEG and PDF images, I must convert them in advance to get the EPS version.

Unfortunately, XeLaTeX runs slower than latex-dvips-ps2pdf. I don't know why. Behind the scene, what steps are actually done by XeLaTeX when compiling input files with PSTricks codes, jpeg, png, eps, pdf images?

2 Answers 2

7

JPEG, PNG and PDF are directly supported by PDF format, then they're supported by xdvipdfmx directly. xetex program reads the image files to determine the bounding boxes and produce a .xdv file, then xdvipdfmx program put the image data to PDF output file.

PDF format does not support PostScript stream, thus EPS files are converted to PDF format and then put into PDF output file. xdvipdfmx calls GhostScript to do the trick.

PSTricks pacakge also calls GhostScript to render the PostScript code. The code needed is in xdvipdfmx.con. Herbert may give more explanations.

4
  • Could it be possible to update the pdf(La)TeX engine so that it would handle PostScript and PStricks commands in a way similar to XeteX does?
    – pluton
    Commented Apr 30, 2012 at 0:15
  • @pluton: That's possible. In fact, new epstopdf package (which is automatically included now) and auto-pst-pdf of PSTricks does some of the tricks.
    – Leo Liu
    Commented Apr 30, 2012 at 6:25
  • yes, but I was thinking of a more integrated solution where we do not have to load specific package and use external engines to do the work. Thanks
    – pluton
    Commented Apr 30, 2012 at 14:12
  • @pluton: Well, that's what dvipdfmx do. dvipdfmx also loads GhostScript to process PostScript code. You may ask LuaTeX developers to call the external programs automatically.
    – Leo Liu
    Commented Apr 30, 2012 at 14:17
6

XeTeX outputs an xdv file (extended DVI) which is piped to xdvipdfmx which understands Postscript specials and is capable to include EPS, PDF, PNG and JPEG files.

You can also use latex+dvipdfmx in order to include PSTricks files as well as EPS, PDF, PNG and JPEG files. This requires to pass graphicx and PSTtricks the dvipdfm option (dvipdfmx is an extended version of dvipdfm).

Note: it seems that "latex+dvipdfmx" is not able to include PSTtricks. :(

6
  • Is XeTeX identical to XeLaTeX? Commented Jun 5, 2011 at 16:37
  • 1
    @xport: XeLaTeX is just XeTeX with LaTeX format.
    – Leo Liu
    Commented Jun 5, 2011 at 16:38
  • @egreg: XeLaTeX outputs pdf or xdv? I have tried it, it produces pdf. Commented Jun 5, 2011 at 16:55
  • 1
    XeTeX itself output a .xdv file, and automaticly call xdvipdfmx to produce PDF output.
    – Leo Liu
    Commented Jun 5, 2011 at 17:12
  • @Leo: I see. I also noticed that MGS.EXE is executed after xdvipdfmx. Commented Jun 5, 2011 at 17:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .