[Tex/LaTex] Chess diagramm with arrows in skak, xskak


How can I draw arrows on a chess game?

For example, if the game starts with 1. e4 …, I want to draw a black arrow from e2 to e4 to show the movement, and, in the same diagram, two red arrows from e4 to f5, and another from e4 to d5, to show the pawn attacking the squares.

Following game works for me. I'd like to find additional highlighting possibilities. For example, for educational purposes, an arrow between the knight in f6 to the squares being attacked by it.



\mainline{1. e4 e5 2. Nf3 Bc5}


Best Answer

I followed the documentation of the xskak package, especially pages 35 and 36, and this is what I've got.

%! *latex mal-chess.tex
  {\equal{#1}{N}}%knight move
    {\equal{#1}{}}% castling
\hidemoves{1. e4 e5 2. Nf3 Bc5}%
%\chessboard[setfen=\xskakgetgame{initfen}]% Show me the empty board.
\chessboard[pgfstyle=\mymovestyle, color=blue,
  markmoves=\xskakget{move}, pgfshortenend=0.3em, arrow=to, coloremph, color=red, markstyle=circle, markfield=\xskakget{movefrom},
  emphfields=\xskakget{moveto}, setfen=\xskakget{nextfen}]
  }% End of \xskakloop...