summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-09-15 00:43:32 +0000
committerKarl Berry <karl@freefriends.org>2009-09-15 00:43:32 +0000
commit837b282273b9bf339577c772249ed79fe64f43f5 (patch)
treef0ea27acf6b2c6f05d9ac00c54f1d2c3f5545f36 /Master/texmf-dist
parent9b5c0be75f6856d930bda2f309319b167a6ea2fb (diff)
crossword 1,8 (13sep09)
git-svn-id: svn://tug.org/texlive/trunk@15288 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/crossword/README29
-rw-r--r--Master/texmf-dist/doc/latex/crossword/cwpuzzle.pdfbin185513 -> 227913 bytes
-rw-r--r--Master/texmf-dist/source/latex/crossword/AcrossLite/README143
-rw-r--r--Master/texmf-dist/source/latex/crossword/AcrossLite/nytconv.c202
-rw-r--r--Master/texmf-dist/source/latex/crossword/AcrossLite/nytsconv.c209
-rw-r--r--Master/texmf-dist/source/latex/crossword/AcrossLite/usaconv.c229
-rw-r--r--Master/texmf-dist/source/latex/crossword/Makefile20
-rw-r--r--Master/texmf-dist/source/latex/crossword/cwpuzzle.dtx369
-rw-r--r--Master/texmf-dist/source/latex/crossword/cwpuzzle.ins2
-rw-r--r--Master/texmf-dist/tex/latex/crossword/cwpuzzle.sty72
10 files changed, 464 insertions, 811 deletions
diff --git a/Master/texmf-dist/doc/latex/crossword/README b/Master/texmf-dist/doc/latex/crossword/README
index 09c35992db2..c9c50b91333 100644
--- a/Master/texmf-dist/doc/latex/crossword/README
+++ b/Master/texmf-dist/doc/latex/crossword/README
@@ -1,14 +1,17 @@
cwpuzzle.sty
-
- a LaTeX package for typesetting crossword puzzles
+ a LaTeX package for typesetting crossword puzzles and more
Gerd Neugebauer
-Since I know only of one additional package for this purpose on CTAN
--- named crosswrd.sty -- I will compare it against this package to
-show the advantages and disadvantages of both packages.
+CROSSWORD PUZZLES
+
+Since I know only of one additional package for typesetting crossword
+puzzles on CTAN -- named crosswrd.sty -- I will compare it against
+this package to show the advantages and disadvantages of both
+packages.
I have developed cwpuzzle.sty because I needed to typeset a puzzle
which required more features than those provided by crosswrd. The
@@ -64,10 +67,22 @@ the boxes or the fonts used as well as the appearance of graphical
elements like the black blocks.
+MORE CELL-BASED PUZZLES
+
+In addition to crossword puzzles Sudoku and Kakuro are supported. They
+are also grid-based. Thus it was easy to facilityte the infrastructure
+already in place for them.
+
+There is a package for sudoku on CTAN. But it does not support
+solutions yet.
+
+
+LOCATION
+
cwpuzzle is located in the CTAN directory
tex-archive/macros/latex/contrib/gene/crossword
-run tex on cwpuzzle.ins to produce the package and latex on
-cwpuzzle.dtx to get the documentation (or the Makefile to do both).
-
+Run tex on cwpuzzle.ins to produce the package and (pdf)latex on
+cwpuzzle.dtx to get the documentation (or the Makefile to do both).
+Per default the Makefile produces the documentation as PDF.
diff --git a/Master/texmf-dist/doc/latex/crossword/cwpuzzle.pdf b/Master/texmf-dist/doc/latex/crossword/cwpuzzle.pdf
index 343c36975b5..2f1555d36d0 100644
--- a/Master/texmf-dist/doc/latex/crossword/cwpuzzle.pdf
+++ b/Master/texmf-dist/doc/latex/crossword/cwpuzzle.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/crossword/AcrossLite/README b/Master/texmf-dist/source/latex/crossword/AcrossLite/README
deleted file mode 100644
index 8555f2a213a..00000000000
--- a/Master/texmf-dist/source/latex/crossword/AcrossLite/README
+++ /dev/null
@@ -1,143 +0,0 @@
-Here are three programs and a script for use with Gerd
-Neugebauer's excellent cwpuzzle.sty package for typesetting
-crossword puzzles in LaTeX.
-
-The purpose of the programs is to convert the popular
-Across Lite(R) puzzle formats, both binary and text, to
-LaTeX input suitable for use with Gerd's package.
-
-Build the programs like this:
-
-gcc -o nytconv nytconv.c
-gcc -o nytsconv nytsconv.c
-gcc -o usaconv usaconv.c
-
-1. nytconv
-
-This program converts Across Lite(R) binary puzzle files:
-
-nytconv puzzlefile.puz >puzzlefile.tex
-
-where of course 'puzzlefile' is the name of the binary
-input file. The program is best suited to puzzles up to
-size 15x15, which is the standard daily puzzle size for
-the New York Times. NYT puzzles are distributed from their
-web site in Across Lite binary format. The web site is
-http://www.nytimes.com but registration (currently free)
-is needed to access the contents of the site.
-
-2. nytsconv
-
-This program is very similar to the previous one except
-it's for the larger Sunday puzzles, up to about 23x23.
-
-nytsconv puzzlefile.puz >puzzlefile.tex
-
-3. usaconv
-
-This program converts Across Lite(R) text files. Puzzles
-such as the USA Today daily puzzle and the Times of London
-daily puzzle are converted to LaTeX input via a two step
-process. You should go to the Across Lite web site,
-http://www.litsoft.com to pick up a USA Today conversion
-program and a Times of London conversion program. You can
-then pick up the puzzles (http://www.usatoday.com, or
-http://www.the-times.co.uk), convert to Across Lite text form,
-and then convert to LaTeX.
-
-usaconv puzzlefile.txt >puzzlefile.tex
-
-Well, you might say, what's the point? There are several.
-I don't want to solve crosswords on screen; I want printed
-copy to work with. So, why not just print from the Across
-Lite program? Because (1) I'm a LaTeX fanatic, and more
-importantly (2) I use an automated procedure to download
-the NYT and USA puzzles every morning, format them, and
-ready them for printing whenever I want a fresh puzzle!
-The only work I have to do is to actually solve the
-puzzle. (I don't have the skill needed to solve difficult
-cryptics such as the Times of London puzzles so I don't
-download them regularly.)
-
-Another important point is generating your own crosswords
-with computerized tools. Tools such as Crossword Express
-(http://www.puzzledepot.com/cwe) help you to produce
-crosswords quickly and effectively. One of the output
-format is Across Lite binary. This can then be converted
-(with the nyt- or nyts- conversion program, depending on
-puzzle size) and dropped into a LaTeX document. This is
-nice for newsletters, educational material, etc.
-
-There is still another possibility using postscript tools
-usually found on Unix systems. You might collect, say,
-100 puzzles, convert them all to LaTeX input, and process
-them. Then you can use tools such as psbook to make books
-of puzzles to take along on boring business trips or
-interesting vacation trips.
-
-For those of you with an interest, here is my automated
-Perl script for downloading and formatting puzzles. It
-requires the program 'wget' which can be found at
-ftp://gnjilux.cc.fer.hr/pub/unix/util/wget/
-(This site is sometimes hard to reach. Keep trying. Or
-contact me for alternatives.)
-
-Now, the script, which will require local site modification:
----------------
-#!/usr/bin/perl
-
-chdir("/usr/games/crossword");
-($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
-
-# NY Times
-
- $mpart = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon];
- if ($mday lt 10){$puzzle = $mpart."0".$mday.$year;}
- else {$puzzle = $mpart.$mday.$year;}
- system("/usr/bin/wget --http-user=myname --http-passwd=secret http://www.nytimes.com/partners/xword/$puzzle.puz");
- if ($wday ne 0) {system("./nytconv $puzzle.puz >$puzzle.tex");}
- else {system("./nytsconv $puzzle.puz >$puzzle.tex");}
- system("/usr/bin/latex $puzzle");
- if ($wday ne 0) {system("/usr/bin/dvips -x 1400 $puzzle");}
- else {system("/usr/bin/dvips -x 1100 $puzzle");}
- system("/usr/bin/psnup -l -2 -pletter $puzzle.ps $puzzle.wps");
- system("echo \"quit\" >>$puzzle.wps");
- system("/usr/bin/gs -q -sDEVICE=laserjet -r300 -dQUIET -dNOPAUSE -sOutputFile=$puzzle.lj $puzzle.wps ");
- system("gzip -9 -f $puzzle.lj");
- system("/bin/rm *dvi *ps *log *aux *tex");
-
-# USA Today
-
-if ($wday ne 6 && $wday ne 0) { # no weekend puzzles
- $month = $mon + 1;
- if ($month lt 10) {$directory = $year."0".$month;}
- else {$directory = $year.$month;}
- if ($mday lt 10){$puzzle = "ut".$directory."0".$mday;}
- else {$puzzle = "ut".$directory.$mday;}
- system("/usr/bin/wget http://www.usatoday.com/life/puzzles/$directory/$puzzle.puz");
- system("./usa-acl $puzzle.puz $puzzle.txt");
- system("./usaconv $puzzle.txt >$puzzle.tex");
- system("/usr/bin/latex $puzzle");
- system("/usr/bin/dvips -x 1400 $puzzle");
- system("/usr/bin/psnup -l -2 -pletter $puzzle.ps $puzzle.wps");
- system("echo \"quit\" >>$puzzle.wps");
- system("/usr/bin/gs -q -sDEVICE=laserjet -r300 -dQUIET -dNOPAUSE -sOutputFile=$puzzle.lj $puzzle.wps ");
- system("gzip -9 -f $puzzle.lj");
- system("/bin/rm *dvi *ps *log *aux *tex *txt");
-}
-
-exit;
---------------
-
-For any questions, bug reports, or especially improvements, please
-contact me:
-
-bnewell@btigate.com
-http://www.btigate.com/~bnewell
-
-
-Bob Newell
-Bismarck, North Dakota
-28 November, 1996
-
-
diff --git a/Master/texmf-dist/source/latex/crossword/AcrossLite/nytconv.c b/Master/texmf-dist/source/latex/crossword/AcrossLite/nytconv.c
deleted file mode 100644
index 2956d29b345..00000000000
--- a/Master/texmf-dist/source/latex/crossword/AcrossLite/nytconv.c
+++ /dev/null
@@ -1,202 +0,0 @@
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#define ROWSIZE 256
-
-FILE *infile;
-int width, height, j, k, ccount, mcount, anum, dnum;
-int apos, dpos;
-
-char inbuf[ROWSIZE];
-
-/* Here is a lazy programmer's waste of space. */
-char aspace[ROWSIZE][ROWSIZE];
-char dspace[ROWSIZE][ROWSIZE];
-
-char rowtext[10*ROWSIZE];
-char tmp[ROWSIZE];
-
-char title[80];
-char author[80];
-char copyright[80];
-char matrix[ROWSIZE*ROWSIZE*10];
-char aclues[ROWSIZE*15*16];
-char dclues[ROWSIZE*15*16];
-
-void fgetaline(char *, FILE *);
-
-void main(int argc, char *argv[])
-{
-
-/* Open the puzzle file. */
- if (argc < 2) {
- printf("Usage: Acl2TeX <puzzle file>\n");
- exit(1);
- }
- infile = fopen(argv[1], "rb");
- if (infile == NULL) {
- printf("Error opening %s.\n");
- exit(1);
- }
-
-/* From here on we're assuming a non-corrupt puzzle file.
- An enhancement later could be to check for this. */
-
-/* Read in the puzzle size, skipping the stuff
- we don't understand. */
- fread(inbuf, 46, 1, infile);
- width = (int)(inbuf[44]);
- height = (int)(inbuf[45]);
-
-/* Read in the solution, assuming(!) it is not scrambled.
- This may be a bad idea but we do it anyhow. */
- fread(inbuf, 6, 1, infile); /* more basura */
- for (j=0; j<height; j++) fread(&aspace[j][0], width, 1, infile);
-
-/* Read in the diagram info separately. It's safer to use
- this to deduce the numbering scheme. */
- for (j=0; j<height; j++) fread(&dspace[j][0], width, 1, infile);
-
- /* Now start to separate some of the text headers. */
- apos=dpos=0;
- fgetaline(title, infile);
- fgetaline(author, infile);
- fgetaline(copyright, infile);
-
-/* Now we are ready to produce the LaTeX stuff for the
- puzzle diagram. Again we are assuming we have an unscrambled
- solution. How can we know this? Put on TODO list. */
-
-/* We write to standard out. Lazy but effective. */
-
- printf("\\documentclass{article}\n");
- printf("\\usepackage{cwpuzzle}\n");
- printf("\\title{%s}\n", title);
- printf("\\author{%s}\n", author);
- printf("\\date{%s}\n", copyright);
- printf("\\voffset -1in\n");
- printf("\\hoffset -1in\n");
- printf("\\begin{document}\n");
-
- ccount = 0;
- mcount = 0;
-
- for (j=0; j<height; j++) {
- strcpy(rowtext,"\0");
- for (k=0; k<width; k++) {
- /* Analyze position for across-number */
- /* Left edge non-black followed by non-black */
- anum = 0;
- if ( (k==0 && dspace[j][k]=='-' && dspace[j][k+1]=='-') ||
- /* Previous black - nonblack - nonblack */
- ( (k+1)<width && (k-1)>=0 && dspace[j][k]=='-'
- && dspace[j][k-1]=='.'
- && dspace[j][k+1]=='-' )
- ){
- ccount++;
- anum = ccount;
- }
- /* Analyze position for down-number */
- dnum = 0;
- /* Top row non-black followed by non-black */
- if ( (j==0 && dspace[j][k]=='-' && dspace[j+1][k]=='-') ||
- /* Black above - nonblack - nonblack below */
- ( (j-1)>=0 && (j+1)<height && dspace[j][k]=='-'
- && dspace[j-1][k]=='.'
- && dspace[j+1][k]=='-' )
- ){
- /* Don't double number the same space */
- if (anum == 0) ccount++;
- dnum = ccount;
- }
- /* Now, if necessary, pick up some clues and save them. */
- if (anum != 0) {
- fgetaline(tmp, infile);
- sprintf(&aclues[apos], "\\Clue{%d}{}{%s}\\\\\n",
- anum, tmp);
- apos = strlen(aclues);
- }
- if (dnum != 0) {
- fgetaline(tmp, infile);
- sprintf(&dclues[dpos], "\\Clue{%d}{}{%s}\\\\\n",
- dnum, tmp);
- dpos = strlen(dclues);
- }
- /* Concat the current info to the current row. */
- strcat(rowtext, "|");
- if (dspace[j][k] == '.') strcat(rowtext, "*");
- else {
- /* see if we need a grid number */
- if (dnum != 0) {
- sprintf(tmp, "[%d]", dnum);
- strcat(rowtext, tmp);
- }
- else if (anum != 0) {
- sprintf(tmp, "[%d]", anum);
- strcat(rowtext, tmp);
- }
- /* Put in solution letter */
- strncat(rowtext, &aspace[j][k], 1);
- }
- }
- /* End of the row. Put in marker and output it. */
- strcat(rowtext, "|.");
- sprintf(&matrix[mcount], "%s\n", rowtext);
- mcount = strlen(matrix);
- }
- /* That's it for the puzzle. */
-
- /* Now output the clue section */
- printf("\\begin{PuzzleClues}{\\textbf{Across}}\\\\\n");
- printf("%s", aclues);
- printf("\\end{PuzzleClues}\n");
- printf("\\begin{PuzzleClues}{\\textbf{Down}}\\\\\n");
- printf("%s", dclues);
- printf("\\end{PuzzleClues}\n");
-
- /* Now output the diagram */
- printf("\\newpage\n");
- printf("\\maketitle\n");
- printf("\\begin{Puzzle}{%d}{%d}\n", width, height);
- printf("%s", matrix);
- printf("\\end{Puzzle}\n");
-
-
- printf("\\end{document}\n");
-
- exit(0);
-
-}
-
- void fgetaline(char *foo, FILE *infile) {
- unsigned char i;
- int oe;
- oe = 0;
- strcpy(foo, "\0");
- while (1) {
- fread(&i, 1, 1, infile);
- if (feof(infile) || (i=='\0')) break;
- if (i == 169) {
- strcat(foo, "\\copyright ");
- }
- else {
- if (i == '_' || i == '&' || i == '#' || i== '$') strcat(foo, "\\");
- if (i == '"') {
- if ( oe == 0) {
- oe = 1;
- strcat(foo, "``");
- }
- else {
- oe = 0;
- strcat(foo, "''");
- }
- }
- else strncat(foo, &i, 1);
- }
- }
- }
-
-
-
diff --git a/Master/texmf-dist/source/latex/crossword/AcrossLite/nytsconv.c b/Master/texmf-dist/source/latex/crossword/AcrossLite/nytsconv.c
deleted file mode 100644
index 77e478f6840..00000000000
--- a/Master/texmf-dist/source/latex/crossword/AcrossLite/nytsconv.c
+++ /dev/null
@@ -1,209 +0,0 @@
-
-/* ACL to LaTeX conversion suitable for Sunday NY Times */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#define ROWSIZE 256
-
-FILE *infile;
-int width, height, j, k, ccount, mcount, anum, dnum;
-int apos, dpos;
-
-char inbuf[ROWSIZE];
-
-/* Here is a lazy programmer's waste of space. */
-char aspace[ROWSIZE][ROWSIZE];
-char dspace[ROWSIZE][ROWSIZE];
-
-char rowtext[10*ROWSIZE];
-char tmp[ROWSIZE];
-
-char title[80];
-char author[80];
-char copyright[80];
-char matrix[ROWSIZE*ROWSIZE*10];
-char aclues[ROWSIZE*15*16];
-char dclues[ROWSIZE*15*16];
-
-void fgetaline(char *, FILE *);
-
-void main(int argc, char *argv[])
-{
-
-/* Open the puzzle file. */
- if (argc < 2) {
- printf("Usage: Acl2TeX <puzzle file>\n");
- exit(1);
- }
- infile = fopen(argv[1], "rb");
- if (infile == NULL) {
- printf("Error opening %s.\n");
- exit(1);
- }
-
-/* From here on we're assuming a non-corrupt puzzle file.
- An enhancement later could be to check for this. */
-
-/* Read in the puzzle size, skipping the stuff
- we don't understand. */
- fread(inbuf, 46, 1, infile);
- width = (int)(inbuf[44]);
- height = (int)(inbuf[45]);
-
-/* Read in the solution, assuming(!) it is not scrambled.
- This may be a bad idea but we do it anyhow. */
- fread(inbuf, 6, 1, infile); /* more basura */
- for (j=0; j<height; j++) fread(&aspace[j][0], width, 1, infile);
-
-/* Read in the diagram info separately. It's safer to use
- this to deduce the numbering scheme. */
- for (j=0; j<height; j++) fread(&dspace[j][0], width, 1, infile);
-
- /* Now start to separate some of the text headers. */
- apos=dpos=0;
- fgetaline(title, infile);
- fgetaline(author, infile);
- fgetaline(copyright, infile);
-
-/* Now we are ready to produce the LaTeX stuff for the
- puzzle diagram. Again we are assuming we have an unscrambled
- solution. How can we know this? Put on TODO list. */
-
-/* We write to standard out. Lazy but effective. */
-
- printf("\\documentclass{article}\n");
- printf("\\usepackage{cwpuzzle,multicol}\n");
- printf("\\title{%s}\n", title);
- printf("\\author{%s}\n", author);
- printf("\\date{%s}\n", copyright);
- printf("\\voffset -1in\n");
- printf("\\hoffset -1in\n");
- printf("\\textwidth 6.5in\n");
- printf("\\marginparwidth 0in\n");
- printf("\\textheight 9.5in\n");
- printf("\\begin{document}\n");
- printf("{\\small\n");
- printf("\\begin{multicols}{5}\n");
- printf("\\raggedright\n");
-
- ccount = 0;
- mcount = 0;
-
- for (j=0; j<height; j++) {
- strcpy(rowtext,"\0");
- for (k=0; k<width; k++) {
- /* Analyze position for across-number */
- /* Left edge non-black followed by non-black */
- anum = 0;
- if ( (k==0 && dspace[j][k]=='-' && dspace[j][k+1]=='-') ||
- /* Previous black - nonblack - nonblack */
- ( (k+1)<width && (k-1)>=0 && dspace[j][k]=='-'
- && dspace[j][k-1]=='.'
- && dspace[j][k+1]=='-' )
- ){
- ccount++;
- anum = ccount;
- }
- /* Analyze position for down-number */
- dnum = 0;
- /* Top row non-black followed by non-black */
- if ( (j==0 && dspace[j][k]=='-' && dspace[j+1][k]=='-') ||
- /* Black above - nonblack - nonblack below */
- ( (j-1)>=0 && (j+1)<height && dspace[j][k]=='-'
- && dspace[j-1][k]=='.'
- && dspace[j+1][k]=='-' )
- ){
- /* Don't double number the same space */
- if (anum == 0) ccount++;
- dnum = ccount;
- }
- /* Now, if necessary, pick up some clues and save them. */
- if (anum != 0) {
- fgetaline(tmp, infile);
- sprintf(&aclues[apos], "{\\bf %d} %s\\\\\n",
- anum, tmp);
- apos = strlen(aclues);
- }
- if (dnum != 0) {
- fgetaline(tmp, infile);
- sprintf(&dclues[dpos], "{\\bf %d} %s\\\\\n",
- dnum, tmp);
- dpos = strlen(dclues);
- }
- /* Concat the current info to the current row. */
- strcat(rowtext, "|");
- if (dspace[j][k] == '.') strcat(rowtext, "*");
- else {
- /* see if we need a grid number */
- if (dnum != 0) {
- sprintf(tmp, "[%d]", dnum);
- strcat(rowtext, tmp);
- }
- else if (anum != 0) {
- sprintf(tmp, "[%d]", anum);
- strcat(rowtext, tmp);
- }
- /* Put in solution letter */
- strncat(rowtext, &aspace[j][k], 1);
- }
- }
- /* End of the row. Put in marker and output it. */
- strcat(rowtext, "|.");
- sprintf(&matrix[mcount], "%s\n", rowtext);
- mcount = strlen(matrix);
- }
- /* That's it for the puzzle. */
-
- /* Now output the clue section */
- printf("{\\bf ACROSS}\\\\\n");
- printf("%s", aclues);
- printf("{\\bf DOWN}\\\\\n");
- printf("%s", dclues);
- printf("\\end{multicols}\n");
- printf("}\n");
-
- /* Now output the diagram */
- printf("\\newpage\n");
- printf("\\maketitle\n");
- printf("\\begin{Puzzle}{%d}{%d}\n", width, height);
- printf("%s", matrix);
- printf("\\end{Puzzle}\n");
-
- printf("\\end{document}\n");
-
- exit(0);
-
-}
-
- void fgetaline(char *foo, FILE *infile) {
- unsigned char i;
- int oe;
- oe = 0;
- strcpy(foo, "\0");
- while (1) {
- fread(&i, 1, 1, infile);
- if (feof(infile) || (i=='\0')) break;
- if (i == 169) {
- strcat(foo, "\\copyright ");
- }
- else {
- if (i == '_' || i == '&' || i == '#' || i == '$') strcat(foo, "\\");
- if (i == '"') {
- if ( oe == 0) {
- oe = 1;
- strcat(foo, "``");
- }
- else {
- oe = 0;
- strcat(foo, "''");
- }
- }
- else strncat(foo, &i, 1);
- }
- }
- }
-
-
-
diff --git a/Master/texmf-dist/source/latex/crossword/AcrossLite/usaconv.c b/Master/texmf-dist/source/latex/crossword/AcrossLite/usaconv.c
deleted file mode 100644
index 9f8433d4fd3..00000000000
--- a/Master/texmf-dist/source/latex/crossword/AcrossLite/usaconv.c
+++ /dev/null
@@ -1,229 +0,0 @@
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#define ROWSIZE 256
-
-FILE *infile;
-int width, height, j, k, ccount, mcount, anum, dnum;
-int apos, dpos;
-int acount, dcount;
-
-char inbuf[ROWSIZE];
-
-/* Here is a lazy programmer's waste of space. */
-char aspace[ROWSIZE][ROWSIZE];
-char dspace[ROWSIZE][ROWSIZE];
-
-char rowtext[10*ROWSIZE];
-char tmp[ROWSIZE];
-
-char title[80];
-char author[80];
-char copyright[80];
-char matrix[ROWSIZE*ROWSIZE*10];
-char actext[ROWSIZE][80];
-char dctext[ROWSIZE][80];
-char aclues[ROWSIZE*15*16];
-char dclues[ROWSIZE*15*16];
-
-void fgetsa(char *, int, FILE *);
-
-void main(int argc, char *argv[])
-{
-
-/* Open the puzzle file. */
- if (argc < 2) {
- printf("Usage: usaconv <puzzle file>\n");
- exit(1);
- }
- infile = fopen(argv[1], "r");
- if (infile == NULL) {
- printf("Error opening %s.\n");
- exit(1);
- }
-
-/* From here on we're assuming a non-corrupt puzzle file.
- An enhancement later could be to check for this. */
-
-/* start reading stuff in */
- fgetsa(inbuf, 80, infile); /*<ACROSS PUZZLE>*/
- fgetsa(inbuf, 80, infile); /*<TITLE>*/
- fgetsa(title, 80, infile);
- fgetsa(inbuf, 80, infile); /*<AUTHOR>*/
- fgetsa(author, 80, infile);
- fgetsa(inbuf, 80, infile); /*<COPYRIGHT>*/
- fgetsa(copyright,80, infile);
- fgetsa(inbuf, 80, infile); /*<SIZE>*/
-
- fgetsa(inbuf, 80, infile);
- height = width = 0 ; /* we calculate instead */
-
- fgetsa(inbuf, 80, infile); /*<GRID>*/
-
-/* Read in the first line of the solution/diagram and determine width */
- fgetsa(&aspace[height][0], 80, infile);
- width = strlen(&aspace[height][0]);
- height++;
- while (1) {
- fgetsa(&aspace[height][0], 80, infile);
- if(strcmp(&aspace[height][0],"<ACROSS>")==0) goto didit;
- height++;
- }
-didit:
- /* Read and save across and down clues */
-
- apos=dpos=0;
- while(1) {
- fgetsa(&actext[apos][0], 80, infile);
- if(strcmp(&actext[apos][0],"<DOWN>")==0)goto dida;
- apos++;
- }
-dida:
- while(1) {
- fgetsa(&dctext[dpos][0], 80, infile);
- if(feof(infile)) goto didd;
- dpos++;
- }
-didd:
- apos=dpos=0;
-
-/* Now we are ready to produce the LaTeX stuff for the
- puzzle diagram. Again we are assuming we have an unscrambled
- solution. How can we know this? Put on TODO list. */
-
-/* We write to standard out. Lazy but effective. */
-
- printf("\\documentclass{article}\n");
- printf("\\usepackage{cwpuzzle}\n");
- printf("\\title{%s}\n", title);
- printf("\\author{%s}\n", author);
- printf("\\date{%s}\n", copyright);
- printf("\\voffset -1in\n");
- printf("\\hoffset -1in\n");
- printf("\\begin{document}\n");
-
- ccount = 0;
- mcount = 0;
- acount = dcount = 0;
-
- for (j=0; j<height; j++) {
- strcpy(rowtext,"\0");
- for (k=0; k<width; k++) {
- /* Analyze position for across-number */
- /* Left edge non-black followed by non-black */
- anum = 0;
- if ( (k==0 && aspace[j][k]!='.' && aspace[j][k+1]!='.') ||
- /* Previous black - nonblack - nonblack */
- ( (k+1)<width && (k-1)>=0 && aspace[j][k]!='.'
- && aspace[j][k-1]=='.'
- && aspace[j][k+1]!='.' )
- ){
- ccount++;
- anum = ccount;
- }
- /* Analyze position for down-number */
- dnum = 0;
- /* Top row non-black followed by non-black */
- if ( (j==0 && aspace[j][k]!='.' && aspace[j+1][k]!='.') ||
- /* Black above - nonblack - nonblack below */
- ( (j-1)>=0 && (j+1)<height && aspace[j][k]!='.'
- && aspace[j-1][k]=='.'
- && aspace[j+1][k]!='.' )
- ){
- /* Don't double number the same space */
- if (anum == 0) ccount++;
- dnum = ccount;
- }
- /* Now, if necessary, assign some clues and save them. */
- if (anum != 0) {
- sprintf(&aclues[apos], "\\Clue{%d}{}{%s}\\\\\n",
- anum, actext[acount]);
- acount++;
- apos = strlen(aclues);
- }
- if (dnum != 0) {
- sprintf(&dclues[dpos], "\\Clue{%d}{}{%s}\\\\\n",
- dnum, dctext[dcount]);
- dcount++;
- dpos = strlen(dclues);
- }
- /* Concat the current info to the current row. */
- strcat(rowtext, "|");
- if (aspace[j][k] == '.') strcat(rowtext, "*");
- else {
- /* see if we need a grid number */
- if (dnum != 0) {
- sprintf(tmp, "[%d]", dnum);
- strcat(rowtext, tmp);
- }
- else if (anum != 0) {
- sprintf(tmp, "[%d]", anum);
- strcat(rowtext, tmp);
- }
- /* Put in solution letter */
-/* this is for real */ if (aspace[j][k]== '&') strncat(rowtext, "\\", 1);
- strncat(rowtext, &aspace[j][k], 1);
- }
- }
- /* End of the row. Put in marker and output it. */
- strcat(rowtext, "|.");
- sprintf(&matrix[mcount], "%s\n", rowtext);
- mcount = strlen(matrix);
- }
- /* That's it for the puzzle. */
-
- /* Now output the clue section */
- printf("\\begin{PuzzleClues}{\\textbf{Across}}\\\\\n");
- for (j=0; j<strlen(aclues); j++){
- printf("%c",aclues[j]);
- }
- printf("\\end{PuzzleClues}\n");
- printf("\\begin{PuzzleClues}{\\textbf{Down}}\\\\\n");
- for (j=0; j<strlen(dclues); j++){
- printf("%c",dclues[j]);
- }
- printf("\\end{PuzzleClues}\n");
-
- /* Now output the diagram */
- printf("\\newpage\n");
- printf("\\maketitle\n");
- printf("\\begin{Puzzle}{%d}{%d}\n", width, height);
- printf("%s", matrix);
- printf("\\end{Puzzle}\n");
-
-
- printf("\\end{document}\n");
-
- exit(0);
-
-}
-
- void fgetsa(char *foo, int size, FILE *infile) {
- int i, oe;
- fgets(tmp, size, infile);
- tmp[strlen(tmp)-1] = '\0';
- strcpy(foo, "\0");
- oe = 0;
- for (i=0; i<strlen(tmp); i++) {
- if (tmp[i]=='$' || tmp[i] == '_' || tmp[i] =='&' || tmp[i] == '#') strcat(foo, "\\");
- if (tmp[i] == '"') {
- if (oe == 0) {
- oe = 1;
- strcat(foo, "``");
- }
- else {
- oe = 0;
- strcat(foo, "''");
- }
- }
- else strncat(foo, &tmp[i], 1);
- }
- }
-
-
-
-
-
-
diff --git a/Master/texmf-dist/source/latex/crossword/Makefile b/Master/texmf-dist/source/latex/crossword/Makefile
index b1372e38a2a..e674b29df73 100644
--- a/Master/texmf-dist/source/latex/crossword/Makefile
+++ b/Master/texmf-dist/source/latex/crossword/Makefile
@@ -1,5 +1,5 @@
#******************************************************************************
-#* $Id: Makefile,v 1.5 2006/08/11 19:15:05 gene Exp $
+#* $Id: Makefile,v 1.9 2009/09/13 08:37:19 gene Exp gene $
#******************************************************************************
#* Author: Gerd Neugebauer
#*=============================================================================
@@ -24,7 +24,7 @@ all: cwpuzzle.sty cwpuzzle.pdf
cwpuzzle.sty sty: cwpuzzle.dtx cwpuzzle.ins
$(RM) cwpuzzle.cls cwpuzzle.sty
- $(LATEX) cwpuzzle.ins
+ $(PDFLATEX) cwpuzzle.ins
cwpuzzle.dvi dvi: cwpuzzle.dtx cwpuzzle.sty
$(LATEX) cwpuzzle.dtx
@@ -33,10 +33,24 @@ cwpuzzle.dvi dvi: cwpuzzle.dtx cwpuzzle.sty
$(MAKEINDEX) -s gglo.ist -o cwpuzzle.gls cwpuzzle.glo
$(LATEX) cwpuzzle.dtx
-cwpuzzle.pdf pdf: cwpuzzle.dtx cwpuzzle.sty
+cwpuzzle.pdf pdf: cwpuzzle.dtx cwpuzzle.sty cwpuzzle.gls
$(PDFLATEX) cwpuzzle.dtx
$(PDFLATEX) cwpuzzle.dtx
$(MAKEINDEX) -s gind.ist cwpuzzle
$(MAKEINDEX) -s gglo.ist -o cwpuzzle.gls cwpuzzle.glo
$(PDFLATEX) cwpuzzle.dtx
+cwpuzzle.gls:
+
+zip dist: ${FILES} cwpuzzle.pdf
+ zip cwpuzzle-`awk '/^\\\\xdef\\\\fileversion/{print $$2}' cwpuzzle.dtx`.zip \
+ ${FILES} cwpuzzle.pdf
+
+clean:
+ $(RM) cwpuzzle.log cwpuzzle.aux cwpuzzle.glo cwpuzzle.gls \
+ cwpuzzle.idx cwpuzzle.ilg cwpuzzle.ind cwpuzzle.toc
+
+veryclean: clean
+ $(RM) cwpuzzle.cls cwpuzzle.sty cwpuzzle.dvi cwpuzzle.pdf
+
+#
diff --git a/Master/texmf-dist/source/latex/crossword/cwpuzzle.dtx b/Master/texmf-dist/source/latex/crossword/cwpuzzle.dtx
index d97e650f3dc..efd2c7d27ac 100644
--- a/Master/texmf-dist/source/latex/crossword/cwpuzzle.dtx
+++ b/Master/texmf-dist/source/latex/crossword/cwpuzzle.dtx
@@ -1,10 +1,10 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% $Id: cwpuzzle.dtx,v 1.7 2009/09/06 15:16:53 gene Exp gene $
+%% $Id: cwpuzzle.dtx,v 1.8 2009/09/13 08:32:34 gene Exp gene $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\CWP@RCS$#1: #2 #3${#2}
\def\filename{cwpuzzle.dtx}
-\xdef\fileversion{\CWP@RCS$Revision: 1.7 $}
-\xdef\filedate{\CWP@RCS$Date: 2009/09/06 15:16:53 $}
+\xdef\fileversion{\CWP@RCS$Revision: 1.8 $}
+\xdef\filedate{\CWP@RCS$Date: 2009/09/13 08:32:34 $}
\let\docversion=\fileversion
\let\docdate=\filedate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -12,7 +12,7 @@
\typeout{%
%% Purpose:
Package: cwpuzzle \filedate\space\fileversion\space
- for typesetting crossword puzzles.
+ for typesetting crossword puzzles and more.
}%
%%
%% Documentation:
@@ -59,7 +59,7 @@
%\fi
%
% \title{A \LaTeX\ Package for Typesetting\\ Crossword
-% Puzzles\thanks{This file documents \filename\ version
+% Puzzles and More\thanks{This file documents \filename\ version
% \fileversion\ as of \filedate.}}
% \author{Gerd Neugebauer\\
% Im Lerchels\"ohl 5\\
@@ -73,22 +73,23 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% \DoNotIndex{\ ,\",\',\.,\,,\[,\\,\],\^,\`,\~,\@,\@dottedtocline}
+% \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,\relax,\renewcommand,\rm,\rule}
+% \DoNotIndex{\normalsize,\null,\par,\put,\raggedright,\raggedleft}
+% \DoNotIndex{\relax,\renewcommand,\RequirePackage,\rm,\rule}
% \DoNotIndex{\scriptsize,\sf,\small,\textsf,\textwidth}
-% \DoNotIndex{\the,\unitlength,\uppercase,\xdef,\ProvidesPackage}
+% \DoNotIndex{\the,\tiny,\unitlength,\uppercase,\xdef,\ProvidesPackage}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \changes{1.3}{1996/10/28}{First public release.}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \CheckSum{469}
+% \CheckSum{637}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% \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
@@ -646,7 +647,6 @@
% \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
@@ -719,6 +719,159 @@
% \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}}
+%
+%
+% \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.
@@ -900,9 +1053,22 @@
% This macro contains the content of a cell during formatting this
% cell. This enables the cell formating macro to access it.
%
+% \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.
%
@@ -922,9 +1088,8 @@
% since this program requires dictionaries which I can not
% distribute legally.
%
-% The examples in this documentation have been computed with the
-% help of the |cwp| program.
-%
+% The crossword examples in this documentation have been computed
+% with the help of the |cwp| program.
%
%
% \StopEventually{}
@@ -950,6 +1115,11 @@
% \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
@@ -1692,6 +1862,7 @@
% \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
@@ -1707,6 +1878,7 @@
% 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
@@ -1724,6 +1896,177 @@
\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.
diff --git a/Master/texmf-dist/source/latex/crossword/cwpuzzle.ins b/Master/texmf-dist/source/latex/crossword/cwpuzzle.ins
index 3b838f78224..964de081099 100644
--- a/Master/texmf-dist/source/latex/crossword/cwpuzzle.ins
+++ b/Master/texmf-dist/source/latex/crossword/cwpuzzle.ins
@@ -32,7 +32,7 @@
\Msg{****************************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the following}
-\Msg{* files into a directory searched by TeX:}
+\Msg{* files into a directory searched by (La)TeX:}
\Msg{*}
\Msg{* \space\space cwpuzzle.sty}
\Msg{*}
diff --git a/Master/texmf-dist/tex/latex/crossword/cwpuzzle.sty b/Master/texmf-dist/tex/latex/crossword/cwpuzzle.sty
index 44a95c17af2..674e11fbfa0 100644
--- a/Master/texmf-dist/tex/latex/crossword/cwpuzzle.sty
+++ b/Master/texmf-dist/tex/latex/crossword/cwpuzzle.sty
@@ -20,17 +20,17 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-%%^^A $Id: cwpuzzle.dtx,v 1.7 2009/09/06 15:16:53 gene Exp gene $
+%%^^A $Id: cwpuzzle.dtx,v 1.8 2009/09/13 08:32:34 gene Exp gene $
\def\CWP@RCS$#1: #2 #3${#2}
\def\filename{cwpuzzle.dtx}
-\xdef\fileversion{\CWP@RCS$Revision: 1.7 $}
-\xdef\filedate{\CWP@RCS$Date: 2009/09/06 15:16:53 $}
+\xdef\fileversion{\CWP@RCS$Revision: 1.8 $}
+\xdef\filedate{\CWP@RCS$Date: 2009/09/13 08:32:34 $}
\let\docversion=\fileversion
\let\docdate=\filedate
\typeout{%
%% Purpose:
Package: cwpuzzle \filedate\space\fileversion\space
- for typesetting crossword puzzles.
+ for typesetting crossword puzzles and more.
}%
%%
%% Documentation:
@@ -78,6 +78,7 @@
%% Right brace \} Tilde \~}
%%
\ProvidesPackage{cwpuzzle}[\filedate gene]
+\RequirePackage{amssymb}
\newdimen\PuzzleUnitlength
\PuzzleUnitlength=20pt
\newcommand\PuzzleClueFont{\footnotesize}
@@ -318,6 +319,7 @@
\newcommand\Puzzle@TYPE{normal}
\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
@@ -325,6 +327,7 @@
\def\Puzzle@TYPE{solution}%
}
\newcommand\PuzzleUnsolved{%
+ \let\Kakuro@HINT\Kakuro@hint
\let\PuzzleClues\Puzzle@Clues@@normal
\let\endPuzzleClues\endPuzzle@Clues@@normal
\let\PuzzleWords\Puzzle@Words@@normal
@@ -332,6 +335,67 @@
\xdef\Puzzle@TYPE{normal}}
\newif\ifPuzzle@SolutionNumbered
\Puzzle@SolutionNumberedfalse
+\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
+\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}}
+\newcommand\SudokuLinethickness{2pt}
+\newcommand\KakuroNumberFont{\sf\tiny}
+\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
+}%
+\def\Kakuro@always{\Puzzle@pipe[][fS]}%
+\def\Kakuro@empty{\Puzzle@pipe{}}%
+\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]{ }}%
+\def\Kakuro@nohint#1:#2>{%
+ \Puzzle@pipe[][,]{ }}%
+\let\Kakuro@HINT\Kakuro@hint
+\begingroup
+\catcode`\|=13
+\gdef\Kakuro#1#2{\begin{Puzzle}{#1}{#2}%
+ \catcode`\|=13
+ \let\Puzzle@pipe=|
+ \let|=\Kakuro@cell
+}
+\endgroup
+\def\endKakuro{\end{Puzzle}}
+\def\KakuroHintType{,}
\PuzzleUnsolved
\DeclareOption{numbered}{\Puzzle@SolutionNumberedtrue}
\DeclareOption{nocenter}{\let\PuzzlePre=\relax