summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/sudoku/sudoku.sty
blob: b955e2854b109df0ac9c140df541f1a21cfab3cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
%%
%% This is file `sudoku.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% sudoku.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright 2005,2006 Paul Abraham <paul.abraham@linuxdirect.org>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any
%% later version.
%% The latest version of this license is in
%%      http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2003/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% This Current Maintainer of this work is Paul Abraham.
%% 
%% This work consists of the files sudoku.dtx, sudoku.ins
%% README, CHANGES and the derived file sudoku.sty.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{sudoku}
 [2006/03/25 v1.0.1 Sudoku grid]
\newcounter{@sudoku@row}
\newcounter{@sudoku@col}
\newcommand*\@sudoku@separator[1]{%
        \stepcounter{@sudoku@col}%
        \ifx#1\@sudoku@separator
                \expandafter#1%
        \else
                \ifx.#1%
                        \setcounter{@sudoku@col}{-1}%
                        \addtocounter{@sudoku@row}{-1}%
                \else
                        \put(\value{@sudoku@col},\value{@sudoku@row})%
                        {\makebox(1,1){\sudokuformat{#1}}}%
                \fi
        \fi
}
\begingroup
        \catcode`\|=\active
        \gdef\@sudoku@activate{\let|=\@sudoku@separator}
\endgroup
\newcommand*\@sudoku@grid{
        \linethickness{\sudokuthinline}%
        \multiput(0,0)(1,0){10}{\line(0,1){9}}%
        \multiput(0,0)(0,1){10}{\line(1,0){9}}
        \linethickness{\sudokuthickline}%
        \multiput(0,0)(3,0){4}{\line(0,1){9}}%
        \multiput(0,0)(0,3){4}{\line(1,0){9}}
        \linethickness{0.5\sudokuthickline}%
        \put(0,0){\framebox(0,0){}}%
        \put(9,0){\framebox(0,0){}}%
        \put(0,9){\framebox(0,0){}}%
        \put(9,9){\framebox(0,0){}}
}
\newcommand*\sudokuformat[1]{\Huge\sffamily#1}
\newdimen\sudokusize
\setlength\sudokusize{10cm}
\newdimen\sudokuthinline
\setlength\sudokuthinline{0.4pt}
\newdimen\sudokuthickline
\setlength\sudokuthickline{2pt}
\newenvironment{sudoku-block}{%
        \catcode`\|=\active
        \@sudoku@activate
        \setcounter{@sudoku@col}{-1}%
        \setcounter{@sudoku@row}{8}%
        \setlength\unitlength{.111111\sudokusize}%
        \begin{picture}(9,9)%
        \@sudoku@grid\@sudoku@grab@arguments
        }{\end{picture}}
 \begingroup
   \@ifundefined{eTeXversion}{\endgroup
     \def\@sudoku@grab@arguments#1{%
       \ifx#1\@sudoku@separator
         \expandafter#1%
       \else
          \PackageError{sudoku}{%
            Sudoku puzzles are not allowed in the arguments\MessageBreak
            of other commands}{%
            Either fix this in your source (possibly using the `lrbox'
            environment) or use an eTeX based LaTeX format}
        \fi
     }%
   }{\endgroup
     \def\@sudoku@grab@arguments#1.#2.#3.#4.#5.#6.#7.#8.#9.{%
       \scantokens{#1.#2.#3.#4.#5.#6.#7.#8.#9.}}%
   }
\newenvironment{sudoku}{%
        \begin{center}%
        \begin{sudoku-block}}{\end{sudoku-block}\end{center}}
\endinput
%%
%% End of file `sudoku.sty'.