Graphics, Figures & Tablesgnuplot to LaTeX

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
skrat
Posts: 11
Joined: Fri Sep 05, 2014 5:22 pm

gnuplot to LaTeX

Post by skrat »

hi there,

I am having some troubles importing graphs from gnuplot to LaTeX and I can't find any good solutions using google...

The thing is, that using terminal "tikz" I created a "name.tex" file. Now the idea is, to use the follwoing code in latex:

Code: Select all

\documentclass{article}
\usepackage{tikz}
\usepackage{gnuplot-lua-tikz}

\begin{document}
\input{name.tex}
\end{document}
but I get an error: ! LaTeX Error: File `gnuplot-lua-tikz.sty' not found.Type X to quit or <RETURN> to proceed,or enter new name. (Default extension: sty)Enter file name:! Emergency stop.<read >

But the thing is, that if I try to search for `gnuplot-lua-tikz.sty' with my explorer, it finds it - somewhere.


What should I do? :/

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: gnuplot to LaTeX

Post by Johannes_B »

Not only your explorer needs to find the file, LaTeX needs to find it as well.
Simple solution would be to move the file in your current LaTeX-working-directory.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

gnuplot to LaTeX

Post by Stefan Kottwitz »

skrat wrote:if I try to search for `gnuplot-lua-tikz.sty' with my explorer, it finds it - somewhere.
The file should be in your TeX installation folder and the TeX file database needs to be up to date, containing it. So, move it to there, then call mktexlsr or texhash at the command prompt.

Or, simpler for testing, copy that sty file in the folder of your own document.

Stefan
LaTeX.org admin
skrat
Posts: 11
Joined: Fri Sep 05, 2014 5:22 pm

gnuplot to LaTeX

Post by skrat »

Johannes_B wrote:Not only your explorer needs to find the file, LaTeX needs to find it as well.
Simple solution would be to move the file in your current LaTeX-working-directory.
That was my idea yes, but I couldn't find the working directory... O.o

I am using Texmaker and I couldn't find any .sty files there. May I ask you where are they supposed to be?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: gnuplot to LaTeX

Post by Stefan Kottwitz »

It means your document directory, where the document itself is stored. Click "Save as" in the editor menu to see it.

Stefan
LaTeX.org admin
skrat
Posts: 11
Joined: Fri Sep 05, 2014 5:22 pm

gnuplot to LaTeX

Post by skrat »

Hmm,

Interesting. I got that part right. So, no more missing files problems. But it still doesn't work.

If I try to run

Code: Select all

\documentclass{article}
\usepackage{tikz}
\usepackage{gnuplot-lua-tikz}

\begin{document}
\input{name.tex}
\end{document}
where "name.tex" is the file from gnuplot in terminal "tikz", I get all sorts of errors from Texmaker. :/
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

gnuplot to LaTeX

Post by Stefan Kottwitz »

skrat wrote:I get all sorts of errors from Texmaker. :/
You could tell us the errors if you would like us to comment them. The first error is the most important, since following errors could be caused by the first one too.

The best would be if you would upload used files as attachment to a post, such as name.tex, so we could test it.

Stefan
LaTeX.org admin
skrat
Posts: 11
Joined: Fri Sep 05, 2014 5:22 pm

gnuplot to LaTeX

Post by skrat »

Ok, good idea. The file is attached. The code is my previous post.
name.tex
Gnuplot returns this file using "tikz" terminal
(10.99 KiB) Downloaded 320 times
Also in the attached picture there is a screenshot of the errors. :)
errors
errors
fffffff.PNG (121.9 KiB) Viewed 6543 times
Thank you for all the help!
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

gnuplot to LaTeX

Post by Stefan Kottwitz »

You used LaTeX code in your labels (such as \cdot) but it is not switched on. It has to be

... {$U[V\cdot 10^{-4}]$} ...

Find the setting in gnuplot, or fix it in name.tex.

Well, you could fix the whole picture at once by adding options to the tikzpicture environment in name.tex:

\begin{tikzpicture}[gnuplot,execute at begin node=$, execute at end node=$]

Using pgfplots, which is native fine LaTeX, would be much easier than gnuplot.

Stefan
LaTeX.org admin
skrat
Posts: 11
Joined: Fri Sep 05, 2014 5:22 pm

Re: gnuplot to LaTeX

Post by skrat »

GREAT, thank you!

I corrected the .tex code and now it works perfectly!

Thanks a lot!
Post Reply