larskotthoff / gnuplottex

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

Error using `do for {...}` inside gnuplot environment #11

Closed mroavi closed 5 years ago

mroavi commented 5 years ago

Hello. I want to be able to use iterators like do for and while loops within the gnuplot environment. I haven't been able to escape the curly brackets { so that gnuplot can process them without latex giving an error. This is a simple example that reproduces the problem:

\begin{gnuplot}[terminal=cairolatex,terminaloptions={transparent font "arial,10" fontscale 1.0 linewidth 3}]
    do for [i=1:2] {replot x*i}
\end{gnuplot}

This code works fine if I copy-paste it in the gnuplot terminal. Thanks in advance.

larskotthoff commented 5 years ago

This is a problem with the cairolatex terminal, which doesn't escape such characters properly. You should be fine using a different terminal. You'll also need to provide an initial expression to be plotted though.