Take the 2-minute tour ×
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.

I'm trying to draw a commutative diagram using xymatrix:

$\xymatrix{
S \ar@[ld]^{\pi_{i}} \ar@[rd]^{\pi_{j}}\\
R_{i} \ar[r]_{\mu_{ji}} & R_{j} }$

without any luck. Any idea?

EDIT: I'm trying to draw the following commutative diagram:

enter image description here

share|improve this question
    
How should the resulting diagram look like? Also, could using another package be an option? –  Gonzalo Medina May 25 '12 at 4:58
    
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces or enclose words in backticks `, they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). –  Alan Munn May 25 '12 at 4:58
    
@Gonzalo Medina: Sorry I'm new hwere. It should an arrow (left diagonal) pointing to R_{i} and an arrow (right diagonal) pointing to R_{j} and between R_{i} and R_{j} a right arrow –  user31509 May 25 '12 at 4:59
    
Most commutative diagram packages work in a grid like this, so it's good to plan out your grid. In your code, there is no entry that is down-left from S. Also, in xymatrix the @ is for changing the arrow style, e.g. for a dashed arrow one writes \ar@{-->}. More examples here. In our case no style was provided, so the arrow probably didn't draw. –  Dylan Moreland May 25 '12 at 5:10
add comment

2 Answers

up vote 14 down vote accepted

Here's one possible solution for the lower part using both xy and tikz-cd:

\documentclass{article}
\usepackage[all]{xy}
\usepackage{tikz-cd}

\begin{document}

$\xymatrix{
& S \ar[ld]^{\pi_{i}} \ar[rd]_{\pi_{j}} &\\
R_{i} \ar[rr]_{\mu_{ji}} & & R_{j} }$

\begin{tikzcd}[column sep=normal]
& S \arrow{dl}{\pi_{i}}\arrow{dr}[swap]{\pi_{j}} & \\
R_{i} \arrow{rr}[swap]{\mu_{ji}} & & R_{j}
\end{tikzcd}

\end{document}

enter image description here

Here's the complete diagram using tikz-cd:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[column sep=normal,row sep=large]
& Y\arrow{ddl}[swap]{\psi_{i}}\arrow{ddr}{\psi_{j}}\arrow{d}{h} & \\
& S \arrow{dl}{\pi_{i}}\arrow{dr}[swap]{\pi_{j}} & \\
R_{i} \arrow{rr}[swap]{\mu_{ji}} & & R_{j}
\end{tikzcd}

\end{document}

enter image description here

And now using xy:

\documentclass{article}
\usepackage[all]{xy}

\begin{document}

$\xymatrix{
& Y\ar[ldd]_{\psi_{i}}\ar[rdd]^{\psi_{j}}\ar[d]^{h} & \\
& S \ar[ld]^{\pi_{i}} \ar[rd]_{\pi_{j}} & \\
R_{i} \ar[rr]_{\mu_{ji}} & & R_{j} }$

\end{document}

enter image description here

And now, as requested in a comment, with some arrows curved:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[column sep=normal,row sep=large]
& Y\arrow[bend right]{ddl}[swap]{\psi_{i}}\arrow[bend left]{ddr}{\psi_{j}}\arrow{d}{h} & \\
& S \arrow{dl}{\pi_{i}}\arrow{dr}[swap]{\pi_{j}} & \\
R_{i} \arrow{rr}[swap]{\mu_{ji}} & & R_{j}
\end{tikzcd}

\end{document}

enter image description here

And with xy:

\documentclass{article}
\usepackage[all]{xy}

\begin{document}

$\xymatrix{
& Y\ar@/_/[ldd]_{\psi_{i}}\ar@/^/[rdd]^{\psi_{j}}\ar[d]^{h} & \\
& S \ar[ld]^{\pi_{i}} \ar[rd]_{\pi_{j}} & \\
R_{i} \ar[rr]_{\mu_{ji}} & & R_{j} }$

\end{document}

enter image description here

share|improve this answer
    
@user31509 for your first question, see my updated answer; for the second question, the package name is tikz-cd. –  Gonzalo Medina May 25 '12 at 5:19
    
@user31509 give me some minutes and I'll post the code. –  Gonzalo Medina May 25 '12 at 5:20
    
thanks, meanwhile a question: which package is better and why? –  user31509 May 25 '12 at 5:23
    
@user31509 First, a side note: don't forget (after a sensible wait) to accept my answer (or any other that might appear) if you consider that it solved your problem (in case of doubt, please see How do you accept an answer?). I updated my answer with the xy code. Personally I think that tikz-cd is more powerful since its built upon PGF/TikZ, but for simple diagrams, both are good. –  Gonzalo Medina May 25 '12 at 5:27
2  
@user31509 the best thing to do is to use the MiKTeX package manager to install packages automatically. –  Gonzalo Medina May 25 '12 at 5:43
show 4 more comments

Here a solution with tkz-graph

  \documentclass[11pt]{scrartcl}
  \usepackage{tkz-graph}

  \begin{document}
  \begin{tikzpicture}[scale=5,rotate=-30,->,>=latex,auto] 
  % vertices
     \SetVertexMath  % use math mode for vertex
     \GraphInit[vstyle=Empty] % Nodes are not drawn
     \Vertex{X} % add a vertex at (0,0)
     \Vertices{circle}{X_i,Y,X_j}   % three nodes on a circle
  %edges 

   \Edge[label=$\pi_j$](X)(X_j)   
   \Edge[label=$\Psi_i$,style={bend left}](Y)(X_i) 
   \Edge[label=$u$](Y)(X)  

  \begin{scope}[EdgeStyle/.append style={swap}] % swap labels
   \Edge[label=$\pi_i$](X)(X_i)  
   \Edge[label=$\Psi_j$,style={bend right}](Y)(X_j)
   \Edge[label=$f_{ij}$](X_j)(X_i)
  \end{scope}

  \end{tikzpicture}
  \end{document}    

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

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.