3

I'm using the skak package to write and comment a chess match.

Trouble occurs when you use the command \variation to analyze the possible consequences to vary the move 15. This MWE code generates an error if i uncomment the commented lines (lines 16 and 17), but i want to type this explanation.

The command \variation already has been used before (in the code) without problems.

Here my code

\documentclass{minimal}
\usepackage{skak}
\begin{document}
\newgame
\noindent\mainline{1.e4 c6 2.d4 d5 3.Nd2 dxe4 4.Nxe4 Nd7 5.Ng5 Ngf6 6.Bc4 e6 7.Qe2 Nb6 8.Bb3 h6 9.N5f3 c5} (\variation{9...a5}) \mainline{10.Bf4 Bd6 11.Bg3 Qe7}
(it's also possible \variation{11...Qc7} and \variation{11...O-O})
\mainline{12.dxc5 Bxc5 13.Ne5 Bd7 14.Ngf3 Nh5}
(no \variation{14...O-O-O 15.Nxf7 Qxf7 16.Qe5}).\\
\begin{center}
\showboard
\end{center}
\styleC
\mainline{15.O-O-O Nxg3}
Change this move by \variation{15...O-O-O} allows 
%\variation{16.Nxd7 Nxd7 17.Bc5!}
%and if \variation{17...Nxe5?!}, then \variation{18.Nxe5 Nf4 19.Qc4}, giving an advantage.
\mainline{16.hxg3 O-O-O}
\end{document}

As I said before if i uncomment the lines get an error message like this

[]

! mainline: 16 is not the correct move number. ...: 16 is not the correct move number}

l.15 \variation{16.Nxd7 Nxd7 17.Bc5!}

This error message was generated by an \errmessage command, so I can't give any explicit help.

Thanks for your help!

3
  • I'm almost sure that this code worked in a previous version of skak package but i don't remember which was.
    – skpblack
    Jul 27 '14 at 2:07
  • In the current skak \variation "plays" the moves too (so that longmoves works) and so move numbers are important. If you want to continue a variation you will have to use one of the continuation commands (in your case \continuevariationcurrent) see refman.pdf. xskak hasn't this problem as variations are no played (and it has more possibilities to play more than one game). Jul 27 '14 at 10:36
  • @UlrikeFischer i'm modifying the code to use your package xskak, the commands are a bit different.
    – skpblack
    Jul 27 '14 at 15:35
2

If you change skak to xskak it works fine.

\listfiles
\documentclass{minimal}
\usepackage{xskak}
\begin{document}
\newgame
\noindent\mainline{1.e4 c6 2.d4 d5 3.Nd2 dxe4 4.Nxe4 Nd7 5.Ng5 Ngf6 6.Bc4 e6 7.Qe2 Nb6 8.Bb3 h6 9.N5f3 c5} (\variation{9...a5}) \mainline{10.Bf4 Bd6 11.Bg3 Qe7}
(it's also possible \variation{11...Qc7} and \variation{11...O-O})
\mainline{12.dxc5 Bxc5 13.Ne5 Bd7 14.Ngf3 Nh5}
(no \variation{14...O-O-O 15.Nxf7 Qxf7 16.Qe5}).\\
\begin{center}
\showboard
\end{center}
\styleC
\mainline{15.O-O-O Nxg3}
Change this move by \variation{15...O-O-O} allows \variation{16.Nxd7 Nxd7 17.Bc5!}
\mainline{16.hxg3 O-O-O}

%and if \variation{17...Nxe5?!}, then \variation{18.Nxe5 Nf4 19.Qc4}, giving an advantage.
\end{document}

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.