summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/chess-problem-diagrams/README2
-rw-r--r--Master/texmf-dist/doc/latex/chess-problem-diagrams/diagram.pdfbin350236 -> 357255 bytes
-rw-r--r--Master/texmf-dist/source/latex/chess-problem-diagrams/diagram.dtx177
-rw-r--r--Master/texmf-dist/tex/latex/chess-problem-diagrams/diagram.sty144
4 files changed, 309 insertions, 14 deletions
diff --git a/Master/texmf-dist/doc/latex/chess-problem-diagrams/README b/Master/texmf-dist/doc/latex/chess-problem-diagrams/README
index a9573ef1dcb..6e9503a16e0 100644
--- a/Master/texmf-dist/doc/latex/chess-problem-diagrams/README
+++ b/Master/texmf-dist/doc/latex/chess-problem-diagrams/README
@@ -1,5 +1,5 @@
diagram --- A package for typesetting chessproblems
-Version v1.12 / Stefan Hoening 2015
+Version v1.15 / Stefan Hoening 1994-2019
CONTENTS
diff --git a/Master/texmf-dist/doc/latex/chess-problem-diagrams/diagram.pdf b/Master/texmf-dist/doc/latex/chess-problem-diagrams/diagram.pdf
index 18407045fdd..0fe72da32df 100644
--- a/Master/texmf-dist/doc/latex/chess-problem-diagrams/diagram.pdf
+++ b/Master/texmf-dist/doc/latex/chess-problem-diagrams/diagram.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/chess-problem-diagrams/diagram.dtx b/Master/texmf-dist/source/latex/chess-problem-diagrams/diagram.dtx
index 8213e7b4532..249d14058b5 100644
--- a/Master/texmf-dist/source/latex/chess-problem-diagrams/diagram.dtx
+++ b/Master/texmf-dist/source/latex/chess-problem-diagrams/diagram.dtx
@@ -13,9 +13,9 @@
%%
%%
% \fi
-% \def\fileversion{v1.12}
-% \def\docdate{2016/01/06}
-% \CheckSum{4288}
+% \def\fileversion{v1.15}
+% \def\docdate{2019/12/28}
+% \CheckSum{4545}
% \changes{v0.1}{15 Februar 2004}{First Version}
% \changes{v0.2}{23 Februar 2004}{Added the documentation for the
% {\itshape information collecting} macros which may be used
@@ -72,6 +72,10 @@
% \changes{v1.11.1}{16 March 2015}{Fixed issue 03f/b31:om: diagram.sty: label and ref don't respect diagnum prefix or diagnumbering setting.}
% \changes{v1.12}{06 January 2016}{Implemented issue: 03f/fc0:om: diagram.dtx: change def x to newcommand.\\
% Changed name of internal commands ds@left, ds@right, ds@upsidedown due to a naming collising with options from eurosym.sty.}
+% \changes{v1.13}{04 April 2019}{Implemented issue: 03f/99b:om: diagram.dtx: added new command fen to allow entering forsyth-edwards-notation}
+% \changes{v1.14}{02 September 2019}{Fixed issue with stereo- and space-diagrams.}
+% \changes{v1.15}{28 December 2019}{Fixed frame issue with stereo- and space-diagrams.\\
+% Added hook commands for begin/end diagram.}
%
% \DoNotIndex{\@arabic,\def,\@idxitem,\@ifnextchar,\@ifstar,
% \@ne,\@ptsize,\ ,\advance,\AtEndOfPackage,\begin,\begingroup,
@@ -100,7 +104,7 @@
% \begin{abstract}
% It have been more than ten years now, since we last published a documented
% version of the {\ttfamily diagram.sty}, which is mainly intended to
-% be used for typesetting chess problems. Since 1994 I (Stefan H"oning) made a
+% be used for typesetting chess problems. Since 1994 I (Stefan H\"oning) made a
% couple of enhancements to the sourcecode of the style, without publishing and
% putting this into the documentation. We also needed to upgrade to \LaTeXe.
% The major change is the documentation language, which is english now.
@@ -147,7 +151,7 @@
% \setboolean{legend}{true}
% \author{Brand, Thomas}
% \source{Problemkiste} \year{1992}
-% \pieces[3+2]{wKa4, wLb5, wSh3, sKb7, sBh4}
+% \fen{8/1k6/8/1B6/K6p/7N/8/8}
% \stip{h\#5}
% \sol{1.Ka8 Sg1, 2.h3 Ka5, 3.h2 Kb6, 4.h\x g1L+ Kc7, 5.La7 Lc6\#}
% \end{diagram}
@@ -256,6 +260,17 @@
% displayed as a black filled circle. So {\ttfamily sCf4} will
% produce the symbol of an imitator. This is shown in
% diagram~\ref{bigdia}.
+% \item \DescribeMacro{\fen}
+% As an alternative notation it is possible to enter the position in
+% \textit{Forsyth-Edwards-Notation}. This is possible for 8\,$\times$\,8 boards
+% only.
+%
+% As an example: The position in diagram~\ref{BSP2} was created via\newline
+% |\fen{8/1k6/8/1B6/K6p/7N/8/8}|.
+%
+%
+% As with the |\pieces| command, you may provide the number of white and
+% black pieces as an optional parameter.
% \item \DescribeMacro{\stipulation} \DescribeMacro{\stip}
% is used to specify the stipulation of the problem, e.\,g.\
% |\stipulation{\#2}| may be used to specify a \explained{mate in
@@ -970,7 +985,7 @@
% Specifies the preamble of our style file.
% \begin{macrocode}
%<*style>
-\ProvidesPackage{diagram}[2016/01/06]
+\ProvidesPackage{diagram}[2019/12/28]
% \end{macrocode}
%
% \begin{macro}{\DefaultDiagramSize}
@@ -1071,6 +1086,9 @@
\newcounter{cpd@blackPieces}
\newcounter{cpd@neutralPieces}
+\newcounter{cpd@row}
+\newcounter{cpd@line}
+
\newcommand{\cpd@stepcounterWhite}{\stepcounter{cpd@whitePieces}}
\newcommand{\cpd@stepcounterBlack}{\stepcounter{cpd@blackPieces}}
\newcommand{\cpd@stepcounterNeutral}{\stepcounter{cpd@neutralPieces}}
@@ -1148,6 +1166,7 @@
\newtoks\fieldframe@tk\fieldframe@tk={\relax}
\newtoks\gridlines@tk\gridlines@tk={\relax}
\newtoks\pieces@tk\pieces@tk={\relax}
+\newtoks\fen@tk\fen@tk={\relax}
\newtoks\fieldtext@tk\fieldtext@tk={\relax}
\newtoks\text@tk\text@tk={\relax}
\newtoks\stipulation@tk\stipulation@tk={\relax}
@@ -1184,6 +1203,7 @@
\newif\if@judgement\@judgementfalse
\newif\if@comment\@commentfalse
\newif\if@pieces\@piecesfalse
+\newboolean{@cpd@fen}\setboolean{@cpd@fen}{false}%
\newif\if@fieldtext\@fieldtextfalse
\newif\if@nofields\@nofieldsfalse
\newif\if@gridlines\@gridlinesfalse
@@ -1248,6 +1268,16 @@
\newif\ifds@label
% \end{macrocode}
%
+% \begin{macro}{\cpd@begindiagram@hook}
+% \begin{macro}{\cpd@enddiagram@hook}
+% We define hooks to be executed in |\begin{diagram}| and |\end{diagram}|.
+% \begin{macrocode}
+\newcommand{\cpd@begindiagram@hook}{}
+\newcommand{\cpd@enddiagram@hook}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{\diagram}
% \begin{macro}{\@diagram}
% Defines the code executed in |\begin{diagram}|. In case no
@@ -1258,12 +1288,16 @@
\@ifnextchar [{\@diagram}{\@diagram[\@ight x\@ight]}%
}
-\def\@diagram[#1x#2]{%
- \lines@max=#1%
- \rows@max=#2%
+\def\@cpd@initsize#1#2{%
\setcounter{cpd@linesmax}{#1}%
\setcounter{cpd@rowsmax}{#2}%
\setcounter{cpd@maxsquare}{\value{cpd@rowsmax}*\value{cpd@linesmax}}%
+}
+
+\def\@diagram[#1x#2]{%
+ \lines@max=#1%
+ \rows@max=#2%
+ \@cpd@initsize{#1}{#2}%
\pl@ne=\z@%
\current@plane=\z@%
\let\put@sqs=\put@sqs@normal%
@@ -1278,13 +1312,16 @@
% \begin{macrocode}
\def\stereodiagram{%
\begingroup%
+ \inner@frame=0.6pt%
\@stereotrue%
+ \@cpd@initsize{8}{8}%
\let\put@sqs=\put@sqs@stereo%
\let\read@plane=\read@plane@stereo%
\@start@diagram%
}
\def\spacediagram{%
\begingroup%
+ \inner@frame=0.6pt%
\@spacetrue%
\@ifnextchar [{\@spacediagram}{\@spacediagram[5x5x5]}%
}
@@ -1293,6 +1330,7 @@
\lines@max=#1%
\rows@max=#2%
\planes@max=#3%
+ \@cpd@initsize{#1}{#2}%
\let\put@sqs=\put@sqs@space%
\let\read@plane=\read@plane@space%
\@start@diagram%
@@ -1304,6 +1342,7 @@
\let\month=\ds@month%
\let\year=\ds@year%
\let\label=\ds@label%
+ \cpd@begindiagram@hook%
\ignorespaces%
}
@@ -1470,6 +1509,7 @@
}%
}}% End of \dia@box
\do@dia@job%
+ \cpd@enddiagram@hook%
\endgroup%
}
@@ -1856,6 +1896,16 @@
\pieces@tk={#1}\@piecestrue%
\ignorespaces%
}
+\newcommand{\fen}[2][]{%
+ \ifthenelse{\equal{#1}{}}%
+ {}% Do nothing
+ {%
+ \setboolean{cpd@checkPieceCounts}{true}%
+ \@parseWhiteAndBlackCount#1+\e@list
+ }%
+ \fen@tk={#2}\setboolean{@cpd@fen}{true}%
+ \ignorespaces%
+}
\def\fieldtext#1{%
\fieldtext@tk={#1}\@fieldtexttrue%
\ignorespaces%
@@ -2749,6 +2799,18 @@
\fi%
\l@@k%
}
+\def\cpd@fen@setpiece{%
+ \ifnum\pl@ne=\current@plane%
+ \cpd@stepcounterPieces%
+ \set@current@square@index{\value{cpd@line}}{\value{cpd@row}}%
+ \get@current@square@value%
+ \ifthenelse{\value{cpd@current@square@value}=\m@ne}
+ {\set@current@square@value{\the\help@a}}%
+ {\ifthenelse{\value{cpd@current@square@value}=144}%
+ {\set@current@square@value{\the\help@a+18}}%
+ {\errmessage{Trying to set a piece to an occupied square}}}%
+ \fi%
+}
\def\set@nofield, {%
\ifnum\pl@ne=\current@plane%
\set@current@square@index\lin@\r@w%
@@ -2782,6 +2844,95 @@
\fi%
\nextpr@c%
}
+\def\@cpd@handle@fen#1{%
+ \ifx#1/\relax%
+ \ifthenelse{\value{cpd@line}=8}%
+ {%
+ \setcounter{cpd@line}{0}%
+ \addtocounter{cpd@row}{\m@ne}%
+ }%
+ {%
+ \errmessage{FEN: there is now row to end here}%
+ }%
+ \else\ifx#1K\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=5%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1Q\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=4%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1R\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=3%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1B\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=2%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1N\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=1%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1P\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=0%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1k\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=17%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1q\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=16%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1r\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=15%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1b\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=14%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1n\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=13%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1p\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=12%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx1#1\relax%
+ \addtocounter{cpd@line}{1}%
+ \else\ifx2#1\relax%
+ \addtocounter{cpd@line}{2}%
+ \else\ifx3#1\relax%
+ \addtocounter{cpd@line}{3}%
+ \else\ifx4#1\relax%
+ \addtocounter{cpd@line}{4}%
+ \else\ifx5#1\relax%
+ \addtocounter{cpd@line}{5}%
+ \else\ifx6#1\relax%
+ \addtocounter{cpd@line}{6}%
+ \else\ifx7#1\relax%
+ \addtocounter{cpd@line}{7}%
+ \else\ifx8#1\relax%
+ \addtocounter{cpd@line}{8}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+}
+\def\@cpd@parse@fen#1{\@cpd@handle@fen#1\l@@klist}
\def\p@rsepieces#1, {\getc@lor#1\e@list\l@@klist}
\def\p@rsetext#1, {\get@text#1\e@list\l@@klist}
\def\set@text{%
@@ -3017,6 +3168,14 @@
% Now we should clear the board
\clear@board%
% Let us now parse the list of pieces
+ \ifthenelse{\boolean{@cpd@fen}}{%
+ \ifthenelse{\value{cpd@rowsmax}=8}{}{\errmessage{FEN is only allowed for 8x8 boards.}}
+ \ifthenelse{\value{cpd@linesmax}=8}{}{\errmessage{FEN is only allowed for 8x8 boards.}}
+ \setcounter{cpd@row}{7}%
+ \setcounter{cpd@line}{0}%
+ \let\@action\@cpd@parse@fen%
+ \@parseTokenlist\fen@tk\e@list%
+ }{}%
\if@pieces%
\let\@action\p@rsepieces%
\let\piece@job\l@@k\let\plane@job\set@piece%
diff --git a/Master/texmf-dist/tex/latex/chess-problem-diagrams/diagram.sty b/Master/texmf-dist/tex/latex/chess-problem-diagrams/diagram.sty
index 4093ffae6d3..5379687f697 100644
--- a/Master/texmf-dist/tex/latex/chess-problem-diagrams/diagram.sty
+++ b/Master/texmf-dist/tex/latex/chess-problem-diagrams/diagram.sty
@@ -36,7 +36,7 @@
%%
%%
-\ProvidesPackage{diagram}[2016/01/06]
+\ProvidesPackage{diagram}[2019/12/28]
\newcommand*{\DefaultDiagramSize}{}
\DeclareOption{10pt}{\renewcommand*{\DefaultDiagramSize}{\diagramx}}
\DeclareOption{11pt}{\renewcommand*{\DefaultDiagramSize}{\diagramxi}}
@@ -114,6 +114,9 @@
\newcounter{cpd@blackPieces}
\newcounter{cpd@neutralPieces}
+\newcounter{cpd@row}
+\newcounter{cpd@line}
+
\newcommand{\cpd@stepcounterWhite}{\stepcounter{cpd@whitePieces}}
\newcommand{\cpd@stepcounterBlack}{\stepcounter{cpd@blackPieces}}
\newcommand{\cpd@stepcounterNeutral}{\stepcounter{cpd@neutralPieces}}
@@ -183,6 +186,7 @@
\newtoks\fieldframe@tk\fieldframe@tk={\relax}
\newtoks\gridlines@tk\gridlines@tk={\relax}
\newtoks\pieces@tk\pieces@tk={\relax}
+\newtoks\fen@tk\fen@tk={\relax}
\newtoks\fieldtext@tk\fieldtext@tk={\relax}
\newtoks\text@tk\text@tk={\relax}
\newtoks\stipulation@tk\stipulation@tk={\relax}
@@ -214,6 +218,7 @@
\newif\if@judgement\@judgementfalse
\newif\if@comment\@commentfalse
\newif\if@pieces\@piecesfalse
+\newboolean{@cpd@fen}\setboolean{@cpd@fen}{false}%
\newif\if@fieldtext\@fieldtextfalse
\newif\if@nofields\@nofieldsfalse
\newif\if@gridlines\@gridlinesfalse
@@ -257,17 +262,23 @@
\newif\if@sindex\@sindexfalse
\newif\if@tindex\@tindexfalse
\newif\ifds@label
+\newcommand{\cpd@begindiagram@hook}{}
+\newcommand{\cpd@enddiagram@hook}{}
\def\diagram{%
\begingroup%
\@ifnextchar [{\@diagram}{\@diagram[\@ight x\@ight]}%
}
-\def\@diagram[#1x#2]{%
- \lines@max=#1%
- \rows@max=#2%
+\def\@cpd@initsize#1#2{%
\setcounter{cpd@linesmax}{#1}%
\setcounter{cpd@rowsmax}{#2}%
\setcounter{cpd@maxsquare}{\value{cpd@rowsmax}*\value{cpd@linesmax}}%
+}
+
+\def\@diagram[#1x#2]{%
+ \lines@max=#1%
+ \rows@max=#2%
+ \@cpd@initsize{#1}{#2}%
\pl@ne=\z@%
\current@plane=\z@%
\let\put@sqs=\put@sqs@normal%
@@ -276,13 +287,16 @@
}
\def\stereodiagram{%
\begingroup%
+ \inner@frame=0.6pt%
\@stereotrue%
+ \@cpd@initsize{8}{8}%
\let\put@sqs=\put@sqs@stereo%
\let\read@plane=\read@plane@stereo%
\@start@diagram%
}
\def\spacediagram{%
\begingroup%
+ \inner@frame=0.6pt%
\@spacetrue%
\@ifnextchar [{\@spacediagram}{\@spacediagram[5x5x5]}%
}
@@ -291,6 +305,7 @@
\lines@max=#1%
\rows@max=#2%
\planes@max=#3%
+ \@cpd@initsize{#1}{#2}%
\let\put@sqs=\put@sqs@space%
\let\read@plane=\read@plane@space%
\@start@diagram%
@@ -302,6 +317,7 @@
\let\month=\ds@month%
\let\year=\ds@year%
\let\label=\ds@label%
+ \cpd@begindiagram@hook%
\ignorespaces%
}
@@ -468,6 +484,7 @@
}%
}}% End of \dia@box
\do@dia@job%
+ \cpd@enddiagram@hook%
\endgroup%
}
@@ -732,6 +749,16 @@
\pieces@tk={#1}\@piecestrue%
\ignorespaces%
}
+\newcommand{\fen}[2][]{%
+ \ifthenelse{\equal{#1}{}}%
+ {}% Do nothing
+ {%
+ \setboolean{cpd@checkPieceCounts}{true}%
+ \@parseWhiteAndBlackCount#1+\e@list
+ }%
+ \fen@tk={#2}\setboolean{@cpd@fen}{true}%
+ \ignorespaces%
+}
\def\fieldtext#1{%
\fieldtext@tk={#1}\@fieldtexttrue%
\ignorespaces%
@@ -1557,6 +1584,18 @@
\fi%
\l@@k%
}
+\def\cpd@fen@setpiece{%
+ \ifnum\pl@ne=\current@plane%
+ \cpd@stepcounterPieces%
+ \set@current@square@index{\value{cpd@line}}{\value{cpd@row}}%
+ \get@current@square@value%
+ \ifthenelse{\value{cpd@current@square@value}=\m@ne}
+ {\set@current@square@value{\the\help@a}}%
+ {\ifthenelse{\value{cpd@current@square@value}=144}%
+ {\set@current@square@value{\the\help@a+18}}%
+ {\errmessage{Trying to set a piece to an occupied square}}}%
+ \fi%
+}
\def\set@nofield, {%
\ifnum\pl@ne=\current@plane%
\set@current@square@index\lin@\r@w%
@@ -1590,6 +1629,95 @@
\fi%
\nextpr@c%
}
+\def\@cpd@handle@fen#1{%
+ \ifx#1/\relax%
+ \ifthenelse{\value{cpd@line}=8}%
+ {%
+ \setcounter{cpd@line}{0}%
+ \addtocounter{cpd@row}{\m@ne}%
+ }%
+ {%
+ \errmessage{FEN: there is now row to end here}%
+ }%
+ \else\ifx#1K\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=5%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1Q\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=4%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1R\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=3%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1B\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=2%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1N\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=1%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1P\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterWhite%
+ \help@a=0%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1k\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=17%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1q\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=16%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1r\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=15%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1b\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=14%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1n\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=13%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx#1p\relax%
+ \let\cpd@stepcounterPieces\cpd@stepcounterBlack%
+ \help@a=12%
+ \cpd@fen@setpiece%
+ \addtocounter{cpd@line}{\@ne}%
+ \else\ifx1#1\relax%
+ \addtocounter{cpd@line}{1}%
+ \else\ifx2#1\relax%
+ \addtocounter{cpd@line}{2}%
+ \else\ifx3#1\relax%
+ \addtocounter{cpd@line}{3}%
+ \else\ifx4#1\relax%
+ \addtocounter{cpd@line}{4}%
+ \else\ifx5#1\relax%
+ \addtocounter{cpd@line}{5}%
+ \else\ifx6#1\relax%
+ \addtocounter{cpd@line}{6}%
+ \else\ifx7#1\relax%
+ \addtocounter{cpd@line}{7}%
+ \else\ifx8#1\relax%
+ \addtocounter{cpd@line}{8}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+}
+\def\@cpd@parse@fen#1{\@cpd@handle@fen#1\l@@klist}
\def\p@rsepieces#1, {\getc@lor#1\e@list\l@@klist}
\def\p@rsetext#1, {\get@text#1\e@list\l@@klist}
\def\set@text{%
@@ -1805,6 +1933,14 @@
% Now we should clear the board
\clear@board%
% Let us now parse the list of pieces
+ \ifthenelse{\boolean{@cpd@fen}}{%
+ \ifthenelse{\value{cpd@rowsmax}=8}{}{\errmessage{FEN is only allowed for 8x8 boards.}}
+ \ifthenelse{\value{cpd@linesmax}=8}{}{\errmessage{FEN is only allowed for 8x8 boards.}}
+ \setcounter{cpd@row}{7}%
+ \setcounter{cpd@line}{0}%
+ \let\@action\@cpd@parse@fen%
+ \@parseTokenlist\fen@tk\e@list%
+ }{}%
\if@pieces%
\let\@action\p@rsepieces%
\let\piece@job\l@@k\let\plane@job\set@piece%