I want to show two 12x12 matrices side by side. This is a transition, so there should be an arrow in the middle between them. I have to use tikz, because i want to highlight the one entry that changed in this transition.
My question: is there a nice way to position this two matrices side by side with the arrow in the midle, that does not require a nasty try-and-error procedure with $\quad$ and other absolute spacing parameters? (all I've found so far is this, and they've used absolute spacing too).
My code:
\documentclass{article}
\usepackage{amsmath}
\setcounter{MaxMatrixCols}{12}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{matrix}
\newcommand{\mybox}[3]{
\draw[color=red] (#1-#2-#3.north west) -- (#1-#2-#3.north east)--(#1-#2-#3.south east) -- (#1-#2-#3.south west)-- (#1-#2-#3.north west);
}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}{.4\textwidth}
\begin{tikzpicture}
\matrix(m)[matrix of math nodes,left delimiter=(,right delimiter=)]
{
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 0 &1 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 &1 \\
0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 &1 \\
0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 &0 \\
0 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 &0 \\
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 1 &0 \\
0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 &0 \\
1 & 1 & 0 & 1 & 1 & 0 & 1 & 1 & 1 & 0 & 0 &0 \\
};
\mybox{m}{10}{8}
\end{tikzpicture}
\end{subfigure}
$\longrightarrow$
\begin{subfigure}{.4\textwidth}
\begin{tikzpicture}
\matrix(n)[matrix of math nodes,left delimiter=(,right delimiter=)]
{
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 0 &1 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 &1 \\
0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 &1 \\
0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 &0 \\
0 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 &0 \\
1 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 1 &0 \\
0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 &0 \\
1 & 1 & 0 & 1 & 1 & 0 & 1 & 1 & 1 & 0 & 0 &0 \\
};
\mybox{n}{10}{8}
\end{tikzpicture}
\end{subfigure}
\caption{Just the arrow}
\end{figure}
\begin{figure}
\centering
\begin{subfigure}{.4\textwidth}
\begin{tikzpicture}
\matrix(m)[matrix of math nodes,left delimiter=(,right delimiter=)]
{
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 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1 & 0 & 1 & 1 & 1 & 0 & 0 &0 \\
};
\mybox{n}{10}{8}
\end{tikzpicture}
\end{subfigure}
\caption{nasty fix with absolut spaces}
\end{figure}
\end{document}



