I am a begineer in LaTex and absoulte novice in gnuplot. I am using Texstudio and Windows 8.1. The problem is - I cannot make LaTex display a simple image. Probably some settings issue. In paricular, I took the simplest gnuplot code from the web (with slight adjustment):

This is the gnuplot code for my graph:

set key inside left top vertical Right noreverse enhanced autotitles box linetype -1 linewidth 1.000
set samples 50, 50
plot [-10:10] sin(x),atan(x),cos(atan(x))
set term pslatex auxfile
set output 'proba1.tex'     

This is a file (test1.tex) that I get (besides ps file):

% GNUPLOT: LaTeX picture with Postscript
\special{psfile=proba1.ps llx=0 lly=0 urx=360 ury=252 rwi=3600}
\put(6839,200){\makebox(0,0){\strut{} 10}}%
\put(5324,200){\makebox(0,0){\strut{} 5}}%
\put(3809,200){\makebox(0,0){\strut{} 0}}%
\put(660,4799){\makebox(0,0)[r]{\strut{} 1.5}}%
\put(660,4066){\makebox(0,0)[r]{\strut{} 1}}%
\put(660,3333){\makebox(0,0)[r]{\strut{} 0.5}}%
\put(660,2599){\makebox(0,0)[r]{\strut{} 0}}%

This is LaTex text:

gnuplot test
\begin {figure}
\end {figure}

It might seems silly, but I am looking for the solution for days now, but no luck. Many thanks. Marko

  • 1
    Your file test1.tex is incomplete, i.e. missing lines from the end. Is that really what you get from gnuplot? – mvkorpel Jul 4 '14 at 14:42
  • 1
    With this setup you have to compile along latex+dvips+ps2pdf – egreg Jul 4 '14 at 14:46
  • Ok, I hate to answer questions with questions, but do you mind me asking why not set teminal latex? It saves you lots of headaches. – Pouya Jul 4 '14 at 15:16
  • I have a revolutionary (;-)) proposition: Why output gnuplot to LaTeX instead of eps or pdf directly? (Special cases, when special characters needed-> use latex terminal, otherwise postscript enhanced or pdf terminal) – user31729 Jul 4 '14 at 16:36
  • Hi, thank you for your comments are prompt asnwers. Few lines were missing, I added those now. But there are some weird characters there, in notepad++ those empty spaces shows as NUL. About latex+dvips+ps2pdf compiling, LaTex gives me errors (text line contains invalid characters) so I cannot proceed with dvips and ps2pdf. I also tried output to eps, but again LaTex gives me errors. – Marko Jul 4 '14 at 18:17

OK, thanks to you guys I managed to find a solution: first, gnuplot did create incomplete tex file, as mvkorpel noticed. I had to write unset output in gnuplot and then I got a complete tex file. According to gnuplot FAW, some output formats must be explicitly closed like this. After that I used latex+dvips+ps2pdf as egreg suggested. This solved the problem. Many thanks once more.

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.