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 it possible to label an arrow with a matrix in Xy-pic? In the following diagram I want to label the arrows with 2x2 matrices to represent linear maps between vector spaces, in the place of a,b and c.

\documentclass{article}

\usepackage{amsmath}
\usepackage{xypic}

\begin{document}

\begin{equation*}
\xymatrix{
{\bullet}^{V_1}\ar[r]^a &{\bullet}^{V_2}\ar[d]^b
\\&{\bullet}^{V_3}\ar[ul]^c
}
\end{equation*}
\end{document}

It is for a diagram of a quiver representation.

share|improve this question
1  
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). –  egreg Nov 12 '12 at 18:08

1 Answer 1

You could just substitute the a, b, c for the matrix or whatever you want in brackets (I've added the - before so that the label is aligned in the middle of the arrow, not the middle of the row/column). Here's an example:

\begin{equation*} 
    \xymatrix @R=2cm @C=2cm { 
    {\bullet}^{V_1} \ar[r]^-{a = \begin{pmatrix}
        a_1 & a_2 \\ a_3 & a_4
    \end{pmatrix}} & {\bullet}^{V_2} \ar[d]^-{b = \begin{pmatrix}
        b_1 & b_2 \\ b_3 & b_4
    \end{pmatrix}} \\
    & {\bullet}^{V_3} \ar[ul]^-{c = \begin{pmatrix}
        c_1 & c_2 \\ c_3 & c_4
    \end{pmatrix}} 
    }
\end{equation*}

And may be you would like to write into an smallmatrix, which could be enough for your needs:

\begin{equation*} 
    \xymatrix @R=2cm @C=2cm { 
    {\bullet}^{V_1} \ar[r]^-{a = \left(\begin{smallmatrix}
        a_1 & a_2 \\ a_3 & a_4
    \end{smallmatrix}\right)} & {\bullet}^{V_2} \ar[d]^-{b = \left(\begin{smallmatrix}
        b_1 & b_2 \\ b_3 & b_4
    \end{smallmatrix}\right)} \\
    & {\bullet}^{V_3} \ar[ul]^-{c = \left(\begin{smallmatrix}
        c_1 & c_2 \\ c_3 & c_4
    \end{smallmatrix}\right)} 
    }
\end{equation*}

The @R=X and the @C=Y in the xymatrix command gives you the chance to change row and column separation.

There is a package tikz-cd (here is the manual at CTAN) which, in my opinion, gives better quality and the language used is easier to understand (i.e. \arrow[hookrightarrow]{rr}{a} instead of the xymatrix \ar@{^{(}->}[rr]^-{a}; or \rar{a} instead of \ar[r]^-{a}). But, in this concrete case there is a problem: tikz-cd causes problems if you want to label an arrow with a matrix (here is a better explanation). That's why I don't include an example here.

share|improve this answer
    
Probably smallmatrix is the best choice. I'd say \xymatrix @R+1pc @C+1pc{...} rather than setting explicit dimensions (this adds 12pt to both the intercolumn and interrow spaces). –  egreg Nov 12 '12 at 18:28
    
I thought saying it in cm would be more explicit and easy to understand. But that's a good tip. Anyway, to the OP @nick, may be you would like to look for the tikz-cdpackage, which is similar and, in my opinion, easier to understand. –  Manuel Nov 12 '12 at 18:33
    
Why don't you give also a solution based on tikz-cd? –  egreg Nov 12 '12 at 18:34
    
Trying to make it I discover that tikz-cd doesn't recognize matrixes in the labels of the arrows, I get an error. It only separates the rows and not the columns (as a substack)! I don't know. ... And here's the answer link. In this case it wouldn't clarify anything for de OP I think. –  Manuel Nov 12 '12 at 19:00

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.