Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

What is the proper code for this red arrow underneath?

share|improve this question
1  
Have you checked the Comprehensive LaTeX symbols list? You will find some arrows when searching for \curve in several packages; for example \curvearrowbotleft in the mathabx package. If you actually want to use TikZ (why the tag?) we had a question about some little arrows … –  Qrrbrbirlbel Feb 9 '13 at 12:20
    
Welcome to TeX.SE. One possibility would be to adapt the solution from How to draw arrows from cell to cell at the borders of a table. –  Peter Grill Feb 9 '13 at 20:13

2 Answers 2

up vote 10 down vote accepted

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

share|improve this answer
    
+1 very nice and shows that TikZ isn't everything! –  tohecz Feb 10 '13 at 22:40

Here is an option adapted form How to draw arrows from cell to cell at the borders of a table. The results are not quite as good as I had hoped due to the small amount of space available. Perhaps more tweaking on the setting will yield better results. One tweak that can be done is to change the line and arrow style when drawing between subsequent digits as I have done for the first case below by setting:

\tikzset{BottomArrowStyle/.style={thin, -stealth}}

If you can alter the location to above and below the digits, or span multiple digits then this is more useful as the last two images illustrate:

enter image description here

Note:

Code:

\documentclass{article} 

\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{calc}


%% Set these if you want to globally atler the arrow styles
%% for the top and bottom arrows.
\tikzset{TopArrowStyle/.style={}}
\tikzset{BottomArrowStyle/.style={}}


\newcommand{\tikzmark}[2]{%
    \tikz[overlay,remember picture,baseline] \node [anchor=base] (#1) {\phantom{#2}};#2% <-- important
}

\newcommand*{\XShift}{0.5ex}
\newcommand*{\ArcDistance}{0.075cm}
\newcommand*{\OutAngle}{}
\newcommand*{\InAngle}{}
\newcommand*{\AnchorPoint}{}
\newcommand*{\ShortenBegin}{}
\newcommand*{\ShortenEnd}{}
%
\NewDocumentCommand{\DrawArrow}{s O{} m m}{%
    \IfBooleanTF {#1} {% starred variant - draw arrows below
        \renewcommand*{\OutAngle}{-95}%
        \renewcommand*{\InAngle}{-85}%
        \renewcommand*{\AnchorPoint}{south}%
        \renewcommand*{\ShortenBegin}{-3.5pt}%
        \renewcommand*{\ShortenEnd}{-3.5pt}%
        \tikzset{Arrow Style/.style={BottomArrowStyle}}% <-- important
    }{% non-starred - draw arrows above
        \renewcommand*{\OutAngle}{95}%
        \renewcommand*{\InAngle}{85}%
        \renewcommand*{\AnchorPoint}{north}%
        \renewcommand*{\ShortenBegin}{-3.5pt}%
        \renewcommand*{\ShortenEnd}{-3.5pt}%
        \tikzset{Arrow Style/.style={TopArrowStyle}}% <-- important
    }%
    \begin{tikzpicture}[overlay,remember picture]
        \draw[
                ->, thick, distance=\ArcDistance,
                shorten <=\ShortenBegin, shorten >=\ShortenEnd,
                out=\OutAngle, in=\InAngle, Arrow Style, #2
            ] 
                ($(#3.\AnchorPoint)+(2.0*\XShift,0)$) to 
                ($(#4.\AnchorPoint)+(0.4*\XShift,0)$);
    \end{tikzpicture}% <-- important
}

\begin{document}
\tikzset{BottomArrowStyle/.style={thin, -stealth}}%
10.\tikzmark{Three}{5}\tikzmark{Two}{6}\tikzmark{One}{6}%
\DrawArrow*[red]{One}{One}%
\DrawArrow*[brown]{Two}{Two}%
\DrawArrow*[blue]{Three}{Three}%
\tikzset{BottomArrowStyle/.style={}}% restore to default

\bigskip
10.\tikzmark{ThreeB}{5}\tikzmark{TwoB}{6}\tikzmark{OneB}{6}%
\DrawArrow*[red]{OneB}{OneB}%
\DrawArrow[brown]{TwoB}{TwoB}%
\DrawArrow*[blue]{ThreeB}{ThreeB}%

\bigskip
10.\tikzmark{Three}{5}\tikzmark{Two}{6}\tikzmark{One}{6}%
\DrawArrow*[red,in=-85, out=-95, distance=0.2cm]{One}{Three}%
\end{document}
share|improve this answer
    
tikzmark like a boss. Great. –  percusse Feb 9 '13 at 23:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.