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 trying to use Gnuplot and package gnuplottex to create plots directly in LaTeX. Started with the following simple example

\documentclass[a4paper]{article}
\usepackage[shell]{gnuplottex}

\begin{document}
\begin{gnuplot}[terminal=pdf,terminaloptions={font ",10" linewidth 3}]
plot sin(x), cos(x)
\end{gnuplot}
\end{document}

When I run

pdflatex  -synctex=1 -interaction=nonstopmode --enable-shell %.tex

I get the following warning messages:

Package gnuplottex Warning:Shell escape not enabled

Package gnuplottex Warning:Please convert example1-gnuplottex-fig1.gnuplot manually

...

No pages of output.

I'm using MikTeX, TeXmaker and Gnuplot 4.5. Any help will be much appreciated!

share|improve this question
2  
Have you tried running it with pdflatex -synctex=1 -interaction=nonstopmode -enable-write18 %.tex? –  Jake Jan 19 '12 at 22:56
1  
AFAIK, the option is either --enable-write18 or --shell-escape, not --enable-shell. –  egreg Jan 19 '12 at 22:56
2  
Since you just seem to be starting out with producing plots in LaTeX: May I recommend you take a look at the pgfplots package? It's a very user friendly and powerful plotting package that creates plots that integrate perfectly with your document, and it can use Gnuplot as a backend (you can use raw Gnuplot code if you wish). –  Jake Jan 19 '12 at 23:00
1  
Since you're using Miktex, you'll have to use \usepackage[miktex]{gnuplottex}. –  Jake Jan 19 '12 at 23:07
    
interesting automation article Fun with gnuplot and arara –  texenthusiast Mar 17 '13 at 18:24
add comment

1 Answer 1

up vote 16 down vote accepted

When using MikTeX, you need to load gnuplottex with the [miktex] option.

Note that you might be better off using the pgfplots package, which generates plots completely within LaTeX (or uses gnuplot as its backend). This integrates the plots much better into the document, since the same font and rendering is used for the text and the plot. It also makes it easier to annotate the plot.

Here's an example comparing the result of using gnuplottex to that of pgfplots (using gnuplot for the calculations):

\documentclass[a4paper]{article}
\usepackage[miktex]{gnuplottex}
\usepackage{pgfplots}

\begin{document}
\section{GnuplotTeX}
\begin{gnuplot}[terminal=pdf, terminaloptions={font "Arial"}]
plot sin(x), cos(x)
\end{gnuplot}

\section{PGFPLOTS}
Note how the tick labels match the document font.

\begin{tikzpicture}
\begin{axis}[domain=-10:10, samples=50, smooth, no markers, enlargelimits=false]
\addplot gnuplot {sin(x)}; \addlegendentry{$\sin(x)$}
\addplot gnuplot {cos(x)}; \addlegendentry{$\cos(x)$}
\end{axis}
\end{tikzpicture}
\end{document}
share|improve this answer
    
Thank you very much. Worked like a charm! –  ant Jan 20 '12 at 0:00
3  
Try \begin{gnuplot}[terminal=pslatex] and run latex+dvips. Then you have same font in text and plot with gnuplottex too. –  AlexG Jan 20 '12 at 11:38
1  
In pdflatex you can use \begin{gnuplot}[terminal=epslatex] –  padde Aug 6 '12 at 16:33
add comment

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.