gnuplot in LaTeX, without gnuplottex
I have avoided using gnuplottex
at all by adding the following custom dependency to .latexmkrc
:
add_cus_dep('gnu','tex', 0, 'makegnu2tex');
sub makegnu2tex {
system("gnuplot \"$_[0].gnu\"") ;
}
My gnuplot
file uses the cairolatex
terminal (or any other terminal who produce a .tex
file). My latex
document contains \input{gnuplot_output.tex}
which, because of the newly defined dependency, causes a system call to gnuplot
upon tex
compilation. The .gnu
file and .tex
files are now a normal dependency, and gnuplot
will not recompile unless the time stamp is changed.
It's important to notice that the path specified in set output "path/gnuplot_output.tex"
in the .gnu
file is relative to the tex root
file as long as the gnuplot
system call is induced by latexmk
.