summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/chessboard
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/chessboard
Initial commit
Diffstat (limited to 'macros/latex/contrib/chessboard')
-rw-r--r--macros/latex/contrib/chessboard/README.md60
-rw-r--r--macros/latex/contrib/chessboard/UF-chessboard-documentation.sty220
-rw-r--r--macros/latex/contrib/chessboard/brett.jpgbin0 -> 53569 bytes
-rw-r--r--macros/latex/contrib/chessboard/chessboard-skakps.pdfbin0 -> 15603 bytes
-rw-r--r--macros/latex/contrib/chessboard/chessboard-skakps.tex19
-rw-r--r--macros/latex/contrib/chessboard/chessboard.dtx5134
-rw-r--r--macros/latex/contrib/chessboard/chessboard.ins73
-rw-r--r--macros/latex/contrib/chessboard/chessboard.pdfbin0 -> 633492 bytes
-rw-r--r--macros/latex/contrib/chessboard/chessboard.tex3735
-rw-r--r--macros/latex/contrib/chessboard/chessboard_and_beamer.pdfbin0 -> 67241 bytes
-rw-r--r--macros/latex/contrib/chessboard/chessboard_and_beamer.tex31
-rw-r--r--macros/latex/contrib/chessboard/file.fen1
12 files changed, 9273 insertions, 0 deletions
diff --git a/macros/latex/contrib/chessboard/README.md b/macros/latex/contrib/chessboard/README.md
new file mode 100644
index 0000000000..e3db967201
--- /dev/null
+++ b/macros/latex/contrib/chessboard/README.md
@@ -0,0 +1,60 @@
+# chessboard --- A package to print chessboards
+Packageversion: 1.8 Ulrike Fischer 2019
+Packagedate: 2019-06-23
+
+## LICENSE
+LaTeX Project Public License
+
+
+## CHANGES
+1.8: no longer uses \arabic to avoid problems with pages which redefine it.
+ Added source of documentation.
+1.7: chessboard no longer loads amssymb (to avoid clashes)
+1.6: Corrected some bugs. Added textfont key for text style.
+1.5: Corrected some bugs.
+ Added key getpiecelists.
+ Adapted the package to xskak.
+1.4: changed the code so that it work with xkeyval 2.5
+1.3a: corrected a small bug
+1.3:A lot of the pgf-code have been rewritten and extended.
+
+
+## CONTENTS AND INSTALLATION
+
+- README.md (this file)
+- chessboard.dtx
+- chessboard.ins
+- chessboard.pdf
+
+The best is to install chessboard with the package manager of your texsystem.
+
+For manual installation compile the .ins file. This will create chessboard.sty, chessboard-keys-main.sty
+chessboard-keys-pgf.sty and chessboard-pgf.sty.
+Move the four .sty in <texmf>/tex/latex/chessboard/ and update the filename
+database. Put chessboard.pdf in doc/latex/chessboard/
+
+
+The dtx-file doesn't contain any documentation.
+So running LaTeX on it makes no sense!
+
+
+## DOCUMENTATION
+
+chessboard.pdf. There isn't a source for the documentation as it use some
+local fonts and styles.
+
+## DESCRIPTION
+
+This package offers commands to print chessboards. It can print partial boards,
+hide pieces and fields, color the boards and put various marks on the board.
+It has a lot of options to place pieces on the board. Using exotic pieces e.g. for
+fairy chess is possible.
+It can be used together with the newest version (1.4) of the skak package
+which you can find at CTAN and together with xskak.
+
+
+## REQUIREMENTS
+chessboard uses some primitives of e\TeX. It needs a recent version
+of chessfss and xkeyval. It also needs the packages xifthen, tikz, pgfcore and pgfbaseshapes (from the pgf bundle),
+and - if run with latex - pst-node (from pstricks).
+
diff --git a/macros/latex/contrib/chessboard/UF-chessboard-documentation.sty b/macros/latex/contrib/chessboard/UF-chessboard-documentation.sty
new file mode 100644
index 0000000000..eec0e064ea
--- /dev/null
+++ b/macros/latex/contrib/chessboard/UF-chessboard-documentation.sty
@@ -0,0 +1,220 @@
+\ProvidesFile{UF-xskak-documentation.sty}[2008/01/09 local style for documentations]
+\DeclareOption{codemargin}{\AtEndOfPackage{%
+ \advance\oddsidemargin by 0.5in\relax
+ \advance\marginparwidth by 1in\relax}}
+\ProcessOptions
+\newcommand\filetype[1] {\upshape\texttt{#1}} %e.g. \filetype{.pdf}
+\newcommand\programm[1] {\upshape\textsf{#1}} %e.g. \programm{afm2tfm}
+\newcommand\chessfontname[1]{\upshape\textsf{#1}} %e.g. chessfontname{maya}
+\newcommand\konzept[1] {\upshape\textsf{#1}} %e.g. \konzept{nfss}
+\newcommand\packagename[1] {\upshape\textsf{#1}}
+
+\newcommand\skaksty{the package \packagename{skak}\xspace}
+\newcommand\Skaksty{The package \packagename{skak}\xspace}
+
+\newcommand\xskak{the package \packagename{xskak}\xspace}
+\newcommand\Xskak{The package \packagename{xskak}\xspace}
+
+\newcommand\chessfss{the package \packagename{chessfss}\xspace}
+\newcommand\Chessfss{The package \packagename{chessfss}\xspace}
+
+\newcommand\pchessboard{the package \packagename{chessboard}\xspace}
+\newcommand\Pchessboard{The package \packagename{chessboard}\xspace}
+
+
+\newcommand\mynobreakpar{\par\nobreak\@afterheading}
+\newcommand\key[1]{\texttt{#1}}
+\newcommand\obsoletekey[1]{\key{#1}\index{#1 (obsolete)}}
+\providecommand\gobble[1]{}
+\newcommand\keyoarg{\oarg{key=value list}}
+\newcommand\keymarg{\marg{key=value list}}
+\newcommand\keylist{\textit{key=value list}\xspace}
+\newcommand\keylists{\textit{key=value lists}\xspace}
+\newcommand\keyvalue{\textit{key=value}\xspace}
+
+\AtBeginDocument{%
+ \renewcommand*\lstlistlistingname{Examples}
+ \renewcommand*\lstlistingname{Example}
+}
+
+%
+\setcounter{secnumdepth}{4}
+\renewcommand{\theparagraph}{\alph{paragraph})}
+
+
+%% standard needed packages
+\RequirePackage[english]{babel}
+\RequirePackage{microtype}
+
+\RequirePackage{array}
+\RequirePackage{booktabs}
+\RequirePackage{xspace}
+\RequirePackage{ifluatex}
+
+%% fonts
+\ifluatex
+\else
+\RequirePackage[scaled=0.85]{luximono}
+\RequirePackage{fourier}
+\RequirePackage[scaled=0.86]{helvet}
+\fi
+%\addtokomafont{sectioning}{\rmfamily}
+\renewcommand*\descfont{\rmfamily\bfseries}
+
+%% colors
+\RequirePackage{xcolor}
+\colorlet{hellgelb}{yellow!15}
+
+
+% Quotes
+\RequirePackage[babel]{csquotes}
+\MakeAutoQuote {«}{»}
+
+
+%% index
+\RequirePackage{makeidx}
+\makeindex % number of columns set after doc
+
+\begin{filecontents}{\jobname.mst}
+actual '='
+quote '!'
+level '>'
+preamble
+"\n \\begin{theindex} \n \\makeatletter\\scan@allowedfalse\n"
+postamble
+"\n\n \\end{theindex}\n"
+item_x1 "\\efill \n \\subitem "
+item_x2 "\\efill \n \\subsubitem "
+delim_0 "\\pfill "
+delim_1 "\\pfill "
+delim_2 "\\pfill "
+% The next lines will produce some warnings when
+% running Makeindex as they try to cover two different
+% versions of the program:
+lethead_prefix "{\\bfseries\\hfil "
+lethead_suffix "\\hfil}\\nopagebreak\n"
+lethead_flag 1
+heading_prefix "{\\bfseries\\hfil "
+heading_suffix "\\hfil}\\nopagebreak\n"
+headings_flag 1
+%%
+%%
+\end{filecontents}
+
+
+%% codes and examples
+\begin{filecontents}{UFlstlocal.cfg}
+\ProvidesFile{UFlstlocal.cfg}[2005/07/01 lokale Listingsdefinitionen (UF)]
+
+\RequirePackage{xcolor}
+
+
+\colorlet{UFkeyscolor}{black}
+\colorlet{UFidentifiercolor}{black}
+\colorlet{UFcommentscolor}{red}
+\colorlet{UFstringcolor}{green!50}
+\colorlet{UFbackgroundcolor}{yellow!10}
+
+\lstdefinestyle{inline}{%
+ basicstyle=\ttfamily,
+ keywordstyle={}}
+
+
+\lstdefinestyle{UFdocu}{% mehr oder weniger kopiert aus showexpl.cfg
+ language=[LaTeX]TeX,%
+ float=hbp,%
+ basicstyle=\ttfamily,%
+ identifierstyle=\color{UFidentifiercolor},%
+ keywordstyle=\color{UFkeyscolor},%
+ stringstyle=\color{UFstringcolor},%
+ commentstyle=\itshape,%
+ columns=flexible,%
+ tabsize=4,%
+ frame=single,%
+ extendedchars=true,%
+ showspaces=false,%
+ showstringspaces=false,%
+ numbers=none,%
+ %numberstyle=\tiny\ttfamily,%
+ breaklines=true,%
+ breakindent=10pt,%
+ backgroundcolor=\color{UFbackgroundcolor},%
+ breakautoindent=true,%
+ captionpos=t,%
+ xleftmargin=1em,%
+ xrightmargin=\fboxsep,%
+ %numbersep=1em,%
+ breakatwhitespace=true,
+ preset=\raggedright\setlength{\parskip}{1ex},%
+ explpreset={numbers=none, basicstyle=\footnotesize\ttfamily},% ueberschreibt default
+ rframe={},% code ist im Rahmen
+ varwidth=true,% Breite des Beispiels
+ pos=o,
+ overhang=4em,%
+ literate={ü}{{\"u}}1{ö}{{\"o}}1{ä}{{\"a}}1
+}
+
+\lstdefinestyle{inline}{%
+ basicstyle=\ttfamily,
+ keywordstyle={}}
+
+\newcommand\mylstinline{\lstinline[style=inline]}
+
+\endinput
+%%
+%% End of file `UFlstlocal.cfg'.
+\end{filecontents}
+
+\RequirePackage[final]{showexpl}
+\input{UFlstlocal.cfg}
+\lstset{style=UFdocu}
+
+\newcommand\UFleftexamples{%
+\let\OriisSX@odd\isSX@odd
+\renewcommand*{\isSX@odd}[2]{##2}}
+
+\UFleftexamples
+
+\RequirePackage{doc}
+\def\meta@font@select{\rmfamily\itshape}
+\c@IndexColumns = 2
+\renewcommand\MacroFont{\scriptsize\ttfamily}
+\renewcommand\encapchar{ -- }
+% from ltxdoc.sty
+\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
+\providecommand\marg[1]{%
+ {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
+\providecommand\oarg[1]{%
+ {\ttfamily[}\meta{#1}{\ttfamily]}}
+\providecommand\parg[1]{%
+ {\ttfamily(}\meta{#1}{\ttfamily)}}
+
+
+%% pagestyle and layout
+\providecommand\UFcurrentpackage{unknown}
+\providecommand\UFcurrentversion{version unknown}
+
+\reversemarginpar
+
+\RequirePackage{fancyhdr}
+\pagestyle{fancy}
+
+\renewcommand\headrulewidth{0pt}
+\fancyhf{}
+\cfoot{\thepage}
+\lfoot{\today}
+\rfoot{\packagename{\UFcurrentpackage} \UFcurrentversion}
+
+
+%% captions
+\RequirePackage[tableposition=top]{caption}
+\captionsetup{singlelinecheck=false,format=hang,belowskip=1em}
+
+
+
+%% pdf-goodies:
+\RequirePackage{animate}
+\RequirePackage[colorlinks=true, %options are passed to hyperref
+ linkcolor=black,
+ hyperindex=true% true clashes with doc.sty
+ ]{attachfile}
diff --git a/macros/latex/contrib/chessboard/brett.jpg b/macros/latex/contrib/chessboard/brett.jpg
new file mode 100644
index 0000000000..aefa37bf2a
--- /dev/null
+++ b/macros/latex/contrib/chessboard/brett.jpg
Binary files differ
diff --git a/macros/latex/contrib/chessboard/chessboard-skakps.pdf b/macros/latex/contrib/chessboard/chessboard-skakps.pdf
new file mode 100644
index 0000000000..085b72199a
--- /dev/null
+++ b/macros/latex/contrib/chessboard/chessboard-skakps.pdf
Binary files differ
diff --git a/macros/latex/contrib/chessboard/chessboard-skakps.tex b/macros/latex/contrib/chessboard/chessboard-skakps.tex
new file mode 100644
index 0000000000..130a19c2bf
--- /dev/null
+++ b/macros/latex/contrib/chessboard/chessboard-skakps.tex
@@ -0,0 +1,19 @@
+% latex, dvips -E, epstopdf
+\documentclass[parskip]{scrartcl}
+\usepackage[T1]{fontenc}
+\usepackage[skaknew,ps]{skak}
+\usepackage[skaknew]{chessboard}
+
+\pagestyle{empty}
+\begin{document}
+\newgame
+\chessboard[psskak,psset,pgf=false,
+ inverse]
+\ifpdf\else
+\highlight[X]{c4}
+\highlight[o]{a8}
+\highlight[O]{g1}
+\printknightmove{g8}{f6}
+BM\pnode{A}\ncline{->}{A}{BM}
+\fi
+\end{document}
diff --git a/macros/latex/contrib/chessboard/chessboard.dtx b/macros/latex/contrib/chessboard/chessboard.dtx
new file mode 100644
index 0000000000..0ba57af48a
--- /dev/null
+++ b/macros/latex/contrib/chessboard/chessboard.dtx
@@ -0,0 +1,5134 @@
+%<*chessboard>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{chessboard}[2019/06/23 version v1.8 print chessboards]
+%%$Date: 2011/03/23 08:42:57 $$Version: 66142533647c $
+
+%1.4: Changed to restore style key
+%1.5: corrected values for mover key (w/b instead of w/s)
+%1.6: corrected bug in \board@do@getpiecelists (def instead of xdef)
+% 14.3.2011: added \normallineskip=1pt\relax\normallineskiplimit=0pt\relax
+% (default latex values).
+% to avoid bad spacing in amsart.cls (see tex.stackexchange discussion)
+\DeclareOption{skaknew}{}%
+\ProcessOptions
+
+\ifx\eTeXversion\@undefined
+ \PackageError{chessboard}
+ {This package may only be run using an\MessageBreak
+ etex in extended mode}
+ {Perhaps you forgot the `*' when making the format with (e)initex.}
+\fi
+
+\ifnum\eTeXversion<2
+ \PackageError{chessboard}
+ {This package requires e-TeX V 2}
+ {You are probably using the obsolete e-TeX V 1.}
+\fi
+
+\RequirePackage{chessfss}[2006/03/31]
+
+
+\RequirePackage{xkeyval}%
+\RequirePackage{xifthen}%
+\RequirePackage{ifpdf}%
+\RequirePackage{tikz}%
+\usepgfmodule{shapes}
+\ifpdf\else
+\RequirePackage{pst-node}%
+\fi
+\RequirePackage{etoolbox}
+%%%%%%%
+%% naming conventions
+%%%%%%%
+%% internal commands start with board@
+%% counters starts with cnt@board
+%% length starts with len@board
+%% xkeyval commands gets the prefix UFCB (for chess key)
+%% and the families gloinit/locinit, gloset/locset or glofill/locfill
+%% ARGEND is used to end/delimiters inputs
+%%%%%%%%
+
+%%%%
+%% New lengths
+%%%
+
+\newlength\len@board@tempx
+\newlength\len@board@tempy
+
+\newcommand\board@do@getsquaresize[1]{%#1=game
+ \cfss@getsquaresize{\csname board@#1@refpiece\endcsname}}
+
+\newcommand\board@do@globalgetsquaresize[1]{%#1=game
+ \cfss@globalgetsquaresize{\csname board@#1@refpiece\endcsname}}
+
+%% \settowidth{\global\len@cfss@squarewidth}{\csname board@#1@refpiece\endcsname}%
+%% \settodepth{\global\len@cfss@squaredepth}{\csname board@#1@refpiece\endcsname}%
+%% \settoheight{\global\len@cfss@squaretotalheight}{\raisebox{\depth}{\csname board@#1@refpiece\endcsname}}}%
+%%
+
+%%%
+%% New counters
+%%%
+
+%% counters for interating throught files and ranks
+%% Temporary counters, never rely on a value when not set at the start of the loop/command!
+\newcounter{cnt@board@file}%
+\newcounter{cnt@board@rank}%
+\newcounter{cnt@board}%
+
+%% User counters for printing the file and rank numbers.
+\newcounter{filelabel}%
+\renewcommand\thefilelabel{\alph{filelabel}}%
+\newcounter{ranklabel}%
+\renewcommand\theranklabel{\arabic{ranklabel}}
+
+%%%%%
+%% various tools
+%%%%%
+
+%% New setkeys command for inner keys, stolen from xkeyval.tex
+
+\def\board@do@setsinglekeys{\XKV@testopta{\XKV@testoptc\board@XKVsetsinglekeys}}%
+\def\board@XKVsetsinglekeys[#1]#2{%
+ \XKV@checksanitizea{#2}\XKV@resb
+ \let\XKV@naa\@empty
+ \XKV@for@o\XKV@resb\XKV@tempa{%
+ \expandafter\XKV@g@tkeyname\XKV@tempa=\@nil\XKV@tempa
+ \XKV@addtolist@x\XKV@naa\XKV@tempa}%
+ \expandafter\XKV@s@tkeys\expandafter{\XKV@resb}{#1}}%
+
+
+\newcommand\board@do@setsavedkey[2]{%#1 = argument (so that it can be better expanded)
+ % #2=key
+ \board@do@setsinglekeys*[UFCB]{locfill}{#2=#1}}%
+
+%%% local addto
+
+\newcommand{\board@do@l@addto@macro}[2]{%
+ \edef#1{\unexpanded\expandafter{#1#2}}}
+
+%%% alphabetic numbering with zero, adapted from latex.ltx
+
+\newcommand\zeroalph{}
+
+\def\zeroalph#1{\expandafter\@zeroalph\csname c@#1\endcsname}%
+
+\def\@zeroalph#1{%
+ \ifcase#1Z\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or
+ k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or
+ y\or z\else\@ctrerr\fi}%
+
+%% expanded @namedef
+\def\board@enamedef#1{\expandafter\edef\csname #1\endcsname}%
+
+%% new tests
+
+\newtest{\board@test@isonactivecolor}[2]{%filenr, ranknr b2={2}{2}
+ \(\board@test@iswhitefield{#1}{#2}
+ \AND
+ \boolean{UFCB@locfill@useonwhite}\)
+ \OR
+ \(
+ \(\NOT\board@test@iswhitefield{#1}{#2}\)
+ \AND
+ \boolean{UFCB@locfill@useonblack}\)}
+
+\newtest{\board@test@iswhitefield}[2]{%filenr, ranknr b2={2}{2}
+ \isodd{\number\numexpr #1+#2\relax}}
+
+\newtest{\board@test@isfieldintrimarea}[2]{%%filenr, ranknr
+ \NOT \(#1<\board@val@starttrimfilenum\) \AND
+ \NOT \(#1>\board@val@stoptrimfilenum\) \AND
+ \NOT \(#2>\board@val@starttrimranknum\) \AND
+ \NOT \(#2<\board@val@stoptrimranknum\)}
+
+\newtest{\board@test@isareaintrimarea}[4]{%%startfilenr, ranknr
+ %%stopfilenr, ranknr
+ \NOT \(#1<\board@val@starttrimfilenum\) \AND
+ \NOT \(#3>\board@val@stoptrimfilenum\) \AND
+ \NOT \(#2>\board@val@starttrimranknum\) \AND
+ \NOT \(#4<\board@val@stoptrimranknum\)}
+
+%%%%%
+%% converting commands
+%%%%%
+
+%%% command to get a (input) char from a number
+\newcommand*\board@conv@numbertochar[1]{{\uccode`!=#1\relax\uppercase{\gdef\board@temp@char{!}}}}%
+
+%% converts a filechar to a number and stores the value in counter #2
+%% in simple case use \number `#1
+\newcommand*\board@conv@filechartonumber[2]{%
+ \setcounter{#2}{\number`#1 }%
+ \ifthenelse
+ {\value{#2} = 90}%
+ % char =Z
+ {\addtocounter{#2}{-90}}%
+ {\ifthenelse
+ {\value{#2} >96 \AND \value{#2} <123}%
+ %char a-z
+ {\addtocounter{#2}{-96}}%
+ {\PackageError{chessboard}%
+ {Wrong field input}%
+ {chars for files should be Z (for zero) or between a-z}}}}%
+
+%% converts a char to the lower case (to set white and black pieces)
+\newcommand*\board@conv@chartolowerchar[1]{% #1 char
+ \setcounter{cnt@board}{\number`#1 }%
+ \ifthenelse
+ {\value{cnt@board} > 64 \AND \value{cnt@board} < 91}%
+ % char between A-Z
+ {\addtocounter{cnt@board}{+32}%
+ \board@conv@numbertochar{\the\c@cnt@board}}%
+ {\def\board@temp@char{#1}}}%
+
+%% converts a char to the upper case (to set white and black pieces)
+\newcommand*\board@conv@chartoupperchar[1]{% #1 char,
+ \setcounter{cnt@board}{\number`#1 }%
+ \ifthenelse
+ {\value{cnt@board} > 96 \AND \value{cnt@board} < 123}%
+ % char between a-z
+ {\addtocounter{cnt@board}{-32}%
+ \board@conv@numbertochar{\the\c@cnt@board}}%
+ {\def\board@temp@char{#1}}}%
+
+%%%%%
+%% splitting commands
+%%%%%
+
+%% split piece positions like Ka1, Qb3 or Rz20:
+%% use as \board@split@pieceposition Ka10ARGEND
+\def\board@split@pieceposition#1#2#3ARGEND{%
+ \edef\board@temp@curpiece{#1}%
+ \edef\board@temp@curfilechar{#2}%
+ \edef\board@temp@curranknum{\number#3}%
+ \board@conv@filechartonumber{#2}{cnt@board}%
+ \edef\board@temp@curfilenum{\the\value{cnt@board}}}%
+
+%% split fields like a1, b3 or z20:
+%% use as \board@split@field a1ARGEND
+\def\board@split@field#1#2ARGEND{%
+ \edef\board@temp@curfilechar{#1}%
+ \edef\board@temp@curranknum{\number#2}%
+ \board@conv@filechartonumber{#1}{cnt@board}%
+ \edef\board@temp@curfilenum{\the\value{cnt@board}}}%
+
+%% split area like a1-b3
+\def\board@split@area#1-#2ARGEND{%
+ \expandafter\board@split@field#1ARGEND%
+ \let\board@temp@curstartfilenum\board@temp@curfilenum
+ \let\board@temp@curstartranknum\board@temp@curranknum
+ \let\board@temp@curstartfilechar\board@temp@curfilechar
+ \edef\board@temp@curstartfield{\board@temp@curstartfilechar\board@temp@curstartranknum}%
+ \expandafter\board@split@field#2ARGEND%
+ \let\board@temp@curstopfilenum\board@temp@curfilenum
+ \let\board@temp@curstopranknum\board@temp@curranknum%
+ \let\board@temp@curstopfilechar\board@temp@curfilechar
+ \edef\board@temp@curstopfield{\board@temp@curstopfilechar\board@temp@curstopranknum}%
+ }%
+
+%% split and sorts areas like a1-b3
+\def\board@split@areasort#1-#2ARGEND{%
+ \expandafter\board@split@field#1ARGEND%
+ \let\board@temp@curstartfilenum\board@temp@curfilenum
+ \let\board@temp@curstartranknum\board@temp@curranknum
+ \let\board@temp@curstartfilechar\board@temp@curfilechar
+ \expandafter\board@split@field#2ARGEND%
+ \ifthenelse%
+ {\board@temp@curstartfilenum<\board@temp@curfilenum}%
+ {\let\board@temp@curstopfilenum\board@temp@curfilenum
+ \let\board@temp@curstopfilechar\board@temp@curfilechar}%
+ {\let\board@temp@curstopfilenum\board@temp@curstartfilenum
+ \let\board@temp@curstopfilechar\board@temp@curstartfilechar
+ \let\board@temp@curstartfilenum\board@temp@curfilenum
+ \let\board@temp@curstartfilechar\board@temp@curfilechar}%
+ \ifthenelse%
+ {\board@temp@curstartranknum>\board@temp@curranknum}%
+ {\let\board@temp@curstopranknum\board@temp@curranknum}%
+ {\let\board@temp@curstopranknum\board@temp@curstartranknum
+ \let\board@temp@curstartranknum\board@temp@curranknum}%
+ \edef\board@temp@curstartfield{\board@temp@curstartfilechar\board@temp@curstartranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curstopfilechar\board@temp@curstopranknum}%
+ }%
+
+\newcommand\board@do@cliparea[1]{%
+ \expandafter\board@split@areasort#1ARGEND%
+ \ifthenelse%
+ {\board@temp@curstartfilenum<\board@val@startprintfilenum}%
+ {\let\board@temp@curstartfilechar\board@val@startprintfilechar%
+ \let\board@temp@curstartfilenum\board@val@startprintfilenum}%
+ {}%
+ \ifthenelse%
+ {\board@temp@curstartranknum>\board@val@startprintranknum}%
+ {\let\board@temp@curstartranknum\board@val@startprintranknum}%
+ {}%
+ \ifthenelse%
+ {\board@temp@curstopranknum<\board@val@stopprintranknum}%
+ {\let\board@temp@curstopranknum\board@val@stopprintranknum}%
+ {}%
+ \ifthenelse%
+ {\board@temp@curstopfilenum>\board@val@stopprintfilenum}%
+ {\let\board@temp@curstopfilechar\board@val@stopprintfilechar
+ \let\board@temp@curstopfilenum\board@val@stopprintfilenum}%
+ {}%
+ \ifthenelse{\board@temp@curstopfilenum<\board@temp@curstartfilenum}%
+ {\edef\board@temp@curcliparea{}}%
+ {\ifthenelse{\board@temp@curstartranknum<\board@temp@curstopranknum}%
+ {\edef\board@temp@curcliparea{}}%
+ {\edef\board@temp@curcliparea{%
+ \board@temp@curstartfilechar\board@temp@curstartranknum-%
+ \board@temp@curstopfilechar\board@temp@curstopranknum}}}}
+
+%%% Making lists
+
+\newcommand\board@do@getfieldcolorlists{%
+ \setcounter{cnt@board@file}{\board@val@startprintfilenum}%
+ \def\board@val@blackfieldlist{}%
+ \def\board@val@whitefieldlist{}%
+ \whiledo%
+ {\value{cnt@board@file}< \numexpr\board@val@stopprintfilenum+1\relax}%
+ {\setcounter{cnt@board@rank}{\board@val@stopprintranknum}%
+ \whiledo%
+ {\value{cnt@board@rank}<\numexpr\board@val@startprintranknum + 1\relax}%
+ {\setcounter{cnt@board}{\numexpr \the\c@cnt@board@file+\the\c@cnt@board@rank\relax}%
+ \ifthenelse%
+ {\isodd{\value{cnt@board}}}
+ {\ifthenelse%
+ {\equal{\board@val@whitefieldlist}{}}%
+ {\edef\board@val@whitefieldlist{\zeroalph{cnt@board@file}\number\value{cnt@board@rank}}}%
+ {\edef\board@temp@curfield{\zeroalph{cnt@board@file}\number\value{cnt@board@rank}}%
+ \expandafter\board@do@l@addto@macro\expandafter\board@val@whitefieldlist\expandafter{\expandafter,\board@temp@curfield}}}%
+ {\ifthenelse%
+ {\equal{\board@val@blackfieldlist}{}}%
+ {\edef\board@val@blackfieldlist{\zeroalph{cnt@board@file}\number\value{cnt@board@rank}}}%
+ {\edef\board@temp@curfield{\zeroalph{cnt@board@file}\number\value{cnt@board@rank}}%
+ \expandafter\board@do@l@addto@macro\expandafter\board@val@blackfieldlist\expandafter{\expandafter,\board@temp@curfield}}}%
+ \addtocounter{cnt@board@rank}{1}}%
+ \addtocounter{cnt@board@file}{1}}}%
+
+%% getting the list of fields where pieces resides
+%% added 2007-12-11, version 1.5.
+%% the piecelists are stored in cblist<english! char of piece>
+
+\newcommand\board@do@getpiecelists{%
+ \setcounter{cnt@board@file}{\board@val@minfilenum}%
+ \setcounter{cnt@board@rank}{\board@val@minranknum}%
+ \edef\board@temp@curlist{%
+ \csname board@\board@val@game @piececharlist\endcsname}%
+ \@for\board@temp@piecechar:=\board@temp@curlist
+ \do {%
+ \expandafter\xdef\csname cblist\board@temp@piecechar\endcsname{}%
+ \expandafter\xdef\csname board@temp@\board@temp@piecechar @comma\endcsname{}}%
+ \xdef\cblistempty{}%
+ \def\board@temp@empty@comma{}%
+ \whiledo
+ {\value{cnt@board@file}<\numexpr \board@val@maxfilenum+1\relax}%
+ {\whiledo
+ {\value{cnt@board@rank}<\numexpr \board@val@maxranknum+1\relax}%
+ {\edef\board@temp@piecechar{%
+ \csname
+ board@val@f\the\c@cnt@board@file r\the\c@cnt@board@rank @piecechar\endcsname}%
+ \edef\board@temp@curlist{%
+ \csname cblist\board@temp@piecechar\endcsname}%
+ \edef\board@temp@comma{%
+ \csname board@temp@\board@temp@piecechar @comma\endcsname}%
+ \expandafter\xdef\csname cblist\board@temp@piecechar \endcsname{%
+ \board@temp@curlist
+ \board@temp@comma
+ \alph{cnt@board@file}\the\c@cnt@board@rank}%
+ \expandafter\def
+ \csname board@temp@\board@temp@piecechar @comma\endcsname
+ {,}%
+ \stepcounter{cnt@board@rank}}%
+ \setcounter{cnt@board@rank}{\board@val@minranknum}%
+ \stepcounter{cnt@board@file}}}
+
+
+
+%%splitting an FEN in pieces,
+%%% use as \board@split@fen <arg>X X X X X X ARGEND
+%%% or as \board@split@fen <arg> X X X X X X ARGEND
+\def\board@split@fen#1 #2 #3 #4 #5 #6 #7ARGEND{%
+ \def\board@val@position{#1}%
+ \ifthenelse{\equal{#2}{X}}%
+ {}%
+ {\def\board@val@mover{#2}}%
+ \ifthenelse{\equal{#3}{X}}%
+ {}%
+ {\def\board@val@castling{#3}}%
+ \ifthenelse{\equal{#4}{X}}%
+ {}%
+ {\def\board@val@enpassant{#4}}%
+ \ifthenelse{\equal{#5}{X}}%
+ {}%
+ {\def\board@val@halfmove{#5}}%
+ \ifthenelse{\equal{#6}{X}}%
+ {}%
+ {\def\board@val@fullmove{#6}}%
+ }%
+
+\input{chessboard-keys-main.sty}%
+\input{chessboard-keys-pgf.sty}%
+\input{chessboard-pgf.sty}
+
+%%% command to store the piece for a field
+%%% the input char of the piece is translated to english first
+%%% the char is stored in the command
+%%% board@val@f<filenum>r<ranknum>@piecechar
+
+\newcommand\board@do@storepieceonfield[3]{%#1 piece #2file #3 rank
+ \ifcsname board@val@lang\board@val@curlang @#1\endcsname
+ \expandafter\edef\csname board@val@f#2r#3@piecechar\endcsname{%
+ \csname board@val@lang\board@val@curlang @#1\endcsname}%
+ \else
+ \PackageError{chessboard}%
+ {Char #1 unknown in input language \board@val@curlang!}%
+ {You either misspelled the char for the piece or forgot to define it for the current language}%
+ \fi}%
+
+%%% Command to get the piece of a field. Don't know if needed
+
+\newcommand\board@do@getpieceoffield[2]{%#1 file, #2 rank
+ \@nameuse{board@val@f#1r#2@piecechar}}%
+
+%%% Commands to print (or not print) the piece of a field:
+
+%%% prints an empty field
+\newcommand\board@do@printfieldempty[2]{%fileNr, rankNr
+ \ifthenelse%
+ {\board@test@iswhitefield{#1}{#2}}%white field
+ {\@nameuse{board@\board@val@game @piece@empty@white}}%
+ {\@nameuse{board@\board@val@game @piece@empty@black}}}
+
+%%% the command to print the content of a single field
+\newcommand\board@do@printfieldcontent[2]{%% 1=fileNr 2=rankNr
+ \ifcsname board@val@f#1r#2@piecechar\endcsname
+ \ifthenelse{\board@test@iswhitefield{#1}{#2}}%white field
+ {\@nameuse{board@the@piece@\@nameuse{board@val@f#1r#2@piecechar}@white}}%
+ {\@nameuse{board@the@piece@\@nameuse{board@val@f#1r#2@piecechar}@black}}%
+
+%% {\@nameuse{board@\board@val@game @piece@\@nameuse{board@val@f#1r#2@piecechar}@white}}%
+%% {\@nameuse{board@\board@val@game @piece@\@nameuse{board@val@f#1r#2@piecechar}@black}}%
+ \else
+ \board@do@printfieldempty{#1}{#2}%
+ \fi}%
+
+%%% the command to print a fieldbox
+\newcommand\board@do@printfieldbox[2]{% 1=fileNr 2=rank
+ \def\board@temp@curfilenum{#1}%
+ \def\board@temp@curranknum{#2}%
+ \raisebox{\len@cfss@squaredepth}[\len@cfss@squaretotalheight][0pt]{%
+ \makebox[\len@cfss@squarewidth][r]{%
+ %% can be used to color only the piece in fonts with masks
+ % deleted 01.06.2006
+ %\def\cfss@piececolor{\csname board@val@f#1r#2@color\endcsname}%
+ %\csname board@val@f#1r#2@color\endcsname
+ \csname board@val@f#1r#2@emph\endcsname % eg. for color, bfseries
+ \makebox[\len@cfss@squarewidth]{%
+ \vphantom{\csname board@\board@val@game @refpiece\endcsname}%
+ \ifcsname board@the@f#1r#2\endcsname
+ \csname board@the@f#1r#2\endcsname
+ \else
+ \board@do@printfieldcontent{#1}{#2}%
+ \fi}}}}%
+
+%%% command to print a rank/row from firstfile to lastfile
+\newcommand\board@do@printrank[3]%#1 rank/rownumber #2 firstfile, #3 lastfile
+ {\begingroup
+ \ifUFCB@locset@labelleft
+ \board@do@printlabelleftfield{#1}%
+ \fi
+ \ifthenelse{#2<#3}%
+ {\setcounter{cnt@board@file}{#2}%% #2<#3: 1->n/normal
+ \whiledo%
+ {\value{cnt@board@file}<#3
+ \OR
+ \value{cnt@board@file}=#3}%
+ {\board@do@printfieldbox{\number\value{cnt@board@file}}{#1}%
+ \stepcounter{cnt@board@file}}}%
+ {\setcounter{cnt@board@file}{#2}%% #2>#3 n->1/inverse
+ \whiledo%
+ {\value{cnt@board@file}>#3
+ \OR
+ \value{cnt@board@file}=#3}%
+ {\board@do@printfieldbox{\number\value{cnt@board@file}}{#1}%
+ \addtocounter{cnt@board@file}{-1}}}%
+ \ifUFCB@locset@labelright
+ \board@do@printlabelrightfield{#1}%
+ \fi
+ \endgroup}%
+
+%%% command to hide /show a fields content:
+
+\newcommand*\board@do@showfield[2]{%
+ \@namedef{board@the@f#1r#2}{\board@do@printfieldcontent{#1}{#2}}}
+
+\newcommand*\board@do@showarea[1]{%
+ \expandafter\board@split@areasort#1ARGEND%
+ %% initialisation
+ \setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \setcounter{cnt@board@rank}{\board@temp@curstartranknum}%
+ %
+ \whiledo
+ {\value{cnt@board@rank}>\numexpr \board@temp@curstopranknum-1\relax}%
+ {\setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \whiledo
+ {\value{cnt@board@file}<\numexpr \board@temp@curstopfilenum+1\relax}%
+ {\board@do@showfield{\number\value{cnt@board@file}}{\number\value{cnt@board@rank}}%
+ \addtocounter{cnt@board@file}{1}%
+ }%
+ \addtocounter{cnt@board@rank}{-1}}}%
+
+\newcommand*\board@do@hidefield[2]{%
+ \@namedef{board@the@f#1r#2}{%
+ \board@do@printfieldempty{#1}{#2}}}
+
+\newcommand*\board@do@hidearea[1]{%
+ \expandafter\board@split@areasort#1ARGEND%
+ %% initialisation
+ \setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \setcounter{cnt@board@rank}{\board@temp@curstartranknum}%
+ %
+ \whiledo
+ {\value{cnt@board@rank}>\numexpr \board@temp@curstopranknum-1\relax}%
+ {\setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \whiledo
+ {\value{cnt@board@file}<\numexpr \board@temp@curstopfilenum+1\relax}%
+ {\board@do@hidefield{\number\value{cnt@board@file}}{\number\value{cnt@board@rank}}%
+ \addtocounter{cnt@board@file}{1}%
+ }%
+ \addtocounter{cnt@board@rank}{-1}}}%
+
+%% Command to hide a piece type
+
+\newcommand*\board@do@hidetype[1]{% char or empty
+ \ifthenelse%
+ {\equal{#1}{empty}}%
+ {\def\board@temp@char{empty}}%
+ {\board@do@strip #1 ARGEND}%
+ \ifcsname board@val@lang\board@val@curlang @\board@temp@char\endcsname
+ \edef\board@temp@curpiece{%
+ \csname board@val@lang\board@val@curlang @\board@temp@char\endcsname}%
+ \else
+ \PackageError{chessboard}%
+ {Char #1 unknown in input language \board@val@curlang!}%
+ {You either misspelled the char for the piece or forgot to define it for the current language}%
+ \fi
+ \@namedef{board@the@piece@\board@temp@curpiece @white}{%
+ \@nameuse{board@\board@val@game @piece@empty@white}}%
+ \@namedef{board@the@piece@\board@temp@curpiece @black}{%
+ \@nameuse{board@\board@val@game @piece@empty@black}}}%
+
+\newcommand*\board@do@hidetypelist[1]{% charlist
+ \@for\board@temp@char:=#1\do
+ {\expandafter\board@do@hidetype\expandafter{\board@temp@char}}}
+
+%% Command to show a piece type
+
+\def\board@do@strip #1#2ARGEND{\def\board@temp@char{#1}}
+
+\newcommand*\board@do@showtype[1]{% char or empty
+ \ifthenelse%
+ {\equal{#1}{empty}}%
+ {\def\board@temp@char{empty}}%
+ {\board@do@strip #1 ARGEND}%
+ \ifcsname board@val@lang\board@val@curlang @\board@temp@char\endcsname
+ \edef\board@temp@curpiece{%
+ \csname board@val@lang\board@val@curlang @\board@temp@char\endcsname}%
+ \else
+ \PackageError{chessboard}%
+ {Char #1 unknown in input language \board@val@curlang!}%
+ {You either misspelled the char for the piece or forgot to define it for the current language}%
+ \fi
+ \board@enamedef{board@the@piece@\board@temp@curpiece @white}{%
+ \noexpand\@nameuse{board@\noexpand\board@val@game @piece@\board@temp@curpiece @white}}%
+ \board@enamedef{board@the@piece@\board@temp@curpiece @black}{%
+ \noexpand\@nameuse{board@\noexpand\board@val@game @piece@\board@temp@curpiece @black}}}%
+
+\newcommand*\board@do@showtypelist[1]{% charlist
+ \@for\board@temp@char:=#1\do
+ {\expandafter\board@do@showtype\expandafter{\board@temp@char}}}
+
+%%% Clear area
+
+\newcommand\board@do@cleararea[1]{%
+ \expandafter\board@split@areasort#1ARGEND%
+ %% initialisation
+ \setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \setcounter{cnt@board@rank}{\board@temp@curstartranknum}%
+ %
+ \whiledo
+ {\value{cnt@board@rank}>\numexpr \board@temp@curstopranknum-1\relax}%
+ {\setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \whiledo
+ {\value{cnt@board@file}<\numexpr \board@temp@curstopfilenum+1\relax}%
+ {\board@do@storepieceonfield{empty}{\number\value{cnt@board@file}}{\number\value{cnt@board@rank}}%
+ \addtocounter{cnt@board@file}{1}}%
+ \addtocounter{cnt@board@rank}{-1}}}%
+
+%%%%%%
+%% Scanning a FEN (only the first part) to set the fields
+%%%%%%
+
+\def\@usenone@until@nil#1\@nil{}%
+
+\newcommand\board@scan@fen[1]{%
+ \setcounter{cnt@board@rank}{\board@val@startfenranknum}%
+ \setcounter{cnt@board@file}{\board@val@startfenfilenum}%
+ \expandafter\board@scan@fennext#1\relax\@nil}%
+
+\newcommand\board@scan@fennext[1]{%
+ \ifx#1\relax \expandafter\@usenone@until@nil \fi
+ \afterassignment\board@fork@feninput\count@ 0#1}%
+
+\newcommand\board@fork@feninput{%
+ \ifnum\count@=\z@
+ \expandafter\board@do@process@fenchar
+ \else
+ \expandafter\board@do@process@fennumber
+ \fi}%
+
+\newcommand\board@do@process@fennumber{%
+ \whiledo%
+ {\the\count@>0}%
+ {\ifthenelse%
+ {\(\value{cnt@board@file}>\board@val@startfillfilenum
+ \OR
+ \value{cnt@board@file}=\board@val@startfillfilenum\)
+ \AND
+ \(\value{cnt@board@file}<\board@val@stopfillfilenum
+ \OR
+ \value{cnt@board@file}=\board@val@stopfillfilenum\)
+ \AND
+ \(\value{cnt@board@rank}<\board@val@startfillranknum
+ \OR
+ \value{cnt@board@rank}=\board@val@startfillranknum\)
+ \AND
+ \(\value{cnt@board@rank}>\board@val@stopfillranknum
+ \OR
+ \value{cnt@board@rank}=\board@val@stopfillranknum\)}
+ {\board@do@storepieceonfield{empty}{\the\value{cnt@board@file}}{\the\value{cnt@board@rank}}}%
+ {}%
+ \addtocounter{cnt@board@file}{1}%
+ \advance\count@-1\relax}%
+ \board@scan@fennext}%
+
+\newcommand\board@do@process@fenchar[1]{%
+ \ifthenelse%
+ {\equal{#1}{/}}%
+ {\setcounter{cnt@board@file}{\board@val@startfenfilenum}% new row
+ \addtocounter{cnt@board@rank}{-1}}%
+ {\ifthenelse%
+ %{\value{cnt@board@file}>\board@val@stopfillfilenum}%
+ {\(\value{cnt@board@file}>\board@val@startfillfilenum
+ \OR
+ \value{cnt@board@file}=\board@val@startfillfilenum\)
+ \AND
+ \(\value{cnt@board@file}<\board@val@stopfillfilenum
+ \OR
+ \value{cnt@board@file}=\board@val@stopfillfilenum\)
+ \AND
+ \(\value{cnt@board@rank}<\board@val@startfillranknum
+ \OR
+ \value{cnt@board@rank}=\board@val@startfillranknum\)
+ \AND
+ \(\value{cnt@board@rank}>\board@val@stopfillranknum
+ \OR
+ \value{cnt@board@rank}=\board@val@stopfillranknum\)}
+ %
+ {\board@do@storepieceonfield{#1}{\the\value{cnt@board@file}}{\the\value{cnt@board@rank}}%
+ \addtocounter{cnt@board@file}{1}}%
+ {\addtocounter{cnt@board@file}{1}}%
+ }%
+ \board@scan@fennext}%
+
+%%% Command to add pieces
+
+\newcommand\board@do@addpieces[1]{% List
+ \@for\board@temp@curpiecepos:=#1\do
+ {\expandafter\board@split@pieceposition\board@temp@curpiecepos ARGEND%
+ \board@do@storepieceonfield{\board@temp@curpiece}{\board@temp@curfilenum}{\board@temp@curranknum}}}%
+
+\newcommand\board@do@addwhitepieces[1]{% List
+ \@for\board@temp@curpiecepos:=#1\do
+ {\expandafter\board@split@pieceposition\board@temp@curpiecepos ARGEND%
+ \expandafter\board@conv@chartoupperchar\board@temp@curpiece
+ \board@do@storepieceonfield{\board@temp@char}{\board@temp@curfilenum}{\board@temp@curranknum}}}%
+
+\newcommand\board@do@addblackpieces[1]{% List
+ \@for\board@temp@curpiecepos:=#1\do
+ {\expandafter\board@split@pieceposition\board@temp@curpiecepos ARGEND%
+ \expandafter\board@conv@chartolowerchar\board@temp@curpiece
+ \board@do@storepieceonfield{\board@temp@char}{\board@temp@curfilenum}{\board@temp@curranknum}}}%
+
+%%% Command to save fen
+
+%%% goes through board and get the fen description of the position
+
+\newcommand*\board@do@getposition{%
+ \setcounter{cnt@board@rank}{\board@val@startstoreranknum}%
+ \board@do@getrankposition{\value{cnt@board@rank}}%
+ \edef\board@val@position{\board@temp@currankposition}%
+ \whiledo%
+ {\value{cnt@board@rank}>\numexpr \board@val@stopstoreranknum\relax}%
+ {\addtocounter{cnt@board@rank}{-1}%
+ \board@do@getrankposition{\value{cnt@board@rank}}%
+ \edef\board@val@position{\board@val@position/\board@temp@currankposition}}}%
+
+\newcommand*\board@do@getrankposition[1]{%
+ \setcounter{cnt@board@file}{\board@val@startstorefilenum}%
+ \setcounter{cnt@board}{0}%
+ \edef\board@temp@currankposition{}%
+ \whiledo%
+ {\value{cnt@board@file}<\numexpr \board@val@stopstorefilenum+1\relax}%
+ {\ifthenelse%
+ {\equal{\csname board@val@f\the\c@cnt@board@file r#1@piecechar\endcsname}{empty}}%
+ {\stepcounter{cnt@board}}%
+ {\ifthenelse%
+ {\value{cnt@board}>0}%
+ {\edef\board@temp@currankposition{%
+ \board@temp@currankposition
+ \number\value{cnt@board}%
+ \csname board@val@f\the\c@cnt@board@file r\the\c@cnt@board@rank @piecechar\endcsname}%
+ \setcounter{cnt@board}{0}}%
+ {\edef\board@temp@currankposition{%
+ \board@temp@currankposition
+ \csname board@val@f\the\c@cnt@board@file r\the\c@cnt@board@rank @piecechar\endcsname}}}%
+ \addtocounter{cnt@board@file}{1}}%
+ \ifthenelse%
+ {\value{cnt@board}>0}%
+ {\edef\board@temp@currankposition{%
+ \board@temp@currankposition
+ \number\value{cnt@board}}}%
+ {}}%
+
+%% stores the fen in chessgame.<name> (as in skak.sty the \storegame command
+
+\newcommand*\board@do@storefen[1]{%
+ \def\board@temp@curfen{}%
+ \board@do@getposition
+ \edef\board@temp@curfen{\board@val@position\space
+ \board@val@mover\space
+ \board@val@castling\space
+ \board@val@enpassant\space
+ \board@val@halfmove\space
+ \board@val@fullmove}%
+ \expandafter\xdef\csname chessgame.#1\endcsname{\board@temp@curfen}}%
+
+%% stores the fen in a file, as in skak.sty the \savegame command
+\newcommand*\board@do@savefen[1]{%
+ \def\board@temp@curfen{}%
+ \board@do@getposition
+ \edef\board@temp@curfen{\board@val@position\space
+ \board@val@mover\space
+ \board@val@castling\space
+ \board@val@enpassant\space
+ \board@val@halfmove\space
+ \board@val@fullmove}%
+ \toks0=\expandafter{\board@temp@curfen}%
+ \immediate\openout0=#1.fen%
+ \immediate\write0{\the\toks0}%
+ \immediate\closeout0}%
+
+\newcommand*\board@do@loadfen[1]{%
+ \immediate\openin0=#1.fen\relax
+ \ifeof0
+ \PackageError{chessboard}{File #1.fen not found}{}%
+ \else
+ \immediate\read0 to \board@temp@curfen%
+ \fi
+ \immediate\closein0\relax}
+
+%%%%
+%% Decoration
+%%%%
+
+%%% the command to print the mover
+
+\newcommand\board@do@printtopmover{%
+ \raisebox%
+ {\dimexpr
+ \numexpr\board@val@startprintranknum-\board@val@stopprintranknum+1\relax\len@cfss@squaretotalheight
+ -\board@val@movertoplift
+ -\height
+ \relax}[0pt][0pt]%
+ {\makebox[0pt][l]{%
+ \hspace*{\board@val@movertopshift}%
+ \fontsize{\board@val@moversize}{\board@val@moversize}\selectfont
+ \ifthenelse%
+ {\equal{\board@val@mover}{w}}%
+ {\ifUFCB@locset@inverse
+ \board@val@moverwhitetop
+ \fi}%
+ {\ifUFCB@locset@inverse\else
+ \board@val@moverblacktop
+ \fi}}}}%
+
+\newcommand\board@do@printbottommover{%#1=color}
+ \raisebox%
+ {\board@val@moverbottomlift}[0pt][0pt]%
+ {\makebox[0pt][l]{%
+ \hspace*{\board@val@moverbottomshift}%
+ \fontsize{\board@val@moversize}{\board@val@moversize}\selectfont
+ \ifthenelse%
+ {\equal{\board@val@mover}{w}}%
+ {\ifUFCB@locset@inverse
+ \else
+ \board@val@moverwhitebottom
+ \fi}%
+ {\ifUFCB@locset@inverse
+ \board@val@moverblackbottom
+ \fi}}}}%
+
+\newcommand\cbDefineMoverStyle[6][]{%
+ % #1 can be used for checks
+ %#2name, #3=white top, #4=white bottom, #5=black top, #6=black bottom
+ \@namedef{board@val@moverstyle@#2}{%
+ #1\relax
+ \def\board@val@moverwhitetop{#3}%
+ \def\board@val@moverwhitebottom{#4}%
+ \def\board@val@moverblacktop{#5}%
+ \def\board@val@moverblackbottom{#6}}}%
+
+\cbDefineMoverStyle%
+ {circle}
+ {$\circ$}
+ {$\circ$}
+ {$\bullet$}
+ {$\bullet$}
+
+\cbDefineMoverStyle%
+ {square}
+ {\tikz \draw[color=black] (0,0) rectangle (0.65em,0.65em);}
+ {\tikz \draw[color=black] (0,0) rectangle (0.65em,0.65em);}
+ {\tikz \fill[color=black] (0,0) rectangle (0.65em,0.65em);}
+ {\tikz \fill[color=black] (0,0) rectangle (0.65em,0.65em);}
+
+\cbDefineMoverStyle%
+ {triangle}
+ {\tikz \draw[color=black] (0.6ex,0pt)--(0,1.25ex)--(1.2ex,1.25ex) --cycle;}
+ {\tikz \draw[color=black] (0.6ex,1.25ex)--(0,0)--(1.2ex,0) --cycle;}
+ {\tikz \fill[color=black] (0.6ex,0pt)--(0,1.25ex)--(1.2ex,1.25ex) --cycle;}
+ {\tikz \fill[color=black] (0.6ex,1.25ex)--(0,0)--(1.2ex,0) --cycle;}
+
+
+\cbDefineMoverStyle%
+ %#1: optional, can be used for checks
+ %#2=style name, #3=white top, #4=white bottom, #5=black top, #6=black bottom
+ [\@ifundefined%
+ {rotatebox}%
+ {\PackageError{chessboard}%
+ {You must load the package graphics or graphicx
+ if you want to use the mover style squarearrow}{}}%
+ {}%
+ \@ifundefined%
+ {ding}%
+ {\PackageError{chessboard}%
+ {You must load the package pifont
+ if you want to use the mover style squarearrow}{}}%
+ {}]
+ {squarearrow}% #2
+ {\rotatebox{-90}{$\square$\,\ding{222}}}%
+ {\rotatebox{90}{$\square$\,\ding{222}}}%
+ {\rotatebox{-90}{$\blacksquare$\,\ding{222}}}%
+ {\rotatebox{90}{$\blacksquare$\,\ding{222}}}%
+
+%%% the command to print the labels text
+
+\newcommand\board@do@printlabelleftfield[1]{%rank
+ \begingroup
+ \setcounter{ranklabel}{#1}%
+ \raisebox{\board@val@labelleftlift}[\len@cfss@squaretotalheight][0pt]{%
+ \makebox[0pt][r]{%
+ \makebox[\board@val@labelleftwidth][l]{%
+ \cfss@sidefont
+ \board@val@labelleftfont
+ \selectfont
+ \board@val@labelleftformat}}}%
+ \endgroup}%
+
+\newcommand\board@do@printlabelrightfield[1]{%rank
+ \begingroup
+ \setcounter{ranklabel}{#1}%
+ \raisebox{\board@val@labelrightlift}[\len@cfss@squaretotalheight][0pt]{%
+ \makebox[0pt][l]{%
+ \makebox[\board@val@labelrightwidth][r]{%
+ \cfss@sidefont
+ \board@val@labelrightfont
+ \selectfont
+ \board@val@labelrightformat}}}%
+ \endgroup}%
+
+\newcommand\board@do@printlabelbottomfield{%
+ \raisebox{-\board@val@labelbottomlift}[0pt][0pt]{\makebox[\len@cfss@squarewidth][c]{\board@val@labelbottomformat}}}%
+
+\newcommand\board@do@printlabeltopfield{%
+ \raisebox{\dimexpr\len@cfss@squaretotalheight+\board@val@labeltoplift\relax}[0pt][0pt]%
+ {\makebox[\len@cfss@squarewidth][c]{\board@val@labeltopformat}}}%
+
+\newcommand\board@do@printlabelbottom[2]{%#1 firstfile, #2 lastfile
+ \begingroup
+ \cfss@sidefont
+ \board@val@labelbottomfont
+ \selectfont
+ \makebox[0pt][r]{%
+ \setcounter{cnt@board@file}{#1}%
+ \whiledo%
+ {\board@print@sign\value{cnt@board@file}<\board@print@sign#2
+ \OR
+ \value{cnt@board@file}=#2}%
+ {\setcounter{filelabel}{\value{cnt@board@file}}%
+ \board@do@printlabelbottomfield%
+ \addtocounter{cnt@board@file}{\board@print@sign1}}}%
+ \endgroup}%
+
+\newcommand\board@do@printlabeltop[2]{%#1 firstfile, #2 lastfile
+ \begingroup
+ \cfss@sidefont
+ \board@val@labeltopfont
+ \selectfont
+ \makebox[0pt][l]{%
+ \setcounter{cnt@board@file}{#1}%
+ \whiledo%
+ {\board@print@sign\value{cnt@board@file}<\board@print@sign#2
+ \OR
+ \value{cnt@board@file}=#2}%
+ {\setcounter{filelabel}{\value{cnt@board@file}}%
+ \board@do@printlabeltopfield%
+ \addtocounter{cnt@board@file}{\board@print@sign1}}}%
+ \endgroup}%
+
+%%%%%
+%% highlighting
+
+%%% emphasize piece
+
+\newcommand\board@do@store@pieceemph[2]{%#1filenum, #2ranknum
+ \@ifundefined{board@val@pieceemph}%
+ {\def\board@val@pieceemph{}}%
+ {}%
+ \toks@=\expandafter{\board@val@pieceemph}%
+ \ifUFCB@locfill@coloremph
+ \@temptokena=\expandafter{\board@val@fontcolorstack}%
+ \board@enamedef{%
+ board@val@f#1r#2@emph}{%
+ \the\toks@\the\@temptokena}%
+ \else
+ \board@enamedef{%
+ board@val@f#1r#2@emph}{%
+ \the\toks@}%
+ \fi}%
+
+\newcommand\board@do@empharea[1]{%
+ \expandafter\board@split@areasort#1ARGEND%
+ %% initialisation
+ \setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \setcounter{cnt@board@rank}{\board@temp@curstartranknum}%
+ %
+ \whiledo
+ {\value{cnt@board@rank}>\numexpr \board@temp@curstopranknum-1\relax}%
+ {\setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \whiledo
+ {\value{cnt@board@file}<\numexpr \board@temp@curstopfilenum+1\relax}%
+ {\board@do@store@pieceemph{\number\value{cnt@board@file}}{\number\value{cnt@board@rank}}%
+ \addtocounter{cnt@board@file}{1}}%
+ \addtocounter{cnt@board@rank}{-1}}}%
+
+%%% border of board
+
+\newcommand\board@print@border{%
+ \raisebox{0pt}[0pt][0pt]{%
+ \makebox[0pt][r]{%bottom
+ \board@val@borderbottomcolor
+ \rule[-\board@val@borderbottomwidth]%
+ {\dimexpr
+ \ifUFCB@locset@borderleft
+ \board@val@borderleftwidth +
+ \fi
+ \numexpr\board@val@stopprintfilenum-\board@val@startprintfilenum+1\relax\len@cfss@squarewidth
+ \ifUFCB@locset@borderright
+ +\board@val@borderrightwidth
+ \fi
+ \relax}%
+ {\ifUFCB@locset@borderbottom\board@val@borderbottomwidth\else0pt\fi}%
+ \ifUFCB@locset@borderright
+ \hspace*{-\board@val@borderrightwidth}%
+ \fi}%
+ \makebox[0pt][r]{%left
+ \board@val@borderleftcolor
+ \rule[\ifUFCB@locset@borderbottom-\board@val@borderbottomwidth\else0pt\fi]%
+ {\ifUFCB@locset@borderleft
+ \board@val@borderleftwidth
+ \else
+ 0pt%
+ \fi}
+ {\dimexpr
+ \ifUFCB@locset@borderbottom\board@val@borderbottomwidth +\fi
+ \numexpr\board@val@startprintranknum-\board@val@stopprintranknum+1\relax\len@cfss@squaretotalheight
+ \ifUFCB@locset@bordertop
+ +\board@val@bordertopwidth
+ \fi
+ \relax}%
+ \hspace*{\numexpr\board@val@stopprintfilenum-\board@val@startprintfilenum+1\relax\len@cfss@squarewidth}%
+ }%
+ %%
+ \makebox[0pt][r]{%top
+ \board@val@bordertopcolor
+ \rule[\numexpr\board@val@startprintranknum-\board@val@stopprintranknum+1\relax\len@cfss@squaretotalheight]%
+ {\dimexpr
+ \ifUFCB@locset@borderleft
+ \board@val@borderleftwidth +
+ \fi
+ \numexpr\board@val@stopprintfilenum-\board@val@startprintfilenum+1\relax\len@cfss@squarewidth
+ \ifUFCB@locset@borderright
+ +\board@val@borderrightwidth
+ \fi
+ \relax}%
+ {\ifUFCB@locset@bordertop\board@val@bordertopwidth\else0pt\fi}%
+ \ifUFCB@locset@borderright
+ \hspace*{-\board@val@borderrightwidth}%
+ \fi}%
+ %%
+ \makebox[0pt][l]{%right
+ \board@val@borderrightcolor
+ \rule[\ifUFCB@locset@borderbottom-\board@val@borderbottomwidth\else0pt\fi]%
+ {\ifUFCB@locset@borderright
+ \board@val@borderrightwidth
+ \else
+ 0pt%
+ \fi}%
+ {\dimexpr
+ \ifUFCB@locset@borderbottom\board@val@borderbottomwidth +\fi
+ \numexpr\board@val@startprintranknum-\board@val@stopprintranknum+1\relax\len@cfss@squaretotalheight
+ \ifUFCB@locset@bordertop
+ +\board@val@bordertopwidth
+ \fi
+ \relax}%
+ }}}
+
+\newcommand\board@do@setpsnode{%
+ \ifpdf\else
+ \ifUFCB@locset@psset
+ \ifUFCB@locset@inverse
+ \pnode(%
+ \dimexpr -1.5\len@cfss@squarewidth +
+ \board@val@startprintfilenum\len@cfss@squarewidth\relax,
+ \dimexpr
+ \board@val@startprintranknum\len@cfss@squaretotalheight
+ -7.5\len@cfss@squaretotalheight\relax){BM}
+ \else
+ \pnode(%
+ \dimexpr 7.5\len@cfss@squarewidth
+ -\board@val@stopprintfilenum\len@cfss@squarewidth\relax,
+ \dimexpr
+ -\board@val@stopprintranknum\len@cfss@squaretotalheight
+ +1.5\len@cfss@squaretotalheight\relax){BM}
+ \fi
+ \fi
+ \fi}
+
+%%%%%%%
+%% the main commands
+%%%%%%
+
+%%% The command that holds saved keys
+
+\def\board@val@savedkeylist{@null=@null}%
+
+\newcommand\storechessboardstyle[2]{%#1 name, #2 key-list
+ \@namedef{board@val@style#1keylist}{#2}}%
+
+\newcommand\setchessboard[1]{%changed 2007-07-03
+ \def\board@temp@keylist{}%
+ \setkeys[UFCB]{@start}{board@expand={#1}}%
+ \toks@=\expandafter{\board@temp@keylist}%
+ \edef\board@temp@command{%
+ \noexpand\setkeys*[UFCB]{gloinit}{\the\toks@}}%
+ \board@temp@command
+ \setrmkeys*[UFCB]{gloset}%
+ \setrmkeys[UFCB]{glofill}}%
+
+\newcommand\chessboard[1][]{%
+ \begingroup
+ \normallineskip=1pt\relax\normallineskiplimit=0pt\relax%14.3.2011
+ \savekeys[UFCB]{locset}{\global{psset},\global{psskak},\global{inverse}}%
+%%% Initialisation
+%% combine the the global keys and the keys in argument
+ \let\board@temp@keylist\board@val@savedkeylist
+ \setkeys[UFCB]{@start}{board@expand={#1}}%
+ \toks@=\expandafter{\board@temp@keylist}%
+ \edef\board@temp@command{%
+ \noexpand\setkeys*[UFCB]{locinit}{\the\toks@}}%
+ \board@temp@command
+ %\show\XKV@rm
+ \expandafter\board@do@showtypelist\expandafter{\csname board@\board@val@game @piececharlist\endcsname,empty}%
+%% fills the board with the current position
+%% getting the fen of the current position with the fencalculate command of the current game:
+ \csname board@\board@val@game @do@fencalculate\endcsname
+%% saving the current language
+ \let\board@val@savelang\board@val@curlang
+%% setting the fen of the current position and saving it
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ language=english,
+ setfen=\board@val@fencalculate,
+ storefen=current,
+ language=\board@val@savelang}%
+ %\show\XKV@rm %test
+%% setting the set keys
+ \setrmkeys*[UFCB]{locset}%
+ \edef\printarea{%
+ \board@val@startprintfilechar\board@val@startprintranknum-%
+ \board@val@stopprintfilechar\board@val@stopprintranknum}%
+ \edef\board{%
+ \board@val@maxfilechar\board@val@maxranknum-%
+ \board@val@minfilechar\board@val@minranknum}%
+ \ifUFCB@locset@inverse
+ \gdef\board@print@sign{-}%
+ \else
+ \gdef\board@print@sign{}%
+ \fi
+%% to get the size of the fields
+ \ifUFCB@locset@psset
+ \expandafter\board@do@globalgetsquaresize\expandafter{\board@val@game}%
+ \else
+ \expandafter\board@do@getsquaresize\expandafter{\board@val@game}%
+ \fi
+%% switch to board font an set ex and em
+ \cfss@boardfont
+ \fontdimen5\font=0.5\len@cfss@squarewidth
+ \fontdimen6\font=\len@cfss@squarewidth
+%% initialisation of the pgf-pictures with the anchor and shifts
+ \board@pgf@init
+ \board@do@getfieldcolorlists
+%% setting the fill keys
+ % \show\XKV@rm %test
+ \setrmkeys[UFCB]{locfill}%
+%%% starting to print
+ \ifUFCB@locinit@print
+%% setting the default font colors
+ \board@val@boardfontcolors
+%% the left margin
+ \ifUFCB@locset@marginleft
+ \makebox[\board@val@marginleftwidth]{}%
+ \fi
+%% the background picture
+ \ifUFCB@locset@pgf
+ \makebox[0pt]{%
+ \begin{pgfpicture}%
+ \board@pgf@background
+ \begin{pgfscope}%
+ \board@pgf@extrabackground
+ \end{pgfscope}%
+ \end{pgfpicture}}%
+ \fi
+%% the board
+ \ifUFCB@locset@inverse
+ \setcounter{cnt@board@rank}{\board@val@stopprintranknum}% inv.
+ \parbox[b]{\numexpr\board@val@stopprintfilenum-\board@val@startprintfilenum+1\relax\len@cfss@squarewidth}%
+ {\parindent0pt\relax\baselineskip=\len@cfss@squaretotalheight\relax%
+ \nointerlineskip
+%% top margin
+ \ifUFCB@locset@margintop
+ \rule{0pt}{\dimexpr\len@cfss@squaretotalheight+\board@val@margintopwidth\relax}%
+ \fi
+ \ifUFCB@locset@labeltop
+ \board@do@printlabeltop{\board@val@stopprintfilenum}{\board@val@startprintfilenum}%
+ \fi
+%% the pieces and side labels
+ \whiledo
+ {\value{cnt@board@rank}<\numexpr\board@val@startprintranknum+1\relax}% inv
+ {\board@do@printrank%
+ {\number\value{cnt@board@rank}}%
+ {\board@val@stopprintfilenum}%
+ {\board@val@startprintfilenum}%
+ \hspace{0pt}%
+ \addtocounter{cnt@board@rank}{1}}%inv
+%% bottom label
+ \ifUFCB@locset@labelbottom
+ \board@do@printlabelbottom{\board@val@stopprintfilenum}{\board@val@startprintfilenum}%
+ \fi}% end parbox
+ \else %not inverse
+ \setcounter{cnt@board@rank}{\board@val@startprintranknum}%
+ \parbox[b]{\numexpr\board@val@stopprintfilenum-\board@val@startprintfilenum+1\relax\len@cfss@squarewidth}%
+ {\parindent0pt\relax\baselineskip=\len@cfss@squaretotalheight\relax%
+ \nointerlineskip
+%% top margin
+ \ifUFCB@locset@margintop
+ \rule{0pt}{\dimexpr\len@cfss@squaretotalheight+\board@val@margintopwidth\relax}%
+ \fi
+ \ifUFCB@locset@labeltop
+ \board@do@printlabeltop{\board@val@startprintfilenum}{\board@val@stopprintfilenum}%
+ \fi
+%% the pieces and side labels
+ \whiledo
+ {\value{cnt@board@rank}>\numexpr\board@val@stopprintranknum-1\relax}%
+ {\board@do@printrank%
+ {\number\value{cnt@board@rank}}%
+ {\board@val@startprintfilenum}%
+ {\board@val@stopprintfilenum}%
+ \hspace{0pt}%
+ \addtocounter{cnt@board@rank}{-1}}%
+%% bottom label
+ \ifUFCB@locset@labelbottom
+ \board@do@printlabelbottom{\board@val@startprintfilenum}{\board@val@stopprintfilenum}%
+ \fi}% end second parbox
+ \fi %end if inverse
+%%the markground picture
+ \ifUFCB@locset@pgf
+ \makebox[0pt]{%
+ \begin{pgfpicture}%
+ \board@pgf@markground
+ \begin{pgfscope}%
+ \csname board@pgf@extramarkground\endcsname
+ \end{pgfscope}%
+ \end{pgfpicture}}%
+ \fi % end pgf
+ \board@do@setpsnode
+ %%
+ % Border
+ %%%
+ \board@print@border
+ %% Mover
+ \ifUFCB@locset@showmover
+ \ifcsname board@val@moverstyle@\board@val@moverstyle\endcsname
+ \csname board@val@moverstyle@\board@val@moverstyle\endcsname
+ \else
+ \PackageWarning{chessboard}%
+ {Moverstyle '\board@val@moverstyle' is not defined, I will use
+ type square instead}%
+ \board@val@moverstyle@square
+ \fi
+ \board@do@printbottommover%
+ \board@do@printtopmover
+ \fi
+ %%
+ \ifUFCB@locset@marginbottom
+ \rule[-\board@val@marginbottomwidth]{0pt}{\board@val@marginbottomwidth}% bottom margin
+ \fi
+ \ifUFCB@locset@marginright
+ \makebox[\board@val@marginrightwidth]{}%right margin
+ \fi
+ \fi %end if print
+ \endgroup%% Attention! Keys after the group must be global!
+ \ifpdf
+ \else
+ \ifthenelse%
+ {\boolean{\XKV@UFCB@locset@psset@value}}%
+ {\psset{xunit=\len@cfss@squarewidth,yunit=\len@cfss@squaretotalheight}}%
+ {}%
+ \ifthenelse%
+ {\boolean{\XKV@UFCB@locset@psskak@value}}%
+ {\let\set@special@psmarkers\board@skak@set@special@psmarkers%
+ \@ifundefined{theps@inverse}{}{%
+ \ifthenelse%
+ {\boolean{\XKV@UFCB@locset@inverse@value}}%
+ {\setcounter{ps@inverse}{180}}%
+ {\setcounter{ps@inverse}{0}}}}%
+ {}%
+ \fi %end ifpdf
+ }% end chessboard
+
+%%% Changing the input language
+
+\newcommand\cbDefineLanguage[1]{%
+ \ifcsname board@val@lang#1\endcsname
+ \PackageWarning{chessboard}%
+ {Language #1 already defined}%
+ \else
+ \global\@namedef{board@val@lang#1}{}%
+ \global\@namedef{board@val@lang#1@empty}{empty}%
+ \fi}%
+
+\newcommand\cbDefineTranslation[3]{%#1 language, #2 english, #3 translation
+ \global\@namedef{board@val@lang#1@#3}{#2}}%
+
+\cbDefineLanguage{german}%
+\cbDefineTranslation{german}{K}{K}%
+\cbDefineTranslation{german}{Q}{D}%
+\cbDefineTranslation{german}{R}{T}%
+\cbDefineTranslation{german}{B}{L}%
+\cbDefineTranslation{german}{N}{S}%
+\cbDefineTranslation{german}{P}{B}%
+\cbDefineTranslation{german}{k}{k}%
+\cbDefineTranslation{german}{q}{d}%
+\cbDefineTranslation{german}{r}{t}%
+\cbDefineTranslation{german}{b}{l}%
+\cbDefineTranslation{german}{n}{s}%
+\cbDefineTranslation{german}{p}{b}%
+
+\cbDefineLanguage{english}%
+\cbDefineTranslation{english}{K}{K}%
+\cbDefineTranslation{english}{Q}{Q}%
+\cbDefineTranslation{english}{R}{R}%
+\cbDefineTranslation{english}{B}{B}%
+\cbDefineTranslation{english}{N}{N}%
+\cbDefineTranslation{english}{P}{P}%
+\cbDefineTranslation{english}{k}{k}%
+\cbDefineTranslation{english}{q}{q}%
+\cbDefineTranslation{english}{r}{r}%
+\cbDefineTranslation{english}{b}{b}%
+\cbDefineTranslation{english}{n}{n}%
+\cbDefineTranslation{english}{p}{p}%
+
+%%% command to add pieces to the list
+
+\newcommand\board@add@chartocolorpiececharlist[3]{% #1 game, #2 color, #3 char
+ \ifcsname board@#1@#2piececharlist\endcsname
+ \ifthenelse%
+ {\equal{\csname board@#1@#2piececharlist\endcsname}{}}
+ {\@namedef{board@#1@#2piececharlist}{#3}}
+ {\expandafter\g@addto@macro\csname board@#1@#2piececharlist\endcsname{,#3}}%
+ \else
+ \@namedef{board@#1@piececharlist}{#3}%
+ \fi}%
+
+\newcommand\board@add@chartopiececharlist[2]{% #1 game, #2 char
+ \ifcsname board@#1@piececharlist\endcsname
+ \ifthenelse%
+ {\equal{\csname board@#1@piececharlist\endcsname}{}}%
+ {\@namedef{board@#1@piececharlist}{#2}}%
+ {\expandafter\g@addto@macro\csname board@#1@piececharlist\endcsname{,#2}}%
+ \else
+ \@namedef{board@#1@piececharlist}{#2}%
+ \fi}%
+
+%%% Adding new pieces
+\newcommand\cbDefineNewPiece[5][skak]{%#1=optional=game, #2=color, #3=char, #4=on white, #5=on black
+ \ifcsname board@#1@piece@#3@white\endcsname
+ \PackageError{chessboard}{Piece #3 already defined!}{}%
+ \else
+ \board@add@chartocolorpiececharlist{#1}{#2}{#3}%
+ \board@add@chartopiececharlist{#1}{#3}%
+ \expandafter\gdef\csname board@#1@piece@#3@white\endcsname{#4}%
+ \expandafter\gdef\csname board@#1@piece@#3@black\endcsname{#5}%
+ \cbDefineTranslation{english}{#3}{#3}%
+ \fi}%
+
+%%% Adding new pieces
+\newcommand\cbReDefineNewPiece[5][skak]{%#1=optional=game, #2=color, #3=char, #4=on white, #5=on black
+ \ifcsname board@#1@piece@#3@white\endcsname
+ \else
+ \PackageWarning{chessboard}{Piece #3 not yet defined! I will define it now}{}%
+ \fi
+ \board@add@chartocolorpiececharlist{#1}{#2}{#3}%
+ \board@add@chartopiececharlist{#1}{#3}%
+ \expandafter\gdef\csname board@#1@piece@#3@white\endcsname{#4}%
+ \expandafter\gdef\csname board@#1@piece@#3@black\endcsname{#5}%
+ \cbDefineTranslation{english}{#3}{#3}}%
+
+%%% Initialization the piece commands.
+%% game: skak
+
+\newcommand\board@skak@piece@empty@white{\cfss@WhiteEmptySquare}%
+\newcommand\board@skak@piece@empty@black{\cfss@BlackEmptySquare}%
+\newcommand\board@skak@piece@K@white{\cfss@WhiteKingOnWhite}%
+\newcommand\board@skak@piece@K@black{\cfss@WhiteKingOnBlack}%
+\newcommand\board@skak@piece@k@white{\cfss@BlackKingOnWhite}%
+\newcommand\board@skak@piece@k@black{\cfss@BlackKingOnBlack}%
+\newcommand\board@skak@piece@Q@white{\cfss@WhiteQueenOnWhite}%
+\newcommand\board@skak@piece@Q@black{\cfss@WhiteQueenOnBlack}%
+\newcommand\board@skak@piece@q@white{\cfss@BlackQueenOnWhite}%
+\newcommand\board@skak@piece@q@black{\cfss@BlackQueenOnBlack}%
+\newcommand\board@skak@piece@R@white{\cfss@WhiteRookOnWhite}%
+\newcommand\board@skak@piece@R@black{\cfss@WhiteRookOnBlack}%
+\newcommand\board@skak@piece@r@white{\cfss@BlackRookOnWhite}%
+\newcommand\board@skak@piece@r@black{\cfss@BlackRookOnBlack}%
+\newcommand\board@skak@piece@B@white{\cfss@WhiteBishopOnWhite}%
+\newcommand\board@skak@piece@B@black{\cfss@WhiteBishopOnBlack}%
+\newcommand\board@skak@piece@b@white{\cfss@BlackBishopOnWhite}%
+\newcommand\board@skak@piece@b@black{\cfss@BlackBishopOnBlack}%
+\newcommand\board@skak@piece@N@white{\cfss@WhiteKnightOnWhite}%
+\newcommand\board@skak@piece@N@black{\cfss@WhiteKnightOnBlack}%
+\newcommand\board@skak@piece@n@white{\cfss@BlackKnightOnWhite}%
+\newcommand\board@skak@piece@n@black{\cfss@BlackKnightOnBlack}%
+\newcommand\board@skak@piece@P@white{\cfss@WhitePawnOnWhite}%
+\newcommand\board@skak@piece@P@black{\cfss@WhitePawnOnBlack}%
+\newcommand\board@skak@piece@p@white{\cfss@BlackPawnOnWhite}%
+\newcommand\board@skak@piece@p@black{\cfss@BlackPawnOnBlack}%
+
+\newcommand\board@skak@refpiece{%
+ \begingroup
+ \fontsize{\cfss@boardfontsize}{\cfss@boardfontsize}%
+ \BlackEmptySquare
+ \endgroup}%
+
+\newcommand\board@skak@piececharlist{K,Q,R,B,N,P,k,q,r,b,n,p}%
+\newcommand\board@skak@whitepiececharlist{K,Q,R,B,N,P}%
+\newcommand\board@skak@blackpiececharlist{k,q,r,b,n,p}%
+\AtBeginDocument{%
+ \@ifpackageloaded{skak}%
+ {%patch skak, see issue #1
+ \patchcmd\Fen@handleA{\arabic}{\number\value}{}{}%
+ \patchcmd\Fen@handleA{\arabic}{\number\value}{}{}%
+ \patchcmd\Fen@handleA{\thehelpgobble}{\c@helpgobble}{}{}%
+ \patchcmd\Fen@handleA{\thehelpgobble}{\c@helpgobble}{}{}%
+ \patchcmd\Fen@calculate{\arabic}{\number\value}{}{}%
+ \patchcmd\Fen@calculate{\arabic}{\number\value}{}{}%
+ \def\board@skak@do@fencalculate{%
+ \Fen@calculate
+ \let\board@val@fencalculate\temp@board}%
+ \def\board@skak@set@special@psmarkers#1#2{%
+ \get@translation#1%
+ \setcounter{fileFrom}{\value{fileTo}}%
+ \setcounter{rankFrom}{\value{rankTo}}%
+ \get@translation#2%
+ \rput(BM){\pnode(-\number\value{fileFrom},\number\value{rankFrom}){From}}%
+ \rput(BM){\pnode(-\number\value{fileTo},\number\value{rankTo}){To}}}}%
+ {\def\board@skak@do@fencalculate{%
+ \def\board@val@fencalculate{8/8/8/8/8/8/8/8}}}}%
+
+%%% Initialization keys
+
+\setkeys*[UFCB]{gloinit}{print,
+ game=skak,
+ maxfield=h8,
+ zero=false,
+ moverdefault=W,
+ castlingdefault=KQkq,
+ enpassantdefault=-,
+ halfmovedefault=0,
+ fullmovedefault=1}%
+
+\setkeys*[UFCB]{gloset}{normalboard,
+ inverse=false,
+ startprint=\board@val@minfilechar\board@val@maxranknum,
+ stopprint=\board@val@maxfilechar\board@val@minranknum,
+ padding=0pt,
+ psset=false,
+ psskak=false,
+ pgf,
+ %labels
+ labelleft,labelbottom,
+ labelfont={}, %defaults from chessfss used
+ hlabelformat=\arabic{ranklabel},
+ vlabelformat=\alph{filelabel},
+ hlabellift=0.35em,
+ hlabelwidth=1ex,
+ labelbottomlift=1.1\baselineskip,
+ labeltoplift=0.2\baselineskip,
+ %margin
+ margin,
+ marginwidth=1em,
+ border,
+ borderwidth=0.04em,
+ bordercolor=black,
+ %mover
+ showmover,
+ moversize=1em,%0.5\len@cfss@squaretotalheight,
+ moverstyle=square,
+ moverlift=0pt,
+ movershift=1ex,
+ }%
+
+\def\board@pgf@linewidth{0.1em}
+\def\board@pgf@arrow{latex}
+\def\board@pgf@colorbackpadding{0pt}
+\def\board@val@boardfontcolors{}
+\def\board@val@fontcolorstack{}
+\def\board@pgf@corner{0pt}
+\def\board@pgf@shortenstart{0pt}
+\def\board@pgf@shortenend{0pt}
+\def\board@pgf@padding{0pt}
+\setkeys[UFCB]{bez}{x1=1/3,x2=2/3,y1=1,y2=1,clockwise}
+\def\currentfontcolors{\board@val@fontcolorstack}
+\setkeys*[UFCB]{glofill}{language=english,trimtocolor=false,trimarea=\board,trim,usepgf=all,pgfstyle=none}%
+\board@do@setsinglekeys*[UFCB]{locfill}{language=english}%
+
+%</chessboard>
+%<*chessboard-pgf>
+\ProvidesFile{chessboard-pgf.sty}[2019/06/23 version v1.8 pgf code for chessboard.sty]
+%%$Date: 2011/01/11 14:07:20 $$Version: 3d9f59c743f1 $
+
+\newcommand\board@pgf@extrabackground{}%
+\newcommand\board@pgf@extramarkground{}%
+
+\newcommand\board@pgf@addbackground[1]{%#1 commands,
+ \expandafter\board@do@l@addto@macro\csname board@pgf@extrabackground\endcsname{#1}}%
+
+\newcommand\board@pgf@addmarkground[1]{%#1 commands
+ \expandafter\board@do@l@addto@macro\csname board@pgf@extramarkground\endcsname{#1}}%
+
+%% saving the markstyles with option
+
+\newcommand\board@do@savemarkstyle{%
+ \@ifnextchar[\board@do@savemarkstylewithopt\board@do@savemarkstylenoopt}%
+
+\def\board@do@savemarkstylewithopt[#1]#2ARGEND{%
+ \def\board@pgf@curstyleopt{#1}%
+ \def\board@pgf@curmarkstyle{#2}%added 2007.08.15
+ \board@pgf@addmarkground{%
+ \def\board@pgf@curmarkstyle{#2}%
+ \def\board@pgf@curstyleopt{#1}}}%
+
+\def\board@do@savemarkstylenoopt#1ARGEND{%
+ \def\board@pgf@curstyleopt{}%added 2007.08.15
+ \def\board@pgf@curmarkstyle{#1}%
+ \board@pgf@addmarkground{%
+ \def\board@pgf@curstyleopt{}%
+ \def\board@pgf@curmarkstyle{#1}}}%
+
+%% saving the backstyle with option
+\newcommand\board@do@savebackstyle{%
+ \@ifnextchar[\board@do@savebackstylewithopt\board@do@savebackstylenoopt}%
+
+\def\board@do@savebackstylewithopt[#1]#2ARGEND{%
+ \def\board@pgf@curstyleopt{#1}%
+ \board@pgf@addbackground{%
+ \def\board@pgf@curbackstyle{#2}%
+ \def\board@pgf@curstyleopt{#1}}}%
+
+\def\board@do@savebackstylenoopt#1ARGEND{%
+ \def\board@pgf@curbackstyle{#1}%
+ \board@pgf@addbackground{%
+ \def\board@pgf@curstyleopt{}%
+ \def\board@pgf@curbackstyle{#1}}}%
+
+%% init/start pgf commands
+
+\newcommand\board@pgf@clippath{}%
+
+\newcommand\board@pgf@setunits{%
+ \pgfsetxvec{\pgfpoint{\len@cfss@squarewidth}{0cm}}%
+ \pgfsetyvec{\pgfpoint{0cm}{\len@cfss@squaretotalheight}}%
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpointorigin}%
+ \pgfusepath{use as bounding box}}%
+
+\newcommand\board@pgf@addnode[2]{%#1= node name =field name, #2=mark or back
+ \expandafter\board@do@l@addto@macro\csname board@pgf@#2ground\endcsname{%
+ \pgfnode{coordinate}{center}{}{#1}{}{}%
+ \pgfusepath{fill}}}%
+
+\newcommand\board@pgf@gotonode[2]{% #1= node name =field name #2=mark or back
+ \expandafter\board@do@l@addto@macro\csname board@pgf@#2ground\endcsname{%
+ \pgftransformshift{\pgfpointanchor{#1}{center}}}}%
+
+\newcommand\board@pgf@setanchors[1]{% #1= mark or back
+ \setcounter{cnt@board@rank}{0}%
+ \setcounter{cnt@board@file}{0}%
+ \whiledo %nodes for files
+ {\value{cnt@board@file}<\numexpr\board@val@maxfilenum+1\relax}%
+ {\setcounter{cnt@board@rank}{0}%
+ \whiledo %nodes for on one field for each rank
+ {\value{cnt@board@rank}<\numexpr\board@val@maxranknum+1\relax}%
+ {\edef\board@temp{\zeroalph{cnt@board@file}\number\value{cnt@board@rank}}%
+ \expandafter\board@pgf@addnode\expandafter{\board@temp}{#1}%
+ \expandafter\board@do@l@addto@macro\csname board@pgf@#1ground\endcsname{%
+ \pgftransformshift{\pgfpointxy{0}{1}}}%
+ \addtocounter{cnt@board@rank}{1}}%
+ \edef\board@temp{\zeroalph{cnt@board@file}0}%
+ \expandafter\board@pgf@gotonode\expandafter{\board@temp}{#1}%
+ \addtocounter{cnt@board@file}{1}%
+ \expandafter\board@do@l@addto@macro\csname board@pgf@#1ground\endcsname{% one to the right
+ \pgftransformshift{\pgfpointxy{1}{0}}}}%
+ \expandafter\board@do@l@addto@macro\csname board@pgf@#1ground\endcsname{%
+ \csname board@pgf@#1clippath\endcsname}}%
+
+\newcommand\board@pgf@init{%
+ \def\board@pgf@background{%
+ \board@pgf@setunits
+ \ifUFCB@locset@inverse
+ \pgftransformshift{\pgfpointxy{\board@val@stopprintfilenum}{\board@val@startprintranknum}}%
+ \pgftransformshift{\pgfpointxy{0.5}{0.5}}%
+ \pgftransformrotate{180}%
+ \else
+ \pgftransformshift{\pgfpointxy{-\board@val@startprintfilenum}{-\board@val@stopprintranknum}}%
+ \pgftransformshift{\pgfpointxy{0.5}{0.5}}%
+ \fi}%
+ \board@pgf@setanchors{back}%
+ %
+ \def\board@pgf@markground{%
+ \board@pgf@setunits
+ \ifUFCB@locset@inverse
+ \pgftransformshift{\pgfpointxy{\board@val@startprintfilenum}{\board@val@startprintranknum}}%
+ \pgftransformshift{\pgfpointxy{-0.5}{0.5}}%
+ \pgftransformrotate{180}%
+ \else
+ \pgftransformshift{\pgfpointxy{-\board@val@stopprintfilenum}{-\board@val@stopprintranknum}}%
+ \pgftransformshift{\pgfpointxy{-0.5}{0.5}}%
+ \fi}%
+ \board@pgf@setanchors{mark}}%
+
+%% getting angles/length of a point:
+
+\newcommand\board@pgf@extractangle[2]{%#1 command, #2 pgfpoint
+ \pgfextracty{\len@board@tempy}{#2}%
+ \pgfextractx{\len@board@tempx}{#2}%
+ \ifdim\len@board@tempx=0pt\relax
+ %\len@board@tempy= 1 or unchanged?
+ \else
+ \divide \len@board@tempy by \strip@pt\len@board@tempx\relax
+ \fi
+ \ifdim\len@board@tempx=0pt\relax
+ \ifdim\len@board@tempy=0pt\relax
+ \def#1{0}%
+ \else
+ \ifdim\len@board@tempy>0pt\relax
+ \def#1{90}%
+ \else
+ \def#1{-90}%
+ \fi
+ \fi
+ \fi
+ \ifdim\len@board@tempy=0pt\relax
+ \ifdim\len@board@tempx=0pt\relax
+ \def#1{0}%
+ \else
+ \ifdim\len@board@tempx>0pt\relax
+ \def#1{0}%
+ \else
+ \def#1{180}%
+ \fi
+ \fi
+ \fi
+ \ifdim\len@board@tempx>0pt\relax
+ \ifdim\len@board@tempy>0pt\relax
+ \pgfmathatan{\len@board@tempy}%
+ \edef#1{\pgfmathresult}%
+ \fi
+ \ifdim\len@board@tempy<0pt\relax
+ \pgfmathatan{\len@board@tempy}%
+ \edef#1{\pgfmathresult}%
+ \fi
+ \fi
+ \ifdim\len@board@tempx<0pt\relax
+ \ifdim\len@board@tempy>0pt\relax
+ \pgfmathatan{-\len@board@tempy}%
+ \pgfmathadd{-\pgfmathresult}{180}%
+ \edef#1{\pgfmathresult}%
+ \fi
+ \ifdim\len@board@tempy<0pt\relax
+ \pgfmathatan{\len@board@tempy}%
+ \pgfmathadd{\pgfmathresult}{180}%
+ \edef#1{\pgfmathresult}%
+ \fi
+ \fi
+ }
+
+
+\newcommand\board@pgf@extractlength[2]{%#1 length, #2 pgfpoint
+ \pgfextracty{\len@board@tempy}{#2}%
+ \pgfextractx{\len@board@tempx}{#2}%
+ \pgfmathveclen{\len@board@tempx}{\len@board@tempy}%
+ #1=\pgfmathresult pt\relax}
+
+
+%% Field decoration:
+%% The command called by the markarea-key
+
+\newcommand*\board@pgf@add@fieldmarkstyletoarea[1]{% #1 =area
+ \expandafter\board@split@areasort#1ARGEND%
+ %% initialisation
+ \setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \setcounter{cnt@board@rank}{\board@temp@curstartranknum}%
+ %
+ \whiledo
+ {\value{cnt@board@rank}>\numexpr \board@temp@curstopranknum-1\relax}%
+ {\setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \whiledo
+ {\value{cnt@board@file}<\numexpr \board@temp@curstopfilenum+1\relax}%
+ {\edef\board@temp@curfield{\zeroalph{cnt@board@file}\number\value{cnt@board@rank}}%
+ \expandafter\board@pgf@addpgftofield\expandafter{\board@temp@curfield}{mark}%
+ \addtocounter{cnt@board@file}{1}}%
+ \addtocounter{cnt@board@rank}{-1}}}%
+
+%% The command called by the backarea-key
+
+\newcommand*\board@pgf@add@fieldbackstyletoarea[1]{% #1 =area
+ \expandafter\board@split@areasort#1ARGEND%
+ %% initialisation
+ \setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \setcounter{cnt@board@rank}{\board@temp@curstartranknum}%
+ %
+ \whiledo
+ {\value{cnt@board@rank}>\numexpr \board@temp@curstopranknum-1\relax}%
+ {\setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
+ \whiledo
+ {\value{cnt@board@file}<\numexpr \board@temp@curstopfilenum+1\relax}%
+ {\edef\board@temp@curfield{\zeroalph{cnt@board@file}\number\value{cnt@board@rank}}%
+ \expandafter\board@pgf@addpgftofield\expandafter{\board@temp@curfield}{back}%
+ \addtocounter{cnt@board@file}{1}}%
+ \addtocounter{cnt@board@rank}{-1}}}%
+
+%% The command that puts the code in the picture.
+\newcommand\board@pgf@addpgftofield[2]{% #1= node name =field name, #2=mark or back
+ \expandafter\board@split@field #1ARGEND%
+ \ifthenelse%
+ {\board@test@isfieldintrimarea{\board@temp@curfilenum}{\board@temp@curranknum}\AND
+ \board@test@isonactivecolor{\board@temp@curfilenum}{\board@temp@curranknum}}%
+ {\ifcsname board@pgf@fieldstyle\csname board@pgf@cur#2style\endcsname\endcsname
+ \csname board@pgf@add#2ground\endcsname{%
+ \def\currentarea{#1}%
+ \def\currentbq{#1}%
+ \def\currentbk{#1}%
+ \def\currentwq{#1}%
+ \def\currentwk{#1}%
+ \def\currentfrom{#1}%
+ \def\currentto{#1}%
+ \pgftransformshift{\pgfpointanchor{#1}{center}}%
+ \expandafter\let\expandafter\board@pgf@curpgfstyle
+ \csname board@pgf@fieldstyle\csname board@pgf@cur#2style\endcsname\endcsname
+ \edef\next{\noexpand\board@pgf@curpgfstyle
+ {#1}%
+ {\unexpanded\expandafter{\board@pgf@curstyleopt}}}%
+ \next}%
+ \else
+ \PackageWarning{chessboard}%
+ {#2 style '\csname board@pgf@cur#2style\endcsname' not defined for fields!
+ I will ignore the #2 commands}%
+ \fi}%
+ {}}%
+
+%% Region decoration
+
+
+\def\board@pgf@backclipleftpadding{0pt}
+\def\board@pgf@backcliptoppadding{0pt}
+\def\board@pgf@backcliprightpadding{0pt}
+\def\board@pgf@backclipbottompadding{0pt}
+\def\board@pgf@markclipleftpadding{0pt}
+\def\board@pgf@markcliptoppadding{0pt}
+\def\board@pgf@markcliprightpadding{0pt}
+\def\board@pgf@markclipbottompadding{0pt}
+\def\board@pgf@usebackclippath{discard}
+\def\board@pgf@usemarkclippath{discard}
+
+\def\board@pgf@markclippath{%
+ \pgfusepath{}%
+ \pgfpathrectanglecorners%
+ {\pgfpointadd%
+ {\pgfpointanchor{\board@val@stopprintfilechar\board@val@startprintranknum}{center}}%
+ {\pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpoint{\board@pgf@markcliprightpadding}{\board@pgf@markcliptoppadding}}%
+ }}%
+ {\pgfpointadd%
+ {\pgfpointanchor{\board@val@startprintfilechar\board@val@stopprintranknum}{center}}%
+ {\pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}
+ {\pgfpoint{-\board@pgf@markclipleftpadding}{-\board@pgf@markclipbottompadding}}%
+ }%
+ }%
+ \pgfusepath{\board@pgf@usemarkclippath}}
+
+\def\board@pgf@backclippath{%
+ \pgfusepath{}%
+ \pgfpathrectanglecorners%
+ {\pgfpointadd%
+ {\pgfpointanchor{\board@val@stopprintfilechar\board@val@startprintranknum}{center}}%
+ {\pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpoint{\board@pgf@backcliprightpadding}{\board@pgf@backcliptoppadding}}%
+ }}%
+ {\pgfpointadd%
+ {\pgfpointanchor{\board@val@startprintfilechar\board@val@stopprintranknum}{center}}%
+ {\pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}
+ {\pgfpoint{-\board@pgf@backclipleftpadding}{-\board@pgf@backclipbottompadding}}%
+ }%
+ }%
+ \pgfusepath{\board@pgf@usebackclippath}}
+
+%% the command called by the markregion key
+%% the command puts the code directly in the pgf as no loop needed
+
+\newcommand\board@pgf@add@regionmarkstyle[2]{% #1=startfield (e.g. a8), #2=stopfield (e.g.h1)
+ \expandafter\board@split@areasort#1-#2ARGEND%
+ \ifthenelse%
+ {\board@test@isareaintrimarea
+ {\board@temp@curstartfilenum}{\board@temp@curstartranknum}%
+ {\board@temp@curstopfilenum}{\board@temp@curstopranknum}}%
+ {\ifcsname board@pgf@regionstyle\board@pgf@curmarkstyle\endcsname
+ \board@pgf@addmarkground{%
+ \def\currentarea{#1-#2}%
+ \expandafter\board@split@areasort#1-#2ARGEND%
+ \edef\currentbq{\board@temp@curstartfilechar\board@temp@curstartranknum}%
+ \edef\currentbk{\board@temp@curstopfilechar\board@temp@curstartranknum}%
+ \edef\currentwq{\board@temp@curstartfilechar\board@temp@curstopranknum}%
+ \edef\currentwk{\board@temp@curstopfilechar\board@temp@curstopranknum}%
+ \def\currentfrom{#1}%
+ \def\currentto{#2}%
+ \pgftransformshift{\pgfpointanchor{#1}{center}}%
+ \expandafter\let\expandafter\board@pgf@curpgfstyle
+ \csname board@pgf@regionstyle\csname board@pgf@curmarkstyle\endcsname\endcsname
+ \edef\next{\noexpand\board@pgf@curpgfstyle
+ {#2}%
+ {\unexpanded\expandafter{\board@pgf@curstyleopt}}}%
+ \next
+ %\csname board@pgf@regionstyle\board@pgf@curmarkstyle\endcsname{#2}%
+ }%
+ \else
+ \PackageWarning{chessboard}%
+ {mark style '\board@pgf@curmarkstyle' not defined for regions!
+ I will ignore the mark commands}%
+ \fi}{}}%
+
+%% the command called by the backregion key
+%% the command puts the code directly in the pgf as no loop needed
+
+\newcommand\board@pgf@add@regionbackstyle[2]{% #1=startfield (e.g. a8), #2=stopfield (e.g.h1)
+ \expandafter\board@split@areasort#1-#2ARGEND%
+ \ifthenelse%
+ {\board@test@isareaintrimarea
+ {\board@temp@curstartfilenum}{\board@temp@curstartranknum}%
+ {\board@temp@curstopfilenum}{\board@temp@curstopranknum}}%
+ {\ifcsname board@pgf@regionstyle\board@pgf@curbackstyle\endcsname
+ \board@pgf@addbackground{%
+ \def\currentarea{#1-#2}%
+ \expandafter\board@split@areasort#1-#2ARGEND%
+ \edef\currentbq{\board@temp@curstartfilechar\board@temp@curstartranknum}%
+ \edef\currentbk{\board@temp@curstopfilechar\board@temp@curstartranknum}%
+ \edef\currentwq{\board@temp@curstartfilechar\board@temp@curstopranknum}%
+ \edef\currentwk{\board@temp@curstopfilechar\board@temp@curstopranknum}%
+ \def\currentfrom{#1}%
+ \def\currentto{#2}%
+ \pgftransformshift{\pgfpointanchor{#1}{center}}%
+ \expandafter\let\expandafter\board@pgf@curpgfstyle
+ \csname board@pgf@regionstyle\csname board@pgf@curbackstyle\endcsname\endcsname
+ \edef\next{\noexpand\board@pgf@curpgfstyle
+ {#2}%
+ {\unexpanded\expandafter{\board@pgf@curstyleopt}}}%
+ \next}%
+ \else
+ \PackageWarning{chessboard}%
+ {back style '\board@pgf@curbackstyle' not defined for regions!
+ I will ignore the back commands}%
+ \fi}{}}%
+
+%% Move decoration
+%% the command called by the markmove key
+%% the command put the code directly in the pgf as no loop needed
+
+\newcommand\board@pgf@add@movemarkstyle[2]{% #1=from field, #2=to field.
+ \expandafter\board@split@areasort#1-#2ARGEND%
+ \ifthenelse%
+ {\board@test@isareaintrimarea
+ {\board@temp@curstartfilenum}{\board@temp@curstartranknum}%
+ {\board@temp@curstopfilenum}{\board@temp@curstopranknum}}%
+ {\ifcsname board@pgf@movestyle\board@pgf@curmarkstyle\endcsname
+ \board@pgf@addmarkground{%
+ \def\currentarea{#1-#2}%
+ \expandafter\board@split@areasort#1-#2ARGEND%
+ \edef\currentbq{\board@temp@curstartfilechar\board@temp@curstartranknum}%
+ \edef\currentbk{\board@temp@curstopfilechar\board@temp@curstartranknum}%
+ \edef\currentwq{\board@temp@curstartfilechar\board@temp@curstopranknum}%
+ \edef\currentwk{\board@temp@curstopfilechar\board@temp@curstopranknum}%
+ \def\currentfrom{#1}%
+ \def\currentto{#2}%
+ \pgftransformshift{\pgfpointanchor{#1}{center}}%
+ \expandafter\let\expandafter\board@pgf@curpgfstyle
+ \csname board@pgf@movestyle\csname board@pgf@curmarkstyle\endcsname\endcsname
+ \edef\next{\noexpand\board@pgf@curpgfstyle
+ {#2}%
+ {\unexpanded\expandafter{\board@pgf@curstyleopt}}}%
+ \next
+ }%
+ \else
+ \PackageWarning{chessboard}%
+ {mark style '\board@pgf@curmarkstyle' not defined for moves!
+ I will ignore the mark commands}%
+ \fi}{}}%
+
+%% the command called by the backmove key
+%% the command put the code directly in the pgf as no loop needed
+
+\newcommand\board@pgf@add@movebackstyle[2]{% #1=from field, #2=to field.
+ \expandafter\board@split@areasort#1-#2ARGEND%
+ \ifthenelse%
+ {\board@test@isareaintrimarea
+ {\board@temp@curstartfilenum}{\board@temp@curstartranknum}%
+ {\board@temp@curstopfilenum}{\board@temp@curstopranknum}}%
+ {\ifcsname board@pgf@movestyle\board@pgf@curbackstyle\endcsname
+ \board@pgf@addbackground{%
+ \def\currentarea{#1-#2}%
+ \def\currentarea{#1-#2}%
+ \expandafter\board@split@areasort#1-#2ARGEND%
+ \edef\currentbq{\board@temp@curstartfilechar\board@temp@curstartranknum}%
+ \edef\currentbk{\board@temp@curstopfilechar\board@temp@curstartranknum}%
+ \edef\currentwq{\board@temp@curstartfilechar\board@temp@curstopranknum}%
+ \edef\currentwk{\board@temp@curstopfilechar\board@temp@curstopranknum}%
+ \def\currentfrom{#1}%
+ \def\currentto{#2}%
+ \pgftransformshift{\pgfpointanchor{#1}{center}}%
+ \expandafter\let\expandafter\board@pgf@curpgfstyle
+ \csname board@pgf@movestyle\csname board@pgf@curbackstyle\endcsname\endcsname
+ \edef\next{\noexpand\board@pgf@curpgfstyle
+ {#2}%
+ {\unexpanded\expandafter{\board@pgf@curstyleopt}}}%
+ \next
+ }%
+ \else
+ \PackageWarning{chessboard}%
+ {back style '\board@pgf@curbackstyle' not defined for moves!
+ I will ignore the back commands}%
+ \fi}{}}%
+
+%%% User command to define pgf styles
+\newcommand\cbDefinePgfFieldStyle[2]{%#1=name, #2=pgf-commands
+ \expandafter\def\csname board@pgf@fieldstyle#1\endcsname##1##2{% ##1=field
+ \begin{pgfscope}% % ##2=options
+ #2
+ \end{pgfscope}}}%
+
+\newcommand\cbDefinePgfRegionStyle[2]{%#1=name, #2=pgf-commands
+ \expandafter\def\csname board@pgf@regionstyle#1\endcsname##1##2{% ##1=oposite corner
+ \begin{pgfscope}% % ##2=options
+ #2
+ \end{pgfscope}}}%
+
+\newcommand\cbDefinePgfMoveStyle[2]{%#1=name, #2=pgf-commands
+ \expandafter\def\csname board@pgf@movestyle#1\endcsname##1##2{% ##1 =to corner
+ \begin{pgfscope}% % ##2 = options
+ #2
+ \end{pgfscope}}}%
+
+\let\cbDefineMarkFieldStyle\cbDefinePgfFieldStyle
+\let\cbDefineMarkRegionStyle\cbDefinePgfRegionStyle
+\let\cbDefineMarkMoveStyle\cbDefinePgfMoveStyle
+
+%%% some predefined pgf styles
+
+%% style none, don't know if useful
+
+\cbDefinePgfFieldStyle{none}{\pgfusepath{discard}}%
+\cbDefinePgfRegionStyle{none}{\pgfusepath{discard}}%
+\cbDefinePgfMoveStyle{none}{\pgfusepath{discard}}%
+
+%% moves
+\cbDefinePgfMoveStyle{straightmove}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \setlength\len@board@tempx{\dimexpr 0.1em + \board@pgf@shortenstart \relax}%
+ \pgfsetshortenstart{\len@board@tempx}%
+ \setlength\len@board@tempx{\board@pgf@shortenend}%
+ \pgfsetshortenend{\len@board@tempx}%
+ \pgfsetarrowsend{\board@pgf@arrow}%
+ \pgfsetroundcap
+ \pgfpathmoveto{\pgfpointorigin}%
+ \pgfpathlineto{\pgfpointanchor{#1}{center}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfMoveStyle{knightmove}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetarrowsend{\board@pgf@arrow}%
+ \setlength\len@board@tempx{\dimexpr 0.3em + \board@pgf@shortenstart \relax}%
+ \pgfsetshortenstart{\len@board@tempx}%
+ \setlength\len@board@tempx{\board@pgf@shortenend}%
+ \pgfsetshortenend{\len@board@tempx}%
+ \pgfextractx{\len@board@tempx}{\pgfpointanchor{#1}{center}}%
+ \pgfextracty{\len@board@tempy}{\pgfpointanchor{#1}{center}}%
+ \pgfpathmoveto{\pgfpointorigin}%
+ \pgfpathcurveto%
+ {\pgfpoint{0pt}{0.8\len@board@tempy}}%
+ {\pgfpoint{0.2\len@board@tempx}{\len@board@tempy}}%
+ {\pgfpointanchor{#1}{center}}%
+ \pgfusepath{stroke}}%
+
+%new 1.5.
+\newcommand\board@pgf@curvemove[2][]{
+ \setkeys[UFCB]{bez}{#1}%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetarrowsend{\board@pgf@arrow}%
+ \setlength\len@board@tempx{\dimexpr 0.3em + \board@pgf@shortenstart \relax}%
+ \pgfsetshortenstart{\len@board@tempx}%
+ \setlength\len@board@tempx{\board@pgf@shortenend}%
+ \pgfsetshortenend{\len@board@tempx}%
+ \board@pgf@extractangle{\board@temp@angle}{#2}%
+ \board@pgf@extractlength{\len@board@tempy}{#2}%
+ \pgftransformrotate{\board@temp@angle}%
+ \pgfpathmoveto{\pgfpointorigin}%
+ \pgfpathcurveto
+ {\pgfpointadd{\pgfpoint{\board@val@bezxi*\len@board@tempy}{0cm}}%
+ {\pgfpointxy{0}{\board@val@pgfsign*\board@val@bezyi}}}%
+ {\pgfpointadd{\pgfpoint{\board@val@bezxii*\len@board@tempy}{0cm}}%
+ {\pgfpointxy{0}{\board@val@pgfsign*\board@val@bezyii}}}%
+ {\pgfpoint{\len@board@tempy}{0cm}}%
+ \pgfusepath{stroke}%
+}
+
+\cbDefinePgfMoveStyle{curvemove}{%
+ \board@pgf@curvemove[#2]{\pgfpointanchor{#1}{center}}}%
+
+\def\board@pgf@curvemovestyle@knight{\setkeys[UFCB]{bez}{x1=1/2,x2=2/3,y1=0.5,y2=0.5}}
+%% region
+
+\cbDefinePgfRegionStyle{text}{%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgftransformshift
+ {\pgfpointintersectionoflines
+ {\pgfpointxy{-0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
+ {\pgfpointxy{0.5}{-0.5}}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{0pt}}%
+ {\pgfpointxy{0.5}{0.5}}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{\len@board@tempy}}%
+ {\pgfpointxy{-0.5}{-0.5}}}}%
+ \ifthenelse%
+ {\boolean{\XKV@UFCB@locset@inverse@value}}%
+ {\pgftext[rotate=180,#2]{\normalfont\board@pgf@curtext}}%
+ {\pgftext[#2]{\normalfont\board@pgf@curtext}}}%
+
+\cbDefinePgfRegionStyle{border}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfpathrectanglecorners%
+ {\pgfpointadd%
+ {\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}%
+ {\pgfpointxy{-0.5}{0.5}}}%
+ {\pgfpointadd%
+ {\pgfpointanchor{#1}{center}}%
+ {\pgfpointadd%
+ {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}%
+ {\pgfpointxy{0.5}{-0.5}}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{color}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfpathrectanglecorners%
+ {\pgfpointadd%
+ {\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}%
+ {\pgfpointxy{-0.5}{0.5}}}%
+ {\pgfpointadd%
+ {\pgfpointanchor{#1}{center}}%
+ {\pgfpointadd%
+ {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}%
+ {\pgfpointxy{0.5}{-0.5}}}}%
+ \pgfusepath{fill}}%
+
+\cbDefinePgfRegionStyle{leftborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{\len@board@tempy}}}%
+ \pgfpathlineto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{0pt}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{topborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd{\pgfpointxy{0.5}{0.5}}{\pgfpoint{\len@board@tempx}{\board@pgf@padding}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{rightborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{0pt}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
+ {\pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{bottomborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointanchor{#1}{center}}%
+ {\pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{\len@board@tempy}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
+ %\pgfpathlineto{{-\board@pgf@padding}{\len@board@tempy}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{lefttopborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{\len@board@tempy}}}%
+ \pgfpathlineto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpoint{\len@board@tempx}{\board@pgf@padding}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{lefttoprightborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{\len@board@tempy}}}%
+ \pgfpathlineto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{\board@pgf@padding}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{toprightborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{\board@pgf@padding}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{toprightbottomborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{\board@pgf@padding}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
+ {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{\len@board@tempy}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{rightbottomborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{0pt}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
+ {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{\len@board@tempy}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{rightbottomleftborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{0pt}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
+ {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{\len@board@tempy}}%
+ {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{0.5}}%
+ {\pgfpoint{-\board@pgf@padding}{0pt}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{bottomleftborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointanchor{#1}{center}}%
+ {\pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{\len@board@tempy}}%
+ {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{0.5}}%
+ {\pgfpoint{-\board@pgf@padding}{0pt}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfRegionStyle{bottomlefttopborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
+ \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointanchor{#1}{center}}%
+ {\pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{\len@board@tempy}}%
+ {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{0.5}}%
+ {\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpoint{\len@board@tempx}{\board@pgf@padding}}}%
+ \pgfusepath{stroke}}%
+
+%% Fields
+\cbDefinePgfFieldStyle{cross}{%
+ \pgfsetroundcap
+ \setlength\len@board@tempx{\dimexpr 0.1em + \board@pgf@shortenstart \relax}%
+ \pgfsetshortenstart{\len@board@tempx}%
+ \setlength\len@board@tempx{\dimexpr 0.1em + \board@pgf@shortenend \relax}%
+ \pgfsetshortenend{\len@board@tempx}%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfpathmoveto{\pgfpointxy{0.5}{0.5}}%
+ \pgfpathlineto{\pgfpointxy{-0.5}{-0.5}}%
+ \pgfusepath{stroke}%
+ \pgfpathmoveto{\pgfpointxy{-0.5}{0.5}}%
+ \pgfpathlineto{\pgfpointxy{0.5}{-0.5}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{circle}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \setlength\len@board@tempx{\dimexpr 0.55em + \board@pgf@padding \relax}%
+ \pgfpathcircle{\pgfpointxy{0}{0}}{\len@board@tempx}%
+ \pgfusepath{stroke,#2}}%
+
+\cbDefinePgfFieldStyle{text}{%
+ \ifthenelse%
+ {\boolean{\XKV@UFCB@locset@inverse@value}}%
+ {\pgftext[rotate=180,#2]{\normalfont\board@pgf@curtext}}%
+ {\pgftext[#2]{\normalfont\board@pgf@curtext}}}%
+
+\cbDefinePgfFieldStyle{border}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfpathrectanglecorners
+ {\pgfpointadd%
+ {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}%
+ {\pgfpointxy{-0.5}{-0.5}}}%
+ {\pgfpointadd%
+ {\pgfpoint{\board@pgf@padding}{\board@pgf@padding}}%
+ {\pgfpointxy{0.5}{0.5}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{color}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfpathrectanglecorners
+ {\pgfpointadd%
+ {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}%
+ {\pgfpointxy{-0.5}{-0.5}}}%
+ {\pgfpointadd%
+ {\pgfpoint{\board@pgf@padding}{\board@pgf@padding}}%
+ {\pgfpointxy{0.5}{0.5}}}%
+ \pgfusepath{fill}}%
+
+\cbDefinePgfFieldStyle{leftborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{0pt}}}%
+ \pgfpathlineto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{0pt}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{topborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd{\pgfpointxy{0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{rightborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{bottomborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{lefttopborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{0pt}}}%
+ \pgfpathlineto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpoint{0pt}{\board@pgf@padding}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{lefttoprightborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{0pt}}}%
+ \pgfpathlineto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{\board@pgf@padding}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{toprightborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{\board@pgf@padding}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{0pt}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{toprightbottomborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{\board@pgf@padding}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{0pt}}%
+ {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{0pt}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{rightbottomborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{0pt}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{0pt}}%
+ {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{0pt}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{rightbottomleftborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{0pt}}%
+ {\pgfpoint{\board@pgf@padding}{0pt}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{0pt}}%
+ {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{0pt}}%
+ {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{0.5}}%
+ {\pgfpoint{-\board@pgf@padding}{0pt}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{bottomleftborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{0pt}}%
+ {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{0.5}}%
+ {\pgfpoint{-\board@pgf@padding}{0pt}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{bottomlefttopborder}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
+ \pgfsetshortenstart{\board@pgf@shortenstart}%
+ \pgfsetshortenend{\board@pgf@shortenend}%
+ \pgfpathmoveto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{-0.5}}%
+ {\pgfpoint{0pt}{-\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{-0.5}}%
+ {\pgfpointadd
+ {\pgfpoint{0pt}{0pt}}%
+ {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{-0.5}{0.5}}%
+ {\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfpointxy{0.5}{0.5}}%
+ {\pgfpoint{0pt}{\board@pgf@padding}}}%
+ \pgfusepath{stroke}}%
+
+
+%</chessboard-pgf>
+%<*chessboard-keys-main>
+\ProvidesFile{chessboard-keys-main.sty}[2019/06/23 version v1.8 key definitions for chessboard.sty]
+%%$Date: 2011/03/23 08:42:57 $$Version: 66142533647c $
+
+%%file=Linie=column=vertikal=al_f_abetisch= a-h
+%%rank=Reihe=row=horizontal=numbe_r_=1-8
+
+%%%%%%%%%%%%%%%%%%%%%
+%%%% Keys
+%%%%%%%%%%%%%%%%%%%%%
+%%%%
+%%% Nullkey, does nothing
+%%%%
+\define@key[UFCB]{locinit}{@null}{}
+\define@key[UFCB]{locset}{@null}{}
+\define@key[UFCB]{locfill}{@null}{}
+\define@key[UFCB]{gloinit}{@null}{}
+\define@key[UFCB]{gloset}{@null}{}
+\define@key[UFCB]{glofill}{@null}{}
+%%%%
+
+%% internal Keys to expand styles, added in 1.4. to repair xkeyval problem
+
+\define@key[UFCB]{@start}{style}{%
+ \toks@=\expandafter\expandafter\expandafter{\csname board@val@style#1keylist\endcsname}%
+ \edef\@@next{\noexpand\board@do@l@addto@macro\noexpand\board@temp@keylist{,\the\toks@}}%
+ \@@next}
+
+\define@key[UFCB]{@start}{board@expand}{%
+ \@for\board@temp@keypair:=#1\do
+ {\expandafter\XKV@g@tkeyname\board@temp@keypair=\@nil\board@temp@keyname
+ \edef\next{\noexpand\key@ifundefined[UFCB]{@start}{\board@temp@keyname}}%
+ \next{\expandafter\board@do@l@addto@macro\expandafter\board@temp@keylist\expandafter{\expandafter,\board@temp@keypair}}%
+ {\edef\@next{\noexpand\setkeys[UFCB]{@start}{\board@temp@keypair}}\@next}}}%
+
+
+%%%%%
+%%% Init keys
+%%%%
+
+%%%
+%% style, can contain any key, so should be processed at start (init).
+%%%
+
+\define@key[UFCB]{locinit}{style}{% D
+ \csname board@use@locstyle@#1\endcsname}
+
+\define@key[UFCB]{gloinit}{style}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,style=#1}}
+
+%%%
+%% defaults, should only be set globally (don't make sense elsewhere)
+%%%
+
+\define@choicekey*[UFCB]{gloinit}{moverdefault}[\board@val@mover]{w,b}{}
+\define@key[UFCB]{gloinit}{castlingdefault}{\def\board@val@castling{#1}}
+\define@key[UFCB]{gloinit}{enpassantdefault}{\def\board@val@enpassant{#1}}
+\define@key[UFCB]{gloinit}{halfmovedefault}{\def\board@val@halfmove{#1}}
+\define@key[UFCB]{gloinit}{fullmovedefault}{\def\board@val@fullmove{#1}}
+
+%%% Dimension of the board
+%%% the right-top corner. Used from clearboard and to set pieces with position
+
+\define@key[UFCB]{locinit}{maxfield}{% D
+ \expandafter\board@split@field#1ARGEND%
+ \edef\board@val@maxfilechar{\board@temp@curfilechar}%
+ \edef\board@val@maxfilenum{\board@temp@curfilenum}%
+ \edef\board@val@maxranknum{\board@temp@curranknum}%
+ %% start rank numbers
+ \edef\board@val@startfenranknum{\board@temp@curranknum}%
+ \edef\board@val@startfillranknum{\board@temp@curranknum}%
+ \edef\board@val@startprintranknum{\board@temp@curranknum}%
+ \edef\board@val@startstoreranknum{\board@temp@curranknum}%
+ %% stop file numbers
+ \edef\board@val@stopfillfilenum{\board@temp@curfilenum}%
+ \edef\board@val@stopprintfilenum{\board@temp@curfilenum}%
+ \edef\board@val@stopstorefilenum{\board@temp@curfilenum}%
+ %% stop file chars
+ \edef\board@val@stopfillfilechar{\board@temp@curfilechar}%
+ \edef\board@val@stopprintfilechar{\board@temp@curfilechar}%
+ \edef\board@val@stopstorefilechar{\board@temp@curfilechar}%
+ }
+
+\define@key[UFCB]{gloinit}{maxfield}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,maxfield=#1}{}}
+
+%%% the left-bottom corner can be set to start with @0.
+%%% Used from clearboard and to set pieces with fen
+%%% boolean key, true is the default, that is zero is the same as zero=true
+
+\define@boolkey[UFCB]{locinit}{zero}[true]{% D
+ \ifUFCB@locinit@zero
+ \def\board@temp@char{Z}%
+ \def\board@temp@num{0}%
+ \else
+ \def\board@temp@char{a}%
+ \def\board@temp@num{1}%
+ \fi
+ \edef\board@val@minfilechar{\board@temp@char}%
+ \edef\board@val@minfilenum{\board@temp@num}%
+ \edef\board@val@minranknum{\board@temp@num}%
+ %% start file numbers
+ \edef\board@val@startfenfilenum{\board@temp@num}%
+ \edef\board@val@startfillfilenum{\board@temp@num}%
+ \edef\board@val@startprintfilenum{\board@temp@num}%
+ \edef\board@val@startstorefilenum{\board@temp@num}%
+ %% start file chars
+ \edef\board@val@startfenfilechar{\board@temp@char}%
+ \edef\board@val@startfillfilechar{\board@temp@char}%
+ \edef\board@val@startprintfilechar{\board@temp@char}%
+ \edef\board@val@startstorefilechar{\board@temp@char}%
+ %% stop rank numbers
+ \edef\board@val@stopfillranknum{\board@temp@num}%
+ \edef\board@val@stopprintranknum{\board@temp@num}%
+ \edef\board@val@stopstoreranknum{\board@temp@num}%
+ }
+
+\define@key[UFCB]{gloinit}{zero}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,zero=#1}{}}
+
+%%% disable the printing
+\define@boolkey[UFCB]{locinit}{print}[true]{} %D
+
+\define@boolkey[UFCB]{gloinit}{print}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,print=#1}{}}
+
+%%%%%%
+%% Set-keys
+%%%%%%
+%%% "print corner"
+
+\define@key[UFCB]{locset}{startprint}{% D
+ \expandafter\board@split@field#1ARGEND%
+ \let\board@val@startprintfilechar\board@temp@curfilechar
+ \let\board@val@startprintfilenum\board@temp@curfilenum
+ \let\board@val@startprintranknum\board@temp@curranknum}
+
+\define@key[UFCB]{gloset}{startprint}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,startprint=#1}{}}
+
+\define@key[UFCB]{locset}{stopprint}{% D
+ \expandafter\board@split@field#1ARGEND%
+ \let\board@val@stopprintfilechar\board@temp@curfilechar
+ \let\board@val@stopprintfilenum\board@temp@curfilenum%
+ \let\board@val@stopprintranknum\board@temp@curranknum}
+
+\define@key[UFCB]{gloset}{stopprint}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,stopprint=#1}{}}
+
+\define@key[UFCB]{locset}{printarea}{% a7-f1 % D
+ \expandafter\board@split@areasort#1ARGEND%
+ \board@do@setsinglekeys*[UFCB]{locset}{%
+ startprint=\board@temp@curstartfield, stopprint=\board@temp@curstopfield}}%
+
+\define@key[UFCB]{gloset}{printarea}{% a7-f1 % D
+ \board@do@l@addto@macro\board@val@savedkeylist{,printarea=#1}{}}%
+
+%%% print inverse
+
+\define@boolkey[UFCB]{locset}{inverse}[true]{} % D
+
+\define@boolkey[UFCB]{gloset}{inverse}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,inverse=#1}{}}
+
+%%%
+%% margin
+%%%
+
+\define@key[UFCB]{locset}{marginleftwidth}{% D
+ \def\board@val@marginleftwidth{#1}}
+
+\define@key[UFCB]{gloset}{marginleftwidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,marginleftwidth=#1}{}}
+
+\define@key[UFCB]{locset}{marginrightwidth}{% D
+ \def\board@val@marginrightwidth{#1}}
+
+\define@key[UFCB]{gloset}{marginrightwidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,marginrightwidth=#1}{}}
+
+\define@key[UFCB]{locset}{margintopwidth}{% D
+ \def\board@val@margintopwidth{#1}}
+
+\define@key[UFCB]{gloset}{margintopwidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,margintopwidth=#1}{}}
+
+\define@key[UFCB]{locset}{marginbottomwidth}{% D
+ \def\board@val@marginbottomwidth{#1}}
+
+\define@key[UFCB]{gloset}{marginbottomwidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,marginbottomwidth=#1}{}}
+
+\define@key[UFCB]{locset}{hmarginwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{marginleftwidth=#1, marginrightwidth=#1}}
+
+\define@key[UFCB]{gloset}{hmarginwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{marginleftwidth=#1, marginrightwidth=#1}}
+
+\define@key[UFCB]{locset}{vmarginwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{margintopwidth=#1, marginbottomwidth=#1}}
+
+\define@key[UFCB]{gloset}{vmarginwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{margintopwidth=#1, marginbottomwidth=#1}}
+
+\define@key[UFCB]{locset}{marginwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{%
+ marginleftwidth=#1, marginrightwidth=#1, margintopwidth=#1, marginbottomwidth=#1}}
+
+\define@key[UFCB]{gloset}{marginwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{%
+ marginleftwidth=#1, marginrightwidth=#1, margintopwidth=#1, marginbottomwidth=#1}}
+
+\define@boolkey[UFCB]{locset}{marginleft}[true]{} %D
+
+\define@boolkey[UFCB]{gloset}{marginleft}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,marginleft=#1}{}}
+
+\define@boolkey[UFCB]{locset}{marginright}[true]{} %D
+
+\define@boolkey[UFCB]{gloset}{marginright}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,marginright=#1}{}}
+
+\define@boolkey[UFCB]{locset}{margintop}[true]{} %D
+
+\define@boolkey[UFCB]{gloset}{margintop}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,margintop=#1}{}}
+
+\define@boolkey[UFCB]{locset}{marginbottom}[true]{} %D
+
+\define@boolkey[UFCB]{gloset}{marginbottom}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,marginbottom=#1}{}}
+
+\define@boolkey[UFCB]{locset}{hmargin}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{marginleft=#1, marginright=#1}}
+
+\define@boolkey[UFCB]{gloset}{hmargin}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{marginleft=#1, marginright=#1}}
+
+\define@boolkey[UFCB]{locset}{vmargin}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{margintop=#1, marginbottom=#1}}
+
+\define@boolkey[UFCB]{gloset}{vmargin}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{margintop=#1, marginbottom=#1}}
+
+\define@boolkey[UFCB]{locset}{margin}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{marginleft=#1, marginright=#1, margintop=#1, marginbottom=#1}}
+
+\define@boolkey[UFCB]{gloset}{margin}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{marginleft=#1, marginright=#1, margintop=#1, marginbottom=#1}}
+
+%% border
+
+\define@boolkey[UFCB]{locset}{borderleft}[true]{} % D
+
+\define@boolkey[UFCB]{gloset}{borderleft}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,borderleft=#1}{}}
+
+\define@boolkey[UFCB]{locset}{borderright}[true]{} % D
+
+\define@boolkey[UFCB]{gloset}{borderright}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,borderright=#1}{}}
+
+\define@boolkey[UFCB]{locset}{bordertop}[true]{} %D
+
+\define@boolkey[UFCB]{gloset}{bordertop}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,bordertop=#1}{}}
+
+\define@boolkey[UFCB]{locset}{borderbottom}[true]{} %D
+
+\define@boolkey[UFCB]{gloset}{borderbottom}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,borderbottom=#1}{}}
+
+\define@boolkey[UFCB]{locset}{hborder}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{borderleft=#1, borderright=#1}}
+
+\define@boolkey[UFCB]{gloset}{hborder}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{borderleft=#1, borderright=#1}}
+
+\define@boolkey[UFCB]{locset}{vborder}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{bordertop=#1, borderbottom=#1}}
+
+\define@boolkey[UFCB]{gloset}{vborder}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{bordertop=#1, borderbottom=#1}}
+
+\define@boolkey[UFCB]{locset}{border}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{borderleft=#1, borderright=#1, bordertop=#1, borderbottom=#1}}
+
+\define@boolkey[UFCB]{gloset}{border}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{borderleft=#1, borderright=#1, bordertop=#1, borderbottom=#1}}
+
+\define@key[UFCB]{locset}{borderleftwidth}{% D
+ \def\board@val@borderleftwidth{#1}}
+
+\define@key[UFCB]{gloset}{borderleftwidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,borderleftwidth=#1}{}}
+
+\define@key[UFCB]{locset}{borderrightwidth}{% D
+ \def\board@val@borderrightwidth{#1}}
+
+\define@key[UFCB]{gloset}{borderrightwidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,borderrightwidth=#1}{}}
+
+\define@key[UFCB]{locset}{bordertopwidth}{% D
+ \def\board@val@bordertopwidth{#1}}
+
+\define@key[UFCB]{gloset}{bordertopwidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,bordertopwidth=#1}{}}
+
+\define@key[UFCB]{locset}{borderbottomwidth}{% D
+ \def\board@val@borderbottomwidth{#1}}
+
+\define@key[UFCB]{gloset}{borderbottomwidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,borderbottomwidth=#1}{}}
+
+\define@key[UFCB]{locset}{hborderwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{borderleftwidth=#1, borderrightwidth=#1}}
+
+\define@key[UFCB]{gloset}{hborderwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{borderleftwidth=#1, borderrightwidth=#1}}
+
+\define@key[UFCB]{locset}{vborderwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{bordertopwidth=#1, borderbottomwidth=#1}}
+
+\define@key[UFCB]{gloset}{vborderwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{bordertopwidth=#1, borderbottomwidth=#1}}
+
+\define@key[UFCB]{locset}{borderwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{%
+ borderleftwidth=#1, borderrightwidth=#1, bordertopwidth=#1, borderbottomwidth=#1}}
+
+\define@key[UFCB]{gloset}{borderwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{%
+ borderleftwidth=#1, borderrightwidth=#1, bordertopwidth=#1, borderbottomwidth=#1}}
+
+%%% border color
+
+\define@key[UFCB]{locset}{borderleftcolor}{% D
+ \def\board@val@borderleftcolor{\color{#1}}}
+
+\define@key[UFCB]{gloset}{borderleftcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,borderleftcolor=#1}{}}
+
+\define@key[UFCB]{locset}{borderrightcolor}{% D
+ \def\board@val@borderrightcolor{\color{#1}}}
+
+\define@key[UFCB]{gloset}{borderrightcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,borderrightcolor=#1}{}}
+
+\define@key[UFCB]{locset}{bordertopcolor}{% D
+ \def\board@val@bordertopcolor{\color{#1}}}
+
+\define@key[UFCB]{gloset}{bordertopcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,bordertopcolor=#1}{}}
+
+\define@key[UFCB]{locset}{borderbottomcolor}{% D
+ \def\board@val@borderbottomcolor{\color{#1}}}
+
+\define@key[UFCB]{gloset}{borderbottomcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,borderbottomcolor=#1}{}}
+
+\define@key[UFCB]{locset}{hbordercolor}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{borderleftcolor=#1, borderrightcolor=#1}}
+
+\define@key[UFCB]{gloset}{hbordercolor}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{borderleftcolor=#1, borderrightcolor=#1}}
+
+\define@key[UFCB]{locset}{vbordercolor}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{bordertopcolor=#1, borderbottomcolor=#1}}
+
+\define@key[UFCB]{gloset}{vbordercolor}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{bordertopcolor=#1, borderbottomcolor=#1}}
+
+\define@key[UFCB]{locset}{bordercolor}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{%
+ borderleftcolor=#1, borderrightcolor=#1, bordertopcolor=#1, borderbottomcolor=#1}}
+
+\define@key[UFCB]{gloset}{bordercolor}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{%
+ borderleftcolor=#1, borderrightcolor=#1, bordertopcolor=#1, borderbottomcolor=#1}}
+
+%%%%
+%% font
+%%%
+
+\define@key[UFCB]{locset}{boardfontsize}{% D
+ \setboardfontsize{#1}}
+
+\define@key[UFCB]{gloset}{boardfontsize}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,boardfontsize=#1}{}}
+
+\define@key[UFCB]{locset}{boardfontfamily}{% D
+ \setboardfontfamily{#1}}
+
+\define@key[UFCB]{gloset}{boardfontfamily}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,boardfontfamily=#1}{}}
+
+\define@key[UFCB]{locset}{boardfontseries}{% D
+ \setboardfontseries{#1}}
+
+\define@key[UFCB]{gloset}{boardfontseries}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,boardfontseries=#1}{}}
+
+%% shorter name:
+
+\define@key[UFCB]{locset}{fontsize}{%
+ \board@do@setsinglekeys*[UFCB]{locset}{boardfontsize=#1}}
+
+\define@key[UFCB]{gloset}{fontsize}{%
+ \board@do@setsinglekeys*[UFCB]{gloset}{boardfontsize=#1}}
+
+\define@key[UFCB]{locset}{fontfamily}{%
+ \board@do@setsinglekeys*[UFCB]{locset}{boardfontfamily=#1}}
+
+\define@key[UFCB]{gloset}{fontfamily}{%
+ \board@do@setsinglekeys*[UFCB]{locset}{boardfontfamily=#1}}
+
+%%% only for the sake of completeness. Better don't mention it.
+\define@key[UFCB]{locset}{boardfontencoding}{% D
+ \def\cfss@boardfontencoding{#1}}
+
+\define@key[UFCB]{gloset}{boardfontencoding}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,boardfontencoding=#1}{}}
+
+%%% mover
+
+\define@boolkey[UFCB]{locset}{showmover}[true]{} % D
+
+\define@boolkey[UFCB]{gloset}{showmover}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,showmover=#1}{}}
+
+\define@key[UFCB]{locset}{moversize}{% D
+ \def\board@val@moversize{#1}}
+
+\define@key[UFCB]{gloset}{moversize}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,moversize=#1}{}}
+
+\define@key[UFCB]{locset}{moverstyle}{% D
+ \def\board@val@moverstyle{#1}}
+
+\define@key[UFCB]{gloset}{moverstyle}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,moverstyle=#1}{}}
+
+\define@key[UFCB]{locset}{moverbottomlift}{% D
+ \def\board@val@moverbottomlift{#1}}
+
+\define@key[UFCB]{gloset}{moverbottomlift}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,moverbottomlift=#1}{}}
+
+\define@key[UFCB]{locset}{movertoplift}{% D
+ \def\board@val@movertoplift{#1}}
+
+\define@key[UFCB]{gloset}{movertoplift}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,movertoplift=#1}{}}
+
+\define@key[UFCB]{locset}{moverlift}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{moverbottomlift=#1,movertoplift=#1}}
+
+\define@key[UFCB]{gloset}{moverlift}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{moverbottomlift=#1,movertoplift=#1}}
+
+\define@key[UFCB]{locset}{moverbottomshift}{% D
+ \def\board@val@moverbottomshift{#1}}
+
+\define@key[UFCB]{gloset}{moverbottomshift}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,moverbottomshift=#1}{}}
+
+\define@key[UFCB]{locset}{movertopshift}{% D
+ \def\board@val@movertopshift{#1}}
+
+\define@key[UFCB]{gloset}{movertopshift}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,movertopshift=#1}{}}
+
+\define@key[UFCB]{locset}{movershift}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{moverbottomshift=#1, movertopshift=#1}}
+
+\define@key[UFCB]{gloset}{movershift}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{moverbottomshift=#1, movertopshift=#1}}
+
+%%% labels
+
+\define@boolkey[UFCB]{locset}{labelleft}[true]{} %D
+
+\define@boolkey[UFCB]{gloset}{labelleft}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelleft=#1}{}}
+
+\define@boolkey[UFCB]{locset}{labelright}[true]{} %D
+
+\define@boolkey[UFCB]{gloset}{labelright}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelright=#1}{}}
+
+\define@boolkey[UFCB]{locset}{labeltop}[true]{} %D
+
+\define@boolkey[UFCB]{gloset}{labeltop}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labeltop=#1}{}}
+
+\define@boolkey[UFCB]{locset}{labelbottom}[true]{} %D
+
+\define@boolkey[UFCB]{gloset}{labelbottom}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelbottom=#1}{}}
+
+\define@boolkey[UFCB]{locset}{hlabel}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{labelleft=#1, labelright=#1}}
+
+\define@boolkey[UFCB]{gloset}{hlabel}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{labelleft=#1, labelright=#1}}
+
+\define@boolkey[UFCB]{locset}{vlabel}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{labeltop=#1, labelbottom=#1}}
+
+\define@boolkey[UFCB]{gloset}{vlabel}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{labeltop=#1, labelbottom=#1}}
+
+\define@boolkey[UFCB]{locset}{label}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{%
+ labelleft=#1, labelright=#1, labeltop=#1, labelbottom=#1}}
+
+\define@boolkey[UFCB]{gloset}{label}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{%
+ labelleft=#1, labelright=#1, labeltop=#1, labelbottom=#1}}
+
+%% width
+\define@key[UFCB]{locset}{labelleftwidth}{% D
+ \def\board@val@labelleftwidth{#1}}
+
+\define@key[UFCB]{gloset}{labelleftwidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelleftwidth=#1}{}}
+
+\define@key[UFCB]{locset}{labelrightwidth}{% D
+ \def\board@val@labelrightwidth{#1}}
+
+\define@key[UFCB]{gloset}{labelrightwidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelrightwidth=#1}{}}
+
+\define@key[UFCB]{locset}{labelbottomwidth}{% D
+ \def\board@val@labelbottomwidth{#1}}
+
+\define@key[UFCB]{gloset}{labelbottomwidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelbottomwidth=#1}{}}
+
+\define@key[UFCB]{locset}{hlabelwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{labelleftwidth=#1, labelrightwidth=#1}}
+
+\define@key[UFCB]{gloset}{hlabelwidth}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{labelleftwidth=#1, labelrightwidth=#1}}
+
+%% lift
+\define@key[UFCB]{locset}{labelleftlift}{% D
+ \def\board@val@labelleftlift{#1}}
+
+\define@key[UFCB]{gloset}{labelleftlift}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelleftlift=#1}{}}
+
+\define@key[UFCB]{locset}{labelrightlift}{% D
+ \def\board@val@labelrightlift{#1}}
+
+\define@key[UFCB]{gloset}{labelrightlift}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelrightlift=#1}{}}
+
+\define@key[UFCB]{locset}{labeltoplift}{% D
+ \def\board@val@labeltoplift{#1}}
+
+\define@key[UFCB]{gloset}{labeltoplift}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labeltoplift=#1}{}}
+
+\define@key[UFCB]{locset}{labelbottomlift}{% D
+ \def\board@val@labelbottomlift{#1}}
+
+\define@key[UFCB]{gloset}{labelbottomlift}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelbottomlift=#1}{}}
+
+\define@key[UFCB]{locset}{hlabellift}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{labelleftlift=#1, labelrightlift=#1}}
+
+\define@key[UFCB]{gloset}{hlabellift}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{labelleftlift=#1, labelrightlift=#1}}
+
+\define@key[UFCB]{locset}{vlabellift}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{labeltoplift=#1, labelbottomlift=#1}}
+
+\define@key[UFCB]{gloset}{vlabellift}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{labeltoplift=#1, labelbottomlift=#1}}
+
+%% font
+
+\define@key[UFCB]{locset}{labelleftfont}{% D
+ \def\board@val@labelleftfont{#1}}
+
+\define@key[UFCB]{gloset}{labelleftfont}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelleftfont=#1}{}}
+
+\define@key[UFCB]{locset}{labelrightfont}{% D
+ \def\board@val@labelrightfont{#1}}
+
+\define@key[UFCB]{gloset}{labelrightfont}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelrightfont=#1}{}}
+
+\define@key[UFCB]{locset}{labeltopfont}{% D
+ \def\board@val@labeltopfont{#1}}
+
+\define@key[UFCB]{gloset}{labeltopfont}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labeltopfont=#1}{}}
+
+\define@key[UFCB]{locset}{labelbottomfont}{% D
+ \def\board@val@labelbottomfont{#1}}
+
+\define@key[UFCB]{gloset}{labelbottomfont}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelbottomfont=#1}{}}
+
+\define@key[UFCB]{locset}{hlabelfont}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{labelleftfont=#1, labelrightfont=#1}}
+
+\define@key[UFCB]{gloset}{hlabelfont}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{labelleftfont=#1, labelrightfont=#1}}%
+
+\define@key[UFCB]{locset}{vlabelfont}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{labeltopfont=#1, labelbottomfont=#1}}%
+
+\define@key[UFCB]{gloset}{vlabelfont}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{labeltopfont=#1, labelbottomfont=#1}}%
+
+\define@key[UFCB]{locset}{labelfont}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{%
+ labelleftfont=#1, labelrightfont=#1, labeltopfont=#1, labelbottomfont=#1}}%
+
+\define@key[UFCB]{gloset}{labelfont}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{labelleftfont=#1, labelrightfont=#1, labeltopfont=#1, labelbottomfont=#1}}%
+
+%%fontsize
+
+\define@key[UFCB]{locset}{labelfontsize}{% D
+ \def\cfss@sidefontsize{#1}}%
+
+\define@key[UFCB]{gloset}{labelfontsize}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelfontsize=#1}{}}%
+
+%% formatting
+
+\define@key[UFCB]{locset}{labelleftformat}{% D
+ \def\board@val@labelleftformat{#1}}%
+
+\define@key[UFCB]{gloset}{labelleftformat}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelleftformat={#1}}{}}%
+
+\define@key[UFCB]{locset}{labelrightformat}{% D
+ \def\board@val@labelrightformat{#1}}%
+
+\define@key[UFCB]{gloset}{labelrightformat}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelrightformat={#1}}{}}%
+
+\define@key[UFCB]{locset}{labeltopformat}{% D
+ \def\board@val@labeltopformat{#1}}%
+
+\define@key[UFCB]{gloset}{labeltopformat}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labeltopformat={#1}}{}}%
+
+\define@key[UFCB]{locset}{labelbottomformat}{% D
+ \def\board@val@labelbottomformat{#1}}%
+
+\define@key[UFCB]{gloset}{labelbottomformat}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,labelbottomformat={#1}}{}}%
+
+\define@key[UFCB]{locset}{hlabelformat}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{labelleftformat=#1, labelrightformat=#1}}%
+
+\define@key[UFCB]{gloset}{hlabelformat}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{labelleftformat={#1}, labelrightformat={#1}}}%
+
+\define@key[UFCB]{locset}{vlabelformat}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{labeltopformat=#1, labelbottomformat=#1}}%
+
+\define@key[UFCB]{gloset}{vlabelformat}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{labeltopformat={#1}, labelbottomformat={#1}}}%
+
+\define@key[UFCB]{locset}{labelformat}{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{%
+ labelleftformat=#1, labelrightformat=#1, labeltopformat=#1, labelbottomformat=#1}}%
+
+\define@key[UFCB]{gloset}{labelformat}{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{%
+ labelleftformat={#1}, labelrightformat={#1}, labeltopformat={#1}, labelbottomformat={#1}}}%
+
+%%%
+%% Board sizes
+%%%
+
+\define@key[UFCB]{locset}{tinyboard}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{fontsize=10pt, labelfontsize=6pt}}%
+
+\define@key[UFCB]{gloset}{tinyboard}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{fontsize=10pt, labelfontsize=6pt}}%
+
+\define@key[UFCB]{locset}{smallboard}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{fontsize=15pt, labelfontsize=8pt}}%
+
+\define@key[UFCB]{gloset}{smallboard}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{fontsize=15pt, labelfontsize=8pt}}%
+
+\define@key[UFCB]{locset}{normalboard}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{fontsize=20pt, labelfontsize=10pt}}%
+
+\define@key[UFCB]{gloset}{normalboard}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{fontsize=20pt, labelfontsize=10pt}}%
+
+\define@key[UFCB]{locset}{largeboard}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{locset}{fontsize=30pt, labelfontsize=12pt}}%
+
+\define@key[UFCB]{gloset}{largeboard}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{gloset}{fontsize=30pt, labelfontsize=12pt}}%
+
+%%% coloring the font layer
+\define@key[UFCB]{locfill}{clearfontcolors}[true]{% D
+ \def\board@val@fontcolorstack{}}
+
+\define@key[UFCB]{glofill}{clearfontcolors}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearfontcolors=#1}{}}%
+
+\define@key[UFCB]{locfill}{whitefieldmaskcolor}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@whitefieldmaskcolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{whitefieldmaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,whitefieldmaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{blackfieldmaskcolor}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@blackfieldmaskcolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{blackfieldmaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,blackfieldmaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{fieldmaskcolor}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ whitefieldmaskcolor=#1,
+ blackfieldmaskcolor=#1}}
+
+\define@key[UFCB]{glofill}{fieldmaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,fieldmaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{whitefieldcolor}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@whitefieldcolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{whitefieldcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,whitefieldcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{blackfieldcolor}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@blackfieldcolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{blackfieldcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,blackfieldcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{fieldcolor}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ whitefieldcolor=#1,
+ blackfieldcolor=#1}}
+
+\define@key[UFCB]{glofill}{fieldcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,fieldcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{whiteonwhitepiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@whiteonwhitepiecemaskcolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{whiteonwhitepiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,whiteonwhitepiecemaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{whiteonblackpiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@whiteonblackpiecemaskcolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{whiteonblackpiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,whiteonblackpiecemaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{blackonwhitepiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@blackonwhitepiecemaskcolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{blackonwhitepiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,blackonwhitepiecemaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{blackonblackpiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@blackonblackpiecemaskcolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{blackonblackpiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,blackonblackpiecemaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{whitepiecemaskcolor}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ whiteonwhitepiecemaskcolor=#1,
+ whiteonblackpiecemaskcolor=#1}}
+
+\define@key[UFCB]{glofill}{whitepiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,whitepiecemaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{blackpiecemaskcolor}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ blackonwhitepiecemaskcolor=#1,
+ blackonblackpiecemaskcolor=#1}}
+
+\define@key[UFCB]{glofill}{blackpiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,blackpiecemaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{onwhitepiecemaskcolor}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ whiteonwhitepiecemaskcolor=#1,
+ blackonwhitepiecemaskcolor=#1}}
+
+\define@key[UFCB]{glofill}{onwhitepiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,onwhitepiecemaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{onblackpiecemaskcolor}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ whiteonblackpiecemaskcolor=#1,
+ blackonblackpiecemaskcolor=#1}}
+
+\define@key[UFCB]{glofill}{onblackpiecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,onblackpiecemaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{piecemaskcolor}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ whiteonwhitepiecemaskcolor=#1,
+ whiteonblackpiecemaskcolor=#1,
+ blackonwhitepiecemaskcolor=#1,
+ blackonblackpiecemaskcolor=#1}}
+
+\define@key[UFCB]{glofill}{piecemaskcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,piecemaskcolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{whitepiececolor}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@whitepiececolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{whitepiececolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,whitepiececolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{blackpiececolor}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@blackpiececolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{blackpiececolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,blackpiececolor=#1}{}}%
+
+\define@key[UFCB]{locfill}{piececolor}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ whitepiececolor=#1,
+ blackpiececolor=#1}}
+
+\define@key[UFCB]{glofill}{piececolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,piececolor=#1}{}}%
+
+%% Obsolete + changed, use whitepiececolor
+\define@key[UFCB]{locfill}{colorwhite}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@whitepiececolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{colorwhite}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorwhite=#1}{}}%
+
+\define@key[UFCB]{locfill}{colorblack}{% D
+ \board@do@l@addto@macro\board@val@fontcolorstack
+ {\def\cfss@blackpiececolor{\color{#1}}}}
+
+\define@key[UFCB]{glofill}{colorblack}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorblack=#1}{}}%
+
+%% end obsolete
+
+%% setting board colors
+\define@key[UFCB]{locfill}{setfontcolors}[true]{% D
+ \let\board@val@boardfontcolors\board@val@fontcolorstack}
+
+\define@key[UFCB]{glofill}{setfontcolors}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,setfontcolors=#1}{}}%
+
+\define@key[UFCB]{locfill}{addfontcolors}[true]{% D
+ \toks@=\expandafter{\board@val@fontcolorstack}%
+ \edef\@@next{\noexpand\board@do@l@addto@macro\noexpand\board@val@boardfontcolors{\the\toks@}}%
+ \@@next}
+
+\define@key[UFCB]{glofill}{setfontcolors}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,setfontcolors=#1}{}}%
+
+%% color in areas.
+
+
+%%% enable postscript units and node
+\define@boolkey[UFCB]{locset}{psset}[true]{}% D
+
+\define@boolkey[UFCB]{gloset}{psset}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,psset=#1}{}}%
+
+%%% redefines some skak commands/skak counters
+\define@boolkey[UFCB]{locset}{psskak}[true]{}% D
+
+\define@boolkey[UFCB]{gloset}{psskak}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,psskak=#1}{}}%
+
+%%%%%%
+%% "fill"-Keys that can be used more than once
+%%%%%%
+
+%%%%
+%% language
+%%%%
+
+\define@key[UFCB]{locfill}{language}{% D
+ \edef\board@val@curlang{#1}}%
+
+\define@key[UFCB]{glofill}{language}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,language=#1}}%
+
+%%%%
+%% clearing
+%%%%
+
+\define@key[UFCB]{locfill}{cleararea}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\board@do@cleararea{\board@temp@curarea}}}%
+
+\define@key[UFCB]{glofill}{cleararea}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,cleararea=#1}}%
+
+\define@key[UFCB]{locfill}{clearareas}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\board@do@cleararea{\board@temp@curarea}}}%
+
+\define@key[UFCB]{glofill}{clearareas}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearareas=#1}}%
+
+\define@key[UFCB]{locfill}{clearboard}[true]{%D
+ \edef\board@temp@curstartfield{\board@val@minfilechar\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{cleararea=\board@temp@curstartfield-\board@temp@curstopfield}}%
+
+\define@key[UFCB]{glofill}{clearboard}[true]{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearboard=#1}}%
+
+\define@key[UFCB]{locfill}{clearrank}{%D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ cleararea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{clearrank}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearrank={#1}}}%
+
+\define@key[UFCB]{locfill}{clearranks}{%D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ cleararea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{clearranks}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearranks={#1}}}%
+
+\define@key[UFCB]{locfill}{clearfile}{%D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ cleararea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{clearfile}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearfile={#1}}}%
+
+\define@key[UFCB]{locfill}{clearfiles}{%D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ cleararea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{clearfiles}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearfiles={#1}}}%
+
+\define@key[UFCB]{locfill}{clearfield}{% #1=list of fields %D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\board@do@setsinglekeys*[UFCB]{locfill}{cleararea=\board@temp@curfield-\board@temp@curfield}}}%
+
+\define@key[UFCB]{glofill}{clearfield}{% %D
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearfield={#1}}}%
+
+\define@key[UFCB]{locfill}{clearfields}{% #1=list of fields %D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\board@do@setsinglekeys*[UFCB]{locfill}{cleararea=\board@temp@curfield-\board@temp@curfield}}}%
+
+\define@key[UFCB]{glofill}{clearfields}{% %D
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearfields={#1}}}%
+
+%%%%
+%% hiding
+%%%%
+
+\define@key[UFCB]{locfill}{hidearea}{% D
+ \board@do@hidearea{#1}}%
+
+\define@key[UFCB]{glofill}{hidearea}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hidearea=#1}}%
+
+\define@key[UFCB]{locfill}{hideareas}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\board@do@hidearea{\board@temp@curarea}}}%
+
+\define@key[UFCB]{glofill}{hideareas}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hideareas=#1}}%
+
+\define@key[UFCB]{locfill}{hideboard}[true]{% D
+ \edef\board@temp@curstartfield{\board@val@minfilechar\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{hidearea=\board@temp@curstartfield-\board@temp@curstopfield}}%
+
+\define@key[UFCB]{glofill}{hideboard}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hideboard=#1}}%
+
+\define@key[UFCB]{locfill}{hiderank}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ hidearea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{hiderank}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hiderank={#1}}}%
+
+\define@key[UFCB]{locfill}{hideranks}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ hidearea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{hideranks}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hideranks={#1}}}%
+
+\define@key[UFCB]{locfill}{hidefile}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ hidearea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{hidefile}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hidefile={#1}}}%
+
+\define@key[UFCB]{locfill}{hidefiles}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ hidearea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{hidefiles}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hidefiles={#1}}}%
+
+\define@key[UFCB]{locfill}{hidefields}{% D #1=list of fields
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\board@do@setsinglekeys*[UFCB]{locfill}{hidearea=\board@temp@curfield-\board@temp@curfield}}}%
+
+\define@key[UFCB]{glofill}{hidefields}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hidefields={#1}}}%
+
+\define@key[UFCB]{locfill}{hidefield}{% D #1=list of fields
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\board@do@setsinglekeys*[UFCB]{locfill}{hidearea=\board@temp@curfield-\board@temp@curfield}}}%
+
+\define@key[UFCB]{glofill}{hidefield}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hidefield={#1}}}%
+
+\define@key[UFCB]{locfill}{hidepiece}{% D list of chars
+ \board@do@hidetypelist{#1}}%
+
+\define@key[UFCB]{glofill}{hidepiece}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hidepiece={#1}}}%
+
+\define@key[UFCB]{locfill}{hidepieces}{% D list of chars
+ \board@do@hidetypelist{#1}}%
+
+\define@key[UFCB]{glofill}{hidepieces}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hidepieces={#1}}}%
+
+\define@key[UFCB]{locfill}{hidewhite}[true]{% D
+ \edef\board@temp@list{%
+ \csname board@\board@val@game @whitepiececharlist\endcsname}%
+ \board@do@hidetypelist{\board@temp@list}}%
+
+\define@key[UFCB]{glofill}{hidewhite}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hidewhite=#1}}%
+
+\define@key[UFCB]{locfill}{hideblack}[true]{% D
+ \edef\board@temp@list{%
+ \csname board@\board@val@game @blackpiececharlist\endcsname}%
+ \board@do@hidetypelist{\board@temp@list}}%
+
+\define@key[UFCB]{glofill}{hideblack}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hideblack=#1}}%
+
+\define@key[UFCB]{locfill}{hideall}[true]{% D
+ \edef\board@temp@list{%
+ \csname board@\board@val@game @piececharlist\endcsname}%
+ \board@do@hidetypelist{\board@temp@list}}%
+
+\define@key[UFCB]{glofill}{hideall}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,hideall=#1}}%
+
+%%%%
+%% show
+%%%%
+
+\define@key[UFCB]{locfill}{showarea}{%
+ \board@do@showarea{#1}}%
+
+\define@key[UFCB]{glofill}{showarea}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,showarea=#1}}%
+
+\define@key[UFCB]{locfill}{showareas}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\board@do@showarea{\board@temp@curarea}}}%
+
+\define@key[UFCB]{glofill}{showareas}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,showareas=#1}}%
+
+\define@key[UFCB]{locfill}{showboard}[true]{%
+ \edef\board@temp@curstartfield{\board@val@minfilechar\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{showarea=\board@temp@curstartfield-\board@temp@curstopfield}}%
+
+\define@key[UFCB]{glofill}{showboard}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,showboard=#1}}%
+
+\define@key[UFCB]{locfill}{showrank}{%
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ showarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{showrank}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,showrank={#1}}}%
+
+\define@key[UFCB]{locfill}{showranks}{%
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ showarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{showranks}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,showranks={#1}}}%
+
+\define@key[UFCB]{locfill}{showfile}{%
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ showarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{showfile}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,showfile={#1}}}%
+
+\define@key[UFCB]{locfill}{showfiles}{%
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ showarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{showfiles}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,showfiles={#1}}}%
+
+\define@key[UFCB]{locfill}{showfield}{% #1=list of fields
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\board@do@setsinglekeys*[UFCB]{locfill}{hidearea=\board@temp@curfield-\board@temp@curfield}}}%
+
+\define@key[UFCB]{glofill}{showfield}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,showfield={#1}}}%
+
+\define@key[UFCB]{locfill}{showfields}{% #1=list of fields
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\board@do@setsinglekeys*[UFCB]{locfill}{hidearea=\board@temp@curfield-\board@temp@curfield}}}%
+
+\define@key[UFCB]{glofill}{showfields}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,showfields={#1}}}%
+
+\define@key[UFCB]{locfill}{showpiece}{% list of chars
+ \board@do@showtypelist{#1}}%
+
+\define@key[UFCB]{glofill}{showpiece}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,showpieces={#1}}}%
+
+\define@key[UFCB]{locfill}{showpieces}{% list of chars
+ \board@do@showtypelist{#1}}%
+
+\define@key[UFCB]{glofill}{showpieces}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,showpieces={#1}}}%
+
+%%%%
+%% fen
+%%%%
+%%% fen "corners
+
+\define@key[UFCB]{locfill}{startfen}{% D
+ \expandafter\board@split@field#1ARGEND%
+ \let\board@val@startfenfilechar\board@temp@curfilechar
+ \let\board@val@startfenfilenum\board@temp@curfilenum
+ \let\board@val@startfenranknum\board@temp@curranknum}%
+
+\define@key[UFCB]{glofill}{startfen}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,startfen=#1}}%
+
+\define@key[UFCB]{locfill}{startfill}{% D
+ \expandafter\board@split@field#1ARGEND%
+ \let\board@val@startfillfilechar\board@temp@curfilechar
+ \let\board@val@startfillfilenum\board@temp@curfilenum
+ \let\board@val@startfillranknum\board@temp@curranknum}%
+
+\define@key[UFCB]{glofill}{startfill}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,startfill=#1}}%
+
+\define@key[UFCB]{locfill}{stopfill}{% D
+ \expandafter\board@split@field#1ARGEND%
+ \let\board@val@stopfillfilechar\board@temp@curfilechar
+ \let\board@val@stopfillfilenum\board@temp@curfilenum
+ \let\board@val@stopfillranknum\board@temp@curranknum}%
+
+\define@key[UFCB]{glofill}{stopfill}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,startfill=#1}}%
+
+\define@key[UFCB]{locfill}{fillarea}{% a7-f1 %D
+ \expandafter\board@split@areasort#1ARGEND%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ startfill=\board@temp@curstartfield, stopfill=\board@temp@curstopfield}}%
+
+\define@key[UFCB]{glofill}{fillarea}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,fillarea=#1}}%
+
+%%%
+%% setting pieces with fen
+%%%
+
+\define@key[UFCB]{locfill}{@fen}{%
+ \board@split@fen#1 X X X X X X XARGEND%
+ \board@scan@fen{\board@val@position}}%
+
+\def\board@setfenkey#1|{\board@do@setsinglekeys*[UFCB]{locfill}{@fen=#1}}%
+
+%%change 1.5
+\define@key[UFCB]{locfill}{setfen}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{clearboard}%
+ \edef\board@temp@fen{#1}%
+ \expandafter\board@setfenkey\board@temp@fen|}%
+
+\define@key[UFCB]{glofill}{setfen}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,setfen=#1}}%
+
+\define@key[UFCB]{locfill}{addfen}{% D
+ \expandafter\board@setfenkey#1|}%
+
+\define@key[UFCB]{glofill}{addfen}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,addfen=#1}}%
+
+%%% other name for usefen
+\define@key[UFCB]{locfill}{restorefen}{% D
+ \edef\board@temp@curfen{\csname chessgame.#1\endcsname}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{language=english, addfen=\board@temp@curfen, language=\board@val@savelang}}%
+
+\define@key[UFCB]{glofill}{restorefen}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,restorefen=#1}}%cor 1.5.
+
+\define@key[UFCB]{locfill}{loadfen}{% D
+ \board@do@loadfen{#1}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{language=english, addfen=\board@temp@curfen, language=\board@val@savelang}}%
+
+\define@key[UFCB]{glofill}{loadfen}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,loadfen=#1}}%
+
+%%%%
+%% rest of fen
+%%%%
+
+\define@key[UFCB]{locfill}{mover}{\def\board@val@mover{#1}} %D %changed 02.08.2007 to allow commands as input
+\define@key[UFCB]{locfill}{castling}{\def\board@val@castling{#1}} %D
+\define@key[UFCB]{locfill}{enpassant}{\def\board@val@enpassant{#1}} %D
+\define@key[UFCB]{locfill}{halfmove}{\def\board@val@halfmove{#1}} %D
+\define@key[UFCB]{locfill}{fullmove}{\def\board@val@fullmove{#1}} %D
+
+\define@key[UFCB]{glofill}{mover}{\board@do@l@addto@macro\board@val@savedkeylist{,mover=#1}} %D
+\define@key[UFCB]{glofill}{castling}{\board@do@l@addto@macro\board@val@savedkeylist{,castling=#1}} %D
+\define@key[UFCB]{glofill}{enpassant}{\board@do@l@addto@macro\board@val@savedkeylist{,enpassant=#1}} %D
+\define@key[UFCB]{glofill}{halfmove}{\board@do@l@addto@macro\board@val@savedkeylist{,halfmove=#1}} %D
+\define@key[UFCB]{glofill}{fullmove}{\board@do@l@addto@macro\board@val@savedkeylist{,fullmove=#1}} %D
+
+%%% saving fen
+
+\define@key[UFCB]{locfill}{storefen}{% D
+ \board@do@storefen{#1}}% D
+
+\define@key[UFCB]{glofill}{storefen}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,storefen=#1}}%
+
+\define@key[UFCB]{locfill}{savefen}{\board@do@savefen{#1}} %D
+
+\define@key[UFCB]{glofill}{savefen}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,savefen=#1}}%
+
+\define@key[UFCB]{locfill}{startstore}{% D
+ \expandafter\board@split@field#1ARGEND%
+ \let\board@val@startstorefilechar\board@temp@curfilechar
+ \let\board@val@startstorefilenum\board@temp@curfilenum
+ \let\board@val@startstoreranknum\board@temp@curranknum%
+ }%
+
+\define@key[UFCB]{glofill}{startstore}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,startstore=#1}}%
+
+\define@key[UFCB]{locfill}{stopstore}{% D
+ \expandafter\board@split@field#1ARGEND%
+ \let\board@val@stopstorefilechar\board@temp@curfilechar
+ \let\board@val@stopstorefilenum\board@temp@curfilenum
+ \let\board@val@stopstoreranknum\board@temp@curranknum}%
+
+\define@key[UFCB]{glofill}{stopstore}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,stopstore=#1}}%
+
+\define@key[UFCB]{locfill}{storearea}{% a7-f1 %D
+ \expandafter\board@split@areasort#1ARGEND%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ startstore=\board@temp@curstartfield, stopstore=\board@temp@curstopfield}}%
+
+\define@key[UFCB]{glofill}{storearea}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,storearea=#1}}%
+
+%%%%%%
+%%% Adding pieces
+%%%%%%
+
+\define@key[UFCB]{locfill}{setpieces}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{clearboard=true}%
+ \board@do@addpieces{#1}}%
+
+\define@key[UFCB]{glofill}{setpieces}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,setpieces={#1}}}%
+
+\define@key[UFCB]{locfill}{addpieces}{% D
+ \board@do@addpieces{#1}}%
+
+\define@key[UFCB]{glofill}{addpieces}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,addpieces={{#1}}}}%
+
+\define@key[UFCB]{locfill}{setwhite}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{clearboard=true}%
+ \board@do@addwhitepieces{#1}}%
+
+\define@key[UFCB]{glofill}{setwhite}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,setwhite={#1}}}%
+
+\define@key[UFCB]{locfill}{addwhite}{% D
+ \board@do@addwhitepieces{#1}}%
+
+\define@key[UFCB]{glofill}{addwhite}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,addwhite={#1}}}%
+
+\define@key[UFCB]{locfill}{setblack}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{clearboard=true}%
+ \board@do@addblackpieces{#1}}%
+
+\define@key[UFCB]{glofill}{setblack}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,setblack={#1}}}%
+
+\define@key[UFCB]{locfill}{addblack}{% D
+ \board@do@addblackpieces{#1}}%
+
+\define@key[UFCB]{glofill}{addblack}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,addblack={#1}}}%
+
+%% getting field lists for piece types
+\define@key[UFCB]{locfill}{getpiecelists}[true]{% D
+ \board@do@getpiecelists}
+
+\define@key[UFCB]{glofill}{getpiecelists}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,getpiecelists={#1}}}%
+
+
+%%\define@key[UFCB]{main}{fontsize}{\setboardfontsize{#1}}%
+
+%% "emphazing"
+
+\define@boolkey[UFCB]{locfill}{coloremph}[true]{}
+
+\define@boolkey[UFCB]{glofill}{coloremph}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,coloremph={#1}}}%
+
+\define@key[UFCB]{locfill}{emphstyle}{% D
+ \def\board@val@pieceemph{#1}}%
+
+\define@key[UFCB]{glofill}{emphstyle}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,emphstyle={#1}}}%
+
+\define@key[UFCB]{locfill}{coloremphstyle}[\relax]{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{coloremph}%
+ \def\board@val@pieceemph{#1}}%
+
+\define@key[UFCB]{glofill}{coloremphstyle}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,coloremphstyle={#1}}}%
+
+\define@key[UFCB]{locfill}{empharea}{% D
+ \board@do@empharea{#1}}%
+
+\define@key[UFCB]{glofill}{empharea}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,empharea=#1}}%
+
+\define@key[UFCB]{locfill}{emphareas}{% D
+ \XKV@sp@deflist\board@templist{#1}%
+ \edef\board@templist{\board@templist}%
+ \@for\board@temp@curarea:=\board@templist\do
+ {\ifx\board@temp@curarea\@empty\else
+ \board@do@empharea{\board@temp@curarea}%
+ \fi}}%
+
+\define@key[UFCB]{glofill}{emphareas}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,emphareas={#1}}}%
+
+\define@key[UFCB]{locfill}{emphboard}[true]{%D
+ \edef\board@temp@curstartfield{\board@val@minfilechar\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{empharea=\board@temp@curstartfield-\board@temp@curstopfield}}%
+
+\define@key[UFCB]{glofill}{emphboard}[true]{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,emphboard=#1}}%
+
+\define@key[UFCB]{locfill}{emphranks}{%D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ empharea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{emphranks}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,emphranks={#1}}}%
+
+\define@key[UFCB]{locfill}{emphrank}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ emphranks=#1}}%
+
+\define@key[UFCB]{glofill}{emphrank}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,emphrank={#1}}}%
+
+\define@key[UFCB]{locfill}{emphfiles}{%D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ empharea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{emphfiles}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,emphfiles={#1}}}%
+
+\define@key[UFCB]{locfill}{emphfile}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ emphfiles=#1}}%
+
+\define@key[UFCB]{glofill}{emphfile}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,emphfile=#1}}%
+
+\define@key[UFCB]{locfill}{emphfields}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\expandafter\board@split@field\board@temp@curfield ARGEND%
+ \board@do@store@pieceemph{\board@temp@curfilenum}{\board@temp@curranknum}}}%
+
+\define@key[UFCB]{glofill}{emphfields}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,emphpieces={#1}}}%
+
+\define@key[UFCB]{locfill}{emphfield}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ emphfields=#1}}%
+
+\define@key[UFCB]{glofill}{emphfield}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,emphfield=#1}}%
+
+\define@key[UFCB]{locfill}{colorpieces}{% D
+ \PackageWarning{chessboard}{The key colorpieces doesn't work anymore. \MessageBreak
+ Use the emph-keys instead.}}%
+\define@key[UFCB]{glofill}{colorpieces}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorpieces={#1}}}%
+
+%%%%%%%%%%%%%%%
+%% setting the game
+%%%%%%%%%%%%%%%
+
+\define@key[UFCB]{locinit}{game}{%
+ \def\board@val@game{#1}}%
+
+\define@key[UFCB]{gloinit}{game}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,game=#1}{}}%
+
+
+%</chessboard-keys-main>
+%<*chessboard-keys-pgf>
+\ProvidesFile{chessboard-keys-pgf.sty}[2019/06/23 version v1.8 key definitions for chessboard.sty]
+%%$Date: 2011/03/17 13:42:38 $$Version: e7ec1b100ede $
+
+%% new 1.5.: style keys for curvemove
+\define@key[UFCB]{bez}{x1}{\def\board@val@bezxi{#1}}
+\define@key[UFCB]{bez}{x2}{\def\board@val@bezxii{#1}}
+\define@key[UFCB]{bez}{y1}{\def\board@val@bezyi{#1}}
+\define@key[UFCB]{bez}{y2}{\def\board@val@bezyii{#1}}
+\define@key[UFCB]{bez}{linewidth}{\def\board@pgf@linewidth{#1}}
+\define@key[UFCB]{bez}{pgflinewidth}{\def\board@pgf@linewidth{#1}}
+\define@key[UFCB]{bez}{pgfshortenstart}{\def\board@pgf@shortenstart{#1}}
+\define@key[UFCB]{bez}{shortenstart}{\def\board@pgf@shortenstart{#1}}
+\define@key[UFCB]{bez}{pgfshortenend}{\def\board@pgf@shortenend{#1}}
+\define@key[UFCB]{bez}{shortenend}{\def\board@pgf@shortenend{#1}}
+\define@key[UFCB]{bez}{pgfarrow}{\def\board@pgf@arrow{#1}}
+\define@key[UFCB]{bez}{arrow}{\def\board@pgf@arrow{#1}}
+
+\define@boolkey[UFCB]{bez}{clockwise}[true]{%
+ \ifUFCB@bez@clockwise
+ \def\board@val@pgfsign{1}
+ \else
+ \def\board@val@pgfsign{-1}%
+ \fi}%
+\define@key[UFCB]{bez}{style}{%
+ \ifcsname board@pgf@curvemovestyle@#1\endcsname
+ \csname board@pgf@curvemovestyle@#1\endcsname
+ \else\PackageError{chessboard}{Style #1 not defined for curvemove}{}%
+ \fi}
+
+%% disable pgf-picture completely
+
+\define@boolkey[UFCB]{locset}{pgf}[true]{}% D
+
+\define@boolkey[UFCB]{gloset}{pgf}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgf=#1}{}}%
+
+%% clears the user "extra" pictures
+
+\define@key[UFCB]{locfill}{clearbackpgf}[true]{%
+ \let\board@pgf@extrabackground\@empty
+ }%
+
+\define@key[UFCB]{glofill}{clearbackpgf}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearbackpgf=#1}}%
+
+\define@key[UFCB]{locfill}{clearmarkpgf}[true]{%
+ \let\board@pgf@extramarkground\@empty
+ }%
+
+\define@key[UFCB]{glofill}{clearmarkpgf}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearmarkpgf=#1}}%
+
+\define@choicekey[UFCB]{locfill}{clearpgf}[\@tempval\@tempnr]{back,mark,all,both,none}[all]{% D
+ \ifcase\@tempnr\relax
+ \board@do@setsinglekeys*[UFCB]{locfill}{clearbackpgf}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{clearmarkpgf}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{clearbackpgf,clearmarkpgf}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{clearbackpgf,clearmarkpgf}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{}%
+ \fi}
+
+\define@key[UFCB]{glofill}{clearpgf}[all]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearpgf=#1}}%
+
+%% obsolete
+
+\define@key[UFCB]{locfill}{clearbackgroundpgf}[true]{%
+ \let\board@pgf@extrabackground\@empty}%
+
+\define@key[UFCB]{glofill}{clearbackgroundpgf}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearbackgroundpgf=#1}}%
+
+\define@key[UFCB]{locfill}{clearforegroundpgf}[true]{%
+ \let\board@pgf@extramarkground\@empty}%
+
+\define@key[UFCB]{glofill}{clearforegroundpgf}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,clearforegroundpgf=#1}}%
+
+%% to chose the affected picture
+
+\define@boolkey[UFCB]{locfill}{usemarkpgf}[true]{}
+
+\define@boolkey[UFCB]{glofill}{usemarkpgf}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,usemarkpgf=#1}}%
+
+\define@boolkey[UFCB]{locfill}{usebackpgf}[true]{}%
+
+\define@boolkey[UFCB]{glofill}{usebackpgf}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,usebackpgf=#1}}%
+
+\define@choicekey[UFCB]{locfill}{usepgf}[\@tempval\@tempnr]{back,mark,all,both,none}{%
+ \def\board@pgf@curusepgf{#1}%
+ \ifcase\@tempnr\relax
+ \board@do@setsinglekeys*[UFCB]{locfill}{usebackpgf=true,usemarkpgf=false}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{usemarkpgf=true,usebackpgf=false}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{usebackpgf=true,usemarkpgf=true}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{usebackpgf=true,usemarkpgf=true}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{usebackpgf=false,usemarkpgf=false}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{usepgf}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,usepgf=#1}}%
+
+
+\define@boolkey[UFCB]{locfill}{useonblack}[true]{%
+ \ifUFCB@locfill@useonblack
+ \board@pgf@addmarkground{\UFCB@locfill@useonblacktrue}%
+ \else
+ \board@pgf@addmarkground{\UFCB@locfill@useonblackfalse}%
+ \fi
+ \ifUFCB@locfill@useonblack
+ \board@pgf@addbackground{\UFCB@locfill@useonblacktrue}%
+ \else
+ \board@pgf@addbackground{\UFCB@locfill@useonblackfalse}%
+ \fi}%
+
+\define@boolkey[UFCB]{glofill}{useonblack}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,useonblack=#1}}%
+
+\define@boolkey[UFCB]{locfill}{useonwhite}[true]{%
+ \ifUFCB@locfill@useonwhite
+ \board@pgf@addmarkground{\UFCB@locfill@useonwhitetrue}%
+ \else
+ \board@pgf@addmarkground{\UFCB@locfill@useonwhitefalse}%
+ \fi
+ \ifUFCB@locfill@useonwhite
+ \board@pgf@addbackground{\UFCB@locfill@useonwhitetrue}%
+ \else
+ \board@pgf@addbackground{\UFCB@locfill@useonwhitefalse}%
+ \fi}%
+
+\define@boolkey[UFCB]{glofill}{useonwhite}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,useonwhite=#1}}%
+
+
+\define@choicekey[UFCB]{locfill}{trimtocolor}[\@tempval\@tempnr]{white,black,false}{% D
+ \def\board@pgf@curtrimtocolor{#1}%
+ \ifcase\@tempnr\relax
+ \board@do@setsinglekeys*[UFCB]{locfill}{useonwhite=true,useonblack=false}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{useonwhite=false,useonblack=true}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{useonwhite=true,useonblack=true}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{trimtocolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,trimtocolor=#1}}%
+
+\define@key[UFCB]{locfill}{trimtowhite}[true]{%
+ \board@do@setsinglekeys*[UFCB]{locfill}{useonwhite=true,useonblack=false}}%
+
+\define@key[UFCB]{glofill}{trimtowhite}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,trimtowhite=#1}}%
+
+\define@key[UFCB]{locfill}{trimtoblack}[true]{%
+ \board@do@setsinglekeys*[UFCB]{locfill}{useonwhite=false,useonblack=true}}%
+
+\define@key[UFCB]{glofill}{trimtoblack}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,trimtoblack=#1}}%
+
+\define@key[UFCB]{locfill}{starttrim}{%
+ \expandafter\board@split@field #1ARGEND%
+ \let\board@val@starttrimfilechar\board@temp@curfilechar
+ \let\board@val@starttrimfilenum\board@temp@curfilenum
+ \let\board@val@starttrimranknum\board@temp@curranknum}%
+
+\define@key[UFCB]{glofill}{starttrim}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,starttrim=#1}}%
+
+\define@key[UFCB]{locfill}{stoptrim}{%
+ \expandafter\board@split@field#1ARGEND%
+ \let\board@val@stoptrimfilechar\board@temp@curfilechar
+ \let\board@val@stoptrimfilenum\board@temp@curfilenum
+ \let\board@val@stoptrimranknum\board@temp@curranknum}%}%
+
+\define@key[UFCB]{glofill}{stoptrim}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,starttrim=#1}}%
+
+\define@key[UFCB]{locfill}{trimarea}[\printarea]{% a7-f1 %
+ \ifthenelse{\equal{#1}{empty}}%
+ {\def\board@val@starttrimfilenum{-1}%
+ \def\board@val@starttrimranknum{-1}%
+ \def\board@val@stoptrimfilenum{-1}%
+ \def\board@val@stoptrimrankenum{-1}}%
+ {\expandafter\board@split@areasort#1ARGEND%
+ \let\board@val@starttrimfilechar\board@temp@curstartfilechar
+ \let\board@val@starttrimfilenum\board@temp@curstartfilenum
+ \let\board@val@starttrimranknum\board@temp@curstartranknum
+ \let\board@val@stoptrimfilechar\board@temp@curstopfilechar
+ \let\board@val@stoptrimfilenum\board@temp@curstopfilenum
+ \let\board@val@stoptrimranknum\board@temp@curstopranknum}%
+ \ifUFCB@locfill@captrimtoprint
+ \ifnum\board@val@starttrimfilenum<\board@val@startprintfilenum
+ \let\board@val@starttrimfilenum\board@val@startprintfilenum
+ \fi
+ \ifnum\board@val@stoptrimfilenum>\board@val@stopprintfilenum
+ \let\board@val@stoptrimfilenum\board@val@stopprintfilenum
+ \fi
+ \ifnum\board@val@starttrimranknum>\board@val@startprintranknum
+ \let\board@val@starttrimranknum\board@val@startprintranknum
+ \fi
+ \ifnum\board@val@stoptrimranknum<\board@val@stopprintranknum
+ \let\board@val@stoptrimranknum\board@val@stopprintranknum
+ \fi
+ \ifthenelse
+ {\(\board@val@starttrimfilenum>\board@val@stoptrimfilenum\)
+ \OR
+ \(\board@val@starttrimranknum<\board@val@stoptrimranknum\)}%
+ {\def\board@val@starttrimfilenum{-1}%
+ \def\board@val@starttrimranknum{-1}%
+ \def\board@val@stoptrimfilenum{-1}%
+ \def\board@val@stoptrimrankenum{-1}}%
+ {}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{trimarea}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,trimarea=#1}}%
+
+\define@boolkey[UFCB]{locfill}{captrimtoprint}[true]{}%
+
+\define@boolkey[UFCB]{glofill}{captrimtoprint}[true]{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,captrimtoprint=#1}}%
+
+\define@boolkey[UFCB]{locfill}{trim}[true]{%
+ \ifUFCB@locfill@trim
+ \board@do@setsinglekeys*[UFCB]{locfill}{trimarea=\printarea}%
+ \else
+ \board@do@setsinglekeys*[UFCB]{locfill}{trimarea=\board}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{trim}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,trim=#1}}%
+
+%% clipping
+
+%% clipping the pictures along a path
+\define@key[UFCB]{locset}{clip}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{intclip}{true,#1}}%
+
+\define@key[UFCB]{gloset}{clip}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,clip={#1}}{}}%
+
+\define@key[UFCB]{locset}{pgfclip}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{intclip}{true,#1}}%
+
+\define@key[UFCB]{gloset}{pgfclip}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfclip={#1}}{}}%
+
+\define@key[UFCB]{locset}{markclip}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{intmarkclip}{true,#1}}%
+
+\define@key[UFCB]{gloset}{markclip}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markclip={#1}}{}}%
+
+\define@key[UFCB]{locset}{backclip}[true]{% D
+ \board@do@setsinglekeys*[UFCB]{intbackclip}{true,#1}}%
+
+\define@key[UFCB]{gloset}{backclip}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backclip={#1}}{}}%
+
+\define@key[UFCB]{intclip}{true}[true]{%
+ \def\board@pgf@usemarkclippath{clip}%
+ \def\board@pgf@usebackclippath{clip}}
+
+\define@key[UFCB]{intclip}{false}[true]{%
+ \def\board@pgf@usemarkclippath{discard}%
+ \def\board@pgf@usebackclippath{discard}}
+
+\define@key[UFCB]{intmarkclip}{true}[true]{%
+ \def\board@pgf@usemarkclippath{clip}}
+
+\define@key[UFCB]{intmarkclip}{false}[true]{%
+ \def\board@pgf@usemarkclippath{discard}}
+
+\define@key[UFCB]{intbackclip}{true}[true]{%
+ \def\board@pgf@usebackclippath{clip}}
+
+\define@key[UFCB]{intbackclip}{false}[true]{%
+ \def\board@pgf@usebackclippath{discard}}
+
+\define@key[UFCB]{intclip}{left}[0pt]{%
+ \def\board@pgf@markclipleftpadding{#1}%
+ \def\board@pgf@backclipleftpadding{#1}}
+
+\define@key[UFCB]{intclip}{top}[0pt]{%
+ \def\board@pgf@markcliptoppadding{#1}%
+ \def\board@pgf@backcliptoppadding{#1}}
+
+\define@key[UFCB]{intclip}{right}[0pt]{%
+ \def\board@pgf@markcliprightpadding{#1}%
+ \def\board@pgf@backcliprightpadding{#1}}
+
+\define@key[UFCB]{intclip}{bottom}[0pt]{%
+ \def\board@pgf@markclipbottompadding{#1}%
+ \def\board@pgf@backclipbottompadding{#1}}
+
+\define@key[UFCB]{intmarkclip}{left}[0pt]{%
+ \def\board@pgf@markclipleftpadding{#1}}
+
+\define@key[UFCB]{intmarkclip}{top}[0pt]{%
+ \def\board@pgf@markcliptoppadding{#1}}
+
+\define@key[UFCB]{intmarkclip}{right}[0pt]{%
+ \def\board@pgf@markcliprightpadding{#1}}
+
+\define@key[UFCB]{intmarkclip}{bottom}[0pt]{%
+ \def\board@pgf@markclipbottompadding{#1}}
+
+\define@key[UFCB]{intbackclip}{left}[0pt]{%
+ \def\board@pgf@backclipleftpadding{#1}}
+
+\define@key[UFCB]{intbackclip}{top}[0pt]{%
+ \def\board@pgf@backcliptoppadding{#1}}
+
+\define@key[UFCB]{intbackclip}{right}[0pt]{%
+ \def\board@pgf@backcliprightpadding{#1}}
+
+\define@key[UFCB]{intbackclip}{bottom}[0pt]{%
+ \def\board@pgf@backclipbottompadding{#1}}
+
+%% pgf properties
+
+\define@key[UFCB]{locfill}{color}{% D
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\color{#1}}%
+ \fi
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\color{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{color}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,color=#1}}%
+
+\define@key[UFCB]{locfill}{pgfcolor}{% D
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\color{#1}}%
+ \fi
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\color{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{pgfcolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfcolor=#1}}%
+
+%% padding for colorfields and other means
+\define@key[UFCB]{locfill}{padding}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@padding{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf %
+ \board@pgf@addbackground{\def\board@pgf@padding{#1}}%
+ \board@pgf@addbackground{\def\board@pgf@colorbackpadding{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{padding}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,padding=#1}}%
+
+\define@key[UFCB]{locfill}{pgfpadding}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@padding{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf %
+ \board@pgf@addbackground{\def\board@pgf@padding{#1}}%
+ \board@pgf@addbackground{\def\board@pgf@colorbackpadding{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{pgfpadding}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfpadding=#1}}%
+
+\define@key[UFCB]{locfill}{opacity}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground%
+ {\pgfsetfillopacity{#1}%
+ \pgfsetstrokeopacity{#1}}%%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground%
+ {\pgfsetfillopacity{#1}%
+ \pgfsetstrokeopacity{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{opacity}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,opacity=#1}}%
+
+\define@key[UFCB]{locfill}{pgfopacity}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground%
+ {\pgfsetfillopacity{#1}%
+ \pgfsetstrokeopacity{#1}}%%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground%
+ {\pgfsetfillopacity{#1}%
+ \pgfsetstrokeopacity{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{pgfopacity}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfopacity=#1}}%
+
+\define@key[UFCB]{locfill}{fillopacity}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground%
+ {\pgfsetfillopacity{#1}}%%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground%
+ {\pgfsetfillopacity{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{fillopacity}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,opacity=#1}}%
+
+\define@key[UFCB]{locfill}{pgffillopacity}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground%
+ {\pgfsetfillopacity{#1}}%%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground%
+ {\pgfsetfillopacity{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{pgffillopacity}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgffillopacity=#1}}%
+
+\define@key[UFCB]{locfill}{strokeopacity}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground%
+ {\pgfsetstrokeopacity{#1}}%
+ \fi%%
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground%
+ {\pgfsetstrokeopacity{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{strokeopacity}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,opacity=#1}}%
+
+\define@key[UFCB]{locfill}{pgfstrokeopacity}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground%
+ {\pgfsetstrokeopacity{#1}}%%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground%
+ {\pgfsetstrokeopacity{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{pgfstrokeopacity}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfstrokeopacity=#1}}%
+
+\define@key[UFCB]{locfill}{linewidth}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@linewidth{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@linewidth{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{linewidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,linewidth=#1}}%
+
+\define@key[UFCB]{locfill}{pgflinewidth}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@linewidth{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@linewidth{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{pgflinewidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgflinewidth=#1}}%
+
+\define@key[UFCB]{locfill}{backlinewidth}{% D
+ \board@pgf@addbackground{\def\board@pgf@linewidth{#1}}}%
+
+\define@key[UFCB]{glofill}{backlinewidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,linewidth=#1}}%
+
+\define@key[UFCB]{locfill}{marklinewidth}{% D
+ \board@pgf@addmarkground{\def\board@pgf@linewidth{#1}}}%
+
+\define@key[UFCB]{glofill}{marklinewidth}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,linewidth=#1}}%
+
+\define@key[UFCB]{locfill}{backcornerarc}{% D
+ \board@pgf@addbackground{\def\board@pgf@corner{#1}}}%
+
+\define@key[UFCB]{glofill}{backcornerarc}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backcornerarc=#1}}%
+
+\define@key[UFCB]{locfill}{cornerarc}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@corner{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@corner{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{cornerarc}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,cornerarc=#1}}%
+
+\define@key[UFCB]{locfill}{pgfcornerarc}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@corner{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@corner{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{pgfcornerarc}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfcornerarc=#1}}%
+
+\define@key[UFCB]{locfill}{arrow}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@arrow{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@arrow{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{arrow}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,arrow=#1}}%
+
+\define@key[UFCB]{locfill}{pgfarrow}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@arrow{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@arrow{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{pgfarrow}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfarrow=#1}}%
+
+\define@key[UFCB]{locfill}{shortenstart}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@shortenstart{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@shortenstart{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{shortenstart}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,shortenstart=#1}}%
+
+\define@key[UFCB]{locfill}{pgfshortenstart}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@shortenstart{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@shortenstart{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{pgfshortenstart}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfshortenstart=#1}}%
+
+\define@key[UFCB]{locfill}{shortenend}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@shortenend{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@shortenend{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{shortenend}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,shortenend=#1}}%
+
+\define@key[UFCB]{locfill}{pgfshortenend}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@shortenend{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@shortenend{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{pgfshortenend}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfshortenend=#1}}%
+
+\define@key[UFCB]{locfill}{shorten}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{shortenend=#1,shortenstart=#1}}%
+
+\define@key[UFCB]{glofill}{shorten}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,shorten=#1}}%
+
+\define@key[UFCB]{locfill}{pgfshorten}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{pgfshortenend=#1,pgfshortenstart=#1}}%
+
+\define@key[UFCB]{glofill}{pgfshorten}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfshorten=#1}}%
+
+\define@key[UFCB]{locfill}{text}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@curtext{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@curtext{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{text}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,text={#1}}}%
+
+\define@key[UFCB]{locfill}{pgftext}{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{\def\board@pgf@curtext{#1}}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{\def\board@pgf@curtext{#1}}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{pgftext}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgftext={#1}}}%
+
+\define@key[UFCB]{locfill}{addpgf}[\end{pgfscope}\begin{pgfscope}]{% D
+ \ifUFCB@locfill@usemarkpgf
+ \board@pgf@addmarkground{#1}%
+ \fi
+ \ifUFCB@locfill@usebackpgf
+ \board@pgf@addbackground{#1}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{addpgf}[\end{pgfscope}\begin{pgfscope}]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,addpgf={#1}}}%
+
+\define@key[UFCB]{locfill}{markstyle}{% D
+ \board@do@savemarkstyle#1ARGEND}%
+
+\define@key[UFCB]{glofill}{markstyle}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markstyle=#1}}%
+
+\define@key[UFCB]{locfill}{backstyle}{% D
+ \board@do@savebackstyle#1ARGEND}%
+
+\define@key[UFCB]{glofill}{backstyle}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backstyle=#1}}%
+
+\define@key[UFCB]{locfill}{pgfstyle}{% D
+ \expandafter\board@do@savemarkstyle#1ARGEND% change 15.08.2007
+ \expandafter\board@do@savebackstyle#1ARGEND}% changed 15.08.2007
+
+
+
+\define@key[UFCB]{glofill}{pgfstyle}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfstyle=#1}}%
+
+%%% fields marks
+
+\define@key[UFCB]{locfill}{markarea}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\board@pgf@add@fieldmarkstyletoarea{\board@temp@curarea}}}%
+
+\define@key[UFCB]{glofill}{markarea}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markarea=#1}}%
+
+\define@key[UFCB]{locfill}{backarea}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\board@pgf@add@fieldbackstyletoarea{\board@temp@curarea}}}%
+
+\define@key[UFCB]{glofill}{backarea}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,backarea={#1}}}%
+
+\define@key[UFCB]{locfill}{markareas}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\board@pgf@add@fieldmarkstyletoarea{\board@temp@curarea}}}%
+
+\define@key[UFCB]{glofill}{markareas}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markareas={#1}}}%
+
+\define@key[UFCB]{locfill}{backareas}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\board@pgf@add@fieldbackstyletoarea{\board@temp@curarea}}}%
+
+\define@key[UFCB]{glofill}{backareas}{%
+ \board@do@l@addto@macro\board@val@savedkeylist{,backareas={#1}}}%
+
+\define@key[UFCB]{locfill}{markfield}{% #1=list of fields D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\board@do@setsinglekeys*[UFCB]{locfill}{markarea=\board@temp@curfield-\board@temp@curfield}}}%
+
+\define@key[UFCB]{glofill}{markfield}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markfield={#1}}}%
+
+\define@key[UFCB]{locfill}{backfield}{% #1=list of fields D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\board@do@setsinglekeys*[UFCB]{locfill}{backarea=\board@temp@curfield-\board@temp@curfield}}}%
+
+\define@key[UFCB]{glofill}{backfield}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backfield={#1}}}%
+
+\define@key[UFCB]{locfill}{markfields}{% #1=list of fields D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\board@do@setsinglekeys*[UFCB]{locfill}{markarea=\board@temp@curfield-\board@temp@curfield}}}%
+
+\define@key[UFCB]{glofill}{markfields}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markfields={#1}}}%
+
+\define@key[UFCB]{locfill}{backfields}{% #1=list of fields D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\board@do@setsinglekeys*[UFCB]{locfill}{backarea=\board@temp@curfield-\board@temp@curfield}}}%
+
+\define@key[UFCB]{glofill}{backfields}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backfields={#1}}}%
+
+\define@key[UFCB]{locfill}{markboard}[true]{% D
+ \edef\board@temp@curstartfield{\board@val@minfilechar\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{markarea=\board@temp@curstartfield-\board@temp@curstopfield}}%
+
+\define@key[UFCB]{glofill}{markboard}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markboard=#1}}%
+
+\define@key[UFCB]{locfill}{backboard}[true]{% D
+ \edef\board@temp@curstartfield{\board@val@minfilechar\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{backarea=\board@temp@curstartfield-\board@temp@curstopfield}}%
+
+\define@key[UFCB]{glofill}{backboard}[true]{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backboard=#1}}%
+
+\define@key[UFCB]{locfill}{markrank}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ markarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{markrank}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markrank={#1}}}%
+
+\define@key[UFCB]{locfill}{backrank}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ backarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{backrank}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backrank={#1}}}%
+
+\define@key[UFCB]{locfill}{markranks}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ markarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{markranks}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markranks={#1}}}%
+
+\define@key[UFCB]{locfill}{backranks}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ backarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{backranks}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backranks={#1}}}%
+
+\define@key[UFCB]{locfill}{markfile}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ markarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{markfile}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markfile={#1}}}%
+
+\define@key[UFCB]{locfill}{backfile}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ backarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{backfile}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backfile={#1}}}%
+
+\define@key[UFCB]{locfill}{markfiles}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ markarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{markfiles}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markfiles={#1}}}%
+
+\define@key[UFCB]{locfill}{backfiles}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ backarea=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{backfiles}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backfiles={#1}}}%
+
+%%% region marks
+
+\define@key[UFCB]{locfill}{markregion}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\expandafter\board@split@areasort\board@temp@curarea ARGEND%
+ \edef\board@temp{{\board@temp@curstartfield}{\board@temp@curstopfield}}%
+ \expandafter\board@pgf@add@regionmarkstyle\board@temp%{a}{b}%
+ }}%
+
+\define@key[UFCB]{glofill}{markregion}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markregion={#1}}}%
+
+\define@key[UFCB]{locfill}{backregion}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\expandafter\board@split@areasort\board@temp@curarea ARGEND%
+ \edef\board@temp{{\board@temp@curstartfield}{\board@temp@curstopfield}}%
+ \expandafter\board@pgf@add@regionbackstyle\board@temp%{a}{b}%
+ }}%
+
+\define@key[UFCB]{glofill}{backregion}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backregion={#1}}}%
+
+\define@key[UFCB]{locfill}{markregions}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\expandafter\board@split@areasort\board@temp@curarea ARGEND%
+ \edef\board@temp{{\board@temp@curstartfield}{\board@temp@curstopfield}}%
+ \expandafter\board@pgf@add@regionmarkstyle\board@temp%{a}{b}%
+ }}%
+
+\define@key[UFCB]{glofill}{markregions}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markregions={#1}}}%
+
+\define@key[UFCB]{locfill}{backregions}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\expandafter\board@split@areasort\board@temp@curarea ARGEND%
+ \edef\board@temp{{\board@temp@curstartfield}{\board@temp@curstopfield}}%
+ \expandafter\board@pgf@add@regionbackstyle\board@temp%{a}{b}%
+ }}%
+
+\define@key[UFCB]{glofill}{backregions}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backregions={#1}}}%
+
+%%% move marks
+
+\define@key[UFCB]{locfill}{markmove}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\expandafter\board@split@area\board@temp@curarea ARGEND%
+ \edef\board@temp{{\board@temp@curstartfield}{\board@temp@curstopfield}}%
+ \expandafter\board@pgf@add@movemarkstyle\board@temp}}%
+
+\define@key[UFCB]{glofill}{markmove}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markmove={#1}}}%
+
+\define@key[UFCB]{locfill}{backmove}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\expandafter\board@split@area\board@temp@curarea ARGEND%
+ \edef\board@temp{{\board@temp@curstartfield}{\board@temp@curstopfield}}%
+ \expandafter\board@pgf@add@movebackstyle\board@temp}}%
+
+\define@key[UFCB]{glofill}{backmove}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backmove={#1}}}%
+
+\define@key[UFCB]{locfill}{markmoves}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\expandafter\board@split@area\board@temp@curarea ARGEND%
+ \edef\board@temp{{\board@temp@curstartfield}{\board@temp@curstopfield}}%
+ \expandafter\board@pgf@add@movemarkstyle\board@temp}}%
+
+\define@key[UFCB]{glofill}{markmoves}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,markmoves={#1}}}%
+
+\define@key[UFCB]{locfill}{backmoves}{% D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curarea:=\board@temp@list\do
+ {\expandafter\board@split@area\board@temp@curarea ARGEND%
+ \edef\board@temp{{\board@temp@curstartfield}{\board@temp@curstopfield}}%
+ \expandafter\board@pgf@add@movebackstyle\board@temp}}%
+
+\define@key[UFCB]{glofill}{backmoves}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,backmoves={#1}}}%
+
+%% obsolete keys, shortcuts
+
+%% obsolete key,
+\define@choicekey[UFCB]{locfill}{applycolor}[\@tempval\@tempnr]{all,none,white,black}{% D
+ \ifcase\@tempnr\relax
+ \board@do@setsinglekeys*[UFCB]{locfill}{trimtocolor=false}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{useonwhite=false,useonblack=false}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{trimtocolor=white}%
+ \or
+ \board@do@setsinglekeys*[UFCB]{locfill}{trimtocolor=black}%
+ \fi}%
+
+\define@key[UFCB]{glofill}{applycolor}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,applycolor=#1}}%
+
+\define@key[UFCB]{locfill}{colorbackarea}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{colorbackareas=#1}}%
+
+\define@key[UFCB]{glofill}{colorbackarea}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorbackarea=#1}}%
+
+\define@key[UFCB]{locfill}{colorbackareas}{% D
+ \let\board@pgf@savebackstyle\board@pgf@curbackstyle
+ \board@do@setsinglekeys*[UFCB]{locfill}{backstyle=color,backareas=#1,backstyle=\board@pgf@savebackstyle}}%
+
+\define@key[UFCB]{glofill}{colorbackareas}{% D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorbackareas={#1}}}%
+
+\define@key[UFCB]{locfill}{colorbackboard}[true]{%D
+ \edef\board@temp@curstartfield{\board@val@minfilechar\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{colorbackareas=\board@temp@curstartfield-\board@temp@curstopfield}}%
+
+\define@key[UFCB]{glofill}{colorbackboard}[true]{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorbackboard=#1}}%
+
+\define@key[UFCB]{locfill}{colorboard}[true]{%D
+ \edef\board@temp@curstartfield{\board@val@startprintfilechar\board@val@startprintranknum}%
+ \edef\board@temp@curstopfield{\board@val@stopprintfilechar\board@val@stopprintranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{colorbackarea=\board@temp@curstartfield-\board@temp@curstopfield}}%
+
+\define@key[UFCB]{glofill}{colorboard}[true]{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorboard=#1}}%
+
+\define@key[UFCB]{locfill}{colorbackranks}{%D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@currank:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@val@minfilechar\board@temp@currank}%
+ \edef\board@temp@curstopfield{\board@val@maxfilechar\board@temp@currank}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ colorbackareas=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{colorbackranks}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorbackranks={#1}}}%
+
+\define@key[UFCB]{locfill}{colorbackrank}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ colorbackranks=#1}}%
+
+\define@key[UFCB]{glofill}{colorbackrank}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorbackrank={#1}}}%
+
+\define@key[UFCB]{locfill}{colorbackfiles}{%D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfile:=\board@temp@list\do
+ {\edef\board@temp@curstartfield{\board@temp@curfile\board@val@maxranknum}%
+ \edef\board@temp@curstopfield{\board@temp@curfile\board@val@minranknum}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ colorbackareas=\board@temp@curstartfield-\board@temp@curstopfield}}}%
+
+\define@key[UFCB]{glofill}{colorbackfiles}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorbackfiles={#1}}}%
+
+\define@key[UFCB]{locfill}{colorbackfile}{% D
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ colorbackfiles=#1}}%
+
+\define@key[UFCB]{glofill}{colorbackfile}{%D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorbackfile={#1}}}%
+
+\define@key[UFCB]{locfill}{colorbackfields}{% #1=list of fields %D
+ \edef\board@temp@list{#1}%
+ \@for\board@temp@curfield:=\board@temp@list\do
+ {\board@do@setsinglekeys*[UFCB]{locfill}{colorbackareas=\board@temp@curfield-\board@temp@curfield}}}%
+
+\define@key[UFCB]{glofill}{colorbackfields}{% %D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorbackfields={#1}}}%
+
+\define@key[UFCB]{locfill}{colorbackfield}{% %D
+ \board@do@setsinglekeys*[UFCB]{locfill}{colorbackareas=#1-#1}}%
+
+\define@key[UFCB]{glofill}{colorbackfield}{% %D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorbackfield=#1}}%
+
+\define@key[UFCB]{locfill}{colorwhitebackfields}[true]{%
+ \let\board@pgf@savetrimtocolor\board@pgf@curtrimtocolor%
+ \board@do@setsinglekeys*[UFCB]{locfill}{trimtocolor=white, colorbackboard}%
+ \expandafter\board@do@setsavedkey\expandafter{\board@pgf@savetrimtocolor}{trimtocolor}}%
+
+\define@key[UFCB]{glofill}{colorwhitebackfields}[true]{% %D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorwhitefields=#1}}%
+
+\define@key[UFCB]{locfill}{colorblackbackfields}[true]{%
+ \let\board@pgf@savetrimtocolor\board@pgf@curtrimtocolor%
+ \board@do@setsinglekeys*[UFCB]{locfill}{trimtocolor=black, colorbackboard}%
+ \expandafter\board@do@setsavedkey\expandafter{\board@pgf@savetrimtocolor}{trimtocolor}}%
+
+\define@key[UFCB]{glofill}{colorblackbackfields}[true]{% %D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorblackfields=#1}}%
+
+%%obsolete
+\define@key[UFCB]{locfill}{colorblackfields}[true]{%
+ \let\board@pgf@savetrimtocolor\board@pgf@curtrimtocolor%
+ \board@do@setsinglekeys*[UFCB]{locfill}{trimtocolor=black, colorbackboard}%
+ \expandafter\board@do@setsavedkey\expandafter{\board@pgf@savetrimtocolor}{trimtocolor}}%
+
+\define@key[UFCB]{glofill}{colorblackfields}[true]{% %D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorblackfields=#1}}%
+
+%% obsolete
+\define@key[UFCB]{locfill}{colorwhitefields}[true]{%
+ \let\board@pgf@savetrimtocolor\board@pgf@curtrimtocolor%
+ \board@do@setsinglekeys*[UFCB]{locfill}{trimtocolor=white, colorbackboard}%
+ \expandafter\board@do@setsavedkey\expandafter{\board@pgf@savetrimtocolor}{trimtocolor}}%
+
+\define@key[UFCB]{glofill}{colorwhitefields}[true]{% %D
+ \board@do@l@addto@macro\board@val@savedkeylist{,colorwhitefields=#1}}%
+
+%% to add background border
+
+\define@key[UFCB]{locfill}{pgfborder}[\printarea]{%
+ \edef\board@pgf@savebackstyle{\board@pgf@curbackstyle}%
+ \board@do@setsinglekeys*[UFCB]{locfill}{%
+ backstyle=border,backregions=#1}%
+ \expandafter\board@do@setsavedkey\expandafter{\board@pgf@savebackstyle}{backstyle}}%
+
+\define@key[UFCB]{glofill}{pgfborder}[\printarea]{% %D
+ \board@do@l@addto@macro\board@val@savedkeylist{,pgfborder=#1}}%
+
+
+%</chessboard-keys-pgf>
diff --git a/macros/latex/contrib/chessboard/chessboard.ins b/macros/latex/contrib/chessboard/chessboard.ins
new file mode 100644
index 0000000000..d232755207
--- /dev/null
+++ b/macros/latex/contrib/chessboard/chessboard.ins
@@ -0,0 +1,73 @@
+%%
+%% This file will generate fast loadable files from chessfss-ex.dtx
+%% when run through LaTeX or TeX.
+%%
+%% This file is part of the LaTeX2e package chessboard
+%% ---------------------------------------------------
+%%
+%% This system is distributed in the hope that it will be useful,
+%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+%%
+%% Copyright 2006-2019 Ulrike Fischer (chess@nililand.de)
+%% -------------------------------------------
+%
+%
+%% This program can be redistributed and/or modified under the terms
+%% of the LaTeX Project Public License distributed from CTAN archives
+%% in the directory macros/latex/base/lppl.txt; either version 1 of
+%% the License, or (at your option) any later version.
+
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+\input docstrip.tex
+
+\keepsilent
+\askforoverwritetrue
+
+\preamble
+\endpreamble
+
+\ifToplevel{\ifx\generate\undefined
+ \Msg{**********************************************}
+ \Msg{*}
+ \Msg{* This installation requires docstrip}
+ \Msg{* version 2.3c or later.}
+ \Msg{*}
+ \Msg{* An older version of docstrip has been input}
+ \Msg{*}
+ \Msg{**********************************************}
+ \errhelp{Move or rename old docstrip.tex.}
+ \errmessage{Old docstrip in input path}
+ \batchmode
+ \csname @@end\endcsname
+ \fi
+ \ifx\askonceonly\undefined\else\askonceonly\fi
+}
+
+\declarepreamble\UFpreamble
+
+chessboard: a package to print chessboards
+Copyright 2006-2019 Ulrike Fischer (chess@nililand.de)
+-------------------------------------------
+
+This file can be redistributed and/or modified under the terms of
+the LaTeX Project Public License distributed from CTAN archives in
+the directory macros/latex/base/lppl.txt; either version 1 of the
+License, or (at your option) any later version.
+
+For error reports see documentation.
+\endpreamble
+
+%% File generation:
+\generate{%
+ \usepreamble\UFpreamble
+ \file{chessboard.sty}{\from{chessboard.dtx}{chessboard}}
+ \file{chessboard-pgf.sty}{\from{chessboard.dtx}{chessboard-pgf}}
+ \file{chessboard-keys-main.sty}{\from{chessboard.dtx}{chessboard-keys-main}}
+ \file{chessboard-keys-pgf.sty}{\from{chessboard.dtx}{chessboard-keys-pgf}}
+}
+\endbatchfile
+%%
+%%end of file chessboard.ins
diff --git a/macros/latex/contrib/chessboard/chessboard.pdf b/macros/latex/contrib/chessboard/chessboard.pdf
new file mode 100644
index 0000000000..fed7f6de1a
--- /dev/null
+++ b/macros/latex/contrib/chessboard/chessboard.pdf
Binary files differ
diff --git a/macros/latex/contrib/chessboard/chessboard.tex b/macros/latex/contrib/chessboard/chessboard.tex
new file mode 100644
index 0000000000..f80c6fd374
--- /dev/null
+++ b/macros/latex/contrib/chessboard/chessboard.tex
@@ -0,0 +1,3735 @@
+% !Mode:: "TeX:DE:UTF-8:Main"
+% -*- mode: TeX -*- -*- coding: UTF-8 -*-
+\listfiles
+\def\UFcurrentpackage{chessboard}
+\def\UFcurrentversion{1.8}
+%$Date$$Version$
+
+
+\RequirePackage{fix-cm}
+
+\documentclass[pagesize,parskip=half-,fontsize=12pt]{scrartcl}
+\usepackage[utf8]{inputenc}
+
+%% chessboard specific commands
+\usepackage[LSB1,LSB2, LSB3,LSBC2,LSBC3,LSBC4,LSBC5, T1]{fontenc}
+%\usepackage[skak-parse]{xskak}
+\usepackage{xskak}
+\usepackage{pifont}
+\usepackage{eqparbox}
+
+\newcommand\Chess[1][1cm]{\boardfont\fontsize{#1}{#1}\setboardfontsize{#1}\selectfont}
+\newcommand\Plus{\raisebox{0.5ex}{\normalfont\fontsize{1.5ex}{1.5ex}\bfseries\,+\,}}
+\newcommand\Equal{\raisebox{0.5ex}{\normalfont\fontsize{1.5ex}{1.5ex}\bfseries\,=\,}}
+
+\makeatletter
+\newcommand\Describesetkey[4]{\par\index{#1}%
+ \colorbox{yellow!50}{\makebox[\dimexpr\textwidth-2\fboxsep\relax]{\ttfamily%
+ \eqparbox{setkey}{#1=\meta{#2}}\hfill
+ \eqparbox{setexample}{%
+ \ifthenelse{\equal{#3}{}}%
+ {#1}
+ {#1={#3}}}\hfill
+ \eqparbox{setdefault}{\hfill #4}}}\par\nobreak\@afterheading}
+
+
+\newcommand\Describefillkey[4][]{\par\index{#2}%
+\makebox[0pt][r]{\scriptsize #1\hspace{1em}}%
+ \colorbox{green!25}{\makebox[\dimexpr\textwidth-2\fboxsep\relax]{\ttfamily%
+ \eqparbox{fillkey}{#2=\meta{#3}}\hfill
+ \eqparbox{fillexample}{%
+ \ifthenelse{\equal{#4}{}}%
+ {#2}
+ {#2={#4}}}}}%
+ \par\nobreak\@afterheading}
+
+
+
+\makeatother
+
+%\usepackage{filecontents} only needed after change of docu.sty
+\usepackage{UF-documentation}
+
+%initialisation
+\setchessboard{smallboard, showmover=false}
+
+
+
+\begin{document}
+\newchessgame
+\title{\packagename{chessboard}: A package to print chessboards}
+\author{Ulrike Fischer}
+\maketitle
+
+\begin{center}
+\newchessgame
+\setchessboard{shortenend=5pt,color=red,margin=false}%
+\unitlength1pt
+\newcommand\currentboard[1][]{%
+ \begin{picture}(150,150)
+ \put(10,10){\chessboard[#1]}
+ \end{picture}}%
+\begin{animateinline}[autoplay,loop]{1}%
+\currentboard
+\newframe
+\hidemoves{1.e4}%
+\currentboard[pgfstyle=straightmove,markmove=e2-e4,
+ pgfstyle=border,markfields={e2,e4}]
+\newframe
+\hidemoves{1... e5}%
+\currentboard[pgfstyle=straightmove,markmove=e7-e5,
+ pgfstyle=border,markfields={e7,e5}]
+\newframe
+\hidemoves{2. Nf3}%
+\currentboard[pgfstyle=knightmove,markmove=g1-f3,
+ pgfstyle=border,markfields={g1,f3}]
+\newframe
+\hidemoves{2... Nc6}%
+\currentboard[pgfstyle=knightmove,markmove=b8-c6,
+ pgfstyle=border,markfields={b8,c6}]
+\newframe
+\hidemoves{3.Bb5}%
+\currentboard[pgfstyle=straightmove,markmove=f1-b5,
+ pgfstyle=border,markfields={f1,b5}]
+\newframe
+\hidemoves{3... a6}%
+\currentboard[pgfstyle=straightmove,markmove=a7-a6,
+ pgfstyle=border,markfields={a7,a6}]
+\end{animateinline}
+\end{center}
+
+
+
+\tableofcontents
+\section{Changes}
+\minisec{Attention!} From version 1.5 on the documentation uses the
+(new) package \packagename{xskak} instead of \packagename{skak}. The
+most notable difference is that in some examples \cs{newchessgame}
+instead of \cs{newgame} is used. But in most cases all examples
+should work with \packagename{skak} alone too. The package
+\packagename{xskak} adds quite a lot new keys to \cs{chessboard} to
+show arbitrary positions from previously parsed games. Read its
+documentation if you want to use them.
+
+
+In version 1.3 I made a lot of changes. I tried to preserve the
+behaviour of existing keys and commands. But is possible that older
+documents will look different when processed with this version.
+
+Notably two things can give problems: The value of the
+\key{padding} key now affects much more objects (marks) in the pgf
+pictures. So it could be necessary to reset the padding. And the
+\key{applycolor} has changed its behaviour. It will now also affect
+the foreground picture.
+
+\begin{description}
+\item[2019-06-23 (Version 1.8)] Uploaded the source of the documentation to ctan.
+ No longer use \cs{arabic} internally, to avoid problems with packages redefining the command. (Issue \#1).
+
+\item[2011-03-17 (Version 1.7)] Changed definition of the triangle mover
+ style. It now uses \packagename{tikz} and no longer
+ \packagename{amssymb}. \packagename{chessboard} no longer loads
+ \packagename{amssymb} (it clashes with \packagename{xunicode}).
+
+\item[2011-03-13 (Version 1.7)] Corrected a bug with spacing when the
+ \packagename{amsart} is used.
+
+
+\item[2008-11-27 (Version 1.6)] Corrected a bug in \key{getpiecelists}
+(empty lists were undefined).
+
+
+\item[2007-12-11 (Version 1.5)] Added the key \key{getpiecelists} to
+retrieve the positions of pieces. Quite a lot new keys to show
+arbitrary positions from previously parsed games are added by the
+package \packagename{xskak}. Read its documentation if you want to
+use them.
+
+\item[2007-08-20 (Version 1.5)] Added curvemove-style to draw moves.
+Corrected some bugs. Changed a lot internally to adapt the package to
+\packagename{xskak.sty}.
+
+\item[2007-07-03 (Version 1.4)] Rewrote the code that process the
+keys saved globally (with \cs{chessboard}) and in styles (with
+\cs{storechessboardstyle}) to go around a problem due to a change in
+\packagename{xkeyval 2.5}. Corrected some errors in the
+documentation.
+\item[2006-07-20 (Version 1.3)] Rearranged and rewrote the keys and commands for
+the pgf-pictures. Now all styles and marks can be used in both
+pictures. Added definitions for partial borders. Extended trim and
+clip commands. \packagename{xifthen} is now required.
+\item[2006-06-22] Added keys for fancy borders, added local commands for
+the boardarea and the printarea. Disabled the option skaknew as it
+not longer works in \chessfss.
+\end{description}
+
+
+
+
+\section{Introduction}
+\minisec{What is does} \DescribeMacro{\chessboard} This package
+offers a command \cs{chessboard}\keyoarg{} to print boards of chess
+positions and similar games. It is intended to replace the
+\cs{showboard} command of \skaksty which has some deficiencies:
+\begin{itemize}
+\item To print a special position one always has to type the
+complete FEN.
+\item It frames all boards with a rule of 1pt -- which is okay
+for a large board but doesn't look good on small boards.
+\item It's difficult (up to impossible) to color some squares.
+\item Even for simple markings like crosses or the mover \skaksty use
+postscript. That makes it difficult to use pdf\LaTeX.
+\item It's difficult to print partial boards.
+\item It's difficult (up to impossible) to print boards with exotic
+pieces e.g.\ fairy chess.
+\item It's impossible to print boards with unusual dimension or unusual labels used by other games e.g.\
+10\texttimes10 boards with numbers instead of characters.
+\item The labels at the bottom changes the baseline which makes it
+difficult to align boards.
+\item Some commands e.g., \cs{notationoff} of \skaksty redefines \cs{skakboard}, so it
+is difficult to patch the command e.g.\ to get larger margins.
+\end{itemize}
+
+
+With \pchessboard you have now full control about size, content and
+look of the board. I have tried to make \cs{chessboard} as flexible
+as possible. So I added a lot of options to change values that
+control the size, layout and filling of the board. In most cases you
+can ignore them but being able to change them can come handy if you
+need something unusual.
+
+But I didn't tried to stretch flexibility too much. The main aim of
+the package is to print chessboards easily, so e.g.\ the inputs use
+the naming conventions of chess. That means that -- as the files are
+numbered alphabetically -- the width of the board is restricted to 26
+fields (27 with option \key{zero}). The board is build with
+alternating black and white fields, changing to e.g.\ three colors
+could be difficult. The pieces are named with simple ASCII-chars, so
+the number of different pieces is restricted. (It is perhaps possible
+to define piecenames consisting of two or more chars, and to use such
+names by putting braces around the chars e.g.,
+\verb+{KK}a3+. A small test worked fine for me, but I wouldn't bet
+that it really works everywhere.)
+
+\minisec{What it doesn't} \Pchessboard doesn't offer commands to type
+captions or titles or a list of the chessboards. There are no options
+that control the placement of the board in the text flow, e.g. to
+center it or to let it float. This is a design decision.
+\cs{chessboard} prints only chessboards like \cs{includegraphics}
+inserts only graphics.
+
+
+
+\subsection{Bugs and errors}
+
+I'm quite sure that they are bugs and errors in the package. I did
+find some quite horrible while making the documentation and I'm sure
+I overlooked some. E.g.\ I have a lot of doubts if spaces and braces
+in keys saved in a style or with \cs{setchessboard} are handled
+correctly in every case.
+
+If you have questions ask them in the newsgroups
+\nolinkurl{comp.text.tex} or
+\nolinkurl{de.comp.text.tex}. I'm reading these groups regularly and
+I'm much better in answering there than in answering e-mails.
+
+
+If you find errors in this text (this includes wrong english) or in
+the package, you can write me a bugreport at
+\nolinkurl{skak@nililand.de}. A bugreport should contain a complete \emph{minimal}
+example and the log-file of the pdf\LaTeX\ run (this is the engine
+that makes a pdf!).
+
+Before sending a bug record check the following things:
+
+
+\minisec{If you get mysterious error messages}
+\begin{itemize}
+\item Check the commas in the \keylists.
+\end{itemize}
+
+\minisec{Missing or faulty pgf-decorations}
+\begin{itemize}
+\item Check if the borders or marks are hidden under other decorations or under board chars with solid fieldmasks.
+\item Check if trimming is responsible: try the key \verb+trim=false+.
+\item Check the state of the key \key{pgf}.
+\item Try another previewer, zoom in and out, print the document.
+\item Go through your log-file and search for chessboard warnings.
+\end{itemize}
+
+
+\subsection{Requirements}
+
+\Pchessboard uses some primitives of e\TeX. It needs a recent version
+of \chessfss (chess font selection), \packagename{xkeyval}
+(\textit{key=value}-syntax) and \packagename{xifthen}. It also needs
+the packages \packagename{pgfcore}, \packagename{pgfbaseshapes} (from
+pgf for the highlighting commands), \packagename{pst-node} (from
+pstricks).
+
+
+\subsection{Installation}
+Run \filetype{chessboard.ins} through \LaTeX\ and then put the four
+\filetype{.sty}-files somewhere where \LaTeX\ finds them.
+\path{<texmf>/tex/latex/chessboard/} is a good place. Update the
+filename database.
+
+\subsection{Robustness: using \texorpdfstring{\cs{chessboard}}{\textbackslash chessboard} in moving arguments}
+I have used \cs{chessboard} in tabulars and in moving arguments. It
+seems to work fine, so I would say the command is quite robust.
+
+Putting chessboards in the table of contents or the header will in
+most case not look very good, so it is sensible to avoid it with
+\lstinline+\section[short text]{\chessboard Title}+.
+But if you want to do some advices:
+\begin{itemize}
+\item
+Boards in the title and in the table of contents are built at different times during the run, when perhaps
+different options and different games are active, so they can look
+different if you are not careful.
+\item You can't put boards in the bookmarks of a pdf, use
+\verb+\texorpdfstring+ from \packagename{hyperref} to provide a
+replacement.
+\item Some pagestyles puts a command to uppercase around the header.
+This affects keys in the optional argument of \cs{chessboard} and
+will give error messages about undefined keys. Try to surround the
+\cs{chessboard} command with \cs{lowercase}\verb+{...}+.
+\end{itemize}
+
+
+
+\subsection{Setting the options}
+
+\Pchessboard use the keyval syntax \meta{key}\texttt{=}\meta{value}.
+
+It differs in some respects to other packages with keyval syntax:
+\mynobreakpar
+\begin{itemize}
+\item
+There are really \emph{very} much keys.
+\item
+Some keys don't set properties of a board (like a width) but
+\emph{do} things like drawing.
+\item
+The order of the keys can matter.
+\item
+Some effects are achieved by using two or more keys after one other.
+\end{itemize}
+
+There are keys that need a certain type of argument, e.g.\ a length
+or a list of fields. There are boolean keys that accept only the
+values \texttt{=true} and \texttt{=false} where the value
+\texttt{=true} can always be omitted. And at last there are keys
+that works as \emph{commands}, you can use whatever argument you want
+or leave it blank. Don't confound this commands with boolean keys.
+E.g.\
+\texttt{clearboard}, \texttt{clearboard=hallo} and even
+\texttt{clearboard=false} will always clear the board.
+
+
+I'm struggling permanently with the naming of the keys. Giving them
+names that are not to long, but descriptive and a bit systematic
+isn't easy. Also it isn't easy to decide if a special effect should
+be achieve with one key (which gives a short input) or with a
+combination of keys (with is more flexible as it can be used to
+implement similar effects but gives longer input). While the package
+evolved I sometimes tumbled in problems and inconsistencies of the
+current naming scheme and had to reconsider my decisions and
+implemented better names or new key combinations. I didn't delete or
+disable older, now perhaps obsolate keys in any case, as I wanted to
+avoid that older documents breaks. I also sometimes add a key that
+is simply a copy of an existing key only to get a more consistent
+naming. So ist quite possible that you can get the same result with
+different key combination. For a lot of things there isn't one
+correct way -- you can choose the one which suits you more.
+
+
+It's easy to make mistakes when using a lot of keys. So if you get
+mysterious errors check that you don't have forgot a comma between
+the keys, that you put braces around lists used as value, that you
+didn't use a backslash before a key, that you didn't used a list of
+fields when a list of pieces is requested.
+
+
+\DescribeMacro{\setchessboard} You can set an option either for one
+board by using the optional argument of \cs{chessboard} or by using
+\cs{setchessboard}\keymarg{} which sets the keys for all following
+boards in the same environment/group.
+
+\begin{LTXexample}
+Default setting in this Dokumentation:
+\setchessboard{
+ smallboard,
+ showmover=false}
+\newchessgame
+\chessboard
+\end{LTXexample}
+
+Even if they share the same name, keys used in the argument of
+\cs{chessboard} are implementated differently than the keys used in
+\cs{setchessboard}. They do different things: In the first case the
+key gets «executed» while in the second case the \keyvalue pair is
+only stored for later use. So it is quite possible that a key works
+with \cs{chessboard} but fails because of a bug when used in
+\cs{setchessboard} or vice-versa.
+
+
+Values set by keys in the argument of \cs{chessboard} will if
+appropriate overwrite the ones set by \cs{setchessboard}.
+
+The keys belong roughly to two classes: There are the keys that set
+one property of the board, e.g.\ the width of a rule or the size.
+Such keys always have a default and only the last value set is used,
+it overwrites all previous values. Internally I call such keys
+«set-keys». In the second class there are keys that can be used more
+than once, e.g.\ keys that add a piece or a mark or a color to the
+board. I call such keys «fill-keys».\footnote{I did realize only
+quite late that using keys not only to set some parameters but also
+for the real content is a bit unusual. It is a bit as if one would
+use keys for the items of a list or the lines of tabular or the code
+in a listing -- in most cases quite a bad idea. But at my opinion it
+works fine in this special case because a chessboard is a quite
+restricted room with only 64 fields.}
+
+
+The «set-keys» are always processed first. Inside the classes the
+keys are processed in general from «left to right», so later keys can
+overwrite values set by earlier keys. This is also true for values
+hidden in a \key{style}.
+
+
+
+
+
+
+For each «set-key» you will find in this documentation a box like
+this:
+
+\Describesetkey{zero}{true|false}{false, zero}{false}
+
+
+It shows on the left the general description of the possible values,
+in the middle one or more examples of correct input, and on the
+right the default value.
+
+For each «fill-key» you will find in this documentation a box like
+this:
+
+\Describefillkey{clearranks}{list of ranks}{8}
+
+It shows on the left the general description of the possible values
+and on the right one or more examples of correct input.
+
+
+
+\subsection{Saving optionlists}
+
+\Describefillkey{style}{name}{mystyle}
+
+\DescribeMacro{\storechessboardstyle} With the
+\cs{storechessboardstyle}\marg{name}\keymarg{} it is possible to
+store a list of \keyvalue-pairs in a «style» and to use this style
+instead of the keys themselves.
+
+\begin{LTXexample}
+\storechessboardstyle{10x10}{%
+ maxfield=j10,
+ clearboard,
+ startfen=b9,
+ restorefen=current,
+ labelleftwidth=1.5ex}
+
+\storechessboardstyle{red-yellow}{%
+ boardfontencoding=LSBC3,
+ whitepiececolor=red,
+ blackpiececolor=yellow,
+ setfontcolors}
+
+\setchessboard{style=red-yellow}
+\newchessgame
+\chessboard
+
+\chessboard[style=10x10]
+\end{LTXexample}
+
+\minisec{Attention} \cs{storechessboardstyle} and \cs{setchessboard}
+only store the \keyvalue pair, they don't expand anything and they
+don't do anything with them. So be careful when using commands that
+could be redefined later:
+
+\begin{LTXexample}
+\def\mylist{Ke1, qe2, kf3}
+\setchessboard{setpieces=\mylist}
+\def\mylist{Ke1, ra1, ke3}
+\chessboard
+\end{LTXexample}
+
+
+
+
+
+\subsection{Naming the board}
+
+In chess the rows of the board are called \emph{ranks} and are
+numbered from 1 to 8. The columns are called \emph{files} and are
+«numbered» from a to h.\footnote{%
+I have some difficulties to remember the english names, so I use the
+following mnemonics:
+\textbf{F}i\textbf{L}e = co\textbf{L}umn = \textbf{L}inie =
+al\textbf{F}abet,
+\textbf{R}ank = \textbf{R}ow = \textbf{R}eihe = numbe\textbf{R}ed}
+
+\Pchessboard use this naming conventions for all inputs:
+Every time \meta{field} is used in this documentation, you should
+give a char from a--z followed by a number.
+
+
+\subsection{Naming areas of the board}
+
+Rectangular areas are normally described by giving the coordinates
+of the left bottom corner and the right upper corner. But when using
+the Forsyth Edwards Notation (FEN) chessboards are filled starting
+from the left upper corner a8 and then going on to the right and
+down to the right bottom corner -- like the normal typesetting
+direction. So it is quite natural to use for FEN related areas this
+corners. As it would be awkward to have two different ways to
+describe areas, I decided to use the fen convention everywhere: Each
+area has a
+\emph{startfield}, the left upper corner, and a \emph{stopfield},
+the right bottom corner. If some area related keys don't seem to
+work, check that you have used the correct corners!
+
+
+An area can also be given as two fields separated by an hyphen. When
+using this input you don't have to worry about the corners, the
+package will sort them:\\
+\meta{area}=\meta{a corner}-\meta{the opposite corner}.
+
+
+\DescribeMacro{\printarea} \DescribeMacro{\board} \cs{chessboard}
+sets at the start this two command to the current values of the
+printarea and the total board as given by the keys \key{zero},
+\key{maxfield} and \key{printarea}. You can use this commands in
+later keys.
+
+
+\subsection{FEN: Forsyth-Edwards Notation}\label{sec:FEN}
+
+FEN describes a chess position. It consist of 6 fields, separated by
+spaces. The first field represents the placement of the pieces on
+the board. The second field represents the active color. A lower
+case «w» is used if White is to move; a lower case «b» is used if
+Black is the active player. The third field represents castling
+availability. The fourth field is the en passant target square. The
+fifth field is a nonnegative integer representing the halfmove
+clock. The sixth and last field is a positive integer that gives the
+fullmove number.
+
+In the first field the board contents are specified starting with
+the eighth rank and ending with the first rank («in typesetting
+direction» when the board has the standard orientation). For each
+rank, the squares are specified from file a to file h. White pieces
+are identified by uppercase piece letters («\texttt{PNBRQK}») and
+black pieces are identified by lowercase piece letters
+(«\texttt{pnbrqk}»). Empty squares are represented by the digits one
+through eight; the digit used represents the count of contiguous
+empty squares along a rank. A solidus character «\texttt{/}» is used
+to separate data of adjacent ranks.
+
+\cs{chessboard} handles FEN-input but also only «FEN-like»-input. If
+given a complete FEN \cs{chessboard} will store all fields in
+commands and evaluate the first field to fill the board. But if they
+are less than six fields, \cs{chessboard} will not complain but
+simply fill up the missing fields with some default values.
+
+In the first field there don't need to be exact 8 pieces in each rank
+and exactly 8 rank descriptions. When there are more pieces than
+needed, \cs{chessboard} will ignore them. When there are less pieces
+than needed then \cs{chessboard} will leave the remaining fields in
+this rank untouched.
+
+
+The FEN can also be stored in a command. So all \cs{chessboard} will
+accept all the following inputs as \meta{FEN}:
+
+{\ttfamily
+ rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1\\
+ rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR \\
+ 8qK\\
+ 10 w - - 0 10}\\
+ \verb+\myfen+
+
+\subsection{The main parts of the board}
+Each chessboard is build by printing three «layers» on top of each
+other:
+
+\minisec{1. The background layer}
+
+This is a pgf-picture that lies under the board. It can be used for
+background colors or fancy borders or other background decoration.
+%Coloring or drawing something in this layers means adding a color
+%command or pgf commands to the code of the picture. How to do this
+%will be described in the section about decorating the background.
+
+%\minisec{2. The (four) font layers}
+\minisec{2. The main board layer}
+This is the main part of the board. It lies above the background
+picture. It uses only «normal» \LaTeX\ objects like rules and chars.
+Labels, movers and figures are all build together in this layer.
+
+\minisec{3. The mark layer}
+
+This layer is again a pgf picture now over the board. It can be used
+to draw crosses, arrows etc on the board.
+
+The sections \ref{startmain} to \ref{stopmain} describe how to
+manipulate the main layer. The section \ref{startpgf} describes
+how to handle the pgf pictures.
+
+
+
+
+
+
+\section{Setting the contents of the board}\label{startmain}
+
+\subsection{The maximum number of fields}
+\Describesetkey{maxfield}{field}{j10}{h8}%
+Chessboards have 8\texttimes8 fields. So this is the default. If you
+want another size you should declare a new right upper corner with
+\key{maxfield=}\meta{Field} e.g., \key{maxfield=j10} for a 10\texttimes10 board.
+Don't use this key if you want only to print a partial board, there
+is another key to achieve this. Use it to change the maximum size
+of a board. All fields and areas you use in other arguments should lie inside this maximum size.
+
+\begin{LTXexample}
+\newchessgame
+\chessboard[tinyboard,
+ maxfield=f6]
+\end{LTXexample}
+
+
+\begin{LTXexample}
+\newchessgame
+\chessboard[tinyboard,
+ maxfield=j10,
+ labelleftwidth=2ex]
+\end{LTXexample}
+
+\Describesetkey{zero}{true|false}{false}{false}%
+I was told that some games numbers the fields starting with 0. So I
+added this option. When set to true the rank numbers start with 0 and
+a file named Z is added left to the file a.
+
+\begin{LTXexample}
+\newchessgame
+\chessboard[zero,
+ labelbottomformat=\arabic{filelabel},
+ addpieces={KZ0, QZ8}]
+\end{LTXexample}
+
+
+\subsection{Filling with \skaksty}
+When \skaksty is loaded and there is a running game, \cs{chessboard}
+will fill the board with the current position.
+
+\begin{LTXexample}
+\newchessgame
+\mainline{1. e4 e5 2. Nf3 Nc6 3. Bb5 a6}
+\chessboard
+\end{LTXexample}
+
+\subsection{Clearing}
+\Describefillkey{clearboard}{arbitrary}{}
+\Describefillkey{cleararea}{area}{a1-c3}
+\Describefillkey{clearareas}{list of areas}{\{a1-c3,g7-h8\}}
+\Describefillkey{clearfile}{file}{g}
+\Describefillkey{clearfiles}{list of files}{\{g,h\}}
+\Describefillkey{clearrank}{rank}{5}
+\Describefillkey{clearranks}{list of ranks}{\{8,7\}}
+\Describefillkey{clearfield}{field}{c6}
+\Describefillkey{clearfields}{list of fields}{\{b5,c6\}}
+
+You can't prevent that \cs{chessboard} fills up the board with the
+running game, so if you need an empty board, you should clear it --
+either with the keys mentioned here, or by using one of the keys
+described later that clears the board before adding new pieces.
+
+\begin{LTXexample}
+\newchessgame
+\mainline{1. e4 e5 2. Nf3 Nc6 3. Bb5 a6}
+\def\ranklist{7 ,6 }
+\def\cleararea{a1-b2}
+\chessboard[clearfiles=g,
+ clearranks=\ranklist,
+ cleararea=\cleararea,
+ clearfields={b5,c6}]
+\end{LTXexample}
+
+
+\subsection{Adding single pieces}
+
+\Describefillkey{setpieces}{List of piece positions}{\{Ke4, Qe1, kd6\}}%
+\Describefillkey{addpieces}{List of piece positions}{\{Ke4, Qe1, kd6\}}%
+
+The \key{setpieces} first clears the board and then set the pieces,
+the \key{addpieces} only set the new pieces but lets the existing
+pieces undisturbed.
+
+\begin{LTXexample}
+\newchessgame
+\mainline{1. e4 e5 2. Nf3 Nc6 3. Bb5 a6}
+\def\piecelist{Ke1,Qd1 , Rg1}
+\chessboard[setpieces={ra1, rh8, ke8},
+ addpieces=\piecelist]
+\end{LTXexample}
+
+\Describefillkey{setwhite}{List of piece positions}{\{Ke4, Qe1, kd6\}}
+\Describefillkey{addwhite}{List of piece positions}{\{Ke4, Qe1, kd6\}}
+\Describefillkey{setblack}{List of piece positions}{\{Ke4, Qe1, kd6\}}
+\Describefillkey{addblack}{List of piece positions}{\{Ke4, Qe1, kd6\}}
+
+It is a bit cumbersome to have to be careful to use uppercase chars
+for the white and lowercase chars for the black piece. With the keys
+\key{setwhite}, \key{addwhite}, \key{setblack} and \key{addblack}
+you can add white and black pieces
+without caring about the cases. Like the keys for adding pieces, the
+keys starting with \key{set} first clears the board, so if you don't
+want to loose all the set pieces, you should use such a key only
+once.
+
+\begin{LTXexample}
+\def\whitepieces{kc3, nc2, pa2, Pd4}
+\chessboard[setwhite=\whitepieces,
+ addblack={Kc8,bh7, pa7}]
+\end{LTXexample}
+
+
+\subsection{Adding FEN-positions}
+
+
+\Describefillkey{setfen}{FEN}{\string\myfen, rnbqk/8/RNBQK}
+\Describefillkey{addfen}{FEN}{\string\myfen, rnbqk/8/RNBQK}
+
+With this keys you can add pieces to the board by given a FEN. The
+\key{setfen} will clear the board, \key{addfen} will left pieces
+outside the fields described by the FEN undisturbed.
+
+\begin{LTXexample}
+\newchessgame
+\def\myfen{KK//KK}
+\chessboard[addfen=\myfen]
+\end{LTXexample}
+
+\Describefillkey{startfen}{field}{b7}%
+
+As a default \cs{chessboard} fills the board with a FEN-position
+starting at the left upper corner. You can shift this start field
+with the key \key{startfen}.
+
+\begin{LTXexample}
+\newchessgame
+\def\myfen{KK//KK}
+\chessboard[startfen=c7, addfen=KK//KK,
+ startfen=f3, addfen=\myfen]
+\end{LTXexample}
+
+
+\Describefillkey{startfill}{field}{b7}
+\Describefillkey{stopfill}{field}{f2}
+\Describefillkey{fillarea}{area}{c2-d4}
+
+With this keys you can restrict the part of the board that is filled
+by a FEN. Only the pieces inside the fillarea are set.
+
+\begin{LTXexample}
+\newchessgame
+\def\myfen{kqrb///KQRB}
+\chessboard[setfen=\myfen, startfen=e4, fillarea=f2-g4, addfen=\myfen]
+\end{LTXexample}
+
+\subsection{Saving positions}
+\Skaksty has the command \cs{storegame}\marg{name} that stores the
+FEN of the current game in an internal command, and the command
+\cs{savegame}\marg{name} that stores the FEN in a file
+\marg{name}\filetype{.fen}
+
+\Pchessboard defines similar keys. The key \key{storefen}=\meta{name}
+stores the FEN in an internal command \emph{with the same name} as
+used by \cs{storegame}\marg{name}. That means that you can exchange
+the games stored by \skaksty and \pchessboard, but it also means that
+\pchessboard can \emph{overwrite} games stored with \skaksty. So be
+careful!
+
+\medskip
+\Describefillkey{storefen}{name}{game1}
+\Describefillkey{savefen}{name of file}{game}
+
+\key{storefen} saves the current position as FEN to a internal command.
+\key{savefen} saves the current position as FEN to a file.
+
+\medskip
+\Describefillkey{startstore}{field}{b7}
+\Describefillkey{stopstore}{field}{f2}
+\Describefillkey{storearea}{area}{c2-d4}
+
+With this keys you can restrict the area that is stored or saved. But
+attention: \skaksty absolutly doesn't like «illegal» FENs that
+doesn't describe a full 8\texttimes8 board.
+
+\medskip
+\Describefillkey{mover}{w|b}{w}
+\Describefillkey{castling}{castling possibilies}{Kq}
+\Describefillkey{enpassant}{field|-}{c4}
+\Describefillkey{halfmove}{number}{14}
+\Describefillkey{fullmove}{number}{20}
+
+With this keys you can set the rest of the FEN-fields. Apart from
+\key{mover} the values are only used if you save FENs. The values
+are also set, if you use in the argument of a
+\key{setfen} or \key{addfen} key complete FENs instead of only the position part.
+
+\subsection{Getting the positions of pieces}
+
+\Describefillkey{getpiecelists}{}{}
+
+New in version 1.5 there is a key, that retrieves the position of the
+pieces on the board. For each piece type there is a list called
+\cs{cblist}\meta{piece}.\index{cblists=\verb!*+\cblist+\meta{piece}}.
+The lists can be used everywhere where a list of fields is expected.
+E.g. it is possible to use the lists to highlight all pawns (see
+section \ref{sec:drawfields}).
+
+Unlike almost all other commands of \packagename{chessboard} this
+commands are saved globally. This makes it possible to use the lists
+after the board:
+
+\begin{LTXexample}
+ \newchessgame
+ \chessboard[getpiecelists]
+
+ White pieces: \king\cblistK, \queen\cblistQ,
+ \rook\cblistR, \bishop\cblistB,
+ \knight\cblistN, \pawn\cblistP.
+
+ Black pieces: \king\cblistk, \queen\cblistq,
+ \rook\cblistr, \bishop\cblistb,
+ \knight\cblistn, \pawn\cblistp.
+\end{LTXexample}
+
+
+\subsection{Using saved and stored games}
+
+When you are using \skaksty, you can use the saved games to set the
+start position of a game with the \skaksty-commands
+\cs{restoregame}\marg{name} (restores the game stored with
+\cs{storegame}) and \cs{loadgame}\marg{name} (loads the game saved
+with \cs{savegame}). This only works if you have saved the position
+of a normal 8\texttimes8-board!
+
+
+
+\medskip
+\Describefillkey{restorefen}{name}{game1}
+\Describefillkey{loadfen}{name}{game}
+
+You can also use the saved games to set positions on \cs{chessboard}.
+\key{restorefen} will use games saved with \cs{storegame} and
+\key{storefen}, \key{loadfen} will load games saved with
+\cs{savegame} and \key{savefen}.
+
+
+
+
+\begin{LTXexample}
+\newchessgame
+\def\gamename{rank7}
+\chessboard[storearea=a7-h7, storefen=\gamename,
+ startfen=a5, restorefen=rank7]
+\end{LTXexample}
+\begin{LTXexample}
+\mainline{1. e4 e5}
+\savegame{file} % to file.fen
+\mainline{2. Nf3 Nf6}
+\def\filename{file}
+\chessboard[loadfen=\filename]
+\end{LTXexample}
+
+\subsection{Restoring the running game}
+
+\cs{chessboard} saves the running game at the start under the name
+«current».
+
+\begin{LTXexample}
+\newchessgame
+\mainline{1. e4 e5 2. Nf3 Nc6 3. Bb5 a6}
+
+\chessboard[maxfield=j10,
+ clearboard,
+ startfen=b9,
+ restorefen=current]
+\end{LTXexample}
+
+
+\subsection{Changing the input language}
+
+\Describefillkey{language}{name}{german}
+\DescribeMacro{\cbDefineLanguage}
+\DescribeMacro{\cbDefineTranslation} With this key you can change the
+language used for input of pieces. The key doesn't affect the input
+language of \skaksty. It also doesn't affect the language of saved
+and restored games. \cs{chessboard} will always switch to english in
+this cases! Up to now only german translations are built in (I don't
+know how chess pieces are called in other languages), but it isn't
+difficult to add other languages. The code for german should be quite
+selfexplanatory:
+
+\begin{lstlisting}
+\cbDefineLanguage{german}%
+\cbDefineTranslation{german}{K}{K}%
+\cbDefineTranslation{german}{Q}{D}%
+\cbDefineTranslation{german}{R}{T}%
+\cbDefineTranslation{german}{B}{L}%
+\cbDefineTranslation{german}{N}{S}%
+\cbDefineTranslation{german}{P}{B}%
+\cbDefineTranslation{german}{k}{k}%
+\cbDefineTranslation{german}{q}{d}%
+\cbDefineTranslation{german}{r}{t}%
+\cbDefineTranslation{german}{b}{l}%
+\cbDefineTranslation{german}{n}{s}%
+\cbDefineTranslation{german}{p}{b}%
+\end{lstlisting}
+
+You can mix the languages in the input (but I don't think you should
+do it, it can get quite confusing, it's better to stick to one
+language).
+
+\begin{LTXexample}
+\def\whitepieces{lc4, sg1}
+\chessboard[setpieces={qd8, ra8, bh8},
+ language=german,
+ addpieces={Da1, Th4},
+ addwhite=\whitepieces,
+ addblack={Bb7}]
+\end{LTXexample}
+
+\section{The look of the board}
+
+\subsection{Units for lengths}
+
+For many of the following commands you will have to enter a length.
+This can be an absolute length like 1in, 2cm, 4pt. But often you will
+prefer a relative length. In most cases the font related length 1ex,
+1em and \cs{baselineskip} will be the same as a half of the square
+width, the width of the square and the total height of a
+square.\footnote{I learned on the hard way that you shouldn't rely
+that fonts sets em and ex correctly, e.g.\ the font
+\chessfontname{skak} doesn't do it and so the units default to zero
+which can be quite confusing. So I decided to set the fontdimen
+values explicitly.} The package uses internally the three lengths
+offered by \chessfss\ -- \cs{len@cfss@squarewidth},
+\cs{len@cfss@squaretotalheight} and \cs{len@cfss@squaredepth} --. In
+most cases they will only give inside \cs{chessboard} (locally) the
+correct sizes, but if you use the key \key{psset} they are set
+globally.
+
+
+\subsection{Some words about box sizes}
+
+In \TeX\ almost everything is either a box (a character box, a line
+box, a page box, a box with a tabular in it~\ldots) or a space. And
+larger objects are build by putting boxes and spaces in a surrounding
+box. In the real world a box has always to be larger as its content.
+In the virtual
+\TeX-world a lot of magic is possible: The content can be much larger
+than the surrounding box or even be partly or completely outside the
+surrounding box.
+
+
+\begin{LTXexample}
+x% shows the current line
+\fbox{% a box
+\raisebox{3ex}[0pt][0pt]{%
+ \makebox[0pt]{%
+ large content outside the box}}}%
+x% and here something after the fbox
+\end{LTXexample}
+
+So the outside size of a box can be quite different from the inside
+size. And the outside baseline of a box can be at quite different
+place as the inside baseline.
+
+In the concrete case of \cs{chessboard} the outside size of the board
+is determined through the size of the font, the fields shown and the
+margin. All other things like border, label, highlighting, mover will
+not affect this size. The baseline of a chess board is always at the
+bottom of the bottom rank. Margins, labels or borders or anything
+else will not change this. If you want to move the baseline you will
+have to use a \cs{raisebox}.
+
+
+\subsection{Margins}
+
+The «outside size» («the bounding box») of a chess board is the size
+of the printed fields plus a margin.
+
+\medskip
+\Describesetkey{marginleftwidth}{length}{1em}{1em}
+\Describesetkey{marginrightwidth}{length}{1em}{1em}\goodbreak
+\Describesetkey{margintopwidth}{length}{1em}{1em}\goodbreak
+\Describesetkey{marginbottomwidth}{length}{1em}{1em}\goodbreak
+\Describesetkey{hmarginwidth}{length}{1em}{1em}\goodbreak
+\Describesetkey{vmarginwidth}{length}{1em}{1em}\goodbreak
+\Describesetkey{marginwidth}{length}{1em}{1em}
+
+
+With this keys you can set and change the thickness of the margin. As
+you can see you can set each margin differently, but there are also
+keys to set more than one margin at one time.
+
+
+
+
+\medskip
+\Describesetkey{marginleft}{true|false}{}{true}
+\Describesetkey{marginright}{true|false}{false}{true}\goodbreak
+\Describesetkey{margintop}{true|false}{}{true}\goodbreak
+\Describesetkey{marginbottom}{true|false}{}{true}\goodbreak
+\Describesetkey{hmargin}{true|false}{}{true}\goodbreak
+\Describesetkey{vmargin}{true|false}{}{true}\goodbreak
+\Describesetkey{margin}{true|false}{}{true}
+
+You can disable the margin either by setting its width to 0pt or with
+this boolean keys.
+
+\goodbreak
+\begin{LTXexample}
+x\fbox{\chessboard[printarea=a1-a1,
+ marginwidth=0pt]}
+
+x\fbox{\chessboard[printarea=a1-a1,
+ marginwidth=0.5cm]}
+
+x\fbox{\chessboard[printarea=a1-a1,
+ marginwidth=0.5cm,
+ margin=false]}
+\end{LTXexample}
+
+\goodbreak
+\subsection{Borders}
+
+The borders are made with rules. You will perhaps notice that on
+screen the edges looks like as if they don't contact properly. This
+is a problem of the rather bad resolution of a screen. When you zoom
+in you can see that the edges are fine. If this bothers you, you can
+try the fancy borders made with the pgf-commands decribed later. As
+they are made with one line, they seem to have better edges -- but
+you can't color them individually and it isn't yet possible to
+disable the borders of single sides.
+
+\Describesetkey{borderleftwidth}{length}{1em}{0.04em}
+\Describesetkey{borderrightwidth}{length}{1em}{0.04em}
+\Describesetkey{bordertopwidth}{length}{1em}{0.04em}
+\Describesetkey{borderbottomwidth}{length}{1em}{0.04em}
+\Describesetkey{hborderwidth}{length}{1em}{0.04em}
+\Describesetkey{vborderwidth}{length}{1em}{0.04em}
+\Describesetkey{borderwidth}{length}{1em}{0.04em}
+
+
+With this keys you can set and change the thickness of the border.
+The border doesn't change the bounding box of the board. If there
+isn't an adequate margin it will stick outside!
+
+\medskip
+\Describesetkey{borderleft}{true|false}{}{true}
+\Describesetkey{borderright}{true|false}{false}{true}
+\Describesetkey{bordertop}{true|false}{}{true}
+\Describesetkey{borderbottom}{true|false}{}{true}
+\Describesetkey{hborder}{true|false}{}{true}
+\Describesetkey{vborder}{true|false}{}{true}
+\Describesetkey{border}{true|false}{}{true}
+
+You can disable the border either by setting its width to 0pt or with
+this boolean keys.
+
+
+\medskip
+\Describesetkey{borderleftcolor}{color}{red}{black}
+\Describesetkey{borderrightcolor}{color}{red}{black}
+\Describesetkey{bordertopcolor}{color}{red}{black}
+\Describesetkey{borderbottomcolor}{color}{red}{black}
+\Describesetkey{hbordercolor}{color}{red}{black}
+\Describesetkey{vbordercolor}{color}{red}{black}
+\Describesetkey{bordercolor}{color}{red}{black}
+
+With this keys you can set and change the color of the border.
+
+{\bfseries You must load a color package like \packagename{xcolor} or
+\packagename{color} to be able to use colors!}\footnote{I must
+correct myself: the pgf-package will load \packagename{xcolor}, so
+you should load a color package only if you want to use it with other
+options}
+
+\begin{LTXexample}
+\raggedright
+some text above the board\\
+the board will overwrite this!\\
+left%
+\def\borderwidth{12pt}
+\def\mycolor{red!50}
+\chessboard[tinyboard,
+ marginleftwidth=1em,
+ margintopwidth=0pt,
+ bordertopwidth=\borderwidth,
+ borderleftcolor=\mycolor,
+ bordertopcolor=yellow!25,
+ marginright=false]%
+right\\
+text below the board
+\end{LTXexample}
+
+
+\subsection{The size of the boardfont}
+
+\Describesetkey{boardfontsize}{length}{10pt}{20pt}
+\Describesetkey{fontsize}{length}{10pt}{20pt}
+\Describesetkey{tinyboard}{arbitrary}{}{}
+\Describesetkey{smallboard}{arbitrary}{}{}
+\Describesetkey{normalboard}{arbitrary}{}{default}
+\Describesetkey{largeboard}{arbitrary}{}{}
+
+With this keys you can change the size of the board font. The keys
+\key{tinyboard} etc.\ gives the same sizes as the similar commands
+\cs{tinyboard} of \skaksty, they also change the size of the font of
+the labels.
+
+You can also change the size of the board font with the commands
+described in the documentation of \chessfss. But you should be aware
+that the keys used in \cs{setchessboard} or \cs{chessboard} will
+always win over the commands from \chessfss.
+
+
+\subsection{Changing the boardfont}
+
+Instead of using the keys described below you can also change the
+board font with the commands described in the documentation of
+\chessfss. But you should be aware that the keys used in
+\cs{setchessboard} or \cs{chessboard} will always win over the
+commands from \chessfss.
+
+
+\Describesetkey{boardfontfamily}{family name}{maya}{skak/skaknew}
+
+With the above key you can change the board font by setting the
+family. This works quite similar as for text font where you can
+switch e.g. from times to helvetica by changing the font family. The
+font families
+\chessfontname{skak} and \chessfontname{skaknew} will work from the
+start. You must install other families before being able to use them!
+
+\begin{LTXexample}
+\chessboard[boardfontfamily=maya]
+\end{LTXexample}
+
+\goodbreak
+\Describesetkey{boardfontseries}{series name}{b}{}
+
+Setting the series to bold (b) only works for a quite small set of
+fonts which have the chars in two weights. But to tell the truth: I
+don't find the result very satisfying.
+
+
+There are no keys to change the shape of the font as I really don't
+know what an italic (\cs{itshape}) or slanted board font should be.
+(And I never saw such a font).
+
+
+\begin{LTXexample}
+\newchessgame
+\chessboard[boardfontfamily=millennia,
+ tinyboard]
+\chessboard[boardfontfamily=millennia,
+ boardfontseries=b,
+ tinyboard]
+
+\end{LTXexample}
+
+
+
+\Describesetkey{boardfontencoding}{encoding}{LSB1}{LSB}
+
+
+With this key you can change the encoding of the board font. While in
+a normal document you probably seldom or never need to bother with
+encodings they are highly useful in connection chess board if you
+want to add colors to the chars on the board. When using other
+encodings that the standard LSB the chars on the board are composed
+with special chars that allows to color e.g. the lines of the black
+field differently to the figure on the field. I will come back to
+this when I describe how to color the chars.
+
+There are simple encodings called LSB, LSB1, LSB2 \ldots, which works
+with almost every font family. And there are special encodings LSBC1,
+LSBC2 \ldots, which works only with professional chess fonts with
+special chars. Happily the default board font, the free font
+\chessfontname{skaknew}, is such a professional chess font.
+
+
+
+If you want to use one of the extended encodings LSB1, LSB2, etc and
+LSBC1, LSBC2 etc you must load the definition files e.g.\ with
+\lstinline+\usepackage[LSB1,T1]{fontenc}+. You find more
+informations in the documentation of \chessfss.
+
+
+
+
+\subsection{Coloring and emphasizing the board chars}
+\subsubsection{In short}
+
+\begin{itemize}
+
+\item Coloring the board or parts of the chars is a two step process:
+
+First you set the colors you want, then you apply them.
+
+\item
+Colors can be applied to the whole board (to set the default colors
+of the white and black pieces and fields). This done with the keys
+\key{setfontcolors} and \key{addfontcolors}.
+
+\item Colors can be applied to part of the board together with other commands like \cs{bfseries}
+ (e.g. to emphasize special fields or ranks)
+by first enabling color emphasing with the key \key{coloremph} and
+then by setting the area or field that should get the colors with
+e.g. the key \key{empharea}.
+
+
+\end{itemize}
+
+
+
+\subsubsection{Introduction: About composed chars and encodings}
+In simple chess fonts each field with and without a figure on it is
+\emph{one} char. You can color such a char but -- as in the case of normal chars -- only
+in one color:
+
+\textcolor{red}{\Large A \BlackKingOnBlack}
+
+This is certainly not very satisfying. You probably would like to be
+able to color the white figures diffently from the black ones, and
+the black fields in a third color.
+
+To be able to do this, one has to use more than one char to build a
+field and to print them on top of each other. Look e.g. at this
+example:
+
+ \colorbox{yellow}{\Chess
+ \makebox[0pt][l]{\color{blue}\BlackEmptySquare}%
+ \color{green}T%
+ \color{red}K}
+
+It is build by putting four different objects on top of each other:
+
+At start there is a standard yellow colorbox
+
+\colorbox{yellow}{\Chess\phantom{\BlackEmptySquare}}
+
+Above there is a black empty square colored in blue:
+
+{\Chess\color{blue}\BlackEmptySquare}
+
+Then comes a solid, filled and colored char with the same shape as
+the king:
+
+{\Chess\color{green}T}
+
+At last there is the char for the king:
+
+{\Chess\color{red}K}
+
+So
+
+{\Chess\colorbox{yellow}{\phantom{\BlackEmptySquare}}\Plus
+ {\color{blue}\BlackEmptySquare}\Plus
+ {\color{green}T\phantom{\BlackEmptySquare}}\Plus
+ {\color{red}K}\Equal
+ \colorbox{yellow}{%
+ \makebox[0pt][l]{\color{blue}\BlackEmptySquare}%
+ \color{green}T%
+ \color{red}K}}
+
+
+There are a lot of other possibilities to compose the board fields.
+Some more «poor man's» compositions that use only chars present in
+every chess font, other that need special masking chars which only
+special chess fonts provide.
+
+{\bfseries Each such construction is connected to a font encoding: By
+changing the encoding of the board font you change the rules that
+compose the board chars and so you change also the options to color
+the chars.}
+
+
+In \chessfss I have defined a bundle of such «construction rules»
+(=encodings) to use and color composed board chars. As it would be a
+strain if each of this construction rules would let to a different
+set of commands to color the chars I had to systemize the
+construction rules. For this I have divided the possible individual
+components of a composed chars in four logical layers and assign to
+each layer generic color commands that are used in the definition of
+the composed chars and can be used to color the components. The four
+layers are named fieldmask, field, piecemask and piece.
+
+As an example table~\ref{tab:encLSBC3} shows a tabular that
+demonstrates how the encoding LSBC3 is built. As you can see the
+chars are built by putting up three or four chars on top of each
+other. (The green and yellow colors are not the default settings!).
+The documentation of
+\chessfss shows the other encodings.
+%The colors have been set with the
+%\chessfss-command
+%\begin{lstlisting}
+%\setboardfontcolors{
+% whitepiece=red!70,
+% blackfield=green,
+% whiteonwhitepiecemask=yellow}
+%\end{lstlisting}
+
+
+
+\begin{table}
+\setboardfontcolors{whitepiece=red!70,
+blackfield=green,whiteonwhitepiecemask=yellow}%
+
+\caption{The contruction rules of encoding LSBC3}\label{tab:encLSBC3}
+
+%\medskip
+\showchessboardencoding{LSBC3}
+
+
+\end{table}
+
+Table~\ref{tab:intcom} shows the internal commands used to color the
+different part of a composed char. You will probably never need them
+but they will give you an idea what can be colored (I hope that is
+clear that it makes only sense to change the colors of layers that
+are used in the actual encoding -- you can't color an solid fieldmask
+that isn't there).
+
+%\begin{minipage}[t]{\textwidth}
+\begin{table}
+\caption{The internal color commands}\label{tab:intcom}
+
+\begin{tabular}[t]{@{}lll}
+\itshape layer & \itshape internal color commands & \itshape default definition\\\hline\\
+
+fieldmask & \cs{cfss@whitefieldmaskcolor} &\cs{color}\ttfamily\{white\}\\
+ & \cs{cfss@blackfieldmaskcolor} &\cs{color}\ttfamily\{gray\}\\
+field & \cs{cfss@whitefieldcolor} &\ttfamily\{\}\\
+ & \cs{cfss@blackfieldcolor} &\ttfamily\{\}\\
+piecemask & \cs{cfss@whiteonwhitepiecemaskcolor}&\cs{color}\ttfamily\{white\}\\
+ & \cs{cfss@whiteonblackpiecemaskcolor}&\cs{color}\ttfamily\{white\}\\
+ & \cs{cfss@blackonwhitepiecemaskcolor}&\cs{color}\ttfamily\{white\}\\
+ & \cs{cfss@blackonblackpiecemaskcolor}&\cs{color}\ttfamily\{white\}\\
+piece & \cs{cfss@whitepiececolor} &\ttfamily\{\}\\
+ & \cs{cfss@blackpiececolor} &\ttfamily\{\} \\
+\end{tabular}
+
+
+\end{table}
+%\end{minipage}
+
+
+I would like to draw your attention to two things:
+
+\begin{enumerate}
+\item The field-layers distinguish between black and white field
+while the piece layer distinguish between black and white pieces and
+the piecemask offers all possible combinations.
+
+\item
+The fieldmask and the piecemask are colored by default and so they
+will overwrite or block out external colors from \cs{colorbox} or
+\cs{textcolor} commands:
+
+\begin{LTXexample}
+%Uses commands from chessfss.sty
+\setboardfontencoding{LSBC3}%
+\setboardfontsize{2cm}
+
+\colorbox{yellow}{%
+ \textcolor{red}{\WhiteKingOnWhite}}
+%
+\setboardfontcolors{
+ whitefieldmask=yellow,
+ whiteonwhitepiecemask=red}
+\colorbox{yellow}{%
+ \textcolor{red}{\WhiteKingOnWhite}}
+\end{LTXexample}
+
+\end{enumerate}
+
+
+
+
+
+So coloring the board is not really difficult: one must only redefine
+the internal commands mentioned above to the wanted color. That's
+what the \cs{setboardfontcolors} command of \chessfss does and it
+will work fine with chessboard.
+
+Naturally I also wanted to add keys for \cs{chessboard} and
+\cs{setchessboard} to change the colors. This is a bit more
+complicated because I wanted not only to be able to change the colors
+of the whole board but also of single fields or areas. And I had also
+to add keys to change the color in the two pgf pictures. Finding
+names for all this keys and effects wasn't easy. And I hope that it
+isn't to confusing.
+
+\subsubsection{Setting the default colors of the board}
+
+\Describefillkey{clearfontcolors}{arbitrary}{}
+
+When you set with the following keys a color for one of the font
+layers, \cs{chessboard} adds simply the color definition to an
+internal command (the «font color stack»). When you use later a key
+to apply the colors to the board or an area this internal command is
+inserted at the start of the board or the fields of the area. The
+internal command can get quite long if you set a lot of colors. With
+the key \key{clearfontcolors} you can empty the internal command
+(this will not destroy the colors that you have already applied).
+
+
+
+
+\Describefillkey{whitefieldmaskcolor}{color}{red!50}
+\Describefillkey{blackfieldmaskcolor}{color}{red!50}
+\Describefillkey{fieldmaskcolor}{color}{red!50}\goodbreak
+
+\Describefillkey{whitefieldcolor}{color}{red!50}
+\Describefillkey{blackfieldcolor}{color}{red!50}
+\Describefillkey{fieldcolor}{color}{red!50}\goodbreak
+
+\Describefillkey{whiteonwhitepiecemaskcolor}{color}{red!50}\goodbreak
+\Describefillkey{whiteonblackpiecemaskcolor}{color}{red!50}
+\Describefillkey{blackonwhitepiecemaskcolor}{color}{red!50}
+\Describefillkey{blackonblackpiecemaskcolor}{color}{red!50}\goodbreak
+\Describefillkey{whitepiecemaskcolor}{color}{red!50}
+\Describefillkey{blackpiecemaskcolor}{color}{red!50}\goodbreak
+\Describefillkey{onwhitepiecemaskcolor}{color}{red!50}
+\Describefillkey{onblackpiecemaskcolor}{color}{red!50}
+\Describefillkey{piecemaskcolor}{color}{red!50}\goodbreak
+
+\Describefillkey{whitepiececolor}{color}{red!50}
+\Describefillkey{blackpiececolor}{color}{red!50}
+\Describefillkey{piececolor}{color}{red!50}
+
+
+With this keys you set the colors of the different parts of a
+composed char. The colors are saved to an internal stack. A key like
+\key{whitepiececolor} saves the color for one of the layer color
+commands. \key{piecemaskcolor} will set the color for all four
+piecemasks in one go.
+
+
+
+
+The keys \obsoletekey{colorwhite} and \obsoletekey{colorblack} of the
+previous version of this package are copies of the keys
+\key{whitepiececolor} and \key{blackpiececolor}.
+
+
+
+\subsubsection{Applying the colors to the whole board}
+
+\Describefillkey{setfontcolors}{arbitrary}{}
+\Describefillkey{addfontcolors}{arbitrary}{}
+
+This keys will put the «font color stack» in a command that is
+executed at the start of the board. So the colors will affect any
+fields that don't get individual colors with the command described in
+the next subsection.
+\key{setfontcolors} will replace any font colors that have been set
+before, \key{addfontcolors} will add the new colors to perhaps
+already existing ones.
+
+\begin{LTXexample}
+\def\mycolor{yellow!50}
+\setchessboard{
+ boardfontencoding=LSBC3,
+ piecemaskcolor=\mycolor,
+ setfontcolors}
+
+\chessboard[tinyboard]
+
+\def\mycolor{green}% will set the
+% piecemask to green:
+\chessboard[tinyboard,
+ whitepiececolor=red,
+ blackpiececolor=blue,
+ fieldcolor=white,
+ addfontcolors]
+\end{LTXexample}
+
+\subsubsection{Emphasising and coloring individual areas}
+
+
+\Describefillkey{emphstyle}{commands}{\cs{bfseries}}
+
+With this key you can set a command that should be applied to an
+area. The commands can be whatever you want, (it is a good idea not
+use something that takes up some space). In my opinion the only
+senseful commands are \cs{color} and -- for the few fonts that have a
+bold boardfont -- \cs{bfseries}. You can use the key e.g. for simple
+coloring.
+
+\begin{LTXexample}
+\newchessgame
+\def\empharea{ h8-f4 }
+\chessboard[emphstyle=\color{red},
+ empharea=\empharea]
+\end{LTXexample}
+
+You can't color with \key{emphstyle} the fieldmask and the piecemask
+of chars as they have a default color that takes precedence.
+
+\Describefillkey{coloremph}{true|false}{}
+With this key you enable or disable color emphasising. When set to
+true, font colors set earlier will be added to emphstyle and so used
+to color the area. The colors are added after the commands of the key
+\key{emphstyle} and so will eventually overwrite them.
+This allows more complicated coloring:
+
+\begin{LTXexample}
+\newchessgame
+\def\empharea{ h8-f1 }
+\chessboard[boardfontencoding=LSBC3,
+ whiteonwhitepiecemaskcolor=green,
+ whitepiececolor=red,
+ blackpiececolor=blue,
+ emphstyle=\color{yellow},
+ %doesn't affect the default white color
+ %of the piecemask
+ empharea=a1-c8,
+ coloremph,
+ empharea=\empharea]
+\end{LTXexample}
+
+
+
+
+
+\goodbreak
+
+\Describefillkey{coloremphstyle}{commands}{\cs{bfseries}}
+
+This key combines the keys \key{coloremph} and \key{emphstyle}.
+
+
+
+\goodbreak
+\Describefillkey{emphboard}{arbitrary}{}
+\Describefillkey{empharea}{area}{a1-c3}
+\Describefillkey{emphareas}{list of areas}{\{f6-h7,a1-c3\}}
+\Describefillkey{emphfile}{file}{a}
+\Describefillkey{emphfiles}{list of files}{\{g,h\}}
+\Describefillkey{emphrank}{rank}{5}
+\Describefillkey{emphranks}{list of ranks}{\{8,7\}}
+\Describefillkey{emphfield}{field}{a3}
+\Describefillkey{emphfields}{list of fields}{\{b5,c6\}}
+
+This keys apply the emphasize commands and eventually the colors to
+the area they define.
+
+\begin{LTXexample}
+\def\empharea{ h8-f4 }
+\chessboard[boardfontfamily=millennia,
+ coloremphstyle=\bfseries,
+ empharea=\empharea,
+ whitepiececolor=red,
+ emphrank=1,
+ whitepiececolor=blue,
+ emphareas={a2-a2, c1-e2},
+ coloremph=false,
+ emphfield=f2]
+\end{LTXexample}
+
+
+\begin{LTXexample}
+\chessboard[boardfontencoding=LSBC3,
+ coloremph,
+ emphfield={f1},
+ whitepiececolor=red,
+ emphranks={1},
+ whitepiececolor=blue,
+ emphfields=a2,
+ blackpiececolor=green,
+ empharea=a8-c7]
+\end{LTXexample}
+
+
+The key \obsoletekey{colorpieces} doesn't work anymore, it will issue
+only a warning. Use
+\key{emphfields} instead.
+
+
+\subsubsection{Transparency/opacity}
+
+Pgf has commands to set the opacity of a color. This works only for
+some drivers and output formats (e.g.\ with pdf\LaTeX), but it also
+works outside pgf pictures in running text. The main drawbacks are
+that the opacity settings gets lost at a pagebreak and that
+\TeX-groups and boxes are not respected, that means that you must
+reset the opacity explicitly. It is possible to add to boxes that use
+internally
+\cs{color@begingroup}/""\cs{color@endgroup}\footnote{Almost all
+\LaTeX-boxes but not e.g.\ \cs{mbox} and \cs{makebox} when used
+without optional argument.} some code that resets the opacity outside
+the box to 1. As \cs{chessboard} uses only such safe boxes it is
+possible to smuggle transparency in parts of the composed chars. But
+the whole is not very safe so use it at your own risk.
+
+\begin{LTXexample}
+\makebox[0pt][l]{\rule{12em}{10pt}}%
+\color{red}%
+\rule{1em}{14pt} ABC
+\pgfsetfillopacity{0.5}%
+\rule{1em}{14pt} ABC
+\pgfsetfillopacity{1}%
+\rule{1em}{14pt} ABC
+
+\makeatletter
+\let\color@endgroupORI\color@endgroup
+\def\color@endgroup
+ {\color@endgroupORI\pgfsetfillopacity{1}}
+
+\chessboard[boardfontencoding=LSBC4,
+ whitepiececolor=red,
+ blackpiececolor=blue,
+ setfontcolors]
+
+\def\cfss@whitepiececolor
+ {\pgfsetfillopacity{0.5}\color{red}}
+\def\cfss@blackpiececolor
+ {\pgfsetfillopacity{0.5}\color{blue}}
+
+\chessboard[boardfontencoding=LSBC4]
+
+\end{LTXexample}
+
+
+\subsection{Labels}
+
+In \chessfss I used the name sidefont for the label. I did it mostly
+because I didn't dare to use the command \cs{labelfont}, I was quite
+sure that somewhere in the packages for \LaTeX\ someone else had
+already used this name. When using keys name clash are not a problem
+as internally a unique prefix is used, so I decided to use names
+starting with «label» in this package.
+
+\medskip
+\Describesetkey{labelleft}{true|false}{}{true}
+\Describesetkey{labelright}{true|false}{false}{false}\goodbreak
+\Describesetkey{labeltop}{true|false}{}{false}\goodbreak
+\Describesetkey{labelbottom}{true|false}{}{true}\goodbreak
+\Describesetkey{hlabel}{true|false}{}{false}\goodbreak
+\Describesetkey{vlabel}{true|false}{}{false}\goodbreak
+\Describesetkey{label}{true|false}{}{false}
+
+You can disable the labels with this boolean keys.
+
+\Describesetkey{labelleftwidth}{length}{1em}{1ex}
+\Describesetkey{labelrightwidth}{length}{1em}{1ex}
+\Describesetkey{hlabelwidth}{length}{1em}{1ex}
+
+The labels on the left side are set raggedleft, the ones on the right
+side raggedright at the distance given by the keys. This width don't
+change the size of the board! The top and bottom labels are centered.
+
+\begin{LTXexample}
+\def\mywidth{1em}
+left%
+\chessboard[maxfield=j10,
+ tinyboard,
+ printarea=d5-j10,
+ hmarginwidth=1em,
+ hlabelwidth=\mywidth,
+ hlabel,
+ vlabel=false]%
+right
+\end{LTXexample}
+
+\Describesetkey{labelleftlift}{length}{1em}{0.35em}
+\Describesetkey{labelrightlift}{length}{1em}{0.35em}
+\Describesetkey{hlabellift}{length}{1em}{0.35em}
+
+With this keys you can move up and down the left and right labels.
+
+
+
+
+\medskip
+\Describesetkey{labeltoplift}{length}{1em}{1.1\cs{baselineskip}}
+\Describesetkey{labelbottomlift}{length}{1em}{0.2\cs{baselineskip}}
+\Describesetkey{vlabellift}{length}{1em}{--}
+
+With this keys you can set the distance of the baselines of the top
+and bottom labels from the board sides. \cs{baselineskip}, ex and em
+refer in this keys \emph{not} to the size of the board, but to the
+size of the label font -- I thought this would be easier to handle.
+
+\medskip
+\Describesetkey{labelleftfont}{fontcommand}{\cs{itshape}}{\cs{sfdefault}}
+\Describesetkey{labelrightfont}{fontcommand}{\cs{itshape}}{\cs{sfdefault}}\goodbreak
+\Describesetkey{labeltopfont}{fontcommand}{\cs{itshape}}{\cs{sfdefault}}\goodbreak
+\Describesetkey{labelbottomfont}{fontcommand}{\cs{itshape}}{\cs{sfdefault}}\goodbreak
+\Describesetkey{hlabelfont}{fontcommand}{\cs{itshape}}{\cs{sfdefault}}\goodbreak
+\Describesetkey{vlabelfont}{fontcommand}{\cs{itshape}}{\cs{sfdefault}}\goodbreak
+\Describesetkey{labelfont}{fontcommand}{\cs{itshape}}{\cs{sfdefault}}
+
+With this keys you can set the font used by the labels. As a default
+(this is set in \chessfss) the sans serif font of the document is
+used. You can also use the \chessfss commands to change the font.
+
+
+\Describesetkey{labelfontsize}{length}{0.5em}{10pt}
+
+This key sets the font size of the label. The default value is set by
+the key \key{normalboard}. There aren't keys to set the size of each
+label separatly. If you really need different sizes, use the key
+\key{hlabelfont} etc (and be careful when using font relative sizes).
+
+\begin{LTXexample}
+\setchessboard{labelfont=\bfseries}
+\setsidefontfamily{ptm} % from chessfss.sty
+\chessboard[labelfontsize=6pt]
+\end{LTXexample}
+
+
+\Describesetkey{labelleftformat}{commands}{}{\arabic{ranklabel}}
+\Describesetkey{labelrightformat}{commands}{}{\arabic{ranklabel}}\goodbreak
+\Describesetkey{labeltopformat}{commands}{}{\alph{filelabel}}\goodbreak
+\Describesetkey{labelbottomformat}{commands}{}{\alph{filelabel}}\goodbreak
+\Describesetkey{hlabelformat}{commands}{}{\arabic{ranklabel}}\goodbreak
+\Describesetkey{vlabelformat}{commands}{}{\alph{filelabel}}\goodbreak
+\Describesetkey{labelformat}{commands}{}{}
+
+With this keys you can control how the number of the files and ranks
+are printed. \texttt{ranklabel} and \texttt{filelabel} are counters
+that contain the current rank and file. You can use them freely (even
+change if you want).
+
+The commands can be a lot of things. You can e.g.\ use them to color
+the labels or to move the labels around. When you use commands with
+optional arguments you must put braces around the value of the key!
+
+\begin{LTXexample}
+\def\mylabelformat{%
+ {\makebox[0pt][r]{%
+ \ifthenelse{\isodd{\value{ranklabel}}}
+ {\color{red}\roman{ranklabel}}
+ {\color{green}\roman{ranklabel}}}}}
+
+\chessboard[hlabelformat=\mylabelformat,
+ vlabelformat=\arabic{filelabel}\hfill]
+\end{LTXexample}
+
+
+\subsection{The mover}
+The «mover» is a sign at the side of the board that indicates which
+player is to move. \cs{chessboard} gets this information either from
+the FEN (if it contains the information as is the case when the FEN
+comes from \skaksty), or through the following key:
+
+\Describefillkey{mover}{w|b}{b}
+
+You can use this key more than once, e.g.\ to control the mover
+field in the FEN that you save, the last value is used for the
+print.
+
+\medskip
+\Describesetkey{showmover}{true|false}{false}{true}
+
+This key switch the print of the mover sign on and off.
+
+\begin{LTXexample}
+\chessboard[smallboard,showmover=true]
+\end{LTXexample}
+
+
+\Describesetkey{moversize}{length}{1ex}{1em}
+
+This key sets the fontsize of the mover. It only has an effect if
+the mover sign comes from a font -- and if the definition doesn't
+change the fontsize.
+
+The value is saved in an inner command with the name
+\cs{board@val@moversize}, you can use this command in your own mover
+definitions.
+
+\medskip
+\Describesetkey{moverlift}{length}{1ex}{0pt}
+\Describesetkey{movertoplift}{length}{1ex}{0pt}
+\Describesetkey{moverbottomlift}{length}{1ex}{0pt}
+
+With this keys you can move the mover vertically. Positive values
+will move the bottom mover up and the top mover down\footnote{This
+isn't perhaps the correct meaning of the word «lift» but I guessed
+that user expect the mover to move either both towards or apart.}.
+0pt will align the bottom mover along the baseline, and the top of
+the upper mover along the upper side of the board.
+
+
+\begin{LTXexample}[width=0.55\textwidth]
+\setchessboard{showmover}%
+\chessboard[tinyboard, setfen=k1K b]%
+\chessboard[tinyboard, setfen=k1K w]
+
+
+\chessboard[tinyboard, setfen=k1K b,
+ moverlift=-1ex]%
+\chessboard[tinyboard, setfen=k1K w,
+ moverlift=-1ex]
+\end{LTXexample}
+
+
+\Describesetkey{movershift}{length}{1ex}{1ex}
+\Describesetkey{movertopshift}{length}{1ex}{1ex}
+\Describesetkey{moverbottomshift}{length}{1ex}{1ex}
+
+With this keys you can shift the mover horizontaly. If you want to
+put it on the left side of the board, use a large negative value.
+
+\begin{LTXexample}[width=0.55\textwidth]
+\setchessboard{showmover}%
+\chessboard[setfen=k1K b,
+ movershift=-9em,
+ labelleft=false,
+ labelright]%
+\end{LTXexample}
+
+\Describesetkey{moverstyle}{typename}{squarearrow}{square}
+
+With this key you can change the mover type. Up to now four types
+are defined, but you can define your own one if you want.
+
+
+
+\begin{LTXexample}[width=0.55\textwidth]
+\setchessboard{showmover}%
+\chessboard[tinyboard, setfen=k1K b,
+ moverstyle=circle]%
+\chessboard[tinyboard, setfen=k1K w,
+ moverstyle=triangle]
+
+%This moverstyle needs pifont and graphics!
+\chessboard[tinyboard, setfen=k1K b,
+ moverstyle=squarearrow]%
+%This will give a warning and square is used:
+\chessboard[tinyboard, setfen=k1K w,
+ moverstyle=unknown]
+\end{LTXexample}
+
+
+\DescribeMacro{\cbDefineMoverStyle} With this command you can define
+your own moverstyle. \cs{cbDefineMoverStyle} takes six arguments (the
+first is optional). The first mandatory argument is the name of the
+style, the following arguments get the definitions for the mover for
+black and white for normal and inverse board.
+
+\cs{cbDefineMoverStyle}\oarg{commands}\marg{name of style}\marg{white
+top}\newline%
+\hspace*{4em}\marg{white bottom}\marg{black top}\marg{black bottom}.
+
+The listing shows the definition of the mover «squarearrow»:
+
+
+
+\begin{lstlisting}
+\cbDefineMoverStyle%
+ %#1: optional, can be used e.g. for checks
+ %#2=style name, #3=white top, #4=white bottom,
+ %#5=black top, #6=black bottom
+ [\@ifundefined{rotatebox}%
+ {\PackageError{chessboard}%
+ {You must load the package graphics or graphicx
+ if you want to use the mover style squarearrow}{}}%
+ {}%
+ \@ifundefined{ding}%
+ {\PackageError{chessboard}%
+ {You must load the package pifont
+ if you want to use the mover style squarearrow}{}}%
+ {}]
+ {squarearrow}% #2
+ {\rotatebox{-90}{$\square$\,\ding{222}}}%
+ {\rotatebox{90}{$\square$\,\ding{222}}}%
+ {\rotatebox{-90}{$\blacksquare$\,\ding{222}}}%
+ {\rotatebox{90}{$\blacksquare$\,\ding{222}}}%
+\end{lstlisting}
+
+
+
+
+\section{Controlling the printing}\label{stopmain}
+\subsection{Printing partial boards}
+\Describesetkey{print}{true|false}{false}{true}
+
+With this key you can disable the printing of the board. This is
+useful if you want to use \cs{chessboard} to save FEN.
+
+
+
+\begin{LTXexample}
+left\chessboard[print=false]right
+\end{LTXexample}
+
+
+\Describefillkey{startprint}{field}{b7}
+\Describefillkey{stopprint}{field}{f2}
+\Describefillkey{printarea}{area}{c2-d4}
+
+
+With this keys you can define the area that gets printed.
+
+\begin{LTXexample}
+\newchessgame
+left\chessboard[printarea=a4-d8]right
+\end{LTXexample}
+
+
+\subsection{Rotating the board}
+\Describesetkey{inverse}{true|false}{false}{false}
+
+With this key you can print the black side at the bottom. It won't
+switch labels or margins etc.
+
+\begin{LTXexample}
+\newchessgame
+left\chessboard[inverse]right
+\end{LTXexample}
+
+
+\subsection{Hiding the content of the board}
+
+\subsubsection{Hiding the content of fields}
+
+\Describefillkey{hideboard}{arbitrary}{}
+\Describefillkey{hidearea}{area}{a1-c3}
+\Describefillkey{hideareas}{list of areas}{\{a1-c3,g7-h8\}}
+\Describefillkey{hidefile}{file}{g}
+\Describefillkey{hidefiles}{list of files}{\{g,h\}}\goodbreak
+\Describefillkey{hiderank}{rank}{5}
+\Describefillkey{hideranks}{list of ranks}{\{8,7\}}
+\Describefillkey{hidefield}{field}{c6}
+\Describefillkey{hidefields}{list of fields}{\{b5,c6\}}
+
+
+With this keys you can hide pieces on certain fields. The pieces are
+not deleted, e.g.\ when you save the position to FEN they will be
+there. But the content of hidden fields don't appear if you add
+pieces to this fields!
+
+\begin{LTXexample}[width=0.55\textwidth]
+\newchessgame
+\def\myfiles{a,b}
+\setchessboard{tinyboard}
+\chessboard[hidefiles=\myfiles,
+ addpieces=Ra2,
+ hidearea=d7-e8,
+ storefen=myfen]
+\chessboard[restorefen=myfen]
+\end{LTXexample}
+
+\subsubsection{Hiding piecetypes}
+
+\Describefillkey{hidepiece}{piece char}{q}
+\Describefillkey{hidepieces}{list of piece chars}{\{K, b\}}
+\Describefillkey{hidewhite}{arbitrary}{}
+\Describefillkey{hideblack}{arbitrary}{}
+\Describefillkey{hideall}{arbitrary}{}
+
+
+This keys doesn't hide the content of fields but piecestypes like
+the kings or the pawns. Here too: you can't add pieces if their type
+is hidden.
+
+
+\begin{LTXexample}[width=0.55\textwidth]
+\newchessgame
+\def\mypieces{R,Q}
+\setchessboard{tinyboard}
+\chessboard[hidepieces=\mypieces,
+ addpieces={Ra2, ra7},
+ hideblack,
+ storefen=myfen]%
+\chessboard[restorefen=myfen]
+\end{LTXexample}
+
+\subsubsection{Showing the content of fields}
+
+\Describefillkey{showboard}{arbitrary}{}
+\Describefillkey{showarea}{area}{a1-c3}\goodbreak
+\Describefillkey{showareas}{list of areas}{\{a1-c3,g7-h8\}}
+\Describefillkey{showfile}{file}{g}
+\Describefillkey{showfiles}{list of files}{\{g,h\}}\goodbreak
+\Describefillkey{showrank}{rank}{5}
+\Describefillkey{showranks}{list of ranks}{\{8,7\}}
+\Describefillkey{showfield}{field}{c6}
+\Describefillkey{showfields}{list of fields}{\{b5,c6\}}
+
+With this keys you can let reappear the content of hidden fields.
+
+\begin{LTXexample}
+\newchessgame
+\def\myfiles{a,b}
+\chessboard[hidefiles=\myfiles,
+ addpieces=Ra2,
+ showfiles=a,
+ showranks=2]
+\end{LTXexample}
+
+\subsubsection{Showing piecetypes}
+
+\Describefillkey{showpiece}{piece char}{q}
+\Describefillkey{showpieces}{list of piece chars}{\{K, b\}}
+\Describefillkey{showwhite}{arbitrary}{}
+\Describefillkey{showblack}{arbitrary}{}
+\Describefillkey{showall}{arbitrary}{}
+And this keys lets reappear hidden piecestypes. Attention: hidden
+pieces on hidden fields reappear only if you use the key to show the
+field
+\emph{and} the key to show the piece!
+
+\begin{LTXexample}
+\newchessgame
+\def\myfiles{a,e}
+\chessboard[hidefiles=\myfiles,
+ hidepieces={K,R},
+ showfiles=a,
+ showranks=1,
+ showpieces=K]
+\end{LTXexample}
+
+
+Keys like \key{showonlypawns} or \key{showonlybut} could be easily
+added as they are simple combinations of the existing keys:
+
+\begin{LTXexample}
+\newchessgame
+\chessboard[hideall,
+ showpieces={P,p},
+ addpieces=pe5]
+\end{LTXexample}
+
+
+
+
+\section{«Decoration»: Colors, background, fancy borders, highlighting}\label{startpgf}
+
+
+%\section{Coloring and emphasizing the board chars}
+
+{\bfseries You must load a color package like \packagename{xcolor} or
+\packagename{color} to be able to use colors!}\footnote{I must
+correct myself: the pgf-package will load \packagename{xcolor}, so
+you should load a color package only if you want to use it with other
+options.}
+
+Coloring and decorating the board is a bit complicated as there is
+so much that can get different colors and so much different
+possibilities for marks, arrows, fancy borders and so on. So it can
+take some time to find out how to achieve a certain effect.
+
+Don't forget that not every effect is sensible or even works
+everywhere. Transparency/opacity e.g.\ don't work for every driver or
+output format or printer or previewer (the documentation of pgf says
+that it works for dvips only with new ghostscript versions). Some
+colors looks good on screen but bad if printed with a greyscale
+printer. Colors can change if you use another monitor. Some color
+combinations are a problem for color blinds.
+
+\Skaksty has some own highlighting commands. They use
+postscript/pstricks commands and they only work if you load
+\skaksty with the option \textsf{ps}. That means that you have to use the
+\filetype{.tex}$\rightarrow$\filetype{.dvi}$\rightarrow$\filetype{.ps}$\rightarrow$\filetype{.pdf}-way
+to process the document. If you want to use pdf\LaTeX\ directly you
+have to use a package like \packagename{pst-pdf} to first make pdf
+graphics from all boards and then include this graphics during the
+pdf\LaTeX-run. I find this quite cumbersome and sometimes it is even
+difficult to get it to work.
+
+So I decided to use \packagename{pgf} to implement my own
+highlighting commands. But I also tried to offer a possibility to use
+the commands of \skaksty.
+
+The pgf-commands used by \pchessboard need only
+\packagename{pgfcore.sty} and \packagename{pgfbaseshapespackage.sty}
+from the \packagename{pgf}-bundle. If you need pgf-commands from
+other parts of the bundle, you will have to load the styles yourself.
+
+\Describesetkey{pgf}{true|false}{}{true}
+
+Pgf-commands works fine with \LaTeX\ and pdf\LaTeX\ but in some case
+(e.g.\ if you use \cs{chessboard} in an environment that calls the
+environment \texttt{preview}) they can induce errors. So I added a
+key to disable all the pgf-commands. It is also useful to disable
+most of the highlighting.
+
+
+
+
+
+\subsection{The pgf-pictures}
+The decorations in the two other layers (background layer and mark
+layer) use pgf-commands -- or to be more precise: the two other
+layers are pgf-pictures.
+
+
+
+
+In the first version of \pchessboard the background picture wasn't
+used much. I had only implemented some code to color the fields. But
+then I got the request to add some more commands for fancy borders
+which did mean that I had to transfer the code which draws borders in
+the foreground picture to the background picture. And I got a request
+for coloring fields in the foreground picture which did mean that I
+had to transfer the code from the background to the foreground.
+
+So I decided to rewrite and extend the codes so that each
+highlighting/drawing in the pgf-pictures can be done in either the
+background or the foreground or in both. I don't know if someone will
+ever have a need for a cross under the figures, but why shouldn't I
+offer some code to do it?
+
+I also tried to unify the keys that affect the pgf-pictures, to
+improve the possibilities for the user to control which pgf-picture
+is affected and put a bit more order in the keys. At the end quite a
+lot of the code has been rearranged and changed.
+
+
+\subsubsection{Naming of the pgf related keys}
+
+There are more or less three set of keys
+
+\begin{itemize}
+\item Keys which affect only the foreground picture. The keys starts with or contains the
+string «\bfseries\ttfamily mark».
+\item Keys which affect only the background picture. The keys starts with or contains the
+string «\bfseries\ttfamily back».
+
+\item
+Keys that saves or set properties that are used in both picture,
+e.g.\ to change the color or the linewidth. Such keys start or
+contain in most cases the string «\bfseries\ttfamily pgf» (with some
+exceptions like the key for clipping and trimming). For a lot of such
+keys there exist a shorter (but less descriptive) name without the
+«\ttfamily pgf». In most cases there isn't a difference between the
+two.
+
+\end{itemize}
+%Using two pictures raises the question how properties that make sense
+%for both pictures should be implemented and how commands that should
+%affect only one picture should be distinguish from a similar command
+%that affect the other picture. E.g.\ there are a lot of keys that
+%sets properties that are or can be of interest in both pictures like
+%setting the color or some variables like linewidth or some padding.
+%I stood for the choice if I should define two keys e.g.
+%\key{colorback} and \key{colormark} or one key \key{color} that puts
+%the color in both pictures. The first alternative is longer and more
+%tiresome, the second can give confusing results if the user don't
+%realize that a key can also affect the other picture.
+%
+%I used both alternatives depending on which I thought more natural in
+%the special cases.
+
+
+
+
+\subsubsection{Executing the drawing commands}
+
+A chessboard consists of fields on which figures make moves and so
+the decoration of the board is field and move orientated.
+
+There are three different types of graphical object:
+\begin{itemize}
+\item You can draw something on a set of
+single \emph{fields} e.g., put a cross on each of the fields or put a
+border around each field. To get these pictures on or under the field
+the inner commands first shift the origin to the middle of field and
+then inserts the code stored in the style definition in the
+foreground or background image.
+
+
+\item
+You can draw something on or around a \emph{region} -- a rectangle
+made of fields --, e.g.\ by putting a border around the center or a
+rank or the whole board. Here the inner commands shift the origin to
+the left upper corner of the region. The name of the other corner is
+available in the style definition through
+\lstinline+#1+.
+
+
+\item And you can mark a \emph{move}.
+The main difference between a move and a region is that the order of the «corners» given in the argument matters.
+For moves the origin is in the first corner (the from field).
+\end{itemize}
+
+The drawing is done by first setting with various key the style and
+the properties of the pgf object and then executed by telling
+\cs{chessboard} which fields, moves or regions should get the
+drawings.
+
+\subsubsection{Drawing on and under fields}\label{sec:drawfields}
+
+\Describefillkey{markboard}{arbitrary}{}
+\Describefillkey{markarea}{area}{a1-c3}
+\Describefillkey{markareas}{list of areas}{\{a1-c3,d5-e5\}}
+\Describefillkey{markfiles}{file}{g}
+\Describefillkey{markfiles}{list of files}{\{g,h\}}
+\Describefillkey{markrank}{rank}{7}
+\Describefillkey{markranks}{list of ranks}{\{8,7\}}
+\Describefillkey{markfield}{field}{c6}
+\Describefillkey{markfields}{list of fields}{\{b5,c6\}}
+\Describefillkey{backboard}{arbitrary}{}
+\Describefillkey{backarea}{area}{a1-c3}
+\Describefillkey{backareas}{list of areas}{\{a1-c3,d5-e5\}}
+\Describefillkey{backfiles}{file}{g}
+\Describefillkey{backfiles}{list of files}{\{g,h\}}
+\Describefillkey{backrank}{rank}{7}
+\Describefillkey{backranks}{list of ranks}{\{8,7\}}
+\Describefillkey{backfield}{field}{c6}
+\Describefillkey{backfields}{list of fields}{\{b5,c6\}}
+
+
+This keys executes the pgf-commands stored in the style command for
+each single field.
+
+In the following example you should look at the difference it makes
+if you put a cross or a border in the background or the foreground.
+
+\begin{LTXexample}
+\newchessgame
+\def\myarea{a1-b8}
+\chessboard[pgfstyle=cross,
+ color=blue,
+ markfile=h,
+ backarea=\myarea,
+ color=red,
+ padding=-0.2em,
+ pgfstyle=circle,
+ markfields=g1,backfields=g8,
+ linewidth=0.1em,
+ pgfstyle=border,
+ markranks=6, backrank=4]
+\end{LTXexample}
+
+The new key \key{getpiecelists} can be used to mark e.g. all pawns on
+a board:
+
+\begin{LTXexample}
+ \newchessgame
+ \mainline{1. e4 e6 2.d4 d5}
+
+ \chessboard[pgfstyle=cross,
+ color=blue,
+ getpiecelists,
+ markfields={\cblistP,\cblistp}]
+\end{LTXexample}
+
+
+
+\subsubsection{Drawing on regions}
+
+\Describefillkey{markregions}{list of regions}{\{a1-c3, b7-c6\}}
+\Describefillkey{markregion}{list of regions}{\{a1-c3, b7-c6\}}
+\Describefillkey{backregions}{list of regions}{\{a1-c3, b7-c6\}}
+\Describefillkey{backregion}{list of regions}{\{a1-c3, b7-c6\}}
+
+
+\begin{LTXexample}
+\newchessgame
+\def\pawnranks{a2-h2, h7-a7}
+\chessboard[inverse,
+ pgfstyle=border,
+ markregions=\pawnranks,
+ color=red, padding=0.3ex,
+ linewidth=0.1ex,
+ backregions={\board,d4-e5},
+ pgfstyle=text,
+ text=$\leftarrow$%
+ \currentbk-\currentwq
+ $\rightarrow$,
+ markregion=a3-h3,
+ pgfstyle={[rotate=45]text},
+ backregion=h8-a1]
+\end{LTXexample}
+
+
+\subsubsection{Drawing move related}
+
+\Describefillkey{markmoves}{list of moves}{\{a1-c3, b7-c6\}}
+\Describefillkey{markmove}{list of moves}{\{a1-c3, b7-c6\}}
+\Describefillkey{backmoves}{list of moves}{\{a1-c3, b7-c6\}}
+\Describefillkey{backmove}{list of moves}{\{a1-c3, b7-c6\}}
+
+
+\begin{LTXexample}
+\def\mymove{d1-d5}%
+\chessboard[pgfstyle=straightmove,
+ markmoves={a1-a3, c3-e5, g1-f3},
+ pgfstyle=knightmove,
+ backmoves={g8-f6, h1-f4},
+ arrow=to, linewidth=0.2em,
+ markmove= \mymove]
+\end{LTXexample}
+
+I'm not very good in designing beautiful curves and moves arrows. If
+someone could offer me better code I will be happy to implement it.
+
+
+
+
+
+
+
+\subsubsection{Choosing what is drawn: pgf styles}
+
+
+
+%\subsubsection{Mark styles}
+\Describefillkey{markstyle}{[options]style name}{cross}
+\Describefillkey{backstyle}{[options]style name}{cross}
+\Describefillkey{pgfstyle}{[options]style name}{[left]text}
+
+
+With this keys you set the style the drawing commands will use.
+\key{markstyle} sets only the style for the foreground (the «mark»
+picture). \key{backstyle} sets only the style for the background
+picture. \key{pgfstyle} sets the style for both pictures (\key{style}
+is not a shorter version of \key{pgfstyle}!).
+
+If the value starts with \verb+[+ the text until \verb+]+ is
+interpreted as an option of the style. It depends on the definition
+of the style if and how this option is used (until now the text
+style, the circle style and (since version 1.5) the curvemove style
+use such options). \textbf{Attention}: to prevent \cs{chessboard} to
+interpret the \verb+]+ as the end of its optional argument you must
+put braces around the whole value if you want to use options.
+
+Not every style is useful for everything, e.g.\ it doesn't make sense
+to put a border around a move. The following tabular shows the
+predefined styles and the types for which they work.
+
+\begin{tabular}{lccc}
+ & fields & regions & moves \\
+cross & \ding{52} & & \\
+circle& \ding{52} \\
+text & \ding{52} & \ding{52} \\
+border(s)& \ding{52} & \ding{52} \\
+color &\ding{52} &\ding{52}\\
+straightmove & & & \ding{52}\\
+knightmove & & & \ding{52}\\
+curvemove & & & \ding{52}\\
+\end{tabular}
+
+
+
+\DescribeMacro{\cbDefinePgfFieldStyle}
+\DescribeMacro{\cbDefinePgfRegionStyle}
+\DescribeMacro{\cbDefinePgfMoveStyle}
+With this commands you can define your own styles. The commands take
+two argument: the first is the name of the style, the second should
+be the pgf-commands needed to draw.
+
+In previous version of the package the commands were called.
+\cs{cbDefineMarkFieldStyle}%
+\index{cbDefineMarkF=\textbackslash cbDefineMarkFieldStyle (obsolete)|see{\textbackslash cbDefinePgfFieldStyle}},
+\cs{cbDefineMarkRegionStyle}%
+\index{cbDefineMarkR=\textbackslash cbDefineMarkRegionStyle (obsolete) |see{\textbackslash cbDefinePgfRegionStyle}}
+and \cs{cbDefineMarkMoveStyle}%
+\index{cbDefineMarkM=\textbackslash cbDefineMarkMoveStyle (obsolete) |see{\textbackslash cbDefinePgfMoveStyle}}.
+%
+I have changed the names to indicate that the commands will define
+the styles for the background picture too. The older commands still
+work but I suggest that you switch to the new names.
+
+
+The listing shows first an example for a field mark, then an example
+for a region where the second corner is accessed through the
+\lstinline+#1+,
+and at last the definition for the text mark -- here it is necessary
+to rotate the text if the key \key{inverse} is true and the
+definition shows how the optional argument of the \key{pgfstyle} key
+can be use with \verb+#2+:
+
+\begin{lstlisting}
+\cbDefinePgfFieldStyle{circle}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \setlength\len@board@tempx{%
+ \dimexpr 0.55em + \board@pgf@padding \relax}%
+ \pgfpathcircle{\pgfpointxy{0}{0}}{\len@board@tempx}%
+ \pgfusepath{stroke,#2}}%%
+
+\cbDefinePgfRegionStyle{border}{%
+ \pgfsetlinewidth{\board@pgf@linewidth}%
+ \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}
+ \pgfpathrectanglecorners%
+ {\pgfpointadd%
+ {\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}
+ {\pgfpointxy{-0.5}{0.5}}}%
+ {\pgfpointadd%
+ {\pgfpointanchor{#1}{center}}
+ {\pgfpointadd%
+ {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}
+ {\pgfpointxy{0.5}{-0.5}}}}%
+ \pgfusepath{stroke}}%
+
+\cbDefinePgfFieldStyle{text}{%
+ \ifthenelse%
+ {\boolean{\XKV@UFCB@locset@inverse@value}}%
+ {\pgftext[rotate=180,#2]{\normalfont\board@pgf@curtext}}%
+ {\pgftext[#2]{\normalfont\board@pgf@curtext}}}%
+\end{lstlisting}
+
+\subsubsection{Introduction to the predefined pgf styles}
+
+%\subsubsection{Graphic properties}
+%
+%Some of the graphic properties can be changed with predefined keys:
+%You already know about the keys \key{color} and \key{opacity}.
+
+%\medskip
+%\Describefillkey{linewidth}{length}{1ex}
+%\Describefillkey{marklinewidth}{length}{1ex}
+%With this keys you can change an internal command that is used to set
+%the linewidth. The first will affect also the linewidth in the
+%background layer, will the second affect only the mark layer.
+
+\minisec{Borders}
+
+\index{border (style)}%
+\index{border (style)>leftborder}%
+\index{border (style)>rightborder}%
+\index{border (style)>topborder}%
+\index{border (style)>bottomborder}%
+\index{border (style)>lefttopborder}%
+\index{border (style)>lefttoprightborder}%
+\index{border (style)>toprightborder}%
+\index{border (style)>toprightbottomborder}%
+\index{border (style)>rightbottomborder}%
+\index{border (style)>rightbottomleftborder}%
+\index{border (style)>bottomleftborder}%
+\index{border (style)>bottomlefttopborder}%
+Borders can be put around fields and regions. There exist also
+partial borders for one, two or three margins of an area, this
+borders are drawn and named «clockwise». «left», «right», «top», and
+«bottom» refer to the position of the border if the white player is
+at the bottom. If you use the key
+\key{inverse} the positions of the lines don't change in relation to
+the players colors.
+
+\begin{LTXexample}
+\newchessgame
+\setchessboard{smallboard,
+ pgfstyle=rightbottomborder,
+ color=orange,
+ markrank=7,
+ pgfstyle=lefttoprightborder,
+ markregion=a1-b3,
+ shortenstart=-1ex,
+ padding=1ex,
+ linewidth=0.3em,
+ pgfstyle=leftborder,color=red,
+ markregion=\mycenter,
+ pgfstyle=topborder,color=blue,
+ markregion=\mycenter,
+ pgfstyle=rightborder,color=green,
+ markregion=\mycenter,
+ pgfstyle=bottomborder,color=yellow,
+ markregion=\mycenter}
+\def\mycenter{d4-e5}
+\chessboard\
+\chessboard[inverse]
+\end{LTXexample}
+
+\minisec{Circle}
+
+\index{circle (style)}%
+\index{circle (style)>fill (option)}%
+This style can only be used in connection with fields. The optional
+argument can be used to fill the circle (default is stroke).
+
+\begin{LTXexample}
+\newchessgame
+\def\mycenter{d4-e5}
+\chessboard[pgfstyle=circle,
+ color=red,
+ markrank=7,
+ linewidth=0.2em,
+ markrank=6,
+ pgfstyle={[fill]circle},
+ markarea=\mycenter,
+ padding=-0.8ex,color=blue,
+ backfile=b]
+\end{LTXexample}
+
+
+\minisec{Cross}
+
+\index{cross (style)}%
+This style can only be used in connection with fields.
+
+\begin{LTXexample}
+\newchessgame
+\def\mycenter{d4-e5}
+\chessboard[pgfstyle=cross,
+ color=red,
+ markrank=7,
+ linewidth=0.2em,
+ markrank=6,
+ shortenstart=0.5ex,
+ markarea=\mycenter,
+ shortenend=0.5ex,color=blue,
+ backfile=b]
+\end{LTXexample}
+
+\minisec{Text}
+
+\index{text (style)}%
+\index{text (style)>options}%
+Text can be used for fields and regions. It is the only style where
+it isn't enough to simply chose the style, you must also give a value
+to the text content with the key \key{text} (don't confuse the key
+«text» with the style «text»!).
+
+The option of the style is passed to the optional argument of the
+\cs{pgftext} command, so everything that is allowed there can be put
+in the option. In the definition of the text content you can use
+informations about the current field or the current region.
+\cs{currentbk}\index{currentbk=\textbackslash currentbk} e.g. gives
+the \textit{b}lack \textit{k}ing corner of the region (when you draw
+in a region) or the field name (when you draw in a field). The
+opposite corner ist
+\cs{currentwq}\index{currentwq=\textbackslash currentwq},%
+\index{currentbq=\textbackslash currentbq}
+\index{currentwk =\textbackslash currentwk}
+the
+\textit{w}hite \textit{q}ueen corner.
+
+As a default the text is centered on the middle of the field or the
+region. You can use the options to move it around, please look in the
+documentation of pgf to find out what is possible.
+
+\begin{LTXexample}
+\newchessgame
+\setchessboard{tinyboard,color=magenta,clearboard}
+\chessboard[
+ pgfstyle=
+ {[base,at={\pgfpoint{0pt}{-0.4ex}}]text},
+ text= \fontsize{1.2ex}{1.2ex}\bfseries
+ \sffamily\currentwq,
+ markboard]
+
+\chessboard[
+ inverse,
+ pgfstyle=
+ {[base,at={\pgfpoint{0pt}{-0.4ex}}]text},
+ text=\fontsize{1.2ex}{1.2ex}\bfseries
+ \sffamily\currentwq,
+ trimtocolor=black, markboard,
+ trimtocolor=white,color=green,
+ markboard]%
+
+\chessboard[pgfstyle={[rotate=90]text},
+ text=
+ \fontsize{1.2ex}{1.2ex}
+ \bfseries file from \currentwq\ to \currentbk,
+ markregions={a1-a8,b1-b8,c1-c8}]%%
+\end{LTXexample}
+
+\begin{LTXexample}
+\newchessgame
+\setchessboard{tinyboard,color=red}
+
+\chessboard[pgfstyle={[rotate=45]text},
+ text=
+ \fontsize{1.2ex}{1.2ex}
+ \bfseries this is the diagonal
+ \currentwq\ to \currentbk,
+ markregions=\board]
+
+\chessboard[inverse, pgfstyle={[rotate=45]text},
+ text=
+ \fontsize{1.2ex}{1.2ex}
+ \bfseries this is the diagonal
+ \currentwq\ to \currentbk,
+ markregions=\board]
+
+\end{LTXexample}
+
+
+\minisec{Color}
+
+\index{color (style)}%
+This style puts a colored square on or under the field or region. At
+the start it was meant to color the background of the fields (and so
+it was only defined for the background). If used for the foreground
+on should set an adequate opacity.
+
+\begin{LTXexample}[width=0.55\textwidth]
+\newchessgame
+\setchessboard{tinyboard,
+ color=orange!80}
+\chessboard[boardfontencoding=LSBC5,
+ pgfstyle=color,
+ trimtocolor=black,
+ backboard,
+ trimtocolor=white,
+ color=gray!50,
+ backboard]%
+\chessboard[pgfstyle=color,
+ padding=-0.2em,
+ opacity=0.5,
+ markfiles={a,b},
+ markregion={e1-h8}]%
+\end{LTXexample}
+
+
+\minisec{Moves}
+
+\index{straightmove (style)}%
+\index{curvemove (style)}%
+\index{knightmove (style)}%
+Three styles draw arrows for moves. Two are quite simple:
+\key{straightmove} which draws straight arrows,
+\key{knightmove} which make a curve suited for knight moves.
+
+
+
+
+
+\begin{LTXexample}
+\newchessgame
+\chessboard[pgfstyle=straightmove,
+ markmove=a1-a8,
+ arrow=to,linewidth=0.2ex,
+ color=red,
+ pgfstyle=knightmove,
+ markmoves={g1-f3, e1-h4},
+ shortenstart=-1ex,
+ markmoves=h1-g3]%
+\end{LTXexample}
+
+
+\paragraph*{curvemove} New in version 1.5 there is the more sophisticated
+\key{curvemove} which draws an arbitrary bezier curve between start
+and end field.
+
+\key{curvemove} accept an optional argument in key val syntax. (If you use it,
+don't forget to put braces arround the value!).
+
+\index{curvemove (style)>x1 (key)}%
+\index{curvemove (style)>x2 (key)}%
+\index{curvemove (style)>y1 (key)}%
+\index{curvemove (style)>y2 (key)}%
+\index{curvemove (style)>clockwise (key)}%
+First, there are keys that lets you change the support points of the
+bezier curve. The curve use a local coordinate system: The x-axis
+goes along the line from the start point to the end point. The
+x-values set with the keys listed below are relative to the length of
+this arrow from start to end, while the y-values are absolute (unit
+it the width of a square). Positive y values give a curve going
+clockwise, negative y values give a curve going anticlockwise. With
+the
+\texttt{clockwise=false} you can change the sign of the y values.
+
+\begin{tabular}{>{\ttfamily}l>{~=~}l}
+x1 & \meta{number}\\
+x2 & \meta{number}\\
+y1 & \meta{number}\\
+y2 & \meta{number}\\
+clockwise & \meta{true|false}
+\end{tabular}
+
+Second, there are keys to change \emph{locally} (only for the curve)
+the look of the arrow. They work like the keys for \cs{chessboard}
+with the same name:
+\index{curvemove (style)>arrow (key)}%
+\index{curvemove (style)>pgfarrow (key)}%
+\key{arrow}, \key{pgfarrow},
+\index{curvemove (style)>linewidth (key)}%
+\index{curvemove (style)>pgflinewidth (key)}%
+\key{linewidth}, \key{pgflinewidth},
+\index{curvemove (style)>shortenstart (key)}%
+\index{curvemove (style)>pgfshortenstart (key)}%
+\key{shortenstart}, \key{pgfshortenstart},
+\index{curvemove (style)>shortenend (key)}%
+\index{curvemove (style)>pgfshortenend (key)}%
+\key{shortenend}, \key{pgfshortenend}.
+
+\index{curvemove (style)>style (key)}%
+At last there is a key \key{style} which you can use to reuse saved
+keyval-lists. Until now only style \texttt{knight} exists and there
+is no user command to define new ones. You want to use own keys, sent
+me either a feature request or do it by defining the low level
+command:
+
+\verb+\def\board@pgf@curvemovestyle@+\meta{name}\verb+{\setkeys[UFCB]{bez}{+\meta{keyval-list}\verb+}}+
+
+\begin{LTXexample}
+\newchessgame
+\def\mystyle{[clockwise=false,style=knight]curvemove}
+\chessboard[arrow=latex,
+ pgfstyle=straightmove,
+ shortenstart=0.1em,
+ color=blue,
+ linewidth=3pt,
+ markmoves={e1-e8},
+ pgfstyle={[linewidth=2pt,arrow=to,
+ style=knight]curvemove},
+ markmove=b1-c3,
+ color=red,
+ pgfstyle=\mystyle,
+ markmoves={b1-c3,b1-a3},
+ pgfstyle=curvemove,
+ markmoves={e1-g1,h1-f1}]
+\end{LTXexample}
+\subsubsection{Setting graphic properties}
+
+As the previous examples showed you can change quite a lot things of
+the pictures. Now here a complete description of the needed keys. The
+keys don't draw anything directly. They only put commands or
+definitions like
+\verb+\color{red}+, \verb+\pgfsetfillopacity{0.3}+ or
+\verb+\def\board@pgf@arrow{to}+ in the pgf-picture(s).
+
+
+
+
+\bigskip
+Let us now start with the keys which put a command in the pictures:
+
+
+\Describefillkey{color}{color}{red}
+\Describefillkey{pgfcolor}{color}{red}
+
+This keys stores a color command (\verb+\color{red}+) in the pgf
+picture(s).
+
+
+\medskip
+\Describefillkey{opacity}{number}{0.5}
+\Describefillkey{pgfopacity}{number}{0.5}
+\Describefillkey{fillopacity}{number}{0.5}
+\Describefillkey{pgffillopacity}{number}{0.5}
+\Describefillkey{strokeopacity}{number}{0.5}
+\Describefillkey{pgfstrokeopacity}{number}{0.5}
+
+
+This keys add \cs{pgfsetfillopacity}\marg{number} and/or
+\cs{pgfsetstrokeopacity}\marg{number} to the pgf-picture(s). The
+number should be between zero and one.
+
+\begin{LTXexample}
+\chessboard[padding=-0.5ex,
+ color=red,fillopacity=0.5,
+ markstyle=circle,markfields=a1,
+ markstyle=color,markfields=b1,
+ fillopacity=1,
+ strokeopacity=0.5,
+ pgfstyle=circle,
+ markfields=d1,backfield=d8,
+ pgfstyle=color,
+ markfields=e1,backfield=c8]
+\end{LTXexample}
+
+
+\bigskip
+The following keys puts only a definition in the pgf-pictures. The
+values will only affect the styles that use the internal commands in
+their definitions.
+
+\medskip
+\Describefillkey{padding}{length}{0.1ex}
+\Describefillkey{pgfpadding}{length}{0.1ex}
+
+This keys save \verb+\def\board@pgf@padding+\marg{length} to the
+pgf-picture(s). The value can be used in various situations to change
+the offset of a line or a border of the area that is covered by a
+color.
+
+Used currently by the border styles, the styles that color fields in
+the background or the foreground to enlarge or reduce the covered
+area and the circle (the length is added to a start diameter).
+
+\begin{LTXexample}
+\chessboard[color=red,
+ markstyle=circle,markfields=a1,
+ markstyle=border,markfields=a3,
+ markstyle=color,markfields=a5,
+ padding=0.3ex,color=green,
+ markstyle=circle,markfields=c3,
+ markstyle=border,markfields=c5,
+ markstyle=color,markfields=e5,
+ padding=-0.3ex,color=blue,
+ markstyle=circle,markfields=g3,
+ markstyle=border,markfields=g5,
+ backstyle=color,backfields=g1]
+\end{LTXexample}
+
+\medskip
+\Describefillkey{arrow}{arrow type}{to}
+\Describefillkey{pgfarrow}{arrow type}{to}
+
+This keys save \verb+\def\board@pgf@arrow+\marg{arrow type} to the
+pgf-picture(s). Styles can use the command to set the arrow
+tips. Look at the documentation of pgf to learn about the existing
+arrow types (and how to define new ones).
+
+Default is \texttt{latex}. Used currently by the move styles.
+
+\begin{LTXexample}
+\chessboard[markstyle=straightmove,
+ markmove=a1-a3,
+ arrow=to,
+ markmove=b1-b3]
+\end{LTXexample}
+
+\Describefillkey{shortenstart}{length}{to}
+\Describefillkey{pgfshortenstart}{length}{to}
+\Describefillkey{shortenend}{length}{to}
+\Describefillkey{pgfshortenend}{length}{to}
+\Describefillkey{shorten}{length}{to}
+\Describefillkey{pgfshorten}{length}{to}
+
+This keys save the definitions
+\verb+\def\board@pgf@shortenstart+\marg{length} or\\
+\verb+\def\board@pgf@shortenend+\marg{length} or both to the
+pgf-picture(s). The commands can be used e.g. in a
+\cs{pgfsetshortenstart} command to shorten a line a the start or the
+end.
+
+As default the lengths are 0pt. Used e.g.\ by the styles
+straightmove, knightmove, cross and the partial borders. The lengths
+are
+\emph{added} to some start values that I thought reasonable. If you
+use large length (over 1ex) this can change the meaning of move marks
+as the mark will start in another field!
+
+\begin{LTXexample}
+\chessboard[markstyle=straightmove,
+ markmove=a1-a3,
+ markstyle=cross,markfield=a5,
+ shortenend=1ex,color=red,
+ markstyle=straightmove,
+ markmove=b1-b3,
+ markstyle=cross,markfield=b5,
+ shorten=-0.5em,color=green,
+ pgfstyle=straightmove,
+ backmove=d1-d3,
+ backstyle=cross,backfield=d5]
+\end{LTXexample}
+
+\Describefillkey{linewidth}{length}{1ex}
+\Describefillkey{pgflinewidth}{length}{1ex}
+\Describefillkey[relict]{marklinewidth}{length}{1ex}
+\Describefillkey[relict]{backlinewidth}{length}{1ex}
+
+This keys save \verb+\def\board@pgf@linewidth+\marg{length} to the
+pgf-picture(s). The command can be used e.g. in \cs{pgfsetlinewidth}.
+The keys \key{marklinewidth} and \key{backlinewidth} are remains from
+an older version. There put the commands only in one picture, and
+they ignore the values of the \key{usepgf} keys.
+
+\begin{LTXexample}
+\chessboard[markstyle=straightmove,
+ markmove=a1-a3,
+ markstyle=cross,markfield=a5,
+ linewidth=1ex,color=red,
+ markstyle=straightmove,
+ markmove=b1-b3,
+ markstyle=cross,markfield=b5,
+ pgfstyle=border,backfield=d5]
+\end{LTXexample}
+
+%??????????????????????????????????
+%vachange an internal command that can be use to set the linewidth
+%e.g. of an arrow or a border. The first key affects both
+%pgf-pictures, the other only the mark or the background layer
+
+\Describefillkey{cornerarc}{length}{2pt}
+\Describefillkey{pgfcornerarc}{length}{2pt}
+\Describefillkey[relict]{backcornerarc}{length}{2pt}
+
+The first two keys save \verb+\def\board@pgf@corner+\marg{length} to
+the pgf-picture(s). The last key will save the same definition only
+to the background picture and it will ignore the value of the
+\key{usebackpgf} and \key{usepgf} keys. \verb+\board@pgf@corner+ can
+be used e.g. in \cs{pgfsetcornersarced} to round the corners of a
+border. To get sharp corners use the value 0pt.
+
+The value is used currently only used in the border styles.
+
+\begin{LTXexample}
+\chessboard[linewidth=0.3ex,color=red,
+ padding=1ex,
+ pgfstyle=border,
+ backregion=\board,
+ cornerarc=1ex,
+ padding=1.5ex,
+ backregion=\board,
+ pgfstyle=bottomlefttopborder,
+ backregion=c3-f6]
+\end{LTXexample}
+
+
+\Describefillkey{addpgf}{(pgf)-commands}{\cs{pgfsetroundcap}}
+
+With this key you can add arbitrary (pgf)-commands to the pictures.
+Use it with care. When you use the key without an argument it will
+end a pgf scope\index{scope} and so reset colors and
+linewidth and some of the other values to their defaults.
+
+\begin{LTXexample}
+\chessboard[
+ showmover=false,
+ inverse,markstyle=leftborder,
+ color=red,linewidth=0.3em,
+ markregion=d3-d5,
+ color=blue,
+ addpgf=\pgfsetroundcap,
+ markregion=e3-e5,
+ addpgf,
+ markstyle=cross,
+ markfield=c4]
+\end{LTXexample}
+
+\Describefillkey{usepgf}{back|mark|all|both|none}{}
+
+With this key you can control in which picture the commands or
+definitions are saved when using the keys described above.
+
+The default is to save everything in both pictures. This means that
+is also adds some superfluous code to the other picture, but I don't
+think this is a problem. In most cases you won't need the key.
+
+
+
+\subsubsection{A special shortcut key for background border}
+
+
+\Describefillkey{pgfborder}{area}{c3-e4}
+
+With this key you can put a border around the area in the background
+picture. The key saves the current style, calls the \key{backstyle}
+and the \key{backregions} keys to draw the border and then restores
+the old style. If you don't give a value to the key, the border is
+around the printarea.
+
+\begin{LTXexample}
+\newchessgame
+\chessboard[%
+ showmover=false,
+ border=false,
+ linewidth=0.4pt,
+ padding=0.4pt,
+ pgfborder,
+ linewidth=1pt,
+ padding=2pt,
+ pgfborder]
+\end{LTXexample}
+
+
+\begin{LTXexample}
+\chessboard[
+ showmover=false,
+ border=false,
+ hlabelwidth=0.6em,
+ vlabellift=1.3em,
+ printarea=c3-f6,
+ pgfstyle=cross,
+ color=red,
+ linewidth=1ex,
+ padding=1ex,
+ pgfborder,
+ markfield=d4,
+ color=blue,
+ linewidth=0.5ex,
+ padding=2.5ex,
+ pgfborder,
+ padding=0ex,
+ color=green,
+ trim=false,%to show the next border
+ pgfborder=\board,
+ markfield=e5]
+\end{LTXexample}
+
+
+
+
+\subsubsection{Special shortcut keys for background color}
+
+
+
+\medskip
+\Describefillkey{colorbackboard}{arbitrary}{}
+\Describefillkey{colorbackarea}{area}{a1-c3}
+\Describefillkey{colorbackareas}{list of areas}{\{a1-c3, f1-f2\}}
+\Describefillkey{colorbackfile}{file}{h}
+\Describefillkey{colorbackfiles}{list of files}{\{g,h\}}
+\Describefillkey{colorbackrank}{rank}{5}
+\Describefillkey{colorbackranks}{list of ranks}{\{8,7\}}
+\Describefillkey{colorbackfield}{field}{g4}
+\Describefillkey{colorbackfields}{list of fields}{\{b5,c6\}}
+\Describefillkey{colorwhitebackfields}{list of fields}{\{b5,c6\}}
+\Describefillkey{colorblackbackfields}{list of fields}{\{b5,c6\}}
+
+
+This keys are shortcuts to color the background of the board. They
+save the current style, color the fields and then restore the style.
+
+
+\begin{LTXexample}
+\chessboard[
+ showmover=false,
+ border=false,
+ pgfstyle=cross,
+ color=red!50,
+ colorwhitebackfields,
+ markfield=d4,
+ color=blue!50,
+ colorblackbackfields,
+ markfield=e5,
+ color=green!50,
+ colorbackarea=d4-e5]
+\end{LTXexample}
+
+
+%\subsection{Marks and highlighting: Adding decoration to the foreground layer}
+
+%
+%
+%\subsection{Coloring the pieces}
+%
+%Coloring the fields isn't really satisfactory. It would be nicer if
+%one could color only the pieces. But as the background and the piece
+%is one char this isn't possible, one needs a font where for each
+%piece there a background mask. One can fake such a font by either
+%using two chars for the fields with black background, or by not
+%using the chars with black background. I added three experimental
+%encodings to
+%\chessfss and some keys to use them. This isn't perfect but it's a
+%start until better fonts are available.
+%
+%To use the encodings you must load
+%\filetype{lsb1enc.def}, \filetype{lsb2enc.def} and
+%\filetype{lsb3enc.def} e.g.\ with
+%\lstinline+\usepackage[LSB1, LSB2, LSB3, T1]{fontenc}+.
+%
+%\Describesetkey{colorwhite}{color}{red}{--}
+%\Describesetkey{colorblack}{color}{green}{--}
+%
+%This keys colors all black and white pieces.
+%
+%\begin{LTXexample}
+%\chessboard[boardfontencoding=LSB1,
+% emphstyle=\color{green},
+% emphboard,
+% colorwhite=red,
+% colorblack=blue]
+%\end{LTXexample}
+%
+
+
+%\Describefillkey{piececolor}{color}{red}
+%\Describefillkey{colorpieces}{list of fields}{\{a1,c3\}}
+%With this keys you can color the pieces on some fields.
+%
+%\begin{LTXexample}
+%\def\fieldlist{a1,b1 , c1}%
+%\def\mycolor{blue}%
+%\chessboard[boardfontencoding=LSB1,
+% emphstyle=\color{green},
+% emphboard,
+% piececolor=red,
+% colorpieces={a8,b8},
+% piececolor=\mycolor,
+% colorpieces=\fieldlist]
+%\end{LTXexample}
+
+%\begin{LTXexample}
+% \chessboard[boardfontencoding=LSB1,
+% colorwhite=red,
+% colorblack=blue,
+% addpieces={qd5,ke5,Qd4,Ke4}]
+%\end{LTXexample}
+
+%\subsection{The foreground picture: Marking}
+
+%The following highlighting commands all use one large pgf-picture
+%that is printed above the board. Putting marks on the boards means
+%inserting some pgf code in this picture. The units of the picture are
+%equal to the width and height of a square. For each field there exist
+%a node with the same name as the field in the middle of field. With
+%the command
+%\lstinline+\pgftransformshift{\pgfpointanchor{+\meta{field}\lstinline+}{center}+
+%one can shift the origin to this field and start to draw.
+%
+
+
+
+%\subsubsection{Adding arbitrary pgf-code}
+
+
+
+
+\subsubsection{Clearing the pgf-pictures}
+
+
+
+
+Removing pgf decoration from the board is easy if you used the
+optional argument of \cs{chessboard}. But what should you do if you
+had added e.g.\ a mark with \cs{setchessboard} for the next four
+board and now want to get rid of it for the fifth? That isn't so easy
+as the code is burried quite deep in a large list.
+
+On the whole there are three possibilities:
+
+
+\begin{itemize}
+\item Use grouping to keep the marks local to some boards.
+
+
+\begin{LTXexample}[width=0.55\textwidth]
+\newchessgame
+\setchessboard{tinyboard}
+{\setchessboard{markstyle=cross,
+ markranks=4}
+\chessboard}%
+\chessboard
+\end{LTXexample}
+
+\item Store the keys in a style that you can redefine:
+
+\begin{LTXexample}[width=0.55\textwidth]
+\newchessgame
+\storechessboardstyle{mymarks}
+ {markstyle=cross,
+ markranks=4}
+
+\setchessboard{style=mymarks}
+\chessboard%
+\storechessboardstyle{mymarks}{}
+\chessboard
+\end{LTXexample}
+
+
+
+\item Use the following keys to clear the pgf pictures.
+
+\end{itemize}
+
+\Describefillkey{clearpgf}{arbitrary}{}
+\Describefillkey{clearbackpgf}{arbitrary}{}
+\Describefillkey{clearmarkpgf}{arbitrary}{}
+
+(I renamed the keys \key{clearforegroundpgf}%
+\index{clearforegroundpgf (obsolete)|see{clearmarkpgf}} and
+\key{clearbackgroundpgf},%
+\index{clearbackgroundpgf (obsolete)|see{clearbackpgf}} the older names will work too, but I
+suggest that you switch to the new ones.)
+
+\begin{LTXexample}[width=0.55\textwidth]
+\newchessgame
+\setchessboard{tinyboard,
+ color=blue,
+ opacity=0.6,
+ colorblackbackfields,
+ color=red,
+ markstyle=cross,
+ markfiles=h}
+\chessboard%
+\chessboard[clearmarkpgf]
+\chessboard[clearbackpgf]%
+\chessboard[clearpgf,
+ markstyle=circle,
+ markranks=4]
+\setchessboard{clearmarkpgf}%
+\chessboard
+\end{LTXexample}
+
+
+\subsubsection{Clipping the pgf pictures}
+
+
+\Describesetkey{clip}{\keylist}{}{false}
+\Describesetkey{markclip}{\keylists}{}{false}
+\Describesetkey{backclip}{\keylists}{}{false}
+
+\index{clip>true (subkey)}%
+\index{clip>false (subkey)}%
+\index{clip>left (subkey)}%
+\index{clip>right (subkey)}%
+\index{clip>top (subkey)}%
+\index{clip>bottom (subkey)}%
+With this keys you can add \emph{one} clipping path to each pgf
+pictures. The clipping paths are always around the print area. The
+argument of the keys is key-value-list with the possible keys
+\key{true},
+\key{false} to enable or disable the clipping and the four keys
+\key{left}, \key{top}, \key{right} and \key{bottom} which take as
+value a length and are used to set the padding.
+
+As in other keys the value \texttt{true} can be omitted, but this
+also means that you have to use the value \texttt{false} explicitly
+if you only want to set some of the padding values but not enable
+clipping.
+
+
+\begin{LTXexample}[width=0.55\textwidth]
+\newchessgame
+\setchessboard{
+ trim=false,printarea=b2-g7,
+ clip={left=0.5ex,top=0.5ex,
+ right=-0.5ex,bottom=-0.5ex,
+ false},
+ %
+ border=false,linewidth=0.3em,
+ pgfborder,
+ %
+ pgfstyle=color,
+ color=blue!50,
+ backrank=6,backfile=c,
+ color=red!50,
+ markrank=4,markfile=f,
+ %
+ pgfstyle=text,color=black,
+ text=a text in the foreground,
+ markfield=b4,
+ text=a text in the background,
+ backfield=f6}%
+
+\chessboard
+
+\chessboard[markclip]
+
+\chessboard[backclip]
+
+\chessboard[clip]
+\end{LTXexample}
+
+
+\subsubsection{Trimming}
+Clipping cuts simply through the pgf-pictures and throws everything
+away that is outside the printarea. This has the drawback that in
+the picture there could be e.g. remains of a move arrow that started
+outside the shown board.
+
+Trimming is an attempt for a more intelligent approach: Objects like
+crosses, circles, text, borders and arrows are discarded completely
+if they lie partly or completely outside the defined scope of fields.
+
+\minisec{Trimming to a area}
+\Describefillkey{trimarea}{area|empty}{}
+
+This sets and activates an trimarea. If you omit a value printarea is
+used. If you don't give an area but use the keyword \verb+empty+
+everything following the key will be trimmed. If you want to disable
+trimming use \verb+trimarea=\board+ (or \verb+trim=false+). As a
+default the trimarea is set to the print area (and so activated).
+
+The value of \key{trimarea} will affect all \emph{following} objects
+drawn with the
+\key{pgfstyle} and the related \key{mark\ldots} and
+\key{back\ldots} keys.
+
+Field related objects will be drawn if the field lies in the area.
+Region related objects will be drawn if the complete region lies in
+the area. Move related objects will be drawn if the complete move
+lies in the area.
+
+
+\begin{LTXexample}
+\newchessgame
+\setchessboard{pgfstyle=color,
+ color=blue!50,
+ backrank=6,
+ trimarea=\myarea,
+ backrank=5,
+ pgfstyle=border,
+ color=red,
+ markregion=d4-d5,
+ markregion=c3-d5,%will disappear
+ pgfstyle=knightmove,
+ color=yellow,
+ markmove=f6-e4,
+ markmove=f7-d5%will disappear
+ }
+\def\myarea{a1-h8}% nothing trimmed
+\chessboard
+
+\def\myarea{d4-f6}% some deco will disappear
+\chessboard
+\end{LTXexample}
+
+\begin{LTXexample}
+\newchessgame
+\setchessboard{pgfstyle=color,
+ color=blue!50,
+ backrank=6,
+ trimarea=\myarea,
+ backrank=5,
+ pgfstyle=border,
+ color=red,
+ markregion=d4-d5,
+ markregion=c3-d5,%will disappear
+ pgfstyle=knightmove,
+ color=yellow,
+ markmove=f6-e4,
+ markmove=f7-d5%will disappear
+ }
+\def\myarea{empty}
+\chessboard
+\end{LTXexample}
+As shown in the previous examples you can set a manual trimarea. But
+you should be aware that you can get unexpected results if this
+area is larger than the printarea:
+
+
+\begin{LTXexample}
+\chessboard[printarea=d4-e5,
+ trimarea=c4-g4,
+ pgfstyle=color,
+ trimtocolor=white,
+ color=red,
+ backboard]
+\end{LTXexample}
+
+\Describefillkey{captrimtoprint}{true|false}{true}
+
+With this key you can force the \emph{following} trimarea commands to
+respect the printarea.
+
+\begin{LTXexample}
+\chessboard[printarea=d4-e5,
+ trimarea=c3-f6,
+ captrimtoprint,
+ pgfstyle=cross,
+ color=red,
+ backboard,
+ trimarea=c3-f6,%now captrimtoprint
+ %has an effect
+ pgfstyle=circle,
+ color=green,
+ backboard]
+\end{LTXexample}
+
+
+\Describefillkey{trim}{true|false}{true}
+
+This is a shorter version of \key{trimarea}. It can only be used to
+set the trimarea to printarea (true) or the complete board (false).
+
+%Until now I have only implement some code to draw colored squares in
+%the background. I don't know really what else could be useful. The
+%only idea that comes to my mind is some code to insert a real
+%background image, but it is difficult to decide how size and position
+%of such an image should be controlled.
+
+
+\begin{LTXexample}
+\newchessgame
+\mainline{1. e4 e5 2. Nf3 Nc6 3. Bb5 a6}
+\setchessboard{linewidth=0.1em,border=false,
+ label=false,showmover=false}
+\chessboard[printarea=a5-d8,
+ padding=0.25em,
+ trim=false,
+ shortenend=-1ex,
+ pgfstyle=rightborder,
+ markregion=d1-d8,
+ padding=-0.25em,
+ pgfstyle=topborder,
+ markrank=4,
+ marginrightwidth=0.5em,
+ marginbottomwidth=0.5em]%
+\chessboard[printarea=e5-h8,
+ marginleftwidth=0em,
+ marginbottomwidth=0.5em]\\%
+\chessboard[printarea=a1-d4,
+ margintopwidth=0em,
+ marginrightwidth=0.5em]%
+\chessboard[printarea=e1-h4,
+ margintopwidth=0em,
+ marginleftwidth=0em]%
+\end{LTXexample}
+
+
+\minisec{Trimming to the white or black fields}
+
+\Describefillkey{trimtocolor}{white|black|false}{}
+
+The key affects only the field related pgf-objects. Regions and moves
+will ignore it. The key \obsoletekey{applycolor} from previous
+versions has now a similar effect\footnote{I couldn't retain the older behaviour due to the changes
+made in the code.}. This means that the key has changed
+its behaviour: it will now affect also the foreground picture!
+
+\begin{LTXexample}
+\chessboard[printarea=c3-f6,
+ trim, %not really needed, default
+ pgfstyle=color,
+ trimtocolor=white,
+ color=red,
+ backboard,
+ trimarea=b2-g7,
+ trimtocolor=black,
+ color=gray!50,
+ backboard]
+\end{LTXexample}
+
+
+%\medskip
+%\Describefillkey{applycolor}{white|black|all|none}{white}
+% \Describefillkey{colorwhitefields}{arbitrary}{}
+%\Describefillkey{colorblackfields}{arbitrary}{}
+
+%With this key you can chose to color only the black or the white
+%fields.
+%\begin{LTXexample}
+%\def\myareas{f6-f7, h7-h8}
+%\chessboard[inverse,
+% printarea=b2-g7,
+% opacity=0.5,
+% color=green, padding=-0.2ex,
+% colorbackareas=\myareas, %trimmed
+% color=red,
+% trim=false, %next fields not trimmed
+% colorbackfields={a1,c3,d4,g8}]
+%\end{LTXexample}
+
+
+\begin{LTXexample}
+\chessboard[printarea=f3-c6,
+ padding=.3ex,
+ trimtocolor=white,
+ color=blue,
+ pgfstyle=cross,
+ backranks=5,
+ color=yellow,
+ trimtocolor=black,
+ trim=false,
+ backfiles={d,e}]
+\end{LTXexample}
+
+
+\begin{LTXexample}
+\chessboard[padding=.3ex,
+ printarea=f3-c6,
+ trimtocolor=white,
+ color=blue,
+ pgfstyle=text,
+ text=\tiny\bfseries white,
+ markboard,
+ color=yellow,
+ trimtocolor=black,
+ text=\tiny\bfseries black,
+ markboard]
+\end{LTXexample}
+
+
+\begin{LTXexample}
+\chessboard[inverse, printarea=a2-g7,
+ boardfontencoding=LSB2,
+ color=lightgray!50,
+ trimtocolor=white,
+ colorbackboard,
+ color=gray!60,
+ trimtocolor=black,
+ colorbackboard]
+\end{LTXexample}\label{stoppgf}
+
+
+
+\subsection{Using a graphic as background}
+
+It isn't really difficult to use a graphic as background of the
+board. You must use a boardfont encoding that hasn't fields and
+fieldmasks. And then you must use trial and error to find out which
+scalefactor and which viewport is fine. There is absolutly no way to
+do this automatically as the border of the board in the graphic is
+unknown. If you change the board size or the size of the left margin,
+you will have to adjust the values.
+
+
+\begin{LTXexample}[width=0.55\textwidth]
+\newchessgame
+\includegraphics
+ [scale=0.477,viewport=-20 17 -20 17]
+ {brett}%
+\chessboard[showmover=false,
+ border=false,
+ label=false,
+ boardfontencoding=LSBC5,
+ boardfontsize=20pt,
+ whitepiececolor=brown!70,
+ blackpiececolor=black,
+ setfontcolors]
+\end{LTXexample}
+
+\subsection{Using the commands of \skaksty}
+
+When used with the option \textsf{ps} \skaksty puts in the middle of
+the right bottom field (that is either h1 or a8) a postscript node
+with the name BM. The highlighting commands of \skaksty use this
+node.
+
+To be able to use the commands also with \cs{chessboard} you must
+load \skaksty with the option \textsf{ps}.
+
+As arguments in the commands of \skaksty you can only use the fields
+of a 8\texttimes8-board.
+
+\medskip
+\Describesetkey{psset}{true|false}{}{false}
+
+This key sets the node BM at the place where \skaksty expect it,
+\emph{and it sets the psunits to the size of the board}. This can
+affect other pspictures as the changes are made after the board and
+so aren't local to the board (the commands of \skaksty must have a
+fighting chance to get the correct values).
+
+\medskip
+\Describesetkey{psskak}{true|false}{}{false}
+
+This key redefines some internal commands of \skaksty. I had to do it
+in order to get the highlighting commands to work. I don't think that
+it will destroy anything but didn't want to activate the changes
+unasked. The changes are also \emph{not} local to the board (but
+local to the group).
+
+\begin{LTXexample}[graphic={chessboard-skakps}]
+\documentclass[parskip]{scrartcl}
+\usepackage[T1]{fontenc}
+\usepackage[ps]{skak}
+\usepackage{chessboard}
+
+\pagestyle{empty}
+\begin{document}
+\newchessgame
+\chessboard[psskak,psset,pgf=false,
+ inverse]
+\ifpdf\else
+\highlight[X]{c4}
+\highlight[o]{a8}
+\highlight[O]{g1}
+\printknightmove{g8}{f6}
+BM\pnode{A}\ncline{->}{A}{BM}
+\fi
+\end{document}
+\end{LTXexample}
+
+
+
+
+
+\subsection{Intelligent highlighting}
+
+\cs{chessboard} doesn't know anything about chess rules. It can't do
+things like «show me the possible moves of the rock», «show me the
+allowed moves» or «highlight the last move». But as the examples show
+it accepts commands as arguments in the highlighting keys, so it can
+use the intelligence of external commands or applications. E.g.\
+highlighting of the last move would be easy if \skaksty would somehow
+save the last from-field and the last to-field -- something it
+doesn't do now.
+
+\section{Extending the game}
+\subsection{Adding new pieces}
+\DescribeMacro{\cbDefineNewPiece}
+With this command you can add new pieces that can be used on the
+board.
+
+\cs{cbDefineNewPiece}\oarg{game}\marg{color}\marg{char}\marg{on
+white}\marg{on black}
+
+The optional argument \meta{game} has not much use yet as there is
+only one sensible value \texttt{skak} which is the default anyway.
+So leave it out.
+
+\meta{color} should by either \texttt{white} or \texttt{black}, it
+will put the character in the list used by e.g.\ the key
+\key{hidewhite}.
+
+\meta{char} is the character used in FEN and the other input
+arguments. Use a uppercase char for white pieces and a lowercase
+char for the black pieces or the keys like \key{addwhite} won't work
+correctly.
+
+\meta{on white} and \meta{on black} should contain the commands
+needed to print the piece on white and black fields. The symbols
+should be scalable. So you should either use symbols from a font or
+use some resizing command from the graphicx package.
+
+\begingroup
+\begin{LTXexample}[width=0.25\textwidth]
+\makeatletter
+\cbDefineNewPiece{white}{C}
+ {\raisebox{\depth}{\cfss@whitepiececolor
+ $\heartsuit$}}
+ {\BlackEmptySquare%
+ \makebox[0pt][r]{\cfss@whitepiececolor
+ \raisebox{\depth}{%
+ \makebox[1em]{$\heartsuit$}}}}
+\cbDefineNewPiece{black}{c}
+ {\raisebox{\depth}{\cfss@blackpiececolor
+ $\clubsuit$}}
+ {\BlackEmptySquare%
+ \makebox[0pt][r]{\cfss@blackpiececolor
+ \raisebox{\depth}{%
+ \makebox[1em]{$\clubsuit$}}}}
+\makeatother
+\setchessboard{tinyboard,
+ addpieces={cd4,Ce5},addwhite={ca1,Cb1},
+ addblack={ca8,Cb8}}
+\chessboard[addpieces={cd4,Ce5, Ke4}]
+\chessboard[hidewhite]
+\chessboard[boardfontencoding=LSB3,
+ whitepiececolor=red,blackpiececolor=blue,
+ setfontcolors,color=lightgray,
+ trimtocolor=black, colorbackboard]
+\end{LTXexample}
+\endgroup
+
+%\subsection{Clipping and trimming the picture}
+
+
+
+\subsection{Using \texorpdfstring{\cs{chessboard}}{\textbackslash chessboard} for other games}
+
+I have tried to prepare \cs{chessboard} for other games. A lot of
+internal commands can be changed simply by changing the «name of the
+game». Up to now there isn't another game, so I don't know if this
+will really work.
+
+
+It should be easy to make boards for checkers if I find a font
+somewhere. Chinese chess is a bit more complicated as one would have
+to decide how to make the background lines. Go is more complicated
+as the pieces are sometimes numbered, I don't know yet if I could
+implement a good input handling -- but as there is a quite good
+package named igo I don't think I will really look into it.
+
+
+The main problem in any cases is the missing partner: \Pchessboard
+isn't «intelligent». As already mentioned above it doesn't know
+anything about the rules of chess. To be able to show «the running
+game» it needs a partner that does the calculation.
+
+
+
+\section{Compability with other packages}
+
+\subsection{\packagename{skak}}
+\Pchessboard works fine with \skaksty. You can use \cs{chessboard}
+everywhere instead of \cs{showboard} etc.
+
+\subsection{\packagename{texmate}}
+
+The new \packagename{texmate} version use \skaksty to follow the
+game. There is no problem to use \cs{chessboard} where the manual
+suggest \cs{showboard}. \packagename{texmate} also defines its own
+diagram commands. They use internaly \cs{showboard}. I haven't made
+much tests until now, but it looks like after a simple
+\lstinline+\let\showboard\chessboard+ you can use \cs{chessboard}
+instead. The main problem is that you can't use the argument of
+\cs{chessboard}. You will have to set the board properties with
+\cs{setchessboard}.
+
+
+\subsection{\packagename{beamer}}
+
+I wouldn't have thought it, but I had no problem to use
+\cs{chessboard} with \packagename{beamer}.
+
+The following listing shows an example. If your pdf-reader can handle
+annotations you can see the result in the attached file:
+\attachfile{chessboard_and_beamer.pdf}
+
+\begin{lstlisting}
+\documentclass{beamer}
+\usepackage[T1]{fontenc}
+\usepackage{chessboard, skak}
+\begin{document}
+
+\begin{frame}
+\newchessgame
+\only<1->{\setchessboard{hideall,showmover=false}}
+\only<2->{\setchessboard{showpieces={p,P}}}
+\only<3->{\setchessboard{showpieces={K,k}}}
+\only<4->{\setchessboard{showpieces={Q,q}}}
+\only<5->{\setchessboard{showpieces={R,r}}}
+\only<6->{\setchessboard{showpieces={B,b}}}
+\only<7->{\setchessboard{showpieces={N,n}}}
+\chessboard
+\end{frame}
+
+\begin{frame}
+\newchessgame\setchessboard{markstyle=border,color=blue}
+\only<1>{\mainline{1.e4}}
+\only<1>{\setchessboard{markfields=e4}}
+\only<2>{\hidemoves{1.e4}\mainline{1... e5}}
+\only<2>{\setchessboard{markfields=e5}}
+\only<3>{\hidemoves{1.e4 e5}\mainline{2. Nf3}}
+\only<3>{\setchessboard{markfields=f3}}
+\only<4>{\hidemoves{1.e4 e5 2.Nf3}\mainline{2... Nc6}}
+\only<4>{\setchessboard{markfields=c6}}
+
+\chessboard
+\end{frame}
+\end{document}
+\end{lstlisting}
+
+\subsection{animate}
+
+It also possible to use animate to get «moving» boards (you need a
+recent pdf-viewer to see the effect). But it is quite tiresome to
+input all the moves. That's why I wrote the package
+\packagename{xskak}. It offers a possibility to store all positions
+of a game with \skaksty and then to loop through them. For an
+example please read the documentation of \packagename{xskak}. Here an
+example of the more tiresome input:
+
+\begin{LTXexample}
+\newchessgame
+\unitlength1pt
+\newcommand\currentboard{%
+ \begin{picture}(150,150)
+ \put(10,10){\chessboard}
+ \end{picture}}
+\begin{animateinline}[autoplay,loop]{1}%
+\currentboard
+\newframe\hidemoves{1.e4}%
+\currentboard
+\newframe\hidemoves{1... e5}%
+\currentboard
+\newframe\hidemoves{2. Nf3}%
+\currentboard
+\newframe\hidemoves{2... Nc6}%
+\currentboard
+\newframe\hidemoves{3.Bb5}%
+\currentboard
+\newframe\hidemoves{3... a6}%
+\currentboard
+\end{animateinline}
+\end{LTXexample}
+
+
+\phantomsection
+\makeatletter\def\index@prologue{\section*{Index}\addcontentsline{toc}{section}{Index}}\makeatother
+\printindex
+\end{document}
+
+\end{document}
diff --git a/macros/latex/contrib/chessboard/chessboard_and_beamer.pdf b/macros/latex/contrib/chessboard/chessboard_and_beamer.pdf
new file mode 100644
index 0000000000..cde1542c35
--- /dev/null
+++ b/macros/latex/contrib/chessboard/chessboard_and_beamer.pdf
Binary files differ
diff --git a/macros/latex/contrib/chessboard/chessboard_and_beamer.tex b/macros/latex/contrib/chessboard/chessboard_and_beamer.tex
new file mode 100644
index 0000000000..199262fb76
--- /dev/null
+++ b/macros/latex/contrib/chessboard/chessboard_and_beamer.tex
@@ -0,0 +1,31 @@
+\documentclass{beamer}
+\usepackage[T1]{fontenc}
+\usepackage[skaknew]{chessboard, skak}
+\begin{document}
+
+\begin{frame}
+\newgame
+\only<1->{\setchessboard{hideall,showmover=false}}
+\only<2->{\setchessboard{showpieces={p,P}}}
+\only<3->{\setchessboard{showpieces={K,k}}}
+\only<4->{\setchessboard{showpieces={Q,q}}}
+\only<5->{\setchessboard{showpieces={R,r}}}
+\only<6->{\setchessboard{showpieces={B,b}}}
+\only<7->{\setchessboard{showpieces={N,n}}}
+\chessboard
+\end{frame}
+
+\begin{frame}
+\newgame\setchessboard{markstyle=border,color=blue}
+\only<1>{\mainline{1.e4}}
+\only<1>{\setchessboard{markfields=e4}}
+\only<2>{\hidemoves{1.e4}\mainline{1... e5}}
+\only<2>{\setchessboard{markfields=e5}}
+\only<3>{\hidemoves{1.e4 e5}\mainline{2. Nf3}}
+\only<3>{\setchessboard{markfields=f3}}
+\only<4>{\hidemoves{1.e4 e5 2.Nf3}\mainline{2... Nc6}}
+\only<4>{\setchessboard{markfields=c6}}
+
+\chessboard
+\end{frame}
+\end{document}
diff --git a/macros/latex/contrib/chessboard/file.fen b/macros/latex/contrib/chessboard/file.fen
new file mode 100644
index 0000000000..7bd220abff
--- /dev/null
+++ b/macros/latex/contrib/chessboard/file.fen
@@ -0,0 +1 @@
+rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2