[Tex/LaTex] Gnuplot with latex and bash

epsepslatexgnuplot

I have created a bash script that accesses and plots data using gnuplot. For this i have had to use the $ variable bash symbol. How can I plot an eps file where i can had a hat or tilde with special characters in the xlabels and ylabels?

$\hat{x}/ \lambda_D$

my current terminal is

set terminal postscript eps enhanced color font 'Helvetica, 18'

Best Answer

I think, you are looking for the epslatex terminal. So begin your Gnuplot script with

set terminal epslatex
set output 'output.tex'

then you can use latex notation like

set xlabel '$\hat{x}/ \lambda_D$'

this should output a .eps file with the plot and and the .tex file where the plot is embedded and the labels are set. You can use it with \input{output} in your LaTeX file.

I am not sure how your bash script works, possibly you have to escape the $, i.e. \$.