(As the author of latexmk, I am naturally partial to my own program, but here's my 2-cents' worth anyway.)
The fundamental problem that latexmk solves is that the number of runs of (pdf)latex needed is highly dynamically dependent on the document and the class file used. If you make a small change to a document, often only one recompilation by (pdf)latex ...
As this is still very high on google:
LatexMk (since 4.31) supports the -xelatex option and auto-detects biber.
Therefore, in the fabulous world of 2015:
$ latexmk -xelatex biberedtexfile.tex
"precompile" is probably a slightly confusing phrase to use as TeX is not a compiler but (mostly) a macro expansion language, but anyway...
In general you can dump most macro definitions and register assignments into a format. What you can't do is ship out pages. So in practice you can dump most LaTeX preambles.
Rather than having to edit the file so that ...
Yes, you can use latexmk -C (or -c) just to clean up auxiliary files. By default, -c cleans up the following files types:
@generated_exts = ( 'aux', 'bcf', 'fls', 'idx', 'ind', 'lof', 'lot',
'out', 'toc' );
(latexmk.pl, l. 1088f)
-C also cleans up the actual output, i.e pdf, dvi, or what have you. If you want to add more file extensions ...
By default, latexmk treats .bbl files as non-regeneratable. This is because the .bib from which they are made is not always available. See the documentation for a fuller explanation, especially the explanation of the $bibtex_use variable. To get latexmk -C to delete .bbl files, put the following in an initialization file:
$bibtex_use = 2;
You need $pdf_mode = 1; to enable pdf mode. The manual says it is the same as the option:
Equivalent to the -pdf-, -pdf, -pdfdvi, -pdfps options.
As of 17 August 2016, latexmk follows the XDG Base Directory Specification and looks for its configuration file in $XDG_CONFIG_HOME/latexmk/latexmkrc (or $HOME/.config/latexmk/latexmkrc if the $...
If you need to do this just once, run:
latexmk -e '$latex=q/latex %O -shell-escape %S/'
latexmk -e '$pdflatex=q/pdflatex %O -shell-escape %S/' -pdf
for PDF output.
If you want latexmk to always run with this option enabled, you should put the following in your .latexmkrc file (yes, that's a thing):
$latex = 'latex %O --shell-escape %S';
Another option to the presumably canonical answer John gave is specifying $clean_ext in a latexmkrc file, which contains your personalized global options. This file can be in one of the places I outlined in my answer to
Latexmk: makeglossaries, Biber and pdfLaTeX / Where to put latexmkrc?. Also see the latexmk manual.
My complete list of extensions looks ...
The reason latexmk keeps re-running is because the generated a-pics.pdf file keeps changing on every run. There are lines in the PDF file with creation dates, modification dates and IDs that keep changing. There are at least two possible solutions.
Tell latexmk to ignore a-pics.pdf completely from its dependency
database. There does not currently seem to be ...
Just in case you want latexmk, the first step is to verify your current version with latexmk -v at the command line/terminal; current version is 4.35, dated 11 Nov 2012. Otherwise update your TeXlive distribution or update to the latest via latexmk at ctan.
Add the custom dependency commands depending on your requirements in a .latexmkrc file in your home ...
Let my try to solve your issue using arara
If you hear arara the first time here a small abstract:
arara allows the specification of the compilation steps from the main document
This small sentence isn't able to describe the whole power of the tool. Therefor you can have a look at the documentation or the short intro at the homepage: Homepage arara
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 much else. However, it's good at determining which files depend on which other files: you don't need to provide a list, so latexmk main will only recompile when a ...
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 here take you through a simple process, as follows. You need the mylatexformat package to make this work.
Split your preamble into "static" and "might change" stuff, ...
Here's a little perl script that might get you started. You can use it as
perl removelatexcode.pl myfile.tex myfile1.tex
and can call it with as many files as you like (or you could pipe into it too).
It does the following:
copies your input file, myfile.tex to myfile.tex.bak just in case something goes wrong
loops through each line in the file, and ...
This isn't latexmk automagic, but it avoids recompiling if the source .tex file hasn't changed:
latexmk -pdf file.tex
make -n -f file.makefile > /dev/null | grep pdflatex > /dev/null
if [ $? -eq 0 ] ; then
make -f file.makefile
latexmk -g -pdf file.tex
If the auto-generated makefile isn't actually going to compile any figures, the string "...
You could use the -latex or -pdflatex options.
I'll use pdflatex for the examples but it should work with latex as well.
latexmk -pdf article
will look for article.tex, invoke the command associated with the pdflatex option which by default is
"pdflatex -interaction=nonstopmode -synctex=1 %S %O"
where %S is replaced by the filename and %O by the options.
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 package with your TeX distribution.
Instead of adding the -lualatex flag to each application of latexmk, you could
place the following
$pdflatex = 'lualatex -file-line-error %O %S';
$pdf_mode = 1;
in an '.latexmkrc' file. This file should reside in your home folder, if you use
lualatex in all your jobs, or in the folder(s) where your lualatex jobs are.
More generally, you will find a ...
Pandoc accepts many different input formats including LaTeX and can produce a variety of outputs including plain text. To try Pandoc online, visit the Try pandoc! site.
As stated on the Pandoc website:
If you need to convert files from one markup format into another, pandoc is your swiss-army knife. Pandoc can convert documents in markdown, ...
I have this in my .latexmkrc:
$pdflatex = "pdflatex -synctex=1 -halt-on-error %O %S";
In my case I tend to use -pvc all the time, so here it just stops the compilation if there is an error and go back to waiting for change. You can also use the -interaction=... option.
If I'm not mistaken you can also pass these on to pdflatex via latexmk CLI options
I don't see any way of configuring the current version of latexmk to prevent it doing the extra runs. Not only is makeindex run a second time by latexmk, but so is latex, so the run time is doubled, which is a bad penalty on a large document.
To correct this needs changes in latexmk itself. There is enough information in the .log file for latexmk to ...
My sources and generated files are in separated directories. Running mhp's solution I got the error: (require "doc.xdy") ERROR: Could not find file "doc.xdy". Then I extended the solution to:
print("LATEXMK: Glossaries Módule...\n");
add_cus_dep('glo', 'gls', 0, '...
To allow convenient use of latexmk for making/building the project, put a file latexmkrc in the same directory is its primary source file main.tex. For the project described in the question, appropriate contents of latexmkrc are
$pdf_mode = 1;
$dvi_mode = $postscript_mode = 0;
$pdflatex = 'lualatex %O %S';
@default_files = ( 'main.tex' );
The first two ...
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 '$max_repeat=2' test
But the default value (5) is quite large, so you should at first try to find out why your document needs more.
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 run latexmk -showextraoptions to see it)
You can use this:
latexmk -pvc -pdf -e "$pdflatex='xelatex %O -interaction=nonstopmode %S'" foo.tex
This is for Windows, for Linux, the following might work, but I don’t use Linux, so I don’t know if it actually works:
latexmk -pvc -pdf -e '$pdflatex=q/xelatex %O -interaction=nonstopmode %S/' foo.tex
With -e you can specify what to run as "pdflatex", and ...
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-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32,