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

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

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.