# gnuplottex package not working anymore

Whenever I try to use the gnuplottex package, I get the following error messages:

/usr/share/texlive/texmf-dist/tex/latex/gnuplottex/gnuplottex.sty:79: Argument of " has an extra }. [...te\write18{rm -f "\jobname.gnuploterrors"}]
/usr/share/texlive/texmf-dist/tex/latex/gnuplottex/gnuplottex.sty:79: Paragraph ended before " was complete. [...te\write18{rm -f "\jobname.gnuploterrors"}]
/home/myDocument.tex:118: Package catchfile Error: File myDocument.gnuploterrors' not found. [\end{document}]
TeX STOPPED: File ended while scanning use of \gnuploterrors@eatpa\ifx \gnuploterrors@ \@empty \else \PackageWarningNoLine {gnuplottex}
TeX reports the error was in file: myDocument.tex


Line 79 of gnuplottex.sty reads \immediate\write18{rm -f "\jobname.gnuploterrors"}, so it not being executed seems to be the cause for the other errors.

Everything worked fine before, but I upgraded to Xubuntu 16.04 LTS lately, so this may be the cause. I already tried removing gnuplot and TeX Live completly and installing them again, but the error remains.

Edit:

I'm using pdflatex and Version 0.9.1 of gnuplottex. All it needs to produce this error is just a \usepackage{gnuplottex}, so for example this document doesn't compile:

%!TEX options = "--shell-escape"

\documentclass[a4paper]{article}

\usepackage{gnuplottex}

\begin{document}
\end{document}


However, I noticed that with this minimal file, only the last 3 lines of the error message from above are shown. All 5 lines are only shown if I also add \usepackage{ngerman}.

• Can you add a minimal example of a LaTeX file for testing? Also the version of gnuplottex is needed. Are you running pdflatex or lualatex? – egreg Apr 23 '16 at 16:29
• How do I find out my version of gnuplottex? – jmb Apr 23 '16 at 17:18
• Look in the log file: you should find something like Package: gnuplottex 2015/12/13 v0.9.1 gnuplot graphs in LaTeX – egreg Apr 23 '16 at 17:20

It's an oversight of gnuplottex: if no gnuplot diagram is processed, the file <jobname>.gnuploterrors is not produced, so the final code for displaying errors fails to find it.

203 \AtEndDocument{%
204   \ifmiktex
205   \else
206     \CatchFileDef\gnuploterrors@{\jobname.gnuploterrors}{\endlinechar=^^J \catcode\ =12 }%
207     \expandafter\gnuploterrors@eatpar\gnuploterrors@\@nil
208     \ifx\gnuploterrors@\@empty\else
209       \PackageWarningNoLine{gnuplottex}{Gnuplot execution produced errors:^^J%
210         \detokenize\expandafter{\gnuploterrors@}}%
211     \fi
212   \fi
213 }


Lines 206–211 should better be

    \IfFileExists{\jobname.gnuploterrors}{%
\CatchFileDef\gnuploterrors@{\jobname.gnuploterrors}{\endlinechar=^^J \catcode\ =12 }%
\expandafter\gnuploterrors@eatpar\gnuploterrors@\@nil
\ifx\gnuploterrors@\@empty\else
\PackageWarningNoLine{gnuplottex}{Gnuplot execution produced errors:^^J%
\detokenize\expandafter{\gnuploterrors@}}%
\fi
}{}%


However, the error should not appear as soon as you have a gnuplot environment in your document.

• Thank you a lot! Shouldn't this be considered a bug in gnuplottex? Also, shouldn't many more people be running in to this problem? I couldnt't find anything about it online. – jmb Apr 23 '16 at 18:25
• @jmb Possibly nobody tried using the package with no gnuplot` environment in the document. But it's surely something to be solved. – egreg Apr 23 '16 at 19:22
• @jmb It's silly to unaccept the answer that solves the stated problem. If you have different problems, you should state them clearly. – egreg Jun 23 '16 at 12:36
• Thanks for the fix! @jmb I've just uploaded a new version, which should be available shortly. Please use the github project page for reporting bugs. – Lars Kotthoff Aug 21 '16 at 19:57
• @LarsKotthoff Added to the list of “watched” repositories – egreg Aug 21 '16 at 19:59