Debian Codegraph @

texmf-dist/source/latex/crosswrd/crosswrd.dtx

raw
1 % \iffalse meta-comment
2 %% crosswrd.dtx
3 %% Copyright 1989 Brian Hamilton Kelly
4 %% updated for LaTeX2e by Frank Mittelbach 96/12/06
5 %% Updated for LPPL 1.3c or later by Clea F. Rees (for Frank Mittelbach), 2008/10/06.
6 %%
7 %% Upgraded with many new features by Dirk Laurie 2010/02/01
8 %
9 % This work may be distributed and/or modified under the
10 % conditions of the LaTeX Project Public License, either version 1.3
11 % of this license or (at your option) any later version.
12 % The latest version of this license is in
13 % http://www.latex-project.org/lppl.txt
14 % and version 1.3 or later is part of all distributions of LaTeX
15 % version 2005/12/01 or later.
16 %
17 % This work has the LPPL maintenance status `unmaintained'.
18 %
19 % This work consists of the files crosswrd.dtx, crosswrd.ins and README
20 % and the derived files crosswrd.sty, test0.tex, test1.tex, grid0.tex and grid1.tex.
21 % \fi
22 % \iffalse
23 %<*dtx>
24 \ProvidesFile{crosswrd.dtx}
25 %</dtx>
26 %<+package>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
27 %<+package>\RequirePackage{ifthen}
28 %<+package>\ProvidesPackage{crosswrd}
29 %<*dtx,package>
30 % \fi
31 % \ProvidesFile{crosswrd.dtx}
32 [2010/02/01 v3.0 Generating crosswords (BHK,DPL)]
33 %
34 % \iffalse
35 %</dtx,package>
36 %<*driver>
37 \documentclass{ltxdoc}
38 \usepackage{crosswrd}
39 \begin{document}
40 \GetFileInfo{crosswrd.dtx}
41 \DocInput{crosswrd.dtx}
42 \end{document}
43 %</driver>
44 % \fi
45 %
46 % \CheckSum{813}
47 %
48 % \let\ifBigTeX=\iftrue ^^A Change this in the obvious fashion if an
49 % ^^A enlarged (>75k maxmem) version of TeX is available
50 % \changes{v2.7}{89/10/16}{Conditional compilation for variant
51 % \protect\TeX's}
52 %
53 % \DoNotIndex{\@input,\@ixpt,\@listi,\@ne,\@setsize,\@starttoc,\@writefile}
54 % \DoNotIndex{\abovedisplayshortskip,\abovedisplayskip,\advance}
55 % \DoNotIndex{\afterassignment,\begin,\belowdisplayshortskip}
56 % \DoNotIndex{\belowdisplayskip,\bf,\bgroup,\centerline,\closeout,\csname}
57 % \DoNotIndex{\def,\edef,\egroup,\else,\end,\endcsname,\endgraf,\endlist}
58 % \DoNotIndex{\errhelp,\errmessage,\expandafter,\fi,\filedate,\fileversion}
59 % \DoNotIndex{\hbox,\hspace,\hss,\if,\iffalse,\ifnum,\ifx,\ignorespaces}
60 % \DoNotIndex{\immediate,\input,\item,\itemsep,\ixpt,\jobname,\labelsep}
61 % \DoNotIndex{\labelwidth,\leavevmode,\leftmargin,\let,\line,\list,\loop}
62 % \DoNotIndex{\lowercase,\m@ne,\makebox,\makelabel,\meaning,\newcount}
63 % \DoNotIndex{\next,\noexpand,\openout,\parsep,\put}
64 % \DoNotIndex{\relax,\repeat,\rm,\romannumeral,\rule,\sloppy,\space,\string}
65 % \DoNotIndex{\strut,\tensf,\the,\tiny,\topsep,\typein,\typeout,\unitlength}
66 % \DoNotIndex{\uppercase,\vtop,\z@}
67 %
68 % \changes{v2.1}{89/04/27}{Total revision of documentation part}
69 % \changes{v2.3}{89/05/17}{Used raw \protect\TeX\protect\space counters}
70 % \changes{v2.5}{89/09/01}{Final revisions for publication}
71 % \changes{v2.6}{89/10/13}{Consistent indentation of {\tt\protect\bslash
72 % def}s}
73 % \changes{v2.9}{07/12/19}{Variable dimensions and type sizes, does barred
74 % grids, does rectangular grids, tests label compatibility, complete
75 % rewrite of grid population code}
76 % \changes{v3.0}{10/02/01}{LPPL copyright notice included}
77 %
78 % \title{Some Macros to Draw Crosswords\thanks{This file is \fileversion,
79 % dated \filedate}}
80 % \author{B Hamilton Kelly\thanks{Especial thanks to my colleague Niel
81 % Kempson for many helpful suggestions, and to Frank Mittelbach of the
82 % Johannes Gutenberg University of Mainz, who saved me two pages of code!}
83 % \\ Extensions by Dirk Laurie}
84 % \maketitle
85 % \begin{abstract}
86 % The {\sf crossword} environment is intended to be used to typeset
87 % crossword puzzles for use in newsletters, etc.
88 % \end{abstract}
89 %
90 % \vspace*{3pt}\hrule
91 %
92 %
93 % \tableofcontents
94 %
95 % \addtocontents{toc}{\protect\begin{multicols}{2}}
96 %
97 % \listoffigures
98 %
99 % \ifBigTeX
100 % \else
101 % \addtocontents{lof}{\protect\begin{multicols}{2}}
102 % \fi
103 %
104 % \[ \vbox{\hrule width 4cm} \]
105 %
106 % \begin{multicols}{2}[\section{Introduction}]
107 %
108 % As a small diversion from the statistics of computer availability, lists
109 % of new software, and the like, Computer Centre Newsletters often include a
110 % crossword for the amusement of their readers.\footnote{That at RMCS has a
111 % bottle of wine as a prize!}
112 %
113 % The macros presented in this document provide a \LaTeX{} method of
114 % typesetting these, and also assist the composer to ensure that the
115 % ``grid'' all goes together correctly. That is to say, checks
116 % are made that crossing lights have the same letter where they cross,
117 % lights starting at the same square have the same clue number,
118 % and clue numbers are in sequence from 1 upwards when reading
119 % from top left to bottom right.
120
121 % The grid generated can be the more
122 % usual form, with black squares separating the ``lights'' which receive the
123 % answers to the clues, or the {\sl Mephisto/Azed\/} type of grid,
124 % in which only thicker grid lines separate the lights, or even
125 % a mixture of these. The user need not specify which type of grid
126 % is to be used, since they are both described by the same simple rule:
127 % a bar is drawn between every pair of adjacent
128 % light squares that do not belong to the same light.
129 %
130 % A sample crossword appears as Figure~\ref{crossword:1}; I've left the
131 % grid blank for those who want some intellectual exercise: those who don't
132 % can cheat by reading the source listing at the end of this
133 % article!
134 %
135 %
136 % \DescribeEnv{crossword}
137 % The whole crossword, including the \verb+\clue+ commands ({\it q.v}.),
138 % is bracketed within the {\sf crossword} environment. The user may
139 % specify one optional and must specify two required parameters:
140 % \begin{description}
141 % \item[\meta{gridrows}] The number of rows
142 % in the rectangular grid. If supplied, it must be enclosed in
143 % square brackets. It may be omitted if the number of rows
144 % equals the number of columns.
145 % \item[\meta{gridcols}] The number of columns
146 % in the rectangular grid.
147 % \item[\meta{visible}] This controls whether the answers are to be
148 % ``filled in''; obviously of no use for publication, but useful whilst
149 % composing the crossword. If the parameter provided is the letter `{\tt
150 % Y}', then the answers will be typeset; if `{\tt N}' then the lights
151 % will be left blank. Any other value\footnote{The lower-case letters
152 % `{\tt y}' and `{\tt n}' are also recognized} provided for this
153 % parameter will cause \LaTeX{} to input a yes/no answer by interaction
154 % with the user.
155 % \end{description}
156 %
157 % \DescribeEnv{crossword*}
158 % An analogous environment is provided especially for typesetting a smaller
159 % version of a grid showing, for example, ``Last Month's Solution''. In
160 % this of course, the answers {\em always\/} appear, and the clues are not
161 % printed. Again it takes three parameters, the first optional:
162 % \begin{description}
163 % \item[\meta{gridrows, gridcols}] As before, these specify the number
164 % of squares in the two axes.
165 % \item[\meta{header\_text}] Some text which will be set (in {\bf bold})
166 % above the completed grid.
167 % \end{description}
168 % \ifBigTeX
169 % \changes{v2.5a}{89/09/08}{Put the {\protect\sf crossword*} in-line}
170 % \changes{v2.7}{89/10/16}{Conditional compilation for variant
171 % \protect\TeX's}
172 % Here is an example of the {\sf crossword*}
173 % environment:
174 % {\centering
175 % \begin{crossword*}{15}{Last month's solution}
176 % \MakePercentComment \input{grid0} \MakePercentIgnore
177 % \end{crossword*}}
178 % \else
179 % Figure~\ref{crossword:2} shows an example of the {\sf crossword*}
180 % environment.
181 % \fi
182 %
183 % \DescribeMacro\clue
184 % Within the body of these environments appear a succession of \verb+\clue+
185 % commands; each of these takes a total of seven (!) parameters:
186 % \begin{description}
187 % \item[\meta{clue\_number}] The number of the light on the grid, for
188 % example \verb+{17}+. See~\ref{clue-numbers} below for details of how
189 % more complex specifications may be given for multiple lights.
190 % \item[\meta{Across/Down}] This parameter {\em must\/} be either the
191 % letter `{\tt A}' or `{\tt D}', in upper-case.
192 % \item[\meta{col\_number}] The $x$-coordinate of the first square of the
193 % light. The left-most column of the grid is numbered 1.
194 % \item[\meta{row\_number}] The $y$-coordinate of the first square of the
195 % light. The top-most row is numbered 1.
196 % \item[\meta{answer}] The answer to the clue (or that part of it which
197 % appears in the light numbered \meta{clue\_number}). Traditionally
198 % in a completed grid, this is a
199 % string of upper-case letters, but spaces in between are silently ignored,
200 % lower case letters are equally OK, and some other characters such as
201 % question mark and fullstop are useful as placeholders in an
202 % uncompleted grid. No hyphens or apostrophes, though.
203 % \item[\meta{text}] The text of the clue itself. If you want to use any
204 % \LaTeX{} macros in this text, such as \verb+\dots+, each such macro must
205 % be preceded by \verb+\noexpand+. This includes such macros as \verb+\&+,
206 % to produce an explicit ampersand.
207 % \item[\meta{help}] Anything to appear after the text, in parentheses;
208 % this will most usually be used for giving the length of the answer, such
209 % as ``7'' or ``2,6,3-3''. Also used when the text of the clue is
210 % associated with another light when this parameter may say something like
211 % ``see 14d''. If this parameter is left \emph{absolutely empty},
212 % not merely blank, i.e.\ \verb+{}+, the clue (if any)
213 % will not be printed at all.
214 % \end{description}
215 %
216 % \subsection{Customizing the layout}
217 % Some definitions made when entering the {\sf crossword} environment
218 % may be overridden by the user inside the environment.
219 % \begin{verbatim}
220 % \unitlength 6mm
221 % \def\Preamble{}
222 % \def\cluewidth{70mm}
223 % \let\numbersize\tiny
224 % \let\cluesize\ninept
225 % \def\barwidth{0.1}
226 % \end{verbatim}
227 % These refer respectively to size of grid cells, text to be set between
228 % the diagram and the clues,
229 % width of clue columns, typesize of numbers in grid, type size of
230 % clues, and width of bars in \verb+\unitlength+s.
231 %
232 % If you override
233 % \verb+\cluesize+ by a \LaTeX\ size command
234 % like \verb+\normalsize+, you will probably feel that there is too much
235 % vertical space between the clues. The only good solution is to
236 % write your own macro by adapting the definition of \verb+\ninept+
237 % given below.
238 %
239
240 % \subsection{How to Specify Clue Numbers}\label{clue-numbers}
241 %
242 % Sometimes the solution to one clue is split amongst a number of
243 % lights. To cover this eventuality, provide a \verb+\clue+ for {\em
244 % each\/} of the lights involved, with the solution to that light {\em
245 % alone\/} given as \meta{answer}. All except the \verb+\clue+
246 % corresponding to the first light of the solution should have a null
247 % \meta{text}, and the \meta{help} parameter might be something like
248 % ``see 7d''.
249 %
250 % \changes{v2.4}{89/08/15}{Support for empty help field}
251 % If you wish to omit any further reference
252 % to the clue number (the usual practice when the current clue
253 % applies to consecutive lights, or in hard cryptics),
254 % leave the \meta{help} field totally empty.
255 %
256 % The \verb+\clue+ for the first light of the solution
257 % should provide the {\em entire\/} clue as its \meta{text}, and the
258 % \meta{help} might say something like ``7,3-3''. The \meta{clue\_number}
259 % field should consist of the number of that light, followed immediately
260 % by the text required to describe the other lights, separated from it by
261 % some non-digit character, for example, a space.
262 %
263 %
264 % \end{multicols}
265 %
266 % \begin{figure*}[tp]
267 % \begin{crossword}{15}{N}
268 % \MakePercentComment \input{grid1} \MakePercentIgnore
269 % \end{crossword}
270 % \caption{A Sample Crossword}\label{crossword:1}
271 % \end{figure*}
272 %
273 % For example, suppose the clue ``Bill's desired outcome?'', has the
274 % solution `ACT OF PARLIAMENT' which is to go into lights 9d and 13a.
275 % Then\footnote{note the {\tt\string\noexpand} before the {\tt\string\rm}
276 % for the {\tt\string\&}}
277 % \begin{verbatim}
278 % \clue{13}{A}{5}{1}{PARLIAMENT}{}{see 9d}
279 % \clue{9 {\noexpand\rm\&} 13a}{D}{1}{10}{ACT OF}%
280 % {Bill's desired outcome?}{3,2,10}
281 % \end{verbatim}
282 % will produce\begin{description}
283 % \item[13] (see 9d)
284 % \end{description} amongst the ACROSS clues, and\begin{description}
285 % \item[9 {\rm\&} 13a] Bill's desired outcome? (3,2,10)
286 % \end{description} amongst the DOWN % clues
287 %
288 % \ifBigTeX
289 % \else
290 % \begin{figure}[hbtp]
291 % \begin{crossword*}{15}{Last month's solution}
292 % \input{grid-0}
293 % \end{crossword*}
294 % \caption{An example of the {\sf crossword*}
295 % environment}\label{crossword:2}
296 % \end{figure}
297 % \fi
298 %
299
300 % \StopEventually{\PrintIndex
301 % \PrintChanges
302 % \ifBigTeX
303 % \else
304 % \addtocontents{lof}{\protect\end{multicols}}%
305 % \fi
306 % \addtocontents{toc}{\protect\end{multicols}}}
307 %
308 % \section{Definition of the Macros}
309 %
310 %
311 % \begin{macro}{\ninept}
312 % \begin{macro}{\@listi}
313 % We define a new 9pt font size for setting clues.
314 % This command also defines suitable
315 % parameters for list environments set in this size of type.
316 %
317 % \begin{macrocode}
318 %<*package>
319 \def\ninept{\@setsize\ninept{11pt}\ixpt\@ixpt
320 \abovedisplayskip 8.5pt plus 3pt minus 4pt
321 \belowdisplayskip \abovedisplayskip
322 \abovedisplayshortskip \z@ plus2pt
323 \belowdisplayshortskip 4pt plus2pt minus 2pt
324 \def\@listi{\itemsep 0pt
325 \parsep \z@ plus 1pt
326 \topsep 4pt plus 2pt minus 2pt
327 }}
328 % \end{macrocode}
329 % \end{macro}
330 % \end{macro}
331 %
332 % \subsection{Counters and Lengths}
333 % \begin{macro}{\ifnumberit}
334 % \begin{macro}{\numberittrue}
335 % \begin{macro}{\numberitfalse}
336 %
337 % The {\sf crossword} environment draws a grid (with black and white
338 % squares); each light into which a clue's answer is to be written has
339 % to be numbered, and this number will be typeset (using \verb+\tiny+) in
340 % the top-left corner of the first square of the light.
341 %
342 % This style option also provides the {\sf crossword*} environment, which
343 % is intended to be used to produce ``last month's solution'' in a smaller
344 % grid. There is insufficient room for clue numbers to appear on the grid
345 % in this mode, so \verb+\ifnumberit+ is used to indicate whether the
346 % numbers should be set.
347 %
348 % \begin{macrocode}
349 \newif\ifnumberit
350 % \end{macrocode}
351 % \end{macro}
352 % \end{macro}
353 % \end{macro}
354 %
355 % \begin{macro}{\gridr@ws}
356 % \begin{macro}{\gridc@ls}
357 % \changes{v2.3}{89/05/17}{Use a raw \protect\TeX\protect\space counter}
358 % \begin{macro}{\p@rsize}
359 % \begin{macro}{\p@csize}
360 % \changes{v2.3}{89/05/17}{Use a raw \protect\TeX\protect\space counter}
361 % \changes{v2.9}{07/12/05}{Define more counters to allow rectangular grids.}
362 % The counters \verb+\gridr@ws+, \verb+\gridc@ls+, are used to hold the
363 % width of the grid, as the number of squares in each direction.
364 %
365 % To prevent too much run-time arithmetic, the counters \verb+\p@rsize+,
366 % \verb+\p@csize+ are set to be one count higher than \verb+\gridc@ls+,
367 % \verb+\gridr@ws+.
368 % \begin{macrocode}
369 \newcount{\gridr@ws}\newcount{\gridc@ls}
370 \newcount{\p@rsize}\newcount{\p@csize}
371 % \end{macrocode}
372 % \end{macro}
373 % \end{macro}
374 % \end{macro}
375 % \end{macro}
376 %
377 % \begin{macro}{\Down}
378 % \changes{v2.3}{89/05/17}{Use a raw \protect\TeX\protect\space counter}
379 % \begin{macro}{\Across}
380 % \changes{v2.3}{89/05/17}{Use a raw \protect\TeX\protect\space counter}
381 % As we move around the grid, determining whether squares are black or
382 % white, we utilize the counters \verb+\Across+ and \verb+\Down+ to keep track
383 % of our location.
384 %
385 % \begin{macrocode}
386 \newcount{\Down}
387 \newcount{\Across}
388 % \end{macrocode}
389 % \end{macro}
390 % \end{macro}
391 %
392 % \subsection{Reading and Writing the Clues}
393 %
394 % \begin{macro}{\tf@acr}
395 % \begin{macro}{\tf@dwn}
396 % \begin{macro}{\OpenClueFiles}
397 % \changes{v2.1}{89/04/27}{Now uses {\tt\protect\bslash @starttoc}}
398 % \changes{v2.1}{89/04/27}{and {\tt\protect\bslash @writefile}}
399 % Whilst we are determining the appearance of the grid, we copy the text of
400 % each of the clues to an auxiliary file, so that the latter may later be
401 % read back to generate the clues themselves after the grid has been
402 % printed.
403 %
404 % This macro opens a new file, with file extension \verb+.acr+, and puts
405 % into it the commands necessary to typeset the Across clues. It also
406 % opens a \verb+.dwn+ file, which is similarly filled with the Down clues.
407 %
408 % Next paragraph is no longer true. I changed the coding to allow more than
409 % 6 crosswords to be used in one document. Using the approach outlined below
410 % the system would run out of write channels pretty soon. (FMi)
411 %
412 % [ These files are created in the same manner as table-of-contents
413 % ({\tt.toc}) files, etc; thus \LaTeX{} will create file ``handles'' with
414 % names \verb+\tf@acr+ and \verb+\tf@dwn+. However, that would ordinarily
415 % attempt to {\em read\/} the given file first, and also might defer the
416 % actual opening; therefore, we start a new group in which we redefine
417 % \LaTeX's \verb+@input+ command and \TeX's \verb+\openout+ primitive. ]
418 %
419 % \changes{v2.8b}{96/12/06}{Use two global write channels (FMi)}
420 % \begin{macrocode}
421 \newwrite\tf@acr
422 \newwrite\tf@dwn
423 \def\OpenClueFiles{%
424 \immediate\openout \tf@acr \jobname.acr\relax
425 \immediate\openout \tf@dwn \jobname.dwn\relax
426 % \end{macrocode}
427 % Here's the preliminary material that gets inserted into the {\tt.acr} file.
428 % \changes{v2.8a}{96/07/22}{Removed string from \cs{@writefile} arg (FMi)}
429 % \changes{v2.8a}{96/07/22}{Make clue column texts accessible (FMi)}
430 % \begin{macrocode}
431 \@writefile{acr}{\begin{minipage}[t]{\cluewidth}}%
432 \@writefile{acr}{ \centerline{\textbf{\ACROSStext}}}%
433 \@writefile{acr}{ \sloppy}%
434 \@writefile{acr}{ \cluesize}%
435 \@writefile{acr}{ \begin{ClueList}}%
436 % \end{macrocode}
437 % Whilst something similar goes into the {\tt.dwn} file.
438 % \begin{macrocode}
439 \@writefile{dwn}{\begin{minipage}[t]{\cluewidth}}%
440 \@writefile{dwn}{ \centerline{\textbf{\DOWNtext}}}%
441 \@writefile{dwn}{ \sloppy}%
442 \@writefile{dwn}{ \cluesize}%
443 \@writefile{dwn}{ \begin{ClueList}}}
444 % \end{macrocode}
445 % \end{macro}\end{macro}\end{macro}
446 %
447 % \begin{macro}{\ACROSStext}
448 % \changes{v2.8a}{96/07/22}{Make clue column texts accessible (FMi)}
449 % \begin{macro}{\DOWNtext}
450 % \changes{v2.8a}{96/07/22}{Make clue column texts accessible (FMi)}
451 % You may (e.g.\ if the crossword is not in English) prefer to change
452 % the column text headers.
453 % \begin{macrocode}
454 \newcommand\ACROSStext{ACROSS}
455 \newcommand\DOWNtext{DOWN}
456 % \end{macrocode}
457 % \end{macro}
458 % \end{macro}
459 %
460 % \begin{macro}{\CloseClueFiles}
461 % \changes{v2.1}{89/04/27}{Now uses {\tt\protect\bslash @writefile}}
462 % After the grid has been printed, we can close the ``clues'' files; these
463 % will later be read back in (by the \verb+\endcrossword+ command) to set
464 % the text of the clues below the grid.
465 %
466 % Before closing, we insert the material that completes the two {\sf
467 % ClueList} environments; firstly across\dots
468 % \changes{v2.8a}{96/07/22}{Removed string from \cs{@writefile} arg (FMi)}
469 % \begin{macrocode}
470 \def\CloseClueFiles{%
471 \@writefile{acr}{ \end{ClueList}}%
472 \@writefile{acr}{\end{minipage}}%
473 % \end{macrocode}
474 % Then for the down clues.
475 % \begin{macrocode}
476 \@writefile{dwn}{ \end{ClueList}}%
477 \@writefile{dwn}{\end{minipage}}%
478 % \end{macrocode}
479 % Now we can close those files, and make them ``invisible'' if someone
480 % tries to write to them.
481 % \begin{macrocode}
482 \immediate\closeout\tf@acr \let\tf@acr\relax
483 \immediate\closeout\tf@dwn \let\tf@dwn\relax
484 \endgraf
485 }
486 % \end{macrocode}
487 % \end{macro}
488 %
489 % \subsection{Tabulating the Clues}
490 % The auxiliary files contain the texts of the clues, each given as an
491 % \verb+\item+ for the {\sf ClueList} environment. This is similar to a
492 % {\sf description} list, except that overlong labels run on into the text
493 % rather than sticking out to the left.
494 %
495 % \begin{macro}{\ClueList}
496 % \begin{macro}{\ClueListLabel}
497 % This sets up the {\sf ClueList} environment, and defines the appearance of
498 % the label.
499 %
500 % \begin{macrocode}
501 \def\ClueListlabel#1{\hspace\labelsep {\bf #1}\hss}
502 \def\ClueList{\list{}{\labelwidth\leftmargin
503 \advance \labelwidth by -\labelsep
504 \let\makelabel\ClueListlabel}}
505 \let\endClueList\endlist
506 % \end{macrocode}
507 % \end{macro}
508 % \end{macro}
509 %
510 %
511 % \begin{macro}{\PrintClues}
512 % The following macro reads in the two files (of Across and Down clues),
513 % and sets them alongside each other, separated by a vertical rule. Clues
514 % are set in the style of the {\sf ClueList} environment.
515 %
516 % \begin{macrocode}
517 \def\PrintClues{%
518 \centerline{%
519 \begin{tabular}{ c | c }
520 \@input{\jobname.acr}
521 &
522 \@input{\jobname.dwn}
523 \end{tabular}
524 }\endgraf
525 }
526 % \end{macrocode}
527 % \end{macro}
528 %
529 % \section{Creating the Grid}
530 % The remaining commands are concerned with creating (and, optionally,
531 % populating) the crossword grid.
532 %
533 % \begin{macro}{crossword}
534 % \begin{macro}{\c@ls}
535 %
536 % The {\sf crossword} environment takes three parameters: {\em viz}.~the
537 % number of rows (optional, may be omitted if the grid is square) and
538 % columns of the matrix, and the indication of whether the grid is to include
539 % the answers. (If the latter is not Y or N, \LaTeX\ will request it
540 % interactively.) The macro \verb+\c@ls+ is a communication mechanism.
541 %
542 % \begin{macrocode}
543 \newenvironment{crossword}[3][\c@ls]{%
544 \def\c@ls{#2}
545 % \end{macrocode}
546 %
547 % \changes{v2.4}{89/08/15}{Group within \string\crossword\space environment}
548 % \changes{v2.6}{89/10/13}{Removed {\tt\protect\bslash iffalse} hack}
549 % We start off with a \verb+\vtop+ box and a group to hold everything
550 % within the environment, so as to ensure that user-entered text remains
551 % with the crossword.
552 % \changes{v2.9}{07/12/04}{Changed to environment syntax, with
553 % optional argument for rectangular grids}
554 %
555 % \begin{macrocode}
556 \endgraf\leavevmode
557 \vtop\bgroup
558 % \end{macrocode}
559 %
560 % \begin{macro}{\Header}
561 % \begin{macro}{\cluewidth}
562 % \begin{macro}{\numbersize}
563 % \begin{macro}{\cluesize}
564 % \begin{macro}{\barwidth}
565 % The {\sf crossword} environment uses the full-size grid, and has the
566 % lights numbered. Furthermore it doesn't have any heading to output (see
567 % the {\sf crossword*} environment).
568 % Some other macros are given so that the user can customize the layout.
569 %
570 % \begin{macrocode}
571 \unitlength 6mm\numberittrue
572 \def\Header{}%
573 \def\Preamble{}%
574 \def\cluewidth{70mm}
575 \let\numbersize\tiny
576 \let\cluesize\ninept
577 \def\barwidth{0.1}
578 % \end{macrocode}
579 % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
580 %
581 % We now open the auxiliary files into which the clues are written, and
582 % determine (interactively if necessary) whether the answers are to be
583 % written into the grid.
584 %
585 % \begin{macrocode}
586 \OpenClueFiles
587 \TestAnswers{#3}%
588 % \end{macrocode}
589 %
590 % Finally, we generate the necessary macros to describe the grid.
591 % For each square, there are three macros. For example, corresponding
592 % to the square in row 4 from the top, column 2 from the
593 % left, the macros are: \smallskip \\ \hspace{1cm}
594 % \begin{tabular}{ll}
595 % \verb+\LetterRivCii+ & Letter in the square; \texttt{!} is used for a black square.\\
596 % \verb+\NumberRivCii+ & Number in the square; 0 is used for a numberless square.\\
597 % \verb+\BarRivCii+ & Code defining bars around the square, defined below.
598 % \end{tabular} \smallskip \\
599 %
600 % \begin{macrocode}
601 \SetUpGrid{#1}{\c@ls}}
602 % \end{macrocode}
603 %
604 % When all the clues have been processed, we can invoke \verb+\FinishGrid+
605 % to draw the grid. The \verb+\FinishGrid+ and \verb+\PrintClues+ commands
606 % draw the grid and tabulate the clues, respectively. By enclosing them in
607 % a vertical mode list, we ensure that they remain stuck together on one
608 % page!
609 %
610 % The {\sf crossword} environment defines \verb+\Header+ to be empty, but
611 % the user may give it an explicit definition within the environment; if so,
612 % we'll print it just above the grid itself.
613 %
614 % \begin{macrocode}
615 {\endgraf
616 \centerline{\Header}%
617 \hbox{\FinishGrid}%
618 % \end{macrocode}
619 %
620 % We can now finish off the auxiliary files and then read them back in to
621 % set the text of the clues below the grid.
622 %
623 % \changes{v2.4}{89/08/15}{Group within \string\crossword\space environment}
624 % \changes{v2.6}{89/10/13}{Removed {\tt\protect\bslash iffalse} hack}
625 % Finally, we complete the group and the \verb+\vtop+ box.
626 %
627 % \begin{macrocode}
628 \ifthenelse {\equal{\Preamble}{}} {}
629 {\centerline{\parbox{\textwidth}{\Preamble}}\medskip}
630 \CloseClueFiles
631 \hbox{\PrintClues}%
632 \egroup
633 }
634 % \end{macrocode}
635 % \end{macro}\end{macro}
636 %
637 % \begin{macro}{crossword*}
638 % \changes{v2.1}{89/04/27}{No longer opens {\tt.acr} and {\tt.dwn} files}
639 % \changes{v2.6}{89/10/13}{Removed {\tt\protect\bslash iffalse} hack}
640 % \changes{v2.9}{07/12/04}{Changed to environment syntax, with
641 % optional argument for rectangular grids}
642 % The {\sf crossword*} environment doesn't need a second parameter to
643 % control printing of answers, because it {\bf always} populates the grid
644 % with the answers. Instead, its second parameter provides the text to
645 % appear above the printed grid. Its actions are as for the {\sf
646 % crossword} environment except that\begin{itemize}
647 % \item It assumes that there is descriptive text above the grid
648 % and allows room for it.
649 % \item It {\bf always} outputs the answers, without numbers.
650 % \item It draws them in a smaller box.
651 % \item It doesn't output the clues (it doesn't even open any
652 % auxiliary files!)
653 % \end{itemize}
654 %
655 % \begin{macrocode}
656 \newenvironment{crossword*}[3][\c@ls]{%
657 \def\c@ls{#2}
658 \unitlength 4mm\numberitfalse
659 \def\barwidth{0.1}
660 \endgraf\leavevmode
661 \vtop\bgroup
662 \def\Header{{\bf\strut #3}}%
663 \def\answer{Y}%
664 \let\tf@dwn=\relax \let\tf@acr=\relax
665 \SetUpGrid{#1}{#2}}
666 {\endgraf
667 \centerline{\Header}%
668 \hbox{\FinishGrid}%
669 \egroup
670 }
671 % \end{macrocode}
672 % \end{macro}
673 %
674 % \subsection{Macros for each square}
675 % \changes{v2.9}{07/12/19}{The part of the code dealing with grid details has
676 % been completely rewritten. (DPL)}
677 % \begin{macro}{\ind@x}
678 % \begin{macro}{\arr@yref}
679 % \begin{macro}{\value}
680 % \begin{macro}{\assign}
681 % \begin{macro}{\addto}
682 % Crosswords are inherently two-dimensional, and require matrices
683 % of related definitions. Since \TeX\ does not allow numbers in
684 % a name, each square has a unique text index using \texttt{R} and
685 % \texttt{C} followed by roman numerals. Each macro name consists
686 % of a prefix (the same for all squares) followed by the unique
687 % text index. The original version of this
688 % package had only one such macro for each square, with an empty prefix,
689 % but in this version we have three: \texttt{Letter}, \texttt{Number}
690 % and \texttt{Bar}.
691 %
692 % For readability of the code, the following macros provide bracket
693 % syntax, thereby avoiding the use of \verb+\csname+\ldots\verb+\endcsname+
694 % elsewhere.
695 % For example, \verb+\value Bar[2,5]+ gives \verb+\BarRiiCv+.
696 % A new definition \texttt{NEW} is assigned by \verb+\assign Bar[2,5]=NEW;+.
697 % If the contents of \verb+\BarRiiCv+ is a number, you can add 31
698 % to it using \verb"\addto Bar[2,5]+=31;". In both cases, the semicolon
699 % is essential.
700 % \begin{macrocode}
701 \def\ind@x#1#2{R\romannumeral #1C\romannumeral#2}
702 \def\arr@yref#1#2#3{\csname #1\ind@x{#2}{#3}\endcsname}
703 \def\value#1[#2,#3]{\arr@yref{#1}{#2}{#3}}
704 \def\assign#1[#2,#3]=#4;%
705 {\expandafter\edef\csname #1\ind@x{#2}{#3}\endcsname{#4}}
706 \newcount\accumulat@r
707 \def\addto#1[#2,#3]+=#4;%
708 {\accumulat@r=\value #1[#2,#3] \advance\accumulat@r by #4
709 \assign #1[#2,#3]=\the\accumulat@r;}
710 % \end{macrocode}
711 % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
712
713 % We do bars as follows: in addition to \verb+\RiCii+ etc which define the
714 % contents of a square, there is a bar code \verb+\BarRiCii+ etc with
715 % the following meaning:
716 % \begin{enumerate}
717 % \item[0:] no bar above or to the left of the square
718 % \item[1:] bar above the square
719 % \item[2:] bar to the left of the square
720 % \item[3:] bars above and to the left of the square
721 % \end{enumerate}
722 % At the start, all bar codes are set to 3;
723 % the bars between letters are erased as we go along.
724
725 % \subsection{Macros used while processing the clues}
726
727 % \begin{macro}{\lettercount}
728 % \begin{macro}{\Barcode}
729 % As we move along the letters of the answer, we count
730 % the number of letters processed in \verb+\lettercount+.
731 % The code for the bar to be erased (1 or 2) is put
732 % into \verb+Barcode+ before we start on each answer.
733 % \begin{macrocode}
734 \newcount\lettercount
735 \newcount\Barcode
736 % \end{macrocode}
737 % \end{macro}
738 % \end{macro}
739
740 % \begin{macro}{\nextletter}
741 % \begin{macro}{\nextlet}
742 % To determine how much space is required for the light corresponding to
743 % an answer, we need to cycle through each of the characters of the answer
744 % individually; this macro is called with two parameters --- the first
745 % indicates the current setting direction (and thus accesses one of the
746 % counters \verb+\Across+ or \verb+\Down+), whilst the second consists of
747 % the characters forming the answer followed by the string \verb+\@nil+.
748 % When it is called, this ``second'' parameter is {\em not\/} enclosed in
749 % braces, so only the first token in it is accessed. The macro calls
750 % itself recursively to process the remaining characters until the
751 % \verb+\@nil+ has been met.
752 %
753 % \changes{v2.1}{89/04/27}{Can now process {\em first\/} letter of light}
754 % \begin{macrocode}
755 \def\nextletter#1#2{%
756 % \end{macrocode}
757 %
758 % If the next token is \verb+\@nil+, we've finished; the \verb+\let+ ensures
759 % that its parameter will be discarded (through the \LaTeX{} internal
760 % command \verb+\@gobble+) and the recursion will then unravel.
761 %
762 % \changes{v2.1}{89/04/27}{Use \protect\LaTeX's {\tt\protect\bslash @gobble}
763 % command}
764 % \begin{macrocode}
765 \ifx#2\@nil \let\nextlet=\@gobble
766 % \end{macrocode}
767 %
768 % Otherwise, we have another letter of the \meta{answer} in {\tt\#2}, so we
769 % save the letter and check that it does not conflict with an earlier letter
770 % in the same square.
771 %
772 % \begin{macrocode}
773 \else \immediate\edef\Before{\value Letter[\Down,\Across]}
774 \assign Letter[\Down,\Across]=#2;
775 \immediate\edef\After{\value Letter[\Down,\Across]}
776 \if \Before ! \else \if \Before \After
777 \else \errhelp{You mistyped an answer, or miscounted the coordinates.}
778 \errmessage{Letter "\After" conflicts with earlier "\Before"
779 in row \the\Down, column \the\Across}
780 \fi \fi
781 % If the letter is not the first letter of its answer, we erase a bar.
782 \ifnum \lettercount>0 \addto Bar[\Down,\Across]+=-\Barcode; \fi
783 % Advance another position in the current direction.
784 \@gobble{#2} \advance#1 by \@ne \global\advance \lettercount by \@ne
785 % \end{macrocode}
786 %
787 % After we've processed this letter, we want to call this routine
788 % recursively to process the remaining letters (if any)\dots
789 %
790 % \changes{v2.1}{89/04/27}{Change to handle subsequent letters of light}
791 % \begin{macrocode}
792 \let\nextlet=\nextletter
793 \fi
794 % \end{macrocode}
795 %
796 % This is where we either exit from the recursion (and \verb+\@gobble+ the
797 % {\tt\#1} parameter) or call the macro recursively to process the next
798 % character; the direction has to be passed on as the first parameter for
799 % \verb+\nextletter+ or \verb+\@gobble+.
800 %
801 % \begin{macrocode}
802 \nextlet{#1}}
803 % \end{macrocode}
804 % \end{macro}
805 % \end{macro}
806 %
807
808
809 % \subsection{The {\tt\protect\bslash clue} Command}
810 %
811 % \begin{macro}{\clue}
812 %
813 % Well, here it is at last. We start off by extracting the parts (if any)
814 % which form the \meta{clue\_number} parameter. We will therefore have
815 % the purely numeric first portion of the \meta{clue\_number} in
816 % \verb+\cluenumber+.
817 %
818 % \begin{macrocode}
819 \def\clue#1#2#3#4#5#6#7{%
820 % \end{macrocode}
821 % The $x$ and $y$ coordinate counters are set from the \meta{column} and
822 % \meta{row} parameters.
823 %
824 % \begin{macrocode}
825 \Across=#3 \Down=#4
826 % \end{macrocode}
827 % The clue may be spread over more than one number, but the square
828 % takes only the first of these.
829 % \begin{macrocode}
830 \findnumber{#1}
831 % \end{macrocode}
832 % Save the clue number, checking that it was not previously defined
833 % to be something else.
834 % \begin{macrocode}
835 \immediate\edef\Before{\value Number[\Down,\Across]}
836 \assign Number[\Down,\Across]=\cluenumber;
837 \immediate\edef\After{\value Number[\Down,\Across]}
838 \ifnum \Before>0 \ifnum \After=\Before
839 \else \errhelp
840 {You probably made a mistake when typing in one of the clues.}
841 \errmessage{Number {\After} conflicts with earlier {\Before}
842 in row \the\Down, column \the\Across}
843 \fi \fi
844 % \end{macrocode}
845 %
846 % We now examine the second (\meta{Across/Down}) parameter of the
847 % \verb+\clue+ command to determine whether this is an Across or Down
848 % clue. The clue's \meta{text} and \meta{help} information is then
849 % written\footnote{The writes only take place if the output files exist,
850 % and the \meta{help} parameter is non-empty.} to the appropriate
851 % auxiliary file, and note taken of the direction in which the
852 % \meta{answer} should be set into the light of the grid.
853 %
854 % \changes{v2.4}{89/08/15}{Support for empty help field}
855 %
856 % Firstly we deal with writes to the {\tt.acr} file, if the
857 % \meta{Across/Down} parameter is the letter `{\tt A}'. In this case, the
858 % counter to be incremented is \verb+\Across+.
859 % \changes{v2.8a}{96/07/22}{Removed string from \cs{@writefile} arg (FMi)}
860 % \changes{v2.9}{07/12/19}{Change empty test to use \cs{ifthenelse}.
861 % Testing by \cs{if} is a bug. (DPL)}
862 % \begin{macrocode}
863 \ifx#2A
864 \global\Barcode=2
865 \ifthenelse{\equal{\@empty}{#7}}{}{
866 \ifx\tf@acr\relax\else
867 \@writefile{acr}{ \item[#1] #6 (#7)}%
868 \fi}
869 \let\Direction=\Across
870 \else
871 % \end{macrocode}
872 % If this parameter is the letter `{\tt D}', writes go to the {\tt.dwn}
873 % file, and the \verb+\Down+ counter is incremented.
874 % \begin{macrocode}
875 \ifx#2D
876 \global\Barcode=1
877 \ifthenelse{\equal{\@empty}{#7}}{}{
878 \ifx\tf@dwn\relax\else
879 \@writefile{dwn}{ \item[#1] #6 (#7)}%
880 \fi}
881 \let\Direction=\Down
882 \else
883 % \end{macrocode}
884 %
885 % If this \meta{Across/Down} parameter is not one of the two permitted
886 % characters, an error message is issued.
887 %
888 % \begin{macrocode}
889 \errhelp{The second parameter of the \string\clue\space
890 command must be `A' or `D'}
891 \errmessage{Illegal direction (#1) specification
892 for \string\clue.}
893 \fi
894 \fi
895 % \end{macrocode}
896 %
897 % Now we can call \verb+\nextletter+ which will cycle through all the
898 % letters of the \meta{answer} until meeting the token \verb+\@nil+.
899 % It will save the current letter and recursively call itself until no
900 % letters are left.
901 % Finally, we ensure that the newlines after \verb+\clue+ commands don't
902 % lead to unwanted spaces being typeset.
903 % \changes{v2.6}{89/10/13}{Minor revision of layout}
904 % \begin{macrocode}
905 \global\lettercount=0
906 \nextletter{\Direction}#5\@nil
907 \ignorespaces
908 }
909 % \end{macrocode}
910 % \end{macro}
911 %
912 % \subsubsection{Finding the clue number to be set in the light}
913 % \begin{macro}{\findnumber}
914 %
915 % We mentioned earlier that clues with solutions which occupy more than
916 % one light require a special format for specifying their
917 % \meta{clue\_number}. If this form is required, the number of the current
918 % light is given first, with the remaining text (as it is required to be
919 % set) following, separated from the first number by some non-digit
920 % character.
921 %
922 % The macro \verb+\findnumber+ is called with the entire
923 % \meta{clue\_number} parameter passed to \verb+\clue+ and sets
924 % \verb+\cluenumber+ to expand to the first or only number found in that
925 % parameter (which should then appear in the first square of the light).
926 %
927 % \begin{macro}{\clueNumber}
928 % Of course, we require a counter in which to attempt to assemble that number:
929 % \begin{macrocode}
930 \newcount\clueNumber
931 % \end{macrocode}
932 %
933 % \begin{macro}{\special@gobble}
934 % This macro is used by \verb+\findnumber+ to discard the unwanted portion
935 % (if any) of a \meta{clue\_number}, including the special termination
936 % token.
937 %
938 % \begin{macrocode}
939 \def\special@gobble #1\@nil{}
940 % \end{macrocode}
941 %
942 % The following mechanism to separate the first (or only) number from the
943 % remainder was suggested by Frank Mittelbach of the University of Mainz,
944 % and replaced about two pages worth of code.
945 % \changes{v2.2}{89/05/17}{Much quicker clue number extraction}
946 % \begin{macrocode}
947 \def\findnumber#1{%
948 % \end{macrocode}
949 % We attempt to assign the \meta{clue\_number} parameter to the
950 % \verb+\clueNumber+ counter: only that portion consisting purely of digits
951 % will actually be assigned. The remainder, if any, including the special
952 % terminator sequence \verb+\@nil+ is then discarded by the
953 % \verb+\special@gobble+ command:
954 %
955 % \begin{macrocode}
956 \afterassignment \special@gobble \clueNumber=0#1 \@nil
957 % \end{macrocode}
958 %
959 % \changes{v2.6}{89/10/13}{Minor revision of layout}
960 % If the user did not provide a valid \meta{clue\_number} (i.e.\ something
961 % starting with a digit), then \verb+clueNumber+ will have zero assigned to
962 % it. This will cause a diagnostic message at the stage when it is checked
963 % that the clue numbers run consecutively in reading order from 1 upwards.
964 %
965 % This completes \verb+\findnumber+.
966 %
967 % \begin{macrocode}
968 \ifnum\clueNumber=0
969 \errhelp{The first parameter of the \string\clue\space command
970 must commence with a digit}
971 \errmessage{Illegal clue number (#1) specified
972 for \string\clue.}
973 \fi
974 }
975 % \end{macrocode}
976 % \end{macro} ^^A \special@gobble
977 % \end{macro} ^^A \clueNumber
978 % \end{macro} ^^A \findnumber
979 %
980 % \begin{macro}{\cluenumber}
981 % This macro merely produces the number as saved in \verb+\clueNumber+.
982 % \begin{macrocode}
983 \def\cluenumber{\the\clueNumber}
984 % \end{macrocode}
985 % \end{macro} ^^A \cluenumber
986 %
987 % \subsection{Populating the Crossword Grid}
988 % \begin{macro}{\blackenrow}
989 % \changes{v2.2}{89/05/17}{Used {\tt\protect\bslash blackenrow} for inner loop}
990 % \changes{v2.8a}{96/07/22}{Fixed command to save val of \cs{iterate}
991 % not \cs{body} (FMi)}
992 % For each column in a row we create a black square by setting the
993 % letter in the square to \texttt{!}. We also initialize the \texttt{Number}
994 % and \texttt{Bar} macros.
995 %
996 % Before starting the inner loop, we need to save the definition of
997 % \verb+\body+ which was created for the outer loop. We cannot do this by
998 % creating a new block, since that would require that each square be defined
999 % globally, which might give rise to save stack overflow problems.
1000 %
1001 % Actually with \LaTeXe{} we have to save \verb=\iterate= as the internals
1002 % of \verb=\loop= have been streamlined. With the old code only the first
1003 % row was updated---this is the price for using an unpublished implementation
1004 % feature.
1005 % \begin{macrocode}
1006 \def\blackenrow{\let\savediterate\iterate
1007 \loop\relax\ifnum\Across>\z@
1008 \assign Bar[\Down,\Across]=3;
1009 \assign Letter[\Down,\Across]=!;
1010 \assign Number[\Down,\Across]=0;
1011 % \end{macrocode}
1012 %
1013 % We then shift ourselves back to the next column to the left and iterate.
1014 % If we've reached the end of this inner loop, we re-establish the
1015 % definition of \verb+\body+.
1016 %
1017 % Again with 2e this has to be \verb=\iterate=.
1018 %
1019 % \begin{macrocode}
1020 \advance\Across by \m@ne
1021 \repeat
1022 \let\iterate\savediterate
1023 }
1024 % \end{macrocode}
1025 %
1026 % \begin{macro}{\SetUpGrid}
1027 % \changes{v2.9}{07/12/05}{Rectangular grids}
1028 %
1029 % This macro creates an empty grid of the appropriate size.
1030 %
1031 % \begin{macrocode}
1032 \def\SetUpGrid#1#2{%
1033 % \end{macrocode}
1034 %
1035 % We firstly make a note of the \meta{gridcols} parameter in the
1036 % \verb+\gr@dcols+ counter, from which the width and height of the grid
1037 % may be computed. We also set the \verb+\p@csize+ counter to be one
1038 % greater than \verb+\gridc@ls+ to save our recomputing this quantity many
1039 % times over. Ditto mutatis mutandis for \meta{gridrows}.
1040 %
1041 % \begin{macrocode}
1042 \gridr@ws=#1\gridc@ls=#2
1043 \p@rsize=#1 \advance\p@rsize by \@ne
1044 \p@csize=#2 \advance\p@csize by \@ne
1045 \typeout{Grid has #1 rows and #2 columns.}
1046 % \end{macrocode}
1047 %
1048 % Right, this is where we start to generate the grid itself. We start at
1049 % the bottom edge, because \TeX\ loops are easiest if counting down to
1050 % zero. Therefore, the \verb+\Down+ counter is set equal to the highest row
1051 % number attainable.
1052 %
1053 % \begin{macrocode}
1054 \Down=\gridr@ws
1055 % \end{macrocode}
1056 %
1057 % We now start a loop, so the following code will be repeated for each row
1058 % of the grid in turn. As with the rows, we process the columns from
1059 % highest address to lowest, so the \verb+\Across+ counter is also set to the
1060 % highest column attainable.
1061 %
1062 % \begin{macrocode}
1063 \loop
1064 \Across=\gridc@ls
1065 % \end{macrocode}
1066 %
1067 % Provided we haven't decremented down to the 0th row, we start off the
1068 % inner loop to process each column: this is done by invoking a separate
1069 % macro --- the alternative to which would be to enclose the inner loop in
1070 % a group, which would require the use of global definitions for each
1071 % square.
1072 % \changes{v2.2}{89/05/17}{Used {\tt\protect\bslash blackenrow} for inner loop}
1073 %
1074 % \begin{macrocode}
1075 \ifnum\Down>\z@
1076 \blackenrow
1077 % \end{macrocode}
1078 %
1079 %
1080 % Afterwards we move ourselves up one row, and iterate for the next row.
1081 %
1082 %
1083 % \begin{macrocode}
1084 \advance\Down by \m@ne
1085 \repeat
1086 }
1087 % \end{macrocode}
1088 % \changes{v2.6}{89/10/13}{Minor revision of layout}
1089 % And that's the end of \verb+\SetUpGrid+!
1090 % \end{macro} ^^A \SetUpGrid
1091 % \end{macro} ^^A \blackenrow
1092 %
1093 % \begin{macro}{\TestAnswers}
1094 % This macro interacts with the user, if necessary, to get a yes or no
1095 % indication of whether the answers shall be written into the grid. No
1096 % check is made that the user has entered a valid response, but the use of
1097 % \verb+\answer+ is such that any answer apart from a `{\tt y}' (in upper-
1098 % or lower-case) is treated as if it were `{\tt n}'.
1099 %
1100 % \begin{macro}{\f@rst}
1101 % To determine what parameter has been provided, or the response elicited,
1102 % we will require a little macro to pass on the first token of a list
1103 % terminated by a full stop.
1104 %
1105 % \begin{macrocode}
1106 \def\f@rst#1#2.{#1}
1107 % \end{macrocode}
1108 %
1109 % We commence by lower-casing the given parameter, setting the lower-cased
1110 % version into the macro \verb+\answer+.
1111 % \begin{macrocode}
1112 \def\TestAnswers#1{\edef\next{\def\noexpand\answer{#1}}%
1113 \lowercase\expandafter{\next}%
1114 % \end{macrocode}
1115 % We can then extract just the first character
1116 % \begin{macrocode}
1117 \edef\answer{\expandafter \f@rst \answer n.}%
1118 % \end{macrocode}
1119 % The we determine whether it's the letter `{\tt y}' or `{\tt n}'\dots
1120 % \begin{macrocode}
1121 \if\answer y \else \if\answer n \else
1122 % \end{macrocode}
1123 % If the \meta{visible} parameter isn't either of these, we ask the user
1124 % to give us an answer!
1125 % \begin{macrocode}
1126 \typein[\answer]{Make answers visible? [Y/N]: }\fi
1127 \fi
1128 % \end{macrocode}
1129 % OK, \verb+\answer+ now contains some response; let's upper-case it and
1130 % extract just its first character
1131 % \begin{macrocode}
1132 \edef\next{\def\noexpand\answer{\answer}}%
1133 \uppercase\expandafter{\next}%
1134 \edef\answer{\expandafter \f@rst \answer n.}%
1135 }
1136 % \end{macrocode}
1137 % \end{macro}
1138 % \end{macro}
1139 %
1140 %
1141 % \subsection{Setting the Grid}
1142 %
1143 % \begin{macro}{\putletter}
1144 %
1145 % \changes{v2.8a}{96/07/22}{use \cs{sffamily} (FMi)}
1146 % These macros put letters, numbers and bars at the current
1147 % \verb+[\Down,\Across]+ position. Note that \verb+\putletter+
1148 % would be redefined to \verb+\relax+ if no actual letters are required.
1149 % \begin{macrocode}
1150 \def\putletter{{\put(\Across,-\Down){\makebox(1,1)
1151 {\sffamily \value Letter[\Down,\Across]}}}}
1152 % \end{macrocode}
1153 % \begin{macro}{\putnumber}
1154 % The \verb+\putnumber+ macro checks whether the clue number is 0 (which
1155 % means an unnumbered square) and whether the clue numbers are in
1156 % sequence. To this end, it makes use of global \verb+\oldnumber+
1157 % and \texttt{seqtest}.
1158 % \begin{macrocode}
1159 \newcount\oldnumber \oldnumber=0
1160 \newif\ifseqtest \seqtestfalse
1161 \def\putnumber{\immediate\def\Number{\value Number[\Down,\Across]}
1162 \ifnumberit \ifnum\Number>0
1163 \put(\Across,-\Down){%
1164 % \end{macrocode}
1165 %
1166 % To insert the clue number, we generate it within a sub-picture, of size
1167 % equal to one square.
1168 %
1169 % \begin{macrocode}
1170 \begin{picture}(1,1)(0,0)
1171 % \end{macrocode}
1172 %
1173 % We stick the number in the top-left corner of an (invisible) box which
1174 % fills the central 81\% of the area. In the process, we check whether
1175 % the clues are properly numbered in reading order.
1176 %
1177 % \begin{macrocode}
1178 \put(0.05,0.05){\makebox(0.9,0.9)[tl]{\numbersize\Number}}
1179 \end{picture}}
1180 \ifnum \oldnumber>0 \advance\oldnumber by\m@ne
1181 \ifnum \oldnumber=\Number {\seqtesttrue} \else
1182 \ifseqtest
1183 \errhelp{Clues should be numbered consecutively from top left
1184 to bottom right.}
1185 \errmessage{Found clue number \Number, but expected \the\oldnumber}
1186 % \end{macrocode}
1187 % If a clue number was mistyped, it will generate two out-of-sequence
1188 % errors. We suppress the second of these.
1189 %
1190 % \begin{macrocode}
1191 \seqtestfalse
1192 \else\seqtesttrue\fi
1193 \fi
1194 \fi
1195 \global \oldnumber=\Number
1196 \fi \fi
1197 }
1198 % \end{macrocode}
1199 % \begin{macro}{\putbars}
1200 % If there are two adjacent light squares not belonging to the same light,
1201 % we draw a bar between them. We use two counters for that: one for the
1202 % previous square, so we can test for its blackness; one for the
1203 % changing value of the barcode for the current square.
1204 % \begin{macrocode}
1205 \newcount \pr@vious
1206 \newcount \c@de
1207 \def\putbars{ \linethickness{\barwidth\unitlength}
1208 \c@de=\value Bar[\Down,\Across]
1209 \ifnum \c@de>1 \advance\c@de by -2
1210 \ifnum \Across>1
1211 \pr@vious=\Across \advance \pr@vious by -1
1212 \immediate\def\pr@vlet{\value Letter[\Down,\pr@vious]}
1213 \if \pr@vlet ! \else \put(\Across,-\Down){\line(0,1){1}}
1214 \fi \fi \fi
1215 \ifnum \c@de>0
1216 \ifnum \Down>1
1217 \pr@vious=\Down \advance \pr@vious by -1
1218 \immediate\def\pr@vlet{\value Letter[\pr@vious,\Across]}
1219 \if \pr@vlet ! \else \put(\Across,-\pr@vious){\line(1,0){1}}
1220 \fi \fi \fi
1221 }
1222 % \end{macrocode}
1223 %
1224 % \end{macro}\end{macro}\end{macro}
1225 %
1226 % \begin{macro}{\FinishGrid}
1227 % Now we can process all the stored macros which define the appearance of
1228 % each square in the grid, and thus generate the printed version thereof,
1229 % using \LaTeX's {\sf picture} environment.
1230 %
1231 % This command makes appropriate redefinitions of some macros which produced
1232 % different effects during the filling of the grid.
1233 % \changes{v2.2}{89/05/17}{Removed extraneous opening space after brace}
1234 % \changes{v2.6}{89/10/13}{Minor revision of layout}
1235 % \changes{v2.9}{07/12/05}{Rectangular grid, top right extra labels}
1236 % \begin{macrocode}
1237 \def\FinishGrid{%
1238 % \end{macrocode}
1239 %
1240 % If the customer doesn't want the letters put into the grid, then we
1241 % need only let \verb+\putletter+ do nothing. Since \verb+\FinishGrid+
1242 % is invoked inside the environment, the original definition will be
1243 % restored on exit.
1244 %
1245 % \begin{macrocode}
1246 \if\answer Y \else \let\putletter\relax \fi
1247 % \end{macrocode}
1248 %
1249 % Now we come to the actual body of \verb+\FinishGrid+.
1250 %
1251 % \changes{v2.6}{89/10/13}{Minor revision of layout}
1252 % \changes{v2.9}{07/12/05}{Rectangular grid}
1253 % We start off at the bottom-most row of the grid\dots
1254 %
1255 % \begin{macrocode}
1256 \Down=\gridr@ws
1257 % \end{macrocode}
1258 %
1259 % The whole grid is created in a centered \verb+\hbox+ in a {\sf picture}
1260 % environment. By offsetting the origin negatively, we can address each
1261 % row by simply negating the $y$ coordinate; thus column $x$ in the highest
1262 % row is $(x,-1)$.
1263 %
1264 % \begin{macrocode}
1265 \centerline{%
1266 \begin{picture}(\p@csize,\p@rsize)(1,-\p@rsize)
1267 % \end{macrocode}
1268 %
1269 % We now cycle through each of the rows. The first thing we output is a
1270 % horizontal rule of the full width of the grid, one such rule being
1271 % generated for each row of the grid, providing the horizontal lines across
1272 % vertical lights.
1273 %
1274 % \begin{macrocode}
1275 \loop\ifnum\Down>\z@
1276 \put(1,-\Down){\line(1,0){\the\gridc@ls}}
1277 % \end{macrocode}
1278 %
1279 % Now we are about to cycle across all the columns of the current row;
1280 % again, it's convenient for us to work backwards to the left\dots
1281 %
1282 % \begin{macrocode}
1283 \Across=\gridc@ls
1284 % \end{macrocode}
1285 %
1286 % To do this we need an inner loop; this has to be inside a group so as to
1287 % isolate the effects of its \verb+\repeat+ command.
1288 %
1289 % \begin{macrocode}
1290 {\loop \ifnum\Across>\z@
1291 % \end{macrocode}
1292 %
1293 % A black square is represented by \texttt{!} instead of a letter.
1294 % We need an \verb+\immediate+ definition to force the expansion
1295 % so we can test using \verb+\if+. This test cannot be made inside
1296 % \verb+\putletter+ because that macro may have been redefined
1297 % when the lights are empty.
1298 % \begin{macrocode}
1299 \immediate\def\lett@r{\value Letter[\Down,\Across]}
1300 \if \lett@r ! \put(\Across,-\Down){\rule{\unitlength}{\unitlength}}
1301 \else \putletter \putnumber \putbars
1302 \fi
1303 % \end{macrocode}
1304 %
1305 % Now we advance to the next column and iterate. That's the end of the
1306 % inner loop for each of the columns of the current row.
1307 %
1308 % \begin{macrocode}
1309 \advance\Across by \m@ne
1310 \repeat
1311 }%
1312 % \end{macrocode}
1313 %
1314 % Now we can decrement down to the next row and iterate through the
1315 % rows. In the process, we encounter all the clue numbers in opposite
1316 % order, therefore the last clue number found should be 1.
1317 %
1318 % \begin{macrocode}
1319 \advance\Down by \m@ne
1320 \repeat
1321 \ifthenelse{\equal{\the\oldnumber}1}{}
1322 {\ifnumberit\errhelp{Clues should be numbered consecutively
1323 from top left to bottom right.}
1324 \errmessage{First clue number is \the\oldnumber, not 1} \fi}
1325 % \end{macrocode}
1326 %
1327 % We've so far drawn a horizontal line {\em under\/} each of the rows; the
1328 % next \verb+\put+ draws a final line {\em above\/} the top-most row.
1329 %
1330 % \begin{macrocode}
1331 \put(1,0){\line(1,0){\the\gridc@ls}}
1332 % \end{macrocode}
1333 %
1334 % Similarly, a short loop can draw vertical rules at the left-hand edge of
1335 % each of the columns, starting with a line on the left of an imaginary
1336 % column to the right of the whole grid, which will therefore form a line to
1337 % the right of the final column.
1338 %
1339 % \begin{macrocode}
1340 \Across=\p@csize
1341 \loop\ifnum\Across>\z@
1342 \put(\Across,0){\line(0,-1){\the\gridr@ws}}
1343 \advance\Across by \m@ne
1344 \repeat
1345 % \end{macrocode}
1346 %
1347 % And that completes the picture.
1348 %
1349 % \begin{macrocode}
1350 \end{picture}%
1351 }%
1352 }
1353 %</package>
1354 % \end{macrocode}
1355 % \end{macro}
1356 %
1357 %
1358 %
1359 % \section{A hard crossword with blocks and bars}
1360 % \begin{crossword}[11]{13}{N}
1361 % \MakePercentComment \input{grid2} \MakePercentIgnore
1362 % \end{crossword}
1363
1364
1365 % \section{Sample input files}
1366 % Finally, here's the input which produced the crossword in
1367 % Figure~\ref{crossword:1}
1368 %
1369 % \begin{verbatim}
1370 % \begin{crossword}{15}{N}
1371 % \input{grid1}
1372 % \end{crossword}
1373 % \end{verbatim}
1374 %
1375 %
1376 %
1377 % \begin{macrocode}
1378 %<*grid0>
1379 \clue{1}{A}{3}{1}{PERAMBULATOR}{Stroller carrying the baby}{12}
1380 \clue{8}{A}{1}{3}{IMPASSE}{Eastern note returned about predicament resulting
1381 in deadlock}{7}
1382 \clue{9}{A}{9}{3}{TERMINI}{Many ends brought back in one minute soak}{7}
1383 \clue{11}{A}{1}{5}{TIEPOLO}{Venetian painter to draw Spanish gipsy dance?}{7}
1384 \clue{12}{A}{9}{5}{ARAMAIC}{Semitic language of one in charge of following a
1385 sheep}{7}
1386 \clue{13}{A}{1}{7}{ENSUE}{Follow three directions and bend eastward}{5}
1387 \clue{14}{A}{7}{7}{IMPLETION}{Filling feeble-minded person who lost his head
1388 about one}{9}
1389 \clue{16}{A}{1}{9}{SURPRISED}{Rip apart with duress taken unawares}{9}
1390 \clue{19}{A}{11}{9}{DUNCE}{Stupid person from hill church}{5}
1391 \clue{21}{A}{1}{11}{ERRATUM}{Published correction --- return walled-up
1392 sailor}{7}
1393 \clue{23}{A}{9}{11}{LIASSIC}{Lower Jurassic sea trip backwards [thus]}{7}
1394 \clue{24}{A}{1}{13}{SABBATH}{Midnight meeting of witches at hospital on rest
1395 day?}{7}
1396 \clue{25}{A}{9}{13}{ISOTRON}{Sort ion with an accelerator?}{7}
1397 \clue{26}{A}{2}{15}{STANDINGROOM}{Substitute husband relegated here at
1398 crowded wedding}{8-4}
1399 \clue{1}{D}{3}{1}{PEPPERS}{Showers band with lonely hearts?}{7}
1400 \clue{2}{D}{5}{1}{RESTORE}{Concerning money saved --- reinstate to former
1401 owner}{7}
1402 \clue{3}{D}{7}{1}{MNEMONICS}{No-one in higher degree produces memory
1403 joggers}{9}
1404 \clue{4}{D}{9}{1}{ULTRA}{Enigmatic secret of WW\,I\kern-.1em I?}{5}
1405 \clue{5}{D}{11}{1}{ACREAGE}{Current about time flows over measured area}{7}
1406 \clue{6}{D}{13}{1}{ORIGAMI}{Maybe magic endlessly raised before one with
1407 Japanese artistic skill}{7}
1408 \clue{7}{D}{1}{2}{LISTLESSNESS}{Enroll fewer once before head suffering a
1409 languid malaise}{12}
1410 \clue{10}{D}{15}{3}{INCANDESCENT}{White-hot Peruvian reorganized objects
1411 covering small coin}{12}
1412 \clue{15}{D}{9}{7}{PEDALLING}{Penny led a rearranged fish engaging in cyclic
1413 activity!}{9}
1414 \clue{17}{D}{3}{9}{RAREBIT}{Welsh toast? An unusual drill!}{7}
1415 \clue{18}{D}{5}{9}{RETRAIN}{Keep in mind, take in, and acquire new
1416 skills}{7}
1417 \clue{19}{D}{11}{9}{DIABOLO}{Twice a high ball thrown up round a two-headed
1418 top}{7}
1419 \clue{20}{D}{13}{9}{NOSTRUM}{No good man with spirit offers quack remedy}{7}
1420 \clue{22}{D}{7}{11}{MAHDI}{I would shortly overact, sent up, and the
1421 downfall of Gordon}{5}
1422 %</grid0>
1423 % \end{macrocode}
1424 %
1425 %
1426 %
1427 % \begin{macrocode}
1428 %<*grid1>
1429 \clue{8}{A}{1}{2}{SWAM}{Points a thousand tested for witchcraft.}{4}
1430 \clue{9}{A}{6}{2}{OHO}{Gourmet's triumphant cry on finding middle-cut
1431 Pacific salmon!}{3}
1432 \clue{10}{A}{10}{2}{ICECAP}{One hundred stride backwards across a
1433 Pole.}{3-3}
1434 \clue{11}{A}{1}{4}{BOPEEP}{Fifties' jazz record about Eastern childs'
1435 play.}{2-4}
1436 \clue{12}{A}{8}{4}{SCHEDULE}{Timetable created by editor in synagogue
1437 of Spain.}{8}
1438 \clue{13}{A}{1}{6}{THALASSOGRAPHER}{The dialect a girl mixed up tangle
1439 around symbolic diagram used by
1440 maritime student!}{15}
1441 \clue{15}{A}{1}{8}{HAIRPIN}{Wire fastening bent road narrowly.}{7}
1442 \clue{17}{A}{9}{8}{UMBRAGE}{Hammerhead consumes German company
1443 and casts a shade.}{7}
1444 \clue{20}{A}{1}{10}{SCALENETRIANGLE}{Strange cel alien chops to make a
1445 figure with odd sides.}{7,8}
1446 \clue{23}{A}{1}{12}{AMOUNTED}{Sounds like a hoarse editor came to in
1447 total!}{8}
1448 \clue{25}{A}{10}{12}{ALLEGE}{Assert without proof everyone, for
1449 example, English.}{6}
1450 \clue{26}{A}{1}{14}{FLORAL}{Flourished examination of flowers.}{6}
1451 \clue{27}{A}{8}{14}{NIL}{Floor covering discards fuming sulphuric acid
1452 and returns to nothing.}{3}
1453 \clue{28}{A}{12}{14}{TACE}{``Latin for a candle'' to be silent note
1454 about aircraftman?}{4}
1455 \clue{1}{D}{2}{1}{SWOOSH}{Water rush noise disturbs show so!}{6}
1456 \clue{2}{D}{4}{1}{IMPELLER}{Mischievous child with cloth measure
1457 hesitates to assemble rotor.}{8}
1458 \clue{3}{D}{6}{1}{COMPASSIONATELY}{Mercifully inclined to pass round
1459 ten? Nay, about short blower!}{15}
1460 \clue{4}{D}{8}{1}{TORSION}{Sort ion? An isotron gives it a new
1461 twist!}{7}
1462 \clue{5}{D}{10}{1}{DITHYRAMBICALLY}{Wildly and boisterously rearrange
1463 Billy May Third, roughly.}{15}
1464 \clue{6}{D}{12}{1}{SENDUP}{Satirical book or film---give odds about
1465 revision of ``Dune''?}{4-2}
1466 \clue{7 {\noexpand\rm\&} 24}{D}{14}{1}{PALL}{Premier took in a Lord
1467 Lieutenant and all played an
1468 old game in London street.}{4-4}
1469 \clue{14}{D}{14}{6}{ERG}{Work expended in power games?}{3}
1470 \clue{16}{D}{2}{8}{ARC}{A church circle (or part of one).}{3}
1471 \clue{18}{D}{12}{8}{RINGLETS}{Encircle hindrances under hair in long
1472 curls.}{8}
1473 \clue{19}{D}{8}{9}{STUDENT}{Boss over oto\-rhino\-laryng\-o\-logy
1474 department undergraduate.}{7}
1475 \clue{21}{D}{4}{10}{LOUVRE}{Old dovecote in Parisian museum.}{6}
1476 \clue{22}{D}{14}{10}{LEGACY}{Like ornamental fabric, for example,
1477 that's in bequest.}{6}
1478 \clue{24}{D}{2}{12}{MALL}{}{See {\bf 7}}
1479 %</grid1>
1480 % \end{macrocode}
1481 %
1482 %
1483 %
1484 % \begin{macrocode}
1485 %<*exa0>
1486 \documentclass{article}
1487 \usepackage{crosswrd}
1488 \pagestyle{empty}
1489 \setlength\topmargin{-1in}
1490 \setlength\textheight{10.7in}
1491
1492 \begin{document}
1493 \begin{crossword}{15}{?}
1494 \input{grid0}
1495 \end{crossword}
1496 \end{document}
1497 %</exa0>
1498 % \end{macrocode}
1499 %
1500 %
1501 % \begin{macrocode}
1502 %<*exa1>
1503 \documentclass{article}
1504 \usepackage{crosswrd}
1505 \pagestyle{empty}
1506 \setlength\topmargin{-1in}
1507 \setlength\textheight{10.7in}
1508 \begin{document}
1509 \section*{A Sample Crossword}
1510 \textit{(Chamber's Twentieth Century dictionary)}
1511 \begin{crossword}{15}{N}
1512 \input{grid1}
1513 \end{crossword}
1514 \begin{crossword*}{15}{Solution to grid 0}
1515 \input{grid0}
1516 \end{crossword*}
1517 \end{document}
1518 %</exa1>
1519 % \end{macrocode}
1520
1521 %
1522 % \Finale
1523 % \endinput
1524
1525
1526 %<*exa2>
1527 \documentclass[a4paper]{article}
1528 \usepackage{a4wide,charter,crosswrd}
1529 \topmargin -20mm
1530 \textheight 240mm
1531 \begin{document}
1532 \thispagestyle{empty}
1533 \begin{crossword}[11]{13}{N}
1534 \input grid2
1535 \end{crossword}
1536 \end{document}
1537 %</exa2>
1538 %<*grid2>
1539 \unitlength 7mm
1540 \let\numbersize\scriptsize
1541 \centerline{\large{\textbf{T-shirt design} by Dirk Laurie}}
1542 \def\Preamble{5 27, and that goes for 17 11 25 and 24A 10 too,
1543 I'm sure, so the unclued lights should be entered in red.
1544 The other lights are all
1545 in the rather ancient edition of Chambers consulted by the composer.}
1546 \clue{1}{A}{1}{1}{........}{Murderer's lip in an evil act}{8}
1547 \clue{6}{A}{9}{1}{.....}{Places where vehicles without
1548 resistance get bogged down?}{5}
1549 \clue{10}{A}{2}{2}{..........}{}{}
1550 \clue{12}{A}{1}{3}{....}{Perhaps 27 die here}{4}
1551 \clue{14}{A}{5}{3}{.....}{Obstinate at first and after a smack}{5}
1552 \clue{15}{A}{10}{3}{....}{Seduced girl, as rumoured}{4}
1553 \clue{16}{A}{1}{5}{........}{Paid an unspecified amount in Johannesburg}{8}
1554 \clue{17 \noexpand\& 11D \noexpand\& 25D}{A}{9}{5}{.....}{}{See preamble}
1555 \clue{18}{A}{1}{6}{......}{Butt gives information in a peeve}{6,hyphenated}
1556 \clue{20}{A}{8}{6}{......}{Big folk appearing in spots last month}{6}
1557 \clue{24 \noexpand\& 10}{A}{1}{7}{.....}{}{See preamble}
1558 \clue{26}{A}{6}{7}{........}{Wince after European has knocked back medicine,
1559 leaving out some}{8}
1560 \clue{30}{A}{1}{9}{....}{Recidivist is back, getting old in here}{4}
1561 \clue{31}{A}{5}{9}{.....}{Unwilling to receive a small copper pot}{5}
1562 \clue{32}{A}{10}{9}{....}{Primal wilderness beside a person from the East
1563 ``is Paradise ---''}{4}
1564 \clue{33}{A}{3}{10}{..........}{Denizen of Africa to suffer in the heat
1565 when dose insects get in}{10}
1566 \clue{34}{A}{1}{11}{.....}{Turn around at home and peek outside, like 18?}{5}
1567 \clue{35}{A}{6}{11}{........}{Such as these two from the back going
1568 ahead in copious lovemaking}{8}
1569 \clue{1}{D}{1}{1}{......}{A disc full of French horn music}{6}
1570 \clue{2}{D}{2}{1}{....}{Drams served up in Highland drizzle}{4}
1571 \clue{3}{D}{4}{1}{......}{A gadfly with well-separated feet etc}{6,two words}
1572 \clue{4}{D}{5}{1}{......}{Not many shooting up, in fact only one}{6}
1573 \clue{5 \noexpand\& 27}{D}{7}{1}{.....}{}{See preamble,three words}
1574 \clue{6}{D}{9}{1}{.....}{Tree that will, having had root extracted
1575 at first, turn into mineral!}{5}
1576 \clue{7}{D}{10}{1}{....}{Give me a response that I can hear:
1577 it's no longer a crisis}{4}
1578 \clue{8}{D}{12}{1}{......}{What unreformed head wears is right}{6}
1579 \clue{9}{D}{13}{1}{.....}{Dirk's parrot, found in polar regions}{5}
1580 \clue{11}{D}{11}{2}{........}{}{}
1581 \clue{13}{D}{3}{3}{........}{Saying "Be with you shortly", lassie goes inside
1582 house}{8}
1583 \clue{19}{D}{2}{6}{......}{Invest ten rand judiciously}{6}
1584 \clue{21}{D}{9}{6}{......}{Coin Dirk lost on the way up; Henry gets involved}{6}
1585 \clue{22}{D}{10}{6}{......}{Peek!}{6}
1586 \clue{23}{D}{13}{6}{......}{Neutral sounds and trite sayings arise all around Switzerland}{6}
1587 \clue{24}{D}{1}{7}{.....}{Servants genteel at heart? One of them
1588 is the butler at Blandings Castle!}
1589 {5}
1590 \clue{25}{D}{5}{7}{.....}{}{}
1591 \clue{27}{D}{7}{7}{.....}{}{}
1592 \clue{28}{D}{4}{8}{....}{Serving up only half a beer is a mistake}{4}
1593 \clue{29}{D}{12}{8}{....}{Footplay before strong no-trump not allowed}{4}
1594 %</grid2>
1595 %
1596