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.

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 draw this:

enter image description here

and my xy-pic code is

{\ar@{-}^{f_1}|{\dir{>}} s0;s1},
{\ar@{-}^{f_2}|{\dir{>}} s1;s2},
{\ar@{-}^{f_3}|{\dir{>}} s2;s3},
{\ar@{-}^{f_4}|{\dir{>}} s3;s0},

Can I use the function @@ to simplify the above code? For example, the code


gives the output without the arrows and the f's.

share|improve this question

TikZ implementation with very simple code:


\begin{tikzpicture}[-stealth,line cap=rect]
\draw(0,0)  |- (1,1)  node[above]{$f_1$};
\draw(1,1)  -| (2,0)  node[right]{$f_2$};
\draw(2,0)  |- (1,-1) node[below]{$f_3$};
\draw(1,-1) -| (0,0)  node[left]{$f_4$};

enter image description here

share|improve this answer

A PSTricks solution where you can control the side length in the diagram (by changing the value of \Length):



  \cs_new_eq:NN \calc \fp_eval:n



    ArrowInside = ->,
    ArrowInsidePos = 0.52,
    arrowscale = 1.5
  \uput[ 90](\halfLength,\Length){$f_{1}$}
  \uput[  0](\Length,\halfLength){$f_{2}$}



Note that I haven't choosen ArrowInsidePos = 0.5 but instead ArrowInsidePos = 0.52 since this gives a better arrowhead placement (visually speaking), I think.

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.