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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\filename{cwpuzzle.dtx}
\def\fileversion{1.9}
\def\filedate{2014/01/12}
\let\docversion=\fileversion
\let\docdate=\filedate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\iffalse
\typeout{%
%% Purpose:
Package: cwpuzzle \filedate\space\fileversion\space
for typesetting crossword puzzles and more.
}%
%%
%% Documentation:
%% The documentation can be generated from the original file
%% cwpuzzle.dtx with the doc style/package. LaTeX the file
%% cwpuzzle.dtx to get the full documentation in dvi format.
%%
%%
%% Author: Gerd Neugebauer
%% Im Lerchelsöhl 5
%% 64521 Groß-Gerau
%% Mail: gene@gerd-neugebauer.de
%%
%% Copyright (c) 1995-2014 Gerd Neugebauer
%%
%% cwpuzzle.dtx is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY. No author or distributor accepts
%% responsibility to anyone for the consequences of using it or for
%% whether it serves any particular purpose or works at all, unless
%% he says so in writing.
%%
%% Everyone is granted permission to copy, modify and redistribute
%% cwpuzzle.dtx, provided this copyright notice is preserved and
%% any modifications are indicated.
%%
%%
%% This style is still under development and may be replaced with a
%% new version which provides an enhanced functionality.
%%
%<*driver>
\documentclass{ltxdoc}
\usepackage{xcolor}
\usepackage{cwpuzzle}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\setcounter{IndexColumns}2
\begin{document}
\DocInput{cwpuzzle.dtx}
\newpage
\PrintChanges
\end{document}
%</driver>
%\fi
%
% \title{A \LaTeX\ Package for Typesetting\\ Crossword
% Puzzles and More\thanks{This file documents \filename\ version
% \fileversion\ as of \filedate.}}
% \author{Gerd Neugebauer\\
% Im Lerchels\"ohl 5\\
% 64521 Gro\ss{}-Gerau (Germany)\\
% Net: {\tt gene@gerd-neugebauer.de}}
%
% \date{{\footnotesize Documentation date: \docdate}}
%
% \maketitle
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \DoNotIndex{\ ,\|,\",\',\.,\,,\[,\\,\],\^,\`,\~,\@,\@dottedtocline}
% \DoNotIndex{\@empty,\@namedef,\@nameuse,\advance,\begin,\begingroup}
% \DoNotIndex{\catcode,\csname,\def,\else,\end,\endcsname,\endgroup}
% \DoNotIndex{\fi,\filedate,\footnotesize,\framebox,\gdef,\global}
% \DoNotIndex{\hfill,\if,\ifx,\large,\let,\makebox,\mbox,\newcommand}
% \DoNotIndex{\newcount,\newdimen,\newenvironment,\newif,\noindent}
% \DoNotIndex{\normalsize,\null,\par,\put,\raggedright,\raggedleft}
% \DoNotIndex{\relax,\renewcommand,\RequirePackage,\rm,\rule}
% \DoNotIndex{\scriptsize,\sf,\small,\textsf,\textwidth}
% \DoNotIndex{\the,\tiny,\unitlength,\uppercase,\xdef,\ProvidesPackage}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \changes{1.3}{1996/10/28}{First public release.}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \CheckSum{640}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \MakeShortVerb{|}
%
% \begin{abstract}
% cpwuzzle.dtx provides a package to typeset crossword puzzles.
% The leading philosophy is that the puzzle and the solution are
% typeset from the same source.
%
% The package can be used to produce several types of puzzles like
% the classical crossword puzzle, a number puzzle, and fill-in
% puzzles. In addition to the block separated puzzles the thick
% line delimited puzzles are supported as well.
% \end{abstract}
%
% \tableofcontents
% \newpage
%
% \section{About Crossword Puzzles}
%
% Crossword puzzles are can be a an amusing but also a challenging
% hobby. Unfortunately at the time of this writing I am not aware
% of any good package to typeset crossword puzzles with \LaTeX.
% Thus I decided to make one which at least fits my needs.
%
% There are several types of crossword puzzles among. This
% package can only be used to typeset several of them. The basic
% assumption in this package is that puzzles are rectangular
% arrangements of boxes. Some of these boxes are black and others
% are prepared to take single letters.
% Each word in the grid is enclosed in black boxes or the outside.
%
% Optionally there may be rectangular regions left blank inside the
% puzzle. They can be used to place ads or other informative texts
% inside the puzzle.
%
% \subsection{Classical Crossword Puzzles}\label{sec:classical}
%
% \PuzzleUnsolved
% \begin{minipage}{.35\textwidth}%
% \begin{Puzzle}{5}{3}%
% |* |* |[1]E|X |* |.
% |[2]A|[3]S|T |* |[4]T|.
% |* |[5]P|A |R |T |.
% \end{Puzzle}%
% \end{minipage}%
% \begin{minipage}{.6\textwidth}
% \begin{PuzzleClues}{Across}%
% \Clue{1}{EX}{unit of measure}%
% \Clue{2}{AST}{\(\ast\)}%
% \Clue{5}{PART}{sectioning unit}%
% \end{PuzzleClues}%
% \begin{PuzzleClues}{Down}%
% \Clue{1}{ETA}{\(\eta\)}%
% \Clue{3}{SP}{unit of measure}%
% \Clue{4}{TT}{non-proportional font}%
% \end{PuzzleClues}%
% \end{minipage}\medskip
%
% The ``classical'' type of a crossword puzzle words are marked
% with numbers and each word is accompanied with a clue which
% should help (or confuse) the reader. Those clues are listed after
% the frame of the puzzle.
%
% \subsection{Number Crossword Puzzles}\label{sec:numbered}
%
% \begin{minipage}{.35\textwidth}%
% \begin{Puzzle}{5}{3}%
% |* |* |[6]E|[1]X|* |.
% |[5]A|[2]S|[7]T|* |[7]T|.
% |* |[4]P|[5]A|[3]R|[7]T|.
% \end{Puzzle}%
% \end{minipage}%
% \begin{minipage}{.6\textwidth}
% \PuzzleLetters{AEPRSTX}\medskip\par
% \PuzzleNumbers{XSRPAET}%
% \end{minipage}\medskip
%
% The ``number puzzle'' variant contains only numbers instead of
% letters. Different numbers denote different letters. There are no
% clues. The reader is assumed to find a complete list of letters
% by filling appropriate words into the grid. Sometimes a word is
% already entered into the grid to ease the start.
%
% \subsection{Fill-In Crossword Puzzles}\label{sec:fill-in}
%
% \begin{minipage}{.35\textwidth}%
% \begin{Puzzle}{5}{3}%
% |* |* |E |X |* |.
% |A |S |T |* |T |.
% |* |P |A |R |T |.
% \end{Puzzle}%
% \end{minipage}%
% \begin{minipage}{.6\textwidth}
% \begin{PuzzleWords}{2}
% \Word{EX}%
% \Word{SP}%
% \Word{TT}%
% \end{PuzzleWords}%
% \begin{PuzzleWords}{3}
% \Word{AST}%
% \Word{ETA}%
% \end{PuzzleWords}%
% \begin{PuzzleWords}{4}
% \Word{PART}%
% \end{PuzzleWords}%
% \end{minipage}\medskip
%
% The ``fill-in puzzle'' variant consists of a frame containing
% only black and white boxes. Additionally a list of words is given
% which have to be put into the frame until none is left and the
% frame is completed.
%
% \subsection{Line delimited Crossword Puzzles}\label{sec:line-delimited}
%
% The crossword puzzles we have seen before had the property that
% words are either delimited by the outer border or by a solid
% block. In addition line delimited puzzles are common. In this
% case a thicker line is drawn to indicate the end of a line.\medskip
%
% \noindent
% \begin{minipage}{.35\textwidth}%
% \begin{Puzzle}{5}{3}%
% |[1] c |[2] c |[3][l]e |[4] x |[5] p |.
% |[6] l | o |[][o]t |[7][l]m| u |.
% | o |[][fl]s|[8][l]a | l |[][o]t |.
% \end{Puzzle}%
% \end{minipage}%
% \begin{minipage}{.6\textwidth}
% \begin{PuzzleClues}{Across}%
% \Clue{1}{CC}{unit of measure}%
% \Clue{3}{EXP}{math function}%
% \Clue{6}{LOT}{list of tables}%
% \Clue{7}{MU}{$\mu$}%
% \Clue{8}{ALT}{key}%
% \end{PuzzleClues}%
% \begin{PuzzleClues}{Down}%
% \Clue{1}{CLO}{class option}%
% \Clue{2}{COS}{math function}%
% \Clue{3}{ETA}{\(\eta\)}%
% \Clue{4}{XML}{all in angle brackets}%
% \Clue{5}{PUT}{\LaTeX\ place picture element}%
% \end{PuzzleClues}%
% \end{minipage}
%
% In the example above we can see another feature. This feature is
% that two letters are circled. This can be used to indicate
% letters for a solution word of the crossword puzzle.
%
%
%
% \subsection{Solutions}
%
% \PuzzleSolution
% \begin{minipage}{.35\textwidth}%
% \begin{Puzzle}{5}{3}%
% |* |* |[1]E|X |* |.
% |[2]A|[3]S|T |* |[4]T|.
% |* |[5]P|A |R |T |.
% \end{Puzzle}%
% \end{minipage}%
% \begin{minipage}{.6\textwidth}
% \end{minipage}\medskip
%
% Often it is not only desirable to typeset the unsolved crossword
% puzzle but also the solution. This means that all the letters
% have to be filled in. This should be possible with the same
% source as the questions to avoid typos or redundancies leading to
% additional work.
%
% Several variants of solutions come to mind. Primarily the
% solution should show the letters and suppress any clues. One
% major distinction is also whether or not the numbers of the words
% should be shown in the solution as well.\medskip
%
% \noindent
% \PuzzleSolution[true]%
% \begin{minipage}{.35\textwidth}%
% \begin{Puzzle}{5}{3}%
% |* |* |[1]E|X |* |.
% |[2]A|[3]S|T |* |[4]T|.
% |* |[5]P|A |R |T |.
% \end{Puzzle}%
% \end{minipage}%
% \begin{minipage}{.6\textwidth}
% \end{minipage}%
%
% Finally there are the lists of letters in numbered puzzles. In
% the solution they will show the letters in them as well.\medskip
%
% \noindent
% \PuzzleSolution[false]%
% \begin{minipage}{.35\textwidth}%
% \begin{Puzzle}{5}{3}%
% |* |* |[6]E|[1]X|* |.
% |[5]A|[2]S|[7]T|* |[7]T|.
% |* |[4]P|[5]A|[3]R|[7]T|.
% \end{Puzzle}%
% \end{minipage}%
% \begin{minipage}{.6\textwidth}
% \PuzzleLetters{AEPRSTX}\medskip\par
% \PuzzleNumbers{XSRPAET}%
% \end{minipage}
%
%
% \section{Input of Crossword Puzzles}
%
% The basic idea behind this package is that a crossword puzzle is
% specified in a separate file. The actual appearance of the puzzle
% is controlled by several options. Thus it should be possible to
% produce the unsolved and the solved puzzle from the same
% source. Before we describe the various options we will have a
% look at the basic environments and macros used to specified a
% crossword puzzle.
%
% \DescribeEnv{Puzzle}%
% This package provides the environment |Puzzle| which typesets the
% frame of a crossword puzzle. This environment takes two
% arguments. These arguments are the number of columns and the
% number of the rows of the puzzle. This means that essentially
% only rectangular puzzles can be typeset.
%
% The example from section~\ref{sec:classical} has been entered as
% follows:
% \begin{verbatim}
% \begin{Puzzle}{5}{3}%
% |* |* |[1]E|X |* |.
% |[2]A|[3]S|T |* |[4]T|.
% |* |[5]P|A |R |T |.
% \end{Puzzle}
% \end{verbatim}
% In this example we can see that inside the |Puzzle| environment
% there is one special character. This is the bar \verb/|/. This
% bar is an active character in \TeX. Thus you can think of it
% like a macro.
%
% The \verb/|/ macro takes three arguments. The first two arguments
% are optional, i.e. enclosed in brackets if present. The first
% optional argument denotes the number for numbered boxes. The
% second optional argument specifies the formatting of the cell.
%
% The third argument is either empty |{}| or it consists of a
% single character. This argument describes the action to be
% performed.
%
% \begin{itemize}
% \item If this argument is a letter then it is simply shown
% in the solution and suppressed in the unsolved crossword puzzle.
%
% \item If this argument is an asterisk |*| then a black box is
% produced.
%
% \item If this argument is a dot |.| then this marks the end of
% the current row. The next box is typeset at the beginning of the
% following row.
%
% \item If this argument is empty |{}| then a white box is
% typeset. This box does not contain a letter, nor does it have a
% frame. This macro can be used to leave room for larger boxed with
% ads. Alternatively this can be used to disable certain boxes to
% make a non-rectangular crossword puzzle.
% \end{itemize}
%
% \begin{verbatim}
% \begin{Puzzle}{5}{5}
% |{} |{} |[1]S|.
% |{} |[2]M|I |[3]D|.
% |[4]T|I |M |E |S |.
% |{} |[5]N|E |G |.
% |{} |{} |Q |.
% \end{Puzzle}
% \end{verbatim}
% \PuzzleUnsolved
% \begin{minipage}{.35\textwidth}%
% \begin{Puzzle}{5}{5}%
% |{} |{} |[1]S|.
% |{} |[2]M|I |[3]D|.
% |[4]T|I |M |E |S |.
% |{} |[5]N|E |G |.
% |{} |{} |Q |.
% \end{Puzzle}%
% \end{minipage}%
% \begin{minipage}{.6\textwidth}
% \begin{PuzzleClues}{\textbf{Across: }}%
% \Clue{2}{MID}{\(\mid\)}%
% \Clue{4}{TIMES}{\(\times\)}%
% \Clue{5}{NEG}{\(\neg\)}%
% \end{PuzzleClues}%
% \begin{PuzzleClues}{\textbf{Down: }}%
% \Clue{1}{SIMEQ}{\(\simeq\)}%
% \Clue{2}{MIN}{log-like function}%
% \Clue{3}{DEG}{log-like function}%
% \end{PuzzleClues}%
% \end{minipage}%
%
% Note that white-space is ignored after the arguments but not
% between the bar and the arguments.
% \bigskip
%
% The formatting of the cell is controlled by the second optional
% argument of the \verb/|/ macro. This optional argument may
% contain a list of several characters. Each of these characters is
% interpreted from left to right. The following list describes the
% meaning of the built-in characters.\medskip
%
% \PuzzleUnsolved
% \newenvironment{CellLetter}[1]{\par\noindent
% \begin{minipage}{.25\textwidth}
% \let\PuzzlePre\relax
% \let\PuzzlePost\relax
% \begin{Puzzle}{1}{1}|[8][#1]X
% \end{Puzzle}\tt\quad
% \char`\|[8][#1]X
% \end{minipage}%
% \begin{minipage}{.7\textwidth}
% }{\end{minipage}\smallskip}%
% \begin{CellLetter}{f}
% The letter f produces a simple frame around the cell. This is
% the default if nothing is specified.
% \end{CellLetter}%
% \begin{CellLetter}{.}
% The character . produces no additional rendering it can be used
% to overwrite the default rendering which is to place a frame
% around the cell.
% \end{CellLetter}%
% \begin{CellLetter}{*}
% The character * produces a black box. This is the same effect
% which can be achieved by providing the character * to be filled
% into the cell for the solution.
% \end{CellLetter}%
% \begin{CellLetter}{O}
% The letter O produces an oval as drawn with the \LaTeX\ macro
% \verb/\oval/.
% \end{CellLetter}%
% \begin{CellLetter}{o}
% The letter o produces an oval inside a frame. T is is an
% abbreviation for the two letters fO.
% \end{CellLetter}%
% \begin{CellLetter}{t}
% The letter t produces a frame with a thicker line at the top.
% The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \end{CellLetter}%
% \begin{CellLetter}{T}
% The letter T produces a thicker line at the top of the cell.
% The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \end{CellLetter}%
% \begin{CellLetter}{b}
% The letter b produces a frame with a thicker line at the bottom.
% The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \end{CellLetter}%
% \begin{CellLetter}{B}
% The letter B produces a thicker line at the bottom of the cell.
% The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \end{CellLetter}%
% \begin{CellLetter}{l}
% The letter l produces a frame with a thicker line at the left
% side of the cell. The thickness of this line is controlled by
% the macro |\PuzzleThickline|.
% \end{CellLetter}%
% \begin{CellLetter}{L}
% The letter L produces a thicker line at the left side of the
% cell. The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \end{CellLetter}%
% \begin{CellLetter}{r}
% The letter r produces a frame with a thicker line at the right
% side of the cell. The thickness of this line is controlled by
% the macro |\PuzzleThickline|.
% \end{CellLetter}%
% \begin{CellLetter}{R}
% The letter R produces a thicker line at the right side of the
% cell. The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \end{CellLetter}%
% \begin{CellLetter}{/}
% The character / produces a line crossing the cell from lower
% left to upper right.
% \end{CellLetter}%
% \begin{CellLetter}{,}
% The character , produces a line crossing the cell from upper
% left to lower right.
% \end{CellLetter}%
% \begin{CellLetter}{S}
% The character S produces the solution, i.e. the content of the
% cell is typeset. No decorations are placed around. For this
% purpose it should be combined with some other formatting
% characters.
% \end{CellLetter}%
%
% Whenever you try to use an undefined specification for the cell
% frame a warning is printed and the letter is ignored.
%
% \DescribeMacro{\PuzzleDefineCell}
% You can define additional cell renderings of your own. For this
% purpose the macro |\PuzzleDefineCell| is provided. It takes two
% arguments. The first argument contains the key under which the
% rendering should be addressed in the optional second argument of
% the macro \verb/|/. The second argument contains the replacement
% text like in |\newcommand|. This replacement text can make use of
% two arguments. They are addressed with |#1| and |#2|. The first
% one contains the x coordinate of the cell to be rendered. The
% second one its y coordinate.
%
% The following example shows for instance the definition of a new
% cell type addressed by the key + which draws a thick frame around
% the cell.
% \begin{verbatim}
% \PuzzleDefineCell{+}{
% \PuzzleThicklines
% \put(#1,#2){\framebox(1,1){}}
% }
% \end{verbatim}
%
%
% Finally we show how to define a cell type consisting of a colored
% box. The box itself is drawn with the help of the macro
% |\colorbox|. Thus it is necessary to load the package
% \texttt{color} which defines this macro.
%
% The two invocations show the combination with the f specifier.
% The specifier f is the default and used only if the user does not
% provide the optional argument. Thus we need to provide the f we
% we want to have it additionally.\medskip
%
% \noindent
% \begin{minipage}{.65\textwidth}\small
% \begin{verbatim}
% \definecolor{gray}{gray}{.9}
% \PuzzleDefineCell{c}{{%
% \put(#1,#2){\makebox(1,1){%
% \fboxsep=0pt
% \colorbox{gray}{\makebox(1,1){}}}}
% }}
% \begin{Puzzle}{2}{2}
% |[1][cf]X | {} |.
% |{} |[2][c]X |.
% \end{Puzzle}
% \end{verbatim}
% \end{minipage}\hfill
% \begin{minipage}{.30\textwidth}
% \definecolor{gray}{gray}{.9}
% \PuzzleDefineCell{c}{{%
% \fboxsep=0pt
% \put(#1,#2){\makebox(1,1){\colorbox{gray}{\makebox(1,1){}}}}
% }}
% \begin{Puzzle}{2}{2}
% |[1][cf]X | {} |.
% |{} |[2][c]X |.
% \end{Puzzle}
% \end{minipage}
%
% \DescribeMacro{\DefineColorCell}
% The macro |\DefineColorCell| simplifies this task by
% encapsulating the definition above. It has two arguments. The
% first one is the key character and the second one is th name of
% the color to use for the background.\medskip
%
% \noindent
% \begin{minipage}{.65\textwidth}\small
% \begin{verbatim}
% \definecolor{gray}{gray}{.9}
% \PuzzleDefineColorCell{g}{gray}
% \begin{Puzzle}{2}{2}
% |{} |[1][cf]X |.
% |[2][c]X |{} |.
% \end{Puzzle}
% \end{verbatim}
% \end{minipage}\hfill
% \begin{minipage}{.30\textwidth}
% \definecolor{gray}{gray}{.9}
% \PuzzleDefineColorCell{g}{gray}
% \begin{Puzzle}{2}{2}
% |{} |[1][cf]X |.
% |[2][c]X |{} |.
% \end{Puzzle}
% \end{minipage}
%
% \DescribeMacro{\Frame}
% The macro |\Frame| can be used to typeset ads or other text into
% larger boxes inside the frame of the crossword puzzle. For this
% purpose five arguments are required. The first two arguments are
% used to specify the lower left corner of the frame. The lower
% left corner has the coordinates 0,0 and the numbers increase
% upwards and to the right.
%
% The third argument is the width of the frame and the fourth
% argument is the height of the frame measured in number of boxes.
% Finally, the fifth argument contains the text to be typeset. Per
% default it is typeset in a mini-page of the appropriate width
% centered horizontally and vertically.
%
% \begin{verbatim}
% \begin{Puzzle}{8}{6}
% \Frame{2}{2}{4}{2}{\sf Crossword\\Puzzle}
% |[1]E|* |[2]N |U |L |[3]L |* |[4]V|.
% |[5]T|[6]R|I |A |N |G |[7]L|E |.
% |A |U |{} |{} |{} |{} |[8]C|C |.
% |* |L |{} |{} |{} |{} |E |* |.
% |[9]B|E |T |[10]A|* |[11]L|I |M |.
% |F |* |[12]L|A |B |E |L |* |.
% \end{Puzzle}
% \end{verbatim}
%
% \PuzzleUnsolved\noindent
% \begin{minipage}{.5\textwidth}\PuzzleUnitlength=18pt
% \begin{Puzzle}{8}{6}%
% \Frame{2}{2}{4}{2}{\sf Crossword\\Puzzle}%
% |[1]E|* |[2]N|U|L|[3]L|* |[4]V|.
% |[5]T|[6]R|I|A|N|G|[7]L|E|.
% |A|U|{}|{}|{}|{}|[8]C|C|.
% |* |L|{}|{}|{}|{}|E|* |.
% |[9]B|E|T|[10]A|* |[11]L|I|M|.
% |F|* |[12]L|A|B|E|L|* |.
% \end{Puzzle}%
% \end{minipage}%
% \begin{minipage}{.47\textwidth}
% \begin{PuzzleClues}{\textbf{Across: }}%
% \Clue{2}{NULL}{empty}%
% \Clue{5}{TRIANGLE}{\(\triangle\)}%
% \Clue{8}{CC}{carbon copy (letter.sty)}%
% \Clue{9}{BETA}{\(\beta\)}%
% \Clue{11}{LIM}{limes}%
% \Clue{12}{LABEL}{mark it}%
% \end{PuzzleClues}%
% \begin{PuzzleClues}{\textbf{Down: }}%
% \Clue{1}{ETA}{\(\eta\)}%
% \Clue{2}{NI}{\(\ni\)}%
% \Clue{3}{LG}{logarithm}%
% \Clue{4}{VEC}{\(\vec{}\)}%
% \Clue{6}{RULE}{black rectangle}%
% \Clue{7}{LCEIL}{\(\lceil\)}%
% \Clue{9}{BF}{bold face}%
% \Clue{10}{AA}{\AA}%
% \Clue{11}{LE}{\(\le\)}%
% \end{PuzzleClues}%
% \end{minipage}%
%
% \DescribeEnv{PuzzleClues}
% The clues in the classical crossword puzzle are typeset with the
% use of the environment |PuzzleClues|. This environment takes one
% argument which is typeset before the clues. The environment takes
% roughly the half of the text width and make a mini-page with this
% width. Thus two invocations of this environment are typeset side
% by side.
%
% Alternatively if the solution is typeset then the environment
% |PuzzleClues| has no effect.
%
% \begin{verbatim}
% \begin{PuzzleClues}{\textbf{Across}}%
% \Clue{1}{EX}{unit of measure}%
% \Clue{2}{AST}{\(\ast\)}%
% \Clue{5}{PART}{sectioning unit}%
% \end{PuzzleClues}%
% \begin{PuzzleClues}{\textbf{Down}}%
% \Clue{1}{ETA}{\(\eta\)}%
% \Clue{3}{SP}{unit of measure}%
% \Clue{4}{TT}{nonproportional font}%
% \end{PuzzleClues}%
% \end{verbatim}
%
% \DescribeMacro{Clue}
% The environment |PuzzleClues| defines one local macro. This macro
% is named |\Clue| and takes three arguments. The first argument is
% the number of the word. This should correspond to the number in
% the puzzle frame. The second argument is the word itself.
% Currently this not used at all. Finally the third argument is the
% clue for the word.
%
% If the unsolved puzzle is typeset then the first and the third
% argument are used. Otherwise all arguments are silently absorbed.
%
% \DescribeMacro{\PuzzleLetters}
% The macro |\PuzzleLetters| can be used to typeset the list of
% used letters in numbered crossword puzzles. It has one argument
% which are the used letters (preferably in alphabetical order.
%
% \DescribeMacro{\PuzzleNumbers}
% The macro |\PuzzleNumbers| can be used to generate a numbered
% list of boxes for the numbered crossword puzzles. The user is
% supposed to collect the found letters here.
%
% \DescribeEnv{PuzzleWords}
% The environment |PuzzleWords| can be sued to typeset the list of
% words for a fill-in puzzle. It takes one argument. This is the
% length of the words listed. For each length there should be an
% invocation of this environment. The words in this environment are
% supposed to be ordered alphabetically.
%
% \DescribeMacro{\Word}
% The macro |\Word| is defined inside the environment
% |PuzzleWords|. It takes one argument which is the word itself.
%
% \begin{verbatim}
% \begin{PuzzleWords}{2}
% \Word{EX}%
% \Word{SP}%
% \Word{TT}%
% \end{PuzzleWords}%
% \begin{PuzzleWords}{3}
% \Word{AST}%
% \Word{ETA}%
% \end{PuzzleWords}%
% \begin{PuzzleWords}{4}
% \Word{PART}%
% \end{PuzzleWords}%
% \end{verbatim}
%
%
% \section{Other Grid-based Puzzles}
%
% In addition to the crossword puzzles other puzzles based on a
% grid can also be typeset with this package. The basic principle
% is the same. Just some minor simplifications have been provided.
%
% \subsection{Sudoku}
%
% A Sudoku is a puzzle on a $9\times9$ grid. It is filled with nine
% numbers. Each number occurs only once in each row, each column
% and each of the nine $3\times3$ boxes. Initially some of the
% numbers are shown. The goal is to fill in all missing digits.
% \medskip
%
% \begin{Sudoku}
% | 7|*2| 4| 1| 3| 5| 6|*9| 8|.
% |*3| 8|*1|*9| 7|*6|*5| 4|*2|.
% | 9| 6| 5|*8| 2|*4| 1| 3| 7|.
% | 2|*9| 6| 7| 1| 8| 3|*5| 4|.
% |*5| 1| 8|*2| 4|*3| 9| 7|*6|.
% | 4|*7| 3| 6| 5| 9| 8|*2| 1|.
% | 6| 3| 9|*4| 8|*7| 2| 1| 5|.
% |*8| 4|*2|*5| 9|*1|*7| 6|*3|.
% | 1|*5| 7| 3| 6| 2| 4|*8| 9|.
% \end{Sudoku}
%
% \DescribeEnv{Sudoku}
% The input for a Sudoku is given in a specialized environment.
% Since the size is fixed there is no need to specify a size. We
% separate the cells with a pipe symbol and mark the end of a line
% with a dot. To mark those cells contianing the hints we preceed
% the number with an asterisk.
%
% The Sudoku shown above is typeset from the following source:
%
% \begin{verbatim}
% \begin{Sudoku}
% | 7|*2| 4| 1| 3| 5| 6|*9| 8|.
% |*3| 8|*1|*9| 7|*6|*5| 4|*2|.
% | 9| 6| 5|*8| 2|*4| 1| 3| 7|.
% | 2|*9| 6| 7| 1| 8| 3|*5| 4|.
% |*5| 1| 8|*2| 4|*3| 9| 7|*6|.
% | 4|*7| 3| 6| 5| 9| 8|*2| 1|.
% | 6| 3| 9|*4| 8|*7| 2| 1| 5|.
% |*8| 4|*2|*5| 9|*1|*7| 6|*3|.
% | 1|*5| 7| 3| 6| 2| 4|*8| 9|.
% \end{Sudoku}
% \end{verbatim}
%
% As for crossword puzzles the macro |\PuzzleSolution| can be used
% to switch to solution mode. Then all numbers are shown. The
% parameters to modify the appearance of a puzzle work here as well. \medskip
%
% {\PuzzleSolution\PuzzleUnitlength=14pt\footnotesize\sf
% \begin{Sudoku}
% | 7|*2| 4| 1| 3| 5| 6|*9| 8|.
% |*3| 8|*1|*9| 7|*6|*5| 4|*2|.
% | 9| 6| 5|*8| 2|*4| 1| 3| 7|.
% | 2|*9| 6| 7| 1| 8| 3|*5| 4|.
% |*5| 1| 8|*2| 4|*3| 9| 7|*6|.
% | 4|*7| 3| 6| 5| 9| 8|*2| 1|.
% | 6| 3| 9|*4| 8|*7| 2| 1| 5|.
% |*8| 4|*2|*5| 9|*1|*7| 6|*3|.
% | 1|*5| 7| 3| 6| 2| 4|*8| 9|.
% \end{Sudoku}}
%
% Since the characters in the solution are numbers only we can use
% the following definition to colorize the cells in the solution.
%
% \begin{verbatim}
% \def\PuzzleSolutionContent#1{\fboxsep=0pt
% \def\myColor{}%
% \ifcase#1
% \def\myColor{white}%0
% \or\def\myColor{red}%1
% \or\def\myColor{green}%2
% \or\def\myColor{yellow}%3
% \or\def\myColor{orange}%4
% \or\def\myColor{lime}%5
% \or\def\myColor{purple}%6
% \or\def\myColor{violet}%7
% \or\def\myColor{teal}%8
% \or\def\myColor{brown}%9
% \else\def\myColor{white}%*
% \fi
% \colorbox{\myColor}{\makebox(1,1){#1}}}
% \end{verbatim}
%
% With the help of the package \textsf{xcolor} for the predefined
% colors we get the following output: \medskip
%
% {\def\PuzzleSolutionContent#1{\fboxsep=0pt
% \def\myColor{}\ifcase#1
% \def\myColor{white}\or\def\myColor{red}\or\def\myColor{green}\or\def\myColor{yellow}\or\def\myColor{orange}\or\def\myColor{lime}\or\def\myColor{purple}\or\def\myColor{violet}\or\def\myColor{teal}\or\def\myColor{brown}\else\def\myColor{white}\fi
% \colorbox{\myColor}{\makebox(1,1){#1}}}
% \PuzzleSolution\PuzzleUnitlength=14pt\footnotesize\sf
% \begin{Sudoku}
% | 7|*2| 4| 1| 3| 5| 6|*9| 8|.
% |*3| 8|*1|*9| 7|*6|*5| 4|*2|.
% | 9| 6| 5|*8| 2|*4| 1| 3| 7|.
% | 2|*9| 6| 7| 1| 8| 3|*5| 4|.
% |*5| 1| 8|*2| 4|*3| 9| 7|*6|.
% | 4|*7| 3| 6| 5| 9| 8|*2| 1|.
% | 6| 3| 9|*4| 8|*7| 2| 1| 5|.
% |*8| 4|*2|*5| 9|*1|*7| 6|*3|.
% | 1|*5| 7| 3| 6| 2| 4|*8| 9|.
% \end{Sudoku}}
%
% Note that this definition has to be restricted to a local block
% if you have solutions for other puzzle types in the same
% document.
%
%
% \subsection{Kakuro}
%
% In a Kakuro the cells are filled with digits. Each ``word''
% consists of different digits; i.e. a number can not be repeated
% in a consecutive horizontal or vertical sequence of numbers.
%
% The hints for the ``words'' are the sums of the digits.
%
% \begin{Kakuro}{6}{9}
% | - |<:13> |<:37> | - |<:41> |<:7> | - |.
% |<4:> |* 3 | 1 |<14:> | 8 | 6 | - |.
% |<13:> | 9 |* 7 |<3:20>| 2 | 1 | - |.
% |<11:> | 1 | 2 | 3 | 5 | - | - |.
% | - |<23:> | 6 |* 8 | 9 | - | - |.
% | - |<29:3>| 8 | 9 | 7 | 5 | - |.
% |<11:> | 2 | 9 |<6:> |* 4 | 2 | - |.
% |<5:> |* 1 | 4 |<7:> | 6 | 1 | - |.
% | - | - | - | - | - | - | - |.
% \end{Kakuro}
%
% \DescribeEnv{Kakuro}
% The input for a Kakuro is given in a specialized environment. It
% takes the width and the height as arguments.
% We separate the cells with a pipe symbol and mark the end of a line
% with a dot. To mark those cells contianing the initial digits we
% preceed the digit with an asterisk.
%
% The hints are enteres in angle brackets. They contain the
% horizontal and vertical sums separated by a colon. The sums can
% be empty if none should be typeset.
%
% The Kakuro shown above is typeset from the following source:
%
% \begin{verbatim}
% \begin{Kakuro}{6}{9}
% | - |<:13> |<:37> | - |<:41> |<:7> | - |.
% |<4:> |* 3 | 1 |<14:> | 8 | 6 | - |.
% |<13:> | 9 |* 7 |<3:20>| 2 | 1 | - |.
% |<11:> | 1 | 2 | 3 | 5 | - | - |.
% | - |<23:> | 6 |* 8 | 9 | - | - |.
% | - |<29:3>| 8 | 9 | 7 | 5 | - |.
% |<11:> | 2 | 9 |<6:> |* 4 | 2 | - |.
% |<5:> | 1 | 4 |<7:> | 6 | 1 | - |.
% | - | - | - | - | - | - | - |.
% \end{Kakuro}
% \end{verbatim}
%
% As for crossword puzzles the macro |\PuzzleSolution| can be used
% to switch to solution mode. Then all numbers are shown.
%
% \begin{minipage}{.25\textwidth}
% {\PuzzleSolution
% \PuzzleUnitlength=14pt
% \footnotesize\sf
% \begin{Kakuro}{6}{9}
% | - |<:13> |<:37> | - |<:41> |<:7> | - |.
% |<4:> |* 3 | 1 |<14:> | 8 | 6 | - |.
% |<13:> | 9 |* 7 |<3:20>| 2 | 1 | - |.
% |<11:> | 1 | 2 | 3 | 5 | - | - |.
% | - |<23:> | 6 |* 8 | 9 | - | - |.
% | - |<29:3>| 8 | 9 | 7 | 5 | - |.
% |<11:> | 2 | 9 |<6:> |* 4 | 2 | - |.
% |<5:> | 1 | 4 |<7:> | 6 | 1 | - |.
% | - | - | - | - | - | - | - |.
% \end{Kakuro}}
% \end{minipage}\hfill
% \begin{minipage}{.7\textwidth}\footnotesize
% \begin{verbatim}
% \PuzzleSolution
% \PuzzleUnitlength=14pt
% \footnotesize\sf
% \begin{Kakuro}{6}{9}
% | - |<:13> |<:37>| - |<:41>|<:7> | - |.
% |<4:> |* 3 | 1 |<14:> | 8 | 6 | - |.
% |<13:>| 9 |* 7 |<3:20>| 2 | 1 | - |.
% |<11:>| 1 | 2 | 3 | 5 | - | - |.
% | - |<23:> | 6 |* 8 | 9 | - | - |.
% | - |<29:3>| 8 | 9 | 7 | 5 | - |.
% |<11:>| 2 | 9 |<6:> |* 4 | 2 | - |.
% |<5:> | 1 | 4 |<7:> | 6 | 1 | - |.
% | - | - | - | - | - | - | - |.
% \end{Kakuro}
% \end{verbatim}
% \end{minipage}
%
%
% \section{Parameters and Options}
%
% The package cwpuzzle can be controlled by a rich set of macros.
% In addition some settings can be performed with style options. The
% following style options are recognized:
% \begin{description}
% \item [numbered]
% The solution numbering is turned on.
% \item [nocenter]
% The puzzle is not typeset in a centered paragraph of its own.
% \item [unboxed]
% The clues are not enclosed in mini-pages and centered on the
% page.
% \item [normalsize]
% The puzzle is set in normalsize. This is the default.
% \item [small]
% The puzzle is set in small. The size of the cell and the font
% size of the solution are adjusted accordingly.
% \item [large]
% The puzzle is set in large. The size of the cell and the font
% size of the solution are adjusted accordingly.
% \item [german]
% \item [ngerman]
% The build in texts are switched to german variants. The
% defaults are English. This options is also in effect when given
% to the document class. The style inherits it from there.
% \end{description}
%
% The style options can be passed to the style in the usual way:
% \begin{verbatim}
% \usepackage[nocenter,unboxed,small]{cwpuzzle}
% \end{verbatim}
%
% The fine tuning can be achieved with the help of several macros.
% Those macros are described below.
%
% \DescribeMacro{\PuzzleUnitlength}
% The length |\PuzzleUnitlength| determines the width and height of
% each single box in the frame of a crossword puzzle. The default
% value is |20pt|.
%
% \DescribeMacro{\PuzzleBlackBox}
% The macro |\PuzzleBlackBox| contains the commands to produce the
% black boxes. It has to produce at most of width and height of
% |\PuzzleUnitlength|. Per default it just produces a black
% rectangle of this size.
%
% The following list shows some variants which can be achieved by
% redefining the macro |\PuzzleBlackBox|.\medskip
%
% \noindent
% \unitlength=\PuzzleUnitlength
% \framebox(1,1){\rule{.75\PuzzleUnitlength}{.75\PuzzleUnitlength}}
% \hfill
% \begin{minipage}{.9\textwidth}
% \begin{verbatim}
% \renewcommand{\PuzzleBlackBox}{\rule{.75\PuzzleUnitlength}%
% {.75\PuzzleUnitlength}}
% \end{verbatim}
% \end{minipage}
%
% \noindent
% \framebox(1,1){\framebox(.75,.75){\framebox(.5,.5){}}}
% \hfill
% \begin{minipage}{.9\textwidth}
% \begin{verbatim}
% \renewcommand{\PuzzleBlackBox}{\framebox(.75,.75){%
% \framebox(.5,.5){}}}
% \end{verbatim}
% \end{minipage}
%
% Additional effects can be achieved by using shades of gray (with
% the |graphics| package).
%
% \DescribeMacro{\PuzzleFont}
% The macro |\PuzzleFont| contains the font changing
% command issued before the frame of the crossword puzzle.
%
% \DescribeMacro{\PuzzleNumberFont}
% The macro |\PuzzleNumberFont| contains the font changing
% command issued before a number in the frame of the crossword
% puzzle is typeset.
%
% \DescribeMacro{\PuzzleClueFont}
% The macro |\PuzzleClueFont| contains the font changing
% command issued before the clues are typeset.
%
% \DescribeMacro{\PuzzleWordsText}
% The macro |\PuzzleWordsText| contains the text which is typeset
% at the beginning of the environment |PuzzleWords|. It has one
% argument which contains the length of the words listed.
%
% \DescribeMacro{\PuzzleLettersText}
% The macro |\PuzzleLettersText| contains the text which is typeset
% at the beginning of the macro |\PuzzleLetters|.
%
% \DescribeMacro{\PuzzleSolution}
% The macro |\PuzzleSolution| arranges everything that the
% following puzzles are typeset in the ``solution'' mode, i.e. the
% letters are shown and the clues are suppressed.
%
% This macros has one optional argument which has to be |true| or
% |false|. This argument determines whether or not the numbers
% should also be shown in the solution. The default is |false|
% which means that the numbers are suppressed in the solution.
%
% \DescribeMacro{\PuzzleUnsolved}
% The macro |\PuzzleUnsolved| arranges everything that the
% following puzzles are typeset in the ``unsolved'' mode, i.e. the
% letters are suppressed and the clues are shown.
%
% \DescribeMacro{\PuzzlePutNumber}
% The macro |\PuzzlePutNumber| is a configuration macro which
% typesets the number in a cell. The first argument is the x
% coordinate. The second argument is the y coordinate. The third
% argument is the number to be typeset. The coordinates are integer
% numbers. The coordinate (0,0) is the lower left corner.
%
% \DescribeMacro{\PuzzleHook}
% The macro |\PuzzleHook| is called at the end of the |Puzzle|
% environment. It can be used to place additional graphical
% elements in the puzzle frame.
%
% The following example shows a crossword puzzle which we have seen
% before and the definition for the |\PuzzleHook|.\medskip
%
% \PuzzleUnsolved
% \begin{minipage}{.35\textwidth}%
% \newcommand\PuzzleHook{%
% \put(0,2){\line(1,-1){2}}
% \put(0,3){\line(1,1){2}}
% \put(5,2){\line(-1,-1){2}}
% \put(5,3){\line(-1,1){2}}
% }
% \begin{Puzzle}{5}{5}%
% |{} |{} |[1]S|.
% |{} |[2]M|I |[3]D|.
% |[4]T|I |M |E |S |.
% |{} |[5]N|E |G |.
% |{} |{} |Q |.
% \end{Puzzle}%
% \end{minipage}%
% \begin{minipage}{.6\textwidth}
% \begin{verbatim}
% \newcommand\PuzzleHook{
% \put(0,2){\line(1,-1){2}}
% \put(0,3){\line(1,1){2}}
% \put(5,2){\line(-1,-1){2}}
% \put(5,3){\line(-1,1){2}}
% }
% \end{verbatim}
% \end{minipage}
%
% \DescribeMacro{\PuzzleLineThickness}
% The macro |\PuzzleLineThickness| contains the width of the line
% used to frame the cells.
%
% \DescribeMacro{\PuzzlePre}
% This macro contains the code to be inserted before a puzzle is
% typeset. It is initialized to begin a new paragraph and center the
% puzzle.
%
% \DescribeMacro{\PuzzlePost}
% This macro contains the code to be inserted after a puzzle is
% typeset. It is initialized to end the paragraph and center the
% puzzle.
%
% \DescribeMacro{\PuzzleCluePre}
% This macro contains the code to be inserted before the clues are
% typeset in normal mode. It is initialized to end the paragraph
% and center the puzzle.
%
% \DescribeMacro{\PuzzleCluePost}
% This macro contains the code to be inserted after the clues are
% typeset in normal mode. It is initialized to end the paragraph
% and center the puzzle.
%
% \DescribeMacro{\PuzzleContent}
% This macro contains the content of a cell during formatting this
% cell. This enables the cell formating macro to access it.
%
% \DescribeMacro{\PuzzleSolutionContent}
% This macro processes the letter in solution mode. It takes one
% argument, the letter. This macro can be redefinied to achieve
% special effects for the solution.
%
% \DescribeMacro{\SudokuLinethickness}
% This macro contains the thickness of the thick lines in a sudoku.
%
% \DescribeMacro{\KakuroNumberFont}
% This macro contains the definition of the font switching macros
% used when typesetting a Kakuro hint.
%
% \DescribeMacro{\KakuroHintTypeKakuroNumberFont}
% This macro contains the cell type used when typesetting a Kakuro
% hint. It can be used to redefine the appearance.
%
%
%
% \section{Further Plans}
%
% \subsection{General}
%
% Maybe I will add a mode for further variants of crossword puzzles
% sometimes.
%
% Maybe I can add support for further languages if someone provides
% the appropriate texts. Contributions are welcome.
%
%
% \subsection{The Related Program}
%
% There is a related program written in Perl/Tk. This program can be
% used to manually construct crossword puzzles and save them in a
% format suitable for this package.
% Other features include the creation of a proper frame and filling
% with words.
%
% Right now I have not prepared a distribution of this program yet
% since this program requires dictionaries which I can not
% distribute legally.
%
% The crossword examples in this documentation have been computed
% with the help of the |cwp| program.
%
%
% \StopEventually{}
% \newpage
%
%
% \section{The Implementation}
%
% The crossword puzzle is basically implemented with the \LaTeX{}
% picture environment. This gives us enough flexibility and
% provides an high enough abstraction such that we do not have to
% fiddle around with to many low level details.
%
% The natural unit in a crossword puzzle is a box which is empty
% or black. Thus the |unitlength| is set to the width (and height)
% of such a box.
%
%
% \subsection{Basic Definitions and Parameters}
%
% First we identify this package.
%
% \begin{macrocode}
\ProvidesPackage{cwpuzzle}[\filedate gene]
% \end{macrocode}
% Next we load the package amssymb beended for the triangles used
% in Kakuros
% \begin{macrocode}
\RequirePackage{amssymb}
% \end{macrocode}
%
% The dimen register |\PuzzleUnitlength| stores the height and
% width of a box of the puzzle. The default is |20pt| which is
% also shown in this documentation.
% \begin{macrocode}
\newdimen\PuzzleUnitlength
\PuzzleUnitlength=20pt
% \end{macrocode}
%
% \begin{macro}{\PuzzleClueFont}
%
% The macro |\PuzzleClueFont| contains font changing
% commands issued before the clues are typeset.
% \begin{macrocode}
\newcommand\PuzzleClueFont{\footnotesize}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzleFont}
%
% The macro |\PuzzleFont| contains font changing
% commands issued before the puzzle is typeset.
% \begin{macrocode}
\newcommand\PuzzleFont{\rm\normalsize}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzleNumberFont}
% The macro |\PuzzleNumberFont| contains font changing
% commands issued before the numbers in a puzzle are typeset.
% \begin{macrocode}
\newcommand\PuzzleNumberFont{\sf\scriptsize}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzleHook}
% Puzzles are typeset with the \LaTeX{} picture environment. At the
% end of this environment the macro |\PuzzleHook| is
% called. The package produces an empty default. Users may want to
% use this place to typeset additional elements on top of the
% puzzle.
%
% The puzzle uses a |\unitlength| of |\PuzzleUnitlength|. Thus it
% is rather easy to address the boxes in the puzzle.
%
% \begin{macrocode}
\let\PuzzleHook=\relax
% \end{macrocode}
% \end{macro}
%
% \subsection{The Frame of the Crossword Puzzle}
%
% To describe the coordinates where the next box should be typeset
% we need two counters for the coordinates. These counters are now
% allocated (even though we could use temporary counters from
% \LaTeX).
% \begin{macrocode}
\newcount\Puzzle@X
\newcount\Puzzle@Y
% \end{macrocode}
%
% \begin{macrocode}
\begingroup
\catcode`\|=13
\gdef\Puzzle@@solution{
\let|=\Puzzle@Box@@solution
\let\Frame=\Puzzle@Frame@@solution
}
% \end{macrocode}
%
% \begin{macrocode}
\gdef\Puzzle@@normal{
\let|=\Puzzle@Box@@normal
\let\Frame=\Puzzle@Frame@@normal
}
\endgroup
% \end{macrocode}
%
% \begin{environment}{Puzzle}
% The environment |Puzzle| typesets the frame of a crossword
% puzzle. It is implemented utilizing a |picture| environment. The
% unitlength is set to the |\PuzzleUnitlength|. Thus the navigation
% is fairly easy. The basic unit is width and height of a single
% box.
%
% The macros which are local to the environment are activated. Thus
% we avoid collisions with other packages where the same macro names
% might be used.
%
% Finally the counter which contain the x and the y coordinate have
% to be initialized.
%
% The last action in the |picture| environment is the expansion of
% the macro |\PuzzleHook|. This can be used to include additional
% material in the |picture| environment. Primarily I have use this
% to include the ads. But now there is the macro |\Frame| for this
% purpose.
% \begin{macrocode}
\newenvironment{Puzzle}[2]{\PuzzlePre
\catcode`\|=13
\@nameuse{Puzzle@@\Puzzle@TYPE}%
\unitlength=\PuzzleUnitlength
\linethickness{\PuzzleLineThickness}%
\Puzzle@Y=#2
\begin{picture}(#1,#2)
\Puzzle@Box@@normal.
}{%
\PuzzleHook
\end{picture}\PuzzlePost
}
% \end{macrocode}
% \end{environment}
%
% \begin{macro}{\PuzzleLineThickness}
% The macro |\PuzzleLineThickness| contains the width of the line
% used to frame the cells.
% \changes{1.5}{2006/08/11}{New}
% \begin{macrocode}
\newcommand\PuzzleLineThickness{.25pt}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzlePre}
% This macro contains the code to be inserted before a puzzle is
% typeset. It is initialized to begin a new paragraph and center the
% puzzle.
% \changes{1.5}{2006/08/11}{New}
% \begin{macrocode}
\newcommand\PuzzlePre{%
\par\noindent\mbox{}\hfill
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzlePost}
% This macro contains the code to be inserted after a puzzle is
% typeset. It is initialized to end the paragraph and center the
% puzzle.
% \changes{1.5}{2006/08/11}{New}
% \begin{macrocode}
\newcommand\PuzzlePost{%
\hfill\null\par\noindent
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Frame@@normal}
% The macro |Puzzle@Frame| is used to place additional
% rectangular regions into the puzzle frame. This frame can contain
% arbitrary text which is typeset in a centered environment.
%
% This macro takes five arguments. The first two arguments are the
% coordinates of the upper left corner of the frame. The
% coordinates are logical coordinates starting from the lower left
% corner of the puzzle. The next two arguments are the width and the
% height of the frame given in the number of boxes covered. Finally
% the fifth argument contains the text which should appear in this
% frame.
% \begin{macrocode}
\newcommand\Puzzle@Frame@@normal[5]{\put(#1,#2){\framebox(#3,#4){%
\begin{minipage}{#3\unitlength}\begin{center} #5
\end{center}\end{minipage}}}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Frame@@solution}
% For the solution the framed ads are simply ignored.
% \begin{macrocode}
\newcommand\Puzzle@Frame@@solution[5]{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzleBlackBox}
% The macro |\PuzzleBlackBox| is called to typeset the black boxes.
% It should produce a box of at most width and height of
% |\PuzzleUnitlength|.
% \begin{macrocode}
\newcommand\PuzzleBlackBox{\rule{\PuzzleUnitlength}{\PuzzleUnitlength}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Box@@normal}
% The macro |\Puzzle@Box@@normal| performs all tasks when a box
% should be typeset in ``normal'' mode. The arguments are evaluated
% and the appropriate type of box typeset or other actions performed.
% \changes{1.4}{1996/11/25}{Minor bug fix. Using
% \texttt{\char`\\ifx}
% instead of \texttt{\char`\\if}.}
% \changes{1.5}{2006/08/10}{Reimplemented to cope with two optional
% arguments.}
% \begin{macrocode}
\newcommand\Puzzle@Box@@normal[1][]{%
\def\Puzzle@tmp@{#1}%
\Puzzle@Box@@normal@
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Box@@normal@}
% The macro |\Puzzle@Box@@normal@| performs all tasks when a box
% should be typeset in ``normal'' mode. The arguments are evaluated
% and the appropriate type of box typeset or other actions performed.
% \changes{1.5}{2006/08/10}{Extracted from
% \texttt{\char`\\Puzzle@Box@@normal}.}
% \changes{1.7}{2009/06/09}{\texttt{\char`\\PuzzleContent} added to
% transport the letter to the formatting macro.}
% \begin{macrocode}
\newcommand\Puzzle@Box@@normal@[2][f]{%
\def\PuzzleContent{#2}%
\def\Puzzle@tmp{#2}%
\if\Puzzle@tmp.
\Puzzle@X=0
\advance\Puzzle@Y-1
\else
\ifx\Puzzle@tmp\@empty
\else
\if\Puzzle@tmp*
\Puzzle@Cell@Loop *#1{}%
\else
\Puzzle@Cell@Loop #1{}%
\fi
\fi
\ifx\@empty\Puzzle@tmp@\else
\PuzzlePutNumber{\Puzzle@X}{\Puzzle@Y}{\Puzzle@tmp@}%
\fi
\advance\Puzzle@X 1
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzlePutNumber}
% The macro |\PuzzlePutNumber| is a configuration macro which
% typesets the number in a cell. The first argument is the x
% coordinate. The second argument is the y coordinate. The third
% argument is the number to be typeset.
% \changes{1.5}{2006/08/10}{New}
% \begin{macrocode}
\def\PuzzlePutNumber#1#2#3{%
\put(#1,#2){\makebox(1,.95)[tl]{\PuzzleNumberFont\,#3}}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@Loop}
% The macro |\Puzzle@Cell@Loop| processes its arguments until an
% empty argument is found. For each argument it is tried to invoke
% the corresponding cell drawing macro.
% \changes{1.5}{2006/08/09}{New}
% \begin{macrocode}
\def\Puzzle@Cell@Loop#1{%
\def\Puzzle@tmp{#1}%
\ifx\Puzzle@tmp\@empty
\let\Puzzle@tmp\relax
\else
\expandafter\ifx\csname Puzzle@Cell@@#1\endcsname\relax
\typeout{cwpuzzle: Cell type #1 is undefined. I am ignoring it}%
\else
\csname Puzzle@Cell@@#1\endcsname{\Puzzle@X}{\Puzzle@Y}%
\fi
\let\Puzzle@tmp\Puzzle@Cell@Loop
\fi
\Puzzle@tmp
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Box@@solution}
% The macro |\Puzzle@Box@@solution| performs all tasks when a box
% should be typeset in ``solution'' mode. The arguments are evaluated
% and the appropriate type of box typeset or other actions performed.
% \changes{1.4}{1996/11/25}{Minor bug fix. Using \texttt{\char`\\ifx} instead of \texttt{\char`\\if}.}
% \changes{1.5}{2006/08/10}{Reimplemented to cope with two optional arguments.}
% \begin{macrocode}
\newcommand\Puzzle@Box@@solution[1][]{%
\def\Puzzle@tmp@{#1}%
\Puzzle@Box@@solution@
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Box@@solution@}
% The macro |\Puzzle@Box@@solution@| performs all tasks when a box
% should be typeset in ``solution'' mode. The arguments are evaluated
% and the appropriate type of box typeset or other actions performed.
% \changes{1.5}{2006/08/10}{Reimplemented to cope with two optional arguments.}
% \changes{1.9}{2014/01/12}{Macro PuzzleSolutionContent introduced as extension point}
% \begin{macrocode}
\newcommand\Puzzle@Box@@solution@[2][f]{%
\def\Puzzle@tmp{#2}%
\if\Puzzle@tmp.
\Puzzle@X=0
\advance\Puzzle@Y-1
\else
\ifx\Puzzle@tmp\@empty
\else
\if\Puzzle@tmp*
\Puzzle@Cell@Loop *#1{}%
\else
\Puzzle@Cell@Loop #1{}%
\put(\Puzzle@X,\Puzzle@Y){\PuzzleSolutionContent{#2}}%
\fi
\fi
\def\Puzzle@tmp{#1}%
\ifx\Puzzle@tmp\@empty\else
\ifPuzzle@SolutionNumbered
\PuzzlePutNumber{\Puzzle@X}{\Puzzle@Y}{\Puzzle@tmp@}%
\fi
\fi
\advance\Puzzle@X 1
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzleSolutionContent}
% The macro |\PuzzleSolutionContent| procees the character in
% solution mode. Per default it converts the argument to upper
% caseand sets it in a box of size $1\times1$.
% \changes{1.9}{2014/01/12}{Macro PuzzleSolutionContent introduced as extension point}
% \begin{macrocode}
\def\PuzzleSolutionContent#1{\makebox(1,1){\uppercase{#1}}}
% \end{macrocode}
% \end{macro}
%
% \subsection{Predefined Cell Types}
% In this section a series of frame types are defined.
%
% \begin{macro}{\PuzzleDefineCell}
% The macro |\PuzzleDefineCell| is a user command to define a new
% cell type. The first argument contains the key under which the
% cell type should be addressed. This key should be expandable and
% should result into a single letter. Special effects can be
% achieved with keys constituted of non letters or several
% characters.
%
% The second argument contains the code to be stored for the key
% given.
% \changes{1.5}{2006/08/08}{New}
% \begin{macrocode}
\newcommand\PuzzleDefineCell[2]{
\global\@namedef{Puzzle@Cell@@#1}##1##2{#2}%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\PuzzleDefineColorCell}
%
% \changes{1.5}{2006/08/11}{New}
% \begin{macrocode}
\newcommand\PuzzleDefineColorCell[2]{
\global\@namedef{Puzzle@Cell@@#1}##1##2{%
\fboxsep=0pt
\put(##1,##2){\makebox(1,1){\colorbox{#2}{\makebox(1,1){}}}}
}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzleThickine}
% The parameter |\PuzzleThickine| contains the expansion text to
% be inserted. whenever a thick line is required. This means that
% this macro arranges everything that a thick line is drawn.
% Usually it contains an invocation to |\linethickness|. It can
% be redefined to achieve other effects like even thicker lines
% or colored lines. Note that the macro is used inside a group in
% the predefined cell types.
% \begin{macrocode}
\def\PuzzleThickline{\linethickness{2pt}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@T}
% The letter T produces a thicker line at the top of the cell.
% The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \changes{1.5}{2006/08/08}{New}
% \begin{macrocode}
\PuzzleDefineCell{T}{{%
\advance#2 1
\PuzzleThickline
\put(#1,#2){{\line(1,0){1}}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@t}
% The letter t produces a frame with a thicker line at the top.
% The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \changes{1.5}{2006/08/08}{New}
% \begin{macrocode}
\PuzzleDefineCell{t}{{%
\put(#1,#2){\framebox(1,1){}}
\advance#2 1
\PuzzleThickline
\put(#1,#2){{\line(1,0){1}}}
}}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Puzzle@Cell@@B}
% The letter B produces a thicker line at the bottom of the cell.
% The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \changes{1.5}{2006/08/10}{New}
% \begin{macrocode}
\PuzzleDefineCell{B}{{%
\PuzzleThickline
\put(#1,#2){{\line(1,0){1}}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@b}
% The letter b produces a frame with a thicker line at the bottom.
% The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \changes{1.5}{2006/08/10}{New}
% \begin{macrocode}
\PuzzleDefineCell{b}{{%
\put(#1,#2){\framebox(1,1){}}
\PuzzleThickline
\put(#1,#2){{\line(1,0){1}}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@l}
% The letter l produces a frame with a thicker line at the left
% side of the cell. The thickness of this line is controlled by
% the macro |\PuzzleThickline|.
% \changes{1.5}{2006/08/10}{New}
% \begin{macrocode}
\PuzzleDefineCell{l}{{%
\put(#1,#2){\framebox(1,1){}}
\PuzzleThickline
\put(#1,#2){{\line(0,1){1}}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@L}
% The letter L produces a thicker line at the left side of the
% cell. The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \changes{1.5}{2006/08/10}{New}
% \begin{macrocode}
\PuzzleDefineCell{L}{{%
\PuzzleThickline
\put(#1,#2){{\line(0,1){1}}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@r}
% The letter r produces a frame with a thicker line at the right
% side of the cell. The thickness of this line is controlled by
% the macro |\PuzzleThickline|.
% \changes{1.5}{2006/08/10}{New}
% \begin{macrocode}
\PuzzleDefineCell{r}{{%
\put(#1,#2){\framebox(1,1){}}
\advance #1 1
\PuzzleThickline
\put(#1,#2){{\line(0,1){1}}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@R}
% The letter R produces a thicker line at the right side of the
% cell. The thickness of this line is controlled by the macro
% |\PuzzleThickline|.
% \changes{1.5}{2006/08/10}{New}
% \begin{macrocode}
\PuzzleDefineCell{R}{{%
\advance #1 1
\PuzzleThickline
\put(#1,#2){{\line(0,1){1}}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@f}
% The letter f produces a simple frame around the cell. This is
% the default if nothing is specified.
% \changes{1.5}{2006/08/08}{New}
% \begin{macrocode}
\PuzzleDefineCell{f}{{%
\put(#1,#2){\framebox(1,1){}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@S}
% The letter S produces the solution without any other formatting
% around it.
% \changes{1.7}{2009/06/09}{New}
% \begin{macrocode}
\PuzzleDefineCell{S}{{%
\put(#1,#2){\makebox(1,1){\expandafter\uppercase{\PuzzleContent}}}
}}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Puzzle@Cell@@.}
% The character . produces no additional rendering it can be used
% to overwrite the default rendering which is to place a frame
% around the cell.
% \changes{1.5}{2006/08/11}{New}
% \begin{macrocode}
\PuzzleDefineCell{.}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@O}
% The letter O produces an oval as drawn with the \LaTeX\ macro
% \verb/\oval/.
% \changes{1.5}{2006/08/11}{New}
% \begin{macrocode}
\PuzzleDefineCell{O}{{%
\put(\the#1.5,\the#2.5){\oval(1,1){}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@o}
% The letter o produces an oval inside a frame. T is is an
% abbreviation for the two letters fO.
% \changes{1.5}{2006/08/08}{New}
% \begin{macrocode}
\PuzzleDefineCell{o}{{%
\put(#1,#2){\framebox(1,1){}}
\put(\the#1.5,\the#2.5){\oval(1,1){}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@*}
% The letter * produces a solid black box.
% \changes{1.5}{2006/08/08}{New}
% \begin{macrocode}
\PuzzleDefineCell{*}{%
\put(#1,#2){\framebox(1,1){\PuzzleBlackBox}}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@/}
% The character / produces a line crossing the cell from lower
% left to upper right.
% \changes{1.5}{2006/08/08}{New}
% \begin{macrocode}
\PuzzleDefineCell{/}{{%
\put(#1,#2){{\line(1,1){1}}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Cell@@,}
% The character , produces a line crossing the cell from upper
% left to lower right.
% \changes{1.5}{2006/08/11}{New}
% \begin{macrocode}
\PuzzleDefineCell{,}{{%
\advance#2 1
\put(#1,#2){{\line(1,-1){1}}}
}}
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Clues}
%
% \begin{macro}{\Puzzle@Clue@@normal}
% The first and the third argument are shown as clue. This macro is
% used for unsolved puzzles.
% \begin{macrocode}
\newcommand\Puzzle@Clue@@normal[3]{\textsf{#1} #3 }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Clue@@solution}
% In solutions clues are simply suppressed. Thus all three
% arguments are discarded.
% \begin{macrocode}
\newcommand\Puzzle@Clue@@solution[3]{}
% \end{macrocode}
% \end{macro}
%
% \begin{environment}{Puzzle@Clues@@normal}
% The environment |Puzzle@Clues@@normal| is mapped to |PuzzleClues|
% in ``normal'' mode. It typesets its contents in a mini-page of
% approximately half text width.
% \begin{macrocode}
\newenvironment{Puzzle@Clues@@normal}[1]{%
\let\Clue\Puzzle@Clue@@normal
\PuzzleCluePre
\PuzzleClueFont{#1}%
}{\PuzzleCluePost }
% \end{macrocode}
% \end{environment}
%
% \begin{macro}{\PuzzleCluePre}
% The macro |\PuzzleCluePre| contains the code which is inserted
% before the clues are typeset in normal mode.
% \begin{macrocode}
\newcommand\PuzzleCluePre{%
\null\hfill
\begin{minipage}[t]{.45\textwidth}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzleCluePost}
% The macro |\PuzzleCluePost| contains the code which is inserted
% after the clues are typeset in normal mode.
% \begin{macrocode}
\newcommand\PuzzleCluePost{
\end{minipage}\hfill\null
}
% \end{macrocode}
% \end{macro}
%
% \begin{environment}{Puzzle@Clues@@solution}
% The environment |Puzzle@Clues@@solution| is mapped to |PuzzleClues|
% in ``solution'' mode. It just suppresses any output.
% \begin{macrocode}
\newenvironment{Puzzle@Clues@@solution}[1]{%
\let\Clue\Puzzle@Clue@@solution
}{}
% \end{macrocode}
% \end{environment}
%
% \begin{macro}{\PuzzleWordsText}
% The macro |\PuzzleWordsText| is the text typeset at the beginning
% of the environment |PuzzleWords|. It takes one argument which is
% the length of the words listed.
% \begin{macrocode}
\newcommand\PuzzleWordsText[1]{Words of length #1: }
% \end{macrocode}
% \end{macro}
%
% \begin{environment}{Puzzle@Words@@normal}
% The environment |Puzzle@Words@@normal| will be mapped to the
% environment |PuzzleWords| in ``normal'' mode. It just arranges
% that words are typeset after the |\PuzzleWordsText| has shown the
% length of the words. Finally a new paragraph is started.
% \begin{macrocode}
\newenvironment{Puzzle@Words@@normal}[1]{%
\PuzzleWordsText{#1}%
\let\Word\relax
}{\par}
% \end{macrocode}
% \end{environment}
%
% \begin{environment}{Puzzle@Words@@solution}
% The environment |Puzzle@Words@@solution| will be mapped to the
% environment |PuzzleWords| in ``solution'' mode. It arranges
% things that the contents is silently ignored.
% \begin{macrocode}
\newenvironment{Puzzle@Words@@solution}[1]{%
\newcommand\Word[1]{}%
}{}
% \end{macrocode}
% \end{environment}
%
% \subsection{Numbers}
%
% \begin{macro}{\PuzzleNumbers}
% The macro |\PuzzleNumbers| will produce a list of boxes with
% numbers for letters. It is intended for numbered crossword puzzles.
% \begin{macrocode}
\newcommand\PuzzleNumbers[1]{\begingroup
\@nameuse{Puzzle@@\Puzzle@TYPE}%
\Puzzle@Y=0
\Puzzle@X=1
\unitlength=\PuzzleUnitlength
\Puzzle@Numbers#1.\endgroup}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@Numbers}
% The macro |\Puzzle@Numbers| loops through the arguments until it
% finds a dot. For each argument it produces a box, either with the
% numbers or with the letters or both, depending on the current
% settings.
%
% The loop is implemented via recursion. The box is typeset by the
% \verb/|/ macro which takes care of the current settings. For this
% purpose this character has to be made active temporarily.
% \begin{macrocode}
\begingroup
\catcode`\|=13
\gdef\Puzzle@Numbers#1{%
\if#1.
\let\next\relax
\else
\begin{picture}(1,1)
\xdef\X{\the\Puzzle@X}%
\Puzzle@X=0
|[\X]{#1}%
\end{picture}%
\let\next\Puzzle@Numbers
\advance\Puzzle@X 1
\fi
\next
}
\endgroup
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzleLettersText}
% The macro |\PuzzleLettersText| contains the text typeset at the
% beginning of the |\PuzzleLetters| environment.
% \begin{macrocode}
\newcommand\PuzzleLettersText{The following letters are used: }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzleLetters}
% The macro |\PuzzleLetters| is intended to show the letters used
% in a numbered crossword puzzle. The argument is the (sorted) list
% of characters used.
% \begin{macrocode}
\newcommand\PuzzleLetters[1]{\PuzzleLettersText #1\par}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Puzzle@TYPE}
% The macro |\Puzzle@TYPE| contains the type of the puzzle. It is
% used find the appropriate initialization macro.
% \begin{macrocode}
\newcommand\Puzzle@TYPE{normal}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzleSolution}
% The macro |\PuzzleSolution| arranges everything that the
% following puzzles are typeset in the ``solution'' mode, i.e. the
% letters are shown and the clues are suppressed.
%
% This macros has one optional argument which has to be |true| or
% |false|. This argument determines whether or not the numbers
% should also be shown in the solution. The default is |false|
% which means that the numbers are suppressed in the solution.
% \begin{macrocode}
\newcommand\PuzzleSolution[1][false]{%
\@nameuse{Puzzle@SolutionNumbered#1}%
\let\Kakuro@HINT\Kakuro@nohint
\let\PuzzleClues\Puzzle@Clues@@solution
\let\endPuzzleClues\endPuzzle@Clues@@solution
\let\PuzzleWords\Puzzle@Words@@solution
\let\endPuzzleWords\endPuzzle@Words@@solution
\def\Puzzle@TYPE{solution}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PuzzleUnsolved}
% The macro |\PuzzleUnsolved| arranges everything that the
% following puzzles are typeset in the ``unsolved'' mode, i.e. the
% letters are suppressed and the clues are shown.
% \begin{macrocode}
\newcommand\PuzzleUnsolved{%
\let\Kakuro@HINT\Kakuro@hint
\let\PuzzleClues\Puzzle@Clues@@normal
\let\endPuzzleClues\endPuzzle@Clues@@normal
\let\PuzzleWords\Puzzle@Words@@normal
\let\endPuzzleWords\endPuzzle@Words@@normal
\xdef\Puzzle@TYPE{normal}}
% \end{macrocode}
% \end{macro}
%
% The boolean |Puzzle@SolutionNumbered| determines whether or
% not the solution should contain numbers. Initially it is set to
% ``false''.
%
% \begin{macrocode}
\newif\ifPuzzle@SolutionNumbered
\Puzzle@SolutionNumberedfalse
% \end{macrocode}
%
% \subsection{Sudoku}
%
% The challenge for the sudoku is to implement a convenient input syntax.
%
% \begin{environment}{Sudoku}
% The environemnt |Sudoku| is used to typeset the puzzle.
% The implementation defines the begin and end macro separately.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\begingroup
\catcode`\|=13
\gdef\Sudoku{\begin{Puzzle}{9}{9}%
\let\Puzzle@pipe=|%
\def\PPa{\Puzzle@pipe[][fS]}%
\def|##1{\ifx##1*\let\next\PPa\else\Puzzle@pipe{##1}\let\next\relax\fi\next}
}
\endgroup
% \end{macrocode}
%
% The macro |\endSudoku| contains the code to be expanded at the
% end of the environment. It draws the field with the $3\times3$
% boxes.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\gdef\endSudoku{%
\multiput(0,0)(1,0)9{\framebox(1,1){}}
\multiput(0,1)(1,0)9{\framebox(1,1){}}
\multiput(0,2)(1,0)9{\framebox(1,1){}}
\multiput(0,3)(1,0)9{\framebox(1,1){}}
\multiput(0,4)(1,0)9{\framebox(1,1){}}
\multiput(0,5)(1,0)9{\framebox(1,1){}}
\multiput(0,6)(1,0)9{\framebox(1,1){}}
\multiput(0,7)(1,0)9{\framebox(1,1){}}
\multiput(0,8)(1,0)9{\framebox(1,1){}}
\linethickness{\SudokuLinethickness}%
\put(0,0){\framebox(9,9){}}
\put(3,0){\framebox(3,9){}}
\put(0,3){\framebox(9,3){}}
\end{Puzzle}}
% \end{macrocode}
% \end{environment}
%
% \begin{macro}{\SudokuLinethickness}
% The macro |\SudokuLinethickness| contains the thickness od thick
% lines in a Sudoku.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\newcommand\SudokuLinethickness{2pt}
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Kakuro}
%
% \begin{macro}{\KakuroNumberFont}
% The macro |\KakuroNumberFont| is used to typeset the hints, i.e.
% the horizontal and vertical sums.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\newcommand\KakuroNumberFont{\sf\tiny}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Kakuro@cell}
% The macro |\Kakuro@cell| is used to typeset the cells. It
% analyzes the argument and acts accordingly.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\def\Kakuro@cell#1{%
\ifx#1. \def\next{\Puzzle@pipe.}%
\else\ifx#1< \let\next\Kakuro@HINT
\else\ifx#1* \let\next\Kakuro@always
\else\ifx#1- \let\next\Kakuro@empty
\else\Puzzle@pipe#1 \let\next\relax
\fi\fi\fi\fi
\next
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Kakuro@always}
% The macro |\Kakuro@always| is used to draw a cell with an inital number.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\def\Kakuro@always{\Puzzle@pipe[][fS]}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Kakuro@empty}
% The macro |\Kakuro@empty| is used to drae an empty cell.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\def\Kakuro@empty{\Puzzle@pipe{}}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Kakuro@hint}
% The macro |\Kakuro@hint| is used to draw hints.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\def\Kakuro@hint#1:#2>{%
\def\x{#2}%
\ifx\x\empty\else
\put(\Puzzle@X,\Puzzle@Y){\makebox(1,.8)[r]{\parbox{.95\unitlength}{\raggedright\KakuroNumberFont
$\blacktriangledown$\\#2}}}
\fi
\def\x{#1}%
\ifx\x\empty\else
\put(\Puzzle@X,\Puzzle@Y){\makebox(1,1.2){\parbox{.95\unitlength}{\raggedleft\KakuroNumberFont
#1 $\blacktriangleright$\\\mbox{}}}}
\fi
\Puzzle@pipe[][\KakuroHintType]{ }}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Kakuro@nohint}
% The macro |\Kakuro@nohint| is used to suppress hints in solution mode.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\def\Kakuro@nohint#1:#2>{%
\Puzzle@pipe[][,]{ }}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Kakuro@HINT}
% The macro |\Kakuro@HINT| contains the definition to be used to
% typeset hints. This indirection is needed to suppress hints in
% solution mode.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\let\Kakuro@HINT\Kakuro@hint
% \end{macrocode}
% \end{macro}
%
%
% \begin{environment}{Kakuro}
% The environemnt |Kakuro| is used to typeset the puzzle.
% The implementation defines the begin and end macro separately to
% cope with catcode changes.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\begingroup
\catcode`\|=13
\gdef\Kakuro#1#2{\begin{Puzzle}{#1}{#2}%
\catcode`\|=13
\let\Puzzle@pipe=|
\let|=\Kakuro@cell
}
\endgroup
% \end{macrocode}
%
% The macro |\endKakuro| contains the code to be expanded at the
% end of the environment.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\def\endKakuro{\end{Puzzle}}
% \end{macrocode}
% \end{environment}
%
% \begin{macro}{\KakuroHintType}
% The macro |\KakuroHintType| contains the cell type for
% typesetting hint cells. It can be used to achieve a different
% look and feel.
% \changes{1.8}{2009/09/13}{New}
% \begin{macrocode}
\def\KakuroHintType{,}
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Initialization}
%
% Finally we arrange that the default behavior is to typeset an
% unsolved crossword puzzle.
%
% \begin{macrocode}
\PuzzleUnsolved
% \end{macrocode}
%
% Now, that everything is in place we can arrange some package
% options.
% \changes{1.6}{2006/08/12}{Several style options defined}
% \begin{macrocode}
\DeclareOption{numbered}{\Puzzle@SolutionNumberedtrue}
\DeclareOption{nocenter}{\let\PuzzlePre=\relax
\let\PuzzlePost=\relax}
\DeclareOption{unboxed}{\let\PuzzleCluePre=\relax
\let\PuzzleCluePost=\relax}
\DeclareOption{normalsize}{\PuzzleUnitlength=20pt
\def\PuzzleFont{\rm\normalsize}}
\DeclareOption{small}{\PuzzleUnitlength=16pt
\def\PuzzleFont{\rm\small}}
\DeclareOption{large}{\PuzzleUnitlength=24pt
\def\PuzzleFont{\rm\large}}
\DeclareOption{german}{%
\renewcommand\PuzzleWordsText[1]{Worte der L\"ange #1: }%
\renewcommand\PuzzleLettersText{Benutzte Buchstaben: }%
}
\DeclareOption{ngerman}{%
\renewcommand\PuzzleWordsText[1]{Worte der L\"ange #1: }%
\renewcommand\PuzzleLettersText{Benutzte Buchstaben: }%
}
\ProcessOptions\relax
% \end{macrocode}
%
% That's all.
%
% \PrintChanges
% \newpage
% \PrintIndex
%
% \Finale
%
\endinput
%
% Local Variables:
% mode: latex
% TeX-master: t
% End:
|