I would like to create a graphic with gnuplot for example and import it to latex to implement it in a text. The problem is that its caption, which I created with latex, has a different font, size etc. than the labeling of the axes which were created by gnuplot.

Now I thought I might create an image via gnuplot saved as tikz, so that, when I include it in latex, the labeling's font etc., changes to the standards of the rest of my document in latex. At the end I would like to see a PDF format file which contains my text and the graphic with the same font-/ size etc.

  • 3
    Looks like you are searching for the standalone documentclass… Commented Oct 29, 2013 at 14:56
  • 2
    Why don't you call gnuplot from within tikz? Then everything should be consistent. Examples for tikz and pgfplots (search for gnuplot, or 4th example).
    – Jost
    Commented Oct 29, 2013 at 15:23

2 Answers 2



Plotting the von Neumann entropy of a two-level spin system, which was prepared in a state of superposition.

Gnuplot code

#!/usr/bin/env gnuplot

set terminal tikz standalone
set output "entropy.tex"

unset key
set grid
set xrange [0:1]
set samples 1000
set title 'Von Neumann entropy'
set xlabel '$\lambda$'
set ylabel '$S(\lambda)$'

plot -( 1./2. * (1 + sqrt(1-2*x+2*x**2)) *      log( 1./2. * (1 + sqrt(1-2*x+2*x**2)) )         +       1./2. * (1 - sqrt(1-2*x+2*x**2)) *      log( 1./2. * (1 - sqrt(1-2*x+2*x**2)) ) )

LaTeX Output

Compile the produced entropy.tex using pdflatex. You now get the correct LaTeX fonts.

enter image description here


I have been using this python script, which is very easy to use. https://github.com/oso/tikz2pdf

I think the README explains most of the part. Say if you have a tikz file myfig.tikz, you just type in terminal

tikz2pdf myfig.tikz

and a pdf file myfig.pdf will be generated in the same folder. If you want to have the pdf updated once the tikz file is modified, you can use this command:

tikz2pdf -ws myfig.tikz

I only need to change the default viewer to open to use it on a mac, and on a linux machine you can put an alias in your .bashrc

alias open=xdg-open

and you are good to go.

  • 1
    Link-only answers are not that helpful. Could you provide more detail in terms of the interface, how one would use it, and perhaps show an example?
    – Werner
    Commented Oct 30, 2013 at 1:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .