3

Can we customize \variation command to suppress display of move numbers ? \variation{1. e4} should display e4 (without the move number). Can this be done ?

I should have explained the problem more clearly. I'm talking about the \variation command which is part of xskak package, to display chess moves. I can customize the \variation command using beforenumber, whiteopen, blackopen etc. What ever I do, the final output displays the move number. Also, \variation{e4} is invalid as \variation command expects the move number. So, my question is, can we customize \variation command to not display the move number in the final output (along the lines of beforenumber etc).

Here's an MWE

\documentclass{book}
\usepackage{xskak}

\begin{document}
\newchessgame\mainline{1. e4 e5} \variation{2. Nf3}
\end{document}

\variation{Nf3} is an invalid statement. But I do not want 2. in the output.

0

3 Answers 3

5

You can define a \variationNM command in the same vein as \variation:

\documentclass{book}
\usepackage{xskak}
\makeatletter
\newcommand{\variationNM}[1][]{%
 \setkeys[UFXS]{print}{#1}%
 \begingroup\catcode`\#=12 \@variationNM}
\def\@variationNM#1{\endgroup
  \gdef\NumberNext{\False}%
  \gdef\AfterBlack{\False}%
  \gdef\PrintMoves{\False}%
  \gdef\ExecuteMoves{\False}%
  \gdef\StoreLastMove{\False}%
  {\variationstyle\opencommands%
   \variationmovemode
   \Mainline(#1 Z )%
   \closecommands}}
\makeatother

\begin{document}
\newchessgame\mainline{1. e4 e5} \variationNM{Nf3}
\end{document}

enter image description here

1
  • Yup. Thats exactly what i'm looking for. Thanks.
    – Surya
    Oct 18, 2013 at 19:08
0

If the usage can be a bit different, there is very simple solution:

\documentclass{article}

\begin{document}

\def\variation#1.{}

\variation1.e4
\variation11. e4-e5

\end{document}

That gives e4 e4-e5 etc., simply eating the number.

Otherwise the definition is more complicated:

\def\variation#1{\def\pomin##1.##2.{##2}\pomin#1.}

with the usage

\variation{12. e6}
\variation{13. e7}

and the desired result.

1
  • Although it works, This is not what I'm looking for. I've edited the question which explains the issue I'm facing.
    – Surya
    Oct 18, 2013 at 6:59
0

@Surya, here is an example:

\documentclass[10pt,twocolumn]{article}
\title{xskak Dua Kolom}
\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}
\[ \showboard \]
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}
1
  • This does not suppress the variation numbers as requested. Jan 28, 2014 at 9:40

You must log in to answer this question.

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