summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/crossword/cwpuzzle.sty
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/tex/latex/crossword/cwpuzzle.sty
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/tex/latex/crossword/cwpuzzle.sty')
-rw-r--r--Master/texmf-dist/tex/latex/crossword/cwpuzzle.sty72
1 files changed, 68 insertions, 4 deletions
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