I'm trying to define multiple cycle lists based on macro variables. The reason for this is that I need more than one list and I want to be able to change the appearance quickly while keeping the coherence.
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\newcommand{\var1}{solid, red, every mark/.append style={solid, fill=red}, mark=o}
\newcommand{\var2}{dashed, blue, every mark/.append style={solid, fill=blue}, mark=x}
\pgfplotscreateplotcyclelist{cycle1}{
\var1\\%
\var2\\%
}
\pgfplotscreateplotcyclelist{cycle2}{
\var1\\%
}
\begin{tikzpicture}
\begin{axis}[cycle list name = cycle1]
\addplot
coordinates
{
(0,0)
(10,5)
};
\addplot+[only marks,forget plot]
coordinates
{
(0,0)
(10,7)
};
\end{axis}
\end{tikzpicture}
\end{document}
This code-example fails with the message
! Undefined control sequence.
\pgfkeyscurrentkey ->\var1
It has probably got something to do with macro-expansion, so I tried \noexpand and \expandafter but none of them seem to work.