I have an issue that has already been discussed in some form for example here and here but I have not been able to resolve it with the hints/solutions given there.

Please consider the following example:

% !TeX TS-program = pdflatex

\tikzexternalize[mode=list and make,prefix=tikz/]

            \addplot[red,mark=o] {sin(x)};

        \begin{axis}[domain=0:2, legend to name=mylegend]
            \addplot[blue,mark=square] {cos(x)};


To be sure that I always recompile with sufficient prior pdflatex runs, I used the following dummy script:


function c () {
        echo "========== PDFLATEX ========="
        pdflatex -shell-escape -synctex=1 -interaction=nonstopmode "main".tex
        echo "========== END PDFLATEX ========"

rm tikz/*
rm main.aux
rm main.figlist
rm main.makefile
rm fig1*
rm fig2*
rm main-figure*

mkdir tikz


make -f main.makefile -j4 # to compile fig1, fig2


make -f main.makefile -j4 # to compile the legend (and for some reasons also again fig2)


which results for me in the results given here enter image description here

where the legend for sin does not have the right line and marker style.


I guess \tikzset{external/optimize=false} is possible but very inconveient workaround.

Your Answer

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

Browse other questions tagged or ask your own question.