views:

51

answers:

1

How can one compile a XeLaTeX tex document using latexmk on Mac OS X?

At present I am running latexmk job.tex and getting an error:

! 
 ********************************************
 * XeTeX is required to compile this document.
 * Sorry!
 ********************************************.
\RequireXeTeX ...********************************}
                                                  \endgroup \fi 
l.18 \RequireXeTeX

? ^D
! Emergency stop.
\RequireXeTeX ...********************************}
                                                  \endgroup \fi 
l.18 \RequireXeTeX

The first line of my tex file is (as suggested by this post):

% !TEX TS-program = xelatexmk

and I've tried others (e.g. program=xelatex), but to no avail.

latexmk describes its commands as follows:

$ latexmk -commands xelatex job
Commands used by latexmk:
   To run latex, I use "latex %O %S"
   To run pdflatex, I use "pdflatex %O %S"
   ...

There doesn't appear bo be any logical mechanism for selecting a tex program from the command line, and it's not clear from the source how one would do this, either.

I've also looked atrubber, but it doesn't seem to work either.

I appreciate any insight you may be able to provide.

Brian

+1  A: 

That's my quick fix, so that latexmk works with XeLaTeX:
Add

`elsif (/^-xelatex$/) { $pdf_mode = 1; $pdflatex = 'xelatex %O %S'; $pdf_previewer =
'start evince %O %S';}`

above (or near) the line

`elsif (/^-pdf$/) { $pdf_mode = 1; }`

.

Then you can call latexmk -xelatex file.tex. Works, but I didn't test it extensively. Should work similarly with lualatex.

andre-r