# How does one construct an abstract (n × n) empty grid of squares?

I would like to just create a grid like this, but without numbers or color, but I'd like to represent an n × n grid abstractly with ellipses like this:

Also, I need just a simple—singular—grid like that of the top left grid in the image above.

I know need a red line (y=x) from the lower left corner to the upper right corner.

-
Welcome to TeX.SX! I added the picture you linked to the question. Later, with more reputation points earned, you will be able to do it yourself. Happy TeXing! :) – Count Zero Jul 25 '13 at 20:35
Thank you! :-) – Loie Benedicte Jul 25 '13 at 20:39
Would you rather do this as a table or as a tikzpicture (since you seem to have included both tags)? – MHaaZ Jul 25 '13 at 20:45
I included both tags so that the experienced answerer could choose between the easier of the two, but I would like to get a handle on tikz, so perhaps tikz is my answer. – Loie Benedicte Jul 25 '13 at 20:49
It could be done in a tabular, but the fact that the rules aren't continuous would cause for some ugliness. It's not that it's hard (once you get to grips with tabulars), it's just ugly. (The tabular solution would potentially be more efficient, but the TikZ solution is prettier by far.) – Sean Allred Jul 25 '13 at 23:06

A very basic approach using grid:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw (0,0) grid (3,3);
\draw (0,4) grid (3,7);
\draw (4,0) grid (7,3);
\draw (4,4) grid (7,7);
\foreach \i/\valor in {1/1,2/2,3/3,5/n-2,6/n-1,7/n}
{
\node[anchor=south] at (\i-0.5,7) {$\valor$};
\node[anchor=east] at (0,-\i+7.5) {$\valor$};
}
\node at (3.5,1.5) {$\cdots$};
\node at (3.5,5.5) {$\cdots$};
\node at (1.5,3.5) {$\vdots$};
\node at (5.5,3.5) {$\vdots$};
\node at (3.5,3.5) {$\ddots$};
\end{tikzpicture}

\end{document}


With the new requirement of the edited question:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw (0,0) grid (3,3);
\draw (0,4) grid (3,7);
\draw (4,0) grid (7,3);
\draw (4,4) grid (7,7);
\foreach \i/\valor in {1/1,2/2,3/3,5/n-2,6/n-1,7/n}
{
\node[anchor=south] at (\i-0.5,7) {$\valor$};
\node[anchor=east] at (0,-\i+7.5) {$\valor$};
}
\node at (3.5,1.5) {$\cdots$};
\node at (3.5,5.5) {$\cdots$};
\node at (1.5,3.5) {$\vdots$};
\node at (5.5,3.5) {$\vdots$};
\node at (3.5,3.5) {$\ddots$};
\draw[red,ultra thick] (0,0) -- (7,7);
\end{tikzpicture}

\end{document}


-
OMG... You are amazing. Thank you! :-) – Loie Benedicte Jul 26 '13 at 5:56
What if I want to put a giant slash from the lower left corner to the upper right corner in red? – Loie Benedicte Jul 27 '13 at 1:26
@LoieBenedicte just before \end{tikzpicture}, you can add \draw[red] (0,0) -- (7,7); – Gonzalo Medina Jul 27 '13 at 1:30
Hmmm... How do you get a bold red? – Loie Benedicte Jul 27 '13 at 2:38
@LoieBenedicte do you mean to increase the line width? If so, \draw[red, ultra thick] (0,0) -- (7,7); or \draw[red,line width=4pt] (0,0) -- (7,7); (change 4pt to the desired value). – Gonzalo Medina Jul 27 '13 at 2:40