2

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 & 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}
    $\quad \qquad\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{nasty fix with absolut spaces}
\end{figure}
\end{document}

and the output: enter image description here

2
  • You should not be placing them in subfigures, if you intend to link the two as a single "image" – Steven B. Segletes Jul 21 '16 at 13:26
  • I wanted the opportunity to give them own captions in the "real" document, it's not that important though. – audiophiel Jul 21 '16 at 13:28
3

You can use \subcaptionbox, if you want to have subcaptions, or nothing at all.

I declared \small in order to fit the big matrices in the page, it may be unnecessary for your document.

\documentclass{article}
\usepackage{amsmath}
\usepackage{caption}
\usepackage{subcaption}

\usepackage{tikz}
\usetikzlibrary{matrix}

\usepackage{lipsum}

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

\lipsum[1]

\begin{figure}[htp]
\centering\small
\subcaptionbox{Start}{%
        \begin{tikzpicture}[ampersand replacement=\&]
        \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}%
}
    \raisebox{6.5\baselineskip}{$\longrightarrow$}
\subcaptionbox{End}{%
        \begin{tikzpicture}[ampersand replacement=\&]
        \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}%
}
    \caption{Just the arrow}
\end{figure}

\begin{figure}[htp]
\centering\small
        \begin{tikzpicture}[ampersand replacement=\&]
        \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}
    \raisebox{6.5\baselineskip}{$\longrightarrow$}
        \begin{tikzpicture}[ampersand replacement=\&]
        \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}
    \caption{Just the arrow}
\end{figure}

\end{document}

enter image description here

2

Your problem is that the matrices are wider than the specified with of the subfigure environment (.4\textwidth), so they stick out of the right edge. This causes the overlap with the arrow.

Reduce the size of the matrices, by modifying (a combination of), font size and inner sep for the nodes, and column sep, row sep for the matrix. I also increased the width of the subfigures a bit.

enter image description here

\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);
}
\tikzset{pmatrix/.style={
    matrix of math nodes,outer sep=0pt,
    nodes={
%     font={\small}, 
     inner sep=2.5pt
    },
    column sep=0pt,row sep=0pt,
    left delimiter=(,right delimiter=)}
}
\begin{document}

\begin{figure}
    \centering
    \begin{subfigure}{.45\textwidth}
    \centering
        \begin{tikzpicture}
        \matrix(m)[pmatrix]
        {
            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}{.45\textwidth}
    \centering
        \begin{tikzpicture}
        \matrix(n)[pmatrix]
        {
            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}
\end{document}
1

Maybe I missed something, but you don't need TikZ for that: a simple \fcolorbox will do:

\documentclass{article}
\usepackage{mathtools}
\setcounter{MaxMatrixCols}{12}
\usepackage{xcolor}

 \begin{document}

    \[
        \begin{pmatrix}
            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 & \mathclap{\fcolorbox{red}{white}{\,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 \
        \end{pmatrix}
   \longrightarrow
        \begin{pmatrix}
            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 & \mathclap{\fcolorbox{red}{white}{\,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
            \end{pmatrix}
            \]

\end{document} 

enter image description here

3
  • There is no particular need for tikz. But the spacing in this solution does not fulfill my styling fetish... – audiophiel Jul 21 '16 at 14:02
  • Which spacing do you mean? – Bernard Jul 21 '16 at 14:37
  • mathclap has fixed this i think, nice alternative, i like this! – audiophiel Jul 21 '16 at 15:06

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.