%% %% Copyright (C) 2013 by: %% Josef Kleber %% %% %% This file 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 "author-maintained". %% %% The Current Maintainer of this work is Josef Kleber. %% %% This work consists of all files listed in manifest.txt. %% \ProvidesPackage{logicpuzzle}[2013/04/20 logicpuzzle.sty v1.9 - Josef Kleber (C) 2013]% % \RequirePackage{xkeyval}% \RequirePackage{ifthen}% \RequirePackage{ragged2e}% \RequirePackage{etoolbox}% \RequirePackage{marginnote}% \RequirePackage{tikz}% \usetikzlibrary{decorations.pathmorphing,calc}% \pgfdeclarelayer{LPdump}% \pgfdeclarelayer{LPbgcolor}% \pgfdeclarelayer{LPbackgroundtwo}% \pgfdeclarelayer{LPbackground}% \pgfdeclarelayer{LPforeground}% \pgfdeclarelayer{LPforegroundtwo}% \pgfsetlayers{LPdump,LPbgcolor,LPbackgroundtwo,LPbackground,main,LPforeground,LPforegroundtwo}% % \newcounter{LP@counter@unique}% \newcounter{LP@counti}% \newcounter{LP@countii}% \newcounter{LP@whiledo@i}% \newcounter{LP@whiledo@ii}% \newcounter{LP@count@ig@i}% \newcounter{LP@count@ig@ii}% \newcounter{LP@count@ig@iii}% \newcounter{LP@count@ig@iv}% \newcounter{LP@puzzlecounter}% \setcounter{LP@puzzlecounter}{1}% % \newcommand*\LP@counterstyle{none}% \newcommand*\LP@titleformat{}% \gdef\LP@env@prefix{}% \gdef\LP@package{}% \gdef\LP@rows{}% \gdef\LP@columns{}% \gdef\LP@scale{1}% \gdef\LP@color{black}% \gdef\LP@bgcolor{}% \gdef\LP@fontsize\Large% \gdef\LP@cvoffset{0pt}% % \def\LP@normallines{0.5pt}% \def\LP@thicklines{1.5pt}% \def\LP@grid@linestyle{}% % \newcommand*\LP@Pfive{.5}% % % 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 % #4 default \newcommand*\LP@define@key[4]% {% \expandafter\gdef\csname#1@#3\endcsname{#4}% \define@key{#2.sty}{#3}[#4]% {% \expandafter\gdef\csname#1@#3\endcsname{##1}% }% \define@key{#2}{#3}% {% \expandafter\def\csname#1@#3\endcsname{##1}% }% }% % % #1 package prefix % #2 package % #3 default \newcommand*\LP@define@choicekey@fontsize[3]% {% \expandafter\gdef\csname#1@fontsize\endcsname{\Large}% \define@choicekey*{#2.sty}{fontsize}[\LP@dck@fontsize\nr]{tiny,scriptsize,footnotesize,small,normalsize,large,Large,LARGE,huge,Huge}[#3]% {% \ifcase\nr\relax% \expandafter\gdef\csname#1@fontsize\endcsname{\tiny}% \or% \expandafter\gdef\csname#1@fontsize\endcsname{\scriptsize}% \or% \expandafter\gdef\csname#1@fontsize\endcsname{\footnotesize}% \or% \expandafter\gdef\csname#1@fontsize\endcsname{\small}% \or% \expandafter\gdef\csname#1@fontsize\endcsname{\normalsize}% \or% \expandafter\gdef\csname#1@fontsize\endcsname{\large}% \or% \expandafter\gdef\csname#1@fontsize\endcsname{\Large}% \or% \expandafter\gdef\csname#1@fontsize\endcsname{\LARGE}% \or% \expandafter\gdef\csname#1@fontsize\endcsname{\huge}% \or% \expandafter\gdef\csname#1@fontsize\endcsname{\Huge}% \fi% }% \define@choicekey*{#2}{fontsize}[\LP@dck@fontsize\nr]{tiny,scriptsize,footnotesize,small,normalsize,large,Large,LARGE,huge,Huge}[#3]% {% \ifcase\nr\relax% \expandafter\def\csname#1@fontsize\endcsname{\tiny}% \or% \expandafter\def\csname#1@fontsize\endcsname{\scriptsize}% \or% \expandafter\def\csname#1@fontsize\endcsname{\footnotesize}% \or% \expandafter\def\csname#1@fontsize\endcsname{\small}% \or% \expandafter\def\csname#1@fontsize\endcsname{\normalsize}% \or% \expandafter\def\csname#1@fontsize\endcsname{\large}% \or% \expandafter\def\csname#1@fontsize\endcsname{\Large}% \or% \expandafter\def\csname#1@fontsize\endcsname{\LARGE}% \or% \expandafter\def\csname#1@fontsize\endcsname{\huge}% \or% \expandafter\def\csname#1@fontsize\endcsname{\Huge}% \fi% }% }% % % colors % % #1 name % #2 rgb color \newcommand*\LP@definecolor[2]% {% \definecolor{#1}{rgb}{#2}% }% % \LP@definecolor{LP@c@i}{.9,.9,.98}% \LP@definecolor{LP@c@ii}{.688,.932,.932}% \LP@definecolor{LP@c@iii}{.88,1,1}% \LP@definecolor{LP@c@iv}{1,1,.88}% \LP@definecolor{LP@c@v}{1,.855,.725}% \LP@definecolor{LP@c@vi}{.498,1,0}% \LP@definecolor{LP@c@vii}{.53,.808,.98}% \LP@definecolor{LP@c@viii}{.196,.804,.196}% \LP@definecolor{LP@c@ix}{1,.96,.932}% \LP@definecolor{LP@c@griddots}{.25,.51,.33}% \LP@definecolor{LP@c@cross}{.25,.51,.33}% \LP@definecolor{LP@c@mirror}{.8,.8,.8}% % % drawing grids % % #1 grid x min % #2 grid y min % #3 grid x max % #4 grid y max % #5 step \newcommand*\LP@drawgrid[5]% {% \setcounter{LP@counti}{#3}% max column \setcounter{LP@countii}{#4}% max row \stepcounter{LP@counti}% \stepcounter{LP@countii}% \draw[step=#5,line width=\LP@normallines,\LP@grid@linestyle] (#1,#2) grid (\value{LP@counti},\value{LP@countii});% }% % \newcommand*\LP@drawgriddots% {% \LP@set@LP@scale{\LP@env@prefix}% \pgfmathsetmacro{\START}{1}% % dots are drawn immediatly after the grid, % so we can recycle LP@counti and LP@countii \pgfmathsetmacro{\ENDC}{\arabic{LP@counti}}% \pgfmathsetmacro{\ENDR}{\arabic{LP@countii}}% \begin{pgfonlayer}{LPforeground}% \foreach \i in {\START,...,\ENDC}% \foreach \j in {\START,...,\ENDR}% \fill[color=LP@c@griddots] (\i,\j) circle [radius=3pt];% \end{pgfonlayer}% }% \newcommand*\LP@drawsudokugrid% {% \draw[line width=\LP@thicklines] (1,1) -- (1,10);% \draw[line width=\LP@thicklines] (4,1) -- (4,10);% \draw[line width=\LP@thicklines] (7,1) -- (7,10);% \draw[line width=\LP@thicklines] (10,1) -- (10,10);% \draw[line width=\LP@thicklines] (1,1) -- (10,1);% \draw[line width=\LP@thicklines] (1,4) -- (10,4);% \draw[line width=\LP@thicklines] (1,7) -- (10,7);% \draw[line width=\LP@thicklines] (1,10) -- (10,10);% }% % % drawing grid background % % #1 grid x min % #2 grid y min % #3 grid x max % #4 grid y max % #5 bgcolor \newcommand*\LP@drawbackground[5]% {% \ifthenelse{\equal{#5}{}}% {}% no bgcolor {% \setcounter{LP@counti}{#3}% max column \setcounter{LP@countii}{#4}% max row \stepcounter{LP@counti}% \stepcounter{LP@countii}% \begin{pgfonlayer}{LPbgcolor}% \fill[color=#5] (#1,#2) rectangle (\value{LP@counti},\value{LP@countii});% \end{pgfonlayer}{LPbgcolor}% }% }% % % In the grid % \newcommand*\LP@ingrid[5]% {% \setcounter{LP@count@ig@i}{#1}% column \setcounter{LP@count@ig@ii}{#2}% row \setcounter{LP@count@ig@iii}{#3}% max column \setcounter{LP@count@ig@iv}{#4}% max row %#5 style % \ifnum\value{LP@count@ig@i}<1% \PackageError{#5}% {element outside of the grid}% {You tried to set an element at (#1,#2),\MessageBreak which is outside the grid (1,1) .. (#3,#4)}% \fi% \ifnum\value{LP@count@ig@ii}<1% \PackageError{#5}% {element outside of the grid}% {You tried to set an element at (#1,#2),\MessageBreak which is outside the grid (1,1) .. (#3,#4)}% \fi% \ifnum\value{LP@count@ig@i}>\value{LP@count@ig@iii}% \PackageError{#5}% {element outside of the grid}% {You tried to set an element at (#1,#2),\MessageBreak which is outside the grid (1,1) .. (#3,#4)}% \fi% \ifnum\value{LP@count@ig@ii}>\value{LP@count@ig@iv}% \PackageError{#5}% {element outside of the grid}% {You tried to set an element at (#1,#2),\MessageBreak which is outside the grid (1,1) .. (#3,#4)}% \fi% }% % \newcommand*\setrule[3]% {% \LP@set@LP@scale{\LP@env@prefix}% \LP@set@LP@bgcolor{\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 (#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} \node [shape=rectangle,inner sep=0pt,anchor=north west,scale=\LP@scale,font=\tiny] at (A_\theLP@counter@unique.north west) {$#3$};% }% % % #1 column % #2 row % #3 content \newcommand*\LP@setcellcontent[3]% {% \node at (#1\LP@Pfive,#2\LP@Pfive){#3};% }% % % #1 column % #2 row % #3 content \newcommand*\LP@setcellcontentC[3]% {% \node at (#1,#2){#3};% }% % \newcommand*\LP@setcellcontentVE[3]% {% \node at (#1,#2\LP@Pfive){#3};% }% % \newcommand*\LP@setcellcontentHE[3]% {% \node at (#1\LP@Pfive,#2){#3};% }% % % #1 csv list % #2 column % #3 row \newcommand*\LP@setrowcontents[3]% {% \setcounter{LP@counti}{#2}% \setcounter{LP@countii}{#3}% \forcsvlist\LP@setrowcontents@i{#1}{\LP@env@prefix}% }% % \newcommand*\LP@setrowcontents@i[1]% {% \LP@setrowcontents@ii{#1}{\LP@env@prefix}% }% % \newcommand*\LP@setrowcontents@ii[2]% {% \LP@setcellcontent{\arabic{LP@counti}}{\arabic{LP@countii}}{\csname #2@fontsize\endcsname#1}% \stepcounter{LP@counti}% }% % \newcommand*\LP@setrowcontents@edge[3]% {% \setcounter{LP@counti}{#2}% \setcounter{LP@countii}{#3}% \forcsvlist\LP@setrowcontents@edge@i{#1}{\LP@env@prefix}% }% % \newcommand*\LP@setrowcontents@edge@i[1]% {% \LP@setrowcontents@edge@ii{#1}{\LP@env@prefix}% }% % \newcommand*\LP@setrowcontents@edge@ii[2]% {% \LP@setcellcontentVE{\arabic{LP@counti}}{\arabic{LP@countii}}{\csname #2@fontsize\endcsname#1}% \stepcounter{LP@counti}% }% % \newcommand*\setrow[2]% {% \LP@setrowcontents{#2}{1}{#1}% }% % % #1 csv list % #2 column % #3 row \newcommand*\LP@setcolumncontents[3]% {% \setcounter{LP@counti}{#2}% \setcounter{LP@countii}{#3}% \forcsvlist\LP@setcolumncontents@i{#1}% }% % \newcommand*\LP@setcolumncontents@i[1]% {% \LP@setcolumncontents@ii{#1}{\LP@env@prefix}% }% % \newcommand*\LP@setcolumncontents@ii[2]% {% \LP@setcellcontent{\arabic{LP@counti}}{\arabic{LP@countii}}{\csname #2@fontsize\endcsname#1}% \stepcounter{LP@countii}% }% % \newcommand*\LP@setcolumncontents@edge[3]% {% \setcounter{LP@counti}{#2}% \setcounter{LP@countii}{#3}% \forcsvlist\LP@setcolumncontents@edge@i{#1}% }% % \newcommand*\LP@setcolumncontents@edge@i[1]% {% \LP@setcolumncontents@edge@ii{#1}{\LP@env@prefix}% }% % \newcommand*\LP@setcolumncontents@edge@ii[2]% {% \LP@setcellcontentHE{\arabic{LP@counti}}{\arabic{LP@countii}}{\csname #2@fontsize\endcsname#1}% \stepcounter{LP@countii}% }% % \newcommand*\setcolumn[2]% {% \LP@setcolumncontents{#2}{#1}{1}% }% % \newcommand*\setcell[3]% {% \LP@set@LP@scale{\LP@env@prefix}% \LP@set@LP@fontsize{\LP@env@prefix}% \LP@set@LP@rows{\LP@env@prefix}% \LP@set@LP@columns{\LP@env@prefix}% \LP@ingrid{#1}{#2}{\LP@columns}{\LP@rows}{\LP@package}% \LP@setcellcontent{#1}{#2}{\LP@fontsize#3}% }% % \newcommand*\setbigcell[4][Huge]% {% \LP@set@LP@scale{\LP@env@prefix}% \LP@set@LP@bgcolor{\LP@env@prefix}% \ifthenelse{\equal{\LP@bgcolor}{}}% {\gdef\LP@sbc@bgcolor{white}}% {\gdef\LP@sbc@bgcolor{\LP@bgcolor}}% \setcounter{LP@counti}{#2}% \setcounter{LP@countii}{#3}% \stepcounter{LP@counti}% \stepcounter{LP@countii}% \draw[line width=\LP@normallines,fill=\LP@sbc@bgcolor,\LP@grid@linestyle] (#2,#3) rectangle ++(2,2);% \begin{pgfonlayer}{LPforegroundtwo}% \fill[color=\LP@sbc@bgcolor] (\arabic{LP@counti},\arabic{LP@countii}) circle [radius=3.5pt*\LP@scale];% \node at (\arabic{LP@counti},\arabic{LP@countii}){\csname#1\endcsname#4};% \end{pgfonlayer}% }% % \newcommand*\setcolorrow[2]% {% \setcounter{LP@counti}{1}% \setcounter{LP@countii}{#1}% \forcsvlist\LP@setcolorrow@i{#2}% }% % \newcommand*\LP@setcolorrow@i[1]% {% \ifthenelse{\equal{#1}{0}}% {% \gdef\LP@HT@color{black}% \begin{puzzlebackground}% \fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}% \end{puzzlebackground}% }% {% \expandafter\gdef\expandafter\LP@HT@color{LP@c@\romannumeral#1}% \begin{puzzlebackground}% \fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}% \end{puzzlebackground}% \setcell{\arabic{LP@counti}}{\arabic{LP@countii}}{#1}% }% \stepcounter{LP@counti}% }% % \newcommand*\setcolorcolumn[2]% {% \setcounter{LP@counti}{#1}% \setcounter{LP@countii}{1}% \forcsvlist\LP@setcolorcolumn@i{#2}% }% % \newcommand*\LP@setcolorcolumn@i[1]% {% \ifthenelse{\equal{#1}{0}}% {% \gdef\LP@HT@color{black}% \begin{puzzlebackground}% \fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}% \end{puzzlebackground}% }% {% \expandafter\gdef\expandafter\LP@HT@color{LP@c@\romannumeral#1}% \begin{puzzlebackground}% \fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}% \end{puzzlebackground}% \setcell{\arabic{LP@counti}}{\arabic{LP@countii}}{#1}% }% \stepcounter{LP@countii}% }% % \newcommand*\fillcell[2]% {% \LP@set@LP@scale{\LP@env@prefix}% \LP@set@LP@color{\LP@env@prefix}% \LP@set@LP@rows{\LP@env@prefix}% \LP@set@LP@columns{\LP@env@prefix}% \LP@ingrid{#1}{#2}{\LP@columns}{\LP@rows}{\LP@package}% \LP@setcellcontent{#1}{#2}{\LP@Block}% }% % % #1 row % #2 csv list \newcommand*\fillrow[2]% {% \setcounter{LP@counti}{1}% \setcounter{LP@countii}{#1}% \forcsvlist\LP@fillrow@i{#2}% }% % \newcommand*\LP@fillrow@i[1]% {% \ifthenelse{\equal{#1}{1}}% {\fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}}% {}% \stepcounter{LP@counti}% }% % % #1 column % #2 csv list \newcommand*\fillcolumn[2]% {% \setcounter{LP@counti}{#1}% \setcounter{LP@countii}{1}% \forcsvlist\LP@fillcolumn@i{#2}% }% % \newcommand*\LP@fillcolumn@i[1]% {% \ifthenelse{\equal{#1}{1}}% {\fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}}% {}% \stepcounter{LP@countii}% }% % \newcommand*\framearea[2]% {% \draw[line width=\LP@thicklines,color=#1] #2;% }% % \newcommand*\fillarea[2]% {% \draw[line width=\LP@thicklines,fill=#1] #2 ;% }% % \newcommand*\colorarea[2]% {% \fill[color=#1] #2 ;% }% % % #1 column % #2 row % #3 csv list of directions \newcommand*\tikzpath[3]% {% (#1,#2)% \foreach \LP@direction in {#3}% {% \ifnum\LP@direction=1% --++(-1,-1)% \fi% \ifnum\LP@direction=2% --++(0,-1)% \fi% \ifnum\LP@direction=3% --++(1,-1)% \fi% \ifnum\LP@direction=4% --++(-1,0)% \fi% \ifnum\LP@direction=6% --++(1,0)% \fi% \ifnum\LP@direction=7% --++(-1,1)% \fi% \ifnum\LP@direction=8% --++(0,1)% \fi% \ifnum\LP@direction=9% --++(1,1)% \fi% };% }% % \newcommand*\filldiagonals[1][yellow!20]% {% \LP@set@LP@columns{\LP@env@prefix}% \LP@set@LP@rows{\LP@env@prefix}% \LP@set@LP@scale{\LP@env@prefix}% \setcounter{LP@counti}{\LP@columns}% \setcounter{LP@countii}{\LP@rows}% \stepcounter{LP@counti}% \stepcounter{LP@countii}% \ifnum\value{LP@counti}=\value{LP@countii}% \begin{puzzlebackground}% \def\LP@color{#1}% \setcounter{LP@whiledo@i}{1}% \setcounter{LP@whiledo@ii}{\LP@rows}% \whiledo{\value{LP@whiledo@i}<\value{LP@counti}}% {% \LP@setcellcontent{\arabic{LP@whiledo@i}}{\arabic{LP@whiledo@i}}{\LP@Block}% \LP@setcellcontent{\arabic{LP@whiledo@i}}{\arabic{LP@whiledo@ii}}{\LP@Block}% \stepcounter{LP@whiledo@i}% \addtocounter{LP@whiledo@ii}{-1}% }% \end{puzzlebackground}% \else% \PackageError{\LP@package}% {non quadratic grid (\filldiagonals)}% {You tried to fill diagonals,\MessageBreak in a non quadratic grid (1,1) .. (\arabic{LP@counti},\arabic{LP@countii})\MessageBreak doesn't make sense!}% \fi% }% % \newcommand*\framepuzzle[1][black]% {% \LP@set@LP@columns{\LP@env@prefix}% \LP@set@LP@rows{\LP@env@prefix}% \setcounter{LP@counti}{\LP@columns}% \setcounter{LP@countii}{\LP@rows}% \stepcounter{LP@counti}% \stepcounter{LP@countii}% \draw[line width=\LP@thicklines,color=#1] (1,1)--(1,\arabic{LP@countii});% \draw[line width=\LP@thicklines,color=#1] (1,\arabic{LP@countii})--(\arabic{LP@countii},\arabic{LP@countii});% \draw[line width=\LP@thicklines,color=#1] (\arabic{LP@countii},\arabic{LP@countii})--(\arabic{LP@countii},1);% \draw[line width=\LP@thicklines,color=#1] (\arabic{LP@countii},1)--(1,1);% }% % \newcommand*\placecross[2]% {% \LP@setcellcontentC{#1}{#2}{\LP@Cross}% }% % \newcommand*\placemirror[3]% {% \LP@setcellcontentC{#1}{#2}{\LP@Mirror{#3}}% }% % \newcommand*\placearrow[3]% {% \LP@setcellcontentC{#1}{#2}{\LP@Arrow{#3}}% }% \newenvironment{puzzlebackground}% {% \begin{pgfonlayer}{LPbackground}% }% {% \end{pgfonlayer}% }% % \newenvironment{puzzleforeground}% {% \begin{pgfonlayer}{LPforeground}% }% {% \end{pgfonlayer}% }% % % around the grid % \newcommand*\LP@bottomrow[1]% {% \LP@setrowcontents{#1}{1}{0}% }% % \newcommand*\LP@bottomrow@edge[1]% {% \LP@setrowcontents@edge{#1}{1}{0}% }% % \newcommand*\LP@leftcolumn[1]% {% \LP@setcolumncontents{#1}{0}{1}% }% % \newcommand*\LP@toprow[1]% {% \LP@toprow@i{#1}{\LP@env@prefix}% }% % \newcommand*\LP@toprow@i[2]% {% \LP@setrowcontents{#1}{1}{\csname the#2@rows\endcsname}% }% % \newcommand*\LP@rightcolumn[1]% {% \LP@rightcolumn@i{#1}{\LP@env@prefix}% }% % \newcommand*\LP@rightcolumn@i[2]% {% \LP@setcolumncontents{#1}{\csname the#2@columns\endcsname}{1}% }% % \newcommand*\LP@rightcolumn@edge[1]% {% \LP@rightcolumn@edge@i{#1}{\LP@env@prefix}% }% % \newcommand*\LP@rightcolumn@edge@i[2]% {% \LP@setcolumncontents@edge{#1}{\csname the#2@columns\endcsname}{1}% }% % % Presentation % \newcommand*\titleformat[1]% {% \renewcommand*\LP@titleformat{#1}% }% \titleformat{\centering\Large\color{blue}}% % \newcommand*\puzzlecounter{\theLP@puzzlecounter}% % \newcommand*\setpuzzlecounter[1]% {% \setcounter{LP@puzzlecounter}{#1}% }% % % #1 counterstyle \newcommand*\LP@drawcounter[1]% {% \LP@set@LP@cvoffset{\LP@env@prefix}% \csname LP@cs@#1\endcsname% }% % \newcommand*{\definecounterstyle}[2]% {% \expandafter\gdef\csname LP@cs@#1\endcsname{#2}% }% % \definecounterstyle{none}{}% \definecounterstyle{left}{\begingroup\reversemarginpar\marginnote{\tikz\node[shape=rectangle,fill=yellow!40,inner sep=7pt,draw,rounded corners=3pt,thick]{\Huge\puzzlecounter};}[\LP@cvoffset]\endgroup}% \definecounterstyle{right}{\marginnote{\tikz\node[shape=rectangle,fill=yellow!40,inner sep=7pt,draw,rounded corners=3pt,thick]{\Huge\puzzlecounter};}[\LP@cvoffset]}% % \newcommand*\LP@Block{\tikz[scale=\LP@scale]\draw[line width=\LP@normallines,fill=\LP@color] (0,0) rectangle (1,1);}% % \newcommand*\LP@Arrow[1]% {% \LP@set@LP@scale{\LP@env@prefix}% \def\LP@rotate{45}% \ifthenelse{\equal{#1}{LeftUp}}{\def\LP@rotate{135}}{}% \ifthenelse{\equal{#1}{LeftDown}}{\def\LP@rotate{225}}{}% \ifthenelse{\equal{#1}{RightDown}}{\def\LP@rotate{315}}{}% \pgfmathsetmacro{\LPlinewidth}{3pt*\LP@scale}% \tikz\draw[->,line width=\LPlinewidth,rotate=\LP@rotate,scale=\LP@scale] (0.1,.5) -- (0.9,.5);% }% % \newcommand*\LP@Cross% {% \LP@set@LP@scale{\LP@env@prefix}% \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} }% % \newcommand*\LP@Mirror[1]% {% \def\LP@rotate{0}% \ifthenelse{\equal{#1}{V}}{\def\LP@rotate{90}}{}% \LP@set@LP@scale{\LP@env@prefix}% \begin{tikzpicture}% \begin{pgfonlayer}{LPforegroundtwo}% \pgfmathsetmacro{\LPlinewidth}{3pt*\LP@scale}% \draw[line width=\LPlinewidth,scale=\LP@scale,color=LP@c@mirror,rotate=\LP@rotate] (.35,.5) -- (0.65,.5);% \end{pgfonlayer}% \end{tikzpicture}% }% % % get package options with prefix % \newcommand*\LP@set@LP@scale[1]% {% \expandafter\xdef\expandafter\LP@scale{\csname #1@scale\endcsname}% }% % \newcommand*\LP@set@LP@color[1]% {% \expandafter\xdef\expandafter\LP@color{\csname #1@color\endcsname}% }% % \newcommand*\LP@set@LP@rows[1]% {% \expandafter\xdef\expandafter\LP@rows{\csname #1@rows\endcsname}% }% % \newcommand*\LP@set@LP@columns[1]% {% \expandafter\xdef\expandafter\LP@columns{\csname #1@columns\endcsname}% }% % \newcommand*\LP@set@LP@cvoffset[1]% {% \expandafter\xdef\expandafter\LP@cvoffset{\csname #1@cvoffset\endcsname}% }% % \newcommand*\LP@set@LP@bgcolor[1]% {% \expandafter\xdef\expandafter\LP@bgcolor{\csname #1@bgcolor\endcsname}% }% % \newcommand*\LP@set@LP@fontsize[1]% {% % can't expand \Large \expandafter\gdef\expandafter\LP@fontsize{\csname #1@fontsize\endcsname}% }% % \newcommand*\LP@set@env@prefix[1]% {% \gdef\LP@env@prefix{#1}% }% % \newcommand*\LP@set@package[1]% {% \gdef\LP@package{#1}% }% % \newcommand*\setgridlinestyle[1]% {% \def\LP@grid@linestyle{#1}% }% % \newcommand*\setnormallinewidth[1]% {% \def\LP@normallines{#1}% }% % \newcommand*\setthicklinewidth[1]% {% \def\LP@thicklines{#1}% }% % % generic logicpuzzle environment and options % \newcommand*\LP@LP@init@prefix{LP@LP}% \newcommand*\LP@LP@init@package{logicpuzzle}% % \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}{rows}{5}% \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}{columns}{5}% \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}{scale}{1}% \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}{counterstyle}{none}% \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}{color}{}% \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}{bgcolor}{}% \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}{width}{5.1cm}% \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}{cvoffset}{-23pt}% \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}{title}{}% \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}{titleindent}{0cm}% \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}{titlewidth}{5.1cm}% \LP@define@choicekey@fontsize{\LP@LP@init@prefix}{\LP@LP@init@package}{Large}% % \ExecuteOptionsX{rows,columns,width,fontsize,scale,bgcolor,cvoffset,counterstyle,title,titleindent,titlewidth}% % \ProcessOptionsX\relax% % \LP@init@counter{\LP@LP@init@prefix}% % \let\logicpuzzlecell\setcell% % \newcommand*\logicpuzzlesetup[1]% {% \setkeys{logicpuzzle.sty}{#1}% }% % \newenvironment{logicpuzzle}[1][]% {% \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}% \begin{minipage}[t]{\LP@LP@width}% \ifthenelse{\equal{\LP@LP@title}{}}% {\par\enspace\par}% empty {\enspace\par\noindent\hspace{\LP@LP@titleindent}\parbox{\LP@LP@titlewidth}{\strut\LP@titleformat\LP@LP@title}\vspace{3mm}\par}% \begin{tikzpicture}[scale=\LP@LP@scale]% \LP@drawbackground{1}{1}{\LP@LP@columns}{\LP@LP@rows}{\LP@LP@bgcolor}% \LP@drawgrid{1}{1}{\LP@LP@columns}{\LP@LP@rows}{1cm}% }% {% \end{tikzpicture}% \LP@drawcounter{\LP@LP@counterstyle}% \stepcounter{LP@puzzlecounter}% \end{minipage}% }% % \endinput%