Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm having an issue with pgfplots/tikz when trying to change the font size for legends/nodes. Any command that contains "font=\size" fails (for example, "font=\small") with the error "Undefined control sequence \end{axis}".

Here is a MWE.

\documentclass[]{minimal}

\usepackage{paralist,pst-func, pst-plot, pst-math, pstricks-add,pgfplots}
\usetikzlibrary{patterns,matrix,arrows}
\pgfplotsset{compat=1.9}

\begin{document}

\begin{tikzpicture}
%\tikzstyle{every node}=[font=\small] % throws "Undefined control sequence \end{axis}"
\begin{axis}
%[legend style={font=\tiny}] % throws "Undefined control sequence \end{axis}"
\addplot[blue, ultra thick] (x,x*x);
\addlegendentry{ Class 1};
\end{axis}
\end{tikzpicture}
\end{document}
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

You are using minimal document class where font size commands will not be available (Refer this answer). Use some other class and things work:

\documentclass[]{standalone}

\usepackage{paralist,pst-func, pst-plot, pst-math, pstricks-add,pgfplots}
\usetikzlibrary{patterns,matrix,arrows}
\pgfplotsset{compat=1.9}

\begin{document}

\begin{tikzpicture}
\begin{axis}
[legend style={font=\tiny}] % works
\addplot[blue, ultra thick] (x,x*x);
\addlegendentry{ Class 1};
\end{axis}
\end{tikzpicture}
\end{document} 

enter image description here

share|improve this answer
    
Thanks, that was it; sorry, but the error message was truly unhelpful. –  facuq Nov 28 '13 at 3:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.