Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using latest TeXLive on Linux, and have gnuplot installed. I have also installed gnuplottex package.

Then, I'm trying to compile the basic gnuplottex CTAN example, example-pdf.tex; however, I get this:

$ pdflatex -shell-escape test.tex
...
! Undefined control sequence.
\gnuplotverbatimwrite ...e \openout \verbatim@out 
                                                  #1 \BeforeStream \let \do ...
l.7 ...f,terminaloptions={font ",10" linewidth 3}]

? X

(full log here)

Anyone have any idea how do I get this basic example to work?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

I've updated the package with the bug fix, should be at a CTAN mirror near you shortly. Thanks guys!

share|improve this answer
    
Many thanks for the feedback, @Lars Kotthoff - moved the accepted answer to yours :) Cheers! –  sdaau Sep 12 '11 at 15:38

I also experienced this error message and used your solution for it. It works very well for smaller documents, meaning less than, say, up to 13 gnuplot-streams in a file.

sadly I experienced a new error in bigger files of my Ph.D. since then: "no room for a new \write". This occurs, if you have more than 13 gnuplot figures in your file, in my case currently I have about 30.

But, finally I got a solution for this also, in de.comp.text.tex by Heiko Oberdiek: just change your: \newwrite\verbatim@out with: \@ifundefined{verbatim@out}{\newwrite\verbatim@out}{}% This avoids that each gnuplot-stream blocks a write-register and the error will not occur any more.

share|improve this answer
    
Hi @Brinker - many thanks for posting your issue and resolution as well! Cheers! –  sdaau Jul 20 '11 at 10:07

Ok, I think I got it - I think it's an error in the package itself..

First of all, according to the error message above, the 'undefined control sequence' seems to occur for \verbatim@out. I first tried to debug the macros using a \tracingmacros=1 in the .tex file, but that didn't tell me too much.

Then I read a bit through verbatim.pdf - A New Implementation of LaTeX's verbatim and verbatim * Environments., and it says:

As a final nontrivial example we describe the definition of an environment called verbatimwrite. It writes all text in its body to a file whose name is given as an argument. We assume that a stream number called \verbatim@out has already been reserved by means of the \newwrite macro.

Ahha... well, gnuplottex.dtx (and the corresponding gnuplottex.sty that gets generated), actually doesn't use \newwrite at all!!

So I simply opened my /PATH/TO/texlive/texmf-dist/tex/latex/gnuplottex/gnuplottex.sty in a text editor, and inserted a \newwrite\verbatim@out after line 84 - so the code around it now looks like:

...
\newcounter{fignum}
\def\figname{\jobname-gnuplottex-fig\thefignum}

\def\gnuplotverbatimwrite#1{%
    \newwrite\verbatim@out % <===== ADDED HERE!!
    \def\BeforeStream
    {\message{Opening gnuplot stream #1}%
        \immediate\write\verbatim@out{\string set terminal \gnuplotterminal \gnuplotterminaloptions}
\immediate\write\verbatim@out{\string set output '\figname.\gnuplottexextension{\gnuplotterminal}'}
    }
    \@bsphack
    \immediate\openout \verbatim@out #1
    \BeforeStream%
...

... and now the basic example seems to work :) (although, I cannot really tell if this is all there is to it :))

Cheers!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.