I am using MikTex 2.9 with TexWorks 0.6.3 as editor. As I frequently have to execute a compile sequence

XeLaTeX -> PdfLatex -> Bibtex -> PdfLatex

which I currently have to do manually, I would like to put this sequence into some kind of wrapper (batch file?) and call this wrapper from the dropdown menu within TexWorks:

enter image description here

Is this possible?

  • XeLaTeX and PdfLaTeX at-the-same-time? Are you sure?
    – user156344
    May 10, 2019 at 14:27
  • Well - I have to call them in a sequence as I call a Python *.py file via pythontex which seems to work only (in my case..) if I process my TEX file with XeLaTeX first and then PdfLaTeX for the final output
    – WolfiG
    May 10, 2019 at 14:30
  • If you need XeLaTeX, my advice is: don't use PdfLaTeX at all... XeLaTeX still produces PDF files.
    – user156344
    May 10, 2019 at 14:30
  • I have/want to PdfLatex as I am calculating a hash code (as unique document identifier) from the text-file content via \pdfmdfivesum file {\jobname}}. Is something like that possible via XeLaTeX?
    – WolfiG
    May 10, 2019 at 14:33
  • it is really quite hard to have a file that works unchanged with xetex and pdftex, and almost impossible to get the same fonts being used. Are you really sure your pipeline is correct? May 10, 2019 at 18:18

1 Answer 1


TeXworks keeps its Typesetting Preferences in a plain text file called tools.ini within its configuration folder. NOTE the contents will vary considerably depending on the TeX engine, here is one with MiKTeX entries.

enter image description here

You thus have two options

a) Edit it directly (ensure you have made a backup, DO NOT edit with TeXworks nor whilst TeXworks is running ) HOWEVER for your case this may not help much as it is what some may call a "flat" format see how the chain of commands XeLaTeX+MakeIndex+BibTeX has only one program called texify.exe.

For your use we need to specify a single program to carry out your desired options XeLaTeX -> PdfLatex -> Bibtex -> PdfLatex.

b) Add entries to a new Processing tool definition inside TeXworks Preferences, HOWEVER we have just seen that also is subject to the same limitation of ONE process handler at a time.

So what is the best approach?, well there is latexmk and araura amongst other batch handlers these remove much trial and error.

Since we can see the contents of the ini we could home brew fairly easily and add an extra tool

NOTE I have 18 so the next one to be added is 019 It will differ for you. the -shell-escape should be optional try with and without

arguments=$fullname, -shell-escape

MyTool.cmd must be somewhere on "path" , ideally alongside the MiKTeX binaries, but that is not essential if they are also on path.

Rem highly simplified to only take %1 = $fullname as passed by MiKTeX NOTE filenames with spaces are most likely to fail. (that has not been but could be allowed for)
Rem optionally %2 passes --shell-escape
miktex-xetex.exe  %2 --synctex=1 -undump=xelatex %1
texify.exe --pdf --engine=xetex --synctex=1 --clean %1
miktex-pdftex.exe %2 --synctex=1 -undump=pdflatex %1
pause whilst testing
:: remove this pause once testing is done

The pause is only needed on first run to check in console it is found and working, normally there would be more messaging but this is a quick and dirty proof of concept.

You must log in to answer this question.

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