topnush
How do I make all the squares the same size in the following MWE?


\documentclass[]{article}

\begin{document}
$\begin{array}{|l|l|l|l|l|l|} \hline & & & & & \\ \hline & 1 & & & 2 & \\ \hline & & & & & \\ \hline & & & & & \\ \hline & 3 & & & 4 & \\ \hline & & & & & \\ \hline \end{array}$
\end{document}


This is what is currently looks like:

![Screenshot from 2022-05-20 11-18-43.png](/image?hash=3a87c0013228107d58ee5eb41a06c0161c30ab57b5efc072ddfce21e0f968d42)
frougon
Assuming you want all *cells* to be *squares* of the same size:


\documentclass[tikz, border=1mm]{standalone}
\usetikzlibrary{matrix}

\begin{document}
\begin{tikzpicture}
\matrix[
matrix of nodes,
row sep =-\pgflinewidth,
column sep = -\pgflinewidth,
nodes in empty cells,
nodes={rectangle, draw, anchor=center, minimum size=2em},
]
{  &   &  &  &   & \\
& 1 &  &  & 2 & \\
&   &  &  &   & \\
&   &  &  &   & \\
& 3 &  &  & 4 & \\
&   &  &  &   & \\
};
\end{tikzpicture}
\end{document}


![out.png](/image?hash=4420bc7233dd406c60bc165bb0f495e5f8afb3be3a4d053d9a4ed8e39f17d585)

In case you want the cells to be *rectangles* with chosen dimensions, you can replace minimum size=2em with, for instance, minimum width=3em, minimum height=2em.

Note that since your MWE doesn't load the array package, it has ugly line joints:

![image.png](/image?hash=e07794fcd63d977f4cb637ae4b0866e4604feefbcb0475de03ce7a4f98599fc7)
barbara beeton
You can put \phantom{0} in each empty column in the first row.

All digits are the same width, so this will force the width of all columns to be the same.


\documentclass{article}

\begin{document}
$\begin{array}{|l|l|l|l|l|l|} \hline \phantom{0} & \phantom{0} & \phantom{0} & \phantom{0} & \phantom{0} & \phantom{0} \\ \hline & 1 & & & 2 & \\ \hline & & & & & \\ \hline & & & & & \\ \hline & 3 & & & 4 & \\ \hline & & & & & \\ \hline \end{array}$
\end{document}


![Screenshot 2022-05-20 at 17.50.11.png](/image?hash=a21f6bd2640508807afe39bee69e27ca00293c266eab40f1bb5c9bd041bcea50)
samcarter
And just for completeness, here a possible solution with tabularray:


\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{amsmath}

\begin{document}

$\begin{+array}{ vlines, hlines, colspec={*{6}{Q[0.25cm,c]}}, } & & & & & \\ & 1 & & & 2 & \\ & & & & & \\ & & & & & \\ & 3 & & & 4 & \\ & & & & & \\ \end{+array}$

\end{document}


![Screenshot 2022-05-23 at 15.02.53.png](/image?hash=acd7d7d135b658c8b067b95da531bdcf3f9ab8d77bd70b66b2e02988493e4856)
निरंजन
You can also try this:


\documentclass[border=0.5cm]{standalone}
\usepackage{calc}
\usepackage{array}

\begin{document}
$\begin{array}{% |*{6}{p{\widthof{0}}|}% } \hline & & & & & \\ \hline & 1 & & & 2 & \\ \hline & & & & & \\ \hline & & & & & \\ \hline & 3 & & & 4 & \\ \hline & & & & & \\ \hline \end{array}$
\end{document}


(*One benefit is that you don't have to load a package which has camel-cased environments :joy:*)
samcarter
As an alternative to using the normal array, you could use the nicematrix package and set the width of the columns:


\documentclass{article}

\usepackage{nicematrix}

\begin{document}
$\begin{NiceArray}{|c|c|c|c|c|c|}[columns-width = 0.15cm] \hline & & & & & \\ \hline & 1 & & & 2 & \\ \hline & & & & & \\ \hline & & & & & \\ \hline & 3 & & & 4 & \\ \hline & & & & & \\ \hline \end{NiceArray}$
\end{document}


![Screenshot 2022-05-20 at 15.19.48.png](/image?hash=7c0b3dc0f8eaddeddc3d3b1013ac7861b994e915fe17d61023b865ebb23b379a)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.