2

I'm using xskak and chessboard to typeset a game. I would like to have a period after each move number such as "1. e4" rather than just "1 e4" How can I achieve this with xskak and chessboard? My current output and MWE are shown below

Here is the MWE for this game:

\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{5mm}
\usepackage{xskak}
\usepackage{chessboard}
\begin{document}
\begin{preview}
\newchessgame
\mainline{1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6 6. Be3 e6
7. g4 e5 8. Nf5 g6 9. g5}\\
\chessboard[label=False]
\end{preview}
\end{document}

Thanks!

3 Answers 3

2

I had to dig into the documentation. On page 44 it talks about creating your own style, which they called test. So I took their name and changed the colors.

\documentclass[12pt]{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{5mm}
\usepackage{xskak}
\usepackage{chessboard}
\begin{document}
\xskaknewstyleitem[%
template=UF,%a predefined style item
beforenumber=\color{black},%
whiteopen=.\,\color{black},
blackopen=\ldots\,\color{black}]{rednumbers}
\xskakaddtostyle[%
level=10,
styleitem=rednumbers,
level=12,
font=\def\beforenumber{\color{black}}\bfseries]
{test}
\begin{preview}
\newchessgame
\mainline[style=test,level=12]{1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3  a6 6. Be3 e6
7. g4 e5 8. Nf5 g6 9. g5}\\
\chessboard[label=False]
\end{preview}
\end{document}

This is the output in Gummi (click on picture to enlarge). enter image description here

4
  • all this color commands are not really necessary, black is the default color. Apr 28, 2019 at 7:29
  • Thanks! From the documentation it looks like "level" corresponds to the variation level, is that right? The example right after the one you modeled after has level=gobbleB,styleitem=gobblecomments, do you know what that means? Apr 28, 2019 at 7:38
  • Are there other templates or do we always choose UF? Apr 28, 2019 at 7:41
  • The documentation says, page 47, five styles: A , B, C, UF, and test. Whichever style suits you best. Looks like "level" corresponds to variation level but Ulricke Fischer would know for sure.
    – DJP
    Apr 28, 2019 at 13:06
3

You can simply use the style UF:

\documentclass{article}
\usepackage{xskak}
\usepackage{chessboard}
\begin{document}
\xskakset{style=UF}
\newchessgame
\mainline{1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6 6. Be3 e6
7. g4 e5 8. Nf5 g6 9. g5}\\
\chessboard[label=False]
\end{document}

enter image description here

2
  • The documentation needs some updating with complete working MWEs like what you have above. The examples I found on page 6 and 8 didn't compile because of missing style files. The code snippets (eg page 15) that had periods after numbers in output weren't helping because, it seems, there was no \xskakset in the snippet.
    – DJP
    Apr 28, 2019 at 13:32
  • @DJP if you find errors, add an issue at github.com/u-fischer/xskak, (there is no code yet, I just open the repo there). Apr 28, 2019 at 14:00
0

Using the notation \styleA to pag. 12 of the documentation of skak package: (The \styleA will switch the typesetting to the way it has been the standard in Denmark and — I believeGermany.)

\documentclass{article}
\usepackage[ps]{skak}
\usepackage{parskip}
\notationoff
\styleA
\showmoverOn
\begin{document}
\newgame
\mainline{1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3  a6 6. Be3 e6
7. g4 e5 8. Nf5 g6 9. g5}
\storegame{game1}
\[ \showboard \]
\end{document}

you have "a period after each move number such as "1. e4"" with a comma.

enter image description here

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.