| 1 |
% \iffalse meta-comment |
| 2 |
%% File 'diagram.dtx' |
| 3 |
%% |
| 4 |
%% This file may be distributed and/or modified under the |
| 5 |
%% conditions of the LaTeX Project Public License, either version |
| 6 |
%% 1.2 of this license or (at your option) any later version. |
| 7 |
%% The latest version of this license is in: |
| 8 |
%% |
| 9 |
%% http://www.latex-project.org/lppl.txt |
| 10 |
%% |
| 11 |
%% and version 1.2 or later is part of all distributions of LaTeX |
| 12 |
%% version 1999/12/01 or later. |
| 13 |
%% |
| 14 |
%% |
| 15 |
% \fi |
| 16 |
% \def\fileversion{v1.23} |
| 17 |
% \def\docdate{2025/03/12} |
| 18 |
% \CheckSum{4227} |
| 19 |
% \changes{v0.1}{15 Februar 2004}{First Version} |
| 20 |
% \changes{v0.2}{23 Februar 2004}{Added the documentation for the |
| 21 |
% {\itshape information collecting} macros which may be used |
| 22 |
% inside a environment.} |
| 23 |
% \changes{v0.3}{21 May 2004}{Added list of commands which should |
| 24 |
% not be indexed.} |
| 25 |
% \changes{v0.4}{11 May 2005}{Added most missing user documentation.} |
| 26 |
% \changes{v0.5}{25 May 2007}{Fixed wrong piece count when using |
| 27 |
% imitators} |
| 28 |
% \changes{v0.6}{01 June 2007}{Changed errneous code to parse given |
| 29 |
% piececount.} |
| 30 |
% \changes{v1.5}{09 March 2008}{Added license meta-comment to |
| 31 |
% publish package on ctan.} |
| 32 |
% \changes{v1.5.1}{08 Jun 2010}{Fixed font problem when writing |
| 33 |
% producing piececounter in small diagrams.} |
| 34 |
% \changes{v1.5.2}{13 Jun 2010}{Added some percent signs at line |
| 35 |
% ends in @start@diagram and enddiagam to avoid accidently added |
| 36 |
% spaces.} |
| 37 |
% \changes{v1.5.3}{04 Oct 2010}{Changed switch, which is used to |
| 38 |
% decide, whether infomration about computer proof is displayed |
| 39 |
% to use standard boolean syntax. Symbols about computer |
| 40 |
% proof are now created by standard commands and may |
| 41 |
% therefore be changed by users.} |
| 42 |
% \changes{v1.5.4}{03 Jun 2011}{Defined 2 different versions of |
| 43 |
% @writename command, to be able to change it in other |
| 44 |
% stylefiles for the part over the diagram without influencing |
| 45 |
% the one used for the solution. Added commands to set white, |
| 46 |
% black and neutral Circles within text.} |
| 47 |
% \changes{v1.5.5}{01 July 2011}{Changed amount of lowering |
| 48 |
% figurine pieces.} |
| 49 |
% \changes{v1.5.6}{09 August 2011}{Added new command |
| 50 |
% 'solpar' to allow use |
| 51 |
% of 'putsol' inside a window environment.} |
| 52 |
% \changes{v1.6}{30 April 2012}{Added boolean showcity and code |
| 53 |
% to suppress display of city, when showcity is false. Added |
| 54 |
% commands for academic titles, which allow to suppress their |
| 55 |
% display.} |
| 56 |
% \changes{v1.6.1}{24 September 2012}{Added new command piecedefs specify names |
| 57 |
% of fairy pieces for rotated pieces.} |
| 58 |
% \changes{v1.6.2}{11 November 2012}{Added boolean for allwhite problems.} |
| 59 |
% \changes{v1.6.3}{12 November 2012}{Added boolean for board with switched field colors.} |
| 60 |
% \changes{v1.6.4}{12 November 2012}{Added convenience command for 'allwhite' and 'switchcolors' booleans.} |
| 61 |
% \changes{v1.6.5}{21 June 2013}{As suggested by Torsten Lin{\ss} and Thomas Brand added support for Equihopper and turned Equihopper (X)} |
| 62 |
% \changes{v1.6.6}{06 July 2013}{Introduced new command to switch to the default diagram size.} |
| 63 |
% \changes{v1.6.7}{17 August 2013}{Fixed issue '19a' with allwhite on quadratic fields.} |
| 64 |
% \changes{v1.7.0}{17 August 2013}{Implemented Issue '32c': the command diagnum now allows to specify a prefix to be used for the following diagrams.} |
| 65 |
% \changes{v1.8.0}{27 November 2013}{Implemented issue '03f/f2a': Added code to display a legend around the board, controlled by the boolean 'legend'.} |
| 66 |
% \changes{v1.8.1}{17 August 2014}{Implemented issue '03f/83c': changed tex boolean solafterdiagram to latex boolean.} |
| 67 |
% \changes{v1.9}{10 Januar 2015}{Implemented issue '03f/932': Renamed boardfont to cpd@boardfont due to a naming collision with another chess package. Changed all font definitions to newcommand instead of def.} |
| 68 |
% \changes{v1.10}{26 January 2015}{Fixed issue: 03f/658:om: diagram.sty: |
| 69 |
% evaluation of options 11pt and 12pt does not work.} |
| 70 |
% \changes{v1.11}{30 January 2015}{Fixed issue 03f/e20:om: diagram.sty: |
| 71 |
% piecedefs should be written after twins and before remarks.} |
| 72 |
% \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.} |
| 73 |
% \changes{v1.12}{06 January 2016}{Implemented issue: 03f/fc0:om: diagram.dtx: change def x to newcommand.\\ |
| 74 |
% Changed name of internal commands ds@left, ds@right, ds@upsidedown due to a naming collising with options from eurosym.sty.} |
| 75 |
% \changes{v1.13}{04 April 2019}{Implemented issue: 03f/99b:om: diagram.dtx: added new command fen to allow entering forsyth-edwards-notation} |
| 76 |
% \changes{v1.14}{02 September 2019}{Fixed issue with stereo- and space-diagrams.} |
| 77 |
% \changes{v1.15}{28 December 2019}{Fixed frame issue with stereo- and space-diagrams.\\ |
| 78 |
% Added hook commands for begin/end diagram.} |
| 79 |
% \changes{v1.16}{09 February 2020}{Fixed date display issue in |
| 80 |
% figurine environment.\\ |
| 81 |
% Added hook commands to figurine environment.\\ |
| 82 |
% Fixed documentation bug: separation character in themes command is |
| 83 |
% comma not semicolon.\\ |
| 84 |
% command diagnumbering fixed: boolean is changed to true globally.} |
| 85 |
% \changes{v1.17}{27 December 2020}{Added generation of cpdparse.sty |
| 86 |
% containing generic command for parsing lists.} |
| 87 |
% \changes{v1.18}{04 February 2021}{03f/0be:om: Typo: above@newlne\\ |
| 88 |
% 03f/035:om: solnamestype has no effect} |
| 89 |
% \changes{v1.19}{04 March 2021}{Minor fix in cl@arsol\\ |
| 90 |
% Added (empty) command gerne.} |
| 91 |
% \changes{v1.20}{13 June 2022}{Introduced two booleans to better |
| 92 |
% control displaying diagram number globally and locally.\\ |
| 93 |
% Removed the old boolean 'di@no'.} |
| 94 |
% \changes{v1.21}{14 June 2022}{Impletented issue: 03f/309:\\ |
| 95 |
% handle empty arguments in information collecting commands\\ |
| 96 |
% Fixed typo in @dia@fidealbum command.} |
| 97 |
% \changes{v1.22}{13 June 2024}{Fix empty argument detection.\\ |
| 98 |
% Change ra and lra commands to allow for common prefix and suffix.\\ |
| 99 |
% Added generic command insidediagram to allow e.g. footnotes inside |
| 100 |
% diagrams.\\ |
| 101 |
% Fixed numbering when creating empty diagram numbering via |
| 102 |
% speciadiagram.} |
| 103 |
% \changes{v1.23}{2025/03/12}{% |
| 104 |
% Fixed pdflatex/Acrobat-Reader issue by using tikz in put@row. |
| 105 |
% Removed dependency to pstricks. |
| 106 |
% Switched to LaTeX counters from TeX counters. |
| 107 |
% Fixed spacing issue when using fen notation. |
| 108 |
% } |
| 109 |
% |
| 110 |
% \DoNotIndex{\@arabic,\def,\@idxitem,\@ifnextchar,\@ifstar, |
| 111 |
% \@ne,\@ptsize,\ ,\advance,\AtEndOfPackage,\begin,\begingroup, |
| 112 |
% \bfseries,\bgroup,\boolean,\box,\char,\chardef,\closeout, |
| 113 |
% \count,\csname,\DeclareOption,\DocInput,\documentclass, |
| 114 |
% \egroup,\else,\end,\endcsname,\endgroup,\endinput,\errmessage, |
| 115 |
% \exhyphenpenalty,\expandafter,\fi,\font,\fonddimen,\gdef,\global, |
| 116 |
% \hangafter,\hangindent,\hbox,\hfill,\hrule,\hsize,\hskip,\hss,\if, |
| 117 |
% \ifcase,\ifdim,\iffalse,\ifmmode,\ifnum,\ifodd,\ifthenelse, |
| 118 |
% \ifvmode,\ifx,\immediate,\index,\input,\itshape,\kern,\label,\let, |
| 119 |
% \llap,\long,\loop,\lower,\mbox,\medskip,\multiply,\newboolean,\newbox, |
| 120 |
% \newcount,\newcounter,\newdimen,\newif,\newindex,\newline,\newtoks, |
| 121 |
% \newwrite,\noexpand,\noindent,\openout,\OptionNotUsed,\or,\p@,\par, |
| 122 |
% \parindent,\parskip,\penalty,\printindex,\ProcessOptions,\ProvidesFile, |
| 123 |
% \ProvidesPackage,\raise,\RecordChanges,\ref,\refstepcounter,\relax, |
| 124 |
% \repeat,\RequirePackage,\rmfamily,\setboolean,\setbox,\setlength, |
| 125 |
% \the,\textwidth,\unhbox,\usepackage,\vbox,\vfil,\vrule,\vskip, |
| 126 |
% \vss,\vtop,\wd,\write,\xdef,\z@} |
| 127 |
% |
| 128 |
% \title{Creating diagrams for chess problems\\{\large Version~\fileversion}} |
| 129 |
% \author{Thomas Brand\\Bornheim\and Stefan H\"oning\\Neuss} |
| 130 |
% \date{\docdate} |
| 131 |
% |
| 132 |
% \maketitle |
| 133 |
% |
| 134 |
% \begin{abstract} |
| 135 |
% It have been more than ten years now, since we last published a documented |
| 136 |
% version of the {\ttfamily diagram.sty}, which is mainly intended to |
| 137 |
% be used for typesetting chess problems. Since 1994 I (Stefan H\"oning) made a |
| 138 |
% couple of enhancements to the sourcecode of the style, without publishing and |
| 139 |
% putting this into the documentation. We also needed to upgrade to \LaTeXe. |
| 140 |
% The major change is the documentation language, which is english now. |
| 141 |
% |
| 142 |
% The style itself tries to collect very detailed information |
| 143 |
% about a chess problem by providing a lot of commands, |
| 144 |
% which you may use to specify the necessary information. There |
| 145 |
% are different reasons for this. One idea was to enable people |
| 146 |
% to read \LaTeX-diagrams into databases with information as |
| 147 |
% detailed as possible. Otherwise it should be easy to change the |
| 148 |
% layout of a diagram by applying a changed style - not by |
| 149 |
% changing the source. |
| 150 |
% \end{abstract} |
| 151 |
% |
| 152 |
% \newpage |
| 153 |
% \tableofcontents |
| 154 |
% \newpage |
| 155 |
% |
| 156 |
% \newcommand{\explained}[1]{{\itshape#1}} |
| 157 |
% \newcommand{\magazine}[1]{{\bfseries\itshape #1}} |
| 158 |
% \newcommand{\Schwalbe}{\magazine{Die Schwalbe}} |
| 159 |
% |
| 160 |
% \section{Creating diagrams} |
| 161 |
% \subsection{An introductary example} |
| 162 |
% Let us first take a look at a simple example which should only |
| 163 |
% show what you have to type into your \LaTeX-code to get nice |
| 164 |
% looking diagrams. |
| 165 |
% |
| 166 |
% \bigskip |
| 167 |
% % |
| 168 |
% \begin{diagram} |
| 169 |
% \label{BSP1} |
| 170 |
% \author{Brand, Thomas} |
| 171 |
% \source{Problemkiste} \year{1992} |
| 172 |
% \dedic{Elmar Bartel gew.} |
| 173 |
% \pieces[2+3]{wKd1, wBe2, sKh8, sBe4, sTa4} |
| 174 |
% \stip{h\#7} |
| 175 |
% \sol{1.Ta3 Kc2!, 2.Tf3 e\x f3, 3.e3 f4, 4.e2 f5, 5.e1T f6, |
| 176 |
% 6.Th1! (Te7?) f7, 7.Th7 f8D\#} |
| 177 |
% \end{diagram} |
| 178 |
% \hfill |
| 179 |
% \begin{diagram} |
| 180 |
% \label{BSP2} |
| 181 |
% \setboolean{legend}{true} |
| 182 |
% \author{Brand, Thomas} |
| 183 |
% \source{Problemkiste} \year{1992} |
| 184 |
% \fen{8/1k6/8/1B6/K6p/7N/8/8} |
| 185 |
% \stip{h\#5} |
| 186 |
% \sol{1.Ka8 Sg1, 2.h3 Ka5, 3.h2 Kb6, 4.h\x g1L+ Kc7, 5.La7 Lc6\#} |
| 187 |
% \end{diagram} |
| 188 |
% |
| 189 |
% \putsol |
| 190 |
% |
| 191 |
% \bigskip |
| 192 |
% To use the package you have to make it available to \LaTeX\ using |
| 193 |
% \verb+\usepackage{diagram}+ inside the preamble of your document. |
| 194 |
% |
| 195 |
% Then you may use the {\ttfamily diagram} environment to create |
| 196 |
% the diagrams. For the above example I had to type the |
| 197 |
% following: |
| 198 |
% |
| 199 |
% \begin{verbatim} |
| 200 |
% \begin{diagram} |
| 201 |
% \author{Brand, Thomas} |
| 202 |
% \source{Problemkiste} \year{1992} |
| 203 |
% \dedic{Elmar Bartel gew.} |
| 204 |
% \pieces[2+3]{wKd1, wBe2, sKh8, sBe4, sTa4} |
| 205 |
% \stip{h\#7} |
| 206 |
% \sol{1.Ta3 Kc2!, 2.Tf3 e\x f3, 3.e3 f4, 4.e2 f5, 5.e1T f6, |
| 207 |
% 6.Th1! (Te7?) f7, 7.Th7 f8D\#} |
| 208 |
% \end{diagram} |
| 209 |
%% |
| 210 |
% \hfill |
| 211 |
%% |
| 212 |
% \begin{diagram} |
| 213 |
% \setboolean{legend}{true} |
| 214 |
% \author{Brand, Thomas} |
| 215 |
% \source{Problemkiste} \year{1992} |
| 216 |
% \pieces[3+2]{wKa4, wLb5, wSh3, sKb7, sBh4} |
| 217 |
% \stip{h\#5} |
| 218 |
% \sol{1.Ka8 Sg1, 2.h3 Ka5, 3.h2 Kb6, 4.h\x g1L+ Kc7, 5.La7 Lc6\#} |
| 219 |
% \end{diagram} |
| 220 |
% |
| 221 |
% \putsol |
| 222 |
% \end{verbatim} |
| 223 |
% |
| 224 |
% \DescribeEnv{diagram} |
| 225 |
% Any information which belongs to a problem should be put |
| 226 |
% between \verb+\begin{diagram}+ and \verb+\end{diagram}+. The |
| 227 |
% above examples contains information for \explained{authors, |
| 228 |
% source, year of publication, stipulation, solution} and (in |
| 229 |
% diagram \ref{BSP1}) a \explained{dedication}. |
| 230 |
% |
| 231 |
% This information is shown around a chessboard except the |
| 232 |
% solution, which is collected and put into the output using the |
| 233 |
% \verb+\putsol+ command. |
| 234 |
% |
| 235 |
% \subsection{Elements of a diagram} |
| 236 |
% This section describes the elements which may be used inside a |
| 237 |
% {\ttfamily diagram} environment. For most of these elements |
| 238 |
% there is no sense using them between \verb+\begin{diagram}+ and |
| 239 |
% \verb+\end{diagram}+. Some of them will not work outside of the |
| 240 |
% environment (like |\author|). In case you use these switches |
| 241 |
% anywhere outside you will specify the information for all |
| 242 |
% problems in your surrounding environment (which may be the |
| 243 |
% complete document). |
| 244 |
% |
| 245 |
% \subsubsection{Collecting the problem information} |
| 246 |
% \MakeShortVerb{\|} |
| 247 |
% The following information is typically given with a problem: |
| 248 |
% \begin{itemize} |
| 249 |
% \item \DescribeMacro{\author} |
| 250 |
% With the |\author| tag you specify one author or a list of authors. |
| 251 |
% If you specify more than one author, you must separate them |
| 252 |
% with ``;~''. Normally an author is given as \explained{``sirname, |
| 253 |
% givenname''}. You may change the way, how the name is |
| 254 |
% interpreted by \LaTeX\ using |\normalnames| and |
| 255 |
% |\reversednames|. This \verb+\author+ command does only |
| 256 |
% overwrite the default behaviour when used inside a diagram |
| 257 |
% environment. |
| 258 |
% \item \DescribeMacro{\Dr} \DescribeMacro{\Prof} |
| 259 |
% \DescribeMacro{\ProfDr} |
| 260 |
% Within the Authors command you should use the commands |\Dr|, |
| 261 |
% |\Prof| and |\ProfDr| to specify these academic titles. So one |
| 262 |
% may switch off the display of these titles --- like it is |
| 263 |
% generally done inside \Schwalbe. |
| 264 |
% \item \DescribeMacro{\pieces} |
| 265 |
% With |\pieces| you specify the position to be displayed on the |
| 266 |
% board. For each kind of piece you may specify a list of fields. |
| 267 |
% Different lists of fields are separated by ``,~''. So the general |
| 268 |
% syntax for specifying the position of a specific piece |
| 269 |
% is:\newline |
| 270 |
% [color][piece]\{rotation of piece\}[list of squares];\newline |
| 271 |
% e.\,g. {\ttfamily wTa1h1} should be clear, {\ttfamily nKa4} is |
| 272 |
% a neutral king on a4\newline |
| 273 |
% {\bfseries w s n} may be used to specify the color of the |
| 274 |
% piece.\newline |
| 275 |
% {\bfseries K D T L S B C E X} may be used to specify the piece. A {\bfseries |
| 276 |
% C} is used for an imitator, {\bfseries E} for an equihopper and {\bfseries X} |
| 277 |
% for a rotated equihopper. You may {\itshape not} use an optional rotation |
| 278 |
% with {\bfseries C, E} and {\bfseries X}.\newline |
| 279 |
% {\bfseries R U L} may be used to specify an optional rotation: |
| 280 |
% right, upside-down, left. So you may use {\ttfamily sDUc7} for |
| 281 |
% a grashopper on c7 --- displayed as an upsidedown |
| 282 |
% queen.\newline The characters used to specify color, piece and |
| 283 |
% rotation may be changed using the |\DefinePieces| command. |
| 284 |
% |
| 285 |
% You may also optionally specify the number of pieces in your |
| 286 |
% diagram, which then will be used to control your input |
| 287 |
% automatically. |
| 288 |
% |
| 289 |
% There is also support for an imitator, which is typically |
| 290 |
% displayed as a black filled circle. So {\ttfamily sCf4} will |
| 291 |
% produce the symbol of an imitator. This is shown in |
| 292 |
% diagram~\ref{bigdia}. |
| 293 |
% \item \DescribeMacro{\fen} |
| 294 |
% As an alternative notation it is possible to enter the position in |
| 295 |
% \textit{Forsyth-Edwards-Notation}. This is possible for 8\,$\times$\,8 boards |
| 296 |
% only. |
| 297 |
% |
| 298 |
% As an example: The position in diagram~\ref{BSP2} was created via\newline |
| 299 |
% |\fen{8/1k6/8/1B6/K6p/7N/8/8}|. |
| 300 |
% |
| 301 |
% |
| 302 |
% As with the |\pieces| command, you may provide the number of white and |
| 303 |
% black pieces as an optional parameter. |
| 304 |
% \item \DescribeMacro{\stipulation} \DescribeMacro{\stip} |
| 305 |
% is used to specify the stipulation of the problem, e.\,g.\ |
| 306 |
% |\stipulation{\#2}| may be used to specify a \explained{mate in |
| 307 |
% two}. There is also an abbreviation |\stip| for this macro. |
| 308 |
% \item \DescribeMacro{\city} |
| 309 |
% may be used to specify the city and country, where the author |
| 310 |
% or the authors live. I use this inside the original section of |
| 311 |
% \Schwalbe. You should separate multiple cities (for multiple |
| 312 |
% authors) with ``;~''. There is also a boolean switch |showcity|, |
| 313 |
% which contols, whether this information is displayed. |
| 314 |
% \item \DescribeMacro{\specialdiagnum} |
| 315 |
% May be used to suppress the default diagram numbering (which |
| 316 |
% uses a counter) and instead directly providing a diagram |
| 317 |
% ``number'' which may be an arbritary text. This may also be used to |
| 318 |
% suppress displaying a diagram number by providing an empty argument |
| 319 |
% \verb+{}+. |
| 320 |
% \item \DescribeMacro{\sourcenr} |
| 321 |
% May be used to specify the number which was used for the |
| 322 |
% problem inside an originals section. |
| 323 |
% \item \DescribeMacro{\source} |
| 324 |
% May be used to specify the book or magazine where the problem |
| 325 |
% was issued first. |
| 326 |
% \item \DescribeMacro{\issue} |
| 327 |
% May be used to specify e.\,g.\ the issue of a magazine where |
| 328 |
% the problem was issued. |
| 329 |
% \item \DescribeMacro{\pages} |
| 330 |
% May be used to specify the page (or pages) where the problem |
| 331 |
% was issued. |
| 332 |
% \item \DescribeMacro{\day} |
| 333 |
% \DescribeMacro{\month}\DescribeMacro{\months} |
| 334 |
% \DescribeMacro{\year} |
| 335 |
% May be used to specify the different parts of the date of |
| 336 |
% publication of the problem. (E.\,g.\ for problems issued in the |
| 337 |
% german magazine \Schwalbe\ you will typically only specify the |
| 338 |
% |\month| and the |\year|. For problems issued in |
| 339 |
% \magazine{feenschach} you may specify a period of months like |
| 340 |
% |\months{7-10}|.) |
| 341 |
% \item \DescribeMacro{\tournament}\DescribeMacro{\award} |
| 342 |
% May be used to specify an award and a tournament for the |
| 343 |
% problem. |
| 344 |
% \item \DescribeMacro{\dedication}\DescribeMacro{\dedic} |
| 345 |
% May be used to specify a dedication which was given by the |
| 346 |
% author of the problem. |
| 347 |
% \item \DescribeMacro{\condition}\DescribeMacro{\cond} |
| 348 |
% May be used to specify the fairy conditions of a problem. |
| 349 |
% Different conditions should be separated with ``;~''. |
| 350 |
% \item \DescribeMacro{\twins} |
| 351 |
% May be used to specify the different twins of a problem. |
| 352 |
% Different twins should be separated with ``;~''. |
| 353 |
% \item \DescribeMacro{\remark}\DescribeMacro{\rem} |
| 354 |
% May be used to specify remarks to the problem. I typically use |
| 355 |
% this to explain fairy pieces on the board. You may also use the |
| 356 |
% abbreviation |\rem|. |
| 357 |
% \item \DescribeMacro{\piecedefs} |
| 358 |
% May be used to explain rotated pieces. An example:\newline |
| 359 |
% \verb+\piecedefs{{ws}{TL}{Turm-L\"aufer-J\"ager}; {wn}{SU}{Nachtreiter}}+ |
| 360 |
% will create\newline |
| 361 |
% \hbox{\wTL\sTL = Turm-L\"aufer-J\"ager}\newline |
| 362 |
% \hbox{\wSU\nSU = Nachtreiter}\newline |
| 363 |
% under the diagram. |
| 364 |
% \item \DescribeMacro{\solution}\DescribeMacro{\sol} |
| 365 |
% |\solution| may be used to specify the solution of the problem. |
| 366 |
% Normally this information is not used while displaying the |
| 367 |
% board but it is only collected and may be put into your text |
| 368 |
% using |\putsol|. There is also an abbreviation |\sol|. |
| 369 |
% \item \DescribeMacro{\judgement} |
| 370 |
% May be used to describe the judgement given for a problem, |
| 371 |
% e.\,g. when you are working on an award or when you are |
| 372 |
% selecting problems for a ``best of \dots{}'' book. |
| 373 |
% \item \DescribeMacro{\comment} |
| 374 |
% May be used to specify some comment on the problem (e.\,g. the |
| 375 |
% authors original comment.) |
| 376 |
% \item \DescribeMacro{\themes} |
| 377 |
% May be used to specify themes displayed in the problem. |
| 378 |
% Different themes should be separated with ``,~''. When creating a |
| 379 |
% theme index, the themes will automatically be used to create |
| 380 |
% the register. |
| 381 |
% \item \DescribeMacro{\genre} |
| 382 |
% May be used to specify genre of the problem. |
| 383 |
% Different genres should be separated with ``,~''. |
| 384 |
% The values are intended to using \LaTeX\-import within the PDB. |
| 385 |
% \end{itemize} |
| 386 |
% |
| 387 |
% When providing an empty argument to commands \verb+\award+, |
| 388 |
% \verb+\after+, \verb+\dedic+, \verb+\correction+ and \verb+\version+ |
| 389 |
% only a warning is issued to the logfile. In previous |
| 390 |
% versions of \verb+diagram.sty+ using empty arguments with the |
| 391 |
% mentioned commands produced empty lines above the diagram. |
| 392 |
% |
| 393 |
% |
| 394 |
% There are some commands which not only collect information but |
| 395 |
% normally direct result in a change of the diagram. These are: |
| 396 |
% |
| 397 |
% \begin{itemize} |
| 398 |
% \item \DescribeMacro{\verticalcylinder} |
| 399 |
% does not display the outer vertical lines to symbolize a |
| 400 |
% verticalcylindric board. |
| 401 |
% \item \DescribeMacro{\horizontalcylinder} |
| 402 |
% does not display the outer horizontal lines to symbolize a |
| 403 |
% horizontalcylindric board. |
| 404 |
% \item \DescribeMacro{\noframe} |
| 405 |
% does completely suppress the outer frame e.\,g.\ to symbolize a |
| 406 |
% torus board. |
| 407 |
% \item \DescribeMacro{\noinnerframe} |
| 408 |
% sometimes you need to suppress the inner frame instead of the |
| 409 |
% outer frame which is achieved by using |\noinnerframe|. You may |
| 410 |
% not use this together with |\noframe|. |
| 411 |
% \item \DescribeMacro{\gridchess} |
| 412 |
% displays lines to seperates fieldsections for gridchess. |
| 413 |
% \end{itemize} |
| 414 |
% |
| 415 |
% \subsubsection{Modifying the layout of the diagram (and the |
| 416 |
% solution)} |
| 417 |
% There are a couple of switches which control the layout of |
| 418 |
% the diagrams. These are typically used more generally, so you |
| 419 |
% may specify these switches outside the {\ttfamily diagram} |
| 420 |
% environment or use them in your own style, which depends on |
| 421 |
% {\ttfamily cpd.sty}. |
| 422 |
% |
| 423 |
% There are some switches which control the layout of the |
| 424 |
% information which is displayed above a diagram: |
| 425 |
% \begin{itemize} |
| 426 |
% \item \DescribeMacro{\diagleft} |
| 427 |
% displayes the information left aligned |
| 428 |
% \item \DescribeMacro{\diagcenter} |
| 429 |
% displayes the information centered |
| 430 |
% \item \DescribeMacro{\diagright} |
| 431 |
% displayes the information right aligned |
| 432 |
% \item \DescribeMacro{\widedias} |
| 433 |
% is like |\diagcenter| but the information shown above the |
| 434 |
% diagram may span the whole width of the page. So \LaTeX\ will |
| 435 |
% not wrap long author names. |
| 436 |
% \end{itemize} |
| 437 |
% |
| 438 |
% \DescribeMacro{\dianamestyle} |
| 439 |
% \DescribeMacro{\solnamestyle} |
| 440 |
% Using |\dianamestyle| (or |\solnamestyle|) you may specify how |
| 441 |
% authornames are written above the boards (or before the |
| 442 |
% solutions). You may use this only if you use |\reversednames| |
| 443 |
% (which is the default). Otherwise it is not possible to |
| 444 |
% distuingish between firstname and sirname. You must specify one |
| 445 |
% of the following options as parameter to |\dianamestyle| (or |
| 446 |
% |\solnamestyle|): |
| 447 |
% \begin{description} |
| 448 |
% \item[fullname] |
| 449 |
% Writes the authorname as {\itshape firstname sirname}. This is |
| 450 |
% the default. |
| 451 |
% \item[sirname] |
| 452 |
% Writes the {\itshape sirname} only. |
| 453 |
% \item[short] |
| 454 |
% Writes an abbreviation of the {\itshape firstname} and the |
| 455 |
% {\itshape sirname}. The abbreviation is calculated as follows: |
| 456 |
% \begin{itemize} |
| 457 |
% \item The first letter of the {\itshape firstname} will be |
| 458 |
% used.\newline |
| 459 |
% |\author{Brand, Thomas}| will be displayed as {\bfseries T. |
| 460 |
% Brand} |
| 461 |
% \item When there is a combined {\itshape firstname} separated |
| 462 |
% with a hyphen, each first letter will be used. (see |
| 463 |
% below)\newline |
| 464 |
% |\author{Reich, Hans-Peter}| will be displayed as {\bfseries |
| 465 |
% H.-P. Reich} |
| 466 |
% \item When specifying the author name, you may provide the |
| 467 |
% abbreviation for the firstname using the form {\itshape |
| 468 |
% sirname, firstname/abbreviation}.\newline |
| 469 |
% |\author{Brand, Thomas/Th.}| will be displayed as {\bfseries |
| 470 |
% Th.~Brand} |
| 471 |
% \end{itemize} |
| 472 |
% \item[noname] |
| 473 |
% displayes nothing |
| 474 |
% \end{description} |
| 475 |
% |
| 476 |
% \DescribeMacro{\diagnumbering} |
| 477 |
% The same way you may specify |\pagenumbering| you may specify |
| 478 |
% the format the diagrams are numbered using |\diagnumbering| |
| 479 |
% and |\pagenumbering| you may specify {\ttfamily arabic, Roman, roman, |
| 480 |
% Alph or alph}. The default used is {\ttfamily arabic}. |
| 481 |
% This command also switches the display for diagram numbers on. |
| 482 |
% |
| 483 |
% \DescribeMacro{\setmonthstyle} |
| 484 |
% You may also specify the way a month is displayed using |
| 485 |
% |\setmonthstyle|. |
| 486 |
% |
| 487 |
% There are some boolean switches, which control whether a specific |
| 488 |
% information is displayed. These are as follows: |
| 489 |
% \begin{itemize} |
| 490 |
% \item \DescribeMacro{piececounter} |
| 491 |
% This is a \LaTeX\ boolean, which is used to specify whether the |
| 492 |
% number of pieces is displayed below the board. So you may |
| 493 |
% change its value using |\setboolean{piececounter}{true}| or |
| 494 |
% |\setboolean{piececounter}{false}|. |
| 495 |
% \item |
| 496 |
% \DescribeMacro{showcomputer} |
| 497 |
% \DescribeMacro{\nocomputer}\DescribeMacro{\showcomputer} |
| 498 |
% There is a boolean value |computer|, which controls whether the |
| 499 |
% infomration about a computer proof is displayed or not. This |
| 500 |
% value may be changed using |\setboolean{showcomputer}{true}| or |
| 501 |
% |\setboolean{showcomputer}{false}| For backwards compatiblity |
| 502 |
% we support the macros |\nocomputer| and |\showcomputer|. |
| 503 |
% \item \DescribeMacro{showcity} |
| 504 |
% This is a boolean switch, which controls whether the informated |
| 505 |
% gathered using the |\city| command is displayed. The default of |
| 506 |
% this value is |false|. |
| 507 |
% \item \DescribeMacro{showacademictitle} |
| 508 |
% This is a boolean switch, which controls whether academic |
| 509 |
% titles |\Dr|, |\Prof| or |\ProfDr| --- typically used within |
| 510 |
% the |\author| command --- are displayed. The default is |true|. |
| 511 |
% \item \DescribeMacro{legend} |
| 512 |
% This boolean controls whether a legend is displayed. The default |
| 513 |
% value of this value is |false|. When legends are displayed the |
| 514 |
% distance between inner and outer frame is automatically adjusted. |
| 515 |
% \end{itemize} |
| 516 |
% |
| 517 |
% \DescribeMacro{\notcomputerproofedsymbol} |
| 518 |
% \DescribeMacro{\computerproofedsymbol} |
| 519 |
% You may specify the text, which is used indicate, whether a |
| 520 |
% problem is proofed by a computer. To specifiy the symbol for a |
| 521 |
% problem, which is proofed, is created by |
| 522 |
% |\computerproofedsymbol|. To specifiy the symbol for a |
| 523 |
% problem, which is not computer proofed, is created by |
| 524 |
% |\notcomputerproofedsymbol|. You may redefine these commands by |
| 525 |
% standard \LaTeX\ means (|\renewcommand|). |
| 526 |
|
| 527 |
% |
| 528 |
% \DescribeMacro{\selectelchfont} |
| 529 |
% You may specify which font is used for the chesspieces. There |
| 530 |
% are two possible fonts: |
| 531 |
% \begin{description} |
| 532 |
% \item[pk] for the font which was originally used in the german |
| 533 |
% magazine \magazine{Problemkiste} |
| 534 |
% \selectelchfont{pk}\hbox{\wK\wD\wT\wL\wS\wB\sK\sD\sT\sL\sS\sB} |
| 535 |
% \item[fs] for the font which was first used (and was created |
| 536 |
% for) the magazine \magazine{feenschach} |
| 537 |
% \selectelchfont{fs}\hbox{\wK\wD\wT\wL\wS\wB\sK\sD\sT\sL\sS\sB} |
| 538 |
% \end{description} |
| 539 |
% |
| 540 |
% \DescribeMacro{\diagramx} |
| 541 |
% \DescribeMacro{\diagramxi} |
| 542 |
% \DescribeMacro{\diagramxii} |
| 543 |
% In analogy to the defaults for fontsizes of a document you may |
| 544 |
% specify sizes of the fonts used in a diagram. The default will |
| 545 |
% be set according to the fontsize specified as the |
| 546 |
% |\documentclass| option. |
| 547 |
% |
| 548 |
% \subsubsection{Other commands} |
| 549 |
% \begin{itemize} |
| 550 |
% \item \DescribeMacro{\label} |
| 551 |
% This overrides the normal |\label| definition such that the |
| 552 |
% diagram number is displayed when using |\ref| instead of the |
| 553 |
% page number. |
| 554 |
% \item \DescribeMacro{\diagnum} |
| 555 |
% This macro expects a number as a parameter. The number will be used to |
| 556 |
% (re-)initialize the diagram number counter. With this command the output of |
| 557 |
% diagram numbers also is switched on. It must be used outside the {\ttfamily |
| 558 |
% diagram} environment. As an optional parameter you may specify something, |
| 559 |
% which will be used as prefix before the automatically updated diagram numbers. |
| 560 |
% E.\,g.\ the command \verb+\diagnum[T-]{4}+ will produce the following diagram numbers for the |
| 561 |
% following diagrams: \textbf{T-4}, \textbf{T-5}, \textbf{T-6}, \dots{} |
| 562 |
% \end{itemize} |
| 563 |
% |
| 564 |
% |
| 565 |
% \subsection{Special boards} |
| 566 |
% \subsubsection{Changing the boardsize} |
| 567 |
% \DescribeEnv{diagram[]} |
| 568 |
% Instead of using a boardsize of $8\times8$ some fairy problems |
| 569 |
% need smaller or larger boards. This can be achieved by |
| 570 |
% specifying the rows and columns as an optional parameter to the |
| 571 |
% |\begin{diagram}| environment. You first have to specify the |
| 572 |
% columns and then the rows as the following examples shows. |
| 573 |
% |
| 574 |
% \bigskip |
| 575 |
% \begin{diagram}[17x11] |
| 576 |
% \label{bigdia} |
| 577 |
% \pieces{wKUi{11}, sKRj9, sCc5b4} |
| 578 |
% \end{diagram} |
| 579 |
% \hspace{2em} |
| 580 |
% \begin{minipage}[t]{7cm} |
| 581 |
% \vspace*{-5cm} |
| 582 |
% is created by |
| 583 |
% |
| 584 |
% \bigskip |
| 585 |
% \begin{verbatim} |
| 586 |
% \begin{diagram}[17x11] |
| 587 |
% \label{bigdia} |
| 588 |
% \pieces{wKUi{11}, sKRj9, sCc5b4} |
| 589 |
% \end{diagram} |
| 590 |
% \end{verbatim} |
| 591 |
% \end{minipage} |
| 592 |
% |
| 593 |
% As you can see in the example, pieces are set using the |
| 594 |
% |\pieces| macro. When using boards with more than 8 lines you |
| 595 |
% have to continue with charachters {\bfseries i, j, k, \dots}\@ |
| 596 |
% In a board with more than 9 rows you have to specify the rows |
| 597 |
% in curly braces \{ \} as shown in the example. |
| 598 |
% |
| 599 |
% \subsubsection{Stereo- and Space-Chess-Diagrams} |
| 600 |
% \DescribeEnv{stereodiagram} |
| 601 |
% \DescribeEnv{spacediagram[]} |
| 602 |
% Other boards which are used from time to time are stereochess |
| 603 |
% or spacechess boards (although there are quite few people which |
| 604 |
% really have such boards!). To create these boards you just have |
| 605 |
% to use either the |stereodiagram| or |spacediagram| environment |
| 606 |
% instead of the normal |diagram| environment. Here is an |
| 607 |
% example: |
| 608 |
% |
| 609 |
% |
| 610 |
% \begin{stereodiagram} |
| 611 |
% \author{Jensch, Gerhard W.} |
| 612 |
% \sourcenr{3104.} |
| 613 |
% \source{feenschach} |
| 614 |
% \year{1980} |
| 615 |
% \award{Preis} |
| 616 |
% \pieces{wKf3, wTf6d5A, wLe3, wSf4A, sKe5, sTc4D, sLc4C, sSc6, sBb6c4A} |
| 617 |
% \stip{\#9} |
| 618 |
% \end{stereodiagram} |
| 619 |
% \hfill |
| 620 |
% \begin{spacediagram} |
| 621 |
% \author{Dawson, T. R.} |
| 622 |
% \sourcenr{6595.} |
| 623 |
% \source{Fairy Chess Review} |
| 624 |
% \month{12} |
| 625 |
% \year{1945} |
| 626 |
% \pieces{wKc1A, wLe1A, sKa1A, sBa2Aa1Ba2Bd3Be4Bd2Ce2D} |
| 627 |
% \stip{\#2} |
| 628 |
% \end{spacediagram} |
| 629 |
% |
| 630 |
% These diagrams have been produced by the following code: |
| 631 |
% |
| 632 |
% \begin{verbatim} |
| 633 |
% \begin{stereodiagram} |
| 634 |
% \author{Jensch, Gerhard W.} |
| 635 |
% \sourcenr{3104.} |
| 636 |
% \source{feenschach} |
| 637 |
% \year{1980} |
| 638 |
% \award{Preis} |
| 639 |
% \pieces{wKf3, wTf6d5A, wLe3, wSf4A, sKe5, sTc4D, sLc4C, sSc6, sBb6c4A} |
| 640 |
% \stip{\#9} |
| 641 |
% \end{stereodiagram} |
| 642 |
% \hfill |
| 643 |
% \begin{spacediagram} |
| 644 |
% \author{Dawson, T. R.} |
| 645 |
% \sourcenr{6595}. |
| 646 |
% \source{Fairy Chess Review} |
| 647 |
% \month{12} |
| 648 |
% \year{1945} |
| 649 |
% \pieces{wKc1A, wLe1A, sKa1A, sBa2Aa1Ba2Bd3Be4Bd2Ce2D} |
| 650 |
% \stip{\#2} |
| 651 |
% \end{spacediagram} |
| 652 |
% \end{verbatim} |
| 653 |
% |
| 654 |
% The main change is within the notation of the pieces, but |
| 655 |
% people knowing space- or stereo-chess problems see that the |
| 656 |
% notation is just one would expect. |
| 657 |
% |
| 658 |
% \DescribeMacro{\spacelayout} |
| 659 |
% Sometimes one would like show the different planes of a |
| 660 |
% space diagram from left to right. This may be switched using |
| 661 |
% the |\spacelayout| command, which takes one parameter: |
| 662 |
% |
| 663 |
% \begin{description} |
| 664 |
% \item[vertical] for planes organized bottom up |
| 665 |
% \item[horizontal] for planes organized left to right |
| 666 |
% \end{description} |
| 667 |
% |
| 668 |
% \noindent\begin{spacediagram}[4x2x3] |
| 669 |
% \spacelayout{horizontal} |
| 670 |
% \end{spacediagram} |
| 671 |
% \hfill% |
| 672 |
% \hbox{\vbox{% |
| 673 |
% \hsize6cm |
| 674 |
% Is produced by |
| 675 |
% |
| 676 |
% \begin{verbatim} |
| 677 |
% \begin{spacediagram}[4x2x3] |
| 678 |
% \spacelayout{horizontal} |
| 679 |
% \end{spacediagram} |
| 680 |
% \end{verbatim} |
| 681 |
% }} |
| 682 |
% |
| 683 |
% \subsubsection{Cylindric boards / suppressing frames} |
| 684 |
% \noindent\hbox{}% |
| 685 |
% \DescribeMacro{\horizontalcylinder} |
| 686 |
% \DescribeMacro{\verticalcylinder} |
| 687 |
% \DescribeMacro{\noframe} |
| 688 |
% \DescribeMacro{\noinnerframe} |
| 689 |
% To stylize a cylindric board one typically does not show parts |
| 690 |
% of the frame. When using |\verticalcylinder|\, the horizontal |
| 691 |
% lines of the outer frame will not be drawn. |
| 692 |
% |\horizontalcylinder|\, suppresses the drawing of the vertical |
| 693 |
% lines of the outer frame. Using |\noframe|\, completely supresses |
| 694 |
% the outer frame. |\noinnerframe|\, suppresses the innerframe. |
| 695 |
% In case of stereo- or space-chess-diagrams |\verticalcylinder|, |
| 696 |
% |\horizontalcylinder|\, and |\noframe|\, suppresses the inner |
| 697 |
% frame. |
| 698 |
% |
| 699 |
% \subsection{Change the coloring of the fields} |
| 700 |
% \DescribeMacro{\allwhite} |
| 701 |
% The \verb+allwhite+ boolean can be used to have all white squares. Therefore |
| 702 |
% dotted lines are produced to separate the squares. For convenience we |
| 703 |
% provide a command \verb+allwhite+ which switches the value of the |
| 704 |
% \verb+allwhite+ boolean to true. |
| 705 |
% |
| 706 |
% \bigskip |
| 707 |
% \begin{diagram} |
| 708 |
% \allwhite |
| 709 |
% \pieces{wKe1, wDd1, wTa1h1, wLf1c1, wSb1g1, sKe8, sDd8, sTa8h8, sLf8c8, sSb8g8} |
| 710 |
% \end{diagram} |
| 711 |
% \hfill |
| 712 |
% \begin{minipage}[b]{7cm} |
| 713 |
% \vspace*{-3cm} |
| 714 |
% This was produced by: |
| 715 |
% |
| 716 |
% \begin{verbatim} |
| 717 |
% \begin{diagram} |
| 718 |
% \allwhite |
| 719 |
% \pieces{wKe1, wDd1, wTa1h1, wLf1c1, wSb1g1, % |
| 720 |
% sKe8, sDd8, sTa8h8, sLf8c8, sSb8g8} |
| 721 |
% \end{diagram} |
| 722 |
% \end{verbatim} |
| 723 |
% \end{minipage} |
| 724 |
% |
| 725 |
% \DescribeMacro{\switchcolors} |
| 726 |
% The boolean \verb+switchcolors+ may be used to switch the coloring of white |
| 727 |
% and black fields. For convenience we provide a command \verb+switchcolors+ |
| 728 |
% which switches the value of the \verb+switchcolors+ boolean to true. |
| 729 |
% |
| 730 |
% \bigskip |
| 731 |
% \begin{diagram} |
| 732 |
% \switchcolors |
| 733 |
% \end{diagram} |
| 734 |
% |
| 735 |
% |
| 736 |
% \subsubsection{figurine Notation} |
| 737 |
% \DescribeEnv{figurine} |
| 738 |
% Instead of using the |diagram|, |stereodiagram| or |
| 739 |
% |spacediagram| environment one may use the |figurine| |
| 740 |
% environment. This suppresses the diagram output and produces a |
| 741 |
% figurine notation inside the current text. |
| 742 |
% |
| 743 |
% \subsubsection{Changes within the board} |
| 744 |
% \DescribeMacro{\nofields} |
| 745 |
% \DescribeMacro{\nosquares} |
| 746 |
% You may remove single fields by using the |\nofields| or |
| 747 |
% |\nosquares| command. Using this command does make sense for |
| 748 |
% empty black fields only. This command expects a list of squares |
| 749 |
% separated by ``,~''. You may also use this command within a |
| 750 |
% stereo- or space-diagram. In this case you must specify the |
| 751 |
% fields the same way you do it inside the |\pieces| command. |
| 752 |
% |
| 753 |
% \DescribeMacro{\fieldframe} |
| 754 |
% You may specify single fields, which should be surrounded by a |
| 755 |
% frame. This is possible using the |\fieldframe| command. You |
| 756 |
% must specify the list of fields which should have frames the |
| 757 |
% same way you specify fields within the |\nofields| command. |
| 758 |
% |
| 759 |
% \DescribeMacro{\gridlines} |
| 760 |
% A more general form of lines within diagrams is possible by |
| 761 |
% using the |\gridlines| command. You may specify a list of |
| 762 |
% horizontal or vertical lines within the diagram. Different |
| 763 |
% lines should be separated by ``,~''. A single line must be |
| 764 |
% specified as: |
| 765 |
% |
| 766 |
% [plane](v or h)(x-coordinate)(y-coordinate)(length in squares) |
| 767 |
% |
| 768 |
% You must specify a plane in case of stereo- or space-chess |
| 769 |
% only. For a vertical line starting at the lower left corner of |
| 770 |
% ``c2'' ending at the upper left corner of ``c8'' the command to |
| 771 |
% use is: |\gridlines{v217}|\@. Concerning the coordinates and |
| 772 |
% length specifications you should pay attention to put values |
| 773 |
% greater 9 in curly braces \{ \}. |
| 774 |
% |
| 775 |
% \DescribeMacro{\fieldtext} |
| 776 |
% Sometimes you need to show text on some squares. This is done |
| 777 |
% using the |\fieldtext| command. The syntax for a single text |
| 778 |
% is: \{Text\}(x-coordinate)(y-coordinate) |
| 779 |
% |
| 780 |
% Now an example how to use |\gridlines|, |\nofields| and |
| 781 |
% |\fieldtext| to create some ``{\itshape Letter-Board}'' with text |
| 782 |
% inside. |
| 783 |
% |
| 784 |
% \bigskip |
| 785 |
% \begin{diagram}[9x7] |
| 786 |
% \label{Buchstabenbrett} |
| 787 |
% \noinnerframe |
| 788 |
% \nofields{a2, b2, c2, a3, b3, c3, % |
| 789 |
% b5, c5, d5, b6, c6, d6, % |
| 790 |
% e1, e2, e3, e4, e5, e6, e7, % |
| 791 |
% g1, h1, h2, h2, g3, h3, g5, h5, g6, h6, g7, h7} |
| 792 |
% \gridlines{h004, h013, h033, h143, h163, h074, % |
| 793 |
% v001, v034, v142, v312, v404, v461, % |
| 794 |
% h501, h571, h632, h642, h801, h871, % |
| 795 |
% v507, v603, v643, v803, v843, v907} |
| 796 |
% \fieldtext{{It ...}c5, {works}b2} |
| 797 |
% \end{diagram} |
| 798 |
% \hfill |
| 799 |
% \begin{minipage}[b]{10cm} |
| 800 |
% \begin{verbatim} |
| 801 |
% \begin{diagram}[9x7] |
| 802 |
% \noinnerframe |
| 803 |
% \nofields{a2, b2, c2, a3, b3, c3, % |
| 804 |
% b5, c5, d5, b6, c6, d6, % |
| 805 |
% e1, e2, e3, e4, e5, e6, e7, % |
| 806 |
% g1, h1, h2, h2, g3, h3, g5, h5, g6, h6, g7, h7} |
| 807 |
% \gridlines{h004, h013, h033, h143, h163, h074, % |
| 808 |
% v001, v034, v142, v312, v404, v461, % |
| 809 |
% h501, h571, h632, h642, h801, h871, % |
| 810 |
% v507, v603, v643, v803, v843, v907} |
| 811 |
% \fieldtext{{It ...}c5, {works}b2} |
| 812 |
% \end{diagram} |
| 813 |
% \end{verbatim} |
| 814 |
% \end{minipage} |
| 815 |
% |
| 816 |
% |
| 817 |
% \subsection{Misc} |
| 818 |
% \subsubsection{Chess pieces within normal text} |
| 819 |
% Sometimes you may need symbols of chess pieces within your |
| 820 |
% normal text, e.\,g. to show the {\itshape |
| 821 |
% Viele-V\"ater-Stellung} {\wK}c8, {\wB}b6, {\sK}a8, {\sB}a7. |
| 822 |
% This is possible by |{\wK}c8, {\wB}b6, {\sK}a8, {\sB}a7|. |
| 823 |
% Additionally you may use some of these symbols: |
| 824 |
% \begin{description} |
| 825 |
% \item[\swL] |
| 826 |
% \DescribeMacro{\swL} |
| 827 |
% a white bishop on a black square |
| 828 |
% \item[\ssL] |
| 829 |
% \DescribeMacro{\ssL} |
| 830 |
% a black bishop on a black square |
| 831 |
% \item[\wNr] |
| 832 |
% \DescribeMacro{\wNr} |
| 833 |
% a white nightrider |
| 834 |
% \item[\nNr] |
| 835 |
% \DescribeMacro{\nNr} |
| 836 |
% a neutral nightrider |
| 837 |
% \item[\sNr] |
| 838 |
% \DescribeMacro{\sNr} |
| 839 |
% a black nightrider |
| 840 |
% \item[\wGh] |
| 841 |
% \DescribeMacro{\wGh} |
| 842 |
% a white grashopper |
| 843 |
% \item[\nGh] |
| 844 |
% \DescribeMacro{\nGh} |
| 845 |
% a neutral grashopper |
| 846 |
% \item[\sGh] |
| 847 |
% \DescribeMacro{\sGh} |
| 848 |
% a black grashopper |
| 849 |
% \item[\Imi] |
| 850 |
% \DescribeMacro{\Imi} |
| 851 |
% an imitator, you may also use the {\bfseries Circle} notation: |
| 852 |
% \item[\wC] |
| 853 |
% \DescribeMacro{\wC} |
| 854 |
% a white circle |
| 855 |
% \item[\nC] |
| 856 |
% \DescribeMacro{\nC} |
| 857 |
% a neutral circle |
| 858 |
% \item[\sC] |
| 859 |
% \DescribeMacro{\sC} |
| 860 |
% a black circle |
| 861 |
% \item[\wE] |
| 862 |
% \DescribeMacro{\wE} |
| 863 |
% a white equihopper |
| 864 |
% \item[\sE] |
| 865 |
% \DescribeMacro{\sE} |
| 866 |
% a black equihopper |
| 867 |
% \item[\nE] |
| 868 |
% \DescribeMacro{\nE} |
| 869 |
% a neutral equihopper |
| 870 |
% \item[\wX] |
| 871 |
% \DescribeMacro{\wX} |
| 872 |
% a white rotated equihopper |
| 873 |
% \item[\sX] |
| 874 |
% \DescribeMacro{\sX} |
| 875 |
% a black rotated equihopper |
| 876 |
% \item[\nX] |
| 877 |
% \DescribeMacro{\nX} |
| 878 |
% a neutral rotated equihopper |
| 879 |
% \end{description} |
| 880 |
% |
| 881 |
% \subsubsection{Other often used symbols} |
| 882 |
% The style also defines commands for other symbols, which are |
| 883 |
% often used within the declaration of twins or when writing a |
| 884 |
% solution: |
| 885 |
% \begin{description} |
| 886 |
% \item[\set] |
| 887 |
% \DescribeMacro{\set} |
| 888 |
% setplay |
| 889 |
% \item[\ra] |
| 890 |
% \DescribeMacro{\ra} |
| 891 |
% a left to right arrow |
| 892 |
% \item[\lra] |
| 893 |
% \DescribeMacro{\lra} |
| 894 |
% a double ended arrow |
| 895 |
% \item[\OO] |
| 896 |
% \DescribeMacro{\OO} |
| 897 |
% king side castling |
| 898 |
% \item[\OOO] |
| 899 |
% \DescribeMacro{\OOO} |
| 900 |
% queen side castling |
| 901 |
% \item[\x] |
| 902 |
% \DescribeMacro{\x} |
| 903 |
% for ``takes'' |
| 904 |
% \item[\any] |
| 905 |
% \DescribeMacro{\any} |
| 906 |
% for an arbitrary move (you must not simply use a \verb+~+ within your |
| 907 |
% text because \TeX\ handles this as a protected space) |
| 908 |
% \end{description} |
| 909 |
% |
| 910 |
% \DescribeEnv{arrowskip} |
| 911 |
% It is possible, to define a prefix and/or a suffix to use before and |
| 912 |
% after arrows - typically a common separating space. Per default |
| 913 |
% there is no such space. You may use the \verb+arrowskip+ environment |
| 914 |
% have a common prefix and suffix before and after arrows: |
| 915 |
% |
| 916 |
% \begin{verbatim} |
| 917 |
% \begin{arrowskip}{a\,}{\,b} |
| 918 |
% ... |
| 919 |
% \end{arrowskip} |
| 920 |
% \end{verbatim} |
| 921 |
% |
| 922 |
% ... will prefix arrows produced with |\ra| or |\lra| with \verb+a\,+ |
| 923 |
% and suffix with \verb+\,b+. |
| 924 |
% |
| 925 |
% \subsubsection{Internationalization} |
| 926 |
% \DescribeMacro{\DefinePieces} |
| 927 |
% This part is relevant for people who do not like the german |
| 928 |
% notation for pieces and therefore want to change this within |
| 929 |
% their sources. Using the german notation, you specify the color |
| 930 |
% of a piece as {\bfseries w}, {\bfseries s} or {\bfseries n}, |
| 931 |
% the type of a piece as {\bfseries K}, {\bfseries D}, {\bfseries T}, |
| 932 |
% {\bfseries L}, {\bfseries S}, {\bfseries B} and a possible |
| 933 |
% rotation of a piece as {\bfseries L}, {\bfseries R} or |
| 934 |
% {\bfseries U}. To use another notation you may use the |
| 935 |
% |\DefinePieces| command which takes 3 parameters. |
| 936 |
% \begin{enumerate} |
| 937 |
% \item the letters used to specify the colors of the pieces |
| 938 |
% using the order white, black, neutral |
| 939 |
% \item the letters used to specify the type of a piece using the |
| 940 |
% order king, queen, rook, bishop, knight, pawn. You may not |
| 941 |
% use the characters {\bfseries C, E} and {\bfseries X}, because these are |
| 942 |
% used for Circle, Equihopper and rotated Equihopper. |
| 943 |
% \item the letters used to specify an optional rotation using |
| 944 |
% the order left-turned, right-turned, upside-down. You must use |
| 945 |
% capital letters for this. |
| 946 |
% \end{enumerate} |
| 947 |
% |
| 948 |
% When using a |\DefinePieces| command, the commands are changed |
| 949 |
% to its next usage (or to the end of the document). The command |
| 950 |
% not only changes the pieces you may use within the |\pieces| |
| 951 |
% command but also defines commands to be used within normal |
| 952 |
% text, as the following example shows: |
| 953 |
% |
| 954 |
% \noindent|\DefinePieces{wbn}{KQRBNP}{LRU}|\newline |
| 955 |
% |\wDU\bKR\bwB|\newline |
| 956 |
% \DefinePieces{wbn}{KQRBNP}{LRU} |
| 957 |
% creates \wDU\bKR\bwB |
| 958 |
% |
| 959 |
% \subsubsection{When writing books} |
| 960 |
% \DescribeMacro{\develop} |
| 961 |
% To simplify your writings you may use the macro |
| 962 |
% |\develop|. This will create the following additional information during |
| 963 |
% developement: |
| 964 |
% \begin{itemize} |
| 965 |
% \item when you use |\label| in your diagrams the label will be |
| 966 |
% shown at the left upper corner of the diagram. |
| 967 |
% \item The given label will also be shown inside the solution |
| 968 |
% and also in any register entry. |
| 969 |
% \item when you have specified a |\judgement| this information |
| 970 |
% will be put into the solution. |
| 971 |
% \end{itemize} |
| 972 |
% |
| 973 |
% Most books on chessproblems contain registers for authors, |
| 974 |
% sometimes also on themes and sources. As you already collect |
| 975 |
% all these information very detailed within the |diagram| |
| 976 |
% environment the generation of registers is very simple. |
| 977 |
% |
| 978 |
% \DescribeMacro{\makeaindex} |
| 979 |
% \DescribeMacro{\authorindex} |
| 980 |
% To create a registers of authors you need to put the |
| 981 |
% |\makeaindex| command inside the preamble of your document. |
| 982 |
% This instructs latex to write an intermediate file containing |
| 983 |
% information about authors and the numbers of the |
| 984 |
% diagrams.\footnote{Normally registers contain page numbers but |
| 985 |
% with chess problems normally people refer to the diagram |
| 986 |
% numbers.} After a first \LaTeX\ run on your document, you need |
| 987 |
% to convert the intermediate file. This may be done with the |
| 988 |
% |makeindex| program, which will typically called like |
| 989 |
% |
| 990 |
% \noindent|makeindex -o <filename>.and <filename>.adx| |
| 991 |
% |
| 992 |
% The resulting register may be put into your document using the |
| 993 |
% |\authorindex| command. |
| 994 |
% |
| 995 |
% |
| 996 |
% \DescribeMacro{\makesindex} |
| 997 |
% \DescribeMacro{\sourceindex} |
| 998 |
% \DescribeMacro{\maketindex} |
| 999 |
% \DescribeMacro{\themeindex} |
| 1000 |
% Like an index for authors you may also create indices for |
| 1001 |
% sources and/or themes. For an source register you need to put |
| 1002 |
% |\makesindex| into your document preamble; for a theme register |
| 1003 |
% the command is |\maketindex|. The conversion commands for the |
| 1004 |
% intermediate files are |
| 1005 |
% |
| 1006 |
% \noindent|makeindex -o <filename>.snd <filename>.sdx| |
| 1007 |
% \newline for the source register and |
| 1008 |
% |
| 1009 |
% \noindent|makeindex -o <filename>.tnd <filename>.tdx| |
| 1010 |
% \newline for the theme register. |
| 1011 |
% |
| 1012 |
% The source register is inserted into the text using |
| 1013 |
% |\sourceindex| and the theme register using |\themeindex|. |
| 1014 |
% |
| 1015 |
% \subsubsection{Other useful stuff} |
| 1016 |
% \DescribeMacro{\solpar} |
| 1017 |
% In some environments --- like \verb+window+ --- the use of \verb+\par+ leads to unwanted |
| 1018 |
% effects. Therefore we use the command \verb+\solpar+ inside the |
| 1019 |
% definition of \verb+\@dia@solution+, which is used to display |
| 1020 |
% a single solution when using \verb+\putsol+. You may use |
| 1021 |
% \verb+\renewcommand{\solpar}+ to provide another definition of |
| 1022 |
% \verb+\solpar+ in such situations. |
| 1023 |
% |
| 1024 |
% \DescribeMacro{\insidediagram} |
| 1025 |
% The problem information collected by some commands may be used in |
| 1026 |
% different places (author names will be shown above the diagram and |
| 1027 |
% at the beginning of solutions when output using \verb+\putsol+). |
| 1028 |
% Therefore we need some special handling of e.g. footnotes, to avoid |
| 1029 |
% creating the footnotemarks multiple times. Such commands should be |
| 1030 |
% used within \verb+\insidediagram+ as shown by the following example: |
| 1031 |
% |
| 1032 |
% \begin{verbatim} |
| 1033 |
% \begin{diagram} |
| 1034 |
% \author{Else\insidediagram{\footnotemark}, Someone} |
| 1035 |
% \end{diagram} |
| 1036 |
% \end{verbatim} |
| 1037 |
% |
| 1038 |
% \StopEventually{\PrintIndex\PrintChanges} |
| 1039 |
% |
| 1040 |
% \section{The documentation driver} |
| 1041 |
% The following code will generate the documentation. Since it is |
| 1042 |
% the first piece of code in the file, the documentation can be |
| 1043 |
% obtained by simply processing the file with \LaTeXe. |
| 1044 |
% \begin{macrocode} |
| 1045 |
%<*driver> |
| 1046 |
\documentclass[a4paper]{article} |
| 1047 |
\usepackage{doc} |
| 1048 |
\usepackage{diagram} |
| 1049 |
\EnableCrossrefs |
| 1050 |
\CodelineIndex |
| 1051 |
\RecordChanges |
| 1052 |
\begin{document} |
| 1053 |
\DocInput{diagram.dtx} |
| 1054 |
\end{document} |
| 1055 |
%</driver> |
| 1056 |
% \end{macrocode} |
| 1057 |
% |
| 1058 |
% \section{The implementation of the style} |
| 1059 |
% Specifies the preamble of our style file. |
| 1060 |
% \begin{macrocode} |
| 1061 |
%<*style> |
| 1062 |
\ProvidesPackage{diagram}[2025/02/21-tikz] |
| 1063 |
% \end{macrocode} |
| 1064 |
% |
| 1065 |
% \begin{macro}{\DefaultDiagramSize} |
| 1066 |
% The \verb+\DefaultDiagramSize+ may be used in code to switch to the |
| 1067 |
% default diagram size. As this depends on the documents default font |
| 1068 |
% size we use the same option and execute \textit{10pt} as default. |
| 1069 |
% \begin{macrocode} |
| 1070 |
\newcommand*{\DefaultDiagramSize}{} |
| 1071 |
\DeclareOption{10pt}{\renewcommand*{\DefaultDiagramSize}{\diagramx}} |
| 1072 |
\DeclareOption{11pt}{\renewcommand*{\DefaultDiagramSize}{\diagramxi}} |
| 1073 |
\DeclareOption{12pt}{\renewcommand*{\DefaultDiagramSize}{\diagramxii}} |
| 1074 |
\ExecuteOptions{10pt} |
| 1075 |
% \end{macrocode} |
| 1076 |
% \end{macro} |
| 1077 |
|
| 1078 |
% \begin{macrocode} |
| 1079 |
\ProcessOptions |
| 1080 |
\AtBeginDocument{\DefaultDiagramSize} |
| 1081 |
% \end{macrocode} |
| 1082 |
% |
| 1083 |
% \begin{macrocode} |
| 1084 |
\RequirePackage{ifthen} |
| 1085 |
\RequirePackage{calc} |
| 1086 |
\RequirePackage{tikz} |
| 1087 |
\RequirePackage{xstring} |
| 1088 |
% \end{macrocode} |
| 1089 |
%% |
| 1090 |
%% |
| 1091 |
%% |
| 1092 |
% Now we declare some constants to unify its usage within the |
| 1093 |
% style file. |
| 1094 |
% \begin{macrocode} |
| 1095 |
\chardef\f@ur=4 |
| 1096 |
\chardef\@ight=8 |
| 1097 |
\newcount\elchfont |
| 1098 |
|
| 1099 |
\chardef\@pkelch=0 |
| 1100 |
\chardef\@fselch=1 |
| 1101 |
|
| 1102 |
\newcount\dia@type |
| 1103 |
|
| 1104 |
\newboolean{@textproblem} |
| 1105 |
\setboolean{@textproblem}{false} |
| 1106 |
\def\textproblem{\setboolean{@textproblem}{true}\let\@dia@stipulation=\relax} |
| 1107 |
|
| 1108 |
\newboolean{@solafterdiagram} |
| 1109 |
\setboolean{@solafterdiagram}{false} |
| 1110 |
\def\solafterdiagram{\setboolean{@solafterdiagram}{true}\ignorespaces} |
| 1111 |
|
| 1112 |
\newif\if@vframe\@vframetrue |
| 1113 |
\newif\if@hframe\@hframetrue |
| 1114 |
\newif\if@leaveOuter\@leaveOutertrue |
| 1115 |
|
| 1116 |
\newif\if@shortform |
| 1117 |
|
| 1118 |
\newif\ifspace@vertical |
| 1119 |
\def\spacehorizontal{\space@verticalfalse} |
| 1120 |
|
| 1121 |
% \newif\ifdi@no |
| 1122 |
\newboolean{@cpd@numbering@global} |
| 1123 |
\newboolean{@cpd@numbering@local} |
| 1124 |
\newcounter{board@nr} |
| 1125 |
\renewcommand{\theboard@nr}{\thediag} |
| 1126 |
% \newif\iffigcnt |
| 1127 |
\newboolean{piececounter} |
| 1128 |
|
| 1129 |
\newcounter{cpd@piece@index} |
| 1130 |
|
| 1131 |
\newboolean{showcity} |
| 1132 |
\setboolean{showcity}{false} |
| 1133 |
\newboolean{showacademictitle} |
| 1134 |
\setboolean{showacademictitle}{true} |
| 1135 |
\newboolean{legend} |
| 1136 |
\setboolean{legend}{false} |
| 1137 |
|
| 1138 |
\newcount\@blackfield |
| 1139 |
\newboolean{allwhite} |
| 1140 |
\setboolean{allwhite}{false} |
| 1141 |
\newcommand{\allwhite}{\setboolean{allwhite}{true}} |
| 1142 |
\newcounter{field@border} |
| 1143 |
\newcount\@whitefield |
| 1144 |
\newboolean{switchcolors} |
| 1145 |
\setboolean{switchcolors}{false} |
| 1146 |
\newcommand{\switchcolors}{\setboolean{switchcolors}{true}} |
| 1147 |
% \end{macrocode} |
| 1148 |
% |
| 1149 |
% We have counters for each color to count the pieces on the |
| 1150 |
% board. |
| 1151 |
% \begin{macrocode} |
| 1152 |
\newboolean{cpd@checkPieceCounts} |
| 1153 |
\newcounter{cpd@defWhitePieces} |
| 1154 |
\newcounter{cpd@defBlackPieces} |
| 1155 |
\newcounter{cpd@defNeutralPieces} |
| 1156 |
|
| 1157 |
\newcounter{cpd@whitePieces} |
| 1158 |
\newcounter{cpd@blackPieces} |
| 1159 |
\newcounter{cpd@neutralPieces} |
| 1160 |
|
| 1161 |
\newcommand{\cpd@stepcounterWhite}{\stepcounter{cpd@whitePieces}} |
| 1162 |
\newcommand{\cpd@stepcounterBlack}{\stepcounter{cpd@blackPieces}} |
| 1163 |
\newcommand{\cpd@stepcounterNeutral}{\stepcounter{cpd@neutralPieces}} |
| 1164 |
\global\let\cpd@stepcounterPieces\relax |
| 1165 |
|
| 1166 |
\newcount\help@a |
| 1167 |
|
| 1168 |
\newbox\dia@box |
| 1169 |
\newbox\@cnt@box |
| 1170 |
\newdimen\@cnt@wd |
| 1171 |
\newbox\@stip@box |
| 1172 |
|
| 1173 |
\newdimen\topdist\topdist\z@ |
| 1174 |
\newbox\@test@box |
| 1175 |
\newdimen\@test@dimen |
| 1176 |
\newif\if@left |
| 1177 |
|
| 1178 |
\newdimen\dia@lineskip |
| 1179 |
|
| 1180 |
\newdimen\board@width |
| 1181 |
\newdimen\bd@width |
| 1182 |
\newdimen\head@width |
| 1183 |
\newdimen\sq@width |
| 1184 |
|
| 1185 |
\newdimen\grid@width |
| 1186 |
\newdimen\inner@frame |
| 1187 |
\newdimen\outer@frame |
| 1188 |
\newdimen\space@frame |
| 1189 |
\newdimen\v@frame@dist |
| 1190 |
\newdimen\h@frame@dist |
| 1191 |
\newdimen\space@frame@dist |
| 1192 |
\newdimen\v@space@dist |
| 1193 |
\newdimen\h@space@dist |
| 1194 |
|
| 1195 |
\newbox\sq@box |
| 1196 |
\newbox\plane@box |
| 1197 |
% \end{macrocode} |
| 1198 |
% |
| 1199 |
% We need a lot of token registers to register the information |
| 1200 |
% from within the |diagram| environment. These token registers |
| 1201 |
% are defined here. Initially each token register is defined to |
| 1202 |
% contain |\relax|, which serves as an {\itshape end-marker} when |
| 1203 |
% parsing lists. |
| 1204 |
% \begin{macrocode} |
| 1205 |
\newtoks\typis@tk\typis@tk={\relax} |
| 1206 |
\newtoks\label@tk\label@tk={\relax} |
| 1207 |
\newtoks\sol@tk\sol@tk={\relax} |
| 1208 |
\newtoks\number@tk\number@tk={\relax} |
| 1209 |
\newtoks\aut@tk\aut@tk={\relax} |
| 1210 |
\newtoks\city@tk\city@tk={\relax} |
| 1211 |
\newtoks\sourcenr@tk\sourcenr@tk={\relax} |
| 1212 |
\newtoks\source@tk\source@tk={\relax} |
| 1213 |
\newtoks\day@tk\day@tk={\relax} |
| 1214 |
\newcount\from@month\from@month=\z@ |
| 1215 |
\newcount\to@month\to@month=\z@ |
| 1216 |
\newtoks\year@tk\year@tk={\relax} |
| 1217 |
\newtoks\issue@tk\issue@tk={\relax} |
| 1218 |
\newtoks\pages@tk\pages@tk={\relax} |
| 1219 |
\newtoks\tournament@tk\tournament@tk={\relax} |
| 1220 |
\newtoks\award@tk\award@tk={\relax} |
| 1221 |
\newtoks\after@tk\after@tk={\relax} |
| 1222 |
\newtoks\version@tk\version@tk={\relax} |
| 1223 |
\newtoks\correction@tk\correction@tk={\relax} |
| 1224 |
\newtoks\dedic@tk\dedic@tk={\relax} |
| 1225 |
\newtoks\fidealbum@tk\fidealbum@tk={\relax} |
| 1226 |
\newtoks\theme@tk\theme@tk={\relax} |
| 1227 |
\newtoks\twins@tk\twins@tk={\relax} |
| 1228 |
\newtoks\judgement@tk\judgement@tk={\relax} |
| 1229 |
\newtoks\comment@tk\comment@tk={\relax} |
| 1230 |
\newtoks\computer@tk\computer@tk={-} |
| 1231 |
\newtoks\nofields@tk\nofields@tk={\relax} |
| 1232 |
\newtoks\fieldframe@tk\fieldframe@tk={\relax} |
| 1233 |
\newtoks\gridlines@tk\gridlines@tk={\relax} |
| 1234 |
\newtoks\pieces@tk\pieces@tk={\relax} |
| 1235 |
\newtoks\fen@tk\fen@tk={\relax} |
| 1236 |
\newtoks\fieldtext@tk\fieldtext@tk={\relax} |
| 1237 |
\newtoks\text@tk\text@tk={\relax} |
| 1238 |
\newtoks\stipulation@tk\stipulation@tk={\relax} |
| 1239 |
\newtoks\condition@tk\condition@tk={\relax} |
| 1240 |
\newtoks\remark@tk\remark@tk={\relax} |
| 1241 |
\newtoks\piecedefs@tk\piecedefs@tk={\relax} |
| 1242 |
\newtoks\@cpd@emptytest |
| 1243 |
% \end{macrocode} |
| 1244 |
% |
| 1245 |
% To remember, which information has been specified, we define |
| 1246 |
% \TeX-booleans for each command. |
| 1247 |
% \begin{macrocode} |
| 1248 |
\newif\if@label\@labelfalse |
| 1249 |
\newif\if@number\@numberfalse |
| 1250 |
\newif\if@special\@specialfalse |
| 1251 |
\newif\ifauth@r\auth@rfalse |
| 1252 |
\newif\if@city\@cityfalse |
| 1253 |
\newif\if@sourcenr\@sourcenrfalse |
| 1254 |
\newif\if@source\@sourcefalse |
| 1255 |
\newif\if@date\@datefalse |
| 1256 |
\newif\if@day\@dayfalse |
| 1257 |
\newif\if@year\@yearfalse |
| 1258 |
\newif\if@issue\@issuefalse |
| 1259 |
\newif\if@pages\@pagesfalse |
| 1260 |
\newif\if@tournament\@tournamentfalse |
| 1261 |
\newif\if@award\@awardfalse |
| 1262 |
\newif\if@after\@afterfalse |
| 1263 |
\newif\if@version\@versionfalse |
| 1264 |
\newif\if@correction\@correctionfalse |
| 1265 |
\newif\if@dedication\@dedicationfalse |
| 1266 |
\newif\if@fidealbum\@fidealbumfalse |
| 1267 |
\newif\if@twins\@twinsfalse |
| 1268 |
\newif\if@theme\@themefalse |
| 1269 |
\newif\if@computer\@computerfalse |
| 1270 |
\newif\if@judgement\@judgementfalse |
| 1271 |
\newif\if@comment\@commentfalse |
| 1272 |
\newif\if@pieces\@piecesfalse |
| 1273 |
\newboolean{@cpd@fen}\setboolean{@cpd@fen}{false}% |
| 1274 |
\newif\if@fieldtext\@fieldtextfalse |
| 1275 |
\newif\if@nofields\@nofieldsfalse |
| 1276 |
\newif\if@gridlines\@gridlinesfalse |
| 1277 |
\newif\if@fieldframe\@fieldframefalse |
| 1278 |
\newif\if@stdgrid\@stdgridfalse |
| 1279 |
\newboolean{showcomputer}\setboolean{showcomputer}{true}% |
| 1280 |
\newcommand*{\computerproofedsymbol}{C+} |
| 1281 |
\newcommand*{\notcomputerproofedsymbol}{C-} |
| 1282 |
% \newif\if@show@computer\@show@computertrue |
| 1283 |
\newif\if@stipulation\@stipulationfalse |
| 1284 |
\newif\if@condition\@conditionfalse |
| 1285 |
\newif\if@remark\@remarkfalse |
| 1286 |
\newif\if@piecedefs\@piecedefsfalse |
| 1287 |
\newif\if@typis\@typisfalse |
| 1288 |
\newif\if@widedias\@widediasfalse |
| 1289 |
\newif\ifx@twins\x@twinsfalse |
| 1290 |
\newif\ifx@cond\x@condfalse |
| 1291 |
\newif\ifimitator\imitatorfalse |
| 1292 |
\newif\ifnormal@names\normal@namesfalse |
| 1293 |
\newif\ifs@lu |
| 1294 |
\newif\if@develop\@developfalse |
| 1295 |
\newif\if@notfirst |
| 1296 |
\newif\if@first |
| 1297 |
% \end{macrocode} |
| 1298 |
% \begin{macrocode} |
| 1299 |
\newwrite\s@lfd |
| 1300 |
\let\below@newline=\relax |
| 1301 |
% These are used by the ``old'' board creating mechanism |
| 1302 |
% \end{macrocode} |
| 1303 |
% |
| 1304 |
% The following counters are used when creating the diagram |
| 1305 |
% itself. |
| 1306 |
% \begin{macrocode} |
| 1307 |
\newcounter{cpd@planes} |
| 1308 |
\newcounter{cpd@rows} |
| 1309 |
\newcounter{cpd@lines} |
| 1310 |
\newcounter{cpd@plane} |
| 1311 |
\newcounter{cpd@current@plane} |
| 1312 |
\newcounter{cpd@current@plane@display} |
| 1313 |
\newcounter{cpd@row} |
| 1314 |
\newcounter{cpd@line} |
| 1315 |
\newcounter{cpd@row@display} |
| 1316 |
\newcounter{cpd@line@display} |
| 1317 |
\newcounter{cpd@maxsquare} |
| 1318 |
\newcounter{cpd@helper} |
| 1319 |
\newcounter{cpd@current@square@index} |
| 1320 |
\newcounter{cpd@current@square@value} |
| 1321 |
% \end{macrocode} |
| 1322 |
% |
| 1323 |
% Some boolean \TeX-switches used whithin stereo- or spacechess |
| 1324 |
% diagrams. |
| 1325 |
% \begin{macrocode} |
| 1326 |
\newif\if@stereo\@stereofalse |
| 1327 |
\newif\if@space\@spacefalse |
| 1328 |
% \end{macrocode} |
| 1329 |
% |
| 1330 |
% These boolean switches are used to control the output of |
| 1331 |
% registers. |
| 1332 |
% \begin{macrocode} |
| 1333 |
\newif\if@aindex\@aindexfalse |
| 1334 |
\newif\if@sindex\@sindexfalse |
| 1335 |
\newif\if@tindex\@tindexfalse |
| 1336 |
\newif\ifds@label |
| 1337 |
% \end{macrocode} |
| 1338 |
% |
| 1339 |
% \begin{macro}{\cpd@begindiagram@hook} |
| 1340 |
% \begin{macro}{\cpd@enddiagram@hook} |
| 1341 |
% We define hooks to be executed in |\begin{diagram}| and |\end{diagram}|. |
| 1342 |
% \begin{macrocode} |
| 1343 |
\newcommand{\cpd@begindiagram@hook}{} |
| 1344 |
\newcommand{\cpd@enddiagram@hook}{} |
| 1345 |
% \end{macrocode} |
| 1346 |
% \end{macro} |
| 1347 |
% \end{macro} |
| 1348 |
% |
| 1349 |
% |
| 1350 |
% \begin{macro}{\diagram} |
| 1351 |
% \begin{macro}{\@diagram} |
| 1352 |
% Defines the code executed in |\begin{diagram}|. In case no |
| 1353 |
% optional size is given, a normal 8$\times$8 board is generated. |
| 1354 |
% \begin{macrocode} |
| 1355 |
\def\diagram{% |
| 1356 |
\begingroup% |
| 1357 |
\@ifnextchar [{\@diagram}{\@diagram[\@ight x\@ight]}% |
| 1358 |
} |
| 1359 |
|
| 1360 |
\def\@cpd@initsize#1#2{% |
| 1361 |
\setcounter{cpd@lines}{#1}% |
| 1362 |
\setcounter{cpd@rows}{#2}% |
| 1363 |
\setcounter{cpd@maxsquare}{\value{cpd@rows}*\value{cpd@lines}}% |
| 1364 |
} |
| 1365 |
|
| 1366 |
\def\@diagram[#1x#2]{% |
| 1367 |
\@cpd@initsize{#1}{#2}% |
| 1368 |
\setcounter{cpd@plane}{0}% |
| 1369 |
\setcounter{cpd@current@plane}{0}% |
| 1370 |
\let\put@sqs=\put@sqs@normal% |
| 1371 |
\let\read@plane=\read@plane@normal% |
| 1372 |
\@start@diagram% |
| 1373 |
} |
| 1374 |
% \end{macrocode} |
| 1375 |
% \end{macro} |
| 1376 |
% \end{macro} |
| 1377 |
% |
| 1378 |
% |
| 1379 |
% \begin{macrocode} |
| 1380 |
\def\stereodiagram{% |
| 1381 |
\begingroup% |
| 1382 |
\inner@frame=0.6pt% |
| 1383 |
\@stereotrue% |
| 1384 |
\@cpd@initsize{8}{8}% |
| 1385 |
\let\put@sqs=\put@sqs@stereo% |
| 1386 |
\let\read@plane=\read@plane@stereo% |
| 1387 |
\@start@diagram% |
| 1388 |
} |
| 1389 |
\def\spacediagram{% |
| 1390 |
\begingroup% |
| 1391 |
\inner@frame=0.6pt% |
| 1392 |
\@spacetrue% |
| 1393 |
\@ifnextchar [{\@spacediagram}{\@spacediagram[5x5x5]}% |
| 1394 |
} |
| 1395 |
|
| 1396 |
\def\@spacediagram[#1x#2x#3]{% |
| 1397 |
\setcounter{cpd@planes}{#3}% |
| 1398 |
\@cpd@initsize{#1}{#2}% |
| 1399 |
\let\put@sqs=\put@sqs@space% |
| 1400 |
\let\read@plane=\read@plane@space% |
| 1401 |
\@start@diagram% |
| 1402 |
} |
| 1403 |
\def\@start@diagram{% |
| 1404 |
\init@vars% |
| 1405 |
\let\author=\ds@author% |
| 1406 |
\let\day=\ds@day% |
| 1407 |
\let\month=\ds@month% |
| 1408 |
\let\year=\ds@year% |
| 1409 |
\let\label=\ds@label% |
| 1410 |
\cpd@begindiagram@hook% |
| 1411 |
\ignorespaces% |
| 1412 |
} |
| 1413 |
|
| 1414 |
\def\showtypis#1{% |
| 1415 |
\@typistrue% |
| 1416 |
\typis@tk={#1}% |
| 1417 |
\ignorespaces% |
| 1418 |
} |
| 1419 |
|
| 1420 |
|
| 1421 |
\newboolean{@cpd@inside@diagram} |
| 1422 |
\setboolean{@cpd@inside@diagram}{false} |
| 1423 |
\newcommand{\insidediagram}[1]{% |
| 1424 |
\ifthenelse{\boolean{@cpd@inside@diagram}}{#1}{}% |
| 1425 |
} |
| 1426 |
\def\enddiagram{% |
| 1427 |
\let\author=\orig@author% |
| 1428 |
\let\day=\orig@day% |
| 1429 |
\let\month=\orig@month% |
| 1430 |
\let\year=\orig@year% |
| 1431 |
\let\label=\orig@label% |
| 1432 |
\if@number% |
| 1433 |
\else% |
| 1434 |
\refstepcounter{board@nr}% so \label and \ref work properly |
| 1435 |
\fi% |
| 1436 |
% |
| 1437 |
% Now \label@tk should be set, if wanted, so |
| 1438 |
% we can generate the index entries |
| 1439 |
% |
| 1440 |
\@aindex% |
| 1441 |
\@sindex% |
| 1442 |
\@tindex% |
| 1443 |
% |
| 1444 |
% Now \@currentlabel will be set right, so we can use |
| 1445 |
% the original label |
| 1446 |
\if@label% |
| 1447 |
\expandafter\@set@label\the\label@tk;% |
| 1448 |
\fi% |
| 1449 |
% |
| 1450 |
% Now we know, if we have frames so we can setup our dimensions |
| 1451 |
% |
| 1452 |
\global\sq@width=\fontdimen\tw@\chessfont% |
| 1453 |
\if@stereo% |
| 1454 |
\bd@width=\@ight\sq@width% |
| 1455 |
\board@width=\@ight\sq@width% |
| 1456 |
\ifdim\h@frame@dist<\sq@width% |
| 1457 |
\h@frame@dist=\sq@width% |
| 1458 |
\fi% |
| 1459 |
% We do already skip with \v@space@dist |
| 1460 |
% So we use the additional skip \space@frame@dist here |
| 1461 |
\v@frame@dist=\space@frame@dist% |
| 1462 |
\ifdim\space@frame>\outer@frame% |
| 1463 |
\outer@frame=\space@frame% |
| 1464 |
\fi% |
| 1465 |
\advance\bd@width\tw@\inner@frame% |
| 1466 |
\advance\board@width\tw@\inner@frame% |
| 1467 |
\advance\board@width\tw@\h@frame@dist% |
| 1468 |
\advance\board@width\tw@\outer@frame% |
| 1469 |
\else\if@space% |
| 1470 |
\ifdim\h@frame@dist<1.5\sq@width% |
| 1471 |
\h@frame@dist=1.5\sq@width% |
| 1472 |
\fi% |
| 1473 |
% We do already skip with \v@space@dist |
| 1474 |
% So we use the additional skip \space@frame@dist here |
| 1475 |
\v@frame@dist=\space@frame@dist% |
| 1476 |
\ifdim\space@frame>\outer@frame% |
| 1477 |
\outer@frame=\space@frame% |
| 1478 |
\fi% |
| 1479 |
\ifspace@vertical% |
| 1480 |
\bd@width=\value{cpd@lines}\sq@width% |
| 1481 |
\board@width\bd@width% |
| 1482 |
\advance\bd@width\tw@\inner@frame% |
| 1483 |
\advance\board@width\tw@\inner@frame% |
| 1484 |
\advance\board@width\tw@\h@frame@dist% |
| 1485 |
\advance\board@width\tw@\outer@frame% |
| 1486 |
\else% |
| 1487 |
\bd@width=\value{cpd@lines}\sq@width% |
| 1488 |
\advance\bd@width\tw@\inner@frame% |
| 1489 |
\ifdim\h@space@dist<1.5\sq@width% |
| 1490 |
\h@space@dist=1.5\sq@width% |
| 1491 |
\fi% |
| 1492 |
%\h@space@dist=0.7\sq@width% |
| 1493 |
% Now we can compute the width of the complete board |
| 1494 |
\board@width\bd@width% |
| 1495 |
\advance\board@width\h@space@dist% |
| 1496 |
\multiply\board@width\value{cpd@planes}% |
| 1497 |
\advance\board@width\h@space@dist% |
| 1498 |
\advance\board@width\tw@\outer@frame% |
| 1499 |
\fi% |
| 1500 |
\else% |
| 1501 |
\ifthenelse{\boolean{legend}}{\v@frame@dist=1.5em\h@frame@dist=1.5em}{}% |
| 1502 |
\bd@width=\value{cpd@lines}\sq@width% |
| 1503 |
\ifthenelse{\value{cpd@lines} > 8}{% |
| 1504 |
% Make the board wider |
| 1505 |
\board@width=\value{cpd@lines}\sq@width% |
| 1506 |
}{% |
| 1507 |
% Make a normal width |
| 1508 |
\board@width=\@ight\sq@width% |
| 1509 |
}% |
| 1510 |
\advance\bd@width\tw@\inner@frame% |
| 1511 |
\advance\board@width\tw@\inner@frame% |
| 1512 |
\advance\board@width\tw@\h@frame@dist% |
| 1513 |
\advance\board@width\tw@\outer@frame% |
| 1514 |
\fi\fi% |
| 1515 |
\if@widedias% |
| 1516 |
\head@width=\textwidth% |
| 1517 |
\else% |
| 1518 |
\head@width=\board@width% |
| 1519 |
\fi% |
| 1520 |
% |
| 1521 |
% Now we should build the diagram itself |
| 1522 |
% |
| 1523 |
\ifthenelse{\boolean{@textproblem}}{% |
| 1524 |
% Put the stipulation into the \sq@box |
| 1525 |
\setbox\sq@box=\hbox{\vbox to \board@width{\hsize\board@width% |
| 1526 |
\stipfont% |
| 1527 |
\raggedright% |
| 1528 |
\sloppy% |
| 1529 |
\the\stipulation@tk% |
| 1530 |
\vfil% |
| 1531 |
}}% |
| 1532 |
}{% |
| 1533 |
\put@sqs% This builds up the \sq@box |
| 1534 |
% Check, if the given number of pieces is reached |
| 1535 |
\ifthenelse{\boolean{cpd@checkPieceCounts}}{% |
| 1536 |
\ifthenelse{\value{cpd@defWhitePieces}=\value{cpd@whitePieces}}{}% |
| 1537 |
{\errmessage{Wrong number of white pieces}}% |
| 1538 |
\ifthenelse{\value{cpd@defBlackPieces}=\value{cpd@blackPieces}}{}% |
| 1539 |
{\errmessage{Wrong number of black pieces}}% |
| 1540 |
\ifthenelse{\value{cpd@defNeutralPieces}=\value{cpd@neutralPieces}}{}% |
| 1541 |
{\errmessage{Wrong number of neutral pieces}}% |
| 1542 |
}{}% |
| 1543 |
}% |
| 1544 |
% |
| 1545 |
\global\setbox\dia@box=\hbox{\vbox{% |
| 1546 |
\setboolean{@cpd@inside@diagram}{true}% |
| 1547 |
\parindent\z@% |
| 1548 |
\parskip\z@% |
| 1549 |
\baselineskip11\p@\advance\baselineskip\dia@lineskip% |
| 1550 |
\hsize\head@width% |
| 1551 |
\centering% |
| 1552 |
% diagram header |
| 1553 |
\vskip\topdist% |
| 1554 |
\vbox{\hsize\board@width\hbox{% |
| 1555 |
\if@develop\if@label% |
| 1556 |
\noindent\raggedright\llap{\labelfont\the\label@tk\ }% |
| 1557 |
\fi\fi% |
| 1558 |
\vbox{% |
| 1559 |
\he@dpos\dia@above% |
| 1560 |
}% |
| 1561 |
}}% |
| 1562 |
\vskip\tw@\p@% |
| 1563 |
% diagram itself |
| 1564 |
\vtop{\hsize\board@width% |
| 1565 |
\hbox to \head@width{\hss\vbox{% |
| 1566 |
\hsize\board@width% |
| 1567 |
\ifthenelse{\boolean{@textproblem}}{% |
| 1568 |
\box\sq@box% |
| 1569 |
}{% |
| 1570 |
\outer@henbox{\box\sq@box}% |
| 1571 |
}% |
| 1572 |
}\hss}% |
| 1573 |
% diagram trailer |
| 1574 |
\hbox to \head@width{\hss\vtop{% |
| 1575 |
\hsize\board@width% |
| 1576 |
\parskip\z@% |
| 1577 |
\raggedright% |
| 1578 |
\put@count% |
| 1579 |
\dia@below% |
| 1580 |
}\hss}% |
| 1581 |
}% |
| 1582 |
\setboolean{@cpd@inside@diagram}{false}% |
| 1583 |
}}% End of \dia@box |
| 1584 |
\do@dia@job% |
| 1585 |
\cpd@enddiagram@hook% |
| 1586 |
\endgroup% |
| 1587 |
} |
| 1588 |
|
| 1589 |
\def\do@put@count{% |
| 1590 |
\ \ (\arabic{cpd@whitePieces}+\arabic{cpd@blackPieces}% |
| 1591 |
\ifthenelse{\value{cpd@neutralPieces}>0}{+\arabic{cpd@neutralPieces}}{})% |
| 1592 |
} |
| 1593 |
|
| 1594 |
\def\put@count{% |
| 1595 |
% First we build the box with the figure count |
| 1596 |
\ifthenelse{\boolean{showcomputer}\OR\boolean{piececounter}}{% |
| 1597 |
\global\setbox\@cnt@box=\hbox{% |
| 1598 |
\stipfont% |
| 1599 |
\ifthenelse{\boolean{showcomputer}}{% |
| 1600 |
\ \ \if@computer\computerproofedsymbol\else\notcomputerproofedsymbol\fi% |
| 1601 |
}{}% |
| 1602 |
\ifthenelse{\boolean{piececounter}}{% |
| 1603 |
\do@put@count% |
| 1604 |
}{}% |
| 1605 |
}% |
| 1606 |
\@cnt@wd=\wd\@cnt@box% |
| 1607 |
\hangindent-\@cnt@wd% |
| 1608 |
\hangafter\m@ne% |
| 1609 |
\noindent% |
| 1610 |
\hbox to \z@{% |
| 1611 |
\hbox to \board@width{\hfil\unhbox\@cnt@box}\hskip -\board@width% |
| 1612 |
}% |
| 1613 |
}{}% |
| 1614 |
} |
| 1615 |
|
| 1616 |
\let\endstereodiagram=\enddiagram |
| 1617 |
\let\endspacediagram=\enddiagram |
| 1618 |
\def\figurine{% |
| 1619 |
\begingroup% |
| 1620 |
\init@vars% |
| 1621 |
\let\author=\ds@author% |
| 1622 |
\let\day=\ds@day% |
| 1623 |
\let\month=\ds@month% |
| 1624 |
\let\year=\ds@year% |
| 1625 |
\let\label=\ds@label% |
| 1626 |
\cpd@begindiagram@hook% |
| 1627 |
} |
| 1628 |
|
| 1629 |
\def\endfigurine{% |
| 1630 |
\let\author=\orig@author% |
| 1631 |
\let\day=\orig@day% |
| 1632 |
\let\month=\orig@month% |
| 1633 |
\let\year=\orig@year% |
| 1634 |
\let\label=\orig@label% |
| 1635 |
\if@number% |
| 1636 |
\else% |
| 1637 |
\refstepcounter{board@nr}% so \label and \ref work properly |
| 1638 |
\fi% |
| 1639 |
% |
| 1640 |
% Now \label@tk should be set, if wanted, so |
| 1641 |
% we can generate the index entries |
| 1642 |
% |
| 1643 |
\@aindex% |
| 1644 |
\@sindex% |
| 1645 |
\@tindex% |
| 1646 |
% |
| 1647 |
% Now \@currentlabel will be set right, so we can use |
| 1648 |
% the original label |
| 1649 |
% |
| 1650 |
\if@label% |
| 1651 |
\expandafter\@set@label\the\label@tk;% |
| 1652 |
\fi% |
| 1653 |
% |
| 1654 |
\@show@figurine% |
| 1655 |
\cpd@enddiagram@hook% |
| 1656 |
\endgroup% |
| 1657 |
} |
| 1658 |
% |
| 1659 |
\gdef\selectelchfont#1{% |
| 1660 |
\global\elchfont\csname @#1elch\endcsname\defaultelchfont% |
| 1661 |
} |
| 1662 |
% \end{macrocode} |
| 1663 |
% |
| 1664 |
% Here we define commands to change fonts used for text above |
| 1665 |
% and below the diagram. You may redefine to adjust the fonts to |
| 1666 |
% your needs. |
| 1667 |
% \begin{macro}{\authorfont} |
| 1668 |
% \begin{macro}{\cityfont} |
| 1669 |
% \begin{macro}{\sourcefont} |
| 1670 |
% \begin{macro}{\awardfont} |
| 1671 |
% \begin{macro}{\dedicfont} |
| 1672 |
% \begin{macro}{\stipfont} |
| 1673 |
% \begin{macro}{\remfont} |
| 1674 |
% \begin{macro}{\labelfont} |
| 1675 |
% \begin{macro}{\cpd@boardfont} |
| 1676 |
% \begin{macro}{\legendfont} |
| 1677 |
% \begin{macrocode} |
| 1678 |
\newcommand*{\authorfont}{\bfseries} |
| 1679 |
\newcommand*{\cityfont}{\slshape} |
| 1680 |
\newcommand*{\sourcefont}{\bfseries\itshape} |
| 1681 |
\newcommand*{\awardfont}{\itshape} |
| 1682 |
\newcommand*{\dedicfont}{\itshape} |
| 1683 |
\newcommand*{\stipfont}{\rmfamily} |
| 1684 |
\newcommand*{\remfont}{\rmfamily} |
| 1685 |
\newcommand*{\labelfont}{\rmfamily} |
| 1686 |
\newcommand*{\cpd@boardfont}{\rmfamily} |
| 1687 |
\newcommand*{\legendfont}{\sffamily} |
| 1688 |
% \end{macrocode} |
| 1689 |
% \end{macro} |
| 1690 |
% \end{macro} |
| 1691 |
% \end{macro} |
| 1692 |
% \end{macro} |
| 1693 |
% \end{macro} |
| 1694 |
% \end{macro} |
| 1695 |
% \end{macro} |
| 1696 |
% \end{macro} |
| 1697 |
% \end{macro} |
| 1698 |
% \end{macro} |
| 1699 |
% |
| 1700 |
% We have three different default sizes for diagrams. |
| 1701 |
% The following commands switch fontsizes used for the chessfonts |
| 1702 |
% to typeset the diagrams. |
| 1703 |
% \begin{macro}{\diagramx} |
| 1704 |
% \begin{macro}{\diagramxi} |
| 1705 |
% \begin{macro}{\diagramxii} |
| 1706 |
% \begin{macrocode} |
| 1707 |
\newcounter{cpd@chessfontsize} |
| 1708 |
\newcommand*{\diagramx}{ |
| 1709 |
\ifcase\elchfont\relax% |
| 1710 |
\font\chessfont=pkelch12 |
| 1711 |
\font\chtextfont=pkelch10 |
| 1712 |
\else% |
| 1713 |
\font\chessfont=fselch12 |
| 1714 |
\font\chtextfont=fselch10 |
| 1715 |
\fi% |
| 1716 |
\dia@lineskip\z@ |
| 1717 |
\dia@type\z@ |
| 1718 |
\setcounter{cpd@chessfontsize}{12}% |
| 1719 |
} |
| 1720 |
|
| 1721 |
\newcommand*{\diagramxi}{ |
| 1722 |
\ifcase\elchfont\relax% |
| 1723 |
\font\chessfont=pkelch14 |
| 1724 |
\font\chtextfont=pkelch11 |
| 1725 |
\else% |
| 1726 |
\font\chessfont=fselch14 |
| 1727 |
\font\chtextfont=fselch11 |
| 1728 |
\fi% |
| 1729 |
\dia@lineskip\@ne\p@ |
| 1730 |
\dia@type\@ne |
| 1731 |
\setcounter{cpd@chessfontsize}{14}% |
| 1732 |
} |
| 1733 |
|
| 1734 |
\newcommand*{\diagramxii}{ |
| 1735 |
\ifcase\elchfont\relax% |
| 1736 |
\font\chessfont=pkelch16 |
| 1737 |
\font\chtextfont=pkelch12 |
| 1738 |
\else% |
| 1739 |
\font\chessfont=fselch16 |
| 1740 |
\font\chtextfont=fselch12 |
| 1741 |
\fi% |
| 1742 |
\dia@lineskip\tw@\p@ |
| 1743 |
\dia@type\tw@ |
| 1744 |
\setcounter{cpd@chessfontsize}{16}% |
| 1745 |
} |
| 1746 |
% \end{macrocode} |
| 1747 |
% \end{macro} |
| 1748 |
% \end{macro} |
| 1749 |
% \end{macro} |
| 1750 |
% |
| 1751 |
% \begin{macro}{\defaultelchfont} |
| 1752 |
% |\defaultelchfont| is used to define the fontsize used to |
| 1753 |
% typeset the diagrams depending on the documentsize. |
| 1754 |
% \begin{macrocode} |
| 1755 |
\def\defaultelchfont{% |
| 1756 |
\ifcase\@ptsize\relax% |
| 1757 |
\diagramx\or% |
| 1758 |
\diagramxi\or% |
| 1759 |
\diagramxii% |
| 1760 |
\fi% |
| 1761 |
} |
| 1762 |
% \end{macrocode} |
| 1763 |
% \end{macro} |
| 1764 |
% |
| 1765 |
% \begin{macrocode} |
| 1766 |
\def\dianamestyle#1{\def\@dianame{\csname @#1\endcsname}} |
| 1767 |
\def\solnamestyle#1{\def\@solname{\csname @#1\endcsname}} |
| 1768 |
\newcommand*{\diagnum}[2][]{% |
| 1769 |
\renewcommand*{\@dianumber@prefix}{#1}% |
| 1770 |
\setcounter{board@nr}{#2}% |
| 1771 |
\addtocounter{board@nr}{\m@ne}} |
| 1772 |
% \end{macrocode} |
| 1773 |
% |
| 1774 |
% Now we define a couple of abbreviations and special symbols |
| 1775 |
% often used when setting problem chess documents. |
| 1776 |
% |
| 1777 |
% \begin{macro}{\ra} |
| 1778 |
% \begin{macro}{\lra} |
| 1779 |
% \begin{macro}{\rla} |
| 1780 |
% \begin{macro}{arrowskip} |
| 1781 |
% Arrows and specification of space (or something different) |
| 1782 |
% before and after arrows. |
| 1783 |
% \begin{macrocode} |
| 1784 |
\newcommand{\@cpd@pre@arrow}{} |
| 1785 |
\newcommand{\@cpd@post@arrow}{} |
| 1786 |
\newcommand{\ra}{\@cpd@pre@arrow\mbox{$\rightarrow$}\@cpd@post@arrow} |
| 1787 |
\newcommand{\lra}{\@cpd@pre@arrow\mbox{$\leftrightarrow$}\@cpd@post@arrow} |
| 1788 |
\let\rla=\lra |
| 1789 |
\newcommand*{\@cpd@prepost@arrow}[2]{% |
| 1790 |
\renewcommand*{\@cpd@pre@arrow}{#1} |
| 1791 |
\renewcommand*{\@cpd@post@arrow}{#2} |
| 1792 |
} |
| 1793 |
\newenvironment{arrowskip}{% |
| 1794 |
\@cpd@prepost@arrow% |
| 1795 |
}{% |
| 1796 |
} |
| 1797 |
% \end{macrocode} |
| 1798 |
% \end{macro} |
| 1799 |
% \end{macro} |
| 1800 |
% \end{macro} |
| 1801 |
% \end{macro} |
| 1802 |
% |
| 1803 |
% \begin{macro}{\x} |
| 1804 |
% \begin{macro}{\set} |
| 1805 |
% \begin{macro}{\OO} |
| 1806 |
% \begin{macro}{\OOO} |
| 1807 |
% \begin{macro}{\any} |
| 1808 |
% \begin{macro}{\further} |
| 1809 |
% \begin{macrocode} |
| 1810 |
\newcommand{\x}{\mbox{\ifmmode\times\else$\times$\fi}} |
| 1811 |
\def\set{\kern -.05em\raise .1ex\hbox{*}} |
| 1812 |
\def\@O{0\raise.25ex\hbox{-}\kern -.1em\relax} |
| 1813 |
\def\OO{\@O0} |
| 1814 |
\def\OOO{\@O\@O0} |
| 1815 |
\def\any{\ifmmode\sim\else$\sim$\fi} |
| 1816 |
\def\further{\ifmmode\Rightarrow\else$\Rightarrow$\fi\ \ignorespaces} |
| 1817 |
% \end{macrocode} |
| 1818 |
% \end{macro} |
| 1819 |
% \end{macro} |
| 1820 |
% \end{macro} |
| 1821 |
% \end{macro} |
| 1822 |
% \end{macro} |
| 1823 |
% \end{macro} |
| 1824 |
% |
| 1825 |
% \begin{macrocode} |
| 1826 |
\def\spacelayout#1{\csname space@#1\endcsname} |
| 1827 |
\def\nodiagnumbering{% |
| 1828 |
% \global\di@nofalse |
| 1829 |
\setboolean{@cpd@numbering@global}{false} |
| 1830 |
} |
| 1831 |
\newcommand*{\@dianumber@prefix}{} |
| 1832 |
\def\diagnumbering#1{% |
| 1833 |
\setboolean{@cpd@numbering@global}{true}% |
| 1834 |
% \global\di@notrue% |
| 1835 |
\diagnum{\@ne}% |
| 1836 |
\gdef\thediag{\@dianumber@prefix\csname @#1\endcsname\c@board@nr}% |
| 1837 |
} |
| 1838 |
% \end{macrocode} |
| 1839 |
% |
| 1840 |
% \begin{macro}{\diagcenter} |
| 1841 |
% \begin{macro}{\diagleft} |
| 1842 |
% \begin{macro}{\diagright} |
| 1843 |
% The macros |\diagcenter|, |\diagleft| and |\diagright| simply |
| 1844 |
% define the macro |\he@dpos| to the corresponding paragraph |
| 1845 |
% alignment. |
| 1846 |
% \begin{macrocode} |
| 1847 |
\def\diagcenter{\def\he@dpos{\centering}} |
| 1848 |
\def\diagleft{\def\he@dpos{\raggedright}} |
| 1849 |
\def\diagright{\def\he@dpos{\raggedleft}} |
| 1850 |
% \end{macrocode} |
| 1851 |
% \end{macro} |
| 1852 |
% \end{macro} |
| 1853 |
% \end{macro} |
| 1854 |
% |
| 1855 |
% \begin{macro}{\setmonthstyle} |
| 1856 |
% The implementation of |\setmonthstyle| does |\diagnumbering| |
| 1857 |
% define a command which uses the given parameter as a part of |
| 1858 |
% the command name. |
| 1859 |
% \begin{macrocode} |
| 1860 |
\def\setmonthstyle#1{\def\write@month{\csname @#1\endcsname}} |
| 1861 |
% \end{macrocode} |
| 1862 |
% \end{macro} |
| 1863 |
% |
| 1864 |
% \begin{macrocode} |
| 1865 |
\def\specialdiagnum#1{% |
| 1866 |
\ifthenelse{\equal{}{#1}}{% |
| 1867 |
% We disable displaying the diagram number |
| 1868 |
\setboolean{@cpd@numbering@local}{false}% |
| 1869 |
}{% |
| 1870 |
\setboolean{@cpd@numbering@local}{true}% |
| 1871 |
\@specialtrue% |
| 1872 |
} |
| 1873 |
\number@tk={#1}\@numbertrue% |
| 1874 |
\def\thediag{#1}\def\@currentlabel{#1}% |
| 1875 |
\ignorespaces% |
| 1876 |
} |
| 1877 |
% \end{macrocode} |
| 1878 |
% |
| 1879 |
% \begin{macro}{\ds@label} |
| 1880 |
% \begin{macro}{\ds@author} |
| 1881 |
% The macros |\ds@label| and |\ds@author| are defined internally |
| 1882 |
% and are made public within |\begin{diagram}|. This is because |
| 1883 |
% the macros |\label| and |\author| are normal \LaTeX-macros and |
| 1884 |
% I want to avoid to redefine these globally. |
| 1885 |
% \begin{macrocode} |
| 1886 |
\def\ds@label{% |
| 1887 |
\@ifstar{\ds@labelfalse\ds@xlabel}{\ds@labeltrue\ds@xlabel}% |
| 1888 |
} |
| 1889 |
\def\ds@author#1{% |
| 1890 |
\aut@tk={#1}\auth@rtrue% |
| 1891 |
\ignorespaces% |
| 1892 |
} |
| 1893 |
% \end{macrocode} |
| 1894 |
% \end{macro} |
| 1895 |
% \end{macro} |
| 1896 |
% \begin{macro}{\ds@academictitle} |
| 1897 |
% \begin{macro}{\Dr} |
| 1898 |
% \begin{macro}{\Prof} |
| 1899 |
% \begin{macro}{\ProfDr} |
| 1900 |
% \begin{macrocode} |
| 1901 |
\def\ds@academictitle#1{\ifthenelse{\boolean{showacademictitle}}{#1~}{}\ignorespaces} |
| 1902 |
\newcommand{\Dr}{\ds@academictitle{Dr.}} |
| 1903 |
\newcommand{\Prof}{\ds@academictitle{Prof.}} |
| 1904 |
\newcommand{\ProfDr}{\ds@academictitle{Prof.\,Dr.}} |
| 1905 |
% \end{macrocode} |
| 1906 |
% \end{macro} |
| 1907 |
% \end{macro} |
| 1908 |
% \end{macro} |
| 1909 |
% \end{macro} |
| 1910 |
% |
| 1911 |
% \begin{macrocode} |
| 1912 |
\def\@cpd@warnIfEmpty#1#2{% |
| 1913 |
\begingroup% |
| 1914 |
\@cpd@emptytest={#1}% |
| 1915 |
\edef\@cpd@param{\the\@cpd@emptytest}% |
| 1916 |
\expandafter\endgroup% |
| 1917 |
\ifx\@cpd@param\@empty\relax% |
| 1918 |
\message{^^JWARNING: empty '#2' argument.^^J}% |
| 1919 |
\fi |
| 1920 |
} |
| 1921 |
\def\city#1{% |
| 1922 |
\city@tk={#1}\@citytrue% |
| 1923 |
\ignorespaces% |
| 1924 |
} |
| 1925 |
\def\sourcenr#1{% |
| 1926 |
\sourcenr@tk={#1}\@sourcenrtrue% |
| 1927 |
\ignorespaces% |
| 1928 |
} |
| 1929 |
\def\source#1{% |
| 1930 |
\source@tk={#1}\@sourcetrue% |
| 1931 |
\ignorespaces% |
| 1932 |
} |
| 1933 |
\def\ds@day#1{% |
| 1934 |
\day@tk={#1}\@daytrue\@datetrue% |
| 1935 |
\ignorespaces% |
| 1936 |
} |
| 1937 |
\def\ds@month#1{% |
| 1938 |
\from@month=#1\@datetrue% |
| 1939 |
\ignorespaces% |
| 1940 |
} |
| 1941 |
\def\months#1{% |
| 1942 |
\@months#1;% |
| 1943 |
\ignorespaces% |
| 1944 |
} |
| 1945 |
\def\ds@year#1{% |
| 1946 |
\year@tk={#1}\@yeartrue\@datetrue% |
| 1947 |
\ignorespaces% |
| 1948 |
} |
| 1949 |
\def\issue#1{% |
| 1950 |
\issue@tk={#1}\@issuetrue% |
| 1951 |
\ignorespaces% |
| 1952 |
} |
| 1953 |
\def\pages#1{% |
| 1954 |
\pages@tk={#1}\@pagestrue% |
| 1955 |
\ignorespaces% |
| 1956 |
} |
| 1957 |
\def\tournament#1{% |
| 1958 |
\tournament@tk={#1}\@tournamenttrue% |
| 1959 |
\ignorespaces% |
| 1960 |
} |
| 1961 |
\def\award#1{% |
| 1962 |
\@cpd@warnIfEmpty{#1}{award}% |
| 1963 |
\award@tk={#1}\@awardtrue% |
| 1964 |
\ignorespaces% |
| 1965 |
} |
| 1966 |
\def\version#1{% |
| 1967 |
\@cpd@warnIfEmpty{#1}{version}% |
| 1968 |
\version@tk={#1}\@versiontrue% |
| 1969 |
\ignorespaces% |
| 1970 |
} |
| 1971 |
\def\after#1{% |
| 1972 |
\@cpd@warnIfEmpty{#1}{after}% |
| 1973 |
\after@tk={#1}\@aftertrue% |
| 1974 |
\ignorespaces% |
| 1975 |
} |
| 1976 |
\def\correction#1{% |
| 1977 |
\@cpd@warnIfEmpty{#1}{correction}% |
| 1978 |
\correction@tk={#1}\@correctiontrue% |
| 1979 |
\ignorespaces% |
| 1980 |
} |
| 1981 |
\def\dedication#1{% |
| 1982 |
\@cpd@warnIfEmpty{#1}{dedication}% |
| 1983 |
\dedic@tk={#1}\@dedicationtrue% |
| 1984 |
\ignorespaces% |
| 1985 |
} |
| 1986 |
\def\fidealbum#1{% |
| 1987 |
\fidealbum@tk={#1}\@fidealbumtrue% |
| 1988 |
\ignorespaces% |
| 1989 |
} |
| 1990 |
\def\pieces{% |
| 1991 |
\@ifnextchar[% |
| 1992 |
{\x@pieces}% |
| 1993 |
{\@pieces}% |
| 1994 |
} |
| 1995 |
\def\x@pieces[#1]{% |
| 1996 |
% We should parse the given piececounts |
| 1997 |
\setboolean{cpd@checkPieceCounts}{true}% |
| 1998 |
\@parseWhiteAndBlackCount#1+\e@list |
| 1999 |
\@pieces% |
| 2000 |
} |
| 2001 |
\def\@parseWhiteAndBlackCount#1+#2+{% |
| 2002 |
\setcounter{cpd@defWhitePieces}{#1}% |
| 2003 |
\setcounter{cpd@defBlackPieces}{#2}% |
| 2004 |
\futurelet\n@xt\cpd@checkNeutral% |
| 2005 |
} |
| 2006 |
\let\cpd@nextproc=\relax% |
| 2007 |
\def\cpd@checkNeutral{% |
| 2008 |
\if\n@xt\relax% |
| 2009 |
\let\cpd@nextproc=\relax% |
| 2010 |
\else% |
| 2011 |
\let\cpd@nextproc=\@parseNeutralCount% |
| 2012 |
\fi% |
| 2013 |
\cpd@nextproc% |
| 2014 |
} |
| 2015 |
\def\@parseNeutralCount#1+{% |
| 2016 |
\setcounter{cpd@defNeutralPieces}{#1}% |
| 2017 |
} |
| 2018 |
\def\@pieces#1{% |
| 2019 |
\pieces@tk={#1}\@piecestrue% |
| 2020 |
\ignorespaces% |
| 2021 |
} |
| 2022 |
\newcommand{\fen}[2][]{% |
| 2023 |
\ifthenelse{\equal{#1}{}}% |
| 2024 |
{}% Do nothing |
| 2025 |
{% |
| 2026 |
\setboolean{cpd@checkPieceCounts}{true}% |
| 2027 |
\@parseWhiteAndBlackCount#1+\e@list% |
| 2028 |
}% |
| 2029 |
\fen@tk={#2}\setboolean{@cpd@fen}{true}% |
| 2030 |
\ignorespaces% |
| 2031 |
} |
| 2032 |
\def\fieldtext#1{% |
| 2033 |
\fieldtext@tk={#1}\@fieldtexttrue% |
| 2034 |
\ignorespaces% |
| 2035 |
} |
| 2036 |
\def\nofields#1{% |
| 2037 |
\nofields@tk={#1}\@nofieldstrue% |
| 2038 |
\ignorespaces% |
| 2039 |
} |
| 2040 |
\let\nosquares\nofields |
| 2041 |
\def\gridlines#1{% |
| 2042 |
\gridlines@tk={#1}\@gridlinestrue% |
| 2043 |
\ignorespaces% |
| 2044 |
} |
| 2045 |
\def\fieldframe#1{% |
| 2046 |
\fieldframe@tk={#1}\@fieldframetrue% |
| 2047 |
\ignorespaces% |
| 2048 |
} |
| 2049 |
\def\stipulation#1{% |
| 2050 |
\stipulation@tk={#1}\@stipulationtrue% |
| 2051 |
\ignorespaces% |
| 2052 |
} |
| 2053 |
\def\condition{% |
| 2054 |
\@ifstar{\x@condtrue\@condition}{\@condition}% |
| 2055 |
} |
| 2056 |
\def\@condition#1{% |
| 2057 |
\condition@tk={#1}\@conditiontrue% |
| 2058 |
\ignorespaces% |
| 2059 |
} |
| 2060 |
\def\twins{% |
| 2061 |
\@ifstar{\x@twinstrue\@twins}{\@twins}% |
| 2062 |
} |
| 2063 |
\def\@twins#1{% |
| 2064 |
\twins@tk={#1}\@twinstrue% |
| 2065 |
\ignorespaces% |
| 2066 |
} |
| 2067 |
\def\remark#1{% |
| 2068 |
\remark@tk={#1}\@remarktrue% |
| 2069 |
\ignorespaces% |
| 2070 |
} |
| 2071 |
\def\piecedefs#1{% |
| 2072 |
\piecedefs@tk={#1}\@piecedefstrue% |
| 2073 |
\ignorespaces% |
| 2074 |
} |
| 2075 |
% \def\@piecedef#1{\csname#1\x@piecedef\endcsname\l@@klist} |
| 2076 |
% \newcommand{\piecedef}[3][ws]{% |
| 2077 |
% \def\x@piecedef{#2}% |
| 2078 |
% \let\@action=\@piecedef% |
| 2079 |
% \hbox{\l@@klist#1\e@list% |
| 2080 |
% \ = #3}% |
| 2081 |
% } |
| 2082 |
\def\Co#1{% |
| 2083 |
\ifx#1+\@computertrue\computer@tk={+}\fi% |
| 2084 |
\ignorespaces% |
| 2085 |
} |
| 2086 |
\long\def\solution#1{% |
| 2087 |
\sol@tk={#1}\global\s@lutrue% |
| 2088 |
\ignorespaces% |
| 2089 |
} |
| 2090 |
\def\themes#1{% |
| 2091 |
\theme@tk={#1}\@themetrue% |
| 2092 |
\ignorespaces% |
| 2093 |
} |
| 2094 |
\def\genre#1{% |
| 2095 |
\relax% Currently not used within diagram.sty |
| 2096 |
} |
| 2097 |
\long\def\comment#1{% |
| 2098 |
\comment@tk={#1}\@commenttrue% |
| 2099 |
\ignorespaces% |
| 2100 |
} |
| 2101 |
\long\def\judgement#1{% |
| 2102 |
\judgement@tk={#1}\@judgementtrue% |
| 2103 |
\ignorespaces% |
| 2104 |
} |
| 2105 |
\def\noframe{% |
| 2106 |
\@vframefalse\@hframefalse% |
| 2107 |
\ignorespaces% |
| 2108 |
} |
| 2109 |
\def\noinnerframe{% |
| 2110 |
\@leaveOuterfalse\@vframefalse\@hframefalse% |
| 2111 |
\ignorespaces% |
| 2112 |
} |
| 2113 |
\def\verticalcylinder{% |
| 2114 |
\@vframefalse% |
| 2115 |
\ignorespaces% |
| 2116 |
} |
| 2117 |
\def\horizontalcylinder{% |
| 2118 |
\@hframefalse% |
| 2119 |
\ignorespaces% |
| 2120 |
} |
| 2121 |
\def\stdgrid{% |
| 2122 |
\@stdgridtrue% |
| 2123 |
\ignorespaces% |
| 2124 |
} |
| 2125 |
% \end{macrocode} |
| 2126 |
% |
| 2127 |
% \begin{macro}{\gridchess} |
| 2128 |
% \begin{macro}{\magic} |
| 2129 |
% \begin{macro}{\tourn} |
| 2130 |
% \begin{macro}{\dedic} |
| 2131 |
% \begin{macro}{\stip} |
| 2132 |
% \begin{macro}{\cond} |
| 2133 |
% \begin{macro}{\rem} |
| 2134 |
% \begin{macro}{\sol} |
| 2135 |
% Here we define some abbreviations and synonyms for other |
| 2136 |
% macros. |
| 2137 |
% \begin{macrocode} |
| 2138 |
\let\gridchess=\stdgrid |
| 2139 |
\let\magic=\fieldframe |
| 2140 |
\let\tourn=\tournament |
| 2141 |
\let\dedic=\dedication |
| 2142 |
\let\stip=\stipulation |
| 2143 |
\let\cond=\condition |
| 2144 |
\let\rem=\remark |
| 2145 |
\let\sol=\solution |
| 2146 |
% \end{macrocode} |
| 2147 |
% \end{macro} |
| 2148 |
% \end{macro} |
| 2149 |
% \end{macro} |
| 2150 |
% \end{macro} |
| 2151 |
% \end{macro} |
| 2152 |
% \end{macro} |
| 2153 |
% \end{macro} |
| 2154 |
% \end{macro} |
| 2155 |
% |
| 2156 |
% \begin{macrocode} |
| 2157 |
\def\develop{% |
| 2158 |
\@developtrue% |
| 2159 |
\ignorespaces% |
| 2160 |
} |
| 2161 |
\def\showcomputer{% |
| 2162 |
\setboolean{showcomputer}{true}% |
| 2163 |
\ignorespaces% |
| 2164 |
} |
| 2165 |
\def\nocomputer{% |
| 2166 |
\setboolean{showcomputer}{false}% |
| 2167 |
\ignorespaces% |
| 2168 |
} |
| 2169 |
\def\putsol{\immediate\closeout\s@lfd\input\jobname.sol\cl@arsol} |
| 2170 |
\def\widedias{\@widediastrue\diagcenter} |
| 2171 |
\def\nowidedias{\@widediasfalse} |
| 2172 |
\def\normalnames{\normal@namestrue} |
| 2173 |
\def\reversednames{\normal@namesfalse} |
| 2174 |
\def\makeaindex{% |
| 2175 |
\@dia@index% |
| 2176 |
\newindex[thediag]{author}{adx}{and}{Autorenverzeichnis}% |
| 2177 |
\@aindextrue\reversednames% |
| 2178 |
} |
| 2179 |
|
| 2180 |
\def\makesindex{% |
| 2181 |
\@dia@index% |
| 2182 |
\newindex[thediag]{source}{sdx}{snd}{Quellenregister}% |
| 2183 |
\@sindextrue% |
| 2184 |
} |
| 2185 |
|
| 2186 |
\def\maketindex{% |
| 2187 |
\@dia@index% |
| 2188 |
\newindex[thediag]{theme}{tdx}{tnd}{Themenregister}% |
| 2189 |
\@tindextrue% |
| 2190 |
} |
| 2191 |
|
| 2192 |
\def\authorindex{{\let\@idxitem\@aidxitem\printindex[author]}} |
| 2193 |
\def\sourceindex{\printindex[source]} |
| 2194 |
\def\themeindex{\printindex[theme]} |
| 2195 |
\def\DefinePieces#1#2#3{% |
| 2196 |
\@setPieceColor#1\@setPieceSpec#2\@setPieceRotation#3% |
| 2197 |
\cpd@piecedef@rotations% |
| 2198 |
\expandafter\xdef\csname\ds@black\ds@white\ds@bishop\endcsname{% |
| 2199 |
\noexpand\ch@fig{20}% |
| 2200 |
}% |
| 2201 |
\expandafter\xdef\csname\ds@black\ds@black\ds@bishop\endcsname{% |
| 2202 |
\noexpand\ch@fig{32}% |
| 2203 |
}% |
| 2204 |
\expandafter\xdef\csname\ds@white F\endcsname{{\chessfont\ }} |
| 2205 |
\expandafter\xdef\csname\ds@black F\endcsname{{\chessfont\char144}} |
| 2206 |
\expandafter\xdef\csname\ds@white Nr\endcsname{% |
| 2207 |
\noexpand\ch@fig{109}% |
| 2208 |
}% |
| 2209 |
\expandafter\xdef\csname\ds@neutral Nr\endcsname{% |
| 2210 |
\noexpand\ch@fig{115}% |
| 2211 |
}% |
| 2212 |
\expandafter\xdef\csname\ds@black Nr\endcsname{% |
| 2213 |
\noexpand\ch@fig{121}% |
| 2214 |
}% |
| 2215 |
\expandafter\xdef\csname\ds@white Gh\endcsname{% |
| 2216 |
\noexpand\ch@fig{112}% |
| 2217 |
}% |
| 2218 |
\expandafter\xdef\csname\ds@neutral Gh\endcsname{% |
| 2219 |
\noexpand\ch@fig{118}% |
| 2220 |
}% |
| 2221 |
\expandafter\xdef\csname\ds@black Gh\endcsname{% |
| 2222 |
\noexpand\ch@fig{124}% |
| 2223 |
}% |
| 2224 |
\expandafter\xdef\csname\ds@white C\endcsname{% |
| 2225 |
\noexpand\ch@fig{145}% |
| 2226 |
}% |
| 2227 |
\expandafter\xdef\csname\ds@neutral C\endcsname{% |
| 2228 |
\noexpand\ch@fig{151}% |
| 2229 |
}% |
| 2230 |
\expandafter\xdef\csname\ds@black C\endcsname{% |
| 2231 |
\noexpand\ch@fig{157}% |
| 2232 |
}% |
| 2233 |
} |
| 2234 |
\def\Imi{\ch@fig{157}} |
| 2235 |
\def\wE{\ch@fig{216}} |
| 2236 |
\def\nE{\ch@fig{222}} |
| 2237 |
\def\sE{\ch@fig{228}} |
| 2238 |
\def\wX{\ch@fig{180}} |
| 2239 |
\def\nX{\ch@fig{186}} |
| 2240 |
\def\sX{\ch@fig{192}} |
| 2241 |
\def\cpd@whiteField{{\chessfont\ }} |
| 2242 |
\def\cpd@blackField{{\chessfont\char144}} |
| 2243 |
|
| 2244 |
% \end{macrocode} |
| 2245 |
% |
| 2246 |
% \begin{macro}{\dia@above} |
| 2247 |
% The content of the box above a diagram is controlled by the |
| 2248 |
% macro |\dia@above|. It just delegates the information to a |
| 2249 |
% couple of other macros, which then generate the displayed |
| 2250 |
% information above the diagram. |
| 2251 |
% \begin{macrocode} |
| 2252 |
\newboolean{above@newline} |
| 2253 |
\newcommand{\above@newline}{\ifthenelse{\boolean{above@newline}}{\linebreak}{\setboolean{above@newline}{true}}} |
| 2254 |
\def\dia@above{% |
| 2255 |
\setboolean{above@newline}{false}% |
| 2256 |
\@dia@number% |
| 2257 |
\@dia@authors% |
| 2258 |
\@dia@city% |
| 2259 |
\@dia@after% |
| 2260 |
\@dia@version% |
| 2261 |
\@dia@source% |
| 2262 |
\@dia@correction% |
| 2263 |
\@dia@tournament% |
| 2264 |
\@dia@award% |
| 2265 |
\@dia@dedic% |
| 2266 |
\@dia@fidealbum% |
| 2267 |
} |
| 2268 |
% \end{macrocode} |
| 2269 |
% \end{macro} |
| 2270 |
% |
| 2271 |
% \begin{macro}{\dia@below} |
| 2272 |
% As before, the macro |\dia@below| creates the displayed |
| 2273 |
% information below the chessboard - forwarding to a couple of other |
| 2274 |
% macros. |
| 2275 |
% \begin{macrocode} |
| 2276 |
\def\dia@below{% |
| 2277 |
\bgroup% |
| 2278 |
\if@stipulation% |
| 2279 |
\@dia@stipulation% |
| 2280 |
\fi% |
| 2281 |
\ifx@cond\else% |
| 2282 |
\@dia@condition% |
| 2283 |
\fi% |
| 2284 |
\ifx@twins\else% |
| 2285 |
\@dia@twins% |
| 2286 |
\fi% |
| 2287 |
\@dia@piecedefs% |
| 2288 |
\@dia@remark% |
| 2289 |
\ifthenelse{\boolean{@solafterdiagram}}{% |
| 2290 |
\below@newline% |
| 2291 |
\the\sol@tk% |
| 2292 |
}{}% |
| 2293 |
\noindent\hbox{}\newline\hbox{}% |
| 2294 |
\egroup% |
| 2295 |
} |
| 2296 |
% \end{macrocode} |
| 2297 |
% \end{macro} |
| 2298 |
% |
| 2299 |
% \begin{macro}{\@dia@number} |
| 2300 |
% The |\@dia@number| macro simply creates the diagram number in a |
| 2301 |
% single paragraph. |
| 2302 |
% \begin{macrocode} |
| 2303 |
\def\@dia@number{% |
| 2304 |
%\ifdi@no\above@newline{\authorfont\thediag}\fi% |
| 2305 |
\ifthenelse{\boolean{@cpd@numbering@local}}{% |
| 2306 |
\above@newline{\authorfont\thediag}% |
| 2307 |
}{}% |
| 2308 |
} |
| 2309 |
% \end{macrocode} |
| 2310 |
% \end{macro} |
| 2311 |
% |
| 2312 |
% \begin{macro}{\@dia@authors} |
| 2313 |
% This macro is used to create the list of authors specified |
| 2314 |
% within the |\author| macro inside the |diagram| environment. |
| 2315 |
% Depending on the \TeX-boolean |normal@names| we either simply |
| 2316 |
% display the registered author or parse the list of authors by |
| 2317 |
% using the generic |\@parseTokenList| macro. |
| 2318 |
% \begin{macrocode} |
| 2319 |
\def\@dia@authors{% |
| 2320 |
\ifauth@r% |
| 2321 |
\ifnormal@names% |
| 2322 |
\above@newline |
| 2323 |
{\authorfont\the\aut@tk}% |
| 2324 |
\else% |
| 2325 |
\let\@action=\@dia@writename% Parse the list of authors |
| 2326 |
\@parseTokenlist\aut@tk; |
| 2327 |
\fi% |
| 2328 |
\fi% |
| 2329 |
} |
| 2330 |
% \end{macrocode} |
| 2331 |
% \end{macro} |
| 2332 |
% |
| 2333 |
% \begin{macrocode} |
| 2334 |
\def\@show@city#1;{\if@notfirst\ \slash\ \else\@notfirsttrue\fi#1} |
| 2335 |
|
| 2336 |
\def\p@rsecity#1; {\@show@city#1;\l@@klist} |
| 2337 |
|
| 2338 |
\def\@dia@city{% |
| 2339 |
\ifthenelse{\boolean{showcity}}{% |
| 2340 |
\if@city% |
| 2341 |
\above@newline% |
| 2342 |
\bgroup% |
| 2343 |
\cityfont\@notfirstfalse% |
| 2344 |
\let\@action=\p@rsecity\@parseTokenlist\city@tk;% |
| 2345 |
\egroup% |
| 2346 |
\fi% |
| 2347 |
}{}% |
| 2348 |
} |
| 2349 |
|
| 2350 |
\def\@dia@after{% |
| 2351 |
\if@after% |
| 2352 |
\bgroup% |
| 2353 |
\above@newline% |
| 2354 |
\dedicfont\the\after@tk% |
| 2355 |
\egroup% |
| 2356 |
\fi% |
| 2357 |
} |
| 2358 |
|
| 2359 |
\def\@dia@version{% |
| 2360 |
\if@version% |
| 2361 |
\above@newline% |
| 2362 |
\bgroup% |
| 2363 |
\dedicfont\the\version@tk% |
| 2364 |
\egroup% |
| 2365 |
\fi% |
| 2366 |
} |
| 2367 |
|
| 2368 |
\def\@dia@date{% |
| 2369 |
\ifnum\from@month>\z@% |
| 2370 |
\if@day% |
| 2371 |
\the\day@tk.\write@month\from@month% |
| 2372 |
\else% |
| 2373 |
\write@month\from@month% |
| 2374 |
\fi% |
| 2375 |
\ifnum\to@month>\z@--\write@month\to@month\fi% |
| 2376 |
\if@day.\else/\fi% |
| 2377 |
\fi% |
| 2378 |
\if@year\the\year@tk\fi% |
| 2379 |
} |
| 2380 |
|
| 2381 |
\def\@dia@source{% |
| 2382 |
\if@source% |
| 2383 |
\above@newline% |
| 2384 |
\bgroup% |
| 2385 |
\sourcefont% |
| 2386 |
\if@sourcenr\the\sourcenr@tk\ \fi |
| 2387 |
\the\source@tk% |
| 2388 |
\if@date\ \ \fi\@dia@date% |
| 2389 |
\if@issue\ \ \the\issue@tk\fi% |
| 2390 |
\if@pages ,\ \the\pages@tk\fi% |
| 2391 |
\egroup% |
| 2392 |
\else% |
| 2393 |
\if@tournament\else\if@date% |
| 2394 |
\above@newline% |
| 2395 |
\bgroup% |
| 2396 |
\sourcefont% |
| 2397 |
\@dia@date% |
| 2398 |
\egroup% |
| 2399 |
\fi\fi% |
| 2400 |
\fi% |
| 2401 |
} |
| 2402 |
|
| 2403 |
\def\@dia@correction{% |
| 2404 |
\if@correction% |
| 2405 |
\above@newline% |
| 2406 |
\bgroup% |
| 2407 |
\dedicfont\the\correction@tk% |
| 2408 |
\egroup% |
| 2409 |
\fi% |
| 2410 |
} |
| 2411 |
|
| 2412 |
\def\@dia@tournament{% |
| 2413 |
\if@tournament |
| 2414 |
\above@newline% |
| 2415 |
\bgroup% |
| 2416 |
\awardfont% |
| 2417 |
\the\tournament@tk |
| 2418 |
\if@source\else\if@date% |
| 2419 |
\ \ \@dia@date% |
| 2420 |
\fi\fi% |
| 2421 |
\egroup% |
| 2422 |
\fi% |
| 2423 |
} |
| 2424 |
|
| 2425 |
\def\@dia@award{% |
| 2426 |
\if@award% |
| 2427 |
\above@newline% |
| 2428 |
\bgroup% |
| 2429 |
\awardfont\the\award@tk% |
| 2430 |
\egroup% |
| 2431 |
\fi% |
| 2432 |
} |
| 2433 |
|
| 2434 |
\def\@dia@dedic{% |
| 2435 |
\if@dedication% |
| 2436 |
\above@newline% |
| 2437 |
\bgroup% |
| 2438 |
\dedicfont\the\dedic@tk% |
| 2439 |
\egroup% |
| 2440 |
\fi% |
| 2441 |
} |
| 2442 |
|
| 2443 |
\def\@show@album#1/#2;{#1 FIDE-Album #2} |
| 2444 |
|
| 2445 |
\def\@dia@fidealbum{% |
| 2446 |
\if@fidealbum% |
| 2447 |
\above@newline% |
| 2448 |
{\expandafter\@show@album\the\fidealbum@tk;}% |
| 2449 |
\fi% |
| 2450 |
} |
| 2451 |
|
| 2452 |
\def\@twinskip{\ \ } |
| 2453 |
|
| 2454 |
\def\@dia@stipulation{% |
| 2455 |
\if@stipulation% |
| 2456 |
\bgroup% |
| 2457 |
\stipfont% |
| 2458 |
\the\stipulation@tk% |
| 2459 |
\ifx@twins% |
| 2460 |
\let\below@newline\@twinskip% |
| 2461 |
\@dia@twins% |
| 2462 |
\else\ifx@cond% |
| 2463 |
\let\below@newline\@twinskip% |
| 2464 |
\@dia@condition% |
| 2465 |
\fi\fi% |
| 2466 |
\egroup% |
| 2467 |
\let\below@newline\newline% |
| 2468 |
\else% |
| 2469 |
\x@twinsfalse% |
| 2470 |
\x@condfalse% |
| 2471 |
\let\below@newline\relax% |
| 2472 |
\fi% |
| 2473 |
} |
| 2474 |
|
| 2475 |
\def\x@write@twin#1; {% |
| 2476 |
\hskip1em#1% |
| 2477 |
\@lefttrue\let\below@newline\newline% |
| 2478 |
\let\@action\write@twins% |
| 2479 |
\l@@klist% |
| 2480 |
} |
| 2481 |
|
| 2482 |
\def\write@twins#1; {% |
| 2483 |
\setbox\@test@box=\hbox{#1\if@left~~\fi}% |
| 2484 |
\ifdim\wd\@test@box>4\sq@width% |
| 2485 |
\below@newline% |
| 2486 |
\@lefttrue% |
| 2487 |
#1% |
| 2488 |
\else% |
| 2489 |
\if@left% |
| 2490 |
\below@newline% |
| 2491 |
\fi% |
| 2492 |
\noindent\hbox to 4\sq@width{#1\hfil}% |
| 2493 |
\if@left% |
| 2494 |
\@leftfalse% |
| 2495 |
\else% |
| 2496 |
\@lefttrue% |
| 2497 |
\fi% |
| 2498 |
\fi% |
| 2499 |
\let\below@newline\newline% |
| 2500 |
\l@@klist% |
| 2501 |
} |
| 2502 |
|
| 2503 |
\def\@dia@twins{% |
| 2504 |
\if@twins% |
| 2505 |
\bgroup% |
| 2506 |
\@lefttrue% |
| 2507 |
\remfont% |
| 2508 |
\ifx@twins% |
| 2509 |
\let\@action=\x@write@twin% |
| 2510 |
\else% |
| 2511 |
\let\@action=\write@twins% |
| 2512 |
\fi% |
| 2513 |
\@parseTokenlist\twins@tk;% |
| 2514 |
\egroup% |
| 2515 |
\let\below@newline\newline% |
| 2516 |
\fi% |
| 2517 |
} |
| 2518 |
|
| 2519 |
\def\@dia@condition{% |
| 2520 |
\if@condition% |
| 2521 |
\bgroup% |
| 2522 |
\@lefttrue% |
| 2523 |
\remfont% |
| 2524 |
\ifx@cond% |
| 2525 |
\let\@action=\x@write@twin% |
| 2526 |
\else% |
| 2527 |
\let\@action=\write@twins% |
| 2528 |
\fi% |
| 2529 |
\@parseTokenlist\condition@tk;% |
| 2530 |
\egroup% |
| 2531 |
\let\below@newline\newline% |
| 2532 |
\fi% |
| 2533 |
} |
| 2534 |
|
| 2535 |
\def\check@piecedef{% |
| 2536 |
\ifx\next@piecedef\relax% |
| 2537 |
\let\col@action=\relax% |
| 2538 |
\else% |
| 2539 |
\let\col@action=\@@piecedef% |
| 2540 |
\fi% |
| 2541 |
\col@action% |
| 2542 |
} |
| 2543 |
\def\@@piecedef#1{\csname#1\x@piecedef\endcsname\parse@piecedef} |
| 2544 |
|
| 2545 |
\def\parse@piecedef{\futurelet\next@piecedef\check@piecedef} |
| 2546 |
|
| 2547 |
\def\@piecedef#1#2#3{% |
| 2548 |
\def\x@piecedef{#2}% |
| 2549 |
\below@newline% |
| 2550 |
\hbox{% |
| 2551 |
\parse@piecedef#1\relax% |
| 2552 |
\ = #3}% |
| 2553 |
} |
| 2554 |
|
| 2555 |
\def\write@piecedefs#1; {% |
| 2556 |
\@piecedef#1% |
| 2557 |
\l@@klist% |
| 2558 |
} |
| 2559 |
|
| 2560 |
\def\@dia@piecedefs{% |
| 2561 |
\if@piecedefs% |
| 2562 |
\bgroup% |
| 2563 |
\@lefttrue% |
| 2564 |
\let\below@newline\newline% |
| 2565 |
\remfont\let\@action=\write@piecedefs% |
| 2566 |
\@parseTokenlist\piecedefs@tk;% |
| 2567 |
\egroup% |
| 2568 |
\fi% |
| 2569 |
} |
| 2570 |
|
| 2571 |
\def\@dia@remark{% |
| 2572 |
\if@remark% |
| 2573 |
\bgroup% |
| 2574 |
\@lefttrue% |
| 2575 |
\remfont\let\@action=\write@twins% |
| 2576 |
\@parseTokenlist\remark@tk;% |
| 2577 |
\egroup% |
| 2578 |
\let\below@newline\newline% |
| 2579 |
\fi% |
| 2580 |
} |
| 2581 |
|
| 2582 |
\def\parse@params#1{% |
| 2583 |
\ifcase\help@a\relax |
| 2584 |
\label@tk={#1}\ifx\relax#1\else\@labeltrue\fi\or% |
| 2585 |
\number@tk={#1}\ifx\relax#1\else\@numbertrue\fi\or% |
| 2586 |
\aut@tk={#1}\ifx\relax#1\else\auth@rtrue\fi\or% |
| 2587 |
\city@tk={#1}\ifx\relax#1\else\@citytrue\fi\or% |
| 2588 |
\sourcenr@tk={#1}\ifx\relax#1\else\@sourcenrtrue\fi\or% |
| 2589 |
\source@tk={#1}\ifx\relax#1\else\@sourcetrue\fi\or% |
| 2590 |
\day@tk={#1}\ifx\relax#1\else\@daytrue\fi\or% |
| 2591 |
\from@month=#1\or% |
| 2592 |
\to@month=#1\or% |
| 2593 |
\year@tk={#1}\ifx\relax#1\else\@yeartrue\fi\or% |
| 2594 |
\issue@tk={#1}\ifx\relax#1\else\@issuetrue\fi\or% |
| 2595 |
\pages@tk={#1}\ifx\relax#1\else\@pagestrue\fi\or% |
| 2596 |
\tournament@tk={#1}\ifx\relax#1\else\@tournamenttrue\fi\or% |
| 2597 |
\award@tk={#1}\ifx\relax#1\else\@awardtrue\fi\or% |
| 2598 |
\after@tk={#1}\ifx\relax#1\else\@aftertrue\fi\or% |
| 2599 |
\version@tk={#1}\ifx\relax#1\else\@versiontrue\fi\or% |
| 2600 |
\correction@tk={#1}\ifx\relax#1\else\@correctiontrue\fi\or% |
| 2601 |
\dedic@tk={#1}\ifx\relax#1\else\@dedicationtrue\fi\or% |
| 2602 |
\theme@tk={#1}\ifx\relax#1\else\@themetrue\fi\or% |
| 2603 |
\twins@tk={#1}\ifx\relax#1\else\@twinstrue\fi\or% |
| 2604 |
\computer@tk={#1}\or% |
| 2605 |
\comment@tk={#1}\ifx\relax#1\else\@commenttrue\fi\or% |
| 2606 |
\judgement@tk={#1}\ifx\relax#1\else\@judgementtrue\fi\or% |
| 2607 |
\sol@tk={#1}% |
| 2608 |
\fi% |
| 2609 |
\advance\help@a \@ne% |
| 2610 |
\l@@klist% |
| 2611 |
} |
| 2612 |
|
| 2613 |
\def\split@param#1{% |
| 2614 |
\@labelfalse\@numberfalse\auth@rfalse\@cityfalse% |
| 2615 |
\@sourcenrfalse\@sourcefalse\@dayfalse\@yearfalse% |
| 2616 |
\@issuefalse\@pagesfalse\@tournamentfalse\@awardfalse% |
| 2617 |
\@afterfalse\@versionfalse\@correctionfalse\@dedicationfalse% |
| 2618 |
\@themefalse\@twinsfalse\@commentfalse\@judgementfalse% |
| 2619 |
\help@a=\z@% |
| 2620 |
\let\@action=\parse@params\l@@klist#1\e@list% |
| 2621 |
} |
| 2622 |
\newcommand{\solpar}{\par} |
| 2623 |
\def\@dia@solution{% |
| 2624 |
\bgroup% |
| 2625 |
\parindent\z@% |
| 2626 |
\parskip\tw@\p@% |
| 2627 |
{\bfseries% |
| 2628 |
\noindent\if@label\showlabel{\the\label@tk}\fi% |
| 2629 |
\if@number\the\number@tk) \fi% |
| 2630 |
\ifauth@r% |
| 2631 |
\ifnormal@names% |
| 2632 |
\the\aut@tk% |
| 2633 |
\else% |
| 2634 |
{\@notfirstfalse% We are the first one |
| 2635 |
\def\name@sep{, }% |
| 2636 |
\let\@action=\@sol@writename% |
| 2637 |
\@parseTokenlist\aut@tk;}:% |
| 2638 |
\fi% |
| 2639 |
\newline% |
| 2640 |
\fi% |
| 2641 |
}% |
| 2642 |
\if@develop\if@judgement\the\judgement@tk\solpar\fi\fi% |
| 2643 |
\the\sol@tk\solpar% |
| 2644 |
\if@comment\the\comment@tk\solpar\fi% |
| 2645 |
\egroup% |
| 2646 |
} |
| 2647 |
\grid@width=0.6\p@ |
| 2648 |
\inner@frame=0.6\p@ |
| 2649 |
\outer@frame=1.2\p@ |
| 2650 |
\space@frame=\outer@frame |
| 2651 |
\v@frame@dist=\tw@\p@% |
| 2652 |
\h@frame@dist=\tw@\p@% |
| 2653 |
\space@frame@dist=\z@ |
| 2654 |
\v@space@dist=1em |
| 2655 |
\def\@show@figurine{% |
| 2656 |
\noindent% |
| 2657 |
\@figurine@number% |
| 2658 |
\@figurine@author% |
| 2659 |
\@figurine@city% |
| 2660 |
\@figurine@after% |
| 2661 |
\@figurine@correction% |
| 2662 |
\@figurine@version% |
| 2663 |
\@figurine@source% |
| 2664 |
\@figurine@tournament% |
| 2665 |
\@figurine@award% |
| 2666 |
\@figurine@dedic% |
| 2667 |
\@figurine@pieces% |
| 2668 |
\@figurine@stip% |
| 2669 |
\@figurine@twins% |
| 2670 |
\@figurine@conditions% |
| 2671 |
\@figurine@remarks% |
| 2672 |
\@figurine@computer% |
| 2673 |
} |
| 2674 |
\def\@figurine@number{{\authorfont\thediag)}} |
| 2675 |
|
| 2676 |
\def\p@rseauthor@figurine#1,#2; {% |
| 2677 |
\if@notfirst, \else\@notfirsttrue\fi#2 #1% |
| 2678 |
\l@@klist% |
| 2679 |
} |
| 2680 |
|
| 2681 |
\def\@figurine@author{% |
| 2682 |
{\ifauth@r% |
| 2683 |
\authorfont\@notfirstfalse% |
| 2684 |
\let\@action=\p@rseauthor@figurine% |
| 2685 |
\@parseTokenlist\aut@tk;% |
| 2686 |
\ \ % |
| 2687 |
\fi}% |
| 2688 |
} |
| 2689 |
|
| 2690 |
\def\@figurine@city{% |
| 2691 |
{\if@city% |
| 2692 |
\cityfont\@notfirstfalse% |
| 2693 |
\let\@action=\p@rsecity\@parseTokenlist\city@tk;% |
| 2694 |
\ \ \ % |
| 2695 |
\fi}% |
| 2696 |
} |
| 2697 |
|
| 2698 |
\def\@figurine@after{\if@after{\dedicfont\ \ \the\after@tk}\fi} |
| 2699 |
|
| 2700 |
\def\@figurine@correction{% |
| 2701 |
\if@correction{\dedicfont\ \ \the\correction@tk}\fi% |
| 2702 |
} |
| 2703 |
|
| 2704 |
\def\@figurine@version{% |
| 2705 |
\if@version{\dedicfont\ \ \the\version@tk}\fi% |
| 2706 |
} |
| 2707 |
|
| 2708 |
\def\@figurine@source{% |
| 2709 |
{\if@source% |
| 2710 |
\sourcefont% |
| 2711 |
\if@sourcenr\the\sourcenr@tk\ \fi% |
| 2712 |
\the\source@tk% |
| 2713 |
\if@date\ \ \fi\@dia@date% |
| 2714 |
\if@issue , \the\issue@tk\fi% |
| 2715 |
\if@pages , \the\pages@tk\fi% |
| 2716 |
\fi}% |
| 2717 |
} |
| 2718 |
|
| 2719 |
\def\@figurine@tournament{% |
| 2720 |
\if@tournament{\awardfont\ \ \the\tournament@tk}\fi% |
| 2721 |
} |
| 2722 |
|
| 2723 |
\def\@figurine@award{% |
| 2724 |
\if@award{\awardfont\ \ \the\award@tk}\fi% |
| 2725 |
} |
| 2726 |
|
| 2727 |
\def\@figurine@dedic{% |
| 2728 |
\if@dedication{\awardfont\ \ \the\dedic@tk}\fi% |
| 2729 |
} |
| 2730 |
\def\show@squares#1\e@list{\ch@fig{\the\help@a}#1, } |
| 2731 |
|
| 2732 |
\def\@figurine@pieces{% |
| 2733 |
{\if@pieces% |
| 2734 |
\let\@action=\p@rsepieces% |
| 2735 |
\let\piece@job\show@squares% |
| 2736 |
\@parseTokenlist\pieces@tk,% |
| 2737 |
\fi}% |
| 2738 |
} |
| 2739 |
\def\@figurine@stip{% |
| 2740 |
\if@stipulation{\stipfont\ \ \the\stipulation@tk}\fi% |
| 2741 |
} |
| 2742 |
|
| 2743 |
\def\@figurine@conditions{% |
| 2744 |
\if@condition{\remfont\ \ \the\condition@tk}\fi% |
| 2745 |
} |
| 2746 |
|
| 2747 |
\def\@figurine@twins{% |
| 2748 |
\if@twins{\remfont\ \ \the\twins@tk}\fi% |
| 2749 |
} |
| 2750 |
|
| 2751 |
\def\@figurine@computer{% |
| 2752 |
\ifthenelse{\boolean{showcomputer}}{% |
| 2753 |
\if@computer\ \computerproofedsymbol\fi% |
| 2754 |
}{}% |
| 2755 |
} |
| 2756 |
|
| 2757 |
\def\@figurine@remarks{% |
| 2758 |
\if@remark{\stipfont\ \ \the\remark@tk}\fi% |
| 2759 |
} |
| 2760 |
\def\do@dia@job{\@write@sol\ifvmode\noindent\fi\unhbox\dia@box} |
| 2761 |
\def\solhead#1{{\split@param{#1}\@dia@solution}} |
| 2762 |
\def\@write@sol{% |
| 2763 |
\ifs@lu% |
| 2764 |
\immediate\write\s@lfd{% |
| 2765 |
\noexpand\solhead{% |
| 2766 |
{\the\label@tk}% |
| 2767 |
{\thediag}% |
| 2768 |
{\the\aut@tk}% |
| 2769 |
{\the\city@tk}% |
| 2770 |
{\the\sourcenr@tk}% |
| 2771 |
{\the\source@tk}% |
| 2772 |
{\the\day@tk}% |
| 2773 |
{\the\from@month}% |
| 2774 |
{\the\to@month}% |
| 2775 |
{\the\year@tk}% |
| 2776 |
{\the\issue@tk}% |
| 2777 |
{\the\pages@tk}% |
| 2778 |
{\the\tournament@tk}% |
| 2779 |
{\the\award@tk}% |
| 2780 |
{\the\after@tk}% |
| 2781 |
{\the\version@tk}% |
| 2782 |
{\the\correction@tk}% |
| 2783 |
{\the\dedic@tk}% |
| 2784 |
{\the\theme@tk}% |
| 2785 |
{\the\twins@tk}% |
| 2786 |
{\the\computer@tk}% |
| 2787 |
{\the\comment@tk}% |
| 2788 |
{\the\judgement@tk}% |
| 2789 |
{\the\sol@tk}% |
| 2790 |
} %end of \solhead |
| 2791 |
}% |
| 2792 |
\fi |
| 2793 |
} |
| 2794 |
\def\@months#1-#2;{\from@month=#1\to@month=#2\@datetrue} |
| 2795 |
\def\@dia@writename#1; {\above@newline{\authorfont\@dianame#1; }\l@@klist} |
| 2796 |
\def\@sol@writename#1; {\sep@names\@solname#1; \l@@klist} |
| 2797 |
\def\name@sep{,\ } |
| 2798 |
\def\sep@names{\if@notfirst\name@sep\else\@notfirsttrue\fi} |
| 2799 |
\def\@checkshort#1/#2#3;{% |
| 2800 |
\@shortformtrue% |
| 2801 |
\ifx#2\e@list\relax% |
| 2802 |
\@shortformfalse% |
| 2803 |
\fi% |
| 2804 |
} |
| 2805 |
\def\short@christian#1#2-{% |
| 2806 |
\if@notfirst -\else\@notfirsttrue\fi% |
| 2807 |
#1.% |
| 2808 |
\l@@klist% |
| 2809 |
} |
| 2810 |
|
| 2811 |
\def\@write@christian#1/#2;{#1} |
| 2812 |
|
| 2813 |
\def\write@christian#1;{% |
| 2814 |
\@checkshort#1/\e@list;% |
| 2815 |
\if@shortform\@write@christian#1;\else#1\fi% |
| 2816 |
} |
| 2817 |
|
| 2818 |
\def\@write@short#1/#2;{#2} |
| 2819 |
|
| 2820 |
\def\write@short#1;{% |
| 2821 |
\@checkshort#1/\e@list;% |
| 2822 |
\if@shortform% |
| 2823 |
\@write@short#1;% |
| 2824 |
\else% |
| 2825 |
{\@notfirstfalse\let\@action\short@christian\l@@klist#1-\e@list}% |
| 2826 |
\fi% |
| 2827 |
} |
| 2828 |
\def\@fullname#1, #2; {\write@christian#2; #1} |
| 2829 |
\def\@sirname#1, #2; {#1} |
| 2830 |
\def\@short#1, #2; {\write@short#2;\ #1} |
| 2831 |
\def\@noname#1, #2; {} |
| 2832 |
\def\@normalname#1; {#1} |
| 2833 |
\def\space@vertical{\space@verticaltrue} |
| 2834 |
\def\space@horizontal{\space@verticalfalse} |
| 2835 |
\def\cl@arsol{\immediate\openout\s@lfd=\jobname.sol\relax} |
| 2836 |
\def\getc@lor#1{% |
| 2837 |
\if#1\ds@white% |
| 2838 |
\help@a\z@\global% |
| 2839 |
\let\cpd@stepcounterPieces\cpd@stepcounterWhite% |
| 2840 |
\else\if#1\ds@neutral% |
| 2841 |
\help@a=6\global% |
| 2842 |
\let\cpd@stepcounterPieces\cpd@stepcounterNeutral% |
| 2843 |
\else\if#1\ds@black% |
| 2844 |
\help@a=12\global% |
| 2845 |
\let\cpd@stepcounterPieces\cpd@stepcounterBlack% |
| 2846 |
\else\errmessage{invalid color!}% |
| 2847 |
\fi\fi\fi% |
| 2848 |
\getpi@ce% |
| 2849 |
} |
| 2850 |
|
| 2851 |
\def\get@text#1{\text@tk={#1}\read@square} |
| 2852 |
|
| 2853 |
\def\getpi@ce#1{% |
| 2854 |
\IfStrEqCase{#1}{% |
| 2855 |
{\ds@pawn}{}% |
| 2856 |
{\ds@knight}{\advance\help@a\@ne}% |
| 2857 |
{\ds@bishop}{\advance\help@a\tw@}% |
| 2858 |
{\ds@rook}{\advance\help@a\thr@@}% |
| 2859 |
{\ds@queen}{\advance\help@a\f@ur}% |
| 2860 |
{\ds@king}{\advance\help@a 5}% |
| 2861 |
{C}{% |
| 2862 |
\let\cpd@stepcounterPieces\relax |
| 2863 |
\advance\help@a 145% |
| 2864 |
}% |
| 2865 |
{E}{\advance\help@a 216}% |
| 2866 |
{X}{\advance\help@a 180}% |
| 2867 |
}[\errmessage{invalid piece!}]% |
| 2868 |
\futurelet\r@tate\chkr@tate% |
| 2869 |
} |
| 2870 |
|
| 2871 |
\def\chkr@tate{% |
| 2872 |
% \IfStrEqCase{\r@tate}{% |
| 2873 |
% {\ds@rotation@upsidedown}{% |
| 2874 |
% \advance\help@a 108% |
| 2875 |
% \let\nextpr@c=\skipr@t% |
| 2876 |
% }% |
| 2877 |
% {\ds@rotation@left}{% |
| 2878 |
% \advance\help@a 36% |
| 2879 |
% \let\nextpr@c=\skipr@t% |
| 2880 |
% }% |
| 2881 |
% {\ds@rotation@right}{% |
| 2882 |
% \advance\help@a 72% |
| 2883 |
% \let\nextpr@c=\skipr@t% |
| 2884 |
% }% |
| 2885 |
% }[\let\nextpr@c\piece@job]% |
| 2886 |
\if\r@tate \ds@rotation@upsidedown\advance\help@a 108\let\nextpr@c=\skipr@t\else% |
| 2887 |
\if\r@tate \ds@rotation@left\advance\help@a 36\let\nextpr@c=\skipr@t\else% |
| 2888 |
\if\r@tate \ds@rotation@right\advance\help@a 72\let\nextpr@c=\skipr@t\else% |
| 2889 |
\let\nextpr@c\piece@job\fi\fi\fi% |
| 2890 |
\nextpr@c% |
| 2891 |
} |
| 2892 |
\def\skipr@t#1{\piece@job} |
| 2893 |
\def\l@@k{\futurelet\whatsnext\parsefi@lds} |
| 2894 |
\def\parsefi@lds{% |
| 2895 |
\if\whatsnext\e@list% |
| 2896 |
\let\nextpr@c\relax% |
| 2897 |
\else |
| 2898 |
\let\nextpr@c\read@square% |
| 2899 |
\fi% |
| 2900 |
\nextpr@c% |
| 2901 |
} |
| 2902 |
|
| 2903 |
\def\set@current@square@index#1#2{% |
| 2904 |
\setcounter{cpd@current@square@index}{#1+\value{cpd@lines}*#2}% |
| 2905 |
} |
| 2906 |
\def\set@current@square@value#1{% |
| 2907 |
\expandafter% |
| 2908 |
\xdef\csname cpd@square@\roman{cpd@current@square@index}\endcsname{#1}% |
| 2909 |
} |
| 2910 |
\def\get@current@square@value{% |
| 2911 |
\setcounter{cpd@current@square@value}% |
| 2912 |
{\csname cpd@square@\roman{cpd@current@square@index}\endcsname}% |
| 2913 |
} |
| 2914 |
\def\@cpd@setpiece{% |
| 2915 |
\ifthenelse{\value{cpd@plane}=\value{cpd@current@plane}}{% |
| 2916 |
\cpd@stepcounterPieces% |
| 2917 |
\set@current@square@index{\value{cpd@line}}{\value{cpd@row}}% |
| 2918 |
\get@current@square@value% |
| 2919 |
\ifthenelse{\value{cpd@current@square@value}=\m@ne}% |
| 2920 |
{\set@current@square@value{\the\help@a}}% |
| 2921 |
{\ifthenelse{\value{cpd@current@square@value}=144}% |
| 2922 |
{\set@current@square@value{\the\help@a+18}}% |
| 2923 |
{\errmessage{Trying to set a piece to an occupied square.}}}% |
| 2924 |
}{}% |
| 2925 |
} |
| 2926 |
\def\set@piece{% |
| 2927 |
\@cpd@setpiece% |
| 2928 |
\l@@k% |
| 2929 |
} |
| 2930 |
\def\set@nofield, {% |
| 2931 |
\ifthenelse{\value{cpd@plane}=\value{cpd@current@plane}}{% |
| 2932 |
\set@current@square@index{\value{cpd@line}}{\value{cpd@row}}% |
| 2933 |
\get@current@square@value% |
| 2934 |
\ifthenelse{\value{cpd@current@square@value}=\m@ne}% |
| 2935 |
{}% This is an empty white square, nothing to do |
| 2936 |
{\ifthenelse{\value{cpd@current@square@value}=144}% |
| 2937 |
{\set@current@square@value{\m@ne}}% |
| 2938 |
{\errmessage{Trying to set a piece to an occupied square}}}% |
| 2939 |
}{}% |
| 2940 |
\l@@klist% |
| 2941 |
} |
| 2942 |
\def\set@frame, {% |
| 2943 |
\ifthenelse{\value{cpd@plane}=\value{cpd@current@plane}}{% |
| 2944 |
\@vGrid{\value{cpd@line}}{\value{cpd@row}}\@ne% |
| 2945 |
\@hGrid{\value{cpd@line}}{\value{cpd@row}}\@ne% |
| 2946 |
\addtocounter{cpd@line}{1}% |
| 2947 |
\@vGrid{\value{cpd@line}}{\value{cpd@row}}\@ne% |
| 2948 |
\addtocounter{cpd@line}{-1}% |
| 2949 |
\addtocounter{cpd@row}{1}% |
| 2950 |
\@hGrid{\value{cpd@line}}{\value{cpd@row}}\@ne% |
| 2951 |
}{}% |
| 2952 |
\l@@klist% |
| 2953 |
} |
| 2954 |
\def\e@list{\relax} |
| 2955 |
\def\l@@klist{\futurelet\nextlist\ch@cklst} |
| 2956 |
\def\ch@cklst{% |
| 2957 |
\ifx\nextlist\e@list% |
| 2958 |
\let\nextpr@c=\relax% |
| 2959 |
\else% |
| 2960 |
\let\nextpr@c=\@action% |
| 2961 |
\fi% |
| 2962 |
\nextpr@c% |
| 2963 |
} |
| 2964 |
\def\@cpd@handle@fen#1{% |
| 2965 |
\ifx#1/\relax% |
| 2966 |
\ifthenelse{\value{cpd@line}=8}% |
| 2967 |
{% |
| 2968 |
\setcounter{cpd@line}{0}% |
| 2969 |
\addtocounter{cpd@row}{\m@ne}% |
| 2970 |
}% |
| 2971 |
{% |
| 2972 |
\errmessage{FEN: there is now row to end here.}% |
| 2973 |
}% |
| 2974 |
\fi% FEN space issue |
| 2975 |
\IfSubStr{12345678}{#1}{% |
| 2976 |
\addtocounter{cpd@line}{#1}% |
| 2977 |
}{}% |
| 2978 |
\IfSubStr{KQRBNP}{#1}{% |
| 2979 |
\let\cpd@stepcounterPieces\cpd@stepcounterWhite% |
| 2980 |
\IfStrEqCase{#1}{% |
| 2981 |
{K}{\help@a=5}% |
| 2982 |
{Q}{\help@a=4}% |
| 2983 |
{R}{\help@a=3}% |
| 2984 |
{B}{\help@a=2}% |
| 2985 |
{N}{\help@a=1}% |
| 2986 |
{P}{\help@a=0}% |
| 2987 |
} |
| 2988 |
\@cpd@setpiece% |
| 2989 |
\addtocounter{cpd@line}{\@ne}% |
| 2990 |
}{}% |
| 2991 |
\IfSubStr{kqrbnp}{#1}{% |
| 2992 |
\let\cpd@stepcounterPieces\cpd@stepcounterBlack% |
| 2993 |
\IfStrEqCase{#1}{% |
| 2994 |
{k}{\help@a=17}% |
| 2995 |
{q}{\help@a=16}% |
| 2996 |
{r}{\help@a=15}% |
| 2997 |
{b}{\help@a=14}% |
| 2998 |
{n}{\help@a=13}% |
| 2999 |
{p}{\help@a=12}% |
| 3000 |
} |
| 3001 |
\@cpd@setpiece% |
| 3002 |
\addtocounter{cpd@line}{\@ne}% |
| 3003 |
}{}% |
| 3004 |
} |
| 3005 |
\def\@cpd@parse@fen#1{\@cpd@handle@fen#1\l@@klist} |
| 3006 |
\def\p@rsepieces#1, {\getc@lor#1\e@list\l@@klist} |
| 3007 |
\def\p@rsetext#1, {\get@text#1\e@list\l@@klist} |
| 3008 |
\def\set@text{% |
| 3009 |
\ifthenelse{\value{cpd@plane}=\value{cpd@current@plane}}{% |
| 3010 |
\raise\value{cpd@row}\sq@width\hbox to \z@{% |
| 3011 |
\hskip\value{cpd@line}\sq@width% |
| 3012 |
\vbox to \sq@width{\vss% |
| 3013 |
\hbox to \sq@width{% |
| 3014 |
\hss% |
| 3015 |
{\the\text@tk}% |
| 3016 |
\hss% |
| 3017 |
}\vss}% |
| 3018 |
\hss% |
| 3019 |
}% |
| 3020 |
}{}% |
| 3021 |
\l@@klist% |
| 3022 |
} |
| 3023 |
\def\p@rseauthor#1; {\sh@wauthor#1;\l@@klist} |
| 3024 |
\def\read@square#1#2{% |
| 3025 |
\setcounter{cpd@line}{`#1-`a}% |
| 3026 |
\setcounter{cpd@row}{#2-1}% |
| 3027 |
\read@plane% |
| 3028 |
} |
| 3029 |
\def\read@plane@normal{\plane@job} |
| 3030 |
|
| 3031 |
\def\read@plane@stereo{\futurelet\plane@char\get@plane@stereo} |
| 3032 |
|
| 3033 |
\def\get@plane@stereo{% |
| 3034 |
\if\plane@char A% |
| 3035 |
\setcounter{cpd@plane}{1}% |
| 3036 |
\addtocounter{cpd@row}{-2}% |
| 3037 |
\addtocounter{cpd@line}{-2}% |
| 3038 |
\let\@plane@job=\skip@plane% |
| 3039 |
\else\if\plane@char B% |
| 3040 |
\setcounter{cpd@plane}{2}% |
| 3041 |
\addtocounter{cpd@row}{-2}% |
| 3042 |
\addtocounter{cpd@line}{-2}% |
| 3043 |
\let\@plane@job=\skip@plane% |
| 3044 |
\else\if\plane@char C% |
| 3045 |
\setcounter{cpd@plane}{3}% |
| 3046 |
\addtocounter{cpd@row}{-2}% |
| 3047 |
\addtocounter{cpd@line}{-2}% |
| 3048 |
\let\@plane@job=\skip@plane% |
| 3049 |
\else\if\plane@char D% |
| 3050 |
\setcounter{cpd@plane}{4}% |
| 3051 |
\addtocounter{cpd@row}{-2}% |
| 3052 |
\addtocounter{cpd@line}{-2}% |
| 3053 |
\let\@plane@job=\skip@plane% |
| 3054 |
\else% |
| 3055 |
\setcounter{cpd@plane}{0}% |
| 3056 |
\let\@plane@job=\plane@job% |
| 3057 |
\fi\fi\fi\fi% |
| 3058 |
\@plane@job% |
| 3059 |
} |
| 3060 |
|
| 3061 |
\def\skip@plane#1{\plane@job} |
| 3062 |
|
| 3063 |
\def\read@plane@space#1{% |
| 3064 |
\setcounter{cpd@plane}{`#1-`A}% |
| 3065 |
\plane@job% |
| 3066 |
} |
| 3067 |
\def\@vGrid#1#2#3{% |
| 3068 |
\raise#2\sq@width\hbox to \z@{% |
| 3069 |
\hskip#1\sq@width\hskip-.5\grid@width% |
| 3070 |
\vrule height#3\sq@width width\grid@width\hss% |
| 3071 |
}% |
| 3072 |
} |
| 3073 |
|
| 3074 |
\def\@hGrid#1#2#3{% |
| 3075 |
\raise#2\sq@width\hbox to \z@{% |
| 3076 |
\hskip#1\sq@width% |
| 3077 |
\vrule width#3\sq@width height .5\grid@width depth% |
| 3078 |
.5\grid@width\hss% |
| 3079 |
}% |
| 3080 |
} |
| 3081 |
\def\@selGrid#1#2, {% |
| 3082 |
\ifthenelse{\value{cpd@plane}=\value{cpd@current@plane}}{% |
| 3083 |
\if#1h% |
| 3084 |
\@hGrid#2% |
| 3085 |
\else\if#1v% |
| 3086 |
\@vGrid#2% |
| 3087 |
\else% |
| 3088 |
\errmessage{Wrong GridSelector #1}% |
| 3089 |
\fi\fi% |
| 3090 |
}{}% |
| 3091 |
\l@@klist% |
| 3092 |
} |
| 3093 |
\def\@stdgrid{% |
| 3094 |
\setbox\plane@box=\vbox{\hbox{% |
| 3095 |
\help@a=\tw@% |
| 3096 |
\whiledo{\help@a<\value{cpd@lines}}{% |
| 3097 |
\@vGrid{\the\help@a}{0}{\value{cpd@rows}}% |
| 3098 |
\advance\help@a\tw@% |
| 3099 |
}% |
| 3100 |
\help@a=\tw@% |
| 3101 |
\whiledo{\help@a<\value{cpd@rows}}{% |
| 3102 |
\@hGrid{0}{\the\help@a}{\value{cpd@lines}}% |
| 3103 |
\advance\help@a\tw@% |
| 3104 |
}% |
| 3105 |
\box\plane@box |
| 3106 |
}}% |
| 3107 |
} |
| 3108 |
\def\ds@xlabel#1{% |
| 3109 |
\label@tk={#1}\@labeltrue% |
| 3110 |
} |
| 3111 |
|
| 3112 |
\def\@set@label#1;{\ifds@label\label{#1}\fi} |
| 3113 |
\def\init@vars{% |
| 3114 |
\global\s@lufalse |
| 3115 |
\ifthenelse{\boolean{@cpd@numbering@global}}{% |
| 3116 |
\setboolean{@cpd@numbering@local}{true}% |
| 3117 |
}{% |
| 3118 |
\setboolean{@cpd@numbering@local}{false}% |
| 3119 |
}% |
| 3120 |
\setboolean{cpd@checkPieceCounts}{false}% |
| 3121 |
\setcounter{cpd@defWhitePieces}{\z@}% |
| 3122 |
\setcounter{cpd@defBlackPieces}{\z@}% |
| 3123 |
\setcounter{cpd@defNeutralPieces}{\z@}% |
| 3124 |
\setcounter{cpd@whitePieces}{\z@}% |
| 3125 |
\setcounter{cpd@blackPieces}{\z@}% |
| 3126 |
\setcounter{cpd@neutralPieces}{\z@}% |
| 3127 |
\setcounter{cpd@line}{0}% |
| 3128 |
} |
| 3129 |
|
| 3130 |
\def\clear@board{% |
| 3131 |
\ifthenelse{\boolean{allwhite}\and\boolean{switchcolors}}% |
| 3132 |
{\errmessage{'allwhite' and 'switchcolors' do not make sense used together.}}% |
| 3133 |
{\@whitefield=\m@ne\@blackfield=144}% |
| 3134 |
\ifthenelse{\boolean{allwhite}}{\@blackfield=\m@ne}{}% |
| 3135 |
\ifthenelse{\boolean{switchcolors}}{\@whitefield=144\@blackfield=\m@ne}{}% |
| 3136 |
\setcounter{cpd@row}{0}% |
| 3137 |
\whiledo{\value{cpd@row}<\value{cpd@rows}}{% |
| 3138 |
\setcounter{cpd@line}{0}% |
| 3139 |
\whiledo{\value{cpd@line}<\value{cpd@lines}}{% |
| 3140 |
\set@current@square@index{\value{cpd@line}}{\value{cpd@row}}% |
| 3141 |
\setcounter{cpd@helper}{% |
| 3142 |
\value{cpd@current@plane}% |
| 3143 |
+\value{cpd@line}% |
| 3144 |
+\value{cpd@row}}% |
| 3145 |
\ifthenelse{\isodd{\value{cpd@helper}}}% |
| 3146 |
{\set@current@square@value{\@whitefield}}% |
| 3147 |
{\set@current@square@value{\@blackfield}}% |
| 3148 |
\addtocounter{cpd@line}{\@ne}% |
| 3149 |
}% |
| 3150 |
\addtocounter{cpd@row}{\@ne}% |
| 3151 |
}% |
| 3152 |
} |
| 3153 |
|
| 3154 |
|
| 3155 |
\def\put@row#1{% |
| 3156 |
\setcounter{cpd@row}{#1}% |
| 3157 |
\setcounter{cpd@row@display}{#1 + 1}% |
| 3158 |
\setcounter{cpd@line}{0}% |
| 3159 |
\hbox{% |
| 3160 |
\ifthenelse{\boolean{legend}}{{% |
| 3161 |
\llap{\raise .1\sq@width\hbox{\legendfont\arabic{cpd@row@display}\ \ }}% |
| 3162 |
}}{}% |
| 3163 |
\if@stereo% |
| 3164 |
\ifthenelse{\value{cpd@current@plane}>0}{% |
| 3165 |
\ifthenelse{\value{cpd@row} = 3}{% |
| 3166 |
\llap{\cpd@boardfont c6\ }% |
| 3167 |
}{}% |
| 3168 |
% \fi% |
| 3169 |
}{}% |
| 3170 |
% \fi% |
| 3171 |
\fi% |
| 3172 |
% \hbox to \z@{\vbox to \sq@width{}}% |
| 3173 |
\set@current@square@index{\value{cpd@line}}{#1}% |
| 3174 |
\begin{tikzpicture}[x=\sq@width,y=\sq@width]% |
| 3175 |
\useasboundingbox (0, 0) rectangle (\value{cpd@lines}, 1);% |
| 3176 |
\whiledo{\value{cpd@line} < \value{cpd@lines}}{% |
| 3177 |
\get@current@square@value% |
| 3178 |
\ifthenelse{\value{cpd@current@square@value}=\m@ne}% |
| 3179 |
{}% |
| 3180 |
{% |
| 3181 |
\draw (\value{cpd@line}+.5, .5)% |
| 3182 |
node {{\chessfont\char\value{cpd@current@square@value}}};% |
| 3183 |
}% |
| 3184 |
\addtocounter{cpd@line}{1}% |
| 3185 |
\addtocounter{cpd@current@square@index}{1}% |
| 3186 |
}% |
| 3187 |
\end{tikzpicture}% |
| 3188 |
}% |
| 3189 |
} |
| 3190 |
\def\cpd@fen@parseTokenlist#1{\expandafter\l@@klist\the#1\e@list} |
| 3191 |
\def\@parseTokenlist#1#2{\expandafter\l@@klist\the#1#2 \e@list} |
| 3192 |
\def\@addToPlane#1{% |
| 3193 |
\setbox\plane@box=\vbox{\hbox{% |
| 3194 |
\@parseTokenlist#1,% |
| 3195 |
\box\plane@box% |
| 3196 |
}}% |
| 3197 |
} |
| 3198 |
\def\put@plane{% |
| 3199 |
% We might want gridchess |
| 3200 |
\if@stdgrid% |
| 3201 |
\@stdgrid% |
| 3202 |
\fi% |
| 3203 |
% Let us first set the fieldframes |
| 3204 |
\if@fieldframe% |
| 3205 |
\let\@action\read@square% |
| 3206 |
\let\plane@job\set@frame% |
| 3207 |
\@addToPlane\fieldframe@tk% |
| 3208 |
\fi% |
| 3209 |
% Now we set text to all squares which are given using \fieldtext |
| 3210 |
\if@fieldtext% |
| 3211 |
\let\@action\p@rsetext% |
| 3212 |
\let\plane@job\set@text% |
| 3213 |
\@addToPlane\fieldtext@tk% |
| 3214 |
\fi% |
| 3215 |
% Then we should add the gridlines |
| 3216 |
\if@gridlines% |
| 3217 |
\let\@action\read@plane% |
| 3218 |
\let\plane@job\@selGrid% |
| 3219 |
\@addToPlane\gridlines@tk% |
| 3220 |
\else% |
| 3221 |
\if@stereo% |
| 3222 |
\stereo@center% |
| 3223 |
\fi% |
| 3224 |
\fi% |
| 3225 |
% In an 'allwhite' diagram we display dotted lines |
| 3226 |
\ifthenelse{\boolean{allwhite}}{% |
| 3227 |
\setbox\plane@box=\vbox{\hbox{% |
| 3228 |
\begin{tikzpicture}[x=\sq@width,y=\sq@width]% |
| 3229 |
\useasboundingbox |
| 3230 |
(0, 0) rectangle (\value{cpd@lines}, \value{cpd@rows}); |
| 3231 |
\setcounter{field@border}{1}% |
| 3232 |
\whiledo{\value{field@border}<\value{cpd@lines}}{% |
| 3233 |
\draw[densely dotted] |
| 3234 |
(\value{field@border},0) |
| 3235 |
-- |
| 3236 |
(\value{field@border},\value{cpd@rows}); |
| 3237 |
\addtocounter{field@border}{\@ne}% |
| 3238 |
}% |
| 3239 |
\setcounter{field@border}{1}% |
| 3240 |
\whiledo{\value{field@border}<\value{cpd@rows}}{% |
| 3241 |
\draw[densely dotted] |
| 3242 |
(0, \value{field@border}) |
| 3243 |
-- |
| 3244 |
(\value{cpd@lines}, \value{field@border}); |
| 3245 |
\addtocounter{field@border}{\@ne}% |
| 3246 |
}% |
| 3247 |
\end{tikzpicture}% |
| 3248 |
\box\plane@box% |
| 3249 |
}}% |
| 3250 |
}{}% |
| 3251 |
% Now we should clear the board |
| 3252 |
\clear@board% |
| 3253 |
% Let us now parse the list of pieces |
| 3254 |
\ifthenelse{\boolean{@cpd@fen}}{% |
| 3255 |
\ifthenelse{\value{cpd@rows}=8}{}{\errmessage{FEN is only allowed for 8x8 boards.}}% FEN space issue |
| 3256 |
\ifthenelse{\value{cpd@lines}=8}{}{\errmessage{FEN is only allowed for 8x8 boards.}}% FEN space issue |
| 3257 |
\setcounter{cpd@row}{7}% |
| 3258 |
\setcounter{cpd@line}{0}% |
| 3259 |
\let\@action\@cpd@parse@fen% |
| 3260 |
\cpd@fen@parseTokenlist\fen@tk\e@list% FEN space issue |
| 3261 |
}{}% |
| 3262 |
\if@pieces% |
| 3263 |
\let\@action\p@rsepieces% |
| 3264 |
\let\piece@job\l@@k\let\plane@job\set@piece% |
| 3265 |
\@parseTokenlist\pieces@tk,% |
| 3266 |
\fi% |
| 3267 |
% Now we clear all fields, which are given using \nofields |
| 3268 |
\if@nofields% |
| 3269 |
\let\@action\read@square% |
| 3270 |
\let\plane@job\set@nofield% |
| 3271 |
\@parseTokenlist\nofields@tk,% |
| 3272 |
\fi% |
| 3273 |
% Now we can put the pieces to the board |
| 3274 |
\global\setbox\plane@box=\hbox{% |
| 3275 |
\vbox{\rlap{\box\plane@box}}% |
| 3276 |
\vbox{% |
| 3277 |
\chessfont% |
| 3278 |
\baselineskip=\z@\lineskip=\z@% |
| 3279 |
\setcounter{cpd@row}{\value{cpd@rows} - 1}% |
| 3280 |
\whiledo{\value{cpd@row} > -1}{% |
| 3281 |
\put@row{\value{cpd@row}}% |
| 3282 |
\addtocounter{cpd@row}{-1}% |
| 3283 |
}% |
| 3284 |
}% |
| 3285 |
% Put a legend if wanted |
| 3286 |
\ifthenelse{\boolean{legend}}{% |
| 3287 |
\vbox to \z@{% |
| 3288 |
\vbox to \z@{\vss}% |
| 3289 |
\llap{\hbox{\hspace*{\inner@frame}% |
| 3290 |
\setcounter{cpd@line}{0}% |
| 3291 |
\setcounter{cpd@line@display}{`a}% |
| 3292 |
\whiledo{\value{cpd@line}<\value{cpd@lines}}{% |
| 3293 |
\hbox to \sq@width{\hfill% |
| 3294 |
{\legendfont\char\value{cpd@line@display}}% |
| 3295 |
\hfill}% |
| 3296 |
\addtocounter{cpd@line}{1}% |
| 3297 |
\addtocounter{cpd@line@display}{1}% |
| 3298 |
} |
| 3299 |
}}% |
| 3300 |
\vss}% |
| 3301 |
}{}% |
| 3302 |
}% |
| 3303 |
} |
| 3304 |
\def\put@sqs@normal{% |
| 3305 |
\put@plane% |
| 3306 |
\setbox\sq@box=\hbox{% |
| 3307 |
\inner@henbox{\box\plane@box}% |
| 3308 |
}% |
| 3309 |
} |
| 3310 |
\def\put@sqs@stereo{% |
| 3311 |
\setbox\sq@box=\hbox{\hfil\vbox{% |
| 3312 |
\vskip\v@space@dist% |
| 3313 |
\setcounter{cpd@current@plane}{4}% |
| 3314 |
\whiledo{\value{cpd@current@plane}>-1}{% |
| 3315 |
\ifthenelse{\value{cpd@current@plane}=0}{% |
| 3316 |
\setcounter{cpd@lines}{8}% |
| 3317 |
\setcounter{cpd@rows}{8}% |
| 3318 |
}{% |
| 3319 |
\setcounter{cpd@lines}{4}% |
| 3320 |
\setcounter{cpd@rows}{4}% |
| 3321 |
}% |
| 3322 |
% Now we should clear the board |
| 3323 |
\begingroup% We need this for inner loops! |
| 3324 |
\clear@board% |
| 3325 |
\put@plane% |
| 3326 |
\endgroup% |
| 3327 |
\hbox to \bd@width{% |
| 3328 |
\hfil% |
| 3329 |
\inner@henbox{\box\plane@box}% |
| 3330 |
\ifcase\value{cpd@current@plane}\or% |
| 3331 |
\rlap{{\cpd@boardfont\ A}}\or% |
| 3332 |
\rlap{{\cpd@boardfont\ B}}\or% |
| 3333 |
\rlap{{\cpd@boardfont\ C}}\or% |
| 3334 |
\rlap{{\cpd@boardfont\ D}}% |
| 3335 |
\fi% |
| 3336 |
\hfil% |
| 3337 |
}% |
| 3338 |
\vskip\v@space@dist% |
| 3339 |
\addtocounter{cpd@current@plane}{-1}% |
| 3340 |
}% |
| 3341 |
}\hfil}% |
| 3342 |
} |
| 3343 |
|
| 3344 |
\def\stereo@center{% |
| 3345 |
\ifthenelse{\value{cpd@current@plane}=0}{% |
| 3346 |
\setbox\plane@box=\vbox{\hbox{% |
| 3347 |
\@hGrid\tw@\tw@\f@ur\@hGrid\tw@ 6\f@ur% |
| 3348 |
\@vGrid\tw@\tw@\f@ur\@vGrid6\tw@\f@ur% |
| 3349 |
\box\plane@box% |
| 3350 |
}}% |
| 3351 |
}{}% |
| 3352 |
} |
| 3353 |
\def\put@sqs@space@vertical{% |
| 3354 |
\setbox\sq@box=\hbox{\hfil\vbox{% |
| 3355 |
\setcounter{cpd@current@plane}{\value{cpd@planes}-1}% |
| 3356 |
\vskip\v@space@dist% |
| 3357 |
\whiledo{\value{cpd@current@plane}>-1}{% |
| 3358 |
\begingroup% We use inner loops! |
| 3359 |
\clear@board% |
| 3360 |
\put@plane% |
| 3361 |
\hbox to \bd@width{% |
| 3362 |
\inner@henbox{\box\plane@box}% |
| 3363 |
\setcounter{cpd@current@plane@display}{`A+\value{cpd@current@plane}}% |
| 3364 |
\rlap{{\cpd@boardfont\ \char\value{cpd@current@plane@display}}}% |
| 3365 |
}% |
| 3366 |
\endgroup% |
| 3367 |
\vskip\v@space@dist% |
| 3368 |
\addtocounter{cpd@current@plane}{-1}% |
| 3369 |
}% |
| 3370 |
}\hfil}% |
| 3371 |
} |
| 3372 |
|
| 3373 |
\def\put@sqs@space@horizontal{% |
| 3374 |
\setbox\sq@box=\hbox{% |
| 3375 |
\setcounter{cpd@current@plane}{0}% |
| 3376 |
\hskip\h@space@dist% |
| 3377 |
\whiledo{\value{cpd@current@plane}<\value{cpd@planes}}{% |
| 3378 |
% Now we should clear the board |
| 3379 |
\begingroup% We use inner loops! |
| 3380 |
\clear@board% |
| 3381 |
\put@plane% |
| 3382 |
\hbox to \bd@width{% |
| 3383 |
\inner@henbox{\box\plane@box}% |
| 3384 |
\setcounter{cpd@current@plane@display}{`A+\value{cpd@current@plane}}% |
| 3385 |
\rlap{{\cpd@boardfont\ \char\value{cpd@current@plane@display}}}% |
| 3386 |
}% |
| 3387 |
\endgroup% |
| 3388 |
\hskip\h@space@dist% |
| 3389 |
\addtocounter{cpd@current@plane}{1}% |
| 3390 |
}% |
| 3391 |
}% |
| 3392 |
} |
| 3393 |
|
| 3394 |
\def\put@sqs@space{% |
| 3395 |
\ifspace@vertical% |
| 3396 |
\put@sqs@space@vertical% |
| 3397 |
\else% |
| 3398 |
\put@sqs@space@horizontal% |
| 3399 |
\fi% |
| 3400 |
} |
| 3401 |
\def\@inner@vframe{% |
| 3402 |
\if@vframe% |
| 3403 |
\vrule width \inner@frame% |
| 3404 |
\else% |
| 3405 |
\hskip\inner@frame% |
| 3406 |
\fi% |
| 3407 |
} |
| 3408 |
|
| 3409 |
\def\@inner@hframe{% |
| 3410 |
\if@hframe% |
| 3411 |
\hrule height \inner@frame% |
| 3412 |
\else% |
| 3413 |
\vskip\inner@frame% |
| 3414 |
\fi% |
| 3415 |
} |
| 3416 |
\def\inner@v@frame@rule{% |
| 3417 |
\if@stereo% |
| 3418 |
\@inner@vframe% |
| 3419 |
\else\if@space% |
| 3420 |
\@inner@vframe% |
| 3421 |
\else\if@leaveOuter% |
| 3422 |
\vrule width \inner@frame% |
| 3423 |
\else% |
| 3424 |
\@inner@vframe% |
| 3425 |
\fi\fi\fi% |
| 3426 |
} |
| 3427 |
|
| 3428 |
\def\inner@h@frame@rule{% |
| 3429 |
\if@stereo% |
| 3430 |
\@inner@hframe% |
| 3431 |
\else\if@space% |
| 3432 |
\@inner@hframe% |
| 3433 |
\else\if@leaveOuter% |
| 3434 |
\hrule height \inner@frame% |
| 3435 |
\else% |
| 3436 |
\@inner@hframe% |
| 3437 |
\fi\fi\fi% |
| 3438 |
} |
| 3439 |
|
| 3440 |
\def\inner@henbox#1{% |
| 3441 |
\hbox{% |
| 3442 |
\inner@v@frame@rule% |
| 3443 |
\vbox{\inner@h@frame@rule#1\inner@h@frame@rule}% |
| 3444 |
\inner@v@frame@rule% |
| 3445 |
}% |
| 3446 |
} |
| 3447 |
\def\@outer@vrule{\vrule width \outer@frame} |
| 3448 |
|
| 3449 |
\def\@outer@hrule{\hrule height \outer@frame} |
| 3450 |
\def\outer@v@frame@rule{% |
| 3451 |
\if@stereo% |
| 3452 |
\@outer@vrule% |
| 3453 |
\else\if@space% |
| 3454 |
\@outer@vrule% |
| 3455 |
\else\if@leaveOuter% |
| 3456 |
\if@vframe\@outer@vrule\else\hskip\outer@frame\fi% |
| 3457 |
\else% |
| 3458 |
\@outer@vrule% |
| 3459 |
\fi\fi\fi% |
| 3460 |
} |
| 3461 |
|
| 3462 |
\def\outer@h@frame@rule{% |
| 3463 |
\if@stereo% |
| 3464 |
\@outer@hrule% |
| 3465 |
\else\if@space% |
| 3466 |
\@outer@hrule% |
| 3467 |
\else\if@leaveOuter% |
| 3468 |
\if@hframe\@outer@hrule\else\vskip\outer@frame\fi% |
| 3469 |
\else% |
| 3470 |
\@outer@hrule% |
| 3471 |
\fi\fi\fi% |
| 3472 |
} |
| 3473 |
|
| 3474 |
\def\outer@henbox#1{% |
| 3475 |
\outer@h@frame@rule% |
| 3476 |
\hbox{% |
| 3477 |
\outer@v@frame@rule% |
| 3478 |
\ifspace@vertical% |
| 3479 |
\hskip\h@frame@dist% |
| 3480 |
\fi% |
| 3481 |
\vbox{% |
| 3482 |
\ifspace@vertical% |
| 3483 |
\vskip\v@frame@dist% |
| 3484 |
\else% |
| 3485 |
\vskip\v@space@dist% |
| 3486 |
\fi% |
| 3487 |
#1% |
| 3488 |
\ifspace@vertical% |
| 3489 |
\vskip\v@frame@dist% |
| 3490 |
\else% |
| 3491 |
\vskip\v@space@dist% |
| 3492 |
\fi% |
| 3493 |
}% |
| 3494 |
\ifspace@vertical% |
| 3495 |
\hskip\h@frame@dist% |
| 3496 |
\fi% |
| 3497 |
\outer@v@frame@rule% |
| 3498 |
}% |
| 3499 |
\outer@h@frame@rule% |
| 3500 |
} |
| 3501 |
\def\ch@fig#1{% |
| 3502 |
\ifvmode\noindent\fi% |
| 3503 |
\hbox{\chtextfont\lower.1\fontdimen\tw@\chtextfont\hbox{\char#1}}% |
| 3504 |
} |
| 3505 |
\def\@dia@index{% |
| 3506 |
\@ifundefined{newindex}% |
| 3507 |
{\errmessage{You should add documentstyle-option 'index'}}{}% |
| 3508 |
} |
| 3509 |
|
| 3510 |
\def\showlabel#1{% |
| 3511 |
\if@develop% |
| 3512 |
\raise1ex\hbox{\labelfont#1}\penalty\exhyphenpenalty% |
| 3513 |
\fi% |
| 3514 |
} |
| 3515 |
|
| 3516 |
\def\@aidxitem#1, #2, #3{% |
| 3517 |
\par\medskip#1, \write@christian#2; \dotfill #3% |
| 3518 |
} |
| 3519 |
|
| 3520 |
\def\dia@index#1\@sep#2[#3]{\index[#3]{#2|showlabel{#1}}} |
| 3521 |
|
| 3522 |
\def\parse@aindex#1; {% |
| 3523 |
\expandafter\dia@index\the\label@tk\@sep#1[author]\l@@klist% |
| 3524 |
} |
| 3525 |
|
| 3526 |
\def\@aindex{% |
| 3527 |
\if@aindex% |
| 3528 |
\ifnormal@names% |
| 3529 |
\errmessage{Cannot create index entries with normalnames}% |
| 3530 |
\else\ifauth@r% |
| 3531 |
\let\@action=\parse@aindex\@parseTokenlist\aut@tk;% |
| 3532 |
\fi\fi% |
| 3533 |
\fi% |
| 3534 |
} |
| 3535 |
|
| 3536 |
\def\x@sindex#1\@sep{\expandafter\dia@index\the\label@tk\@sep#1[source]} |
| 3537 |
|
| 3538 |
\def\@sindex{% |
| 3539 |
\if@sindex\if@source% |
| 3540 |
\expandafter\x@sindex\the\source@tk\@sep% |
| 3541 |
\fi\fi% |
| 3542 |
} |
| 3543 |
|
| 3544 |
\def\parse@tindex#1, {% |
| 3545 |
\expandafter\dia@index\the\label@tk\@sep#1[theme]\l@@klist% |
| 3546 |
} |
| 3547 |
|
| 3548 |
\def\@tindex{% |
| 3549 |
\if@tindex\if@theme% |
| 3550 |
\let\@action=\parse@tindex\@parseTokenlist\theme@tk,% |
| 3551 |
\fi\fi% |
| 3552 |
} |
| 3553 |
\def\@setPieceColor#1#2#3{% |
| 3554 |
\gdef\ds@white{#1}\gdef\ds@black{#2}\gdef\ds@neutral{#3}% |
| 3555 |
} |
| 3556 |
|
| 3557 |
\def\@setPieceSpec#1#2#3#4#5#6{% |
| 3558 |
\gdef\ds@king{#1}\gdef\ds@queen{#2}\gdef\ds@rook{#3}% |
| 3559 |
\gdef\ds@bishop{#4}\gdef\ds@knight{#5}\gdef\ds@pawn{#6}% |
| 3560 |
} |
| 3561 |
|
| 3562 |
\def\@setPieceRotation#1#2#3{% |
| 3563 |
\gdef\ds@rotation@left{#1}\gdef\ds@rotation@right{#2}\gdef\ds@rotation@upsidedown{#3}% |
| 3564 |
} |
| 3565 |
\newcommand{\cpd@piecedef@rotations}{% |
| 3566 |
\def\@theRotation{}\cpd@piecedef@colors{0}% |
| 3567 |
\def\@theRotation{\ds@rotation@left}\cpd@piecedef@colors{36}% |
| 3568 |
\def\@theRotation{\ds@rotation@right}\cpd@piecedef@colors{72}% |
| 3569 |
\def\@theRotation{\ds@rotation@upsidedown}\cpd@piecedef@colors{108}% |
| 3570 |
} |
| 3571 |
\newcommand{\cpd@piecedef@colors}[1]{% |
| 3572 |
\def\@theColor{\ds@white}\cpd@piecedef@types{#1}{0}% |
| 3573 |
\def\@theColor{\ds@neutral}\cpd@piecedef@types{#1}{6}% |
| 3574 |
\def\@theColor{\ds@black}\cpd@piecedef@types{#1}{12}% |
| 3575 |
} |
| 3576 |
\newcommand{\cpd@piecedef@types}[2]{% |
| 3577 |
\def\@thePiece{\ds@pawn}\cpd@piecedef{#1}{#2}{0}% |
| 3578 |
\def\@thePiece{\ds@knight}\cpd@piecedef{#1}{#2}{1}% |
| 3579 |
\def\@thePiece{\ds@bishop}\cpd@piecedef{#1}{#2}{2}% |
| 3580 |
\def\@thePiece{\ds@rook}\cpd@piecedef{#1}{#2}{3}% |
| 3581 |
\def\@thePiece{\ds@queen}\cpd@piecedef{#1}{#2}{4}% |
| 3582 |
\def\@thePiece{\ds@king}\cpd@piecedef{#1}{#2}{5}% |
| 3583 |
} |
| 3584 |
\newcommand{\cpd@piecedef}[3]{% |
| 3585 |
\setcounter{cpd@piece@index}{#1+#2+#3}% |
| 3586 |
\edef\cpd@piecedef@index{\arabic{cpd@piece@index}}% |
| 3587 |
\expandafter\xdef% |
| 3588 |
\csname\@theColor\@thePiece\@theRotation\endcsname{% |
| 3589 |
\ch@fig{\cpd@piecedef@index}% |
| 3590 |
} |
| 3591 |
} |
| 3592 |
|
| 3593 |
\elchfont\@fselch |
| 3594 |
|
| 3595 |
\defaultelchfont% |
| 3596 |
\diagnum{\@ne} |
| 3597 |
%% \figcnttrue |
| 3598 |
\setboolean{piececounter}{true} |
| 3599 |
\def\@dianame{\@fullname} |
| 3600 |
\def\@solname{\@fullname} |
| 3601 |
\space@verticaltrue |
| 3602 |
\diagnumbering{arabic} |
| 3603 |
\def\write@month{\@arabic}% |
| 3604 |
\diagleft |
| 3605 |
\cl@arsol |
| 3606 |
\let\orig@author=\author |
| 3607 |
\let\orig@day=\day |
| 3608 |
\let\orig@month=\month |
| 3609 |
\let\orig@year=\year |
| 3610 |
\let\orig@label=\label |
| 3611 |
\DefinePieces{wsn}{KDTLSB}{LRU} |
| 3612 |
\newdimen\normalboardwidth |
| 3613 |
\def\setboardwidth{% |
| 3614 |
\normalboardwidth=\@ight\fontdimen\tw@\chessfont% |
| 3615 |
\advance\normalboardwidth\tw@\inner@frame% |
| 3616 |
\advance\normalboardwidth\tw@\h@frame@dist% |
| 3617 |
\advance\normalboardwidth\tw@\outer@frame% |
| 3618 |
} |
| 3619 |
|
| 3620 |
\setboardwidth |
| 3621 |
|
| 3622 |
%</style> |
| 3623 |
% \end{macrocode} |
| 3624 |
% |
| 3625 |
% \section{The implementation of cpdparse.sty} |
| 3626 |
% |
| 3627 |
% The following contains the style file \emph{cpdparse.sty}, which |
| 3628 |
% implements generic parsing of lists. |
| 3629 |
% |
| 3630 |
% \begin{macrocode} |
| 3631 |
%<*cpdparse> |
| 3632 |
\ProvidesPackage{cpdparse}[2020/12/27] |
| 3633 |
% \end{macrocode} |
| 3634 |
% |
| 3635 |
% \begin{macrocode} |
| 3636 |
\def\cpd@parse@list{\futurelet\cpd@parse@lookahead\cpd@parse@check} |
| 3637 |
\def\cpd@parse@check{% |
| 3638 |
\ifx\cpd@parse@lookahead\relax\relax% |
| 3639 |
\let\cpd@parse@next=\relax% |
| 3640 |
\else% |
| 3641 |
\let\cpd@parse@next=\cpd@parse@action% |
| 3642 |
\fi% |
| 3643 |
\cpd@parse@next% |
| 3644 |
} |
| 3645 |
% \end{macrocode} |
| 3646 |
% |
| 3647 |
%</cpdparse> |
| 3648 |
% |
| 3649 |
% |
| 3650 |
% \Finale |