# Typesetting a matrix with crossing arrows on it

I'm able to draw matrices on LaTeX but I don't know how to put crossing arrows on it as the second matrix in the figure.

I tried to make it 5 x 5 matrices and put \diagup, \diagdown on diagonals but it didn't seem like a good idea.

• Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. Also, a picture/mockup of what you want might be very helpfull. Oct 28 '11 at 14:05
• My TikZ-sense is tingling Oct 28 '11 at 14:18
• @Seamus: Your sense didn't fool you. Oct 28 '11 at 15:03

I once worked out a similar thing with pgf/tikZ (surprise, surprise!) as a solution to a question where else.

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{calc,matrix}

\begin{document}
\begin{tikzpicture}[>=stealth]
\matrix [%
matrix of math nodes,
column sep=1em,
row sep=1em
] (sarrus) {%
a_{11} & a_{12} & a_{13} & a_{11} & a_{12} \\
a_{21} & a_{22} & a_{23} & a_{21} & a_{22} \\
a_{31} & a_{32} & a_{33} & a_{31} & a_{32} \\
};

\path ($(sarrus-1-1.north west)-(0.5em,0)$) edge ($(sarrus-3-1.south west)-(0.5em,0)$)
($(sarrus-1-3.north east)+(0.5em,0)$) edge ($(sarrus-3-3.south east)+(0.5em,0)$)
(sarrus-1-1)                          edge            (sarrus-2-2)
(sarrus-2-2)                          edge[->]        (sarrus-3-3)
(sarrus-1-2)                          edge            (sarrus-2-3)
(sarrus-2-3)                          edge[->]        (sarrus-3-4)
(sarrus-1-3)                          edge            (sarrus-2-4)
(sarrus-2-4)                          edge[->]        (sarrus-3-5)
(sarrus-3-1)                          edge[dashed]    (sarrus-2-2)
(sarrus-2-2)                          edge[->,dashed] (sarrus-1-3)
(sarrus-3-2)                          edge[dashed]    (sarrus-2-3)
(sarrus-2-3)                          edge[->,dashed] (sarrus-1-4)
(sarrus-3-3)                          edge[dashed]    (sarrus-2-4)
(sarrus-2-4)                          edge[->,dashed] (sarrus-1-5);

\foreach \c in {1,2,3} {\node[anchor=south] at (sarrus-1-\c.north) {$+$};};
\foreach \c in {1,2,3} {\node[anchor=north] at (sarrus-3-\c.south) {$-$};};
\end{tikzpicture}
\end{document}


• @egreg I want to reproduce the picture. I tried wit align. I want to write D=. Could you please help me? I tried \begin{align*} D & = \begin{tikzpicture}[>=stealth].....but it does not work Jun 26 at 14:54