GeneralGnuplot Issue and Option Clash for Package

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
tcovoc
Posts: 3
Joined: Tue Aug 02, 2011 9:27 pm

Gnuplot Issue and Option Clash for Package

Post by tcovoc »

Hello!

At the outset I would like to apologize that the first message on the forum and right away please help and please forgive me for any language mistakes

Although I try to use gnuplot in conjunction with packages Tikz and PGZ, but still come across any problems.

I downloaded gnuplot, I changed the name of pgnuplot.exe on gnuplot.exe and placed it in the folder C: \ Windows \ System32
I downloaded the gnuplot-lua-tikz.sty and gnuplot.lua I found online, but I do not know whether that is for sure

The gnuplot.lua sorce is below
http://code.google.com/p/scintillua/sou ... nuplot.lua
I don't know how to make shell escape allowed (LED editor). I tried to put some lines on the top of the document, but it did not work.

Another mistake that arises is: "Latex Error: Option clash for package color."

My code:
%& -shell-escape

Code: Select all

\documentclass[a4paper]{article}
 \usepackage[miktex]{gnuplottex}
 \usepackage{tikz}
 \usepackage{gnuplot-lua-tikz}
 \usepackage{mathpazo}
\usepackage[cp1250]{inputenc}
\usepackage{polski} 
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{color}
\usepackage[usenames]{color} 
\usepackage{fancyhdr}
\usepackage{enumerate}
\usepackage{pgf}
\newcommand{\szerokosc}{15.92cm}
\newcommand{\linia}{\rule{\linewidth}{0.2mm}}
%-----------------------------------------
\begin{document}
\pagestyle{fancy}
\rhead{\small Lorem...}
\lhead{\small Lorem...}
\renewcommand{\headrulewidth}{0.4pt}

 \begin{gnuplot}[scale=0.95,terminal=lua]
     set parametric
     set angle degree
     set urange [0:360]
     set vrange [-90:90]
     fx(u,v)=cos(u)*cos(v)
     fy(u,v)=sin(u)*cos(v)
     fz(v)=sin(v)
     splot fx(u,v),fy(u,v),fz(v)
 \end{gnuplot}

\end{document}
I'll be very grateful for your help. I really depend on that.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Gnuplot Issue and Option Clash for Package

Post by localghost »

You are mixing two different because unrelated topics in one thread, which is not desirable.
tcovoc wrote:[…] I downloaded gnuplot, I changed the name of pgnuplot.exe on gnuplot.exe and placed it in the folder C: \ Windows \ System32 […]
Since version 4.4.x of Gnuplot this is not necessary anymore because there is a »gnuplot.exe« located in the »binary« sub-directory.
tcovoc wrote:[…] I don't know how to make shell escape allowed (LED editor). I tried to put some lines on the top of the document, but it did not work. […]
Since I don't use neither LEd nor Wind0ws I can't tell you clearly what to do, but somewhere you should find the settings for calling the compiler. There you will have to add the command line option --enable-write18. The approach with the first line entry only works if the compiler is called with the command line option -parse-first-line [1].
tcovoc wrote:[…] Another mistake that arises is: "Latex Error: Option clash for package color." […]
Just don't load the color package twice. And perhaps you should think about using the more sophisticated xcolor package instead.

It's worth to take a look at the brilliant pgfplots package. It uses Gnuplot as back-end. I don't know what this gnuplot-lua-tikz thing is, but the package can't be poorer.

[1] MiKTeX 2.9 Manual — miktex-pdftex


Best regards and welcome to the board
Thorsten
tcovoc
Posts: 3
Joined: Tue Aug 02, 2011 9:27 pm

Gnuplot Issue and Option Clash for Package

Post by tcovoc »

If this would help I could move to another editor. I would be grateful if you could help me solve these problems.

I changed

Code: Select all

\usepackage{color}
\usepackage[usenames]{color} 
into

