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 need the code for arrows underneath numbers going in the right direction. I've looked up the commands online and all I have \uarrow which goes to the left and not right.:

enter image description here

Thank you Hendrik. My problem is solved!

share|improve this question
1  
Have you tried replacing \curvearrowbotleft with \curvearrowbotright in the code you've got? –  Hendrik Vogt Feb 16 '13 at 17:50
add comment

1 Answer

up vote 2 down vote accepted

The previous solution at Getting arrows underneath numbers allows one to provide options to the \DrawArrow which you can use to reverse the direction of the arrow. You could either change the arrow style for all subsequent \DrawArrow calls from:

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

where the -stealth option draws a stealth style arrow from left to right, to

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

which draws the arrow from right to left as shown in the first line on the right hand side.

Alternatively, you could specify <- for each \DrawArrow so you can then mix and match as desired the direction, as shown by the right hand side of the second line, where the olive and magenta are drawn in opposite directions. Not that I think you want to do this, but rather to illustrate its use.

enter image description here

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%
}

\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}}%
    }{% 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}}%
    }%
    \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}%
}

\begin{document}
\tikzset{BottomArrowStyle/.style={thin, -stealth}}% change arrow style
10.\tikzmark{Three}{5}\tikzmark{Two}{6}\tikzmark{One}{6}%
\DrawArrow*[red]{One}{One}%
\DrawArrow*[brown]{Two}{Two}%
\DrawArrow*[blue]{Three}{Three}%
%
\hspace*{0.25cm}%
%
\tikzset{BottomArrowStyle/.style={thin, stealth-}}% change arrow style
10.\tikzmark{Three}{5}\tikzmark{Two}{6}\tikzmark{One}{6}%
\DrawArrow*[olive]{One}{One}%
\DrawArrow*[green]{Two}{Two}%
\DrawArrow*[magenta]{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}%
%
\hspace*{0.25cm}%
%
10.\tikzmark{ThreeB}{5}\tikzmark{TwoB}{6}\tikzmark{OneB}{6}%
\DrawArrow*[olive,<-]{OneB}{OneB}%
\DrawArrow[green,<-]{TwoB}{TwoB}%
\DrawArrow*[magenta,->]{ThreeB}{ThreeB}%

\bigskip
10.\tikzmark{Three}{5}\tikzmark{Two}{6}\tikzmark{One}{6}%
\DrawArrow*[red,in=-85, out=-95, distance=0.2cm]{One}{Three}%
%
\hspace*{0.25cm}%
%
10.\tikzmark{Three}{5}\tikzmark{Two}{6}\tikzmark{One}{6}%
\DrawArrow*[magenta,in=-85, out=-95, distance=0.2cm, <-]{One}{Three}%
\end{document}
share|improve this answer
add comment

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.