texlive[53302] Master/texmf-dist: chess-problem-diagrams (2jan20)

commits+karl at tug.org commits+karl at tug.org
Thu Jan 2 23:10:48 CET 2020


Revision: 53302
          http://tug.org/svn/texlive?view=revision&revision=53302
Author:   karl
Date:     2020-01-02 23:10:48 +0100 (Thu, 02 Jan 2020)
Log Message:
-----------
chess-problem-diagrams (2jan20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/chess-problem-diagrams/README
    trunk/Master/texmf-dist/doc/latex/chess-problem-diagrams/diagram.pdf
    trunk/Master/texmf-dist/source/latex/chess-problem-diagrams/diagram.dtx
    trunk/Master/texmf-dist/tex/latex/chess-problem-diagrams/diagram.sty

Modified: trunk/Master/texmf-dist/doc/latex/chess-problem-diagrams/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/chess-problem-diagrams/README	2020-01-02 22:10:15 UTC (rev 53301)
+++ trunk/Master/texmf-dist/doc/latex/chess-problem-diagrams/README	2020-01-02 22:10:48 UTC (rev 53302)
@@ -1,5 +1,5 @@
 diagram --- A package for typesetting chessproblems
-Version v1.12 / Stefan Hoening 2015
+Version v1.15 / Stefan Hoening 1994-2019
 
 CONTENTS
 

Modified: trunk/Master/texmf-dist/doc/latex/chess-problem-diagrams/diagram.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/chess-problem-diagrams/diagram.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/chess-problem-diagrams/diagram.dtx	2020-01-02 22:10:15 UTC (rev 53301)
+++ trunk/Master/texmf-dist/source/latex/chess-problem-diagrams/diagram.dtx	2020-01-02 22:10:48 UTC (rev 53302)
@@ -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 at left, ds at right, ds at 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 at blackPieces}
 \newcounter{cpd at neutralPieces}
 
+\newcounter{cpd at row}
+\newcounter{cpd at line}
+
 \newcommand{\cpd at stepcounterWhite}{\stepcounter{cpd at whitePieces}}
 \newcommand{\cpd at stepcounterBlack}{\stepcounter{cpd at blackPieces}}
 \newcommand{\cpd at stepcounterNeutral}{\stepcounter{cpd at neutralPieces}}
@@ -1148,6 +1166,7 @@
 \newtoks\fieldframe at tk\fieldframe at tk={\relax}
 \newtoks\gridlines at tk\gridlines at tk={\relax}
 \newtoks\pieces at tk\pieces at tk={\relax}
+\newtoks\fen at tk\fen at tk={\relax}
 \newtoks\fieldtext at tk\fieldtext at tk={\relax}
 \newtoks\text at tk\text at tk={\relax}
 \newtoks\stipulation at tk\stipulation at tk={\relax}
@@ -1184,6 +1203,7 @@
 \newif\if at judgement\@judgementfalse
 \newif\if at comment\@commentfalse
 \newif\if at pieces\@piecesfalse
+\newboolean{@cpd at fen}\setboolean{@cpd at fen}{false}%
 \newif\if at fieldtext\@fieldtextfalse
 \newif\if at nofields\@nofieldsfalse
 \newif\if at gridlines\@gridlinesfalse
@@ -1248,6 +1268,16 @@
 \newif\ifds at label
 %    \end{macrocode}
 %
