# External PDF from pgfplots contains several pages when with floatrow

Plotting with pgfplots and the external library creates the single PDFs for every plot as wanted. But every of those PDFs contains several pages, each showing the same plot. Sometimes there are three pages, sometimes much more. I couldn't figure out, what triggers the amount of pages.

Since only the first page is included into the master document, I get correct results. But I guess the compilation slows down quite a bit, because all equal pages have to be created individually. When I compare compilation with and without the external library I experience a much longer time with it.

Does it behave equally for you? What could be done about it?

Edit: Minimal example. It seems the floatrow package is the problem here... In this case two files are generated. If you uncomment the \tikzsetnextfilename{testplot} you get only one file but with two pages in it.

\documentclass{standalone}

\usepackage{floatrow}

\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize[mode=list and make]
\tikzset{external/system call={lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}

\begin{document}

Testplot:

%\tikzsetnextfilename{testplot}
\ffigbox
{}
{\begin{tikzpicture}
\begin{axis}[]
\addplot {sin(x)};
\end{axis}
\end{tikzpicture}}
\end{document}


Edit 2: The log file reports as well that the drawing is done twice...

Opening 'test.figlist' for writing.
Opening 'test.makefile' for writing.
\tikzexternal@outmakefile=\write5
Writing 'test-figure0' to 'test.figlist'.
Writing 'test-figure0' to 'test.makefile'.
Writing 'test-figure1' to 'test.figlist'.
Writing 'test-figure1' to 'test.makefile'.


Edit 3: When including a simple PDF image instaed of the tikzpicture, the log also tells two calls...

<test-figure0.pdf, id=4, 248.42511pt x 179.13223pt>
File: test-figure0.pdf Graphic file (type pdf)
<use test-figure0.pdf>
Package pdftex.def Info: test-figure0.pdf used on input line 25.
(pdftex.def)             Requested size: 248.42448pt x 179.13177pt.
File: test-figure0.pdf Graphic file (type pdf)
<use test-figure0.pdf>
Package pdftex.def Info: test-figure0.pdf used on input line 25.
(pdftex.def)             Requested size: 248.42448pt x 179.13177pt.

-
Can you post a minimal working example (MWE) rather than a code snippet? –  Andrew Swann Mar 25 '14 at 12:26
You are right. I was in a hurry, but now I've provided one. –  monoceros84 Mar 25 '14 at 13:20
Could anyone please try and at least confirm this issue? Since I don't even know if it's my installation or if this is a floatrow thing... –  monoceros84 Mar 27 '14 at 7:26
I can confirm the behaviour you describe. I don't (yet) understand what in floatrow is causing it. –  Andrew Swann Mar 27 '14 at 10:46
Looks like there was a similar question recently - without any answer as well. But the additional calls seem to come from floatrow trying to get the image dimensions before drawing. tex.stackexchange.com/questions/115134/… –  monoceros84 Mar 27 '14 at 15:08