41

I'm trying to make latexmk works with XeLaTeX and biber for my thesis. The document will have many cross references. What settings do I need to ensure it works correctly? My current settings for latexmk are below.

-e 
$pdflatex=q/pdflatex -synctex=1 %O %S/
-pdf
$fullname
Paul Gaborit
  • 70,770
  • 10
  • 176
  • 283
Darling
  • 3,597

4 Answers4

78

LatexMk (since 4.31) supports the -xelatex option and auto-detects biber.

Therefore, in the fabulous world of 2015:

$ latexmk -xelatex biberedtexfile.tex

This is equivalent to:

$ latexmk -pdfxe -dvi- -ps- biberedtexfile.tex

Or to putting the following into .latexmkrc:

$pdf_mode = 5;
$dvi_mode = 0;
$postscript_mode = 0;
Tommy
  • 893
  • 1
  • 6
  • 6
  • 3
    If you want this in your .latexmkrc file:
    $pdflatex = "xelatex %O %S";                           
    $pdf_mode = 1;                                                        
    $dvi_mode = $postscript_mode = 0;  
    
    

    This is what latexmk does when it encounters the -xelatex flag.

    – rubdos Oct 13 '17 at 13:38
  • 4
    @rubdos while that works, that is not correct. The -xelatex flag corresponds to setting $pdf_mode = 5; $dvi_mode = $postscript_mode = 0;. No need to override $pdflatex. – Joe Dec 18 '18 at 14:38
  • I think it is latexmk --xelatex biberedtexfile.tex that works. – zyy May 03 '20 at 20:45
  • Make sure you do not include the -pdf option — this negates the -xelatex option – Jollywatt Sep 07 '21 at 05:59
26

Put

$pdflatex=q/xelatex -synctex=1 %O %S/

in the .latexmkrc file.

For Biber, look at this discussion. However the latest version of latexmk coming with TeX Live 2011 works with Biber, choosing it automatically when needed (thanks to PLK for pointing this out).

egreg
  • 1,121,712
5

This is a really old question, but I still want to help those who are here.

Besides -xelatex option metioned by @Tommy, latexmk's doc explains $pdf_mode's usage:

If equal to 5, generate a pdf version (and an xdv version) of the document using xelatex, using the commands specified by the $xelatex and xdvipdfmx variables.

Thus, setting $pdf_mode = 5 in .latexmkrc would help.

zsrkmyn
  • 151
  • 1
  • 3
2

If neither of the two other approaches works (as in my case), put this in .latexmkrc, as suggested by @rubdos in the comments:

$pdflatex = "xelatex %O %S";
$pdf_mode = 1;
$dvi_mode = 0;
$postscript_mode = 0;