[Tex/LaTex] Getting arrows underneath numbers

arrowstikz-pgf

I want to draw curved arrows underneath my numbers, does anyone know how to do this? I've tried the command \curvearrowleft but TeX doesn't recognize that line, either because I don't have the package or the command doesn't exist.

http://www.math.com/school/subject1/images/S1U1L5GL.gif
(source: leslienettling.com)

What is the proper code for this red arrow underneath?

Best Answer

One possibility is the \curvearrowbotleft mentioned by Qrrbrbirlbel along with the accents package:

\documentclass{minimal}
\usepackage{mathabx}
\usepackage{accents}
\usepackage{xcolor}
\newcommand*{\uarr}[1]{\underaccent{\color{red}\curvearrowbotleft}{#1}}
\begin{document}
$\uarr{7}$.
$10.\uarr{5}\uarr{5}\uarr{6}$.
\end{document}

Arrows under numbers

Here is a version with more visible arrow heads and less overlap with adjacent arrows, at the cost of more complication and a somewhat goofy-looking arrow head.

\documentclass{amsart}
\usepackage{mathabx}  % for \curvearrowbotleft
\usepackage{accents}  % for \underaccent
\usepackage{xcolor}   % for \color
\usepackage{graphicx} % for \resizebox
\usepackage{calc}     % for \widthof
\usepackage{bm}       % for \bm (bold symbol)
\newcommand*{\uarr}[1]{\underaccent{\resizebox{\widthof{#1}}{\height}{$\color{red}\bm{\curvearrowbotleft}$}}{#1}}

\begin{document}
$\uarr{7}$.
$10.\uarr{5}\uarr{5}\uarr{6}$.
\end{document}

enter image description here

The command must be used in math mode (since \underaccent is math-only), but has $ inside since \resizebox leaves math mode.

Edit: Originally, I had \widthof{0} in the above definition. This allowed the arrows to fit different font sizes and fonts, like so: arrows under different size numbers This depends on the fact that all digits are the same width, which is true in most math fonts but not all. I realized that simply changing it to \widthof{#1} would not only take care of the case of different-width digits, but allow putting arrows under more than one digit. For instance, $\uarr{00}$. $\uarr{007}$. would have originally given small arrows centered under digits, but now gives arrows stretched under multiple digits