larskotthoff / gnuplottex

Gnuplot graphs in LaTeX. See http://www.ctan.org/pkg/gnuplottex
3 stars 1 forks source link

tikz externalize in beamer overlays creates hundreds of files #14

Open Eldrad-Ulthran opened 4 years ago

Eldrad-Ulthran commented 4 years ago

When combining beamer overlays, gnuplottex and the externalize function of tikz (in pdflatex) an absurd amount of files is generated. Consider this example, where the externalized files should be placed in the folder gnuplottmp. However, after compilation there are now 72 temporary files in the main folder of the main.tex file with the name main-gnuplottex-fig[1 to 36].[tex or gnuplot]. Additionally, in the subfolder gnuplottmp/ there are now 2808 files which take up almost 50MB. These have names like main-figure0-gnuplottex-fig1.gnuplot, main-figure35-gnuplottex-fig36.tex and so on. Most of the files seem to be duplicates of each other as well… e.g. in this case I spotted main-figure0.pdf and main-figure6.pdf to be identical.

The externalization does work in principle, successive compilations are definitely faster than the first one, but what is going on here?

%%%%%%%%%%%%%%%%%%%% \documentclass{beamer} \usepackage[utf8]{inputenc} \usepackage{siunitx} \usepackage{gnuplot-lua-tikz} \usepackage{tikz} \usetikzlibrary{external} \tikzexternalize[prefix=gnuplottmp/] \usepackage[siunitx]{gnuplottex}

\begin{document} \begin{frame}[fragile]{Some title} \centering

\begin{onlyenv}<1> \begin{gnuplot}[terminal=tikz, terminaloptions={color size 10cm,7cm}] plot sin(x) \end{gnuplot} \end{onlyenv}

\begin{onlyenv}<2> \begin{gnuplot}[terminal=tikz, terminaloptions={color size 10cm,7cm}] plot cos(x) \end{gnuplot} \end{onlyenv}

\begin{onlyenv}<3> \begin{gnuplot}[terminal=tikz, terminaloptions={color size 10cm,7cm}] plot tan(x) \end{gnuplot} \end{onlyenv}

\begin{onlyenv}<4> \begin{gnuplot}[terminal=tikz, terminaloptions={color size 10cm,7cm}] plot sin(x)*cos(x) \end{gnuplot} \end{onlyenv}

\begin{onlyenv}<5> \begin{gnuplot}[terminal=tikz, terminaloptions={color size 10cm,7cm}] plot sin(x)**2 \end{gnuplot} \end{onlyenv}

\begin{onlyenv}<6> \begin{gnuplot}[terminal=tikz, terminaloptions={color size 10cm,7cm}] plot sin(x)*x \end{gnuplot} \end{onlyenv}

\end{frame} \end{document}

larskotthoff commented 4 years ago

Hmm, I don't think that this is something I can detect and work around in gnuplottex -- looks like beamer is creating all the repeated calls. I don't have access to the information where they came from in gnuplottex.

If you have any suggestions they'd be more than welcome, but I'm going to close this for now as this isn't something caused by gnuplottex.

uhoefel commented 4 years ago

Does this also happen when you have separate slides? If I would have to guess, I would guess that they are all rerun for each "sub"slide (1 to 6). Then it would indeed be something that is probably out of reach for gnuplottex.

Eldrad-Ulthran commented 4 years ago

Putting the figures on different slides only partially eliminates the duplicates. There are still files created in the main directory ("main-gnuplottex-fig[1-6].tex"), and in the externalized folder there are still duplicate .tex files, e.g. "main-figure0-gnuplottex-fig1.tex" and main-figure1-gnuplottex-fig1.tex (up to fig6).