diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty | 152 |
1 files changed, 125 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty b/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty index dbbc3e0b7a7..d16df95b6c8 100644 --- a/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty +++ b/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty @@ -19,7 +19,7 @@ %% %% This work consists of all files listed in manifest.txt. %% -\ProvidesPackage{logicpuzzle}[2013/05/03 logicpuzzle.sty v2.0 - Josef Kleber (C) 2013]% +\ProvidesPackage{logicpuzzle}[2013/05/10 logicpuzzle.sty v2.1 - Josef Kleber (C) 2013]% % \RequirePackage{xkeyval}% \RequirePackage{ifthen}% @@ -36,6 +36,8 @@ \pgfdeclarelayer{LPforegroundtwo}% \pgfsetlayers{LPdump,LPbgcolor,LPbackgroundtwo,LPbackground,main,LPforeground,LPforegroundtwo}% % +\newcounter{LP@rows}% +\newcounter{LP@columns}% \newcounter{LP@counter@unique}% \newcounter{LP@counti}% \newcounter{LP@countii}% @@ -69,17 +71,6 @@ % % init % -% #1 prefix -\newcommand*\LP@init@counter[1]% -{% - \newcounter{#1@rows}% - \newcounter{#1@columns}% - \setcounter{#1@rows}{\csname #1@rows\endcsname}% - \setcounter{#1@columns}{\csname #1@columns\endcsname}% - \stepcounter{#1@rows}% - \stepcounter{#1@columns}% -}% -% % #1 package prefix % #2 package % #3 option @@ -284,7 +275,7 @@ \stepcounter{LP@counter@unique}% \begin{pgfonlayer}{LPdump}% \node [shape=rectangle,inner sep=0pt] (A_\theLP@counter@unique) at (#1\LP@Pfive,#2\LP@Pfive) {\tikz\draw[scale=\LP@scale,color=\LP@sr@bgcolor] (0.08,0.1) rectangle (0.92,0.9);};% - \end{pgfonlayer}{LPdump} + \end{pgfonlayer}% \node [shape=rectangle,inner sep=0pt,anchor=north west,scale=\LP@scale,font=\tiny] at (A_\theLP@counter@unique.north west) {$#3$};% }% % @@ -484,6 +475,40 @@ \stepcounter{LP@countii}% }% % +\def\LP@KKR@print@element#1% +{% + \if!\ifnum9<1#1!\else_\fi% + \ifLP@KKR@solution% + \setcell{\arabic{LP@counti}}{\arabic{LP@countii}}{#1}% + \else% + \fi% + \else% + #1% + \fi% +}% +% +\newcommand*\kakurorow[2]% +{% + \setcounter{LP@counti}{1}% + \setcounter{LP@countii}{#1}% + \foreach \LP@element in {#2}% + {% + \LP@KKR@print@element{\LP@element}% + \stepcounter{LP@counti}% + };% +}% +% +\newcommand*\kakurocolumn[2]% +{% + \setcounter{LP@counti}{#1}% + \setcounter{LP@countii}{1}% + \foreach \LP@element in {#2}% + {% + \LP@KKR@print@element{\LP@element}% + \stepcounter{LP@countii}% + };% +}% +% \newcommand*\fillcell[2]% {% \LP@set@LP@scale{\LP@env@prefix}% @@ -675,7 +700,7 @@ % \newcommand*\LP@toprow@i[2]% {% - \LP@setrowcontents{#1}{1}{\csname the#2@rows\endcsname}% + \LP@setrowcontents{#1}{1}{\theLP@rows}% }% % \newcommand*\LP@rightcolumn[1]% @@ -685,7 +710,7 @@ % \newcommand*\LP@rightcolumn@i[2]% {% - \LP@setcolumncontents{#1}{\csname the#2@columns\endcsname}{1}% + \LP@setcolumncontents{#1}{\theLP@columns}{1}% }% % \newcommand*\LP@rightcolumn@edge[1]% @@ -695,7 +720,7 @@ % \newcommand*\LP@rightcolumn@edge@i[2]% {% - \LP@setcolumncontents@edge{#1}{\csname the#2@columns\endcsname}{1}% + \LP@setcolumncontents@edge{#1}{\theLP@columns}{1}% }% % % Presentation @@ -745,12 +770,12 @@ \newcommand*\LP@Cross% {% \LP@set@LP@scale{\LP@env@prefix}% - \begin{tikzpicture} - \begin{pgfonlayer}{LPforeground} + \begin{tikzpicture}% + \begin{pgfonlayer}{LPforeground}% \pgfmathsetmacro{\LPlinewidth}{3pt*\LP@scale}% \draw[line width=\LPlinewidth,scale=\LP@scale,color=LP@c@cross] (.35,.35) -- (0.65,.65) -- (.5,.5) -- (.65,.35)-- (.35,.65);% - \end{pgfonlayer} - \end{tikzpicture} + \end{pgfonlayer}% + \end{tikzpicture}% }% % \newcommand*\LP@Mirror[1]% @@ -768,7 +793,7 @@ % \newcommand*\LP@Mine% {% - \begin{tikzpicture}[scale=\LP@scale]% + \begin{tikzpicture}[scale=\LP@scale]% \fill[color=black] (.2,.5) -- (.5,.6) -- (.5,.4) -- cycle;% \fill[color=black] (.8,.5) -- (.5,.6) -- (.5,.4) -- cycle;% \fill[color=black] (.5,.8) -- (.4,.5) -- (.6,.5) -- cycle;% @@ -814,6 +839,81 @@ \egroup% }% % +\newcommand*\LP@Tree% +{% + \begin{tikzpicture}[scale=.07*\LP@scale]% + \draw[fill=brown!95!black!95,line width=.1pt*\LP@scale]% + (.75,-1) .. controls (.5,.5) and (.5,3) .. (0.5,4) --% + (-0.5,4) .. controls (-.5,3) and (-.5,.5) .. (-.75,-1);% + \shade[top color=green!50!black!60,draw=black,line width=.1pt*\LP@scale,bottom color=green!50!black]% + (0,10) .. controls (0,8) and (1,7) .. (1.5,7)% + .. controls (1,7) and (1,7) .. (0.5,7.25)% + .. controls (1.5,5) and (2.5,4) .. (3,4)% + .. controls (2,4) and (1.25,4) .. (1,4.5)% + .. controls (2,2) and (3.5,2) .. (4,2)% + .. controls (1,1) and (-1,1) .. (-4,2)% + .. controls (-3.5,2) and (-2,2) .. (-1,4.5)% + .. controls (-1.25,4) and (-2,4) .. (-3,4)% + .. controls (-2.5,4) and (-1.5,5) .. (-0.5,7.25)% + .. controls (-1,7) and (-1,7) .. (-1.5,7)% + .. controls (-1,7) and (0,8) .. (0,10);% + \end{tikzpicture}% +}% +% +\let\Tree\LP@Tree% +% +\newcommand*\LP@Tent% +{% + \begin{tikzpicture}[scale=\LP@scale]% + \draw[fill=yellow!50,line width=.1pt*\LP@scale] (.1,.1) -- (.6,.1) -- (.9,.5) -- (.75,.8) -- (.35,.6) -- cycle;% + \draw[line width=.1pt*\LP@scale] (.35,.6) -- (.35,.1);% + \draw[line width=.1pt*\LP@scale] (.35,.6) -- (.6,.1);% + \end{tikzpicture}% +}% +% +\let\Tent\LP@Tent% +% +\newcommand*\KKR[2]% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \LP@set@LP@bgcolor{\LP@env@prefix}% + \LP@set@LP@color{\LP@env@prefix}% + \ifthenelse{\equal{\LP@bgcolor}{}}% + {\gdef\LP@sr@bgcolor{white}}% + {\gdef\LP@sr@bgcolor{\LP@bgcolor}}% + \stepcounter{LP@counter@unique}% + \begin{pgfonlayer}{LPdump}% + \node [shape=rectangle,inner sep=0pt] (A_\theLP@counter@unique) at (\arabic{LP@counti}\LP@Pfive,\arabic{LP@countii}\LP@Pfive) {\tikz\draw[scale=\LP@scale,color=\LP@sr@bgcolor] (0.08,0.1) rectangle (0.92,0.9);};% + \end{pgfonlayer}% + \begin{puzzlebackground}% + \fill[color=\LP@color] (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(1,1);% + \draw[line width=\LP@normallines] (\arabic{LP@counti},\arabic{LP@countii}) -- ++(0,1) -- ++(1,-1);% + \end{puzzlebackground}% + \node [shape=rectangle,inner sep=0pt,anchor=south west,scale=\LP@scale,font=\small] at (A_\theLP@counter@unique.south west) {#1};% + \node [shape=rectangle,inner sep=0pt,anchor=north east,scale=\LP@scale,font=\small] at (A_\theLP@counter@unique.north east) {#2};% +}% +% +\newcommand*\Black% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \begin{puzzlebackground}% + \fill[color=black] (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(1,1);% + \end{puzzlebackground}% +}% +% +\newcommand*\LP@Diamond% +{% + \begin{tikzpicture}[scale=\LP@scale*.9]% + \clip (.05,.905) rectangle (.95,.1);% + \draw[line width=\LP@normallines,fill=yellow!20] (.5,.1) -- (.7,.9) -- (.3,.9) -- cycle;% + \draw[line width=\LP@normallines,fill=orange!20] (.5,.1) -- (.7,.9) -- (.9,.8) -- cycle;% + \draw[line width=\LP@normallines,fill=orange!20] (.5,.1) -- (.3,.9) -- (.1,.8) -- cycle;% + \draw[line width=\LP@normallines] (.1,.8) -- (.9,.8);% +\end{tikzpicture}% +}% +% +\let\Diamond\LP@Diamond% +% % get package options with prefix % \newcommand*\LP@set@LP@scale[1]% @@ -899,8 +999,6 @@ % \ProcessOptionsX\relax% % -\LP@init@counter{\LP@LP@init@prefix}% -% \let\logicpuzzlecell\setcell% % \newcommand*\logicpuzzlesetup[1]% @@ -913,10 +1011,10 @@ \setkeys{logicpuzzle}{#1}% \LP@set@package{logicpuzzle}% \LP@set@env@prefix{LP@LP}% - \setcounter{LP@LP@rows}{\LP@LP@rows}% - \setcounter{LP@LP@columns}{\LP@LP@columns}% - \stepcounter{LP@LP@rows}% - \stepcounter{LP@LP@columns}% + \setcounter{LP@rows}{\LP@LP@rows}% + \setcounter{LP@columns}{\LP@LP@columns}% + \stepcounter{LP@rows}% + \stepcounter{LP@columns}% \begin{minipage}[t]{\LP@LP@width}% \ifthenelse{\equal{\LP@LP@title}{}}% {\par\enspace\par}% empty |