I would like to use a macro to define the label of an extra tick in a pgfplots picture. When the macro uses a greek character it generates an error:
! Missing \endcsname inserted.
Here is my MWE:
\documentclass{article}
\usepackage{pgfplots}
\newcommand{\extraticksmwe}{%
extra y ticks={.5}, extra y tick labels={$\alpha$}%
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ytick={0},
\extraticksmwe
]
\addplot[]{ .5 };
\end{axis}
\end{tikzpicture}
\end{document}
Note that if I do not use a greek character, e.g. using $a$ instead of $\alpha$, the same code above does not generate an error. Similarly, if I do not use a macro at all, it does not generate an error, so the following code works fine:
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ytick={0},
extra y ticks={.5}, extra y tick labels={$\alpha$}%
]
\addplot[]{ .5 };
\end{axis}
\end{tikzpicture}
\end{document}
extraticksmwe/.style={...}and call that key instead of the macro. – percusse Jun 07 '13 at 10:11