6

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
}
0

1 Answer 1

10

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

1
  • @user15412 Another possibility is to say \ar[r]^{f}_{g}
    – egreg
    Commented Jul 13, 2012 at 17:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .