Debian Codegraph @

texmf-dist/doc/fonts/xq/xqexample.tex

raw
1 %example file for demonstrating the usage of xq.sty.
2 \documentclass[twocolumn,11pt]{article}
3 \usepackage{xq}
4
5 \parindent 0pt
6 \setlength{\columnsep}{5mm}
7 \setlength{\textheight}{220mm}
8 \setlength{\headheight}{13.6pt}
9 \setlength{\hoffset}{-3.0mm}
10 \setlength{\voffset}{-6.0mm}
11
12 \begin{document}
13
14 \texttt{The xq package is made for writing about Xiangqi or Chinese chess. This file demonstrates what the package can do.}
15
16 \mylanguage english
17 %i ve tried to enable input of the language typical letters for the different pieces. By now there
18 %are letters defined for:
19 %
20 %"german" (King=F, Advisor/Guard=M, Elephant=E, Chariot=W, Cannon=K, Horse=P, Soldier=S - for red pieces
21 % and corresponding lower cases for black pieces)
22 %"english" (K,A,E,R,C,H,P);
23 %"spanish" (R,O,E,T,B,C,P);
24 %"italian" (R,M,E,T,B,C,P);
25 %"french" (R,M,E,T,B,C,P);
26 %"czech" (K,R,S,V,D,J,P) and
27 %"dutch" (G,A,O,T,K,P,S)
28 %
29 %If you want to add your language or do not like the letters I used goto xq.sty and use the pattern
30 %to define the letter definitions according to your preferences. Please rename the style file, if you
31 %make any changes.
32 %This selection affects on the one hand the letters for the pieces when setting up a position in the
33 %input file and on the other hand the letters for pieces shown in the move blocks in the output file.
34
35 \bigskip
36 \texttt{First we write down a complete game.}
37 \newgame
38 %defines the board with the start position, the movecount, shown in the move blocks, is set to 0.
39
40 \begin{center}
41 {\bf\large{Player\,1\,--\,Player\,2}}
42 \end{center}
43
44 \move f1e2 h8e8
45 %note that there is absolutely no check for legal moves - this means, that on the one hand any piece can move to any place, even to the place it comes from and on the other hand a piece moved from/to a place that does not exist on the board will not be shown, selecting an empty square as start square produces an error - so everything has to be correct here
46 \bigskip
47 \texttt{Moves are input like this: "\textbackslash{}move f1e2 h8e8". The letter of the piece moved is generated automatically and also, whether it is a capture or not. The piece letters shown depend on the language, you choose at the beginning of the .tex file, in this case it is "english". By now there are letters defined for English, Spanish, French, Italian, Czech, Dutch and my mother tongue: German. I created a pattern in the style file, where you can add your language typical letters, if the ones already defined do not match your preferences.} \\
48 \bigskip
49
50 \move h1g3 h0g8
51 \move b1c3 i0h0
52 \move i1h1 h0h6
53 \move h3h5 b0a8
54 \move c4c5 b8c8
55 \move c1e3 c7c6
56 \move c3b5 c6c5
57 \move e3c5 h6c6
58 \move c5e3 g7g6
59 \move b5a7 c6c3
60 \move b3b6 c3c7
61 \move h5h7 e7e6
62 \cr !
63 %shows the comment you input here after the next red move
64 \move b6g6 xxxx
65 %shows a move only of red, actually, only the first letter of the side, that does not move, has to be a "x", but it have to be 4 letters
66
67 \newpage
68
69 \showboard
70 %shows the board in a size fitted to twocolumn on a4paper according to my personal preference, the position shown should be the one the moves input are leading to
71 \texttt{The board is shown with a single command. The style finds the correct position depending on the moves you input.}
72 \bigskip
73 \cb ?
74 %the same for next black move
75 \move xxxx c7a7
76 %move only of black
77 Black wins a major piece, but more important is that Red gets a strong attack on the right wing of the board.
78 \cr +
79 \move g6g0 f0e9
80 \cr +
81 \move h7h0 xxxx
82
83 It is not better for Red to play \bv 16.Ci0, for after 16|Kf0 17.Chh0+ Kf9 18.Rh9+ Kf8 19.Rg9 Hh6 20.Rg6 \ev Red gets back the major piece only\dots %between \bv and \ev "|" produces \ldots, "*" produces \times (the capturing symbol), if you need these to be output, use \makevisible*\makeactive
84
85 \move xxxx g8h0
86 \move h1h0 a0a9
87 \cr +
88 \move g0d0 e9f0
89 \move d0f0 a9f9
90 \cr +
91 \move f0c0 xxxx
92 but in the game Red takes the whole defense of Black\dots
93 \move xxxx e0e9
94 \move a1b1 a7f7
95 \cr +
96 \move b1b9 c8c9
97 \move c0a0 e8d8
98
99 \newpage
100
101 \showwesternboard
102
103 \texttt{You can also show the board with western pieces using \textbackslash{}showwesternboard.}
104 \bigskip
105
106 \move b9a9 d8d2
107 \move a0a8 xxxx
108 \dots and the major piece.
109 \move xxxx e9e8
110 \cr +
111 \move h0h8 f7f8
112 \move a9c9 xxxx
113 Black resigned the game.
114 \begin{center}
115 {\bf{\large{1\,:\,0}}}
116 \end{center}
117
118 \newpage
119 \newpage
120
121 \texttt{Now we start playing from a special position, that is input in the .tex file.}
122
123 \begin{center}
124 {\bf{\large{Exercise}}}
125 \end{center}
126 In the diagram shown below, both sides can checkmate the opponent, depending only on who is to move.
127
128 \resetboard
129 %makes the board to show an empty one, recommended before setting up a position
130
131 \piece Ec1
132 %by now positions have to be input piece by piece which is not so cool, sorry :-)
133 \piece Ke1
134 \piece Af1
135 \piece Rh1
136 \piece Ae2
137 \piece Ha3
138 \piece Ee3
139 \piece Pc4
140 \piece Pg4
141 \piece Pi4
142 \piece Pa5
143 \piece ce5
144 \piece Ci5
145 \piece pc6
146 \piece rd6
147 \piece pg6
148 \piece pa7
149 \piece pe7
150 \piece Cg7
151 \piece hc8
152 \piece ee8
153 \piece hg8
154 \piece ae9
155 \piece ec0
156 \piece ke0
157 \piece af0
158
159 \showboard
160
161 1.\,Red to move, checkmates in 3 moves\\
162 2.\,Black to move, checkmates in 4 moves\\
163
164 \textit{Solution}\\
165
166 1.\,Red to move
167 \movecount=0
168 \cr +
169 \move i5i0 g8h0
170 \cr +
171 \move g7g0 e8g0
172 \cr \#
173 \move i0g0 xxxx
174
175 \resetboard
176
177 \piece Ec1
178 \piece Ke1
179 \piece Af1
180 \piece Rh1
181 \piece Ae2
182 \piece Ha3
183 \piece Ee3
184 \piece Pc4
185 \piece Pg4
186 \piece Pi4
187 \piece Pa5
188 \piece ce5
189 \piece Ci5
190 \piece pc6
191 \piece rd6
192 \piece pg6
193 \piece pa7
194 \piece pe7
195 \piece Cg7
196 \piece hc8
197 \piece ee8
198 \piece hg8
199 \piece ae9
200 \piece ec0
201 \piece ke0
202 \piece af0
203
204 \bigskip
205 2.\,Black to move
206
207 \movecount=1
208 \move xxxx e0d0
209 \cr +
210 \move i5i0 d0d9
211 \cr +
212 \move i0i9 d9d8
213 \move i9i6 xxxx
214 \dots or any other move
215 \cb \#
216 \move xxxx d6d1
217
218 \newpage
219
220 \texttt{I added some additional signs to demonstrate legal moves of pieces.\\But for now this is not more than a first draft with only the four extra signs shown in the diagram.}
221
222 \resetboard
223
224 \piece Ke1
225 \addsign Ld1
226 \addsign Lf1
227 \addsign Le2
228
229 \piece ng8
230 \piece pg7
231 \addsign Uf6
232 \addsign Uh6
233 \addsign Li7
234 \addsign Li9
235 \addsign Lh0
236 \addsign Lf0
237 \addsign Le9
238 \addsign Le7
239
240 \addsign Ra1
241 \addsign Ba0
242
243 \showboard
244 %pieces in running text
245 \newpage
246
247 \texttt{Pieces in running text:}
248 \bigskip
249
250 \textpiece K \textpiece k
251 the kings
252
253 \vspace{2pt}
254
255 \textpiece A \textpiece a
256 the advisors/guards
257
258 \makebox[21pt][c]{\vdots}
259
260 \vspace{4pt}
261 \westerntextpiece H \westerntextpiece h
262 the knights/horses
263
264 \vspace{2pt}
265
266 \westerntextpiece P \westerntextpiece p
267 the pawns/soldiers
268 \vspace{2pt}
269
270 %finally a large board
271 \newpage
272 \onecolumn
273
274 \newgame
275 \texttt{I also included commands to show large boards: \textbackslash{}showlargeboard and \textbackslash{}showlargewesternboard.}
276 \showlargeboard
277 %shows a board in a size fitted to onecolumn on a4paper according to my personal preference. For western pieces input \showlargewesternboard
278
279 \texttt{That's all! Hopefully everything works like it should!}
280
281 \end{document}
282
283 %Stephan Weinhold 09.2006
284 %[email protected]