Code: Select all

\usepackage{color}
\usepackage[usenames]
and it works.

And if we are talking about gnuplot...
How Latex editor will know about its existence, since this program haven't a normal installation?

__
How to find Package Manager in MikTeX? Which executable file I need to open?


Regards,
tcovoc
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Gnuplot Issue and Option Clash for Package

Post by localghost »

tcovoc wrote:If this would help I could move to another editor. I would be grateful if you could help me solve these problems. […]
I'm not sure what you expect in this regard. A recommendation?
tcovoc wrote:[…] I changed

Code: Select all

\usepackage{color}
\usepackage[usenames]{color} 
into

Code: Select all

\usepackage{color}
\usepackage[usenames]
and it works. […]
I'm pretty sure that this doesn't work. Take a look at the log file. Instead I recommend the xcolor package included like this.

Code: Select all

\usepackage[usenames]{xcolor}
This is the only line you need.
tcovoc wrote:[…] And if we are talking about gnuplot...
How Latex editor will know about its existence, since this program haven't a normal installation? […]
You have to make your system aware of Gnuplot. On an older Wind0ws XP system the following steps worked for me.
  1. Get the current version 4.4.3 of Gnuplot from its homepage [1].
  2. Unpack the archive to e. g. »C:\Program Files\Gnuplot«. No need anymore to rename a file.
  3. Add the directory »C:\Program Files\Gnuplot\binary« to the »Path« environment variable. On older systems like Wind0ws XP it was possible to do that by the following steps.
    1. Do a right click on the desktop icon from which I think that in English it is called »My Computer« and choose »Properties« from the context menu.
    2. Select the tab »Advanced« (not sure if this is its English name). Near the bottom of the dialog window you can find the button »Environment Variables« (or similar).
    3. Select the variable »Path« from the system variables and click »Edit«.
    4. Add the path »C:\Program Files\Gnuplot\binary«. Note that the entries are separated by a semicolon. And of course click »OK«.
It can happen that the new entry isn't immediately recognized by the system. A restart should remedy this issue.

Since I'm not using a current Wind0ws system there is no guarantee that my descriptions are completely correct. Some steps may differ. And I'm not sure about the names of buttons and tabs since I have a German system.
tcovoc wrote:[…] How to find Package Manager in MikTeX? Which executable file I need to open? […]
Like all other installed programs on your machine you should find it via »Start« menu [2]. There should be two versions of »Maintenance« tools, one for the current user and one for the admin. I guess the admin versions are preferable for all maintenance processes.

[1] gnuplot homepage
[2] MiKTeX 2.9 Manual
tcovoc
Posts: 3
Joined: Tue Aug 02, 2011 9:27 pm

Gnuplot Issue and Option Clash for Package

Post by tcovoc »

localghost wrote: I'm not sure what you expect in this regard. A recommendation?
Exactly. The editor is not for me until this matter - I only depend on the inclusion of the "shell escape" on Windows.

localghost wrote:I'm pretty sure that this doesn't work. Take a look at the log file. Instead I recommend the xcolor package included like this.

Code: Select all

\usepackage[usenames]{xcolor}
This is the only line you need.
I changed

Code: Select all

\usepackage{color}
\usepackage[usenames]{color} 
into

Code: Select all

\usepackage[usenames]{xcolor}
and i and I get an error "Option clash for package xcolor".

I do not know why, because this package is not loaded twice

Code:

Code: Select all

%& -shell-escape
\documentclass[a4paper]{article}
 \usepackage[miktex]{gnuplottex}
 \usepackage{tikz}
 \usepackage{gnuplot-lua-tikz}
 \usepackage{mathpazo}
