0

There are good entries on this site on how to produce a grid with tikz. In particular, this answer https://tex.stackexchange.com/a/12858/92346. The key seems to be the following command:

\draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);

I wonder if there is a similar automation to produce grids of the following form. enter image description here

1 Answers1

1

An idea to create this is to use 3 grids with different xstep and ystep. Then, to automate the process, I can use a pic. More on pic on this answer of mine

You can toy around with the pic, create arguments to change it or use pic actions to transfer arguments to subparts of the pic code.

\documentclass[border=1cm]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[ threegrids/.pic ={ \draw[ystep=5cm,xstep=1cm,color=gray] (0,0) grid (5,5); \draw[ystep=5cm,xstep=5cm,color=gray] (5,0) grid (10,5); \draw[ystep=5cm,xstep=1cm,color=gray] (10,0) grid (15,5); \node at(7.5,2.5) {...};
} ] \draw[ystep=5cm,xstep=1cm,color=gray] (0,0) grid (5,5); \draw[ystep=5cm,xstep=5cm,color=gray] (5,0) grid (10,5); \draw[ystep=5cm,xstep=1cm,color=gray] (10,0) grid (15,5);

% add the dots
\node at(7.5,2.5) {...};

% using a pic
\pic at (0,-6) {threegrids};

\end{tikzpicture} \end{document}

enter image description here

anis
  • 1,510
  • 5
  • 13