0

I want to use skak/chessboard to make the diagram of a problem. This accomplishes what I want:

\documentclass{article}
\usepackage{skak,chessboard}

\begin{document}

\newgame
\def\myfen{8/R7/1R6/6k1/8/5K2 w}
\chessboard[setfen=\myfen]
            
\movecomment{1. Ra5 Kh4}
            
\newgame
\def\myfen{8/8/1R6/R7/7k/5K2 w}
\chessboard[setfen=\myfen]

\end{document}

But I would have preferred to use \mainline, instead of \movecomment, after the first diagram so that I don't have to type the new FEN position after every move. I understand that \mainline expects a new game (and that's why a get an error if I use it). Is there any other way to represent some position and its following moves when they're not part of a game?

1 Answer 1

2

You should be using the xskak package, not the skak package for more functionality. Then adapt Ulrike Fischer's answer here to your problem:

\documentclass{article}
\usepackage{xskak,chessboard}

\begin{document}

\newgame
\def\myfen{8/R7/1R6/6k1/8/5K2 w}
\newchessgame[setfen=\myfen,moveid=16w]
\chessboard

\mainline{16. Ra5+ Kh4} 

\chessboard        
\end{document}

The result running in Gummi is: enter image description here

The documentation for xskak, which is an extension of the skak package can be found here on CTAN.

2
  • Thank you, this works very well (I had not seen Fischer's answer). The only thing I'd say is that I need to assume some arbitrary move number. Since this is a problem, not part of a game, I think I could simply change your 16 for 1, and let (in my example) Ra5+ be move 1.
    – oscar231
    Nov 10, 2020 at 21:05
  • 1
    Correct. Change to moveid=1w and then start in mainline with 1.
    – DJP
    Nov 10, 2020 at 22:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .