4

Given a LaTeX file, foo.tex, that requires xelatex, one can convert it to PDF in the following two ways:

  1. Run xelatex foo (which directly generates foo.pdf)
  2. Run xelatex -no-pdf foo (which generates foo.xdv) followed by xdvipdfmx foo (which converts the xdv file to foo.pdf)

Do the two approaches, in effect, produce the same pdf file? Or is there some advantage to (1) (or indeed (2))?

(The context for this is that in the past I had always assumed that with a latex file that does not require xelatex it was preferable to call pdflatex rather than calling latex and converting the DVI to PDF. Indeed, in the past latexmk with the -xelatex argument would follow route (1), however newer versions follow (2), which initially concerned me, in analogy with my pdflatex comment above. Having found "latexmk with xelatex xdv mode" I suspect that (1) and (2) are essentially equivalent, but I wanted to confirm this. In particular I want to be sure the two routes are equivalent even if one is using packages such as microtype or hyperref.)

6

The approaches are identical because xetex calls xdvipdfmx unless you specify -no-pdf.

xetex is not like pdftex or luatex that have a modified back end that generates pdf, it always generates (extended) dvi but it runs xdvipdfmx at the end and deletes the intermediate files unless --no-pdf option is given.

  • Perfect! Is this fact (namely that xelatex is exactly equivalent to xelatex -no-pdf+xdvipdfmx) documented somewhere? – banbh Nov 15 '17 at 16:59
  • 1
    @banbh er... I have the sources checked out, does that count?:-) if you go xetex --help then among the options is -output-driver=CMD use CMD as the XDV-to-PDF driver instead of xdvipdfmx which sort of hints that the default behaviour is to run xdvipdfmx but it isn't mentioned in the xetex manual as far as I can see. – David Carlisle Nov 15 '17 at 17:07
  • 1
    Hey David, does xelatex calls xdvipdfmx with any flags? It seems that xelatex == xelatex -no-pdf + xdvipdfmx -E? – Ch'en Meng Apr 3 '18 at 7:21
  • 1
    @Ch'enMeng Checking the XeTeX sources I found: const char *outputdriver = "xdvipdfmx -q -E"; /* default to portable xdvipdfmx driver */, so calling xelatex is essentially the same as calling xelatex -output-driver='xdvipdfmx -q -E' or xelatex -no-pdf + xdvipdfmx -q -E. – Phelype Oleinik Feb 7 at 18:19
  • 1
    Hi @PhelypeOleinik, thanks for the information. : ) – Ch'en Meng Feb 11 at 11:30

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.