LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 11-07-2009, 08:24 PM   #1
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,569
Blog Entries: 1

Rep: Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026
which terminal to use with gnuplot to work with pdf latex


I'm trying to embed some gnuplot graphs into pdflatex documents. I've had no luck so far. Which terminal is best for pdflatex?

Thank you
 
Old 11-08-2009, 04:15 AM   #2
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
There are more than one way I recall, depending on if you are OK with the plain Gnuplot result, or if you want some "extra" like LaTeX symbols into the graphs. If you run
Code:
set terminal
in Gnuplot, you'll see what it can do (probably you knew this already), if you want to try out some of them. It would be nice to have it output .pdf as these you could embed in a (pdf)LaTeX document, but it won't, without a "get-around".

Personally I need to have some symbols in the plots that Gnuplot doesn't know how to do. For this I use a little "trick" I read from someone's website long time ago: I set the output terminal to be "epslatex" and write the symbols in the Gnuplot file as in LaTeX (for example \Delta into a title). This produces two files: a .tex file and a .eps file, the other containing the symbols and the other the plot, without symbols. Then I use a minimal (pdf)LaTeX document to combine these two by inputting the .tex file, which results in a .pdf file containing both the plot and the symbols. I'm not doing anything fancy here, so the resulting file is sized A4, whereas the plot itself is typically smaller, so then I still need to use pdfcrop to "cut" the plot out to form a .pdf that contains only the plot (with symbols) and is properly sized, which I can them put in a (pdf)LaTeX document like any other .pdf image.

This sounds like awfully lot of work, but it didn't take long for me to write a script that automates most of the work. Now I only need to make the Gnuplot work in a .gp file as I usually do and setting the output terminal to 'epslatex'. Then I run the script and give it the .gp file as an argument (and the output .tex/.eps filename as well, though I usually do this so that it's the same as the .gp filename without suffix -- less writing, less work), and the script runs it through Gnuplot, makes a temporary (pdf)LaTeX file to combine the resulting files, crops the produced .pdf and removes temporary files before exiting, so that the overall result is just the .pdf file (.gp preserved), nothing else. Pretty neat (though the script is a little ugly as of now..but it works).

Last edited by b0uncer; 11-08-2009 at 04:20 AM.
 
Old 11-08-2009, 07:39 AM   #3
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,569
Blog Entries: 1

Original Poster
Rep: Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026
Thanks, I managed to get it work with 'epslatex'. Could you possibly post your script, please? I'm sure I'll benefit from it.

btw, this is how I embed it in a .tex file:
Code:
\documentclass[11pt,twoside,a4paper]{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
  \begin{center}
    \scalebox{1.0}{\input{plot.tex}}
  \caption{My caption}
  \end{center}
\end{figure}
\end{document}
 
Old 02-15-2011, 06:25 AM   #4
mtrummer
LQ Newbie
 
Registered: Feb 2011
Posts: 1

Rep: Reputation: 0
gnuplot and latex

Hello,

I embedd many gnuplot figures in my latex files. The way I do this is by first using the postscript terminal, and then by converting the eps files to pdf, in order to be able to use them with pdflatex. This works just fine. The problem I have now is that I use the gnuplot symbols 24, 25 and 27 of the postscript pointtypes (half-filled circle, ...). Since I do not like having these symbols with an explanation in the key of the figure, I use latex captions to describe them instead. How do I produce these symbols with pdflatex?

Thanks for your help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gnuplot svg terminal problem sreejithpk Linux - Software 6 03-18-2009 11:24 AM
no x11 terminal in gnuplot 4.0.0 polzbert Linux - Software 1 01-10-2006 04:54 AM
gnuplot cant detect terminal trylinux Linux - Software 3 02-17-2005 04:02 AM
pdf--->> latex, graphics possible? realos Linux - General 2 05-31-2004 04:50 AM
LaTeX to pdf kwigibo Linux - General 2 01-04-2003 07:44 PM


All times are GMT -5. The time now is 03:43 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration