Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile XeLaTeX tex file with latexmk

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

like image 531
Brian M. Hunt Avatar asked Jun 26 '10 14:06

Brian M. Hunt


People also ask

What is the difference between pdfLaTeX and XeLaTeX?

pdfLaTeX means using the LaTeX macro package with the pdfTeX engine. XeLaTeX means using the LaTeX macro package with the XeTeX engine. LuaLaTeX means using the LaTeX macro package with the LuaTeX engine.

What is Latexmk?

Latexmk (whose current released version is 4.77 dated 17 March 2022) is a perl script for running LaTeX the correct number of times to resolve cross references, etc; it also runs auxiliary programs (bibtex, makeindex if necessary, and dvips and/or a previewer as requested).

Is XeLaTeX slower than pdfLaTeX?

The above accounts for any "final pause", but otherwise xetex is in general slower than pdftex (and faster than luatex) they are different systems working with different font technologies and different character data structures, so you would expect some differences.

How do I use latexmk on Windows?

On Windows, you can use the system-wide config file C:\latexmk\LatexMk (if the file doesn’t exist yet, just create a new text file with this name). To choose a PDF viewer, use something like this:

How do I recompile my project to latex?

Click on the Overleaf menu icon above the file list panel, and set the Compiler setting to 'LaTeX'. Recompile your project. Click on the "Logs and output files" button next to the Recompile button. Scroll right to the bottom, and click on "Other logs and output files".

How does the LaTeX compiler read the data?

During the first compilation the LaTeX compiler writes the .aux file for informations about different numbering and during the second one the compiler reads these informations in order to properly generate a table of contents, bibliography, etc. This process can be automatized by the command latexmk.

What is XeLaTeX used for?

In this approach, xelatex is used to generate the PDF file directly, without generating an intermediate output file. Note that, today, xelatex first generates an xdv stream and internally pipes it to xdvipdfmx to produce a PDF file. Updated 2019.08.31 from user36296 's comment.


1 Answers

latexmk -v Latexmk, John Collins, 16 January 2010. Version 4.13a 

I put

$pdflatex = 'xelatex --shell-escape %O %S'; 

in my .latexmkrc file. This is a workaround, of course. But it works for me when I call

latexmk -pvc -pdf MyXetexFile 
like image 106
Kay Smarczewski Avatar answered Sep 30 '22 14:09

Kay Smarczewski