Debian Codegraph @

texmf-dist/doc/latex/texmate/texmate2manual.tex

raw
1 \documentclass[12pt]{ltxdoc}
2 \usepackage{array}
3 \usepackage{makeidx}
4 \usepackage[dvipdfm,bookmarks=true,hyperindex=false]{hyperref}
5 %\usepackage{fourier}
6 %\usepackage{doc}
7 %\usepackage{shortvrb}
8 \usepackage[skaknew]{chessfss}
9 \usepackage{texmate}
10 \makeindex
11 \PageIndex
12 \begin{document}
13 \setcounter{IndexColumns}{2}
14 \IndexPrologue{\section*{Index of user commands}}
15 \renewcommand\usage{}
16 \title{\TeXmate\,2: User's manual}
17 \author{Federico Garcia}
18 \maketitle
19 \tableofcontents
20 \MakeShortVerb{\"}
21 \DeleteShortVerb{\|}
22 \makeatletter
23 \DeclareRobustCommand\SMC{%
24 \ifx\@currsize\normalsize\small\else
25 \ifx\@currsize\small\footnotesize\else
26 \ifx\@currsize\footnotesize\scriptsize\else
27 \ifx\@currsize\large\normalsize\else
28 \ifx\@currsize\Large\large\else
29 \ifx\@currsize\LARGE\Large\else
30 \ifx\@currsize\scriptsize\tiny\else
31 \ifx\@currsize\tiny\tiny\else
32 \ifx\@currsize\huge\LARGE\else
33 \ifx\@currsize\Huge\huge\else
34 \small\SMC@unknown@warning
35 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
36 }
37 \newcommand\SMC@unknown@warning{\PackageWarning{\acro}{\string\SMC: unrecognised
38 text font size command -- using \string\small}}
39 \newcommand\textSMC[1]{{\SMC #1}}
40 \newcommand\acro[1]{\textSMC{#1}\@}
41
42 \section{Introduction}
43
44 Since the appearance last year of \TeXmate\ in its first version, the \LaTeX-chess community has been very active. Now there are new versions of Torben~Hoffmann's \textsf{skak} and of its fonts. There are new packages of immense scope and utility: Ulrike~Fischer's \textsf{chessfss} and \textsf{chessboard}.
45
46 To an important degree, all these efforts have grown together. And \TeXmate\ now incorporates the chess-playing capabilities of \textsf{skak}, somewhat achieving what back in the day was a dream of having the best of both worlds, a dream that arose from the enthusiastic reception of the first \TeXmate. Now \TeXmate\ uses \textsf{skak} to follow the game, helping to catch input mistakes, and, above all, drawing the diagram of the current position automatically. In addition, font handling is completely delegated to \textsf{chessfss}, and for now all packages appear to be satisfactorily compatible.
47
48 My thanks then to Ulrike and Torben, but also Ulrich~Dirr, for their constant interest and feedback. I am indebted for the final encouragement to Frank~Mittelbach as well.
49
50 Future plans include a \acro{PGN}-to-\TeX\ translator. As for \TeXmate, it's probably too early to know where it's going, but one thing seems clear: \TeXmate\ might interfere with other complicated packages. The problem lies in the change of category codes for some characters. This is certainly something to look into. (Quick and dirty try, though: modify "\@nochesscodes" according to the other packages you are loading\dots)
51
52 \pagebreak
53 \section{Basic usage}
54
55 \subsection{A short game}\label{first}
56 \makebarother
57 \begin{verbatim}
58 |1 e4 e5 Nf3 Nc6 Bc4 Bc5 0-0 d6 d3 Nf6 Bg5
59 h6 Bh4 g5 Bg3 h5 Nxg5 h4 Nxf7 hxg3
60 Nxd8 Bg4 Qe1 Nd4 Nc3 Nf3+ gxf3 Bxf3|
61 \end{verbatim}
62
63 This input stream gives \TeXmate\ the moves of a beautiful miniature (probably home-prepared, though) by Steinitz.
64
65 The only two conventions are the inclusion of all moves between two \DescribeMacro{|}\SpecialIndex{|}"|"'s (``chess mode''), and the separation of moves by spaces. Beyond that, the user is free to add punctuation marks, as inconsistently as he wants, and \TeXmate\ will always produce the same output. (In particular, \acro{PGN} move notation is supported without any change.)
66
67 In normal conditions, the "|" is set by default to delimit chess mode. The user commands "\makebarother" and "\makebarchess"\DescribeMacro{\makebarchess}\DescribeMacro{\makebarother} toggle the meaning of that character between chess mode and nothing special.
68
69 However, if \TeXmate\ finds that another package has a special use for "|", it will refrain from using it. In that case, chess mode should be entered with through an alternative (which is always available, in any case): the \texttt{texmate} environment ("\begin{texmate}"--"\end{texmate}"). Even then, a "\makebarchess" (by the user) will make "|" open and close chess mode.
70
71 \bigskip\noindent
72 With default settings, the result of the quoted input is:
73
74 \begin{texmate}
75 1 e4 e5 Nf3 Nc6 Bc4 Bc5 d3 Nf6 Bg5 d6 O-O h6 Bh4 g5 Bg3 h5 Nxg5 h4 Nxf7 hxg3 Nxd8 Bg4 Qe1 Nd4 Nc3 Nf3+ gxf3 Bxf3
76 \end{texmate}
77
78 And White cannot avoid being mated.
79
80 \subsection{Game title}\label{markup}
81
82 The game was played between Dubois and Steinitz in London in 1862. So:
83
84 \begin{verbatim}
85 \whitename{Dubois}
86 \blackname{Steinitz}
87 \chessevent{London 1862}
88 \ECO{C50}
89 \chessopening{Giucco Pianissimo}
90 \end{verbatim}
91
92 \SpecialIndex{\whitename}\SpecialIndex{\blackname}\SpecialIndex{\ECO}\SpecialIndex{\chessopening}
93 \SpecialIndex{\chessevent}
94 \DescribeMacro{\welo}\DescribeMacro{\belo}("\chessevent" is a safer command name than `place,' and for games of chess, they are usually interchangeable.) All these commands are not required, and there are two more: "\welo" and "\belo" for ratings or other information about the players.
95
96 \whitename{Dubois}
97 \blackname{Steinitz}
98 \chessevent{London 1862}
99 \ECO{C50}
100 \chessopening{Giucco Pianissimo}
101
102 Now, before the game is input, we can issue \DescribeMacro{\makegametitle}"\makegametitle". If in addition we type \DescribeMacro{\resigns}"\resigns" when its White's turn (so the game input is \makebarother"|1 e4 e5 Nf3"\dots"Bxf3 \resigns|"), the result is:
103
104 \makebarchess
105 \makegametitle
106 |1 e4 e5 Nf3 Nc6 Bc4 Bc5 d3 Nf6 Bg5 d6 0-0 h6 Bh4 g5 Bg3 h5 Nxg5 h4 Nxf7 hxg3 Nxd8 Bg4 Qe1 Nd4 Nc3 Nf3 gxf3 Bxf3 \resigns|
107
108 \bigskip\noindent
109 \DescribeMacro{\newgame}"\makegametitle" includes the all-important command "\newgame", that sets the stage for \TeXmate\ (and \textsf{skak}) to start a game afresh. It is the safest way to start from scratch (for example, for quoting a related game in commentary) if there is no interest in the game title as defined in \TeXmate. (See also sections \ref{cosmetics}~and~\ref{skak}.)
110
111 \subsection{Basic Annotations}\label{annotation}
112
113 Here we will add more things:
114
115 \begin{description}
116 \item[Symbols] after the moves: !, ?, etc. These pose no complication at all---\TeXmate\ treats them as part of moves, just as if they were letters. The same applies to chess symbols like "\betteris", or "\onlymove".
117 \item[Simple threats] with the command \DescribeMacro{\threat}"\threat<"\meta{threat}">". \TeXmate\ inserts the symbol \withidea\ and typesets the \meta{threat} without regard to move numbers, etc.
118 \item[Variations] with the `commentary' markers \DescribeMacro{[}"[" and "]".
119 \end{description}
120
121 \makebarother
122 \begin{verbatim}
123 |1 e4 e5 Nf3 Nc6 Bc4 Bc5 d3 Nf6 Bg5?! [Nc3]
124 d6 O-O?! h6 Bh4 g5 Bg3 h5! Nxg5 h4! Nxf7 hxg3!!
125 Nxd8 [Nxh8 Qe7! \threat<Qh7> Nf7 Bxf2+ Rxf2
126 gxf2+ Kxf2 Ng4+ Kg3 Qf6 Qf3 Qg7\BBetter] Bg4
127 Qe1 Nd4 Nc3\onlymove [h3 Ne2+ Kh1 Rxh3+ gxh3
128 Bf3\#] Nf3+! gxf3 Bxf3 \resigns|
129 \end{verbatim}
130
131 \makebarchess
132 \makegametitle
133 |1 e4 e5 Nf3 Nc6 Bc4 Bc5 d3 Nf6 Bg5?! [Nc3] d6 O-O?! h6 Bh4 g5 Bg3 h5! Nxg5 h4! Nxf7 hxg3!! Nxd8 [Nxh8 Qe7! \threat<Qh7> Nf7 Bxf2+ Rxf2 gxf2+ Kxf2 Ng4+ Kg3 Qf6 Qf3 Qg7\BBetter] Bg4 Qe1 Nd4 Nc3\onlymove [h3 Ne2+ Kh1 Rxh3+ gxh3 Bf3\#] Nf3+! gxf3 Bxf3 \resigns|
134
135 \subsection{Diagrams}\label{diagrams}
136 \TeXmate\,2 makes use of the chess engine of the package \textsf{skak} to `follow' the game as it is input, so that it can, at any point, insert a diagram with the current position. This can be done simply by \textsf{skak}'s command \SpecialIndex{\showboard}"\showboard". At this very moment, the final position of the game is in memory, so, in a paragraph by itself, the command will produce:
137
138 \showboard
139
140 \noindent All \textsf{skak} commands apply. For example, "\showonlypanws\showboard" produces:
141
142 \showonlypawns\showboard\showall
143
144 \bigskip\noindent
145 \TeXmate\ provides tools for the handling of diagrams. \DescribeMacro{\toD}"\toD" (meaning something like ``refer to Diagram'') inserts `\textit{(D)}' in the chess text, and saves the position in memory. \DescribeMacro{\makediagrams}Many positions (by default 3, but extendable) can be held in memory, and they are actually typeset by the command "\makediagrams".
146
147 "\toD" has an argument: the last move. \TeXmate\ will typeset the last move and put it (by default) below the diagram. Note that it will \emph{not} typeset the move directly in the running chess text (thus the move can be different in running text---where it can have annotation symbols---and in the diagram).
148
149 \bigskip\noindent
150 Adding this to the game, the complete input is:
151
152 \makebarother
153 \begin{verbatim}
154 \whitename{Dubois}
155 \blackname{Steinitz}
156 \chessevent{London 1862}
157 \ECO{C50}
158 \chessopening{Giucco Pianissimo}
159
160 \makegametitle
161 |1 e4 e5 Nf3 Nc6 Bc4 Bc5 d3 Nf6 Bg5?! [Nc3]
162 d6 O-O?! h6 Bh4 g5 Bg3 h5! Nxg5 h4! Nxf7 hxg3!!
163 \toD{hxg3!!} Nxd8 [Nxh8 Qe7! \threat<Qh7> Nf7 Bxf2+
164 Rxf2 gxf2+ Kxf2 Ng4+ Kg3 Qf6 Qf3 Qg7\BBetter] Bg4
165 Qe1 Nd4 Nc3\onlymove [h3 Ne2+ Kh1 Rxh3+ gxh3
166 Bf3\#] Nf3+! gxf3 Bxf3 \toD{Bxf3} \resigns|
167
168 \begin{figure}[h]
169 \makediagrams
170 \end{figure}
171 \end{verbatim}
172
173 \noindent And the complete output is:
174 \makebarchess
175 \whitename{Dubois}
176 \blackname{Steinitz}
177 \chessevent{London 1862}
178 \ECO{C50}
179 \chessopening{Giucco Pianissimo}
180
181 \makegametitle
182
183 |e4 e5 Nf3 Nc6 Bc4 Bc5 d3 Nf6 Bg5?! [Nc3] d6 O-O?! h6 Bh4 g5 Bg3 h5! Nxg5 h4! Nxf7 hxg3!! \toD{hxg3!!} Nxd8 [Nxh8 Qe7! \threat<Qh7> Nf7 Bxf2+ Rxf2 gxf2+ Kxf2 Ng4+ Kg3 Qf6 Qf3 Qg7\BBetter] Bg4 Qe1 Nd4 Nc3\onlymove [h3 Ne2+ Kh1 Rxh3+ gxh3
184 Bf3\#] Nf3+! gxf3 Bxf3 \toD{Bxf3} \resigns|
185
186 \begin{figure}
187 \makediagrams
188 \end{figure}
189
190 This will insert the diagrams at a reasonable (in \LaTeX-insertion scales) place. The appearance of the diagrams can be customized to some extent, as treated in section~\ref{custdiagrams}. "\makediagrams" will center the diagrams automatically, so "\begin{center}" is not necessary.
191
192 On the other hand, the starred \DescribeMacro{\toD*}"\toD*"\meta{last move} will not insert ``\textit{(D)}'', but will otherwise do the same as "\toD".
193
194 \bigskip\noindent
195 \DescribeMacro{\preparediagram}There is an alternative way of preparing a diagram for typesetting:
196
197 "\preparediagram""{"\meta{diagram header}"}{"\meta{diagram footer}"}"\\
198 sends the current position into diagram cache, not with the usual header and footer (which by default are the players' names and the last move, as explained in section~\ref{custdiagrams}), but with those set directly by the user. This can be done at any point, but it is useful particularly in connection with "\position" (section~\ref{position}).
199
200
201 \subsection{Text and chess}\label{text}
202
203 Regular, running text can be inserted at any point into a game, by simply exiting chess mode and entering it before the game resumes.
204
205 \makebarother
206 \begin{verbatim}
207 \whitename{Dubois}
208 \blackname{Steinitz}
209 \chessevent{London 1862}
210 \ECO{C50}
211 \chessopening{Giucco Pianissimo}
212
213 \makegametitle
214 |1 e4 e5 Nf3 Nc6 Bc4 Bc5 d3 Nf6 Bg5?! [Nc3]
215 d6 O-O?!| Black has not yet castled, so he can storm with the
216 Kingside pawns, taking advantage of the aggressive but
217 unfortunate position of White's bishop. |h6 Bh4 g5 Bg3 h5!
218 Nxg5 h4! Nxf7 hxg3!! Nxd8 [Nxh8 Qe7! \threat<Qh7> Nf7 Bxf2+
219 Rxf2 gxf2+ Kxf2 Ng4+ Kg3 Qf6 Qf3 Qg7\BBetter] Bg4 Qe1 Nd4
220 Nc3\onlymove [h3 Ne2+ Kh1 Rxh3+ gxh3 Bf3\#] Nf3+! gxf3
221 Bxf3\resigns|
222 \end{verbatim}
223
224
225 \makebarchess
226 \whitename{Dubois}
227 \blackname{Steinitz}
228 \chessevent{London 1862}
229 \ECO{C50}
230 \chessopening{Giucco Pianissimo}
231
232 \makegametitle
233 |1 e4 e5 Nf3 Nc6 Bc4 Bc5 d3 Nf6 Bg5?! [Nc3] d6 O-O?!| Black has not yet castled, so he can storm with the Kingside pawns, taking advantage of the aggressive but unfortunate position of White's bishop. | h6 Bh4 g5 Bg3 h5! Nxg5 h4! Nxf7 hxg3!! Nxd8 [Nxh8 Qe7! \threat<Qh7> Nf7 Bxf2+ Rxf2 gxf2+ Kxf2 Ng4+ Kg3 Qf6 Qf3 Qg7\BBetter] Bg4 Qe1 Nd4 Nc3\onlymove [h3 Ne2+ Kh1 Rxh3+ gxh3 Bf3\#] Nf3+! gxf3 Bxf3 \resigns|
234
235 \subsection{Text and annotation}\label{textann}
236 When text and annotation (chess variations that are not the main line of the game) are used at the same time, the symbol `[', inserted by default for variations, can be redundant. \SkakOff We don't want something like ``|\white 5 Bg5?![|The development of the Knight with |Nc3| is more urgent. |] d6|.'' But exiting and re-entering chess mode is not enough, for \TeXmate\ needs to know that this is a variation (otherwise it will typeset \makebarother"|Nc3|" as belonging to the game, and \textsf{skak} will try to update the board and get confused).
237
238 The solution is to open the annotation not with the commentary character, but with the commentary \emph{control~sequence}: \DescribeMacro{\[}"\[". Thus:
239
240 \begin{verbatim}
241 |e4 e5 Nf3 Nc5 Bc4 Bc5 d3 Nf5 Bg5?! \[| The
242 development of the Knight with |Nc3| is more
243 urgent. |\] d6...|
244 \end{verbatim}
245
246 \noindent which produces:
247
248 \SkakOn
249 \newgame
250 \makebarchess
251 |1 e4 e5 Nf3 Nc5 Bc4 Bc5 d3 Nf5 Bg5?! \[| The
252 development of the Knight with |Nc3| is more
253 urgent. |\] d6|\dots
254
255
256 \subsection{Variations and subvariations}\label{subvars}
257
258 Variations and subvariations, marked by either "["\meta{variation}"]" or "\["\meta{variation}"\]", can be nested (however, "[" should always be closed by "]", and "\[" by "\]"). \TeXmate\ has four levels of variation (the first being the main game itself), each with its own conventions of font, signs, etc.
259
260 So, for example, here is a deeper annotation to White's move~11, achieved by nesting variations (the relevant input is ``\texttt{Nxd8 [Nxh8 Qe7!\ [Bg4?\ Qd2 Nd4 Nc3 Qe7 Qh6}"\WBetter"\texttt{] Nf7 Bxf2+ Rxf2\linebreak gxf2+ Kxf2 Ng4+ Kg3 Qf6 Qf3 Qg7}"\BBetter"\texttt{] Bg4}''):
261 \makebarchess
262 \makegametitle
263 |1 e4 e5 Nf3 Nc6 Bc4 Bc5 d3 Nf6 Bg5?! [\betteris Nc3] d6 O-O?! h6 Bh4 g5 Bg3 h5! Nxg5 h4! Nxf7 hxg3!! Nxd8 [Nxh8 Qe7! [Bg4? Qd2 Nd4 Nc3 Qe7 Qh6\WBetter] Nf7 Bxf2+ Rxf2 gxf2+ Kxf2 Ng4+ Kg3 Qf6 Qf3 Qg7\BBetter] Bg4 Qe1 Nd4 Nc3\onlymove [h3 Ne2+ Kh1 Rxh3+ gxh3 Bf3\#] Nf3+! gxf3 Bxf3\toD*{Bxf3} \resigns|
264
265
266 \subsection{Other tools for annotation}\label{tools}
267
268 When you open a commentary (whether by "[" or by "\["), \TeXmate\ `undoes' the last move (assuming that the commentary will offer alternatives to it). Therefore the first move in the commentary will feature the same move number, and be played by the same side, that the last move in the main game (or in the mother variation). Sometimes, however, you open a commentary to talk about what the answer can be to that last move. For those occassions, \TeXmate\,2 has the command \DescribeMacro{\ahead}"\ahead".
269
270 A good illustration is the last move of our Dubois--Steinitz game (see diagram).
271
272 \begin{figure}[h]
273 \makediagrams
274 \end{figure}
275
276 The point is that Black threatens mate with the g3 pawn on h2; White could try to avoid it by taking the pawn, but then the rook mates on h1. What we want for the last move is `{\bfseries\bishop\takes f3} \withidea g\takes h2\#, and if now 15.~h\takes g3 \rook h1\#'. I just typed it manually, but because I know the move numbers, etc. The "\ahead" mechanism provides automation:
277
278 \makebarother
279 \begin{verbatim}
280 |... Bxf3 \threat<gxh2\#>\[|, and if now
281 |\ahead hxg3 Rh1\#\]\resigns|
282 \end{verbatim}
283
284 \makebarchess
285 \newgame
286 |1 e4 e5 Nf3 Nc6 Bc4 Bc5 d3 Nf6 Bg5?! [\betteris Nc3] d6 O-O?! h6 Bh4 g5 Bg3 h5! Nxg5 h4! Nxf7 hxg3!! Nxd8 [Nxh8 Qe7! [Bg4? Qd2 Nd4 Nc3 Qe7 Qh6\WBetter] Nf7 Bxf2+ Rxf2 gxf2+ Kxf2 Ng4+ Kg3 Qf6 Qf3 Qg7\BBetter] Bg4 Qe1 Nd4 Nc3\onlymove [h3 Ne2+ Kh1 Rxh3+ gxh3 Bf3\#] Nf3+! gxf3 \storegame{gf3} Bxf3 \threat<gxh2\#>\[|, and if now |\ahead hxg3 Rh1\#\]\resigns|
287
288 \bigskip\noindent
289 We can also refine the comment to moves 12 by Black and 13 by White with the specification of the threat. This could not have been done with "\threat" (section~\ref{annotation}), because the threat involves a whole variation, not simply a move. With \DescribeMacro{\Threat}"\Threat<"\meta{threatened variation}">", \TeXmate\ will typeset the \meta{threatened variation} with appropriate move numbers, etc. Unlike "\threat", "\Threat" does not include the \withidea\ sign, but this can be added to the first move if necessary. Sometimes a space must be forced---the idea is that "\Threat" can be used in connection with running text, so nothing is rigidly added. (On the other hand, since this is not a real variation playable on the board, \textsf{skak} is turned off.)
290
291 So, by saying `{\ttfamily Nd4 "\Threat<\ \withidea" Ne2+ Kh1 Rxh3+ gxh3 Bf3"\#"] Nc3"\onlymove"}' we get `\SkakOff|\black 12 Nd4\Threat<\ \withidea Ne2+ Kh1 Rxh3+ gxh3 Bf3\#> Nc3\onlymove\Threat<Bd5>|', a better option for these moves than we have had so far.
292
293
294 \SkakOn
295
296 \bigskip\noindent
297 \DescribeMacro{\dummy}\DescribeMacro{\ddummy}On the other hand, the commands "\dummy" and "\ddummy" make \TeXmate\ advance half a move or a complete move (that is, a movement by both players). They can be used in commentary to talk about what is to come, and they are in some senses more flexible than "\ahead". But they remain in \TeXmate\,2 mainly for compatibility. Their main drawback is that they confuse \textsf{skak} (that is following the game, so that the moves have to make sense, and the move numbers have to be consistent). In \TeXmate\,2, therefore, they immediately turn \textsf{skak} off: for the remainder of the variation (or sub-variation), \textsf{skak} will not try to follow the game. The main consequence of this is that the variation cannot be automatically diagrammed.
298
299 \DescribeMacro{\white}\DescribeMacro{\black}Similarly, the old commands "\white" and "\black", that force \TeXmate\ to take the next move as one done by the indicated side, have to turn \textsf{skak} off.
300
301 \subsection{Multiple variations}\label{vars}
302
303 In complicated games, a commentator will often need to examine several alternatives in a given position. The tools given so far are not satisfactory for this. In old \TeXmate\ it could be achieved by handling groups properly, but this is not exactly trivial for the user (who is thinking of variations that are already complicated as it is!). In addition, this approach puts \textsf{skak} off the game, and will create strange results.
304
305 So, \TeXmate\,2 provides an additional tool for this, that turns out to be very powerful and useful. It is the family of environments "{variations}".
306
307 Again, the final position of Dubois--Steinitz provides illustration. White could also try \emph{advancing} the pawn. So, having two alternatives for White's 14, let's discuss the different "{variations}" environments.
308
309 \DescribeEnv{variations}\DescribeMacro{\var}The regular\\
310 "[\begin{variations}"\\
311 "\var" \meta{variation}\\
312 "\var"\meta{variation}\\
313 $\vdots$\\
314 "\end{variations}]"
315
316 \noindent is designed for running commentary (not a lot of text). It makes the first move of each variation bold, and puts a `;' between variations:
317
318 \restoregame{gf3}
319 \@whitefalse\move14
320 |Bxf3 \threat<gxh2\#>[|If now |\ahead\begin{variations}
321 \var hxg3 Rh1\#%
322 \var h3 Rxh3\threat<Rh1\#>\end{variations}]\resigns|
323
324 \noindent was produced by:
325
326 \makebarother
327 \begin{verbatim}
328 Bxf3 \threat<gxh2\#>[|If now |\ahead\begin{variations}
329 \var hxg3 Rh1\#%
330 \var h3 Rxh3\threat<Rh1\#>\end{variations}]\resigns
331 \end{verbatim}
332
333
334 \DescribeMacro{\var*}The starred "\var*" forgoes any formatting (no bold, no semicolon). It is useful when one of the variations is embedded in text. You can always force the bold first move by saying "\var*\bfseries". In general, font can be set immediately after "\var" or "\var*", and it will apply to the first move of the variation only.
335
336 \DescribeEnv{variations*}"\begin{variations*}" creates a list of variations where no variation has formatting (thus giving a shorthand for many "\var*"'s). Of course it has to be closed by "\end{variations*}".
337
338 \bigskip\noindent
339 On the other hand, "\begin{variations}" has a very different behavior when it appears in a `text commentary' (i.e., one open with "\[" rather than "["). Then it invokes another environment (usually a list, by default an "{itemize}"), where each "\var" is an \SpecialIndex{\item}"\item". (The starred "variations*", however, behaves as in non-text commentary.)
340
341 So, a more explicit commentary to the final position of our game is:
342
343 \begin{verbatim}
344 ...Bxf3\[| threatening mate on h2. If now
345 |\ahead\begin{variations}
346 \var hxg3 Rh1\#
347 \var h3 Rxh3\threat<Rh1\#>\end{variations}|
348 In view of that, White resigned.|\]\resigns|
349 \end{verbatim}
350
351
352 \makebarchess
353 \restoregame{gf3}
354 \@whitefalse\move14
355 |Bxf3 \[| threatening mate on h2. If now |\ahead\begin{variations}
356 \var hxg3 Rh1\#
357 \var h3 Rxh3\threat<Rh1\#>\end{variations}| In view of that, White resigned.|\]\resigns|
358
359 \bigskip
360 \DescribeMacro{\VariationsEnvironment}List environments defined by other packages (\textsf{paralist}, \textsf{enumerate}, etc.) can be used. For example:
361
362 \begin{verbatim}
363 \VariationsEnvironment
364 {\begin{enumerate}[a)]}
365 {\end{enumerate}
366 \end{verbatim}
367
368
369 \bigskip\noindent
370 Different "{variations}" environments can be nested one into another, at least in some combinations (that is, sometimes there are problems, but it's been hard to understand why). It seems that the main requirement is that they don't appear at the same level of commentary. Here is a full analysis from a game that actually calls for commentary this deep. This is the input:
371
372
373 \makebarother\begin{verbatim}
374 |Bd4!! f5\onlymove Bxg7+\onlymove Kxg7
375 [\begin{variations}
376 \var Kg8 Qg3! Bxd6 Bxc6 Qxc6 Qg6! Rf7\onlymove
377 Bh6+ Kh8 Qxf7 Rg8 Bg5! Rg7\onlymove Qe8+ Bf8
378 [Rg8 Bf6+ Nxf6 Qxc6] Re1\WBetter
379 \var Kh7 Qh3+ Kxg7 Qg3+| transposes to the
380 game|\end{variations}]
381 Qg3+ Kh7 [Kf6? Qg5\#] Rb3!!| (threatening mate
382 with |\Threat<Qh3+ Kg7 Rg3+ Kf6 Qh6\#>\[|) and now:
383 |\ahead\begin{variations}
384 \var Bxd6 \[| where I had calculated
385 |\ahead\begin{variations*}\var Qh4+ Kg7 Rg3+ Kf7 Qh5+!
386 Kf6 Rg6+ Kf7 Rh6+ Ke7 Rh7+|, but
387 |\var Qg5!\end{variations*}\]|
388 with mate is more elegant.
389 |\var Nf6 Qh3+ Kg7 Rg3+ Ng4 Rxg4+! fxg4 Qxg4+ Kh8
390 Qh5+ Kg8 Qh7\#|.
391 |\var Rf6 Qh3+ Kg7 [Rh6 Bxf5! exf5 Qxf5 Rg6 Rh3+|
392 and mate|] Rg3+ Rg6 Nxf5+! exf5 Rxg6+ Kxg6
393 Qxf5+ Kf8 Qh6+ Kf7 Bd5+ Ke8 Qg6+ Kf8 Qf7\#|.
394 |\var Nce5! fxe5 Nxe5 Nxf5! exf5 Qxe5 Qf6 Bxf5+
395 Qxf5 Qxe7+\WBetter|.
396 |\end{variations}\]|
397 \end{verbatim}
398
399
400
401 This is the position:
402 \position[w 34]{3r1r1k/3nbpp/q1nNp/p/PpP1BP/3QB/6PP/1RR3K}
403
404 \preparediagram{Garcia--Winwood}{After 33\dots\bishop e7}
405
406 \makediagrams
407
408 \noindent and this is the output:
409
410 \makebarchess
411 |Bd4!! f5\onlymove Bxg7+\onlymove Kxg7
412 [\begin{variations}%
413 \var Kg8 Qg3! Bxd6 Bxc6 Qxc6 Qg6! Rf7\onlymove
414 Bh6+ Kh8 Qxf7 Rg8 Bg5! Rg7\onlymove Qe8+ Bf8
415 [Rg8 Bf6+ Nxf6 Qxc6] Re1\WBetter
416 \var Kh7 Qh3+ Kxg7 Qg3+| transposes to the
417 game|\end{variations}]
418 Qg3+ Kh7 [Kf6? Qg5\#] Rb3!!| (threatening mate
419 with |\Threat<Qh3+ Kg7 Rg3+ Kf6 Qh6\#>\[|) and now:
420 |\ahead\begin{variations}
421 \var Bxd6 \[| where I had calculated
422 |\ahead\begin{variations*}\var\bfseries Qh4+ Kg7 Rg3+ Kf7 Qh5+!%
423 Kf6 Rg6+ Kf7 Rh6+ Ke7 Rh7+|, but
424 |\var\bfseries Qg5!\end{variations*}\]|
425 with mate is more elegant.
426 |\var Nf6 Qh3+ Kg7 Rg3+ Ng4 Rxg4+! fxg4 Qxg4+ Kh8
427 Qh5+ Kg8 Qh7\#|.
428 |\var Rf6 Qh3+ \[| and now:|\begin{variations}
429 \var Rh6 Bxf5! exf5 Qxf5 Rg6 Rh3+| and mate, as in the game.
430 |\var Rg3+ Rg6 Nxf5+! exf5 Rxg6+ Kxg6
431 Qxf5+ Kf8 Qh6+ Kf7 Bd5+ Ke8 Qg6+ Kf8 Qf7\#|.|\end{variations}\]|%
432 |\var Nce5! fxe5 Nxe5 Nxf5! exf5 Qxe5 Qf6 Bxf5+
433 Qxf5 Qxe7+\WBetter|.
434 |\end{variations}\]|
435
436 \subsection{Setting up a position}\label{position}
437
438 \DescribeMacro{\position}With the command "\position", you can set up the board to any given position. As in \textsf{skak} and old \TeXmate, the position itself is indicated in \acro{FEN} format: line by line, from top to bottom, lowercase for black pieces, uppercase for white, and numbers for empty squares---lines separated by "/". For "\position", the lines do not have to have all 8 squares: a "/" at the end of a line instructs \TeXmate\ to `fill in' the remaining places with empty squares.
439
440 It's much easier just to see one than to read the paragraph above:
441 \begin{verbatim}
442 \position{r1bq1rk/4bppp/p1p/1p1nR/%
443 8/1BP/PP1P1PPP/RNBQ2K}
444 \end{verbatim}
445 \noindent creates a position that can be visualized with \textsf{skak}'s "\showboard":
446
447 \fenboard{r1bq1rk/4bppp/p1p/1p1nR/8/1BP/PP1P1PPP/RNBQ2K w KQkq - 0 11}
448 \showboard
449
450 This is a Marshall-Attack position, and it's White's turn to make his eleventh move. If moves are going to be typeset for this diagram, we need \TeXmate\ to know it's move 11 by white. That's easy enough with old commands ("\white 11"), but in \TeXmate\,2 we have to instruct \textsf{skak} as well.
451
452 In order to do that, "\position" has an optional argument, something like "[b 19]"---whose turn it is ("w" or "b"), and what move number it is. The diagram above should be created with
453
454 \begin{verbatim}
455 \position[w 11]{r1bq1rk/4bppp/p1p/1p1nR/%
456 8/1BP/PP1P1PPP/RNBQ2K}
457 \end{verbatim}
458
459 \noindent The position is now in memory, and will be upgraded with any new moves. It can be sent, at any point, to diagram memory with "\toD".
460
461 \bigskip
462 \noindent"\position" is designed for quick diagram drawing (where it does not matter who can castle where, etc.). For complete \acro{FEN} descriptions of positions (for example from an external source), \textsf{skak}'s \SpecialIndex{\fenboard}"\fenboard{"\meta{\acro{FEN} position}"}" can be used. It has been modified so that \TeXmate\ will know who is to play and what the move number is.
463
464
465 \bigskip\noindent
466 The old \TeXmate\ command \DescribeMacro{\diagram}"\diagram", kept for compatibility, has the effect of "\position" followed by "\showboard". It now accepts the optional argument (turn and move number) and passes it on to "\position".
467
468 \section{Customization}
469
470 \subsection{The input}\label{input}
471
472 \DescribeMacro{\pieceinitials}By default, input goes by the piece initials customary in English (Rook, kNight, Bishop, Queen, King). This can be changed, so that input can be though of (or copy-pasted in) other languages. Adding the Pawn at the beginning, and going left-to-right through the initial position, "\pieceinitials{"\meta{new initials}"}" will change the initials.
473
474 The effects of this are:
475 \begin{itemize}
476 \item Input in chess mode uses the new initials for pieces.
477 \item \textsf{skak} will also change. Even the commands that are not interfaced by \TeXmate\ (notably "\showonly{"\meta{pieces-to-show}"}" will make use of the new initials.
478 \item Position setup with "\position", "\diagram", and "\fenboard" will use the new language.
479 \item \textsf{chessfss}-directed output after \SpecialIndex{\usetextfig}"\usetextfig" will use the new language.
480 \end{itemize}
481
482 The architecture of the different programs even allows input in one language and output in another: issue "\pieceinitials" for the input language, and follow it immediately with \textsf{chessfss}'s \SpecialIndex{\setfigtextchars}"\setfigtextchars" to set the output. (Of course, "\usetextfig" must be in place for the latter to have any consequences.)
483
484 There is no more customization to the input to be done: \textbf{castling} can be input either with zeroes or with O's. \textbf{Captures} can be input either with `"x"' or with `":"'---or not at all, hoping for \textsf{skak} to be OK with that (it often is). Of course, in the latter case you would lose any automatic formatting of captures. \textbf{Checks} are a `"+"' or nothing---no problem here. It is strongly recommended to input \textbf{Promotions} with the `"="' sign (`"g1=Q"'), because \textsf{skak} will understand it.
485
486 So, the system is immediately ready to read PNG games (without commentary), as long as the input language (the piece initials) is not changed.
487
488 \subsection{The output: signs}\label{signs}
489
490 \DescribeMacro{\Castle}If you want castles like ``0--0--0'', type "\Castle0" (default). If you like them like ``O--O--O'', type "\CastleO".
491
492 \DescribeMacro{\takes}Predefined essentially as "$\times$", you can "\renewcommand\takes" to substitute your favorite sign for captures (a colon? nothing?).
493
494 \DescribeMacro{\checksign}\DescribeMacro{\#}Checks are "\checksign" (`+' by default). Mate is "\#" (`\#') by default. There is a "\mate" sign in the informator fonts of \textsf{skaknew}, that looks like `\mate', and to use it you can "\renewcommand\#{\mate}".
495
496 \subsection{The output: punctuation}\label{punct}
497
498 The material between moves and move numbers can be customized. The appropriate commands, their function, and their default, are in Table~\ref{moves}.
499
500 \begin{table}[h]
501 \centering
502 \begin{tabular}{lm{.5\textwidth}l}
503 \textsf{Command} & \textsf{Meaning} & \textsf{Default}\\\hline
504 "\afterno" & What comes between the move number and White's move & ".~"\\\hline
505 "\afterw" & What comes between White's move and Black's & \verb*" "\\\hline
506 "\afterb" & What comes between Black's move and the (immediately) following move number & \verb*" "\\\hline
507 "\beforeb" & What comes before Black's move when the variation is resumed & "\the\move\dots"\\\hline
508 "\beforeno" & What comes before the move number (always, sometimes after "\afterb"). & nothing\\\hline
509 \end{tabular}
510 \caption{Punctuation commands}\label{moves}
511 \SpecialIndex{\afterno}\SpecialIndex{\afterw}\SpecialIndex{\afterb}\SpecialIndex{\beforeb}\SpecialIndex{\beforeno}
512 \end{table}
513
514 \subsection{The output: fonts and contexts}\label{fonts}
515
516 There are four levels of commentary in \TeXmate, as summarized in Table~\ref{levels}.
517
518 \begin{table}[h]
519 \centering\begin{tabular}{clll}
520 \textsf{Level no.} & \textsf{Context} & \textsf{Font} & \textsf{Delimiters}\\\hline
521 i &Main game & boldface & nothing\\
522 ii & Comm.\ level 1 & normal & [ and ]\\
523 iii & Comm.\ level 2 & normal & ( and )\\
524 iv & Comm. level 3 & italic & ( and )\\\hline
525 \end{tabular}
526 \caption{Levels, default fonts and delimiters}\label{levels}
527 \end{table}
528
529 \DescribeMacro{\...font}\DescribeMacro{\...open}\DescribeMacro{\...close}Fonts and delimiters can be changed. Each level has commands for `font,' `open,' and `close.' Those of level three, for example, are "\iiiopen", "\iiiclose", and "\iiifont". These three are defined by default as follows:
530
531 "\let\iiifont\normalfont"
532
533 "\newcommand\iiiopen{(}"
534
535 "\newcommand\iiiclose{\leavevmode\unskip)}"
536
537 \noindent and the others are analogous. They can all be redefined. The \SpecialIndex{\unskip}"\leavevmode\unskip" in "\iiiclose" removes the space that is added by \TeXmate\ after the last move.
538
539 Similarly, the space before and after the delimiters is embedded in \TeXmate. "\unskip", or its safer version "\leavevmode\unskip" can be used to remove these spaces. For example, to use the em-dash as delimiter for the third level, the redefinitions should be
540
541 \begin{verbatim}
542 \renewcommand\iiiopen{\leavevmode\unskip---}
543 \renewcommand\iiiclose{\leavevmode\unskip---}
544 \end{verbatim}
545
546 \bigskip\noindent
547 \DescribeMacro{\...opent}\DescribeMacro{\...closet}The delimiters work for commentaries open with "[". For commentaries with "\[" (`text commentaries'), the commands are "\iopent" and "\icloset", etc.\ (`"t"' for `text'). In principle they are all defined as "\relax" (nothing), but they could be redefined so that, for example, all commentary at level~ii starts on a new paragraph.
548
549
550 \bigskip\noindent
551 The regular variations in a "{variations}" environment within a "[" commentary (not a "\[" one) make their first move bold by default. \DescribeMacro{\varfont}This is command "\varfont", which is originally equivalent to "\bfseries", but can be changed. This is invoked by "\var", but not by "\var*".
552
553 \bigskip\noindent
554 \DescribeMacro{\steplevel}\DescribeMacro{\backlevel}Levels can be arbitrarily traversed with commands "\steplevel" and "\backlevel". This only affects fonts and typesetting uses, so there is no concern about getting \textsf{skak} confused. It might confuse the reader, though.
555
556
557 \subsection{Diagrams}\label{custdiagrams}
558
559 This section applies to intrinsic \TeXmate\ diagram-drawing tools. The tools of both \textsf{skak} (notably "\showboard", that typesets the current position) and \textsf{chessfss} (that provides commands for font, size, each piece on each kind of square, etc.), are kept independent, so that modularity is ensured.
560
561 In fact, \TeXmate\,2 does not have some possibilities of old \TeXmate. Its diagrams are always $8\times8$ squares. \textsf{chessboard} provides excellently for less standard situations. This program works hand in hand with \textsf{skak}, which means that when \TeXmate\ is used with this latter, there will be also communication with \textsf{chessboard}.\footnote{However, \textsf{skak} and \textsf{chessboard} do not pass information on to \TeXmate.}
562
563
564 \subsubsection{Diagram font, size, etc.}
565
566 \TeXmate\ does not deal with these matters, which are delegated to the package \textsf{chessfss}. The latter's \SpecialIndex{\setboardfontsize}"\setboardfontsize{12pt}" is issued by \TeXmate\ as a default, but there is no further handling. In addition, this latter default only has an effect when \textsf{skak} is not loaded, since otherwise \textsf{skak}'s commands (\SpecialIndex{\tinyboard}\SpecialIndex{\smallboard}\SpecialIndex{\normalboard}"\tinyboard", "\smallboard", "\normalboard") take precedence. \TeXmate\ sets "\smallboard" by default.
567
568
569 \subsubsection{Issuing the diagrams}\label{diagiss}
570 Diagrams are \emph{issued} at one point, and \emph{printed} at another. This allows the typesetting of diagrams side by side without regard to what the current position.
571
572 \DescribeMacro{\diagramsign}Issuing the diagrams is done by the commands explained in section~\ref{diagrams}, namely \SpecialIndex{\toD}\SpecialIndex{\toD*}\SpecialIndex{\preparediagram}"\toD", "\toD*", and "\preparediagram". The regular version "\toD" inserts the contents of \diagramsign, which by default is `{~\mdseries(\textit{D})}', but can be freely redefined. "\toD*" does not insert "\diagramsign".
573
574 The diagrams are then put in memory---as \LaTeX\ boxes---together with some accompanying material: player names, move number, etc. (Note that \textsf{skak}'s \SpecialIndex{\showboard}"\showboard" or \textsf{chessboard}'s \SpecialIndex{\chessboard}"\chessboard" do not `issue' a diagram in \TeXmate's terms, but simply print the current or given position.) This section describes the basic customization of the diagram boxes. It actually tells some white lies, so section~\ref{further} below explains in full detail.
575
576 By default, diagrams:
577 \begin{itemize}
578 \item Are not numbered.
579 \item Put Black's name (whatever was given by \SpecialIndex{\bname}"\bname") above the diagram, boldface.
580 \item Put White's name \SpecialIndex{\wname}("\wname") below, boldface.
581 \item Typeset the last move (the argument to "\toD" or "\toD*") below White's name.
582 \item \textbf{Analysis} diagrams (diagrams issued within a commentary, i.e., between "["~and~"]" or "\["~and"\]") override the default behavior: instead of the players' names, the word `Analysis' appears at the top of the diagram, and the last move appears at the bottom.
583 \end{itemize}
584
585
586 \begin{table}
587 \begin{tabular}{lm{.6\textwidth}}\hline
588 "\topdiagramnames" & Players' names on top of the diagram. Like this: `\textbf{Dubois--Steinitz}'.\\\cline{2-2}
589 "\bottomdiagramnames" & Players' names at the bottom of the diagram.\\\cline{2-2}
590 "\diagramnames" & White's name at the bottom, Black's on top (default).\\\cline{2-2}
591 "\nodiagramnames" & No players' names.\\\hline
592 "\diagramnumber" & Diagram number on the top of the diagram (above names, if any). \newline The number is formatted by the current version of "\TheDiagram"---by default something like `\textit{\textbf{4}}'. \newline Regular (lower-case) "\thediagram" is intended for running-text reference. \\\cline{2-2}
593 "\nodiagramnumber" & No diagram numbers (default).\\\hline
594 "\leftdiagramturn" & Turn marker at the left of the diagram.\\
595 "\rightdiagramturn" & Turn marker at the right of the diagram.\\
596 "\nodiagramturn" & No turn marker (default).\\\hline
597 "\diagrammove" & Last move at the bottom (default).\\
598 "\nodiagrammove" & No last move.\\\hline
599 "\analysistop" & What goes by default on top of analysis diagrams. Defined originally as `Analysis'.
600 \end{tabular}
601 \SpecialIndex{\topdiagramnames}\SpecialIndex{\bottomdiagramnames}\SpecialIndex{\diagramnames}
602 \SpecialIndex{\nodiagramnames}\SpecialIndex{\diagramnumber}\SpecialIndex{\nodiagramnumber}\SpecialIndex{\leftdiagramturn}
603 \SpecialIndex{\rightdiagramturn}\SpecialIndex{\nodiagramturn}\SpecialIndex{\diagrammove}\SpecialIndex{\nodiagrammove}
604 \SpecialIndex{\analysistop}\SpecialIndex{\thediagram}\SpecialIndex{\TheDiagram}
605 \caption{Command for diagram information}\label{diagramcommands}
606 \end{table}
607
608 \noindent The commands of Table~\ref{diagramcommands} govern these defaults. They are user-modifiable with "\renewcommand", with one warning: these commands (and in general non-chess stuff) should go \emph{outside} chess mode.
609
610 \DescribeMacro{\whiteturnmarker}\DescribeMacro{\blackturnmarker}When a turn marker is requested, \TeXmate\ will use the contents of either "\whiteturnmarker" or "\blackturnmarker". These, by default, are defined as:
611
612 \begin{verbatim}
613 \newcommand*\whiteturnmarker{%
614 \raisebox{.75\expandafter\ht\csname
615 chessdiag\@roman\@tempcnta\endcsname}{%
616 \textsl{W}}\ }
617 \end{verbatim}
618
619 \noindent where the first part is responsible for raising the symbol to three-quarters the height of the diagram. Modification of the coefficient .75 and of the actual contents of the box should (or the space after it) should pose no problem.
620
621
622 \DescribeMacro{\nextdiagramtop}\DescribeMacro{\nextdiagrambottom}On the other hand, it is possible to set the top and the bottom of one diagram (the one that is issued next, with "\toD" or "\toD*") with "\nextdiagramtop{"\meta{header}"}" and "\nextdiagrambottom{"\meta{footer}"}".
623
624 For example:
625
626 \begin{verbatim}
627 \nextdiagramtop{\wname--\bname}
628 \nextdiagrambottom{Final position after}
629 \toD*{Bxf3}
630 \makediagrams
631 \end{verbatim}
632
633 \noindent produces
634
635 \nextdiagramtop{\wname--\bname}
636 \nextdiagrambottom{Final position after}
637 \toD*{Bxf3}
638 \makediagrams
639
640 \noindent \DescribeMacro{\diagramtop}\DescribeMacro{\diagrambottom}\DescribeMacro{\wname}\DescribeMacro{\bname}To set the top or bottom of \emph{all} future (non-analysis) diagrams at once, the commands "\diagramtop" and "\diagrambottom" can be redefined with "\renewcommand". For this, the commands "\wname" and "\bname", which hold the player names (as given at the beginning of the game with \SpecialIndex{\whitename}\SpecialIndex{\blackname}"\whitename" and "\blackname", as in section~\ref{markup}), might prove useful.
641
642
643 \bigskip\noindent
644 \DescribeMacro{\makediagramsfont}All the text typeset by "\makediagrams" is subject to "\makediagramsfont". By default it means "\small", but it can be changed at any point.
645
646 \subsubsection{Printing the diagrams}\label{diagpr}
647 The diagrams are actually typeset with the command \SpecialIndex{\makediagrams}"\makediagrams". This command will typeset, in principle, all diagrams in memory, framed and separated by "\hfill"'s. (There is therefore no need for "\centering", which in fact can disturb the resulting layout.)
648
649 An optional argument to "\makediagrams["\meta{n}"]" will tell \TeXmate\ to typeset only the first $n$ diagrams in memory. The rest of the diagrams take then the memory positions of those that were typeset.
650
651 \DescribeMacro{\DiagramCache}By default, the number of diagrams that can be held in memory is~3. It can be enlarged with the command "\DiagramCache{"\meta{number}"}". So, a page of nine diagrams like page~\pageref{problems} below can be composed thus (the counter is reset because previous diagrams in this document have stepped it):
652
653 \begin{verbatim}
654 \DiagramCache{9}
655 \setcounter{diagram}{0}
656 \tinyboard
657 \diagramnumber
658 \leftdiagramturn
659 \let\makediagramfont\footnotesize
660 % First diagram
661 \position[w 22]{r1q4r/pp2bQ/2p2p1k/6pp/4N/6R/PPP2PPP/2KR}
662 \preparediagram{}{22.~?}\label{pageref}
663
664 % Second diagram
665 \position[b 20]{r5k/1bpp1ppp/1p1b3r/pP2n1q/2PB/P3PPP/3QBR1P/R2N2K}
666 \preparediagram{}{{20\dots?}}
667
668 etc.
669
670 % Ninth diagram
671 \position[w 27]{2r1r1k/p1q2ppp/6n/1p1Q/2N1P/P3B2P/2R2PP/6K}
672 \preparediagram{}{27.?}
673
674 \begin{figure}[p]
675 \makediagrams[3]
676
677 \smallskip\makediagrams[3]
678
679 \smallskip\makediagrams[3]
680 \end{figure}
681 \end{verbatim}
682
683 \DiagramCache{9}
684 \setcounter{diagram}{0}
685 \tinyboard
686 \diagramnumber
687 \leftdiagramturn
688 \let\makediagramfont\footnotesize
689
690 \position[w 22]{r1q4r/pp2bQ/2p2p1k/6pp/4N/6R/PPP2PPP/2KR}
691 \preparediagram{}{22.~?}
692
693 \position[b 20]{r5k/1bpp1ppp/1p1b3r/pP2n1q/2PB/P3PPP/3QBR1P/R2N2K}
694 \preparediagram{}{20\dots?}
695
696 \position[w 13]{r2qr1k/ppp1bppp/5n/1N1PQ1B/8/8/PPP2PPP/R4RK}
697 \preparediagram{}{13.~?}
698
699 \position[w 34]{3r1r1k/3nbpp/q1nNp/p/PpP1BP/3QB/6PP/1RR3K}
700 \preparediagram{}{34.~?}
701
702 \position[w 15]{rnbr2k/pp2bppp/4pn/1N2N/2B1q/4B/PP2QPPP/R2R2K}
703 \preparediagram{}{13.~?}
704
705 \position[b 22]{1r2r1k/5ppp/R2b/3p3q/3P/2P1B1Pb/1P3P1P/1N2R1KQ}
706 \preparediagram{}{22\dots?}
707
708 \position[b 44]{8/5k1r/4pP1p/3pP1pP/2p1p1P/5n1Q/r/1R5K}
709 \preparediagram{}{44\dots?}
710
711 \position[b 22]{1k4r/p1q2p/Q1p1pp/3p3p/4rP/1P/P1P1NK/3R1R}
712 \preparediagram{}{22\dots?}
713
714 \position[w 27]{2r1r1k/p1q2ppp/6n/1p1Q/2N1P/P3B2P/2R2PP/6K}
715 \preparediagram{}{27.?}
716
717 \begin{figure}[p]
718 \makediagrams[3]\label{problems}
719
720 \smallskip\makediagrams[3]
721
722 \smallskip\makediagrams[3]
723 \end{figure}
724
725
726 \bigskip
727 \noindent Almost all the layout parameters described in the previous section have an effect when the diagram is \emph{issued}. However, the switches for move number and last move (i.e., whether and where they should be put) are enforced at the moment of printing with "\makediagrams".
728
729 \subsubsection{Diagrams and cross refences}\label{diagref}
730
731 Diagrams are counted (whether the number is printed or not) with the "diagram" counter. When diagrams are printed with \SpecialIndex{\makediagrams}\SpecialIndex{diagram}\SpecialIndex{\label}"\makediagrams", this counter is "\refstep"'ped, i.e., a "\label" can be assigned to it for cross references. The mechanism is not completely implemented in \TeXmate, not least because there is little of a `standard' use. As it stands, the main problem is that the user cannot assign individual "\label"'s to diagrams that printed with the same "\makediagrams". On the other hand, if the latter command is used for one diagram at a time, cross referencing is fully functional.
732
733 \subsubsection{Detailed mechanism description}\label{further}
734
735
736 The commands described in the previous section are not intended to provide full control on diagram layout, but rather simple tools for the needs of most of the time. More extensive customization will require hands-on programming. The diagram mechanism in \TeXmate\,2 has been designed to make this task easier, should it arise. This section explains it.
737
738 As has been said, a diagram is \emph{issued} first and \emph{retrieved} later. The issuing commands \SpecialMainIndex{\toD}\SpecialMainIndex{\toD*}\SpecialMainIndex{\preparediagram}("\toD", "\toD*", and "\preparediagram") build four \LaTeX\ boxes and one command containing the diagram and the accompanying information. The names of these boxes contain the diagram number in lowercase Roman numerals. If, for example, a diagram in the third memory position is being issued, the following boxes are created:
739 \begin{itemize}
740 \item "\chessdiagiii" holds the diagram itself---and it is a copy of either "\showboard" or (when \textsf{skak} is not loaded) \TeXmate's own typesetting of the diagram with \textsf{chessfss} commands.
741 \item "\chessdiagiiitop" holds whatever goes on the top of the diagram. It can be: $a)$~with the "\...diagramnames" switches, the names of the players (or of Black); $b)$ whatever was defined by the user as "\diagramtop"; or $c)$ the first argument of the user's "\preparediagram".
742 \item "\chessdiagiiibottom" holds whatever goes on the bottom of the diagram. Analogous.
743 \item "\chessdiagiiimove" holds the typeset form of the argument to "\toD" or "\toD". It is empty in the case of "\preparediagram".
744 \end{itemize}
745 \SpecialIndex{\chessdiag...}\SpecialIndex{\chessdiag...top}\SpecialIndex{\chessdiag...bottom}
746 \SpecialIndex{\chessdiag...move}
747
748 \SpecialIndex{\chessdiag...turn}In addition, each diagram also has a command, "\chessdiagiiiturn" for the third diagram. This is set, according to whose turn it is when the diagram is issued, to expand to either "\whiteturnmarker" or "\blackturnmarker".\SpecialIndex{\whiteturnmarker}\SpecialIndex{\blackturnmarker}
749
750 The default \SpecialMainIndex{\makediagrams}"\makediagrams" (the command that is most likely to change in customization) is a fairly simple usage of these boxes and commands. Essentially, it follows the switches for diagram number, turn, and last move ("\if@numbertop", "\if@turnleft", "\if@turnright", "\if@movebottom") to typeset a "\shortstack[c]" containing, from top to bottom
751
752 \begin{center}
753 the diagram number
754
755 "\chessdiagiiitop"
756
757 "\chessdiagiii"
758
759 "\chessdiagiiibottom"
760
761 "\chesdiagiiimove"
762 \end{center}
763 \noindent For items to the left or the right, it builds 0-wide boxes (so that they don't affect centering and spacing) that contain "\whiteturnmarker" or "\blackturnmarker".
764
765 The same applies for all diagrams, just replacing the inner "iii" by the Roman numeral (lowercase) of the position of the diagram in memory. Note that this number is not the diagram~number, but its slot in memory. After using the boxes in that way, \SpecialMainIndex{\makediagrams}"\makediagrams" calls "\@killdiagrams", that deletes the diagrams from memory (and moves any remaining diagrams to the first memory positions).
766
767 \subsection{Cosmetics}\label{cosmetics}
768
769 There are other tools in \TeXmate\ that are provided `as is,' without complicated customization, because there is no standard. These should be modified or directly replaced to follow individual preferences.
770
771 The game title is one of them. The pieces of information already implemented (with the user commands described in section~\ref{markup}) are: the players' names, held in "\wname" and "\bname"; their ratings, "\@welo", "\@belo"; the event, "\@tourn"; the opening, "\@opening"; and the \acro{ECO} code, held in "\@eco". The latter is the only one that adds something to the user's input: "\def\@elo{ -- \textbf{#1}}".
772
773 Then, \SpecialMainIndex{\makegametitle}"\makegametitle" simply uses these variables. Redefining it will not affect the program in any way.
774
775 \bigskip
776 \noindent\DescribeMacro{\result}Game result is also a `cosmetic.' The current definition of "\result{"\meta{result}"}" puts a boldface copy of its argument on the right margin of the current line, if it fits, or of the next one, if it doesn't. (When the command is encountered not in the main game, but in the commentaries, the argument is simply typeset.)
777
778 \DescribeMacro{\whitewins}\DescribeMacro{\blackwins}\DescribeMacro{\drawn}\DescribeMacro{\resigns}"\whitewins" simply means "\result{1\,:\,0}"; "\blackwins" and "\drawn" are analogous. Finally, "\resigns" issues "\whitewins" if it's Black's turn, or "\blackwins" if it's White's.
779
780 \section{\protect\TeXmate\,2 and \textsf{skak}}\label{skak}
781
782 The command \SpecialIndex{\showboard}"\showboard" in the package \textsf{skak} has been mentioned repeatedly in this manual. It can be used with \TeXmate, and it provides total flexibility for the typesetting of the diagram, forgoing the automatic formatting that \TeXmate\ performs.
783
784 Another important command, also mentioned before, is \SpecialIndex{\fenboard}"\fenboard".
785
786 But there are other commands from \textsf{skak} whose use might prove an extension to \TeXmate's capabilities. This is mainly connected to saving and restoring positions in memory or disk. \textsf{skak}'s \SpecialIndex{\storegame}"\storegame{"\meta{key}"}" saves a position in memory, to be restored by \SpecialIndex{\restoregame}"\restoregame{"\meta{key}"}". With this tool, for example, it is possible to quote an independent game in commentary, and still have the capabilities of \textsf{skak}. All that is needed is to store the main game, type \SpecialIndex{\newgame}"\newgame", quote the alternative game, issue any diagrams from it, and restore the main game when done. (\textsf{skak} also offers \SpecialIndex{\sidegame}"\sidegame" for this purpose, but its use with \TeXmate\ is not as straightforward.
787
788
789
790 \bigskip
791 \noindent \DescribeMacro{\SkakOff}\DescribeMacro{\SkakOn}If, for any reason, the capabilities of \textsf{skak} are an obstacle rather than a utility, \textsf{skak} can be turned off with "\SkakOff". \TeXmate\ will then typeset the moves as given, without passing them onto \textsf{skak}, and any potential problems and error messages caused by \textsf{skak} trying to follow the game will be avoided. "\SkakOn" turns all capabilities back on.
792
793 \TeXmate\,2 has a small tracing utility of \textsf{skak}'s workings: option \texttt{[diagnostics]} will type out messages with the moves that have been passed on to \textsf{skak}, helping understand where the latter stands respect to the typeset game and analysis.
794
795 \makebarother
796
797 \section{Chess symbols}
798
799 Chess symbols, as chess fonts, are delegated to \textsf{chessfss} in \TeXmate\,2. There are some differences with the output of \TeXmate, for the latter used to modify some of the symbols (in size, in position, etc.). It has been decided, for the sake of modularity, to forgo these modifications in \TeXmate\,2. Table~\ref{symbols} lists the symbols (with \TeXmate\ command names).
800
801 \makebarother
802 \begin{table}
803 \centering
804 \begin{tabular}{lc}\hline
805 \verb"\wbetter" & \wbetter\\
806 \verb"\bbetter" & \bbetter\\
807 \verb"\wBetter" & \wBetter\\
808 \verb"\bBetter" & \bBetter\\
809 \verb"\WBetter" & \WBetter\\
810 \verb"\BBetter" & \BBetter\\
811 \verb"\equal" & \equal \\
812 \verb"\unclear" & \unclear\\
813 \verb"\compensation" & \compensation\\\hline
814 \verb"\development" & \development\\
815 \verb"\spaceadv" & \spaceadv \\
816 \verb"\attack" & \attack \\
817 \verb"\initiative" & \initiative \\
818 \verb"\counterplay" & \counterplay \\\hline
819 \verb"\zugzwang" & \zugzwang \\
820 \verb"\onlymove" & \onlymove\\
821 \verb"\withidea" & \withidea \\
822 \verb"\betteris" & \betteris \\\hline
823 \verb"\boardfile" & \boardfile \\
824 \verb"\boarddiagonal" & \boarddiagonal\\
825 \verb"\boardcenter" & \boardcenter \\
826 \verb"\kingside" & \kingside \\
827 \verb"\queenside" & \queenside \\\hline
828 \verb"\weak" & \weak \\
829 \verb"\ending" & \ending \\
830 \verb"\bishops" & \bishops \\
831 \verb"\oppositebishops" & \oppositebishops\\
832 \verb"\samebishops" & \samebishops\\\hline
833 \verb"\unitedpawns" & \unitedpawns \\
834 \verb"\separatedpawns" & \separatedpawns \\
835 \verb"\doubledpawns" & \doubledpawns \\
836 \verb"\passedpawn" & \passedpawn \\
837 \verb"\pawnsno" & \pawnsno\\\hline
838 \verb"\timetrouble" & \timetrouble \\
839 \verb"\with" & \with \\
840 \verb"\without" & \without \\
841 \verb"\chessetc" & \chessetc \\\hline
842 \end{tabular}
843 \caption{Chess symbols}\label{symbols}
844 \end{table}
845
846 \clearpage
847 \PrintIndex
848 \end{document}
849