1

This question introduced a idea that instead of generating pdf file every time, we may use xdv file as the target for intermediate processes, and only convert to pdf file once with xdvipdfmx at the final step, and this is expected to save us a lot of processing time.

And also quote from the manual of latexmk:

-pdfxe Generate pdf version of document using xelatex. Note that to optimize processing time, latexmk uses xelatex to generate an xdv file rather than a pdf file directly. Only after possibly multiple runs to generate a fully up-to-date xdv does latexmk then call xdvipdfmx to generate the final pdf file.

(Note: When the document includes large graphics files, especially png files, the last step can be quite time consuming, even when the creation of the xdv file by xelatex is fast. So the use of the intermediate xdv file can result in substantial gains in procesing time, since the pdf file is produced once rather than on every run of xelatex.)

I am thinking of if there is way to fully utilize this feature. Currently when I edit a tex file, I would always have latexmk -xelatex -pvc run somewhere so that I can see the updated file immediately. But this command would still generate the pdf file at each run(after each time I saved the file). So are there actually ways that let latexmk generate only the xdv file? And I would manually convert the xdv file to pdf after I finish editing.

But of course I am just searching for a more efficient workflow, what I am suggesting here may not be the optimal as well. If there are other ways to save the processing time, please let me know!

  • 1
    xetex --no-pdf will make just the xdv and not the pdf, but is there a viewer that can preview xdv files? – David Carlisle Oct 25 '18 at 21:16
  • yes, skim on mac opens xdv files. I am not sure if it converts xdv to pdf internally tho. So is it actually a good idea to reducing processing time by only generating xdv file? – huangzonghao Oct 25 '18 at 21:32
  • @huangzonghao Skim just calls xdvipdfmx when you ask it to open an XDV file. I think it should be possible to have latexmk call xelatex with -no-pdf and, when the last run is successful, call xdvipdfmx. Indeed, for graphic intensive documents this could result in faster compilation. – egreg Oct 25 '18 at 21:44
  • for most documents you should never have to do multiple runs while in an edit-preview cycle, so unless you are happy to do lots of editing and just run xetex -no-pdf to syntax check without viewing the result, I don't see how this can speed things up. – David Carlisle Oct 25 '18 at 21:58
  • @egreg Oh yeah, if skim is also calling xdvipdfmx I guess there would be no point for me to try to stop latexmk from doing so. And as a side note, I think latexmk only passes command of pdflatex? So -draftmode works for pdflatex, but --no-pdf will not be passed to xetex. – huangzonghao Oct 25 '18 at 22:08

Your Answer

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

Browse other questions tagged or ask your own question.