I like crossword puzzles. I like hard crossword puzzles.
I like strange, hard crossword puzzles where the clues are so puzzling that you have no idea what could be meant by them...

When I found the cwpuzzle LaTeX package I tried to generate one myself, but creating the puzzle inside of the .tex file was a little confusing. Not that it isn't well structured - but the puzzle should be designed before you start with the .tex file.

Since I am an avid LaTeX fan (because of the great usability as a beautiful output system for dynamically generated data, amongst other reasons) I wrote a little script in perl to take a puzzle in its simplest form and generate the semi-completed LaTeX file from it. All that is missing afterwards are the clues, which are to be comfortably inserted with your favorite editor.

 

 

Here is how you do it:

Download the script from here: txt2cwp.tar.bz2

Create a simple textfile containing only a filled out crossword form.
Filled (solid black) blocks in the puzzle are set by the character '_' (underscore).
You don't have to set up the dimension of the puzzle - just put the same number of letters into each line.

If you look at the example in 'cwp.txt' you will find its content to be:

counter
hex_rsa
amt_and
r_esc__
_friend
vim__or

It is very easy to fill such a puzzle if you start with something like this:

counter
..x....
..t....
..e....
..r....
..m....

and fill in the missing letters in replace (overwrite) mode in your editor.

Then you can parse the source file through txt2cwp:

  • 'txt2cwp cwp.txt'

This generates cwp.tex, a frameset for your puzzle in which only the clues are missing.
You have to insert the clues into the tex file at the appropriate positions:

.tex file excerpt before entering clues

should become something like this:

.tex file excerpt after entering clues

Since the solution to each clue is given as second parameter to \Clue, this should be very easy, in fact, dare I say, comfortable!

After all the clues are added compile the tex file using:

  • 'pdflatex cwp.tex'

and you are done...

Enjoy!

The complete crossword puzzle