2

Killer chess training gives out worksheets like https://p8e5c7t2.rocketcdn.me/wp-content/uploads/2021/03/Friendly-Homework-23-%E2%80%93-2021-03-23.pdf every week.

They ask students to do three things:

  1. Mark weaknesses with green squares (alternate: mark with circle)
  2. Mark the worst placed piece(s) on both sides with yellow squares (alternate: mark with square)
  3. Indicate the opponent’s idea with red arrows

Is there a latex package for marking up chess diagrams in this way?

2 Answers 2

2

There are multiple latex packages to produce chess boards (diagrams) most comprehensive is chessboard by Ulrike Fischer with numerous options (but it doesn't work with RTL languages). Start from there, everything you've described is in that package. if not satisfied try mpchess (works fine with RTL languages) Browse the documentation first the illustrations will show you what you need.

2

One option is to use the xskak package which loads and extends the skak package while also loading the chessboard package.

Overleaf has a great tutorial with examples, as well as links to examples in the documentation for the referenced packages. Works with both FEN and PGN notation.

Replacing \showboard with \chessboard will add a marker to the right of the diagram indicating if it is White to move or Black to move. Turn this off with \chessboard[showmover=false].

Additional features:

Example using xskak:

Be sure to include \usepackage{xskak} in the preamble.

% Example (works with both skak and xskak packages)
% Preamble
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[papersize={8.5in,11in},margin=1in]{geometry}
\usepackage{xskak}

% Document
\begin{document}

Figure~\ref{fig:startpos} shows the starting position.

\begin{figure}[h!]   % example use with figure
    \centering
    \newgame
    \chessboard % instead of \showboard
    \caption{Starting position for a game of chess.}
    \label{fig:startpos}
\end{figure}

For example White may choose to lead with the King's pawn fighting for central squares with \mainline{1. e4}.  

Black responds with \mainline{1...e5} also seeking to grab central space.

Play proceeds with \mainline{2. Nf3 Nf6 3. Nxe5}.

\begin{center}
    \chessboard  % no need for LaTeX figure 
\end{center}

% Showcase use of FEN
\newpage
\section*{Mate in 2}
\noindent Notes:  White to move. 

\section*{Galitsky A}
\newgame
\fenboard{6R1/2pk4/8/8/4QK2/8/8/8 w - - 0 1}
\chessboard

\section*{Kolodnas Z}
\newgame
\fenboard{8/4P1Q1/3k4/8/3K4/8/8/8 w - - 0 1}
\chessboard[showmover=false]  % remove move indicator

\newpage
% Position source: https://lichess.org/wFLCholu
\chessboard[setfen=2rq1r1k/pb3pp1/1p6/b2PP3/3pB3/P7/1PQ2PPP/R1B2RK1 w - - 0 18,
            pgfstyle=border,
            markfields={h7,a5},
            color=blue!50,
            colorbackfield=b2,
            pgfstyle=color,
            opacity=0.5,
            color=red,
            markfield={a5},
            color=green,
            markfield={c2}]
\end{document}

Output:

Example xskak package output using LaTeX code.

Example xskak package output using LaTeX code.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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