0

I would like to draw positions of Checkers (aka Draughts) with the almighty package chessboard, and I would like to place some discs with a nice boundary, rather than plain discs.

Edit: What I ideally need is a symbol for a checkers piece as follows, quoting from the documentation of chessboard regarding adding non-standard pieces on the board:

Symbols should be scalable, so you should either use symbols from a font or use some resizing command from the graphicx package.

And then gives the following example (the minimal one, with a black clubsuit, is highlighted): enter image description here

So yes, I would like something to replace \clubsuit with some nice checkers piece :)


The best example I found online is at the very end of this answer: https://tex.stackexchange.com/a/555137 where Marjin proposes to put a double border on plain discs.

I really like that effect, but I can't reproduce it. I simply put this code in my preamble (with xcolor loaded):

\definecolor{offwhite}{RGB}{255,255,244}
\definecolor{dimgray}{RGB}{42,42,42}
\newcommand{\blackdisc}{\linethickness{0.5mm}\color{dimgray}\circle*{19}\color{gray}\circle{19.4}\linethickness{0.2mm}\circle{15}}
\newcommand{\whitedisc}{\linethickness{0.5mm}\color{offwhite}\circle*{19}\color{gray}\circle{19.4}\linethickness{0.2mm}\circle{15}}

Which is then used to have the following result: enter image description here

Note that the original code used \renewcommand rather than \newcommand, because it was used within the othelloboard environment.

I just tried to write \blackdisc in text mode, but I get the disc and the boundary uncentered, so I haven't gone forward to use it within chessboard.

Is there an easy fix to this, or an alternative solution?

3
  • well while I like to hear that chessboard is almighty I don't like questions which contains only snippets of code and links to other questions. I don't have the time to hunt through links and assemble code. Aug 13 '21 at 18:39
  • I only mentioned the relevant code, the rest was specific to othelloboard - I added a picture from the linked question for clarity
    – davideleo
    Aug 14 '21 at 11:48
  • 1
    Your question would be a lot clearer if you provided a code example, but the \blackdisk code you show is picture mode so it is designed to be used inside \begin{picture}(10,10)\put(0,0){\blackdisk}}\end{picture} or some such construct. Aug 14 '21 at 16:39
3

This is an alternative solution, I don't know if your problem can be fixed with the chessboard package (I have never used it). But it's very easy to draw a checkers game with TikZ and put the pieces where you need them. I am drawing the pieces with a \pic, the rest are squares.

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

\tikzset
{%
  pics/piece/.style={
    code={%
      \draw[line width=0.4mm,fill] (-0.5,-0.5) circle (0.4);
      \draw[line width=0.2mm]      (-0.5,-0.5) circle (0.3);
    }},
}

\begin{document}
\begin{tikzpicture}
% chessboard
\draw[very thick,brown] (0,0) rectangle (8,8);
\foreach\i in {0,...,7}\foreach\j in {0,...,7}
{
  \pgfmathsetmacro\blend{Mod(\i+\j,2)==0?75:25}
  \fill[brown!\blend] (\i,\j) rectangle ++ (1,1);
}
% black pieces
\foreach\i/\j in {1/1,3/1,5/1,7/1,2/2,4/2,6/2,8/2,/3,3/3,5/3,6/4}
  \pic[draw=white] at (\i,\j) {piece};
% white pieces
\foreach\i/\j in {2/8,4/8,6/8,8/8,1/7,3/7,5/7,7/7,2/6,4/6,6/6,8/6}
  \pic[fill=white] at (\i,\j)     {piece};
% an intruder
\pic[draw=red,fill=green] at (3.5,4.25) {piece};
\end{tikzpicture}
\end{document}

enter image description here

Edit: A slightly better looking piece:

\tikzset
{%
  pics/piece/.style={
    code={%
      \fill                   (-0.5,-0.5) circle (0.4);
      \fill[left color=white,
            right color=gray,
            opacity=0.6]      (-0.5,-0.5) circle (0.4);
      \draw[line width=0.4mm] (-0.5,-0.5) circle (0.4);
      \draw[line width=0.2mm] (-0.5,-0.5) circle (0.3);
    }},
}

enter image description here

1
  • Thank you Juan, this is a very good-looking solution! However, I realised that I need to use chessboard because it provides a more minimalistic chessboard (I am drawing infinite chessboards, so I can't really add too many details); I'll edit the question to clarify that I need a way to draw a piece with graphicx, in order to use it within that package.
    – davideleo
    Aug 14 '21 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.