TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to pass a TeX macro to the gnuplottex environment gnuplot. The example here is rather trivial but help solving would be appreciated. The end goal is to adapt the gnuplottex code to call octave instead and return a curve fit string in algebraic notation, via a text file, for use in a pstricks plot. Anyway although the example is trivial the solution would be helpful for non-trivial use.

\def\plotme{\string 2*x}
plot [x=20000:20005] \plotme 
share|improve this question

The callout to gnuplot happens in this line (line 141 in my gnuplottex.sty)

\immediate\write18{gnuplot \figname.gnuplot}

You would need to change that to call octave instead (and add commandline options accordingly. The \figname.gnuplot is written starting line 86


You would similarly need to adjust this to create octave commands. The inclusion of the finished figure happens in line 151


You could change that to insert the output from octave into a pst-plot environment (which might be tricky), or change the file output from octave to contain all the code required to make the plot in a similar fashion to how the input file is written. You could then simply include this file.

Basically, you can execute arbitary shell commands and write arbitrary files. You have to find what works best for you, but it should certainly be possible.

share|improve this answer
Hi, Thanks for the response. I actually figured out how to do this with GNUplot rather than switching to octave. An example of some quick and dirty code is posted here: tug.org/pipermail/pstricks/2012/009491.html – Buddy Feb 2 '12 at 19:17
I still don't know how to process tokens in the verbatim environment - I'm sure others will be able to figure it out. I just wanted to know if pstricks could use an external fitting backend and it appears it can - thanks again. – Buddy Feb 2 '12 at 19:19

Your Answer


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.