The Gnuplot output terminal 'epslatex' generates two output files, one .eps with the actual plot and one file .tex with the text in Latex format. To include the file use \input{filename.tex}
\documentclass[11pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{epstopdf}
\begin{document}
\begin{figure}
\input{test.tex}
\end{figure}
\end{document}
Output
Source
{
int N = 512;
vec x(N), y(N);
x = linspace(-5, 5, N);
y = exp(-(x - 1) % (x - 1) / datum::pi);
gp.
label(-4, 0.5,
" $f(x)=e^{-\\\\frac{(x-1)^2}{\\\\pi}} $");
return 0;
}