6

I used the code http://www.texample.net/tikz/examples/circular-arrows-text/ and modified it a little bit. The text below is HI and it works fine. When I change HI to $\pi$, the typesetting does not finish. Any suggestions?

MWE

\documentclass[tikz,border=10pt]{standalone}
\usepackage{amssymb} 
\usetikzlibrary{decorations.text} 
\newcommand*{\mytextstyle}{\Large\bfseries\color{black!85}} 
\newcommand{\arcarrow}[8]{% 
% inner radius, middle radius, outer radius, start angle, 
% end angle, tip protusion angle, options, text   
\pgfmathsetmacro{\rin}{#1}
\pgfmathsetmacro{\rmid}{#2}   
\pgfmathsetmacro{\rout}{#3}
\pgfmathsetmacro{\astart}{#4}   
\pgfmathsetmacro{\aend}{#5}
\pgfmathsetmacro{\atip}{#6}   
\fill[#7] (\astart:\rin) arc (\astart:\aend:\rin)
       -- (\aend+\atip:\rmid) 
       -- (\aend:\rout) arc (\aend:\astart:\rout)
       -- (\astart+\atip:\rmid) -- cycle;
\path[decoration = {text along path, text = {|\mytextstyle|#8},
    text align = {align = center}, raise = -0.5ex}, decorate]
    (\astart+\atip:\rmid) arc (\astart+\atip:\aend+\atip:\rmid); 
}

\begin{document}

\begin{tikzpicture}   \fill[even odd rule,red!30] circle (3.8) circle (3.2);
    \arcarrow{3}{3.5}{4}{-30}{30}{5}{red,   draw = red!50!black, very thick}{HI} 
\end{tikzpicture} 
\end{document}
Alan Munn
  • 218,180
Mark S.
  • 561

1 Answers1

6

Just enclose your text in an additional set of braces ({}) and it will work:

\documentclass[tikz,border=10pt]{standalone}
\usepackage{amssymb} 
\usetikzlibrary{decorations.text} 
\newcommand*{\mytextstyle}{\Large\bfseries\color{black!85}} 
\newcommand{\arcarrow}[8]{% 
% inner radius, middle radius, outer radius, start angle, 
% end angle, tip protusion angle, options, text   
\pgfmathsetmacro{\rin}{#1}
\pgfmathsetmacro{\rmid}{#2}   
\pgfmathsetmacro{\rout}{#3}
\pgfmathsetmacro{\astart}{#4}   
\pgfmathsetmacro{\aend}{#5}
\pgfmathsetmacro{\atip}{#6}   
\fill[#7] (\astart:\rin) arc (\astart:\aend:\rin)
       -- (\aend+\atip:\rmid) 
       -- (\aend:\rout) arc (\aend:\astart:\rout)
       -- (\astart+\atip:\rmid) -- cycle;
\path[decoration = {text along path, text = {|\mytextstyle|#8},
    text align = {align = center}, raise = -0.5ex}, decorate]
    (\astart+\atip:\rmid) arc (\astart+\atip:\aend+\atip:\rmid); 
}

\begin{document}

\begin{tikzpicture}   \fill[even odd rule,red!30] circle (3.8) circle (3.2);
    \arcarrow{3}{3.5}{4}{-30}{30}{5}{red,   draw = red!50!black, very thick}{{$\pi$}}
%                                    another set of braces                   ^     ^
\end{tikzpicture} 
\end{document}

enter image description here

Zarko
  • 296,517