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.

How can I use a matrix as label in the xymatrix environment? I tried to nest matrices (naively) but it seems to be rather complicated.

\xymatrix{
A \ar[r]^{\xymatrix{f \\ g}} & B
}
share|improve this question

1 Answer 1

No, you can't; but you can use \substack, provided by amsmath:

\documentclass{article}
\usepackage[all,cmtip]{xy}
\usepackage{amsmath}
\begin{document}
\xymatrix{
A \ar[r]^{\substack{f \\ g}} & B
}
\end{document}

enter image description here

An alternative is the smallmatrix environment:

\documentclass{article}
\usepackage[all,cmtip]{xy}
\usepackage{amsmath}
\begin{document}
\xymatrix{
A \ar[r]^{\left[\begin{smallmatrix}a&b\\c&d\end{smallmatrix}\right]} & B  
}
\end{document}

enter image description here

share|improve this answer
    
Beautiful, thanks! –  user15412 Jul 13 '12 at 17:02
    
@user15412 Another possibility is to say \ar[r]^{f}_{g} –  egreg Jul 13 '12 at 17:04
    
What if I want to insert a square matrix? –  user15412 Jul 13 '12 at 17:13
    
@user15412 I've added a way –  egreg Jul 13 '12 at 17:20

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.