# Defining a new style in xskak

I am experimenting with the various styles for displaying \mainline chess moves and observed that \styleC displays moves as a column of two half-moves per line. Ulrike Fischer informed me that the display width used in \styleC is \linewidth (which of course it would be unwise to tamper with) and suggested the alternative of creating my own style, call it \styleD. Locating skak.sty in my MiKTeX2.9 distribution I located one block with one reference and another block with 2 references to \styleC, pasted these blocks into the preamble section of my document and renamed the three occurences of \styleC to read \styleD (not bothering at this stage to change the definition itself). My MWE (or should I call it Minimal Not-Working Example?) thus created won't compile, with error undefined control sequence \styleD:

\documentclass[10pt]{article}
\usepackage{xskak}
%following code pasted from xskak.sty with a view to redefining \styleC to my own \styleD (suggested by Ulrike Fischer 20 Feb 13):
\xskaknewstyleitem[%
opencommands={\begin{tabbing}%
\hspace{.2\linewidth}\=\hspace{.2\linewidth}\=%
\hspace{.2\linewidth}\= \kill},
closecommands={\end{tabbing}},
blackopen=\>\ldots,
beforenumber=\>,
beforewhite=\>,
beforeblack=\>,
afterblack=\\]{styleD}
%
\xskaknewstyle[level= 1,styleitem=styleD,font=\bfseries,
level= 2,styleitem=styleB,
level= 3,font=\itshape]{styleD}
%end of \typeD definition.
%
\begin{document}
\newchessgame
\styleC
\textbf{styleC}\\
\mainline{1.e4 c5 2.Nf3 Nc6 3.Bc4 Bc5 4.c3 Nf6 5.d3}%
\newchessgame
\styleD
\textbf{styleD}\\
\mainline{1.e4 c5 2.Nf3 Nc6 3.Bc4 Bc5 4.c3 Nf6 5.d3}%
\end{document}


I am doing something wrong, but what is it?

-
Styles in xskak are set with keys: \mainline[style=styleD] or \xskakset{style=styleC}. The commands \styleA etc are from skak.sty (which is loaded by xskak). They are independent from the style-system of xskak. –  Ulrike Fischer Feb 22 '13 at 8:44
@Ulrike ... so how do I invoke styleD in my document? –  Reinhard Neuwirth Feb 22 '13 at 10:35
As I wrote in my comment: with xskakset. –  Ulrike Fischer Feb 22 '13 at 10:39
1. Simply replace the 0.2\linewidth by e.g. 3cm. 2. If you mean the move number: whiteopen. Check section "An user interface for styles". There is an example which shows where all the commands are inserted. –  Ulrike Fischer Feb 22 '13 at 11:46
"Warum in die Ferne schweifen, wenn das Gute liegt so nah?". The section I mentioned is naturally in the documentation of xskak. –  Ulrike Fischer Feb 23 '13 at 9:49
Styles in xskak are set with keys: \mainline[style=styleD] or \xskakset{style=styleC}. The commands \styleA etc are from skak.sty (which is loaded by xskak). They are independent from the style-system of xskak.
The documentation of xskak contains a section "An user interface for styles" which describes how to adapt the styles of xskak.