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.


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


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






    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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.