summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/texmate/texmate.sty
blob: 998a3fd9ff46cd9256406e9255cbb295b0a3bff5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
%%
%% This is file `texmate.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% texmate.dtx  (with options: `package')
%% 
%% Copyright 2005 Federico Garcia
%% 
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{texmate}[2005/03/12 v1 Chess typesetting (Federico Garcia)]
\newif\if@filling\@fillingfalse
\DeclareOption{filling}{\@fillingtrue}
\DeclareOption{notfilling}{\@fillingfalse}
\DeclareOption*{\typeout{Unknown option (`\CurrentOption')}}
\ExecuteOptions{filling}
\ProcessOptions
\def\pieceinitials#1{\@initials#1}
\def\@initials#1#2#3#4#5#6{%
    \def\@Pawn{#1}\def\@Rook{#2}\def\@Knight{#3}%
    \def\@Bishop{#4}\def\@Queen{#5}\def\@King{#6}%
    \lowercase{\def\@pawn{#1}\def\@rook{#2}\def\@knight{#3}%
    \def\@bishop{#4}\def\@queen{#5}\def\@king{#6}}}
\newlength\diagramsize
\newcount\SquareNo
\newcount\@squarecount
\newif\if@blacksq\@blacksqfalse
\def\@togglesq{\if@blacksq\@blacksqfalse\else\@blacksqtrue\fi}
\newcount\@piececode
\def\diagram#1{\font\diagramfont=skak10 at \the\diagramsize
    \@squarecount\SquareNo
    \bgroup
    \setlength\fboxsep{.8pt}%
    \fbox{\parbox{\the\SquareNo\diagramsize}{%
        \baselineskip\diagramsize\diagramfont\@diagline#1.}}\egroup}
\def\@diagpiece#1{\def\temp{#1}\symbol{%
        \ifx\temp\@pawn\if@blacksq'157\else'160\fi\else
        \ifx\temp\@rook\if@blacksq'163\else'162\fi\else
        \ifx\temp\@knight\if@blacksq'155\else'156\fi\else
        \ifx\temp\@bishop\if@blacksq'141\else'142\fi\else
        \ifx\temp\@queen\if@blacksq'154\else'161\fi\else
        \ifx\temp\@king\if@blacksq'152\else'153\fi\else
        \ifx\temp\@Pawn\if@blacksq'117\else'120\fi\else
        \ifx\temp\@Rook\if@blacksq'123\else'122\fi\else
        \ifx\temp\@Knight\if@blacksq'115\else'116\fi\else
        \ifx\temp\@Bishop\if@blacksq'101\else'102\fi\else
        \ifx\temp\@Queen\if@blacksq'114\else'121\fi\else
        \ifx\temp\@King\if@blacksq'112\else'113\fi\else
        \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}}
\def\@diagline#1{\@tempcnta0 \let\next\@diagline
    \ifx#1.\let\next\relax\if@filling\@dospaces{\@squarecount}\fi
    \else\ifx#1/\def\next{\if@filling\@dospaces{\@squarecount}\fi
        \newline\@togglesq\@squarecount\SquareNo\relax
        \@diagline}%
    \else\ifcat1#12\@dospaces{#1}%
    \else\@diagpiece#1\advance\@squarecount-1 \@togglesq
    \fi\fi\fi
    \next}
\def\@dospaces#1{\ifnum#1>0
    \if@blacksq\symbol{'132}\else\hphantom{\symbol{'132}}\fi
    \@togglesq\@tempcntb#1 \advance\@tempcnta1 \advance\@squarecount-1
    \ifnum\@tempcnta<\@tempcntb\let\@next\@dospaces\else
        \let\@next\@gobble\fi
    \@next\@tempcntb\fi}
\newcommand{\skakfamily}{\usefont{U}{skak}{m}{n}}
\DeclareTextFontCommand{\textskakbf}{\skakfamily\bfseries}
\DeclareTextFontCommand{\textskak}{\skakfamily}
\newcount\@rk\@rk'122
\newcount\@kt\@kt'116
\newcount\@bp\@bp'102
\newcount\@qn\@qn'121
\newcount\@kg\@kg'113
\DeclareRobustCommand\rook{\@piece\@rk }
\DeclareRobustCommand\knight{\@piece\@kt }
\DeclareRobustCommand\bishop{\@piece\@bp }
\DeclareRobustCommand\queen{\@piece\@qn }
\DeclareRobustCommand\king{\@piece\@kg }
\def\@piece#1{\bgroup\catcode`\x=11 \textpiece{\symbol{#1}}\egroup}
\def\@@piece#1{\def\temp{#1}%
    \ifx\temp\@Rook\rook\else
    \ifx\temp\@Knight\knight\else
    \ifx\temp\@Bishop\bishop\else
    \ifx\temp\@Queen\queen\else
    \ifx\temp\@King\king\else
    #1\fi\fi\fi\fi\fi}
\DeclareRobustCommand\takes{\makebox[1.2ex][c]{$\times$}}
{\catcode`\x=13 \gdefx{\takes}}
\def\@chesssymbol#1{\bgroup\catcode`\x=11
    \smash{\textskak{\symbol{#1}}}\egroup }
\DeclareRobustCommand\checksign{\smash{\@piece{'053}}}
\DeclareRobustCommand\mate{\smash{\@piece{'155}}}
\DeclareRobustCommand\wbetter{\raisebox{-.1ex}{\@chesssymbol{'146}}}
\DeclareRobustCommand\bbetter{\raisebox{-.1ex}{\@chesssymbol{'147}}}
\DeclareRobustCommand\wBetter{\raisebox{-.35ex}{\@chesssymbol{'143}}}
\DeclareRobustCommand\bBetter{\@chesssymbol{'145}}
\DeclareRobustCommand\WBetter{{\large\@chesssymbol{'150}}}
\DeclareRobustCommand\BBetter{{\large\@chesssymbol{'151}}}
\DeclareRobustCommand\equal{=}
\DeclareRobustCommand\unclear{\raisebox{-.5ex}{{\Large\@chesssymbol{'153}}}}
\DeclareRobustCommand\compensation{{\large\@chesssymbol{'156}}}
\DeclareRobustCommand\development{{\footnotesize\@chesssymbol{'164}}}
\DeclareRobustCommand\spaceadv{{\footnotesize\@chesssymbol{'171}}}
\DeclareRobustCommand\attack{\raisebox{-.3ex}{{\large\@chesssymbol{'101}}}}
\DeclareRobustCommand\initiative{\raisebox{-.2ex}{{\large\@chesssymbol{'103}}}}
\DeclareRobustCommand\counterplay{{\large\@chesssymbol{'126}}}
\DeclareRobustCommand\zugzwang{{\small\@chesssymbol{'104}}}
\DeclareRobustCommand\withidea{{\footnotesize\@chesssymbol{'105}}}
\DeclareRobustCommand\onlymove{{\footnotesize\@chesssymbol{'106}}}
\DeclareRobustCommand\betteris{{\footnotesize\@chesssymbol{'142}}}
\DeclareRobustCommand\boardfile{\@chesssymbol{'110}}
\DeclareRobustCommand\boarddiagonal{{\small\@chesssymbol{'107}}}
\DeclareRobustCommand\boardcenter{{\small\@chesssymbol{'111}}}
\DeclareRobustCommand\kingside{\@chesssymbol{'117}}
\DeclareRobustCommand\queenside{\@chesssymbol{'115}}
\DeclareRobustCommand\weak{{\small\@chesssymbol{'170}}}
\DeclareRobustCommand\ending{{\footnotesize\@chesssymbol{'114}}}
\DeclareRobustCommand\bishops{\@chesssymbol{'141}}
\DeclareRobustCommand\oppositebishops{\@chesssymbol{'157}}
\DeclareRobustCommand\samebishops{\@chesssymbol{'163}}
\DeclareRobustCommand\unitedpawns{\@chesssymbol{'153}}
\DeclareRobustCommand\separatedpawns{\@chesssymbol{'161}}
\DeclareRobustCommand\doubledpawns{\@chesssymbol{'144}}
\DeclareRobustCommand\passedpawn{\@chesssymbol{'162}}
\DeclareRobustCommand\pawnsno{{\small\@chesssymbol{'123}}}
\DeclareRobustCommand\timetrouble{{\small\@chesssymbol{124}}}
\DeclareRobustCommand\with{{\small\@chesssymbol{'166}}}
\DeclareRobustCommand\without{{\small\@chesssymbol{'167}}}
\DeclareRobustCommand\chessetc{\@chesssymbol{'120}}
\DeclareRobustCommand\chesssee{\@chesssymbol{'154}}
\def\ifont{\bfseries\let\textpiece\textskakbf}
\def\iifont{\normalfont\let\textpiece\textskak}
\def\iiifont{\normalfont}
\def\ivfont{\itshape}
\newcount\@commlevel
\let\iopen\relax\let\iclose\relax
\DeclareRobustCommand\iopent{\par\noindent }
\DeclareRobustCommand\icloset{\par}
\DeclareRobustCommand\iiopen{ [}
\DeclareRobustCommand\iiclose{\leavevmode\unskip]\textbf{;} }
\DeclareRobustCommand\iiiopen{ (}
\DeclareRobustCommand\iiiclose{\leavevmode\unskip) }
\DeclareRobustCommand\ivopen{ (}
\DeclareRobustCommand\ivclose{\leavevmode\unskip) }
\DeclareRobustCommand\iiopent{}
\DeclareRobustCommand\iicloset{}
\DeclareRobustCommand\iiiopent{}
\DeclareRobustCommand\iiicloset{}
\DeclareRobustCommand\ivopent{}
\DeclareRobustCommand\ivcloset{}
\def\makebarother{\catcode`\|=12 }
\def\makebarchess{\catcode`\|=13 }
\makebarchess
\def\@chesscodes{\catcode`\ =\active \catcode`\.=\active
    \catcode`\;=\active \catcode`\[=\active \catcode`\]=\active
    \catcode`\>=\active \catcode`\+=\active }
\def\@restorecodes{\catcode`\ =10 \catcode`\.=12
    \catcode`\;=12 \catcode`\]=12 \catcode`\[=12
    \catcode`\>=12 \catcode`\x=11 \catcode`\+=12 }
\newif\if@white
\newif\if@resuming
\newif\if@delimited
\def\@turn{\@delimitedtrue\if@white\@whitefalse\else\@whitetrue\fi}
\long\def\@execute#1{\let\next\relax
    \ifcat1\noexpand#1%
        \ifnum0=#1
            \if@white
                \if@resuming
                    \def\next{\beforeno\the\move\afterno
                        \catcode`\x=\active\@@piece}%
                \else
                    \def\next{\afterb\beforeno\the\move\afterno
                        \catcode`\x=\active\@@piece}%
                \fi
            \else
                \if@resuming
                    \def\next{\beforeb
                        \advance\move1
                        \catcode`\x=\active\@@piece}%
                \else
                    \def\next{\afterw
                        \advance\move1
                        \catcode`\x=\active\@@piece}%
                \fi
            \fi
            \@delimitedfalse
            \@resumingfalse
        \else
            \def\next{\move}%
        \fi
    \else
    \ifcat a\noexpand#1%
        \if@white
            \if@resuming
                \def\next{\beforeno\the\move\afterno
                    \catcode`\x=\active\@@piece}%
            \else
                \def\next{\afterb\beforeno\the\move\afterno
                    \catcode`\x=\active\@@piece}%
            \fi
        \else
            \if@resuming
                \def\next{\beforeb
                    \advance\move1
                    \catcode`\x=\active\@@piece}%
            \else
                \def\next{\afterw
                    \advance\move1
                    \catcode`\x=\active\@@piece}%
            \fi
        \fi
        \@delimitedfalse
        \@resumingfalse
    \fi\fi
    \next#1}
\newcount\move
\DeclareRobustCommand\afterno{.~}
\DeclareRobustCommand\afterw{ }
\DeclareRobustCommand\afterb{; }
\DeclareRobustCommand\beforeb{\the\move.~\dots\ }
\DeclareRobustCommand\beforeno{}
\def\@openchess{\let|\@closechess
    \advance\@commlevel-1\relax
    \csname\@roman{\the\@commlevel}font\endcsname
    \@chesscodes
    \@execute}
\let|\@openchess
\def\@closechess{\let|\@openchess
    \if@delimited\else\@turn\fi
    \@restorecodes\normalfont
    \@resumingtrue\advance\@commlevel1\relax}
\def\@opencomm#1{%
    \@resumingtrue
    \catcode`\x=11
    \bgroup
    \if@delimited
        \@turn
    \fi
    \@delimitedtrue
    \if@white\else\advance\move-1\fi
    \advance\@commlevel1\relax
    \csname\@roman{\the\@commlevel}font\endcsname
    \csname\@roman{\the\@commlevel}#1\endcsname
    \@execute}
\def\@closecomm#1{\csname\@roman{\the\@commlevel}#1\endcsname
    \egroup}
\def\dummy{\@turn
    \if@white\advance\move1\relax\fi\@execute}
\def\ddummy{\advance\move1\relax\@execute}
\def\black{\@whitefalse\@execute}
\def\white{\@whitetrue\@execute}
\def\steplevel{\advance\@commlevel1\relax\csname
    \@roman{\the\@commlevel}font\endcsname}
\def\backlevel{\advance\@commlevel-1\relax\csname
    \@roman{\the\@commlevel}font\endcsname}
\def\newgame{\@whitetrue\@resumingtrue\@commlevel2 \move1 \@delimitedtrue}
\long\def\threat#1{\bgroup\ifcase\@commlevel\or
    \iifont\or\iiifont\or\ivfont\or\ivfont\fi\
    \@restorecodes\catcode`\>\active\withidea}
\def\@chessperiod{. }
\def\@chesssemicolon{; }
{\@chesscodes\iffalse
\fi\global\let\.\@chessperiod\iffalse
\fi\global\let\;\@chesssemicolon\iffalse
\fi\gdef+{\checksign}\iffalse
\fi\gdef\#{\mate}\iffalse
\fi\long\gdef #1{\ifx #1\else\iffalse
    \fi\if@delimited\else\@turn\fi\expandafter\@execute\fi#1}\iffalse
\fi\gdef.#1{ }\gdef;{ }\iffalse
\fi\global\let>\egroup\iffalse
\fi\gdef[{\@opencomm{open}}\iffalse
\fi\gdef\[{\@opencomm{opent}}\iffalse
\fi\gdef]{\@closecomm{close} }\iffalse
\fi\gdef\]{\@closecomm{closet} }}
\setlength\diagramsize{18pt}
\SquareNo8
\pieceinitials{PRNBQK}
\let\textpiece\textskak
\newgame
\endinput
%%
%% End of file `texmate.sty'.