# How to draw chessboards in ConTeXt?

I wonder which module you can use to draw chessboards in ConTeXt. When I was using LaTeX, skak is fine but now I a bit stuck.

In LaTeX the code looks like:

\documentclass{minimal}
\usepackage{skak}

\begin{document}
\newgame
\mainline{1.b4 b6} \\
\showboard
\end{document}

• I don't think that there is a chess module for context (and I certainly don't plain to write one). – Ulrike Fischer Nov 28 '18 at 19:31

AFAIK, there isn't any package dedicated to chess. Depending on what you want, you can actually piggyback on skak:

\usemodule[filter]

\defineexternalfilter
[chess]
[filter=pdflatex,
output=\externalfilterbasefile.pdf,
purge=no,
bufferbefore=chessbefore,
bufferafter=chessafter,
]

\startbuffer[chessbefore]
\documentclass{minimal}
\usepackage{skak}
\usepackage[active,tightpage]{preview}

\begin{document}
\begin{preview}
\newgame
\hidemoves{
\stopbuffer

\startbuffer[chessafter]
}
\showboard
\end{preview}
\end{document}
\stopbuffer

\starttext
\startchess
1. b4 b6
\stopchess

\stoptext


which gives

• wow, context using latex to get something working ;-). But I guess it wouldn't work in a context standalone, or can context find an existing texlive? Btw: you are missing the rank numbers. – Ulrike Fischer Nov 29 '18 at 17:55
• @UlrikeFischer: Not sure why the rank numbers got cropped. Either preview package in LaTeX or \startTEXpage in ConTeXt is being too aggressive. Regarding context standalone finding texlive, that depends on the path. One can pass a PATH setup to the filter command (at least on linux) to make sure everything works. Even without munging with the path, simply calling pdflatex usually works as long as pdflatex does not call a binary that is provided by context standalone (e.g., bibtex). – Aditya Nov 29 '18 at 22:30
• the number are cropped as they are not inside the bounding box. You need to setup some border (this would be easier with chessboard, it has keys for this). – Ulrike Fischer Nov 29 '18 at 22:51