\usepackage[cp1250]{inputenc}
\usepackage{polski} 
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage[usenames]{xcolor}
\usepackage{fancyhdr}
\usepackage{enumerate}
\usepackage{pgf}
%-----------------------------------------
\begin{document}
\pagestyle{fancy}
\rhead{\small Lorem...}
\lhead{\small Lorem...}
\renewcommand{\headrulewidth}{0.4pt}

 \begin{gnuplot}[scale=0.95,terminal=lua]
     set parametric
     set angle degree
     set urange [0:360]
     set vrange [-90:90]
     fx(u,v)=cos(u)*cos(v)
     fy(u,v)=sin(u)*cos(v)
     fz(v)=sin(v)
     splot fx(u,v),fy(u,v),fz(v)
 \end{gnuplot}
\end{document}
localghost wrote: You have to make your system aware of Gnuplot. On an older Wind0ws XP system the following steps worked for me.
  1. Get the current version 4.4.3 of Gnuplot from its homepage [1].
  2. Unpack the archive to e. g. »C:\Program Files\Gnuplot«. No need anymore to rename a file.
  3. Add the directory »C:\Program Files\Gnuplot\binary« to the »Path« environment variable. On older systems like Wind0ws XP it was possible to do that by the following steps.
    1. Do a right click on the desktop icon from which I think that in English it is called »My Computer« and choose »Properties« from the context menu.
    2. Select the tab »Advanced« (not sure if this is its English name). Near the bottom of the dialog window you can find the button »Environment Variables« (or similar).
    3. Select the variable »Path« from the system variables and click »Edit«.
    4. Add the path »C:\Program Files\Gnuplot\binary«. Note that the entries are separated by a semicolon. And of course click »OK«.
It can happen that the new entry isn't immediately recognized by the system. A restart should remedy this issue.
I tried to follow these guidelines and probably it is?
Path-EV.png
Path-EV.png (16.9 KiB) Viewed 6264 times
Sorry for the long message.


Regards,
tcovoc
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Gnuplot Issue and Option Clash for Package

Post by localghost »

tcovoc wrote: Exactly. The editor is not for me until this matter - I only depend on the inclusion of the "shell escape" on Windows. […]
A recommendation is difficult at best. You may look at the »LaTeX Editors« section on our board index. Regardless of which editor you use, there should be settings that allow you add this command line option to be passed to the compiler.
tcovoc wrote:[…] I do not know why, because this package is not loaded twice […]
It is so, but hidden in some way. The tikZ package already loads it. So just load xcolor before.
tcovoc wrote:[…] I tried to follow these guidelines and probably it is? […]
This should work. Test if Gnuplot is found on your system by opening a command line and trying to start. Type "gnuplot" and confirm with »Enter«.
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Gnuplot Issue and Option Clash for Package

Post by shadgrind »

If you want to use gnuplot, then I'd recommend using it directly instead of though the gnuplottex package, which seems broken.

The easiest way is to use gnuplot's epslatex terminal and then use the output in your LaTeX document. But if you want gnuplot to use TikZ for creating the plot, then do the following:

1. In gnuplot run the following commands:

Code: Select all

set terminal lua tikz
set parametric
set angle degree
set urange [0:360]
set vrange [-90:90]
unset key
set xlabel '$x$'
set ylabel '$y$'
set zlabel '$z$'
fx(u,v)=cos(u)*cos(v)
fy(u,v)=sin(u)*cos(v)
fz(v)=sin(v)
set output 'luatikztest.tex'
splot fx(u,v),fy(u,v),fz(v)
This only works if your version of gnuplot supports the Lua TikZ terminal. You'll get an error message after the "set terminal lua tikz" command otherwise, at which point you can't go this route.

2. If the above worked, then copy the luatikztest.tex file to the same directory that contains your main LaTeX file:

Code: Select all

\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage[usenames]{xcolor}
\usepackage{tikz}
\usepackage{gnuplot-lua-tikz}
\begin{document}
\scalebox{0.95}{\input{luatikztest.tex}}
\end{document}
3. Compile that LaTeX file and you should see your plot in the resulting PDF.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
Post Reply