# Compilation

Too Long; Didn’t Read: Use …

• lualatex as TeX engine
• biber as bib engine
• latexmk to compile and use a latexmkrc config file (ours for example))

## Pdflatex vs. XeTeX vs. Lualatex

A compiler is a software that compiles a .tex file to a .pdf. They are generally installed with your TeX distribution (TeXLive, MikTeX,…). Compiling a .tex file could be quite handy, back in the days, where multiple commands should be launched to obtain a .pdf file:

graph LR A(file.tex) -->|latex|B(file.dvi) B --> |dvips| C(file.ps) C --> |ps2pdf| D(file.pdf)

Since decades, this is the not the case anymore and the majority of people use pdflatex:

graph LR A(file.tex) -->|pdflatex|B(file.pdf)

Today (2020), a more modern compiler is available, lualatex, which is written in Lua. We strongly advice you to use lualatex instead of pdflatex:

graph LR A(file.tex) -->|lualatex|B(file.pdf)

XeLaTeX is another engine but we encourage to use LuaLaTeX, which has (a little) more features than XeTeX, see for example this discussion.

Even if we advice you to use lualatex, there is still a problem: some scientific journal does not accept .tex submission written for lualatex. This is simply due to the fact that lualatex is not that used in the community - until now!

## Latexmk

### Automatic compiler

One of the problem with latex is that it sometimes requires multiples compilation, due to cross reference and bibliography. As a user, we can be confused of whether we must compile the file again, or the .bib file, or not. Here comes our savior: latexmk, a program that you run once and that compiles everything automatically:

latexmk file.tex


latexmk can select the tex engine you like:

latexmk -pdflatex=lualatex file.tex


### Config file: latexmkrc

Because it’s not handu to remember this, a config file, named .latexmkrc or latexmkrc (with or without dot), can be set up, for example:

$pdflatex = 'lualatex -file-line-error %O %S';$pdf_mode = 1;


Here is [a simple config file]( ours for example).

### “Run-time” compilation

One of the great feature of latexmk is its -pvc option that launches a daemon which recompiles the file everytime it has been changed on disk:

latexmk file.tex -pvc


## BibTeX and Biber

bibtex is a great software to compile bibliography file (.bib) along with your .tex file. Even though it is powerfull, a more modern software has been developped, biber which provides more features than bibtex especially when it comes to customization.

## Encoding

Last but not least, a word about encoding. Please, encode all your file using UTF-8

Suivant