5

I know how to make a blank chessboard, but I want to show that the chessboard is very large by putting in ellipses like this following sketch a blank chessboard with dots

0

3 Answers 3

5

Without foreach but with grids. Drawing the interrupted chess board is as simple as saying

\draw[step=5mm,line cap=rect] (0,0) grid (3.6,-3.6) (4.4,0) grid (5,-3.6)
 (0,-5) grid (3.6,-4.4) (5,-5) grid (4.4,-4.4);

This exploits that the grid lines are "on grid". The dotted lines/ellipses are as simple as

\draw[Dotted,thick,step=1.5cm] (3.75,-3.75) -- (4.25,-4.25)
    [yshift=-2.5mm] (3.75,0) grid[xstep=0] (4.25,-4.75)
    [yshift=2.5mm,xshift=2.5mm] (0,-3.75) grid[ystep=0] (4.75,-4.25);

A big chunk of the following code is the definition of a fully customizable round dotted line style and acknowledging its source.

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[Dotted/.style={% https://tex.stackexchange.com/a/52856/194703
    dash pattern=on 0.1pt off 2mm,line cap=round,line width = 2pt,
    shorten <=2.5mm,shorten >=2.5mm}]
 \draw[step=5mm,line cap=rect] (0,0) grid (3.6,-3.6) (4.4,0) grid (5,-3.6)
 (0,-5) grid (3.6,-4.4) (5,-5) grid (4.4,-4.4);
 \draw[Dotted,thick,step=1.5cm] (3.75,-3.75) -- (4.25,-4.25)
    [yshift=-2.5mm] (3.75,0) grid[xstep=0] (4.25,-4.75)
    [yshift=2.5mm,xshift=2.5mm] (0,-3.75) grid[ystep=0] (4.75,-4.25);
\end{tikzpicture}
\end{document}

enter image description here

3
  • You're really galactic :-)
    – Sebastiano
    Dec 30, 2019 at 16:47
  • @Sebastiano All of us are. The heavier elements in our bodies stem (to a large extent) from supernovae.
    – user194703
    Dec 30, 2019 at 16:48
  • No no, I'm, peraphs, a pulsar (that is only my heart beats).
    – Sebastiano
    Dec 30, 2019 at 16:49
9

A simple way using \foreach.

\documentclass[tikz]{standalone}
\begin{document}

\begin{tikzpicture}
  \foreach \x in {0,...,5,7,8}
    \draw (\x,0)--(\x,8) (0,8-\x)--(8,8-\x);
  \draw[line width=1.7cm, white] (.5,2)--(7.5,2) (6,.5)--(6,7.5);
  \foreach \x in {.5,1.5,...,4.5,7.5} 
    \node at (\x,2) {$\vdots$} node at (6,8-\x) {$\dots$};
  \node at (6,2) {$\ddots$};
\end{tikzpicture}

\end{document}

enter image description here

PS:

As suggested by @Schrödinger'scat, removing parts from the outer box can give a nicer look. In this case, the code can become simpler as well:

\begin{tikzpicture}
  \draw (0,0) grid (8,8);
  \draw[line width=1.7cm, white, line cap=rect] (0,2)--(8,2) (6,0)--(6,8);
  \foreach \x in {.5,1.5,...,4.5,7.5} 
    \node at (\x,2) {$\vdots$} node at (6,8-\x) {$\dots$};
  \node at (6,2) {$\ddots$};
\end{tikzpicture}

enter image description here

0
8

Use a loop. Note that I rotate \cdots nodes instead of using \vdots or \ddots. To see why, just use \vdots and \ddots in those places.

\documentclass[tikz,margin=4]{standalone}
\begin{document}
\begin{tikzpicture}
  \def\cellsize{7mm}
  \foreach \i in {1,...,5} {
    \draw (\i*\cellsize,0) -- (\i*\cellsize,-5.2*\cellsize) 
          (\i*\cellsize,-6.8*\cellsize) -- (\i*\cellsize,-8*\cellsize)
          (0,-\i*\cellsize) -- (5.2*\cellsize,-\i*\cellsize)
          (6.8*\cellsize,-\i*\cellsize) -- (8*\cellsize,-\i*\cellsize)
          (\i*\cellsize-\cellsize/2,-6*\cellsize) node[rotate=90] {$\cdots$}
          (6*\cellsize,-\i*\cellsize+\cellsize/2) node            {$\cdots$};
  }
  \draw (0,0) rectangle (8*\cellsize,-8*\cellsize)
        (7*\cellsize,-8*\cellsize) -- ++ (0,1.2*\cellsize)
        (8*\cellsize,-7*\cellsize) -- ++ (-1.2*\cellsize,0)
        (7*\cellsize,0) -- ++ (0,-5.2*\cellsize)
        (0,-7*\cellsize) -- ++ (5.2*\cellsize,0)
        (6*\cellsize,-6*\cellsize) node[rotate=-45] {$\cdots$}
        (6*\cellsize,-7.5*\cellsize) node {$\cdots$}
        (7.5*\cellsize,-6*\cellsize) node[rotate=90] {$\cdots$};
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .