summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-04-13 22:57:32 +0000
committerKarl Berry <karl@freefriends.org>2013-04-13 22:57:32 +0000
commit5cc36a171f8092e44ab898ee2e44446b5c4a2949 (patch)
tree4ee8dd508166a45c92a2eac14aea6ce9cd6989e7 /Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty
parent934ca9c7cea256e522389fcd652070ac2e378efa (diff)
logicpuzzle (13apr13)
git-svn-id: svn://tug.org/texlive/trunk@29897 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty')
-rw-r--r--Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty121
1 files changed, 119 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty b/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty
index 74d6b42cbd5..3dcb1fa9c1e 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/04/05 logicpuzzle.sty v1.3 - Josef Kleber (C) 2013]%
+\ProvidesPackage{logicpuzzle}[2013/04/12 logicpuzzle.sty v1.8 - Josef Kleber (C) 2013]%
%
\RequirePackage{xkeyval}%
\RequirePackage{ifthen}%
@@ -28,13 +28,15 @@
\RequirePackage{marginnote}%
\RequirePackage{tikz}%
\usetikzlibrary{decorations.pathmorphing}%
+\pgfdeclarelayer{LPdump}%
\pgfdeclarelayer{LPbgcolor}%
\pgfdeclarelayer{LPbackgroundtwo}%
\pgfdeclarelayer{LPbackground}%
\pgfdeclarelayer{LPforeground}%
\pgfdeclarelayer{LPforegroundtwo}%
-\pgfsetlayers{LPbgcolor,LPbackgroundtwo,LPbackground,main,LPforeground,LPforegroundtwo}%
+\pgfsetlayers{LPdump,LPbgcolor,LPbackgroundtwo,LPbackground,main,LPforeground,LPforegroundtwo}%
%
+\newcounter{LP@counter@unique}%
\newcounter{LP@counti}%
\newcounter{LP@countii}%
\newcounter{LP@whiledo@i}%
@@ -54,6 +56,7 @@
\gdef\LP@columns{}%
\gdef\LP@scale{1}%
\gdef\LP@color{black}%
+\gdef\LP@bgcolor{}%
\gdef\LP@fontsize\Large%
\gdef\LP@cvoffset{0pt}%
%
@@ -246,6 +249,20 @@
\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
@@ -422,6 +439,46 @@
\draw[ultra thick,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}%
@@ -573,6 +630,11 @@
\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
@@ -589,4 +651,59 @@
\gdef\LP@package{#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% \ No newline at end of file