Skip to main content
28 votes

Ultrafast PDFLaTeX with precompiling

For the benefit of people using a search engine arriving here looking for how to convert a never-changing but slow-loading preamble into a super-quick "precompiled" format. The instructions ...
LondonRob's user avatar
  • 4,532
27 votes
Accepted

What is the role of the different entities (TexLive, pdlatex, latexmk) in the LaTeX ecosystem?

To use TeX you need: An implementation of TeX "a tex engine" in modern terminology that converts your source file into PDF (or DVI). pdftex the most used variant at present. An editor to ...
David Carlisle's user avatar
26 votes

How to have latexmk always use -shell-escape?

If you need to do this just once, run: latexmk -e '$latex=q/latex %O -shell-escape %S/' or latexmk -e '$pdflatex=q/pdflatex %O -shell-escape %S/' -pdf for PDF output. If you want latexmk to ...
einpoklum's user avatar
  • 12.5k
21 votes
Accepted

LaTeX \newcommand recursion gets very slow

Let's see what happens when you do \gcdab{377}{233}. The first expansion becomes \ifnum233=0 \else\gcdab{233}{\modab{#1}{#2}}\fi The conditional is false, so you get \gcdab{233}{\modab{377}{233}}\fi ...
egreg's user avatar
  • 1.2m
20 votes
Accepted

How to suitably configure the TEXINPUTS variable in latexmkrc for detecting the sty and cls files present in a custom folder in the project directory?

Latexmk actually has a subroutine for adding items to search paths. You can write ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' ); This takes care of using the correct operating-system-...
John Collins's user avatar
  • 11.4k
19 votes
Accepted

What is the meaning of option "t" in documentclass beamer?

Copy/pasting from the beamer manual:
18 votes
Accepted

Error "latexmk: The script engine could not be found" in VS Code using MikTeX 2.9

Quick summary: Install Perl from The Perl Programming Language. ActiveState Perl is recommended for beginners. Make sure to add the Perl local directory to your system Path. Install the latexmk ...
Paul Kim's user avatar
  • 1,078
17 votes
Accepted

How to have latexmk always use -shell-escape?

You can pass the parameter directly to latexmk as such: latexmk -shell-escape This option is not mentioned in the manpage. The manpage suggests the -e option which is also used in the first answer. ...
snwflk's user avatar
  • 530
15 votes

How to change latexmk's number of maximum runs

You can change the $max_repeat variable with a command line option or in a configuration file. latexmk -e "$max_repeat=2" test or perhaps on other OS/shells with a single quote latexmk -e '$...
Ulrike Fischer's user avatar
15 votes

arXiv: post supplementary files using external document and xr

