TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using gnuplot with terminal epslatex in order to plot graphs containing LaTeX labels.

In particular I've got something like this on Y tics:

$\\frac{ L_{seq} }{ 8 }$

Everything works, but the output graph has a lot of white space between the Y axis label and the Y tics.

I guess that's because gnuplot parses $\\frac{ L_{seq} }{ 8 }$ as a normal string and reserves space for it, but the resulting string (after pdflatex renders it) will actually be shorter.

Any way to solve this?

share|improve this question
There are much more elegant ways of getting datasets plotted. Take a look at »pgfplots« or »pst-plot«. – Thorsten Donig Dec 8 '10 at 17:05
@Martin: Is the double backslash really correct? – Hendrik Vogt Feb 7 '11 at 17:47
@Hendrik: Yes, the backslash needs to be escaped in Gnuplot. – Jake Feb 7 '11 at 18:01
up vote 3 down vote accepted

In my experience it's best to let graphics programs such as gnuplot use their own (non LaTeX) labels, and then replace these using psfrag. psfrag allows you to align the left/right/centre of the object to be replaced with the left/right/centre of the replacement. So, in gnuplot try

set term postscript eps mono
set output 'myplot.eps'
set ylabel 'Y'
plot x**3

and then in your document



share|improve this answer

Use next code to make two tics on Y axis. It works correctly.

set label "$U_{in}$" right at graph 0, first 3.4 offset character -1,0
set ytics add ("" 3.4)
set ytics add ("" 3.4/sqrt(2))
set label "$\\frac{U_{in}}{\\sqrt{2}}$"right  at graph 0, first 3.4/sqrt(2) offset character -1,0
share|improve this answer

This answer is not directly related to LaTeX, rather it's an ugly workaround from the gnuplot's side. When I used epslatex terminal of gnuplot and I had this problem I "solved" adding an offset to the axis label like this:

set ylabel 'axis label' offset 2,0

where the x offset (the number 2 in the example) is found by trial and error.

(As already noticed in a comment, there are more elegant alternatives to include plots in (La)TeX documents: personally I've switched to pgfplots.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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