I'm new in LaTeX and I've been trying to write chess moves on it.
All was good until this big problem I got after I've written this of line chess moves, extracted from a game of Chess played by Botvinnik, I didn't understand and I can't solve it. One more detail: it is NOT from the begining of the game, but nearly the twentieth move.
\documentclass[a4paper, 11pt]{report}
\usepackage[left=3cm, right=3cm, top=3cm, bottom=3cm]{geometry}
\usepackage{skak}
\begin{document}
\mainline{1. Nb2 Rc3 \, 2. Bd2 Rb3 \, 3. Qc2 Qb5 \, 4. Rc1 Bf8 \, 5. Rd1 Re2 \, 6. Qc1
Rxh3+ ! \, 7. gxh3 d4 0--1}
\showboard
\end{document}
Here's the error message :
! Undefined control sequence.
<argument> \MoveFrom
l.132 ...e2 \, 6. Qc1 Rxh3+ ! \, 7. gxh3 d4 0--1}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
Any help will be welcome.
Thanks
Best Answer
As Ulrike Fisher suggested in a comment, something was missing in the code: the first moves of the game.
skak
can follow the moves from the beginning as if was playing and print the chessboard at the final state as well. Additionally, you can set the chessboard by putting every single piece on its own square and then print it with some relevant moves and comments aside with the written moves. For those purpouses,xskak
is an improved version of the package, since corrects some bugs detected and adds some other features (see xskak: An extension to the package skak)When displaying only move games, you must write them from the beginning or, from some move to finish.
I did both in the code. First column is the complete game with all the moves (I retrieved the information on Stolberg vs. Botvinnik game). Here
xskak
plays the game -as Fisher said-, and returns the final possition with\chessboard
command.Second column is what you were pretending. But in this case -since
xskak
does not know how to interpret the last 7 moves of a game without preamble and middle game, would place pieces in positions that could overlap each other on every square-, you needed to write a command to tellxskak
to forget first moves and displays last ones by typing\xskakset{defaultmoveid=35w}
(p.28, CTAN xskak), and then you can settle by hand the pieces on the chessboard with the final positions if you want.Your code generated two errors, one because of the last moves written and second, due to
0--1
at the end of\mainline{...}
(this one caused the errorThe control sequence ... was never \def'ed
). You should write the keyresult=0--1
inside\newchessboard
and call it after\mainline{...}
with\xskakgetgame{result}
. There is no need to put\,
to separate moves within this environment.