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?


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.

| improve this answer | |
  • 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 Apr 30 '12 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 Apr 30 '12 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 Apr 30 '12 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 Apr 30 '12 at 14:17

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. :(

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

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.