%%
%% This is file `cwpuzzle.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% cwpuzzle.dtx 
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from cwpuzzle.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file cwpuzzle.dtx.
%% 
%% This generated file may be distributed as long as the
%% 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.4 1996/11/25 21:20:35 gerd Exp gerd $
\def\DTK@RCS$#1: #2 #3${#2}
\def\filename{cwpuzzle.dtx}
\xdef\fileversion{\DTK@RCS$Revision: 1.4 $}
\xdef\filedate{\DTK@RCS$Date: 1996/11/25 21:20:35 $}
\let\docversion=\fileversion
\let\docdate=\filedate
\typeout{%
%% Purpose:
        Package: cwpuzzle \filedate\space\fileversion\space
        for typesetting crossword puzzles.
}%
%%
%% 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
%%         Mainzer Str. 8
%%         56321 Rhens
%% Mail:   gerd@informatik.uni-koblenz.de
%%
%% Copyright (C) 1996 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
%%  dtk.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.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  \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         \~}
%%
\ProvidesPackage{cwpuzzle}[\filedate gene]
\newdimen\PuzzleUnitlength
\PuzzleUnitlength=20pt
\newcommand\PuzzleClueFont{\footnotesize}
\newcommand\PuzzleFont{\rm\normalsize}
\newcommand\PuzzleNumberFont{\sf\scriptsize}
\let\PuzzleHook=\relax
\newcount\Puzzle@X
\newcount\Puzzle@Y
\begingroup
\catcode`\|=13
\gdef\Puzzle@@solution{
  \let|=\Puzzle@Box@@solution
  \let\Frame=\Puzzle@Frame@@solution
}
\gdef\Puzzle@@normal{
  \let|=\Puzzle@Box@@normal
  \let\Frame=\Puzzle@Frame@@normal
}
\endgroup
\newenvironment{Puzzle}[2]{\par\noindent\mbox{}\hfill
  \catcode`\|=13
  \@nameuse{Puzzle@@\Puzzle@TYPE}%
  \unitlength=\PuzzleUnitlength
  \Puzzle@Y=#2
  \begin{picture}(#1,#2)
    \Puzzle@Box@@normal.
}{%
    \PuzzleHook
  \end{picture}\hfill\null\par\noindent
}
\newcommand\Puzzle@Frame@@normal[5]{\put(#1,#2){\framebox(#3,#4){%
      \begin{minipage}{#3\unitlength}\begin{center} #5
      \end{center}\end{minipage}}}}
\newcommand\Puzzle@Frame@@solution[5]{}
\newcommand\PuzzleBlackBox{\rule{\PuzzleUnitlength}{\PuzzleUnitlength}}
\newcommand\Puzzle@Box@@normal[2][]{%
  \def\Puzzle@tmp{#2}%
  \if\Puzzle@tmp.
    \Puzzle@X=0\relax \advance\Puzzle@Y-1
  \else
    \ifx\@empty\Puzzle@tmp
    \else
    \if\Puzzle@tmp*
    \put(\Puzzle@X,\Puzzle@Y){\framebox(1,1){\PuzzleBlackBox}}
    \else
    \put(\Puzzle@X,\Puzzle@Y){\framebox(1,1){}}
    \fi
    \fi
    \def\Puzzle@tmp{#1}%
    \ifx\@empty\Puzzle@tmp\else
      \put(\Puzzle@X,\Puzzle@Y){%
        \makebox(1,.95)[tl]{\PuzzleNumberFont\,#1}}%
    \fi
    \advance\Puzzle@X 1
  \fi
}
\newcommand\Puzzle@Box@@solution[2][]{%
  \def\Puzzle@tmp{#2}%
  \if\Puzzle@tmp.
    \Puzzle@X=0\relax \advance\Puzzle@Y-1
  \else
    \ifx\Puzzle@tmp\@empty
    \else\if\Puzzle@tmp*
    \put(\Puzzle@X,\Puzzle@Y){\framebox(1,1){\PuzzleBlackBox}}
    \else
    \put(\Puzzle@X,\Puzzle@Y){\framebox(1,1){\uppercase{#2}}}%
    \fi
    \fi
    \def\Puzzle@tmp{#1}%
    \ifx\Puzzle@tmp\@empty\else
      \ifPuzzle@SolutionNumbered
      \put(\Puzzle@X,\Puzzle@Y){%
        \makebox(1,.95)[tl]{\PuzzleNumberFont\,#1}}%
    \fi
    \fi
    \advance\Puzzle@X 1
  \fi
}
\newcommand\Puzzle@Clue@@normal[3]{\textsf{#1} #3 }
\newcommand\Puzzle@Clue@@solution[3]{}
\newenvironment{Puzzle@Clues@@normal}[1]{%
  \null\hfill
  \let\Clue\Puzzle@Clue@@normal
  \begin{minipage}[t]{.45\textwidth}%
    \PuzzleClueFont{#1}%
}{\end{minipage}\hfill\null }
\newenvironment{Puzzle@Clues@@solution}[1]{%
  \let\Clue\Puzzle@Clue@@solution
}{}
\newcommand\PuzzleWordsText[1]{Words of length #1: }
\newenvironment{Puzzle@Words@@normal}[1]{%
  \PuzzleWordsText{#1}%
  \let\Word\relax
}{\par}
\newenvironment{Puzzle@Words@@solution}[1]{%
  \newcommand\Word[1]{}%
}{}
\newcommand\PuzzleNumbers[1]{\begingroup
  \@nameuse{Puzzle@@\Puzzle@TYPE}%
  \Puzzle@Y=0
  \Puzzle@X=1
  \unitlength=\PuzzleUnitlength
  \Puzzle@Numbers#1.\endgroup}
\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
\newcommand\PuzzleLettersText{The following letters are used: }
\newcommand\PuzzleLetters[1]{\PuzzleLettersText #1\par}
\newcommand\Puzzle@TYPE{normal}
\newcommand\PuzzleSolution[1][false]{%
  \@nameuse{Puzzle@SolutionNumbered#1}%
  \let\PuzzleClues\Puzzle@Clues@@solution
  \let\endPuzzleClues\endPuzzle@Clues@@solution
  \let\PuzzleWords\Puzzle@Words@@solution
  \let\endPuzzleWords\endPuzzle@Words@@solution
  \xdef\Puzzle@TYPE{solution}}
\newcommand\PuzzleUnsolved{%
  \let\PuzzleClues\Puzzle@Clues@@normal
  \let\endPuzzleClues\endPuzzle@Clues@@normal
  \let\PuzzleWords\Puzzle@Words@@normal
  \let\endPuzzleWords\endPuzzle@Words@@normal
  \xdef\Puzzle@TYPE{normal}}
\newif\ifPuzzle@SolutionNumbered
\Puzzle@SolutionNumberedfalse
\PuzzleUnsolved
\endinput
%%
%% End of file `cwpuzzle.sty'.
