Following an example offered here, I want to insert colored, circled numbers referring to items in a figure (figure details left as an exercise to the reader) into my text. The numbers are defined like this:
\definecolor{highlightcolor}{RGB}{241,90,36}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,fill=highlightcolor,inner sep=2pt] (char) {\textcolor{white}#1};}}
which I refer to in my text as \circled{1}, \circled{2}, etc. Works like a charm. The problem occurs when I try to add this command inside a figure \caption{}. LateX complains bitterly, accusing me of this, among other unprintable things:
main.tex:121 Use of \tikz@picture doesn't match its definition.
\pgfutil@ifnextchar ...1\def \pgfutil@reserved@a {
#2}\def \pgfutil@reserved@...
l.121 ... indicator; 7: currently-selected page. }
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
What am I doing wrong?
\caption{\protect\circled{1}}. – Gonzalo Medina Jun 10 '13 at 05:21