From d1148bc45e870c8f7c8fc92bdb59d45f5f772fc1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 14 Aug 2011 23:04:59 +0000 Subject: chess-problem-diagrams git-svn-id: svn://tug.org/texlive/trunk@23555 c570f23f-e606-0410-a88d-b1316a301751 --- .../latex/chess-problem-diagrams/diagram.dtx | 188 ++++++++++++++------- 1 file changed, 128 insertions(+), 60 deletions(-) (limited to 'Master/texmf-dist/source/latex/chess-problem-diagrams') 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 a55dea75b74..9036582e0fa 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.5} -% \def\docdate{2008/03/09} -% \CheckSum{3968} +% \def\fileversion{1.5.4} +% \def\docdate{2011/06/04} +% \CheckSum{4022} % \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 @@ -29,6 +29,21 @@ % piececount.} % \changes{v1.5}{09 March 2008}{Added license meta-comment to % publish package on ctan.} +% \changes{v1.5.1}{08 Jun 2010}{Fixed font problem when writing +% producing piececounter in small diagrams.} +% \changes{v1.5.2}{13 Jun 2010}{Added some percent signs at line +% ends in @start@diagram and enddiagam to avoid accidently added +% spaces.} +% \changes{v1.5.3}{04 Oct 2010}{Changed switch, which is used to +% decide, whether infomration about computer proof is displayed +% to use standard boolean syntax. Symbols about computer +% proof are now created by standard commands and may +% therefore be changed by users.} +% \changes{v1.5.4}{03 Jun 2011}{Defined 2 different versions of +% @writename command, to be able to change it in other +% stylefiles for the part over the diagram without influencing +% the one used for the solution. Added commands to set white, +% black and neutral Circles within text.} % % \DoNotIndex{\@arabic,\def,\@idxitem,\@ifnextchar,\@ifstar, % \@ne,\@ptsize,\ ,\advance,\AtEndOfPackage,\begin,\begingroup, @@ -283,7 +298,7 @@ % horizontalcylindric board. % \item \DescribeMacro{\noframe} % does completely suppress the outer frame e.\,g.\ to symbolize a -% thorus board. +% torus board. % \item \DescribeMacro{\noinnerframe} % sometimes you need to suppress the inner frame instead of the % outer frame which is achieved by using |\noinnerframe|. You may @@ -372,10 +387,26 @@ % number of pieces is displayed below the board. So you may % change its value using |\setboolean{piececounter}{true}| or % |\setboolean{piececounter}{false}|. -% \item \DescribeMacro{\nocomputer} -% is used to suppress the display whether a problem has been -% computerproved or not. +% \item +% \DescribeMacro{showcomputer} +% \DescribeMacro{\nocomputer}\DescribeMacro{\showcomputer} +% There is a boolean value |computer|, which controls whether the +% infomration about a computer proof is displayed or not. This +% value may be changed using |\setboolean{showcomputer}{true}| or +% |\setboolean{showcomputer}{false}| For backwards compatiblity +% we support the macros |\nocomputer| and |\showcomputer|. % \end{itemize} +% +% \DescribeMacro{\notcomputerproofedsymbol} +% \DescribeMacro{\computerproofedsymbol} +% You may specify the text, which is used indicate, whether a +% problem is proofed by a computer. To specifiy the symbol for a +% problem, which is proofed, is created by +% |\computerproofedsymbol|. To specifiy the symbol for a +% problem, which is not computer proofed, is created by +% |\notcomputerproofedsymbol|. You may redefine these commands by +% standard \LaTeX\ means (|\renewcommand|). + % % \DescribeMacro{\selectelchfont} % You may specify which font is used for the chesspieces. There @@ -643,18 +674,33 @@ % \item[\wNr] % \DescribeMacro{\wNr} % a white nightrider +% \item[\nNr] +% \DescribeMacro{\nNr} +% a neutral nightrider % \item[\sNr] % \DescribeMacro{\sNr} % a black nightrider % \item[\wGh] % \DescribeMacro{\wGh} % a white grashopper +% \item[\nGh] +% \DescribeMacro{\nGh} +% a neutral grashopper % \item[\sGh] % \DescribeMacro{\sGh} % a black grashopper % \item[\Imi] % \DescribeMacro{\Imi} -% an imitator +% an imitator, you may also use the {\bfseries Circle} notation: +% \item[\wC] +% \DescribeMacro{\wC} +% a white circle +% \item[\nC] +% \DescribeMacro{\nC} +% a neutral circle +% \item[\sC] +% \DescribeMacro{\sC} +% a black circle % \end{description} % \subsubsection{Other often used symbols} % The style also defines commands for other symbols, which are @@ -797,7 +843,7 @@ % Specifies the preamble of our style file. % \begin{macrocode} %<*style> -\ProvidesPackage{diagram}[2008/03/09] +\ProvidesPackage{diagram}[2011/06/04] \DeclareOption{10pt}{\AtBeginDocument{\diagramx}} \DeclareOption{11pt}{\AtBeginDocument{\diagramxi}} \DeclareOption{12pt}{\AtBeginDocument{\diagramxii}} @@ -979,7 +1025,10 @@ \newif\if@gridlines\@gridlinesfalse \newif\if@fieldframe\@fieldframefalse \newif\if@stdgrid\@stdgridfalse -\newif\if@show@computer\@show@computertrue +\newboolean{showcomputer}\setboolean{showcomputer}{true}% +\newcommand*{\computerproofedsymbol}{C+} +\newcommand*{\notcomputerproofedsymbol}{C-} +% \newif\if@show@computer\@show@computertrue \newif\if@stipulation\@stipulationfalse \newif\if@condition\@conditionfalse \newif\if@remark\@remarkfalse @@ -1084,12 +1133,12 @@ \@start@diagram% } \def\@start@diagram{% - \init@vars - \let\author=\ds@author - \let\day=\ds@day - \let\month=\ds@month - \let\year=\ds@year - \let\label=\ds@label + \init@vars% + \let\author=\ds@author% + \let\day=\ds@day% + \let\month=\ds@month% + \let\year=\ds@year% + \let\label=\ds@label% \ignorespaces% } @@ -1100,11 +1149,11 @@ } \def\enddiagram{% - \let\author=\orig@author -\let\day=\orig@day -\let\month=\orig@month -\let\year=\orig@year -\let\label=\orig@label + \let\author=\orig@author% + \let\day=\orig@day% + \let\month=\orig@month% + \let\year=\orig@year% + \let\label=\orig@label% \if@number% \else% \refstepcounter{board@nr}% so \label and \ref work properly @@ -1138,8 +1187,8 @@ \ifdim\space@frame>\outer@frame% \outer@frame=\space@frame% \fi% - \advance\bd@width\tw@\inner@frame - \advance\board@width\tw@\inner@frame + \advance\bd@width\tw@\inner@frame% + \advance\board@width\tw@\inner@frame% \advance\board@width\tw@\h@frame@dist% \advance\board@width\tw@\outer@frame% \else\if@space% @@ -1155,8 +1204,8 @@ \ifspace@vertical% \bd@width=\lines@max\sq@width% \board@width\bd@width% - \advance\bd@width\tw@\inner@frame - \advance\board@width\tw@\inner@frame + \advance\bd@width\tw@\inner@frame% + \advance\board@width\tw@\inner@frame% \advance\board@width\tw@\h@frame@dist% \advance\board@width\tw@\outer@frame% \else% @@ -1260,13 +1309,16 @@ \def\put@count{% % First we build the box with the figure count - \ifthenelse{\boolean{piececounter}}{% + \ifthenelse{\boolean{showcomputer}\OR\boolean{piececounter}}{% \global\setbox\@cnt@box=\hbox{% - \if@show@computer% - \ \ C\if@computer +\else --\fi% - \fi% - \ \ (\arabic{cpd@whitePieces}+\arabic{cpd@blackPieces}% - \ifthenelse{\value{cpd@neutralPieces}>0}{+\arabic{cpd@neutralPieces}}{})% + \stipfont% + \ifthenelse{\boolean{showcomputer}}{% + \ \ \if@computer\computerproofedsymbol\else\notcomputerproofedsymbol\fi% + }{}% + \ifthenelse{\boolean{piececounter}}{% + \ \ (\arabic{cpd@whitePieces}+\arabic{cpd@blackPieces}% + \ifthenelse{\value{cpd@neutralPieces}>0}{+\arabic{cpd@neutralPieces}}{})% + }{}% }% \@cnt@wd=\wd\@cnt@box% \hangindent-\@cnt@wd% @@ -1281,21 +1333,21 @@ \let\endstereodiagram=\enddiagram \let\endspacediagram=\enddiagram \def\figurine{% - \begingroup - \init@vars - \let\author=\ds@author - \let\day=\ds@day - \let\month=\ds@month - \let\year=\ds@year - \let\label=\ds@label + \begingroup% + \init@vars% + \let\author=\ds@author% + \let\day=\ds@day% + \let\month=\ds@month% + \let\year=\ds@year% + \let\label=\ds@label% } \def\endfigurine{% - \let\author=\orig@author - \let\day=\orig@day - \let\month=\orig@month - \let\year=\orig@year - \let\label=\orig@label + \let\author=\orig@author% + \let\day=\orig@day% + \let\month=\orig@month% + \let\year=\orig@year% + \let\label=\orig@label% \if@number% \else% \refstepcounter{board@nr}% so \label and \ref work properly @@ -1729,11 +1781,11 @@ \ignorespaces% } \def\showcomputer{% - \@show@computertrue% + \setboolean{showcomputer}{true}% \ignorespaces% } \def\nocomputer{% - \@show@computerfalse% + \setboolean{showcomputer}{false}% \ignorespaces% } \def\putsol{\immediate\closeout\s@lfd\input\jobname.sol\cl@arsol} @@ -1776,15 +1828,30 @@ \expandafter\xdef\csname\ds@white Nr\endcsname{% \noexpand\ch@fig{109}% }% + \expandafter\xdef\csname\ds@neutral Nr\endcsname{% + \noexpand\ch@fig{115}% + }% \expandafter\xdef\csname\ds@black Nr\endcsname{% \noexpand\ch@fig{121}% }% \expandafter\xdef\csname\ds@white Gh\endcsname{% \noexpand\ch@fig{112}% }% + \expandafter\xdef\csname\ds@neutral Gh\endcsname{% + \noexpand\ch@fig{118}% + }% \expandafter\xdef\csname\ds@black Gh\endcsname{% \noexpand\ch@fig{124}% }% + \expandafter\xdef\csname\ds@white C\endcsname{% + \noexpand\ch@fig{145}% + }% + \expandafter\xdef\csname\ds@neutral C\endcsname{% + \noexpand\ch@fig{151}% + }% + \expandafter\xdef\csname\ds@black C\endcsname{% + \noexpand\ch@fig{157}% + }% } \def\Imi{\ch@fig{157}} % \end{macrocode} @@ -1864,7 +1931,7 @@ \else% {\def\name@sep{\par}% \@notfirstfalse% - \let\@action=\@writename% Parse the list of authors + \let\@action=\@dia@writename% Parse the list of authors \@parseTokenlist\aut@tk;} \fi% \egroup% @@ -2035,7 +2102,7 @@ \@lefttrue% \fi% \fi% - \let\below@newline\newline + \let\below@newline\newline% \l@@klist% } @@ -2126,7 +2193,7 @@ \bgroup% \parindent\z@% \parskip\tw@\p@% - {\bf + {\bfseries% \noindent\if@label\showlabel{\the\label@tk}\fi% \the\number@tk) % \ifauth@r% @@ -2135,7 +2202,7 @@ \else% {\@notfirstfalse% We are the first one \def\name@sep{, }% - \let\@action=\@writename% + \let\@action=\@sol@writename% \@parseTokenlist\aut@tk;}:% \fi% \par% @@ -2270,9 +2337,9 @@ } \def\@figurine@computer{% - \if@show@computer - \if@computer\ (Co)\fi% - \fi% + \ifthenelse{\boolean{showcomputer}}{% + \if@computer\ \computerproofedsymbol\fi% + }{}% } \def\@figurine@remarks{% @@ -2313,7 +2380,8 @@ \fi } \def\@months#1-#2;{\from@month=#1\to@month=#2\@datetrue} -\def\@writename#1; {\sep@names\@dianame#1; \l@@klist} +\def\@dia@writename#1; {\sep@names\@dianame#1; \l@@klist} +\def\@sol@writename#1; {\sep@names\@dianame#1; \l@@klist} \def\name@sep{,\ } \def\sep@names{\if@notfirst\name@sep\else\@notfirsttrue\fi} \def\@checkshort#1/#2#3;{% @@ -2387,9 +2455,9 @@ } \def\chkr@tate{% - \if\r@tate \ds@upsidedown\advance\help@a 108\let\nextpr@c=\skipr@t\else - \if\r@tate \ds@left\advance\help@a 36\let\nextpr@c=\skipr@t\else - \if\r@tate \ds@right\advance\help@a 72\let\nextpr@c=\skipr@t\else + \if\r@tate \ds@upsidedown\advance\help@a 108\let\nextpr@c=\skipr@t\else% + \if\r@tate \ds@left\advance\help@a 36\let\nextpr@c=\skipr@t\else% + \if\r@tate \ds@right\advance\help@a 72\let\nextpr@c=\skipr@t\else% \let\nextpr@c\piece@job\fi\fi\fi\nextpr@c% } \def\skipr@t#1{\piece@job} @@ -3018,7 +3086,7 @@ \or% \def\@thePiece{\ds@king}% \fi% - \expandafter\xdef\csname + \expandafter\xdef\csname% \@theColor\@thePiece\@theRotation\endcsname{% \noexpand\ch@fig{\the\help@a}% } @@ -3049,9 +3117,9 @@ \newdimen\normalboardwidth \def\setboardwidth{% \normalboardwidth=\@ight\fontdimen\tw@\chessfont% - \advance\normalboardwidth\tw@\inner@frame - \advance\normalboardwidth\tw@\h@frame@dist - \advance\normalboardwidth\tw@\outer@frame + \advance\normalboardwidth\tw@\inner@frame% + \advance\normalboardwidth\tw@\h@frame@dist% + \advance\normalboardwidth\tw@\outer@frame% } \setboardwidth -- cgit v1.2.3