From ce2a28ecb931f66bcba16f921343e5dc0a10388b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 13 Nov 2012 00:22:52 +0000 Subject: chess-problem-diagrams (12nov12) git-svn-id: svn://tug.org/texlive/trunk@28243 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/chess-problem-diagrams/README | 2 +- .../doc/latex/chess-problem-diagrams/diagram.pdf | Bin 318364 -> 330313 bytes .../latex/chess-problem-diagrams/diagram.dtx | 138 +++++++++++++++++++-- .../tex/latex/chess-problem-diagrams/diagram.sty | 77 +++++++++++- 4 files changed, 203 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 73020382014..17234263c4c 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 1.6 / Stefan Hoening 2012 +Version 1.6.3 / Stefan Hoening 2012 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 3c8df75dfc6..7769b550deb 100644 Binary files a/Master/texmf-dist/doc/latex/chess-problem-diagrams/diagram.pdf and b/Master/texmf-dist/doc/latex/chess-problem-diagrams/diagram.pdf 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 2dad0f501bc..666071336ff 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{1.6} -% \def\docdate{2012/04/30} -% \CheckSum{4046} +% \def\fileversion{1.6.3} +% \def\docdate{2012/11/12} +% \CheckSum{4186} % \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 @@ -53,6 +53,10 @@ % to suppress display of city, when showcity is false. Added % commands for academic titles, which allow to suppress their % display.} +% \changes{v1.6.1}{24 September 2012}{Added new command piecedefs specify names +% of fairy pieces for rotated pieces.} +% \changes{v1.6.2}{11 November 2012}{Added boolean for allwhite problems.} +% \changes{v1.6.3}{12 November 2012}{Added boolean for board with switched field colors.} % % \DoNotIndex{\@arabic,\def,\@idxitem,\@ifnextchar,\@ifstar, % \@ne,\@ptsize,\ ,\advance,\AtEndOfPackage,\begin,\begingroup, @@ -204,7 +208,7 @@ % \DescribeMacro{\ProfDr} % Within the Authors command you should use the commands |\Dr|, % |\Prof| and |\ProfDr| to specify these academic titles. So one -% may switch of the display of these titles --- like it is +% may switch off the display of these titles --- like it is % generally done inside \Schwalbe. % \item \DescribeMacro{\pieces} % With |\pieces| you specify the position to be displayed on the @@ -283,6 +287,13 @@ % May be used to specify remarks to the problem. I typically use % this to explain fairy pieces on the board. You may also use the % abbreviation |\rem|. +% \item \DescribeMacro{\piecedefs} +% May be used to explain rotated pieces. An example:\newline +% \verb+\piecedefs{{ws}{TL}{Turm-L\"aufer-J\"ager}; {wn}{SU}{Nachtreiter}}+ +% will create\newline +% \hbox{\wTL\sTL = Turm-L\"aufer-J\"ager}\newline +% \hbox{\wSU\nSU = Nachtreiter}\newline +% under the diagram. % \item \DescribeMacro{\solution}\DescribeMacro{\sol} % |\solution| may be used to specify the solution of the problem. % Normally this information is not used while displaying the @@ -573,7 +584,7 @@ % \spacelayout{horizontal} % \end{spacediagram} % \hfill% -% \hbox{\vtop{% +% \hbox{\vbox{% % \hsize6cm % Is produced by % @@ -600,6 +611,39 @@ % |\horizontalcylinder| and |\noframe| suppresses the inner % frame. % +% \subsection{Change the coloring of the fields} +% \DescribeMacro{allwhite} +% The \verb+allwhite+ boolean can be used to have all white squares. +% Therefore dotted lines are produced to separate the squares. +% +% \bigskip +% \begin{diagram} +% \setboolean{allwhite}{true} +% \pieces{wKe1, wDd1, wTa1h1, wLf1c1, wSb1g1, sKe8, sDd8, sTa8h8, sLf8c8, sSb8g8} +% \end{diagram} +% \hfill +% \begin{minipage}[b]{7cm} +% \vspace*{-3cm} +% This was produced by: +% +% \begin{verbatim} +% \begin{diagram} +% \setboolean{allwhite}{true} +% \pieces{wKe1, wDd1, wTa1h1, wLf1c1, wSb1g1, % +% sKe8, sDd8, sTa8h8, sLf8c8, sSb8g8} +% \end{diagram} +% \end{verbatim} +% \end{minipage} +% +% \DescribeMacro{switchcolors} +% The boolean \verb+switchcolors+ may be used to switch the coloring of white and black fields. +% +% \bigskip +% \begin{diagram} +% \setboolean{switchcolors}{true} +% \end{diagram} +% +% % \subsubsection{figurine Notation} % \DescribeEnv{figurine} % Instead of using the |diagram|, |stereodiagram| or @@ -876,7 +920,7 @@ % Specifies the preamble of our style file. % \begin{macrocode} %<*style> -\ProvidesPackage{diagram}[2011/06/04] +\ProvidesPackage{diagram}[2012/11/12] \DeclareOption{10pt}{\AtBeginDocument{\diagramx}} \DeclareOption{11pt}{\AtBeginDocument{\diagramxi}} \DeclareOption{12pt}{\AtBeginDocument{\diagramxii}} @@ -884,6 +928,7 @@ \ProcessOptions \RequirePackage{ifthen} \RequirePackage{calc} +\RequirePackage{pstricks} % \end{macrocode} %% %% @@ -931,6 +976,14 @@ \setboolean{showcity}{false} \newboolean{showacademictitle} \setboolean{showacademictitle}{true} + +\newcount\@blackfield +\newboolean{allwhite} +\setboolean{allwhite}{false} +\newcounter{field@border} +\newcount\@whitefield +\newboolean{switchcolors} +\setboolean{switchcolors}{false} % \end{macrocode} % % We have counters for each color to count the pieces on the @@ -1027,6 +1080,7 @@ \newtoks\stipulation@tk\stipulation@tk={\relax} \newtoks\condition@tk\condition@tk={\relax} \newtoks\remark@tk\remark@tk={\relax} +\newtoks\piecedefs@tk\piecedefs@tk={\relax} % \end{macrocode} % % To remember, which information has been specified, we define @@ -1069,6 +1123,7 @@ \newif\if@stipulation\@stipulationfalse \newif\if@condition\@conditionfalse \newif\if@remark\@remarkfalse +\newif\if@piecedefs\@piecedefsfalse \newif\if@typis\@typisfalse \newif\if@widedias\@widediasfalse \newif\ifx@twins\x@twinsfalse @@ -1755,6 +1810,17 @@ \remark@tk={#1}\@remarktrue% \ignorespaces% } +\def\piecedefs#1{% + \piecedefs@tk={#1}\@piecedefstrue% + \ignorespaces% +} +% \def\@piecedef#1{\csname#1\x@piecedef\endcsname\l@@klist} +% \newcommand{\piecedef}[3][ws]{% +% \def\x@piecedef{#2}% +% \let\@action=\@piecedef% +% \hbox{\l@@klist#1\e@list% +% \ = #3}% +% } \def\Co#1{% \ifx#1+\@computertrue\computer@tk={+}\fi% \ignorespaces% @@ -2191,6 +2257,31 @@ \fi% } +\def\check@piecedef{% + \ifx\next@piecedef\relax% + \let\col@action=\relax% + \else% + \let\col@action=\@@piecedef% + \fi% + \col@action% +} +\def\@@piecedef#1{\csname#1\x@piecedef\endcsname\parse@piecedef} + +\def\parse@piecedef{\futurelet\next@piecedef\check@piecedef} + +\def\@piecedef#1#2#3{% + \def\x@piecedef{#2}% + \below@newline% + \hbox{% + \parse@piecedef#1\relax% + \ = #3}% +} + +\def\write@piecedefs#1; {% + \@piecedef#1% + \l@@klist% +} + \def\@dia@remark{% \if@remark% \bgroup% @@ -2200,6 +2291,14 @@ \egroup% \let\below@newline\newline% \fi% + \if@piecedefs% + \bgroup% + \@lefttrue% + \let\below@newline\newline% + \remfont\let\@action=\write@piecedefs% + \@parseTokenlist\piecedefs@tk;% + \egroup% + \fi% } \def\parse@params#1{% @@ -2692,7 +2791,11 @@ } \def\clear@board{% - % Now the new style + \ifthenelse{\boolean{allwhite}\and\boolean{switchcolors}}% + {\errmessage{'allwhite' and 'switchcolors' do not make sense used together.}}% + {\@whitefield=\m@ne\@blackfield=144}% + \ifthenelse{\boolean{allwhite}}{\@blackfield=\m@ne}{}% + \ifthenelse{\boolean{switchcolors}}{\@whitefield=144\@blackfield=\m@ne}{}% \setcounter{cpd@current@row}{0}% \whiledo{\value{cpd@current@row}<\value{cpd@rowsmax}}{% \setcounter{cpd@current@line}{0}% @@ -2700,8 +2803,8 @@ \set@current@square@index{\value{cpd@current@line}}{\value{cpd@current@row}}% \setcounter{cpd@helper}{\the\current@plane+\value{cpd@current@line}+\value{cpd@current@row}}% \ifthenelse{\isodd{\value{cpd@helper}}}% - {\set@current@square@value{-1}}% - {\set@current@square@value{144}}% + {\set@current@square@value{\@whitefield}}% + {\set@current@square@value{\@blackfield}}% \addtocounter{cpd@current@line}{\@ne}% }% \addtocounter{cpd@current@row}{\@ne}% @@ -2789,6 +2892,23 @@ \stereo@center% \fi% \fi% + % In an 'allwhite' diagram we display dotted lines + \ifthenelse{\boolean{allwhite}}{% + \setbox\plane@box=\vbox{\hbox{% + \psset{unit=\sq@width,linewidth=.4pt,linestyle=dotted,dotsep=.125}% + \setcounter{field@border}{1}% + \whiledo{\value{field@border}<\lines@max}{% + \psline(0,\value{field@border})(\rows@max,\value{field@border})% + \addtocounter{field@border}{\@ne}% + }% + \setcounter{field@border}{1}% + \whiledo{\value{field@border}<\rows@max}{% + \psline(\value{field@border},0)(\value{field@border},\lines@max)% + \addtocounter{field@border}{\@ne}% + }% + \box\plane@box% + }}% + }{}% % Now we should clear the board \clear@board% % Let us now parse the list of pieces 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 434fc40c7f6..57f66bee0c7 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}[2011/06/04] +\ProvidesPackage{diagram}[2012/11/12] \DeclareOption{10pt}{\AtBeginDocument{\diagramx}} \DeclareOption{11pt}{\AtBeginDocument{\diagramxi}} \DeclareOption{12pt}{\AtBeginDocument{\diagramxii}} @@ -44,6 +44,7 @@ \ProcessOptions \RequirePackage{ifthen} \RequirePackage{calc} +\RequirePackage{pstricks} %% %% %% @@ -86,6 +87,14 @@ \setboolean{showcity}{false} \newboolean{showacademictitle} \setboolean{showacademictitle}{true} + +\newcount\@blackfield +\newboolean{allwhite} +\setboolean{allwhite}{false} +\newcounter{field@border} +\newcount\@whitefield +\newboolean{switchcolors} +\setboolean{switchcolors}{false} \newboolean{cpd@checkPieceCounts} \newcounter{cpd@defWhitePieces} \newcounter{cpd@defBlackPieces} @@ -169,6 +178,7 @@ \newtoks\stipulation@tk\stipulation@tk={\relax} \newtoks\condition@tk\condition@tk={\relax} \newtoks\remark@tk\remark@tk={\relax} +\newtoks\piecedefs@tk\piecedefs@tk={\relax} \newif\if@label\@labelfalse \newif\if@number\@numberfalse \newif\if@special\@specialfalse @@ -205,6 +215,7 @@ \newif\if@stipulation\@stipulationfalse \newif\if@condition\@conditionfalse \newif\if@remark\@remarkfalse +\newif\if@piecedefs\@piecedefsfalse \newif\if@typis\@typisfalse \newif\if@widedias\@widediasfalse \newif\ifx@twins\x@twinsfalse @@ -740,6 +751,10 @@ \remark@tk={#1}\@remarktrue% \ignorespaces% } +\def\piecedefs#1{% + \piecedefs@tk={#1}\@piecedefstrue% + \ignorespaces% +} \def\Co#1{% \ifx#1+\@computertrue\computer@tk={+}\fi% \ignorespaces% @@ -1115,6 +1130,31 @@ \fi% } +\def\check@piecedef{% + \ifx\next@piecedef\relax% + \let\col@action=\relax% + \else% + \let\col@action=\@@piecedef% + \fi% + \col@action% +} +\def\@@piecedef#1{\csname#1\x@piecedef\endcsname\parse@piecedef} + +\def\parse@piecedef{\futurelet\next@piecedef\check@piecedef} + +\def\@piecedef#1#2#3{% + \def\x@piecedef{#2}% + \below@newline% + \hbox{% + \parse@piecedef#1\relax% + \ = #3}% +} + +\def\write@piecedefs#1; {% + \@piecedef#1% + \l@@klist% +} + \def\@dia@remark{% \if@remark% \bgroup% @@ -1124,6 +1164,14 @@ \egroup% \let\below@newline\newline% \fi% + \if@piecedefs% + \bgroup% + \@lefttrue% + \let\below@newline\newline% + \remfont\let\@action=\write@piecedefs% + \@parseTokenlist\piecedefs@tk;% + \egroup% + \fi% } \def\parse@params#1{% @@ -1616,7 +1664,11 @@ } \def\clear@board{% - % Now the new style + \ifthenelse{\boolean{allwhite}\and\boolean{switchcolors}}% + {\errmessage{'allwhite' and 'switchcolors' do not make sense used together.}}% + {\@whitefield=\m@ne\@blackfield=144}% + \ifthenelse{\boolean{allwhite}}{\@blackfield=\m@ne}{}% + \ifthenelse{\boolean{switchcolors}}{\@whitefield=144\@blackfield=\m@ne}{}% \setcounter{cpd@current@row}{0}% \whiledo{\value{cpd@current@row}<\value{cpd@rowsmax}}{% \setcounter{cpd@current@line}{0}% @@ -1624,8 +1676,8 @@ \set@current@square@index{\value{cpd@current@line}}{\value{cpd@current@row}}% \setcounter{cpd@helper}{\the\current@plane+\value{cpd@current@line}+\value{cpd@current@row}}% \ifthenelse{\isodd{\value{cpd@helper}}}% - {\set@current@square@value{-1}}% - {\set@current@square@value{144}}% + {\set@current@square@value{\@whitefield}}% + {\set@current@square@value{\@blackfield}}% \addtocounter{cpd@current@line}{\@ne}% }% \addtocounter{cpd@current@row}{\@ne}% @@ -1713,6 +1765,23 @@ \stereo@center% \fi% \fi% + % In an 'allwhite' diagram we display dotted lines + \ifthenelse{\boolean{allwhite}}{% + \setbox\plane@box=\vbox{\hbox{% + \psset{unit=\sq@width,linewidth=.4pt,linestyle=dotted,dotsep=.125}% + \setcounter{field@border}{1}% + \whiledo{\value{field@border}<\lines@max}{% + \psline(0,\value{field@border})(\rows@max,\value{field@border})% + \addtocounter{field@border}{\@ne}% + }% + \setcounter{field@border}{1}% + \whiledo{\value{field@border}<\rows@max}{% + \psline(\value{field@border},0)(\value{field@border},\lines@max)% + \addtocounter{field@border}{\@ne}% + }% + \box\plane@box% + }}% + }{}% % Now we should clear the board \clear@board% % Let us now parse the list of pieces -- cgit v1.2.3