Why does the following code give me this error message?
Error
ERROR: Undefined control sequence.
--- TeX said --- \pgfmath@dimen@ ...men@@ #1=0.0pt\relax \pgfmath@
l.28 \draw (\getWickersonLeft{c},0) -- (\getWickersonRight{c},5);
Code
\documentclass{article}
\usepackage{tikz}
\pgfkeys{/wickersons/.cd,
execute style/.style={#1},
execute macro/.style={execute style/.expand once=#1},
left/.code={\gdef\wickersonsleft{#1}},
right/.code={\gdef\wickersonsright{#1}}
}
\def\getWickersonLeft#1{\csname wickerson#1left\endcsname}
\def\getWickersonRight#1{\csname wickerson#1right\endcsname}
\newcommand*\defWickersonMacros[3]{%
\expandafter\edef\csname wickerson#1left\endcsname{#2}
\expandafter\edef\csname wickerson#1right\endcsname{#3}
}
\begin{document}
\begin{tikzpicture}[x=1mm,y=-1mm]%
\foreach \x/\xvalue in {c/{left=67,right=77}} {
\pgfkeys{/wickersons/.cd, execute macro=\xvalue}
\expandafter\defWickersonMacros{c}{\wickersonsleft}{\wickersonsright}
}
\draw (\getWickersonLeft{c},0) -- (\getWickersonRight{c},5);
\end{tikzpicture}
\end{document}


\defWickersonMacrosneeds\xdefs here … (by the way,\csnamewill expand everything it will encounter so you don't need to expand\xfor it which I guess the lonely\expandafterin the loop is a remainder of). – Qrrbrbirlbel May 14 '13 at 20:01\expandafter\defWickersonMacros{expands{which isn't expandable. – David Carlisle May 14 '13 at 20:08