I'm trying to define a run configuration for using XeLaTeX with BiBTeX from within TeXWorks, but I'm coming up empty.

I tried following this guide and adapt it to what I wanted to do, and ended up with this:

program: xelatex
argument: "%1.tex" && bibtex "%1" && xelatex "%1.tex" && xelatex "%1.tex"

but when I run it by hitting Ctrl+T I get the following message:

This is XeTeX, Version 3.1415926-2.3-0.9997.5 (TeX Live 2011)
restricted \write18 enabled.
entering extended mode


and then nothing happens.

How do I configure TeXWorks to run XeLaTeX+BiBTeX+XeLaTeX+XeLaTeX when I hit "compile"?

For extra credit, the run configuration should not run more times than necessary, i.e. not all four runs if no references have changed.


1 Answer 1


The simplest way is to create a new xelatexmk "engine" in the "Typeset" menu; instructions are at


It's sufficient to change pdflatex with xelatex. If you also put at the beginning of the file the "magic line"

% !TEX program = xelatexmk

this new engine will be automatically selected. The script latexmk will run the necessary programs the right number of times to resolve cross references and build the bibliography.

In the end, the window for defining the tool should look like the following

Name: xelatexmk
Program: latexmk

Arguments: -pdf
           $pdflatex=q/xelatex $synctexoption %O %S/
  • Is it possible to add make index within that code? So it becomes exlatex+bibtex+makeindex+exlatex+exlatex
    – user24460
    Jan 16, 2013 at 2:38
  • @user24460 That's a job for latexmk; I don't know if it supports exlatex
    – egreg
    Jan 16, 2013 at 10:50

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.