12

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?

2

2 Answers 2

10

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

0
9

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}
1
  • tikzmark like a boss. Great.
    – percusse
    Feb 9, 2013 at 23:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .