diff options
author | Karl Berry <karl@freefriends.org> | 2009-09-06 23:33:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-09-06 23:33:52 +0000 |
commit | e3fc112b2ceec82657c11e788064ee66cdb0c9e3 (patch) | |
tree | f470e89e44659e2ff90f977cdac6dd981223d983 /Master/texmf-dist/tex | |
parent | ac1fc30e3b72fa74dd581a3ebda79152734b638d (diff) |
crossword update (6sep09)
git-svn-id: svn://tug.org/texlive/trunk@15166 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/crossword/cwpuzzle.sty | 358 |
1 files changed, 358 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/crossword/cwpuzzle.sty b/Master/texmf-dist/tex/latex/crossword/cwpuzzle.sty new file mode 100644 index 00000000000..44a95c17af2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/crossword/cwpuzzle.sty @@ -0,0 +1,358 @@ +%% +%% 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.7 2009/09/06 15:16:53 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 $} +\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 +%% Im Lerchelsöhl 5 +%% 64521 Groß-Gerau +%% Mail: gene@gerd-neugebauer.de +%% +%% Copyright (C) 1995-2009 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. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% \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]{\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 +} +\newcommand\PuzzleLineThickness{.25pt} +\newcommand\PuzzlePre{% + \par\noindent\mbox{}\hfill +} +\newcommand\PuzzlePost{% + \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[1][]{% + \def\Puzzle@tmp@{#1}% + \Puzzle@Box@@normal@ +} +\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 +} +\def\PuzzlePutNumber#1#2#3{% + \put(#1,#2){\makebox(1,.95)[tl]{\PuzzleNumberFont\,#3}}% +} +\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 +} +\newcommand\Puzzle@Box@@solution[1][]{% + \def\Puzzle@tmp@{#1}% + \Puzzle@Box@@solution@ +} +\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){\makebox(1,1){\uppercase{#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 +} +\newcommand\PuzzleDefineCell[2]{ + \global\@namedef{Puzzle@Cell@@#1}##1##2{#2}% +} +\newcommand\PuzzleDefineColorCell[2]{ + \global\@namedef{Puzzle@Cell@@#1}##1##2{% + \fboxsep=0pt + \put(##1,##2){\makebox(1,1){\colorbox{#2}{\makebox(1,1){}}}} + }% +} +\def\PuzzleThickline{\linethickness{2pt}} +\PuzzleDefineCell{T}{{% + \advance#2 1 + \PuzzleThickline + \put(#1,#2){{\line(1,0){1}}} +}} +\PuzzleDefineCell{t}{{% + \put(#1,#2){\framebox(1,1){}} + \advance#2 1 + \PuzzleThickline + \put(#1,#2){{\line(1,0){1}}} +}} +\PuzzleDefineCell{B}{{% + \PuzzleThickline + \put(#1,#2){{\line(1,0){1}}} +}} +\PuzzleDefineCell{b}{{% + \put(#1,#2){\framebox(1,1){}} + \PuzzleThickline + \put(#1,#2){{\line(1,0){1}}} +}} +\PuzzleDefineCell{l}{{% + \put(#1,#2){\framebox(1,1){}} + \PuzzleThickline + \put(#1,#2){{\line(0,1){1}}} +}} +\PuzzleDefineCell{L}{{% + \PuzzleThickline + \put(#1,#2){{\line(0,1){1}}} +}} +\PuzzleDefineCell{r}{{% + \put(#1,#2){\framebox(1,1){}} + \advance #1 1 + \PuzzleThickline + \put(#1,#2){{\line(0,1){1}}} +}} +\PuzzleDefineCell{R}{{% + \advance #1 1 + \PuzzleThickline + \put(#1,#2){{\line(0,1){1}}} +}} +\PuzzleDefineCell{f}{{% + \put(#1,#2){\framebox(1,1){}} +}} +\PuzzleDefineCell{S}{{% + \put(#1,#2){\makebox(1,1){\expandafter\uppercase{\PuzzleContent}}} +}} +\PuzzleDefineCell{.}{} +\PuzzleDefineCell{O}{{% + \put(\the#1.5,\the#2.5){\oval(1,1){}} +}} +\PuzzleDefineCell{o}{{% + \put(#1,#2){\framebox(1,1){}} + \put(\the#1.5,\the#2.5){\oval(1,1){}} +}} +\PuzzleDefineCell{*}{% + \put(#1,#2){\framebox(1,1){\PuzzleBlackBox}} +} +\PuzzleDefineCell{/}{{% + \put(#1,#2){{\line(1,1){1}}} +}} +\PuzzleDefineCell{,}{{% + \advance#2 1 + \put(#1,#2){{\line(1,-1){1}}} +}} +\newcommand\Puzzle@Clue@@normal[3]{\textsf{#1} #3 } +\newcommand\Puzzle@Clue@@solution[3]{} +\newenvironment{Puzzle@Clues@@normal}[1]{% + \let\Clue\Puzzle@Clue@@normal + \PuzzleCluePre + \PuzzleClueFont{#1}% +}{\PuzzleCluePost } +\newcommand\PuzzleCluePre{% + \null\hfill + \begin{minipage}[t]{.45\textwidth}% +} +\newcommand\PuzzleCluePost{ + \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 + \def\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 +\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 +\endinput +%% +%% End of file `cwpuzzle.sty'. |