Debian Codegraph @

texmf-dist/tex/generic/tex4ht/diagram.4ht

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % diagram.4ht 2009-05-21-09:32 %
3 % Copyright (C) 2008--2009 Eitan M. Gurari %
4 % %
5 % This work may be distributed and/or modified under the %
6 % conditions of the LaTeX Project Public License, either %
7 % version 1.3c of this license or (at your option) any %
8 % later version. The latest version of this license is %
9 % in %
10 % http://www.latex-project.org/lppl.txt %
11 % and version 1.3c or later is part of all distributions %
12 % of LaTeX version 2005/12/01 or later. %
13 % %
14 % This work has the LPPL maintenance status "maintained".%
15 % %
16 % This Current Maintainer of this work %
17 % is Eitan M. Gurari. %
18 % %
19 % If you modify this program your changing its signature %
20 % with a directive of the following form will be %
21 % appreciated. %
22 % \message{signature} %
23 % %
24 % [email protected] %
25 % http://www.cse.ohio-state.edu/~gurari %
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 \immediate\write-1{version 2009-05-21-09:32}
28
29 \inner@frame = 0pt
30 \outer@frame = 0pt
31
32 \NewConfigure{diagram}{6}
33
34
35
36 \NewConfigure{stipulation}{4}
37
38 \NewConfigure{piececounter}{2}
39
40
41 \pend:def\@dia@authors{\ifauth@r \a:authors\fi}
42 \append:def\@dia@authors{\ifauth@r \b:authors \fi}
43 \NewConfigure{authors}{2}
44 \pend:def\@dia@condition{\if@condition \a:condition\fi}
45 \append:def\@dia@condition{\if@condition \b:condition \fi}
46 \NewConfigure{condition}{2}
47 \pend:def\@dia@solution{\a:solution}
48 \append:def\@dia@solution{\b:solution }
49 \NewConfigure{solution}{2}
50 \pend:def\@dia@award{\if@award\a:award\fi}
51 \append:def\@dia@award{\if@award\b:award\fi }
52 \NewConfigure{award}{2}
53 \pend:def\@dia@dedic{\if@dedication\a:dedic\fi}
54 \append:def\@dia@dedic{\if@dedication\b:dedic \fi}
55 \NewConfigure{dedic}{2}
56 \pend:def\@dia@number{\ifdi@no\a:number\fi}
57 \append:def\@dia@number{\ifdi@no\b:number\fi}
58 \NewConfigure{number}{2}
59
60 \pend:def\@dia@twins{\ifauth@r \a:twins\fi}
61 \append:def\@dia@twins{\ifauth@r \b:twins\fi}
62 \NewConfigure{twins}{2}
63 \pend:def\@dia@remark{\ifauth@r \a:remark\fi}
64 \append:def\@dia@remark{\ifauth@r \b:remark \fi}
65 \NewConfigure{remark}{2}
66
67 \pend:def\dia@above{\a:above}
68 \append:def\dia@above{\b:above }
69 \NewConfigure{above}{2}
70
71 \pend:def\dia@below{\a:below}
72 \append:def\dia@below{\b:below }
73 \NewConfigure{below}{2}
74
75 \pend:def\@dia@correction{\if@correction\a:correction\fi}
76 \append:def\@dia@correction{\if@correction\b:correction\fi }
77 \NewConfigure{correction}{2}
78 \def\putsol{\immediate\closeout\s@lfd\input\jobname.sol}%\cl@arsol}
79 \pend:def\putsol{\HAssign\solNum=0}
80 \def\showlabel#1{\if@develop\a:showlabel\hbox{\labelfont#1}\b:showlabel\fi}
81 \NewConfigure{showlabel}{2}
82
83 \def\@dia@solution{%
84 \bgroup%
85 \parindent\z@%
86 \csname a:sol-title\endcsname
87 {\bf
88 \noindent\if@label\showlabel{\the\label@tk}\fi
89 \csname a:sol-number\endcsname
90 \the\number@tk \csname b:sol-number\endcsname) %
91 \ifauth@r%
92 \csname a:sol-author\endcsname
93 \ifnormal@names%
94 \the\aut@tk%
95 \else%
96 {\@notfirstfalse% We are the first one
97 \let\@action=\@solname%
98 \@parseTokenlist\aut@tk;}:%
99 \fi%
100 \csname b:sol-author\endcsname
101 \fi%
102 }%
103 \if@develop\if@judgement\a:judgement\the\judgement@tk\b:judgement\fi\fi%
104 \csname b:sol-title\endcsname
105 \par%
106 \the\sol@tk\par%
107 \if@comment\the\comment@tk\par\fi%
108 \egroup%
109 }
110 \NewConfigure{judgement}{2}
111 \NewConfigure{sol-number}{2}
112 \NewConfigure{sol-author}{2}
113 \NewConfigure{sol-title}{2}
114 \def\@dia@source{%
115 {\if@source%
116 \a:source
117 \sourcefont%
118 \if@sourcenr\the\sourcenr@tk\ \fi
119 \the\source@tk%
120 \a:date
121 \ifnum\from@month>\z@%
122 \if@day%
123 \ \ \the\day@tk .\write@month\from@month%
124 \else%
125 \ \ \write@month\from@month%
126 \fi%
127 \ifnum\to@month>\z@ -\write@month\to@month\fi%
128 \if@day .\else /\fi%
129 \else%
130 \ \ %
131 \fi%
132 \if@year\the\year@tk\fi%
133 \b:date
134 \if@issue /\a:issue\the\issue@tk\b:issue\fi%
135 \if@pages ,\ \a:pages\the\pages@tk\b:pages\fi%
136 \par%
137 \b:source
138 \fi}%
139 }
140 \NewConfigure{source}{2}
141 \NewConfigure{source}{2}
142 \NewConfigure{date}{2}
143 \NewConfigure{issue}{2}
144 \NewConfigure{pages}{2}
145
146 \let\:EndIgnore\relax
147 \def\:Ignore{\bgroup
148 \catcode`\\=12
149 \long\def\:temp##1:EndIgnore{\egroup}\:temp
150 }
151 \ifx \setboardwidth\:UnDef \expandafter\:Ignore\fi
152 \def\@dia@stipulation{%
153 \if@stipulation%
154 \a:stipulation
155 \bgroup%
156 \stipfont%
157 \c:stipulation \the\stipulation@tk \d:stipulation
158 \ifx@twins%
159 \let\below@newline\@twinskip%
160 \@dia@twins%
161 \else\ifx@cond%
162 \let\below@newline\@twinskip%
163 \@dia@condition%
164 \fi\fi%
165 \egroup%
166 \b:stipulation
167 \let\below@newline\newline%
168 \else%
169 \x@twinsfalse%
170 \x@condfalse%
171 \let\below@newline\relax%
172 \fi%
173 }
174 \def\put@count{%
175 % First we build the box with the figure count
176 \ifthenelse{\boolean{piececounter}}{%
177 \a:piececounter
178 \if@show@computer%
179 C\if@computer +\else --\fi
180 \ \
181 \fi%
182 (\arabic{cpd@whitePieces}+\arabic{cpd@blackPieces}%
183 \ifthenelse{\value{cpd@neutralPieces}>0}{+\arabic{cpd@neutralPieces}}{})%
184 \b:piececounter
185 }{}%
186 }
187 \def\put@plane{%
188 % We might want gridchess
189 \if@stdgrid%
190 \@stdgrid%
191 \fi%
192 % Let us first set the fieldframes
193 \if@fieldframe%
194 \let\@action\read@square%
195 \let\plane@job\set@frame%
196 \@addToPlane\fieldframe@tk%
197 \fi%
198 % Now we set text to all squares which are given using \fieldtext
199 \if@fieldtext%
200 \let\@action\p@rsetext%
201 \let\plane@job\set@text%
202 \@addToPlane\fieldtext@tk%
203 \fi%
204 % Then we should add the gridlines
205 \if@gridlines%
206 \let\@action\read@plane%
207 \let\plane@job\@selGrid%
208 \@addToPlane\gridlines@tk%
209 \else%
210 \if@stereo%
211 \stereo@center%
212 \fi%
213 \fi%
214 % Now we should clear the board
215 \clear@board%
216 % Let us now parse the list of pieces
217 \if@pieces%
218 \let\@action\p@rsepieces%
219 \let\piece@job\l@@k\let\plane@job\set@piece%
220 \@parseTokenlist\pieces@tk,%
221 \fi%
222 % Now we clear all fields, which are given using \nofields
223 \if@nofields%
224 \let\@action\read@square%
225 \let\plane@job\set@nofield%
226 \@parseTokenlist\nofields@tk,%
227 \fi%
228 % Now we can put the pieces to the board
229 \global\setbox\plane@box=\hbox{%
230 \vbox{\rlap{\box\plane@box}}%
231 \vbox{%
232 \a:diagram
233 \chessfont%
234 \baselineskip=\z@\lineskip=\z@%
235 \@rows=\rows@max%
236 % \multiply\@rows by \lines@max%
237 \loop%
238 % \advance\@rows -\lines@max%
239 % \put@line\@rows%
240 % Remove \put@line in future versions
241 \advance\@rows \m@ne%
242 \tmp:cnt=\@rows \advance\tmp:cnt by 1
243 \edef\HRow{\the\tmp:cnt}%
244 \c:diagram \put@row\@rows \d:diagram
245 \ifnum\@rows>\z@\repeat%
246 \b:diagram
247 }%
248 }%
249 }
250 \def\put@row#1{%
251 \lin@\z@%
252 \help@b=#1%
253 \advance\help@b\brd@ff%
254 \hbox{%
255 \if@stereo%
256 \ifnum\current@plane>\z@%
257 \ifnum\@rows=12%
258 \llap{\raise .5\sq@width\hbox{\boardfont c6\ }}%
259 \fi%
260 \fi%
261 \fi%
262 \hbox to \z@{\vbox to \sq@width{}}%
263 \set@current@square@index{\lin@}{#1}%
264 \loop%
265 \tmp:cnt=\lin@ \advance\tmp:cnt by 1\relax
266 \edef\HCol{\the\tmp:cnt}%
267 \e:diagram
268 \get@current@square@value%
269 \ifthenelse{\value{cpd@current@square@value}=\m@ne}%
270 {\wF}%
271 {\char\value{cpd@current@square@value}}%
272 % \ifnum\count\help@b=\m@ne\wF%
273 % \else\char\count\help@b\fi%
274 \advance\lin@\@ne%
275 \addtocounter{cpd@current@square@index}{1}%
276 % \advance\help@b\@ne%
277 \f:diagram
278 \ifnum\lin@<\lines@max\repeat%
279 }%
280 }
281
282 \:EndIgnore
283 \ifx \setboardwidth\:UnDef \else \expandafter\:Ignore\fi
284 \def\@dia@stipulation{%
285 \a:stipulation
286 \bgroup%
287 \stipfont%
288 \hbox{%
289 \a:piececounter
290 \if@show@computer%
291 C\if@computer +\else --\fi
292 \fi%
293 \iffigcnt%
294 \if@show@computer\ \ \fi{} (\the\w@cnt+\the\b@cnt
295 \ifnum\z@<\n@cnt+\the\n@cnt\fi)%
296 \fi%
297 \b:piececounter
298 \if@stipulation \c:stipulation\the
299 \stipulation@tk \d:stipulation\fi
300 \ifx@twins \@dia@twins\fi%
301 \ifx@cond \@dia@condition\fi%
302 }%
303 \egroup%
304 \b:stipulation
305 }
306 \def\put@plane{%
307 % We might want gridchess
308 \if@stdgrid%
309 \@stdgrid%
310 \fi%
311 % Let us first set the fieldframes
312 \if@fieldframe%
313 \let\@action\read@square%
314 \let\plane@job\set@frame%
315 \@addToPlane\fieldframe@tk%
316 \fi%
317 % Then we should add the gridlines
318 \if@gridlines%
319 \let\@action\read@plane%
320 \let\plane@job\@selGrid%
321 \@addToPlane\gridlines@tk%
322 \else%
323 \if@stereo%
324 \stereo@center%
325 \fi%
326 \fi%
327 % Now we should clear the board
328 \clear@board%
329 % Let us now parse the list of pieces
330 \if@pieces%
331 \let\@action\p@rsepieces%
332 \let\piece@job\l@@k\let\plane@job\set@piece%
333 \@parseTokenlist\pieces@tk,%
334 \fi%
335 % Now we clear all fields, which are given using \nofields
336 \if@nofields%
337 \let\@action\read@square%
338 \let\plane@job\set@nofield%
339 \@parseTokenlist\nofields@tk,%
340 \fi%
341 \global\setbox\plane@box=\hbox{
342 % Now we can put the pieces to the board
343 \vbox{\IgnorePar\box\plane@box}%
344 \vbox{%
345 \a:diagram
346 \chessfont%
347 \baselineskip=\z@\lineskip=\z@%
348 \@rows=\rows@max%
349 \multiply\@rows by \lines@max%
350 \loop%
351 \advance\@rows -\lines@max%
352 \tmp:cnt=\@rows \divide\tmp:cnt by 8 \advance\tmp:cnt by 1
353 \edef\HRow{\the\tmp:cnt}%
354 \c:diagram \put@line\@rows \d:diagram
355 \ifnum\@rows>\z@\repeat%
356 \b:diagram
357 }%
358 }%
359 }
360 \def\put@line#1{%
361 \lin@\z@%
362 \help@b=#1\advance\help@b\brd@ff%
363 \hbox{%
364 \if@stereo%
365 \ifnum\current@plane>\z@%
366 \ifnum\@rows=12%
367 \llap{\raise .5\sq@width\hbox{\boardfont c6\ }}%
368 \fi%
369 \fi%
370 \fi%
371 \hbox to \z@{\vbox to \sq@width{}}%
372 \loop%
373 \tmp:cnt=\lin@ \advance\tmp:cnt by 1\relax
374 \edef\HCol{\the\tmp:cnt}%
375 \e:diagram
376 \ifnum\count\help@b=\m@ne\wF%
377 \else \char\count\help@b\fi%
378 \advance\lin@\@ne\advance\help@b\@ne%
379 \f:diagram
380 \ifnum\lin@<\lines@max\repeat%
381 }%
382 }
383
384 \:EndIgnore
385 \Hinput{diagram}
386 \endinput
387