+% \begin{macro}{\cpd at begindiagram@hook}
+% \begin{macro}{\cpd at enddiagram@hook}
+% We define hooks to be executed in |\begin{diagram}| and |\end{diagram}|.
+%    \begin{macrocode}
+\newcommand{\cpd at begindiagram@hook}{}
+\newcommand{\cpd at 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\@cpd at initsize#1#2{%
+   \setcounter{cpd at linesmax}{#1}%
+   \setcounter{cpd at rowsmax}{#2}%
+   \setcounter{cpd at maxsquare}{\value{cpd at rowsmax}*\value{cpd at linesmax}}%
+}
+
 \def\@diagram[#1x#2]{%
    \lines at max=#1%
    \rows at max=#2%
-   \setcounter{cpd at linesmax}{#1}%
-   \setcounter{cpd at rowsmax}{#2}%
-   \setcounter{cpd at maxsquare}{\value{cpd at rowsmax}*\value{cpd at linesmax}}%
+   \@cpd at initsize{#1}{#2}%
    \pl at ne=\z@%
    \current at plane=\z@%
    \let\put at sqs=\put at sqs@normal%
@@ -1278,7 +1312,9 @@
 %    \begin{macrocode}
 \def\stereodiagram{%
    \begingroup%
+   \inner at frame=0.6pt%
    \@stereotrue%
+   \@cpd at initsize{8}{8}%
    \let\put at sqs=\put at sqs@stereo%
    \let\read at plane=\read at plane@stereo%
    \@start at diagram%
@@ -1285,6 +1321,7 @@
 }
 \def\spacediagram{%
    \begingroup%
+   \inner at frame=0.6pt%
    \@spacetrue%
    \@ifnextchar [{\@spacediagram}{\@spacediagram[5x5x5]}%
 }
@@ -1293,6 +1330,7 @@
    \lines at max=#1%
    \rows at max=#2%
    \planes at max=#3%
+   \@cpd at initsize{#1}{#2}%
    \let\put at sqs=\put at sqs@space%
    \let\read at plane=\read at plane@space%
    \@start at diagram%
@@ -1304,6 +1342,7 @@
    \let\month=\ds at month%
    \let\year=\ds at year%
    \let\label=\ds at label%
+   \cpd at begindiagram@hook%
    \ignorespaces%
 }
 
@@ -1470,6 +1509,7 @@
       }%
    }}% End of \dia at box
    \do at dia@job%
+   \cpd at enddiagram@hook%
    \endgroup%
 }
 
@@ -1856,6 +1896,16 @@
    \pieces at tk={#1}\@piecestrue%
    \ignorespaces%
 }
+\newcommand{\fen}[2][]{%
+   \ifthenelse{\equal{#1}{}}%
+      {}% Do nothing
+      {%
+         \setboolean{cpd at checkPieceCounts}{true}%
+         \@parseWhiteAndBlackCount#1+\e at list
+      }%
+   \fen at tk={#2}\setboolean{@cpd at fen}{true}%
+   \ignorespaces%
+}
 \def\fieldtext#1{%
    \fieldtext at tk={#1}\@fieldtexttrue%
    \ignorespaces%
@@ -2749,6 +2799,18 @@
    \fi%
    \l@@k%
 }
+\def\cpd at fen@setpiece{%
+   \ifnum\pl at ne=\current at plane%
+      \cpd at stepcounterPieces%
+      \set at current@square at index{\value{cpd at line}}{\value{cpd at row}}%
+      \get at current@square at value%
+      \ifthenelse{\value{cpd at current@square at value}=\m at ne}
+        {\set at current@square at value{\the\help at a}}%
+        {\ifthenelse{\value{cpd at current@square at value}=144}%
+          {\set at current@square at value{\the\help at a+18}}%
+          {\errmessage{Trying to set a piece to an occupied square}}}%
+   \fi%
+}
 \def\set at nofield, {%
    \ifnum\pl at ne=\current at plane%
       \set at current@square at index\lin@\r at w%
@@ -2782,6 +2844,95 @@
    \fi%
    \nextpr at c%
 }
+\def\@cpd at handle@fen#1{%
+   \ifx#1/\relax%
+      \ifthenelse{\value{cpd at line}=8}%
+      {%
+         \setcounter{cpd at line}{0}%
+         \addtocounter{cpd at row}{\m at ne}%
+      }%
+      {%
+         \errmessage{FEN: there is now row to end here}%
+      }%
+   \else\ifx#1K\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=5%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1Q\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=4%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1R\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=3%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1B\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=2%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1N\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=1%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1P\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=0%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1k\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=17%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1q\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=16%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1r\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=15%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1b\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=14%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1n\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=13%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1p\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=12%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx1#1\relax%
+      \addtocounter{cpd at line}{1}%
+   \else\ifx2#1\relax%
+      \addtocounter{cpd at line}{2}%
+   \else\ifx3#1\relax%
+      \addtocounter{cpd at line}{3}%
+   \else\ifx4#1\relax%
+      \addtocounter{cpd at line}{4}%
+   \else\ifx5#1\relax%
+      \addtocounter{cpd at line}{5}%
+   \else\ifx6#1\relax%
+      \addtocounter{cpd at line}{6}%
+   \else\ifx7#1\relax%
+      \addtocounter{cpd at line}{7}%
+   \else\ifx8#1\relax%
+      \addtocounter{cpd at 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 at parse@fen#1{\@cpd at handle@fen#1\l@@klist}
 \def\p at rsepieces#1, {\getc at lor#1\e at list\l@@klist}
 \def\p at rsetext#1, {\get at text#1\e at list\l@@klist}
 \def\set at text{%
@@ -3017,6 +3168,14 @@
    % Now we should clear the board
    \clear at board%
    % Let us now parse the list of pieces
+   \ifthenelse{\boolean{@cpd at fen}}{%
+      \ifthenelse{\value{cpd at rowsmax}=8}{}{\errmessage{FEN is only allowed for 8x8 boards.}}
+      \ifthenelse{\value{cpd at linesmax}=8}{}{\errmessage{FEN is only allowed for 8x8 boards.}}
+      \setcounter{cpd at row}{7}%
+      \setcounter{cpd at line}{0}%
+      \let\@action\@cpd at parse@fen%
+      \@parseTokenlist\fen at tk\e at list%
+   }{}%
    \if at pieces%
       \let\@action\p at rsepieces%
       \let\piece at job\l@@k\let\plane at job\set at piece%

Modified: trunk/Master/texmf-dist/tex/latex/chess-problem-diagrams/diagram.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/chess-problem-diagrams/diagram.sty	2020-01-02 22:10:15 UTC (rev 53301)
+++ trunk/Master/texmf-dist/tex/latex/chess-problem-diagrams/diagram.sty	2020-01-02 22:10:48 UTC (rev 53302)
@@ -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 at blackPieces}
 \newcounter{cpd at neutralPieces}
 
+\newcounter{cpd at row}
+\newcounter{cpd at line}
+
 \newcommand{\cpd at stepcounterWhite}{\stepcounter{cpd at whitePieces}}
 \newcommand{\cpd at stepcounterBlack}{\stepcounter{cpd at blackPieces}}
 \newcommand{\cpd at stepcounterNeutral}{\stepcounter{cpd at neutralPieces}}
@@ -183,6 +186,7 @@
 \newtoks\fieldframe at tk\fieldframe at tk={\relax}
 \newtoks\gridlines at tk\gridlines at tk={\relax}
 \newtoks\pieces at tk\pieces at tk={\relax}
+\newtoks\fen at tk\fen at tk={\relax}
 \newtoks\fieldtext at tk\fieldtext at tk={\relax}
 \newtoks\text at tk\text at tk={\relax}
 \newtoks\stipulation at tk\stipulation at tk={\relax}
@@ -214,6 +218,7 @@
 \newif\if at judgement\@judgementfalse
 \newif\if at comment\@commentfalse
 \newif\if at pieces\@piecesfalse
+\newboolean{@cpd at fen}\setboolean{@cpd at fen}{false}%
 \newif\if at fieldtext\@fieldtextfalse
 \newif\if at nofields\@nofieldsfalse
 \newif\if at gridlines\@gridlinesfalse
@@ -257,17 +262,23 @@
 \newif\if at sindex\@sindexfalse
 \newif\if at tindex\@tindexfalse
 \newif\ifds at label
+\newcommand{\cpd at begindiagram@hook}{}
+\newcommand{\cpd at enddiagram@hook}{}
 \def\diagram{%
    \begingroup%
    \@ifnextchar [{\@diagram}{\@diagram[\@ight x\@ight]}%
 }
 
+\def\@cpd at initsize#1#2{%
+   \setcounter{cpd at linesmax}{#1}%
+   \setcounter{cpd at rowsmax}{#2}%
+   \setcounter{cpd at maxsquare}{\value{cpd at rowsmax}*\value{cpd at linesmax}}%
+}
+
 \def\@diagram[#1x#2]{%
    \lines at max=#1%
    \rows at max=#2%
-   \setcounter{cpd at linesmax}{#1}%
-   \setcounter{cpd at rowsmax}{#2}%
-   \setcounter{cpd at maxsquare}{\value{cpd at rowsmax}*\value{cpd at linesmax}}%
+   \@cpd at initsize{#1}{#2}%
    \pl at ne=\z@%
    \current at plane=\z@%
    \let\put at sqs=\put at sqs@normal%
@@ -276,7 +287,9 @@
 }
 \def\stereodiagram{%
    \begingroup%
+   \inner at frame=0.6pt%
    \@stereotrue%
+   \@cpd at initsize{8}{8}%
    \let\put at sqs=\put at sqs@stereo%
    \let\read at plane=\read at plane@stereo%
    \@start at diagram%
@@ -283,6 +296,7 @@
 }
 \def\spacediagram{%
    \begingroup%
+   \inner at frame=0.6pt%
    \@spacetrue%
    \@ifnextchar [{\@spacediagram}{\@spacediagram[5x5x5]}%
 }
@@ -291,6 +305,7 @@
    \lines at max=#1%
    \rows at max=#2%
    \planes at max=#3%
+   \@cpd at initsize{#1}{#2}%
    \let\put at sqs=\put at sqs@space%
    \let\read at plane=\read at plane@space%
    \@start at diagram%
@@ -302,6 +317,7 @@
    \let\month=\ds at month%
    \let\year=\ds at year%
    \let\label=\ds at label%
+   \cpd at begindiagram@hook%
    \ignorespaces%
 }
 
@@ -468,6 +484,7 @@
       }%
    }}% End of \dia at box
    \do at dia@job%
+   \cpd at enddiagram@hook%
    \endgroup%
 }
 
@@ -732,6 +749,16 @@
    \pieces at tk={#1}\@piecestrue%
    \ignorespaces%
 }
+\newcommand{\fen}[2][]{%
+   \ifthenelse{\equal{#1}{}}%
+      {}% Do nothing
+      {%
+         \setboolean{cpd at checkPieceCounts}{true}%
+         \@parseWhiteAndBlackCount#1+\e at list
+      }%
+   \fen at tk={#2}\setboolean{@cpd at fen}{true}%
+   \ignorespaces%
+}
 \def\fieldtext#1{%
    \fieldtext at tk={#1}\@fieldtexttrue%
    \ignorespaces%
@@ -1557,6 +1584,18 @@
    \fi%
    \l@@k%
 }
+\def\cpd at fen@setpiece{%
+   \ifnum\pl at ne=\current at plane%
+      \cpd at stepcounterPieces%
+      \set at current@square at index{\value{cpd at line}}{\value{cpd at row}}%
+      \get at current@square at value%
+      \ifthenelse{\value{cpd at current@square at value}=\m at ne}
+        {\set at current@square at value{\the\help at a}}%
+        {\ifthenelse{\value{cpd at current@square at value}=144}%
+          {\set at current@square at value{\the\help at a+18}}%
+          {\errmessage{Trying to set a piece to an occupied square}}}%
+   \fi%
+}
 \def\set at nofield, {%
    \ifnum\pl at ne=\current at plane%
       \set at current@square at index\lin@\r at w%
@@ -1590,6 +1629,95 @@
    \fi%
    \nextpr at c%
 }
+\def\@cpd at handle@fen#1{%
+   \ifx#1/\relax%
+      \ifthenelse{\value{cpd at line}=8}%
+      {%
+         \setcounter{cpd at line}{0}%
+         \addtocounter{cpd at row}{\m at ne}%
+      }%
+      {%
+         \errmessage{FEN: there is now row to end here}%
+      }%
+   \else\ifx#1K\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=5%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1Q\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=4%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1R\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=3%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1B\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=2%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1N\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=1%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1P\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterWhite%
+      \help at a=0%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1k\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=17%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1q\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=16%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1r\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=15%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1b\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=14%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1n\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=13%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx#1p\relax%
+      \let\cpd at stepcounterPieces\cpd at stepcounterBlack%
+      \help at a=12%
+      \cpd at fen@setpiece%
+      \addtocounter{cpd at line}{\@ne}%
+   \else\ifx1#1\relax%
+      \addtocounter{cpd at line}{1}%
+   \else\ifx2#1\relax%
+      \addtocounter{cpd at line}{2}%
+   \else\ifx3#1\relax%
+      \addtocounter{cpd at line}{3}%
+   \else\ifx4#1\relax%
+      \addtocounter{cpd at line}{4}%
+   \else\ifx5#1\relax%
+      \addtocounter{cpd at line}{5}%
+   \else\ifx6#1\relax%
+      \addtocounter{cpd at line}{6}%
+   \else\ifx7#1\relax%
+      \addtocounter{cpd at line}{7}%
+   \else\ifx8#1\relax%
+      \addtocounter{cpd at 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 at parse@fen#1{\@cpd at handle@fen#1\l@@klist}
 \def\p at rsepieces#1, {\getc at lor#1\e at list\l@@klist}
 \def\p at rsetext#1, {\get at text#1\e at list\l@@klist}
 \def\set at text{%
@@ -1805,6 +1933,14 @@
    % Now we should clear the board
    \clear at board%
    % Let us now parse the list of pieces
+   \ifthenelse{\boolean{@cpd at fen}}{%
+      \ifthenelse{\value{cpd at rowsmax}=8}{}{\errmessage{FEN is only allowed for 8x8 boards.}}
+      \ifthenelse{\value{cpd at linesmax}=8}{}{\errmessage{FEN is only allowed for 8x8 boards.}}
+      \setcounter{cpd at row}{7}%
+      \setcounter{cpd at line}{0}%
+      \let\@action\@cpd at parse@fen%
+      \@parseTokenlist\fen at tk\e at list%
+   }{}%
    \if at pieces%
       \let\@action\p at rsepieces%
       \let\piece at job\l@@k\let\plane at job\set at piece%



More information about the tex-live-commits mailing list