3
\documentclass{article}
\usepackage{mpgraphics}
\begin{document}
\begin{figure}
.
\label{fig:a}
\caption{a}
\end{figure}
\begin{mpinline}
draw (20,20)--(0,0)--(0,30)--(30,0)--(0,0)
\end{mpinline}
\ref{fig:a}
\end{document}

I use MikTex 2.9 and TexMaker. I compiled this MWE with means of latexmk. To be more precise, the command was: latexmk -e "$pdflatex=q/pdflatex -synctex=1 -shell-escape -interaction=nonstopmode/" -pdf %.tex.

My document compiled over and over and over. A log says that:

Rule 'pdflatex': File changes, etc: Changed files, or newly in use since previous run(s): 'C:/tmp/tmp-fig1.pdf' 'tmp-fig1.pdf' ------------ Run number 1 of rule 'pdflatex' ------------ ------------ Running 'pdflatex -synctex=1 -shell-escape -interaction=nonstopmode -recorder "tmp.tex"' ------------

Rule 'pdflatex': File changes, etc: Changed files, or newly in use since previous run(s): 'C:/tmp/tmp-fig1.pdf' 'tmp-fig1.pdf' ------------ Run number 2 of rule 'pdflatex' ------------ ------------ Running 'pdflatex -synctex=1 -shell-escape -interaction=nonstopmode -recorder "tmp.tex"' ------------

Rule 'pdflatex': File changes, etc: Changed files, or newly in use since previous run(s): 'C:/tmp/tmp-fig1.pdf' 'tmp-fig1.pdf' ------------ Run number 3 of rule 'pdflatex' ------------ ------------ Running 'pdflatex -synctex=1 -shell-escape -interaction=nonstopmode -recorder "tmp.tex"' ------------

Rule 'pdflatex': File changes, etc: Changed files, or newly in use since previous run(s): 'C:/tmp/tmp-fig1.pdf' 'tmp-fig1.pdf' ------------ Run number 4 of rule 'pdflatex' ------------ ------------ Running 'pdflatex -synctex=1 -shell-escape -interaction=nonstopmode -recorder "tmp.tex"' ------------

Rule 'pdflatex': File changes, etc: Changed files, or newly in use since previous run(s): 'C:/tmp/tmp-fig1.pdf' 'tmp-fig1.pdf' ------------ Run number 5 of rule 'pdflatex' ------------ ------------ Running 'pdflatex -synctex=1 -shell-escape -interaction=nonstopmode -recorder "tmp.tex"' ------------

Finally, it compiled five times which is 3 more than necessary.
I suspect the reason is that pdfs that are results of mpinline are not binary equal (they contain a timestamp or something like that?) and that causes latexmk to think that it needs to compile again.

When compiling very long document this behaviur is really annoying as it consumes a lot of time. Can it be fixed?

3

It really seems that the .pdf file is looked at for changes and of course it changes every time. On my experiment, latexmk actually gives up.

This works without problems:

\documentclass{article}
\usepackage[shellescape]{gmp}
\begin{document}
\begin{figure}
.
\label{fig:a}
\caption{a}
\end{figure}
\begin{mpost}[use]
draw (20,20)--(0,0)--(0,30)--(30,0)--(0,0)
\end{mpost}
\ref{fig:a}
\end{document}
5

The generated .pdf file does indeed change every time, because of time stamps and the like. (Just compared the generated .pdf file on successive runs.) You can configure latexmk to ignore the relevant lines in the .pdf file(s) by putting the following in one of latexmk's initialization files:

$hash_calc_ignore_pattern{'pdf'} = 
   '^/CreationDate\('
   .'|^/ModDate\('
   .'|^/ID \['
   .'|^<rdf:RDF '
   .'|^<rdf:Description rdf:about'
   .'|^<xmp:CreateDate>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.