2

I am learning how to use the package "chessboard". I would like to typeset chessboards' black squares as solid grey rather than as the default diagonal lines, because

  • I find the lines a bit distracting
  • I can control the shade of grey and thus make my own choice of compromise between "so dark, figurines on black squares are hard to recognise" and "so pale, black squares are hard to see"

This is fine but only works with chessboard's default figurine font, Merida:

\documentclass[a4paper]{article}
\usepackage[LSBC4,T1]{fontenc} % use fontenc before chessboard
\usepackage{chessboard}

\setboardfontencoding{LSBC4}

\setchessboard{
boardfontfamily=alpha % futile; still uses Merida
}

\makeatletter
\setboardfontcolors{blackfieldmask=gray!40}
\makeatother

\begin{document}
\setchessboard{setfen=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR}
\chessboard
\end{document}

I can change the figurine font if I use encoding LSB or LSF, but then that enforces the "diagonal lines regime":

\documentclass[a5paper]{article}
\usepackage[LSB,T1]{fontenc} % use fontenc before chessboard
\usepackage{chessboard}

\setboardfontencoding{LSB}

\setchessboard{
boardfontfamily=alpha
}

\begin{document}
\setchessboard{setfen=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR}
\chessboard
\end{document}

Any way to select a font and also have the solid grey "black" squares? Rather tantalisingly, Ulrike Fischer's document "The chess fonts gallery" (June 2006), p.3, shows Alpha both on "lined" and on grey "black" squares, although in the latter case the white figurines' interiors are transparent, whereas they should be white (look at white figurines on black squares).

6

The board encodings with a "C" in their name needs special glyphs for the color effects (e.g. field masks and piece masks). These encodings only works with rather sophisticated, complete chess fonts.

For a rather simple font like alpha you can't use the encoding. The only thing that works there is to color the board through the background pgf picture.

A similar font with more glyphs is alphadia. For this font LSBC4 works.

For both variants you need the files in the enpassant package. With miktex you can install the package with the miktex console. But with texlive you will have to install them manually as texlive doesn't ship them.

\documentclass[a4paper]{article}
\usepackage[LSB2,LSBC4,T1]{fontenc} % use fontenc before chessboard
\usepackage{chessboard}

\begin{document}
\setchessboard{setfen=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR}
\chessboard[
 boardfontfamily=alpha,
 boardfontencoding=LSB2,
 color=gray!40,
 trimtocolor=black,
 colorbackboard]

\setchessboard{setfen=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR}
\setboardfontcolors{blackfieldmask=gray!40}
\chessboard[
 boardfontfamily=alphadia,
 boardfontencoding=LSBC4,
 ]


\end{document}

enter image description here

1
  • I use Miktex, and your solution worked automatically; I didn't have to install anything manually.
    – Rosie F
    Aug 14 '18 at 20:40

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.