# tikzexternal, asymptote and duplicated asy files

I'm trying to work with tikzexternal and asymptote for my documents. Here is a sample TeX document :

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage[inline]{asymptote}
\usetikzlibrary{quotes,angles}
\usetikzlibrary{external}
\tikzexternalize
\begin{document}
\begin{tikzpicture}
\draw
(3,-1) coordinate (a) node[right] {a}
-- (0,0) coordinate (b) node[left] {b}
-- (2,2) coordinate (c) node[above right] {c}
pic["$\alpha$", draw=orange, <->, angle eccentricity=1.2, angle radius=1cm]
{angle=a--b--c};
\end{tikzpicture}

\begin{asy}
size(5cm,0);
pair A=(0,0), B=(4,0);
draw(A--B);
dot("$A$",A,W);
dot("$B$",B,E);
dot("$I$",(A+B)/2,N);
\end{asy}
\end{document}


When I use pdflatex --shell-escape test.tex, I get a file named test-1.asy, which is my asy file, a file test-figure0.pdf, which is my tikz picture, and another test-figure0-1.asy, which is a copy of the original asy file.

Without using --shell-escape, I don't have the extra asy file.

Does anyone has any idea how to get rid of the creation of this last file ? Here it is not really a problem, but if I have 10 tikz picture and 12 asy images, I get 10*12=120 asy files totally useless.

Thanks.

• If you don't need interactive 3d figures, you might try the asypictureB package as an alternative interface to Asymptote. If you do this, make sure that shell-escape is on and--equally importantly--the latexmk rule for Asymptote is off. – Charles Staats May 16 '15 at 3:24
• Thanks for your answer. But it did not workout. I replaced \usepackage[inline]{asymptote} with \usepackage{asypictureB} and \begin{asy} with \begin{asypicture}{name=asymptoteB}. I still have a file named test-figure0-asymptoteB.asy which is compiled in eps and the "real file" test-asymptoteB.asy which is copiled in eps and pdf format. – Regis C. May 17 '15 at 9:14
• This is a shot in the dark, but have you tried putting your asy or asypicture environment inside the text of a tikz node? (Make sure the \begin{asy} and \end{asy} commands are on lines by themselves.) And this probably goes without saying, but make sure to delete all *.asy files before recompiling when you test something like this. – Charles Staats May 18 '15 at 16:40
• Thanks again for this try. It didn't work either. Still the two asy files at the end. – Regis C. May 19 '15 at 13:26