# LaTeXmk compiler configuration file
# https://mirror.koddos.net/CTAN/support/latexmk/latexmk.pdf

# Set master documents
@default_files = ('rotare-doc.tex');

# Set paths for packages, figures and bibliography
ensure_path('TEXINPUTS', './style//','./figures//');
# Set path for bibliography style
ensure_path('BSTINPUTS', './style/');

# Set compiler option (same option for all compilers)
set_tex_cmds('-synctex=1 -interaction=nonstopmode -file-line-error %O %S');
$pdf_mode = 4;  # 1: use pdflatex, 4: use lualatex, 5 use xelatex

# Delete bbl files without checking if bib is available (dangerous when bib files are not available)
$bibtex_use = 2;

# Extra extensions to clean
$clean_ext = 'synctex.gz synctex.gz(busy) run.xml tex.bak bbl bcf fdb_latexmk run tdo %R-blx.bib lox nlg nlo nls';

# Make nomenclature
add_cus_dep("nlo", "nls", 0, "nlo2nls");
sub nlo2nls {
    system("makeindex $_[0].nlo -s nomencl.ist -o $_[0].nls -t $_[0].nlg");
}