You can workaround a problem. Take your file.aux, create xx.tex and upload it to arxiv along with your latex file. the xx.tex is: \begin{filecontents}{file.aux} The content of file.aux \end{...
user184439's user avatar
14 votes

Is there latexmk functionality for LuaTeX?

Since version 4.51 of latexmk, you can use the following .latexmkrc: $pdf_mode = 4; $postscript_mode = $dvi_mode = 0;
sebastian's user avatar
  • 899
14 votes
Accepted

What is makefile and when do I need to use it along with latexmk?

This is a quite general question, and so it'll be hard to write down a complete answer. I'll talk about when I use Make and when I use latexmk. latexmk is a tool for compiling .tex files, and not ...
Arun Debray's user avatar
  • 7,174
14 votes
Accepted

Unicode -(U+301) error in biblatex, but not in main text: {\'{\i}}

With biblatex and Biber the best solution™ is of course to use the correct Unicode characters (and ideally the precomposed characters: Åström, not a combination of the combining characters: Åström) ...
moewe's user avatar
  • 179k
12 votes
Accepted

TexStudio with LuaLatex and latexmk - is this possible?

Yes it is possible and also quite easy.: Go to Configurate TexStudio and then choose Commands, scroll down and insert in latexmk latexmk -lualatex -silent -latexoption="-synctex=1" % Be carefull with ...
TimK's user avatar
  • 701
11 votes

How to make Latexmk use makeglossaries?

The current version of the glossary/glossaries sample latexmkrc file on CTAN http://mirrors.ctan.org/support/latexmk/example_rcfiles/glossaries_latexmkrc contains # This shows how to use the ...
moewe's user avatar
  • 179k
11 votes

How to have latexmk always use -shell-escape?

To enable shell-escape for all *latex commands using a latexmkrc file: set_tex_cmds( '--shell-escape %O %S' );
user35915's user avatar
  • 307
11 votes
Accepted

How to enable shell escape when building with latexmk and xelatex

There are multiple options: latexmk -xelatex -latexoption="-shell-escape" document latexmk -xelatex -shell-escape document (this option is not listed in the normal latexmk -help menu, but you have to ...
samcarter_is_at_topanswers.xyz's user avatar
11 votes
Accepted

Why is pdflatex outing itself as pdftex?

In a Linux terminal on /usr/local/texlive/2018/bin/x86_64-linux directory: $ file pdflatex pdflatex: symbolic link to pdftex But with pdftex: $ file pdftex pdftex: ELF 64-bit LSB executable, x86-...
Fran's user avatar
  • 83.4k
11 votes
Accepted

latexmk clean (-c): some Beamer-related files are not deleted

latexmk has an internal list of extensions that are known to be safe to delete. But it does not know all extensions used by all LaTeX packages or which of them are safe to delete. latexmk can read ...
daleif's user avatar
  • 55.5k
10 votes
Accepted

Generating PDF from xelatex

The approaches are identical because xetex calls xdvipdfmx unless you specify -no-pdf. xetex is not like pdftex or luatex that have a modified back end that generates pdf, it always generates (...
David Carlisle's user avatar
10 votes
Accepted

comparing tex4ht, lwarp and latexml on same document?

A substantial lwarp example is here: this is a 65 page set of lecture notes for a course I teach. It includes tikz graphics, cleveref references and a lot of maths. I had to supply some js and css ...
Fran Burstall's user avatar
10 votes

LaTeX \newcommand recursion gets very slow

In the first version you want to evaluate \modab earlier \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \usepackage{etoolbox} \makeatletter \newcommand*{\programmerdiv}[2]{% \...
David Carlisle's user avatar
9 votes

Latexmk says the file is up-to-date, while it's not

An option could be to add the -g flag when using latexmk: latexmk -pdf -g main.tex From the latexmkdocumentation for -g Force latexmk to process document fully, even under situations ...
Niels's user avatar
  • 191
9 votes

What is makefile and when do I need to use it along with latexmk?

I would like to know what makefile is The command make most often refers to GNU make or BSD make. Each variant has its merits; the differences are for advanced uses not discussed here. Regardless of ...
ccorn's user avatar
  • 443
9 votes
Accepted

Passing options to biber through latexmk

In ~/.latexmkrc, add $biber='biber --validate-datamodel %O %S' (or whatever options you like)
Derek's user avatar
  • 1,766
9 votes
Accepted

Is there a possibility to change compiler engine depending on presence of a package

I'm on windows too. My editor, Winedt, has macro capabilities and it would be easy to write a macro to start the compilation which does want you ask for. It is also not every difficult to devise ...
Ulrike Fischer's user avatar
9 votes
Accepted

Compiling using latexmk from a different directory?

As was already mentioned in a comment, the -cd option to latexmk does exactly what you request latexmk -pdf -cd subfolder/subfolder/main.tex
John Collins's user avatar
  • 11.4k
9 votes
Accepted

Emacs/AUCTeX/LaTeXmk: Default compilation command only on first run?

Short answer: AUCTeX doesn't play very well with latexmk, by default. Long answer: AUCTeX has its own system to decide what command to run next, when building a document. This is based on reading ...
giordano's user avatar
  • 8,526
9 votes

Vimtex: how to display error messages?

The best way is to use \le, and here is a full list of command of vimtex (from the official document) ---------------------------------------------------------------------~ LHS RHS ...
yujie6's user avatar
  • 328
8 votes

Make latexmk ignore errors and finish compiling

Another simpler solution is: latexmk -pvc -pdf foo.tex < /dev/null
Winston Ewert's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible