I'm using \xymatrix to draw a diagram and I need some of the arrows to be named with a matrix over it. To draw the matrices over arrows, I'm using the \arrow command but, unfortunately, it puts very large matrices and collapses the diagram. The usual size-changing commands, such as \scriptstyle..., do not work. could somebody give a hint? Thanks in advance.

  • Could you post the example code that you're working with, to give an indication of what you're trying to do and what's not working? – Arun Debray Jan 7 '16 at 20:44

The smallmatrix environments are the right thing to use here, since they by default are small enough to fit into a line of text. You can use \begin{smallmatrix}...\end{smallmatrix} in place of \begin{matrix}...\end{matrix} to get something that's small enough.

Then, if you use the mathtools package, you can add delimiters: psmallmatrix is like pmatrix (a matrix delimited by parentheses, but smaller), bsmallmatrix uses brackets like bmatrix, and so on.

Here's how this looks with arrows in a commutative diagram:

A \ar[r]^{\begin{psmallmatrix}1 & 0\\0 & 1\end{psmallmatrix}}
  \ar[d]_{\begin{psmallmatrix}1 & -1\\-1 & 1\end{psmallmatrix}}
& B\ar[d]^{\begin{psmallmatrix}c & 0\\d & e\end{psmallmatrix}} \\
C\ar[r]_{\begin{bsmallmatrix}a & 0\\0 & b\end{bsmallmatrix}} & D

enter image description here


In addition to Arun's solution, this is how it would look like with :

% arara: pdflatex


\begin{tikzcd}[ampersand replacement=\&]
    A \arrow{d}[swap]{\begin{psmallmatrix}1 & 0\\0 & 1\end{psmallmatrix}} \arrow{r}{\begin{psmallmatrix}1 & 0\\0 & 1\end{psmallmatrix}} \& B \arrow{d}{\begin{psmallmatrix}1 & 0\\0 & 1\end{psmallmatrix}} \\
    C \arrow{r}[swap]{\begin{psmallmatrix}1 & 0\\0 & 1\end{psmallmatrix}} \& D

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.