1

I try to plot a line from the file "aLinePlot.tex" which is automatically generated via matlab2tikz:

% This file was created by matlab2tikz.
%
%The latest updates can be retrieved from
%  http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz
%where you can also make suggestions and rate matlab2tikz.
%
\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}%
\definecolor{mycolor2}{rgb}{0.85000,0.32500,0.09800}%
\definecolor{mycolor3}{rgb}{0.92900,0.69400,0.12500}%
%
\begin{tikzpicture}

\begin{axis}[%
width=0.951\fwidth,
height=0.75\fwidth,
at={(0\fwidth,0\fwidth)},
scale only axis,
xmin=1,
xmax=10,
xlabel style={font=\color{white!15!black}},
xlabel={xLabel},
ymin=-0.4,
ymax=1.5,
ylabel style={font=\color{white!15!black}},
ylabel={yLabel},
axis background/.style={fill=white},
xmajorgrids,
ymajorgrids,
legend style={at={(0.03,0.97)}, anchor=north west, legend cell align=left, align=left, legend plot pos=left, draw=black}
]
\addplot [color=black, line width=1.0pt, mark=o, mark options={solid, black}]
  table[row sep=crcr]{%
1   0.05\\
2   0.1\\
3   0.15\\
4   0.2\\
5   0.25\\
6   0.3\\
7   0.35\\
8   0.4\\
9   0.45\\
10  0.5\\
};
\addlegendentry{legend1}

\end{axis}
\end{tikzpicture}%

With the following minimal Example I get the error "Undefined control sequence. \end{axis}

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}

\usepackage{pgfplots}
\pgfplotsset{every axis/.append style={
        label style={font=\footnotesize },
        label style={font=\footnotesize },
        tick label style={font=\footnotesize},  
        legend style={font=\miniscule},                     
}}

\usepackage{tikz}
\pgfplotsset{compat=newest}
\pgfplotsset{plot coordinates/math parser=false}
\newlength\fwidth
\newlength\fheight % not used in this example

\begin{document}

    \begin{figure}[htb]
        \begin{center}
            \setlength{\fwidth}{.7\linewidth} 
            \input{aLinePlot.tex}
            \label{fig:someLabel}
            \caption{some Caption}
        \end{center}
    \end{figure}

\end{document}

As i am not really familiar with tikz, can someone give me a hint how to solve this problem? Btw: Compiler is PdfLatex on a linux machine

  • 1
    the problem is the line : legend style={font=\miniscule} I commented out that line and your code compiles fine on my debian/GNU Linux with pdflatex (using version pdftex 3.14159265-2.6-1.40.17) – koleygr Dec 6 '17 at 9:11
  • I also searched for that command and found that is available in memoir documentclass but not in article... Tested and work within memoir – koleygr Dec 6 '17 at 9:22
1

Your editor doesn't help you when it parses the .log file, the error says

! Undefined control sequence.
\tikz@textfont ->\miniscule 

l.73 \end{axis}

? 

which means that \miniscule is the undefined control sequence.

\miniscule is a font size switch that isn't defined in the standard classes, but it is defined in the memoir class. So either change the documentclass to memoir, or modify

legend style={font=\miniscule}

to for example

legend style={font=\tiny}

Working code:

\documentclass[10pt,a4paper]{memoir} % <-- changed article to memoir
\usepackage[latin1]{inputenc}

\usepackage{pgfplots}
\pgfplotsset{every axis/.append style={
        label style={font=\footnotesize },
        label style={font=\footnotesize },
        tick label style={font=\footnotesize},  
        legend style={font=\miniscule},                     
}}

\usepackage{tikz}
\pgfplotsset{compat=newest}
\pgfplotsset{plot coordinates/math parser=false}
\newlength\fwidth
\newlength\fheight % not used in this example

\begin{document}

    \begin{figure}[htb]
        \begin{center}
            \setlength{\fwidth}{.7\linewidth} 
% This file was created by matlab2tikz.
%
%The latest updates can be retrieved from
%  http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz
%where you can also make suggestions and rate matlab2tikz.
%
\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}%
\definecolor{mycolor2}{rgb}{0.85000,0.32500,0.09800}%
\definecolor{mycolor3}{rgb}{0.92900,0.69400,0.12500}%
%
\begin{tikzpicture}

\begin{axis}[%
width=0.951\fwidth,
height=0.75\fwidth,
at={(0\fwidth,0\fwidth)},
scale only axis,
xmin=1,
xmax=10,
xlabel style={font=\color{white!15!black}},
xlabel={xLabel},
ymin=-0.4,
ymax=1.5,
ylabel style={font=\color{white!15!black}},
ylabel={yLabel},
axis background/.style={fill=white},
xmajorgrids,
ymajorgrids,
legend style={at={(0.03,0.97)}, anchor=north west, legend cell align=left, align=left, legend plot pos=left, draw=black}
]
\addplot [color=black, line width=1.0pt, mark=o, mark options={solid, black}]
  table[row sep=crcr]{%
1   0.05\\
2   0.1\\
3   0.15\\
4   0.2\\
5   0.25\\
6   0.3\\
7   0.35\\
8   0.4\\
9   0.45\\
10  0.5\\
};
\addlegendentry{legend1}

\end{axis}
\end{tikzpicture}%
            \label{fig:someLabel}
            \caption{some Caption}
        \end{center}
    \end{figure}

\end{document}

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.