I can't for the life of me figure out a proper way to handle NAGs (Numeric Annotation Glyphs) and/or Chess Informant symbols with xskak.
I'm writing a document where I'm handling a lot of variations, so I'm staying away from \newchessgame and \mainline for the most part and putting everything in \variation{}s.
\documentclass{article}
\usepackage{xskak,mathtools,xspace}
\def\invar#1{{\variation[invar]{#1}}}
\def\onlymovesymbol{\ensuremath{\square}}
\def\onlymove{\xskakcomment{\onlymovesymbol}\xspace}
\def\onlymoveNAG{$7}%$ stop highlighting, Emacs+AUCTeX!
\begin{document}
\variation{1.e4 e5 2.Nf3 Nc6 3.Bc4 Nf6 4.Ng5 d5\onlymove 5.Nxe4}
\variation{%
1.e4 e5 2.Nf3 Nc6 3.Bc4 Bc5 4.c3 Nf6 5.d4 exd4 6.cxd4 Bb4+ 7.Nc3 Nxe4
8.O-O Nxc3 9.bxc3 d5}
\iffalse %This doesn't even compile:
\invar{9... Bxc3 10.Qb3 d5\onlymove 11.Bxd5 O-O}
\fi
\end{document}
If one compiles this the square shows up in the first variation, but "5 Nxe4" is printed without the figurine for the "N".
Am I correct in assuming that NAGs only work when xskak actually parses the moves (i.e. only with \mainline{})?
If that's the case, I can't see how I won't have to use \xskakcomment. I know I'm doing something wrong, but I can't for the life of me decipher how one is supposed to accomplish this.
PS: For those who use Emacs + AUCTeX and find this question by searching. Look at the options beginning with LaTeX-verbatim. You can consider adding \mainline, \variation[invar] and \variation[outvar] to the list of verbatim macros with delimiters if you want to use NAGs without AUCTeX spilling the colour for maths mode all over your buffer.

\def\subv{\variation[invar]{}} \def\endsubv{\variation[outvar]{}}used like this:\variation{<stuff>} \subv \variation{<other stuff>} \endsubv. Ugly, but it kind of works. At least until you get three nested levels of variations (e.g. if you're GM Robert Hübner :D) – kahen May 02 '14 at 16:48{\variation[invar]{moves} blah blah explanation \variation{more moves}}. It just doesn't look right that a subvariation starts withinvarbut continues without it. I find that it makes it harder for me to verify that I've written what I wanted. – kahen May 03 '14 at 18:34\variationcommand, this would only be possible with printing commands completly under the control ofxskak(like\printchessgame). But you can use braces:{\variation[invar]{..}}. You can also define commands which changes the levels like this:\newcommand\invar{\xskakset{invar}}\newcommand\outvar{\xskakset{outvar}}– Ulrike Fischer May 04 '14 at 09:22