0

I was wondering if is possible to have latex labels in Gnuplot but with pdf output instead .tex

Thanks.

  • 1
    Welcome to LaTeX! Welcome to TeX.SX! If you're asking how to configure Gnuplot, then unfortunately this website is not the right place to ask this and you might have better luck on StackOverflow. Having said this, I'll also point out that PGFplots is a great plotting packing within LaTeX. – JP-Ellis Feb 26 '16 at 11:56
0

I may reply a bit too late, however, I had the same problem and I've found the solution here.

Basically you need to add a single additional key "standalone" to your terminal definition. I provide a MWE below (script.gp):

set terminal epslatex size 3.5,2.62 standalone color colortext 10
set output 'example.tex'
plot sin(x)

After that you run three more commands:

gnuplot script.gp
latex example.tex
dvips -o example.ps example.dvi

Finally, you can convert the resulting file to pdf. This is probably not the most optimal way to do what you need, however, it works.

UPDATE: Actually, that was a very long way to do this due to my lack of experience. You can reduce the number of steps like this:

gnuplot script.gp
latex example.tex
dvipdf example.dvi example.pdf

However, for some reason dvipdf started giving an empty pdf document some time ago (and I have no desire to dig deeper). You also can use latex directly through pdflatex, however, I get two pdf output files, one of them has no labels at all.

1

Yes, it is possible. Gnuplot has so called epslatex terminal, which outputs labels in latex and the plot in eps. LaTeX graphics package can automatically convert eps to pdf.

Leyla Akhmadeeva and I wrote a paper about this for TUGboat: http://tug.org/TUGboat/tb34-3/tb108veytsman.pdf

  • Thanks Boris. Is there a way to have a plot with latex labels directly to pdf output from gnuplot's terminal without convert it from eps to pdf within latex package ? – Elias Rodrigues Feb 27 '16 at 16:16
  • @EliasRodrigues you need to process TeX input in TeX using the preamble of your document to get consistent fonts and sizes in PDF. This is the most direct way to do it. – Boris Feb 27 '16 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.