[Tex/LaTex] Problems with including a tikz tex file generated by Octave (MatLab clone)

MATLABoctaveplottikz-pgf

I have plotted a figure in Octave and printed it as a TikZ figure (see the device option) to a tex file called comparison_tikz.tex, and I have imported it into my document with the line

\input{comparison_tikz.tex}

I have also included the tikz package in the preamble of my document. However, when I try to compile the document, I get the following errors:

line 17   Use of \tikz@parse@cs@xy polar doesn't match its definition ...gb]{0,0,0}{{25}}}{}{\pgfusepath{discard}}}
line 17   Extra }, or forgotten \endgroup ...gb]{0,0,0}{{25}}}{}{\pgfusepath{discard}}}
line 0    Missing control sequence inserted

I tried to google it but I couldn't find anything about the error. I see that it complains about something with polar coordinates, but the plot I've made doesn't use polar coordinates.

When I double click on any of the error messages, it takes me to line 17 in the generated file (which looks almost exactly like other lines in the file). Anyway, here is the beginning of the file:

% Title: glps_renderer figure
% Creator: GL2PS 1.3.6, (C) 1999-2011 C. Geuzaine
% For: Octave
% CreationDate: Wed Jun 13 08:48:06 2012
\begin{pgfpicture}
{
\pgftransformshift{\pgfpoint{246.399994pt}{73.195633pt}}
\pgfnode{rectangle}{north}{\fontsize{10}{0}\selectfont\textcolor[rgb]{0,0,0}{{10}}}{}{\pgfusepath{discard}}}
{
\pgftransformshift{\pgfpoint{333.199982pt}{73.195633pt}}
\pgfnode{rectangle}{north}{\fontsize{10}{0}\selectfont\textcolor[rgb]{0,0,0}{{15}}}{}{\pgfusepath{discard}}}
{
\pgftransformshift{\pgfpoint{419.999969pt}{73.195633pt}}
\pgfnode{rectangle}{north}{\fontsize{10}{0}\selectfont\textcolor[rgb]{0,0,0}{{20}}}{}{\pgfusepath{discard}}}
{
\pgftransformshift{\pgfpoint{506.799957pt}{73.195633pt}}
\pgfnode{rectangle}{north}{\fontsize{10}{0}\selectfont\textcolor[rgb]{0,0,0}{{25}}}{}{\pgfusepath{discard}}} % This is the line causing the error
{
\pgftransformshift{\pgfpoint{67.799995pt}{78.200020pt}}
\pgfnode{rectangle}{east}{\fontsize{10}{0}\selectfont\textcolor[rgb]{0,0,0}{{0}}}{}{\pgfusepath{discard}}}
{

If I print the plot as a tex figure instead and try to include that it also gives me an error when I try to compile the document; the generated tex file then looks like

% Title: glps_renderer figure
% Creator: GL2PS 1.3.6, (C) 1999-2011 C. Geuzaine
% For: Octave
% CreationDate: Wed Jun 13 08:48:05 2012
\setlength{\unitlength}{1pt}
\begin{picture}(0,0)
\includegraphics{}
\end{picture}% This is the line causing the error
\begin{picture}(576,412)(0,0)
\fontsize{10}{0}
\selectfont\put(246.4,33.1956){\makebox(0,0)[t]{\textcolor[rgb]{0,0,0}{{10}}}}
\fontsize{10}{0}
\selectfont\put(333.2,33.1956){\makebox(0,0)[t]{\textcolor[rgb]{0,0,0}{{15}}}}
\fontsize{10}{0}
\selectfont\put(420,33.1956){\makebox(0,0)[t]{\textcolor[rgb]{0,0,0}{{20}}}}
\fontsize{10}{0}
\selectfont\put(506.8,33.1956){\makebox(0,0)[t]{\textcolor[rgb]{0,0,0}{{25}}}}
\fontsize{10}{0}
\selectfont\put(67.8,38.2){\makebox(0,0)[r]{\textcolor[rgb]{0,0,0}{{0}}}}
\fontsize{10}{0}
\selectfont\put(67.8,95.25){\makebox(0,0)[r]{\textcolor[rgb]{0,0,0}{{0.005}}}}
\fontsize{10}{0}
\selectfont\put(72.8,33.1956){\makebox(0,0)[t]{\textcolor[rgb]{0,0,0}{{0}}}}
\fontsize{10}{0}
\selectfont\put(159.6,33.1956){\makebox(0,0)[t]{\textcolor[rgb]{0,0,0}{{5}}}}
\fontsize{10}{0}
\selectfont\put(67.8,152.3){\makebox(0,0)[r]{\textcolor[rgb]{0,0,0}{{0.01}}}}
\fontsize{10}{0}
\selectfont\put(67.8,209.35){\makebox(0,0)[r]{\textcolor[rgb]{0,0,0}{{0.015}}}}
\fontsize{10}{0}
\selectfont\put(67.8,266.4){\makebox(0,0)[r]{\textcolor[rgb]{0,0,0}{{0.02}}}}
\fontsize{10}{0}
\selectfont\put(67.8,323.45){\makebox(0,0)[r]{\textcolor[rgb]{0,0,0}{{0.025}}}}
\fontsize{10}{0}
\selectfont\put(67.8,380.5){\makebox(0,0)[r]{\textcolor[rgb]{0,0,0}{{0.03}}}}
\end{picture}

The error message reads

line 0    File `' not found.

and when I double click on the message it takes me to line 8 in the generated file.

What is it about these files that LaTeX doesn't like? I think they should work properly since it is Octave that has generated them. Do I need to set up my document in some certain way in order to be able to use the files?

Edit 1 (Solved): Here is a minimal (not) working example for the tex figure:

\documentclass[]{report}
\begin{document}

\input{comparison.tex}

\end{document}

where comparison.tex is the latter of the two generated tex files included above. This gives me the compilation error

line 11   Undefined control sequence ...box(0,0)[t]{\textcolor[rgb]{0,0,0}{{10}}}}
line 13   Undefined control sequence ...box(0,0)[t]{\textcolor[rgb]{0,0,0}{{15}}}}

and so on for the lines 11, 13, 15, … 35 in comparison.tex. It highlights the \put and the \makebox macros in the code.

Edit 2: And here is a minimal (not) working example for the TikZ figure:

\documentclass[]{report}
\usepackage{tikz,graphicx,color}
\begin{document}

\input{comparison_tikz.tex}

\end{document}

where comparison_tikz.tex is the former of the two generated tex files included above. This gives me the compilation error

line 17   Use of \tikz@parse@cs@xy polar doesn't match its definition ...gb]{0,0,0}{{25}}}{}{\pgfusepath{discard}}}
line 17   Extra }, or forgotten \endgroup ...gb]{0,0,0}{{25}}}{}{\pgfusepath{discard}}}
line 0    Missing control sequence inserted
line 0    \begin{pgfpicture} on input line 5 ended by \end{document}.

Best Answer

Your MWE uses commands from the graphicx and color packages but does not load them so produces errors about undefined commands. So it needs to be

\documentclass[]{report}
\usepackage{graphicx,color}
\begin{document}

\input{comparison.tex} % Uses commands from the graphicx and color packages

\end{document}

Then line 7 of the included file is

 \includegraphics{}

which is nonsense, including a graphic without specifying a file name, so you get an error about a missing file.

If you change that to

%\includegraphics{}

It runs without error.