# incremental compiling with multi-core-cpu on Sharelatex: files in cache are not found in next run of pdflatex

I have many complex plots generated with tikz. There is a great method to incremental compile with multi-core-cpu described in Integrating latexmk and TikZ external mode=list and make

## Automated work flow:

1. automatically generate individual tasks for each tikz-picture in a makefile (\tikzexternalize[mode=list and make])
2. compile tikz-pictures simultaneously using 8-core cpu !!! (make -j8 -f %B.makefile)
3. automatically insert tikz-pictures as pdf-files in second run of pdflatex (\usetikzlibrary{external})

Here is a simplified MWE that should work on our local machine.

Run with latexmk -pdf main.tex

%%% file named main.tex %%%
\documentclass{article}
\usepackage{tikz,pgfplots}
%\pgfplotsset{compat=1.14}
\usetikzlibrary{external}
\tikzexternalize[mode=list and make]

%%%  please create file latexmkrc manually %%%
% \begin{filecontents}{latexmkrc}
% \$pdflatex='pdflatex --shell-escape -synctex=1 -interaction=batchmode %O %S;  make -f %B.makefile; pdflatex --shell-escape -synctex=1 -interaction=batchmode %O %S';
% \end{filecontents}

\begin{document}
\tikzsetnextfilename{myPlot}
\begin{tikzpicture}
\begin{axis}
\end{axis}
\end{tikzpicture}
\end{document}


## Observation in Sharelatex

I want to get the example working on Sharelatex on my own server. For testing, you can create a free account at Sharelatex.

1. The makefile is generated by tikz-external as expected.
2. The make-command works as expected. The file myPlot.pdf is generated and can be found in cache beside the log-files.
3. In the second run of pdflatex, the myPlot.pdf is NOT inserted in the main-file.

## Problem

In the second run of pdflatex, it looks like myPlot.pdf does not exist. The warning is:

Package tikz Warning: Some images are not up-to-date and need to be generated.


And actually: if I download myPlot.pdf and upload it again so that it is a regular part of the project and not only a cached file, everything works fine!

## Question

How can I tell sharelatex to see the cached files in the second run of pdflatex?

I run the community edition of Sharelatex in docker on my own server, so I have access to everything you might suggest.

Looking forward to Sunday -- has the easter bunny hid any options, flags, ... in any config-file deep inside the sharelatex-code that could help me? Maybe have to give access privileges to any processes?

I would be really happy if you could help me. Furthermore, the solution could result in a great feature to other users for quite fast compiling on a fast multi-core server?!

• If you would like to test on your own server, do not forget to activate -shell-escape in /var/www/sharelatex/clsi/app/js/LatexRunner.js with respect to github.com/sharelatex/sharelatex-docker-image/issues/45 – Tobias Apr 14 '17 at 21:21
• What is produced beside the .pdf, which is probably not the most interesting file here. Which method is externalisation using to decide whether files require updating? – cfr Apr 15 '17 at 0:46