Je ferais pour ma part appel à latexmk :
latexmk -pdf -pvc master.tex
Latexmk surveille les dépendances présente dans le fichier log : quand on change une photo chargée avec includegraphics, latexmk recompile automatiquement le document.
Citation du manuel :
> Latexmk can also be set to run continuously with a suitable previewer.
In that case the latex program (or one of its relatives), etc, are
rerun whenever one of the source files is modified, and the previewer
automatically updates the on-screen view of the compiled document.
> Latexmk determines which are the source files by examining the log
file. (Optionally, it also examines the list of input and output files
generated by the -recorder option of modern versions of latex (and
pdflatex, xelatex, lualatex, etc). […] When latexmk is run, it examines
properties of the source files, and if any have been changed since the
last document generation, latexmk will run the various LaTeX processing
programs as necessary. In particular, it will repeat the run of latex
(or a related program)) often enough to resolve all cross references;
depending on the macro packages used. With some macro packages and
document classes, four, or even more, runs may be needed. If necessary,
latexmk will also run bibtex, biber, and/or makeindex. In addition,
latexmk can be configured to generate other necessary files.
L’option `-pvc` permet bénéficier d’une compilation automatique, qui lance latexmk en toile de fond : une visonneuse par défaut est ouverte, et latexmk vérifie à intervalle régulier (configurable) si les fichiers ont changé. Si c’est le cas, il lance automatiquement la compilation.
Je cite à nouveau le manuel
>The second previewing option is the powerful -pvc option (mnemonic:
"preview continuously"). In this case, latexmk runs continuously,
regularly monitoring all the source files to see if any have changed.
Every time a change is detected, latexmk runs all the programs
necessary to generate a new version of the document. A good previewer
will then automatically update its display.
Voilà à quoi ressemble mon .latexmkrc
$pdf_mode = 1;
$postscript_mode = $dvi_mode = 0;
$biber = 'biber %O %S';
$pdf_previewer = 'start mupdf %O %S';
$recorder = 1 ;
#vérifie toutes les deux secondes si les programmes ont été actualisés.
$sleep_time= 2 ;
#rajoute des extensions à celles identifiant les fichiers auxiliaires
push @generated_exts, "nav","snm","run.xml" ;
$clean_ext= 'tex.bak tex~ bib~' ;
Je recommande donc fortement, après configuration de latexmk, de privilégier la ligne de commande
latexmk -pdf -pvc master.tex