[Tex/LaTex] gnuplot within LaTeX using epslatex terminal and pdflatex for compiling

epslatexgnuplot

I am encountering problems of implementing gnuplot images in my TeX document. I can actually create a gnuplot image (.tex and .eps file) interactively (separately) and use \input{image} to implement in my document but this is very inconvenient.

I hope one of you would have a look on the code and tell me what's the craic.
I am using gnuplot 4.6 patch 4. Latest TeX version, running Ubuntu 14.04 LTE.

\documentclass 
[fontsize=12pt,twoside,BCOR17mm,DIV15,headinclude,bibliog
raphy=totoc, captions=tableheading,pdftex,parskip=half,openright, 
cleardoublepage=empty]{scrbook} 

\usepackage{color}                  % manage foreground/background color, works with graphics package
\usepackage{amsmath}                % Mathematikbefehle
\usepackage{amssymb}                % Unter anderem schöne Mengensymbole
%\usepackage[amssymb]{SIunits}      % Einheiten per Befehl einfügen
\usepackage[numbers]{natbib}                                        
\usepackage[pdftitle={Diplomarbeit John - Robert Scholz}, pdfauthor={John - Robert Scholz}, bookmarks=true, pdfborder={0 0 0}]{hyperref}        % klickbare verlinkungen im dokument
\usepackage[all]{hypcap}            
\usepackage[utf8]{inputenc}         % translates encoding into latex language
\usepackage[T1]{fontenc}            % al­lows the user to se­lect font en­cod­ings
\usepackage[ngerman, english]{babel}
\usepackage{siunitx,booktabs}
\sisetup{range-phrase=--}           % Deutsch --> option: [locale=DE], händelt auch alle andere Pakte dazu
\usepackage[babel,german=quotes]{csquotes}  % csquotes einbinden; hauptsächlich um Anführungszeichen in Bibliographie anzupassen
\numberwithin{table}{section}       % Formel-, bilder- und Tabellennummer mit section.nummer
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\usepackage{graphicx}               % Grafiken einfügen
\usepackage{epstopdf}               % verwandelt .eps to .pdf on the fly
\usepackage[labelformat=parens,labelfont=normalfont]{subcaption} %Teilbilder
\usepackage{placeins}               % Barieren für figures
%\usepackage{subfigure}             % Teilbilder erzeugen
\usepackage[format=plain, font=small, labelfont=bf,justification=RaggedRight,width=\textwidth]{caption} 
        % ex­tended im­ple­men­ta­tion of the ar­ray and tab­u­lar en­vi­ron­ments
\usepackage{caption}                % customize caption in floating enviroments
\usepackage{tabularx}               
%\usepackage{gnuplottex}            
\usepackage[miktex]{gnuplottex}     
\usepackage{tocstyle}

...

\begin{figure}\centering
\begin{gnuplot}[terminal=epslatex,terminaloptions=color,scale=1] 
    f(x)= x**2
    plot f(x) title "Fitfunktion"
\end{gnuplot} 
\caption[..]{..}
\label{..}
\end{figure}

All I get is the actual caption in my document but nothing else, like as the picture itself would miss. I compiled with:

pdflatex --shell-escape document.tex ; pdflatex -shell-escape document.tex ; pdflatex document.tex

Nothing worked. All I got was the terminal warning as follows:

Package gnuplottex Warning: Shell escape not enabled.
(gnuplottex) You'll need to convert the graphs yourself.

[18] Opening gnuplot stream diplomarbeit-gnuplottex-fig1.gnuplot
Package gnuplottex Warning: Please convert diplomarbeit-gnuplottex-fig1.gnuplot manually.

LaTeX Warning: Characters dropped after `\end{gnuplot}' on input line 339.

I'd appreciate your help and hope you forgive me my package chaos.

Best Answer

Load each package once only, and don't give the [miktex] option to the gnuplottex pacakge unless you really are using MiKTeX.