[Tex/LaTex] Using GNUPlot inside Latex (TexStudio) for IEEE Tran

gnuplotieee-styleieeetranpdftex

I am trying to insert gnuplot inside my IEEE Tran paper (Platform is Windows). I am unable to do it correctly. Here is the code. The below give code is not working. No output is obtained. I am writing all the packages just in case they are required.

Code 1

\documentclass[conference]{IEEEtran}

\ifCLASSINFOpdf

\else
\fi
\usepackage[usenames,dvipsnames]{color}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.multipart}
\usepackage{subfig}
\usepackage{tabularx,tikz}
\usepackage{ifthen}

\usepackage[shell]{gnuplottex}
\hyphenation{op-tical net-works semi-conduc-tor}


\begin{document}

\title{Bare Demo of IEEEtran.cls for Conferences}

\maketitle

\IEEEpeerreviewmaketitle

\section{Introduction}
I wish you the best of success.

\begin{gnuplot}[terminal=pdf,terminaloptions={font ",10" linewidth 3}]
plot sin(x), cos(x)
\end{gnuplot}
\end{document}

I also used the below given code but the margins are way too wide for a conference. Please suggest solutions for it. I would be happy to get some feedback on how to use epslatex inside the latex. Kindly, advice me for IEEE Tran.

Code 2

gnuplot> set terminal latex
Terminal type set to 'latex'
Options are '(document specific font) norotate'
gnuplot> set output 'plot.tex'
gnuplot> plot x**2
gnuplot> unset output

Below given I wrote in a latex file :

\documentclass[conference]{IEEEtran}
\ifCLASSINFOpdf

\else
\fi
\usepackage[usenames,dvipsnames]{color}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.multipart}
\usepackage{subfig}
\usepackage{tabularx,tikz}
\usepackage{ifthen}

\usepackage[shell]{gnuplottex}
\hyphenation{op-tical net-works semi-conduc-tor}


\begin{document}

\title{Bare Demo of IEEEtran.cls for Conferences}

\maketitle

\IEEEpeerreviewmaketitle

\section{Introduction}
I wish you the best of success.
\input{plot.tex}
\end{document}

Best Answer

The reason why your code doesn't work are the characters e.g. in ’$\cos(x)$’. Replace them with ' and you get the desired output (so e.g. ’$\cos(x)$’ --> '$\cos(x)$' )

Besides that, the code works for me:

enter image description here

I'll update the manual in the next days, as the characters are shown wrong there, thank you!