# gnuplottex and auto-pst-pdf don't work together

I just started to work with gnuplottex to have nice diagrams in my thesis. In my pretests everything worked fine, but when implementing the diagram into my thesis it did not work anymore. While putting up a minimal example I found out, that the packages gnuplottex and auto-pst-pdf (which I need for other diagrams) don't work together. Can you give me a hint how to get a work around or what I am doing wrong?

\documentclass{scrartcl}
\usepackage[runs=2,crop=off]{auto-pst-pdf}
\usepackage[miktex,shell]{gnuplottex}
\usepackage{graphicx}
\usepackage{color}
\begin{document}
\tableofcontents
\clearpage
\section{Ein Kapitel}
Ein bisschen Text.
\begin{gnuplot}[terminal=epslatex, terminaloptions={color dashed size 15cm,15cm}]
set key below
set boxwidth 0.75 absolute
set style data histograms
set style histogram rowstacked
set style fill solid 1.0 border lt -1
set xtics 1 rotate by -75
set yrange [0:100]
set xtics scale 0
set xrange [0:30]
unset y2tics
set grid ytics
set ylabel 'Umsatz, Ausbeute / \%'
set noborder
plot 'test.dat' using 3:xtic(1) ti "qw", '' using 4:xtic(1) ti "we", '' using 5:xtic(1) ti "rt", '' using 6:xtic(1) ti "fg", '' using 7:xtic(1) ti "vc", '' using 8:xtic(1) ti "nb", '' using 9:xtic(1) ti "jh", '' using 2:xtic(1) with points pointtype 5 ti "mj"
\end{gnuplot}
\section{Ein Kapitel}
Ein bisschen mehr Text.
\end{document}


I know, this is not a real minimal example as I left the plot quite complete. But everything works fine when I remove the package auto-pst-pdf. When I add it, the file foo-pics.pdf does not contain the graph but the whole document just without the graph. This is then implemented at the place of the graph.

I am using MiKTeX 2.9 and TeXnicCenter 2.02. You can find my datafile below for testing purpose:

Katalysator mj qw we rt fg vc nb jh
" a" 99 0 0 0 0 68 0 0
" b" 96 0 0 0 0 53 0 0
" c" 53 0 0 0 0 21 0 0
" d" 79 0 0 0 0 7 0 0
" e" 77 0 0 0 0 22 0 0
" f" 89 0 0 0 0 15 0 0
" g" 100 0 0 0 0 35 0 0
" h" 100 0 0 0 46 0 0 0
" i" 96.72 1.56 14.95 12.86 23.52 8.63 6.87 0
" j" 98.58 0.47 2.49 11.31 61.03 0.6 0.19 1.92
" k" 100 0 0 0 43 0 0 0
" l" 58.01 0 0 0 0 4.12 0 0
" m" 49 0 0 0 0 2.03 0 0
" n" 47.26 0 0 0 0 4.53 0 0
" o" 64.06 0 0 0 0 1.72 0 0
" p" 61.92 0 0 0 0.34 14.5 0 0
" q" 57.24 0 0 0 0.05 15.71 0 0
" r" 100 0 0 0 0 70.2 0 0
" s" 100 0 0 0 1.59 44.17 0 0
" t" 100 0 0 0 1.13 81.74 0 0
" u" 100 0 0 0 14.57 26.04 0 0
" v" 100 0 0 0 2.53 64.68 0 0
" w" 31.34 0 0.31 8.97 0.16 18.77 0.27 0.36
" x" 92.05 0 8.85 14.09 8.96 31.42 9.33 1.8
" y" 57.67 0 2.79 14.44 11.9 7.33 0.78 9.65
" z" 95.74 0 0 0 1.47 0 0 0
" aa" 89.65 0.34 0.97 14.59 0.16 3.7 0 10.44
" bb" 97.5 0.59 9.7 26.57 39.75 2.21 0.95 1.88
" cc" 100 1.8 15.06 12.46 40.46 0.46 0.34 0
" dd" 26.26 0 0 11.96 0 17.61 0 0


Thank you!

• What's the error message you're getting? Have you tried loading the two packages in the opposite order in which you're loading them now? – Lars Kotthoff Aug 21 '16 at 19:25
• @LarsKotthoff I don't get an error, jut a warning. That says 'foo-pics.pdf' contains 2 pages but 1 pages are requested: File 'foo-pics.pdf' is no more valid! Recreate it. I did not try different orders of loading the packages before, but checked for it now. It does not make a difference if I exchange gnuplottex and auto-pst-pdf. Also loading auto-pst-pdf last doesn't change anything. – DookyAC Aug 22 '16 at 10:31
• Are you using latex or pdflatex? It looks like auto-pst-pdf is processing the generated figures. – Lars Kotthoff Aug 22 '16 at 16:32
• I am using pdflatex. I looked again through my complete file to see, where I need auto-pst-pdf. I have schemes with chemical compounds which I want to number automaticaly (done by chemstyle) . auto-pst-pdf allows me to work with .eps files with pdflatex. – DookyAC Aug 22 '16 at 17:37
• Have you tried a non-eps terminal for the gnuplot figures? – Lars Kotthoff Aug 22 '16 at 18:21

It seems that auto-pst-pdf is processing the figures generated by gnuplottex incorrectly. Not sure what's causing this, but you can avoid the problem by using a gnuplot terminal that supports PDF output so that this conversion is unnecessary.