1

I'm trying to create square cells horizontally centred in brackets. The codes are below:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}


\begin{document}



$$\left (\begin{tikzpicture}
\tikzset{square matrix/.style={
        matrix of nodes,
        column sep=-\pgflinewidth, row sep=-\pgflinewidth,
        nodes={draw,
            minimum height=#1,
            anchor=center,
            text width=#1,
            align=center,
            inner sep=0pt
        },
    },
    square matrix/.default=1cm
}

\matrix[square matrix]
{
&~&~&~&\\
&~&~&~&\\
};
\end{tikzpicture} \right )$$

\end{document}

enter image description here

I would like to show the result as

enter image description here

How can I do it?

Thank you very much.

egreg
  • 1,121,712

0 Answers0