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'm trying to do something like that to show a arithmetic progression (using TikZ):enter image description here

Thanks! :D

share|improve this question
1  
thanks for what? –  percusse Oct 26 '13 at 18:46
    
@percusse, for possible future answers. lol –  Sigur Oct 26 '13 at 18:54
    
"Thank you in advance". –  Who is crazy first Oct 26 '13 at 18:55
    
Well done, @percusse. Now we can't edit the thanks out of the OP's post :p –  Jubobs Oct 26 '13 at 20:07
    

3 Answers 3

With PSTricks.

\documentclass[preview,border=20pt]{standalone}
\usepackage{pst-node}
\psset{arm=8pt,arrows=->,nodesep=2pt,shortput=nab,labelsep=2pt}

\begin{document}
$
(\rnode{2}{2},\rnode{4}{4},\rnode{6}{6},\rnode{8}{8},\cdots)
\ncbar[angle=90]{2}{4}^{\scriptstyle 2}
\ncbar[angle=-90]{4}{6}_{\scriptstyle 2}
\ncbar[angle=90]{6}{8}^{\scriptstyle 2}
$
\end{document}

enter image description here

share|improve this answer

Remarks

For some unknown reason, when using the standalone documentclass an error

! Missing $ inserted.

is thrown.

Implementation

\documentclass{article}
\pagestyle{empty}
\usepackage{tikz}
\tikzset{every picture/.append style={remember picture}}
\begin{document}
$(
\tikz[baseline=(n2.base)]{\node (n2) {$2$};},
\tikz[baseline=(n4.base)]{\node (n4) {$4$};},
\tikz[baseline=(n6.base)]{\node (n6) {$6$};},
\tikz[baseline=(n8.base)]{\node (n8) {$8$};},
\cdots)
$
\begin{tikzpicture}[overlay]
    \path[->] (n2) edge[out=90,in=90] node[above] {$+2$} (n4);
    \path[->] (n4) edge[out=90,in=90] node[above] {$+2$} (n6);
    \path[->] (n6) edge[out=90,in=90] node[above] {$+2$} (n8);
\end{tikzpicture}

\vspace{1cm}

$(
\tikz[baseline=(n2.base)]{\node (n2) {$2$};},
\tikz[baseline=(n4.base)]{\node (n4) {$4$};},
\tikz[baseline=(n6.base)]{\node (n6) {$6$};},
\tikz[baseline=(n8.base)]{\node (n8) {$8$};},
\cdots)
$
\begin{tikzpicture}[overlay]
    \path[->] (n2) edge[out=90,in=90]   node[above] {$+2$} (n4);
    \path[->] (n4) edge[out=-90,in=-90] node[below] {$+2$} (n6);
    \path[->] (n6) edge[out=90,in=90]   node[above] {$+2$} (n8);
\end{tikzpicture}
\end{document}

Output

enter image description here

share|improve this answer

A solution using a variation of \tikzmark:

\documentclass{article}
\usepackage{tikz}

\newcommand\tikzmark[1]{\tikz[remember picture,baseline=(#1.base)]{\node(#1){#1};}}
\newcommand\arprog[3][bend left]{\tikz[remember picture,overlay,font=\footnotesize]{
    \draw[->,#1](#2.north)to node[above]{$+2$}(#3.north);
}}

\begin{document}

\[
  (\tikzmark{2},\tikzmark{4},\tikzmark{6},\dots)
\]

\arprog{2}{4}
\arprog{4}{6}

\end{document}

enter image description here

share|improve this answer
    
Thanks everyone! :D –  mvfs314 Mar 2 at 21:39

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.