Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am hoping to use Skak to typeset my chess notes, and as part of the learning process, I decided to typeset a page from a chess book I own. I got as far as the following before I stumbled.

\documentclass[10pt,twocolumn]{article}

\usepackage{skak}   

\begin{document}

\begin{center}
    \textbf{Botvinnik -- Smyslov} \\
    \textit{World Championship Match (17)} \\
    \textit{Moscow 1957} \\
    Gr\"{u}nfeld Defence
\end{center}

\newgame
\styleC

\mainline{ 1. Nf3 Nf6 2. g3 g6 3. c4 c6 4. Bg2 Bg7 5. Nc3 O-O 6. d4 d5 7. cxd5 cxd5 8. Ne5 b6}

A satisfactory way of developing.  After \variation{8... Nc6 9. Nxc6 bxc6} Black would be saddled with a weak pawn at c6.

\mainline{9. Bg5 Bb7 10. Bxf6 Bxf6 11. O-O}

In the variation \variation{11. e4 dxe4 12. Nxe4 Bxe5 13. dxe5 Nd7 14. f4 Nc5} Black has a good game.

\mainline{11... e6 12. f4}

If \variation{12. e4 Nc6 13. exd5 Nxe5 14. dxe5 Bxe5 15. dxe6 Bxg2 16. exf7+ Rxf7 17. Kxg2 Bxc3 18. bxc3 Qxd1 19. Rfxd1 Rc8 20. Rd3 Rc4}, and Black can successfully battle for a draw in the rook ending.

\end{document}

I would like to insert the variation (13. Nxc6 Bxc6 14. exd5 exd5) between the half-moves 13. exd5 and 13...Nxe5 of the last line. My first attempt was to use \variations within \variations, but that failed due to a discrepancy in move counts. Then I tried to be clever and spent some time playing with convoluted \hidemoves and \restoregame tricks, but still no luck. Any suggestion as to how I can typeset nested variations?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

Try xskak. Be aware that in xskak mainline/variation are handled diffently than in skak. In xskak \mainline is used for moves which should be parsed (where you want to show a board) while \variation is used for moves which are only printed. Both commands can print their moves in "main style" and "variation style" and so you have to be careful with grouping and keys to get the correct style.

\documentclass[10pt,twocolumn]{article}

\usepackage{xskak}

\begin{document}

\begin{center}
    \textbf{Botvinnik -- Smyslov} \\
    \textit{World Championship Match (17)} \\
    \textit{Moscow 1957} \\
    Gr\"{u}nfeld Defence
\end{center}

\newchessgame
\xskakset{style=styleC}

\mainline{1. Nf3 Nf6 2. g3 g6 3. c4 c6 4. Bg2 Bg7 5. Nc3 O-O 6. d4 d5 7. cxd5
cxd5 8. Ne5 b6}

A satisfactory way of developing.  After {\variation[invar]{8... Nc6 9. Nxc6
bxc6}} Black would be saddled with a weak pawn at c6.

\mainline{9. Bg5 Bb7 10. Bxf6 Bxf6 11. O-O}

In the variation {\variation[invar]{11. e4 dxe4 12. Nxe4 Bxe5 13. dxe5 Nd7
14. f4 Nc5}} Black has a good game.

\mainline{11... e6 12. f4}

If {\variation[invar]{12. e4 Nc6 13. exd5} (\variation[invar]{13. Nxc6 Bxc6
14. exd5 exd5}) \variation[outvar]{13... Nxe5 14. dxe5 Bxe5 15. dxe6 Bxg2 16.
exf7+ Rxf7 17. Kxg2 Bxc3 18. bxc3 Qxd1 19. Rfxd1 Rc8 20. Rd3 Rc4}}, and Black
can successfully battle for a draw in the rook ending.

\end{document}
share|improve this answer
    
Thank you very much for the answer, and also for writing packages xskak and chessboard. I am sure I will need to use chessboard once I start typesetting notes on corresponding squares. –  Michael Wijaya Nov 21 '10 at 15:49
    
There are even more chess related packages available which might be of interest to you. Go to the CTAN website and search on the term "chess". –  DJP Aug 12 '11 at 5:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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