# Pdf-latex & tikz-feynman

Recently I have known how to use tikz-feynman with pdf-latex but I missunderstand one moment. I have used:

\usetikzlibrary{external}             %% Load the external library
\immediate\write18{mkdir -p pgf-img}  %% Create pgf-img directory
\tikzexternalize[                     %% Activate externalization
prefix=pgf-img/,                    %% Avoid cluttering the directory
system call={                       %% Use lualatex in system call
lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname="\image" "\texsource"
},
]


but, unfortunately, compilation produces a lot of errors. As I understand, these errors doesn't give any problems, but I would like to clarify it.

For instance, I will try to give a sample of code which works but produces errors.

\documentclass[a4paper,11pt]{article}
\usepackage{tikz}
\usetikzlibrary{external}             %% Load the external library
\immediate\write18{mkdir -p pgf-img}  %% Create pgf-img directory
\tikzexternalize[                     %% Activate externalization
prefix=pgf-img/,                    %% Avoid cluttering the directory
system call={                       %% Use lualatex in system call
lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname="\image" "\texsource"
},
]
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\begin{tikzpicture}[baseline=-\the\dimexpr\fontdimen22\textfont2\relax]
\begin{feynman}
\vertex (v1);
\vertex[right=0.7cm of v1] (v2);
\vertex[above right=0.7cm of v2] (v3);
\vertex[below right=0.7cm of v2] (v4);
\diagram*{(v1)--[boson](v2),(v2)--[fermion](v3),(v4)--[fermion](v2)};
\end{feynman}
\end{tikzpicture}
\end{document}


The first appeared error is

• errors always give you problems, never ignore them! – user192672 Jul 13 at 20:44

## 2 Answers

It seems you are using overleaf I do not know, sorry.

But the error message is very clear for me: The issue here is that you want to run \immediate\write18{mkdir -p pgf-img}.

With my current MiKTeX I have to add the command option -shell-escape to the call of lualatex.exe to enable LuaLaTeX to start an extern run ...

Please ask the support of overleaf how to do that with overleaf (if it is possible there) ...

My problem has been solved in the very strange way.

I change compiler to LuaLaTeX and it still gives errors. Then I change compiler one more time to pdf-LaTeX and now it works without errors.