I'm using TikZ to create some circles with numbers as some sort of marker. But I want to use them as superscript.
So to generate a circle I'm using this command (suggested here: Good way to make \textcircled numbers?):
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,fill=blue!20,draw,inner sep=0.5pt] (char) {#1};}}
To use it within the text (as superscript) I'm using:
text^{\circled{1}}
However I get the following error:
> Description Resource Path Location Type Missing $ inserted. ... & 24 &
> 8 & 32^{\circleds{3}} & (followed by: 0 & 24 & 8
> \\) doc.tex /doc line 287 Texlipse Build Error
Any suggestions of why is that?
Here is an small code example.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,fill=blue!20,draw,inner sep=0.5pt] (char) {#1};}}
\begin{document}
This works: \circled{3}. But this^{\circled{1}} is no good.
\end{document}
Best Answer
As discussed in numerous comments, the underlying problem was that
^
was invoked in text, not math mode. Here are two possibilities, depending on how you want it to behave.