[Tex/LaTex] TikZ picture: two arrow; one over the other

tikz-pgf

I have the following code:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{matrix,arrows}

\begin{document}
  \[
        \begin{tikzpicture}
         \matrix (m) [matrix of math nodes,row sep=3em,column sep=1em,minimum width=2em]{
              A &   & G \\
                & S &   \\
         };
         \path[-stealth]
            (m-1-1) edge node [above] {$f$} (m-1-3)
            (m-1-1)  edge [bend right] node [left] {$p\;$} (m-2-2)
            (m-1-3) edge node [right] {$\;q$} (m-2-2)
            (m-2-2) edge node [right] {$\epsilon$} (m-1-1);
         \path[-stealth]
            ([yshift=5pt]m-1-1) edge node [right] {$g$} ([yshift=5pt]m-1-3);
        \end{tikzpicture}
    \]
\end{document}

I dare you to compile it. Then you will get a disgusting output. What I want is to get the two arrow on top one over the other (just like corolary 1.3.1.5, page 70, in the notes on http://math.umn.edu/~kwlan/articles/cpt-PEL-type-thesis-revision.pdf).

Can anyone help? I would love if the solution didn't modify too much the way I coded the diagram since it is the way I always do it (with the matrix) but beggers can't be choosers, so.

Best Answer

Here is an attempt to fix it by using the .east and .west anchors:

enter image description here

Notes:

  • Not sure why you were using math mode -- I have removed that in the below MWE.

Code:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{matrix,arrows}

\begin{document}
        \begin{tikzpicture}
         \matrix (m) [matrix of math nodes,row sep=3em,column sep=1em,minimum width=2em]{
              A &   & G \\
                & S &   \\
         };
         \path[-stealth]
            (m-1-1.east) edge node [above,yshift=1.0ex] {$f$} (m-1-3.west)
            (m-1-1) edge [bend right] node [left] {$p\;$} (m-2-2)
            (m-1-3) edge node [right] {$\;q$} (m-2-2)
            (m-2-2) edge node [right] {$\epsilon$} (m-1-1);
         \path[-stealth]
            ([yshift=5pt]m-1-1.east) edge node [below,,yshift=-1.0ex] {$g$} ([yshift=5pt]m-1-3.west);
        \end{tikzpicture}
\end{document}