TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make a diagram like A--->B, but there are two arrows, one written f_1 and another with f_2.

I tried \stackrel, but this gives arrows with different sizes.

If using \mathop{}_{under}^{over}, then the vertical separation is too large.

I also tried tikz, but the height position does not match the inline text.


My tikz example code

\textbf{cokernel} of
  \node (a) at (0,0){$A$};
  \node (b) at (1.5,0){$X$};
  ([yshift=2pt]a.east)edge node[above]{$f_1$}([yshift=2pt]b.west)
  ([yshift=-2pt]a.east)edge node[below]{$f_2$}([yshift=-2pt]b.west);



And no matter how I adjust the y-position of node (a),(b), it just does not move to the right place.

share|improve this question
Welcome to TeX.SX! Please add a minimal working example (MWE) that illustrates your problem or what you tried so far. It would also be helpful to see a picture of what you try to accomplish. I can't imagine that much from you description, but it should be possible with TikZ. – Ronny Dec 13 '13 at 9:14
I just edit the question. Take a look. – Y.H. Dec 13 '13 at 9:49
Thanks, but i think the result is quite nice, that you have with TikZ, so what do you mena by “move to the right place”? In line with the text before? – Ronny Dec 13 '13 at 9:55
Are you looking for tex.stackexchange.com/q/65932/15925 ? – Andrew Swann Dec 13 '13 at 9:59
...which would in your case be baseline=(a.base) – Ronny Dec 13 '13 at 10:04
up vote 7 down vote accepted

Here is a solution using xy. If you don't need tikz...


\textbf{cokernel} of $\xymatrix{A\ar@<3pt>[r]^{f_1} \ar@<-3pt>[r]_{f_2} & X}$

enter image description here

If you don't like that arrow tips you can change it using \xyoption{tips} on preamble (or \usepackage[all,cmtips]{xy} as suggested by @egreg) and then change the arrow tip with

\SelectTips{cm}{10}$\xymatrix{A\ar@<3pt>[r]^{f_1} \ar@<-3pt>[r]_{f_2} & X}$

where cm means Computer Modern. You also can use lu or eu. See the results

enter image description here enter image description here enter image description here

share|improve this answer
Isn't \usepackage[all,cmtips]{xy} better for selecting CM tips? – egreg Dec 16 '13 at 0:01
@egreg, it could be. I'll edit and insert your suggestion. – Sigur Dec 16 '13 at 12:01

If you use tikz-cd, the baseline works well automatically:

\textbf{cokernel} of
A \ar[yshift=2pt]{r}{f_1} \ar[yshift=-2pt]{r}[swap]{f_2} & X


enter image description here

Personally, I prefer tikz-cd to xy because to my eyes, the arrow tips in xy are not correctly aligned with the shafts.

share|improve this answer

Your Answer


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.