[Tex/LaTex] How to create an annuity timeline on LaTeX


I was wondering, how can I create a timeline exactly like this one:

enter image description here

on LaTeX?

I am a Finance student, and write all of my notes using LaTeX. These timelines, are giving me a headache. Since we use a lot of different timelines because of annuities. I want to learn how to create one basic timeline, so that I can then change anything I want. But basically, I want something like this, with the arrows and everything.

Thank you so much guys!

Best Answer

With tikz


  \draw[line width=1pt] (0,0) -- node[below=1mm,pos=0.6,scale=2] {$\cdots$} (10,0)node[right=4mm]{(periods)};
  \foreach \x/\y in {0/0,1/1,2/2,3/3,9/$n-1$,10/$n$}{
    \draw[line width=1pt] (\x,-2mm)node[below](\x){\strut\y} -- (\x,2mm)node[above]{$\$ 1$};
    \draw[-latex] (0,-7mm) -- +(0,-10mm)node[below]{$A_{ni}$};
    \draw[-latex] (10,-7mm) -- +(0,-10mm)node[below]{$S_{ni}$};

enter image description here