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}

^is a command to be used in math mode. If you provided a minimal version of the code that fails, we could answer more definitively, buttext^{anything}will fail irrespective oftikz, if it is not already in math mode. Maybe trytext\textsuperscript{\circled{1}}– Steven B. Segletes Jun 30 '16 at 18:01$text^{\circled{1}}$– Cfun Jun 30 '16 at 18:02text&$text$will produce different output (the former roman, the latter italic and spaced oddly). Your suggestion would make the "text" italic, whereas the context of the question makes it seem as if "text" should be roman. – Steven B. Segletes Jun 30 '16 at 18:06$\text{text}^{\circled{1}}$– Cfun Jun 30 '16 at 18:07text$^{\circled{1}}$– Steven B. Segletes Jun 30 '16 at 18:09amsmath\textis defined in that package. – Cfun Jun 30 '16 at 18:17