# How to put a symbol inside a circle arrow?

I'm trying to draw a clockwise circle arrow with a symbol inside. My current solution requires manual alignment of the content, and as such doesn't look very good.

\makebox[0pt][l]{\huge$\circlearrowright$}\ $i_3$ }


Is there a solution which doesn't require manual correction? If not, is there a method to have more fine-grained control over the horizontal alignment, and any control at all over the vertical?

-
Related Question: Drawing a circle around a node that looks like an arrow. –  Peter Grill Nov 8 '14 at 21:49

Here is slightly automated solution using tikz. I measure the height and width of the text and place an arc whose size is based on the maximum of that. Am sure this can be improved, but this should get you started:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{calc}

\makeatletter
\newlength\@SizeOfCirc%
\newcommand{\CricArrowRight}[1]{%
\setlength{\@SizeOfCirc}{\maxof{\widthof{#1}}{\heightof{#1}}}%
\tikz [x=1.0ex,y=1.0ex,line width=.15ex, draw=blue]%
\draw [->,anchor=center]%
node (0,0) {#1}%
(0,1.2\@SizeOfCirc) arc (85:-240:1.2\@SizeOfCirc);%
}%
\makeatother

\begin{document}
\CricArrowRight{$i$}
\CricArrowRight{$i_3$}
\CricArrowRight{$\frac{a}{b}$}
\CricArrowRight{$\dfrac{a}{b}$}
\end{document}


I created a temporary length \@SizeOfCirc so as to minimize potential name conflicts, and need to use \maktatother. See What do \makeatletter and \makeatother do? for more info if you are not familiar with that.

-
Very flexible, and I learnt some TiKZ. Thanks! –  Tim N Sep 29 '11 at 3:15

This may be satisfying, if the symbol to put inside is not too big

\usepackage{relsize}
\newcommand\cca[1]{{%
\ooalign{\raisebox{-.4ex}{\larger[4]$\circlearrowright$}\cr
\hidewidth$\,#1$\hidewidth}}}


Then \cca{i_{3}} should do what you need.

Look at Subseteq+circ as a single symbol "open subset" for details about \ooalign.

-

Here is manual way of doing it that allows some freedom in terms of fine-tuning the vertical movement:

\documentclass{article}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\begin{document}
\setbox1=\hbox{\huge$\circlearrowright$}%
\setbox2=\hbox{$i_3$}%
\makebox[0pt][c]{\usebox1}% Place \circlearrowright
\makebox[0pt][c]{\raisebox{2.5pt}{$i_3$}}% Overlay label
\hspace{0.5\wd1} Here is some more text.
\end{document}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​


The zero-width \makeboxes have their contents centered [c]. Both elements are placed stored in a box (box1 and box2 respectively) so that you can use their widths (\wd1 and \wd2) or heights (\ht1 and \ht2) if needed.

-