# I want to print the matrix on the arrow from A to B. How can I write?

I am working on quiver representation. I want to print the matrix on the arrow from A to B. How can I write? For example:

For linear transformation  $k^{3} \arrow{r} k^{2}$

• welcome to tex.se! please show what you try so far. is this math expression or an image? – Zarko Jul 10 '18 at 13:36
• see if $k^{3} \xrighttarrow{\left[\begin{smallmatrix}1 & 2\\ 3 & 4 \end{smallmatrix}\right]} k^{2}$ (amsmath package is needed) gives what you looking for. – Zarko Jul 10 '18 at 13:47

like this:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
For linear transformation  $k^{3} \xrightarrow{\left(\begin{smallmatrix} 1 & 2\\ 3 & 4 \end{smallmatrix}\right)} k^{2}$
\end{document}


edit: with matrix 3 x 2 and use of mathtools:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
For linear transformation  $k^{3} \xrightarrow{\begin{psmallmatrix} 1 & 2 & 3\\ 4 & 5 & 6 \end{psmallmatrix}} k^{2}$
\end{document}


You can configure your TABstacks for fontsize, column gap, and baselineskip. Here are two examples.

\documentclass{article}
\usepackage{tabstackengine,amsmath}
\TABstackMathstyle{\scriptstyle}
\setstacktabbedgap{.5ex}
\setstackgap{L}{8pt}
\begin{document}
\TABstackMathstyle{\scriptscriptstyle}
\setstacktabbedgap{.4ex}
\setstackgap{L}{8pt}
For non-linear transformation  $k^{3} \xrightarrow{ \parenMatrixstack{x & y^2\\2x & y} } k^{2}$

\TABstackMathstyle{\scriptstyle}
\setstacktabbedgap{.6ex}
\setstackgap{L}{10pt}
For non-linear transformation  $k^{3} \xrightarrow{ \parenMatrixstack{x & y^2\\2x & y} } k^{2}$
\end{document}


There is also this alternative code.

\documentclass[a4paper,12pt]{article}
\usepackage{tikz-cd,mathtools,amsmath,amssymb}
\newcommand{\smat}[4]{\begin{psmallmatrix} #1 & #2 \\ #3 & #4\end{psmallmatrix}}
\begin{document}
For linear transformation
\begin{tikzcd}
& k^3 \arrow[r, "\smat{1}{2}{3}{4}"] & k^2
\end{tikzcd}
\end{document}