diff options
author | Karl Berry <karl@freefriends.org> | 2013-06-29 00:16:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-06-29 00:16:40 +0000 |
commit | ec4fd129ad01f534716631faed103a0aab51eb94 (patch) | |
tree | 7fa128c4c04f9ba8c4d79b5a1e57a1b1020fbecc /Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty | |
parent | 41837423e5e17767c06fc0fc81d47da607b823f5 (diff) |
logicpuzzle (6jun13)
git-svn-id: svn://tug.org/texlive/trunk@31024 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.sty | 392 |
1 files changed, 385 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty b/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty index e2800f154dd..1fdd9900ac5 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/17 logicpuzzle.sty v2.2 - Josef Kleber (C) 2013]% +\ProvidesPackage{logicpuzzle}[2013/06/06 logicpuzzle.sty v2.4 - Josef Kleber (C) 2013]% % \RequirePackage{xkeyval}% \RequirePackage{ifthen}% @@ -27,7 +27,7 @@ \RequirePackage{etoolbox}% \RequirePackage{marginnote}% \RequirePackage{tikz}% -\usetikzlibrary{decorations.pathmorphing,calc,shapes.geometric}% +\usetikzlibrary{decorations.pathmorphing,decorations.pathreplacing,calc,shapes.geometric}% \pgfdeclarelayer{LPdump}% \pgfdeclarelayer{LPbgcolor}% \pgfdeclarelayer{LPbackgroundtwo}% @@ -50,6 +50,8 @@ \newcounter{LP@puzzlecounter}% \setcounter{LP@puzzlecounter}{1}% % +\newlength\LP@length% +% \newcommand*\LP@counterstyle{none}% \newcommand*\LP@titleformat{}% \gdef\LP@env@prefix{}% @@ -67,6 +69,8 @@ \def\LP@grid@linestyle{}% \def\LP@draw@opacity{1}% \def\LP@rel@tikzpath{}% +\def\LP@tracks@scale{.3}% +\def\LP@fw@linestyle{-|}% % \newcommand*\LP@Pfive{.5}% % @@ -170,6 +174,7 @@ \definecolor{LP@c@tunnel@i}{rgb}{.8,.8,.8}% \definecolor{LP@c@tunnel@ii}{rgb}{.5,.5,.5}% \LP@definecolor{LP@c@bridge}{1,0,0}% +\colorlet{LP@c@track}{black!80}% % % drawing grids % @@ -201,6 +206,27 @@ \fill[color=LP@c@griddots] (\i,\j) circle [radius=3pt];% \end{pgfonlayer}% }% +% +\newcommand*\LP@magnetsgrid% +{% + \LP@set@LP@fontsize{\LP@env@prefix}% + \LP@set@LP@columns{\LP@env@prefix}% + \LP@set@LP@rows{\LP@env@prefix}% + \setcounter{LP@counti}{\LP@columns}% max column + \setcounter{LP@countii}{\LP@rows}% max row + \stepcounter{LP@counti}% + \stepcounter{LP@countii}% + \draw[step=1cm,line width=\LP@normallines] (-1,1) grid (1,\arabic{LP@countii});% + \draw[step=1cm,line width=\LP@normallines] (1,\arabic{LP@countii}) grid ++(\LP@columns,2);% + \draw[line width=\LP@normallines] (0,\arabic{LP@countii}) -- ++(0,1) -- ++(1,0);% + \draw[line width=\LP@thicklines] (-1,1) rectangle (1,\arabic{LP@countii});% + \draw[line width=\LP@thicklines] (1,\arabic{LP@countii}) rectangle ++(\LP@columns,2);% + \draw[line width=\LP@thicklines] (1,\arabic{LP@countii}) rectangle ++(-2,2);% + \node[font=\LP@fontsize\bfseries] at (0.5,\arabic{LP@counti}.5) {$-$};% + \stepcounter{LP@counti}% + \node[font=\LP@fontsize\bfseries] at (-0.5,\arabic{LP@counti}.5) {$+$};% +}% +% \newcommand*\LP@drawsudokugrid% {% \draw[line width=\LP@thicklines,draw opacity=\LP@draw@opacity] (1,1) -- (1,10);% @@ -407,6 +433,19 @@ \LP@setcellcontent{#1}{#2}{\LP@fontsize#3}% }% % +\newcommand*\setcells[2]% +{% + \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}% + \foreach \LP@sc@column/\LP@sc@row in {#1}% + {% + \LP@ingrid{\LP@sc@column}{\LP@sc@row}{\LP@columns}{\LP@rows}{\LP@package}% + \LP@setcellcontent{\LP@sc@column}{\LP@sc@row}{\LP@fontsize#2}% + };% +}% +% \newcommand*\setbigcell[4][Huge]% {% \LP@set@LP@scale{\LP@env@prefix}% @@ -641,6 +680,38 @@ };% }% % +\newcommand*\xtikzpath[3]% +{% + (#1\LP@rel@tikzpath,#2\LP@rel@tikzpath)% + \foreach \LP@dir/\LP@plength in {#3}% + {% + \ifnum\LP@dir=1% + --++(-\LP@plength,-\LP@plength)% + \fi% + \ifnum\LP@dir=2% + --++(0,-\LP@plength)% + \fi% + \ifnum\LP@dir=3% + --++(\LP@plength,-\LP@plength)% + \fi% + \ifnum\LP@dir=4% + --++(-\LP@plength,0)% + \fi% + \ifnum\LP@dir=6% + --++(\LP@plength,0)% + \fi% + \ifnum\LP@dir=7% + --++(-\LP@plength,\LP@plength)% + \fi% + \ifnum\LP@dir=8% + --++(0,\LP@plength)% + \fi% + \ifnum\LP@dir=9% + --++(\LP@plength,\LP@plength)% + \fi% + };% +}% +% \newcommand*\filldiagonals[1][yellow!20]% {% \LP@set@LP@columns{\LP@env@prefix}% @@ -679,9 +750,9 @@ \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);% + \draw[line width=\LP@thicklines,color=#1] (1,\arabic{LP@countii})--(\arabic{LP@counti},\arabic{LP@countii});% + \draw[line width=\LP@thicklines,color=#1] (\arabic{LP@counti},\arabic{LP@countii})--(\arabic{LP@counti},1);% + \draw[line width=\LP@thicklines,color=#1] (\arabic{LP@counti},1)--(1,1);% }% % \newcommand*\placecross[2]% @@ -1065,16 +1136,22 @@ \def\LP@Line@linecolor{#1}% }% % +\define@key{LP@Line}{linewidth}[1mm]% +{% + \def\LP@Line@linewidth{#1}% +}% +% \newcommand*\LP@Line[2][]% {% \def\LP@Line@double{}% \def\LP@Line@linecolor{LP@c@bridge}% + \def\LP@Line@linewidth{1mm}% \setkeys{LP@Line}{#1}% \LP@set@LP@scale{\LP@env@prefix}% \begin{pgfonlayer}{LPbackgroundtwo}% \ifthenelse{\equal{\LP@Line@double}{double}}% - {\draw[double,double distance=.1cm*\LP@scale,color=\LP@Line@linecolor, line width=.1cm*\LP@scale] #2;}% - {\draw[color=\LP@Line@linecolor, line width=.1cm*\LP@scale] #2;}% + {\draw[double,double distance=\LP@Line@linewidth*\LP@scale,color=\LP@Line@linecolor, line width=\LP@Line@linewidth*\LP@scale] #2;}% + {\draw[color=\LP@Line@linecolor, line width=\LP@Line@linewidth*\LP@scale] #2;}% \end{pgfonlayer}% }% % @@ -1083,6 +1160,307 @@ \LP@Line[#1]{#2}% }% % +\newcommand*\LP@trackC% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \begin{tikzpicture}[scale=\LP@scale]% + \pgfsetcornersarced{\pgfpoint{4mm*\LP@scale}{4mm*\LP@scale}}% + \draw[color=LP@c@track, line width=.3cm*\LP@scale] (0,.5)--(.5,.5)--(.5,0);% + \end{tikzpicture}% +}% +% +\newcommand*\LP@G@trackC[1][0]% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \begin{tikzpicture}[scale=\LP@scale,rotate=#1]% + \clip (0,0) rectangle (1,1);% + \pgfsetcornersarced{\pgfpoint{4mm*\LP@scale}{4mm*\LP@scale}}% + \draw[color=LP@c@track, line width=.3cm*\LP@scale] (0,.5)--(.5,.5)--(.5,0);% + \end{tikzpicture}% +}% +% +\let\CurveBL\LP@G@trackC% +\newcommand*\CurveBR{\LP@G@trackC[90]}% +\newcommand*\CurveTR{\LP@G@trackC[180]}% +\newcommand*\CurveTL{\LP@G@trackC[270]}% +% +\newcommand*\LP@trackS% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \begin{tikzpicture}[scale=\LP@scale]% + \draw[draw opacity=0] (.2,0) -- (.8,1);% + \draw[color=LP@c@track, line width=.3cm*\LP@scale] (.5,0)--(.5,1);% + \end{tikzpicture}% +}% +% +\newcommand*\LP@G@trackS[1][0]% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \begin{tikzpicture}[scale=\LP@scale,rotate=#1]% + \clip (0,0) rectangle (1,1);% + \draw[color=LP@c@track, line width=.3cm*\LP@scale] (.5,0)--(.5,1);% + \end{tikzpicture}% +}% +% +\newcommand*\StraightV{\LP@G@trackS}% +\newcommand*\StraightH{\LP@G@trackS[90]}% +\let\Straight\StraightV% +% +\newcommand*\LP@trackCR% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \begin{tikzpicture}[scale=\LP@scale]% + \draw[color=LP@c@track, line width=.3cm*\LP@scale] (0,0.5)--(1,.5);% + \draw[color=LP@c@track, line width=.3cm*\LP@scale] (0.5,0)--(.5,.2);% + \draw[color=LP@c@track, line width=.3cm*\LP@scale] (0.5,1)--(.5,.8);% + \end{tikzpicture}% +}% +% +\newcommand*\LP@G@trackCR[1][0]% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \begin{tikzpicture}[scale=\LP@scale,rotate=#1]% + \clip (0,0) rectangle (1,1);% + \draw[color=LP@c@track, line width=.3cm*\LP@scale] (0,0.5)--(1,.5);% + \draw[color=LP@c@track, line width=.3cm*\LP@scale] (0.5,0)--(.5,.2);% + \draw[color=LP@c@track, line width=.3cm*\LP@scale] (0.5,1)--(.5,.8);% + \end{tikzpicture}% +}% +% +\newcommand*\CrossH{\LP@G@trackCR}% +\newcommand*\CrossV{\LP@G@trackCR[90]}% +\let\Cross\CrossH% +% +\newcommand*\LP@graveltrap% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \begin{tikzpicture}[scale=\LP@scale]% + \clip (0,0) rectangle (1,1);% + \fill[color=LP@c@track] (.5,.5) circle (.1cm);% + \end{tikzpicture}% +}% +% +\let\Graveltrap\LP@graveltrap% +% +\newcommand*\parkinglot[2]% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \LP@set@LP@color{\LP@env@prefix}% + \LP@set@LP@bgcolor{\LP@env@prefix}% + \LP@set@LP@fontsize{\LP@env@prefix}% + \ifthenelse{\equal{\LP@color}{}}% + {\gdef\LP@c@parkinglot{black}}% + {\gdef\LP@c@parkinglot{\LP@color}}% + \ifthenelse{\equal{\LP@bgcolor}{}}% + {\gdef\LP@c@bg@parkinglot{white}}% + {\gdef\LP@c@bg@parkinglot{\LP@bgcolor}}% + \setcounter{LP@counti}{#1}% + \setcounter{LP@countii}{#2}% + \stepcounter{LP@counti}% + \stepcounter{LP@countii}% + \draw[color=\LP@c@parkinglot,line width=\LP@normallines,fill=\LP@c@bg@parkinglot] (#1,#2) rectangle ++(2,2);% + \node[color=\LP@c@parkinglot,font=\sffamily\bfseries\LP@fontsize] at (\arabic{LP@counti},\arabic{LP@countii}){P};% +}% +% +\newcommand*\pitlane[3]% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \LP@set@LP@color{\LP@env@prefix}% + \ifthenelse{\equal{\LP@color}{}}% + {\gdef\LP@c@pitlane{black}}% + {\gdef\LP@c@pitlane{\LP@color}}% + \ifthenelse{\equal{#3}{V}}% + {\draw[color=black,line width=\LP@normallines,fill=\LP@c@pitlane] (#1,#2) rectangle ++(1,4);}% + {\draw[color=black,line width=\LP@normallines,fill=\LP@c@pitlane] (#1,#2) rectangle ++(4,1);}% +}% +% +\newcommand*\LP@trackline[3]% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \pgfmathsetlength{\LP@length}{.1cm*\LP@scale}% + \scalebox{\LP@tracks@scale}% + {% + \hspace{\LP@length}% + \setcounter{LP@whiledo@i}{#1}% + \whiledo{\arabic{LP@whiledo@i}>0}% + {% + \LP@trackS% + \addtocounter{LP@whiledo@i}{-1}% + }% + \setcounter{LP@whiledo@i}{#2}% + \whiledo{\arabic{LP@whiledo@i}>0}% + {% + \LP@trackC% + \addtocounter{LP@whiledo@i}{-1}% + }% + \hspace{\LP@length}% + \setcounter{LP@whiledo@i}{#3}% + \whiledo{\arabic{LP@whiledo@i}>0}% + {% + \LP@trackCR% + \addtocounter{LP@whiledo@i}{-1}% + }% + }% +}% +% +\newcommand*\trackV[1]% +{% + \LP@set@LP@columns{\LP@env@prefix}% + \setcounter{LP@counti}{\LP@columns}% + \stepcounter{LP@counti}% + \setcounter{LP@countii}{1}% + \foreach \LP@c@straight/\LP@c@curve/\LP@c@cross in {#1}% + {% + \node[anchor=west] at (\arabic{LP@counti},\arabic{LP@countii}.5) {\LP@trackline{\LP@c@straight}{\LP@c@curve}{\LP@c@cross}};% + \stepcounter{LP@countii}% + };% +}% +% +\newcommand*\trackH[1]% +{% + \setcounter{LP@counti}{1}% + \setcounter{LP@countii}{1}% + \foreach \LP@c@straight/\LP@c@curve/\LP@c@cross in {#1}% + {% + \node[anchor=west,rotate=-90] at (\arabic{LP@counti}.5,\arabic{LP@countii}) {\LP@trackline{\LP@c@straight}{\LP@c@curve}{\LP@c@cross}};% + \stepcounter{LP@counti}% + };% +}% +% +\newcommand*\track[1]% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \LP@set@LP@bgcolor{\LP@env@prefix}% + \ifthenelse{\equal{\LP@bgcolor}{}}% + {\gdef\LP@c@bg@track{white}}% + {\gdef\LP@c@bg@track{\LP@bgcolor}}% + \bgroup% + \def\LP@rel@tikzpath{.5}% + \begin{pgfonlayer}{LPbackgroundtwo}% + \pgfsetcornersarced{\pgfpoint{4.9mm*\LP@scale}{4.9mm*\LP@scale}}% + \draw[decorate,decoration={show path construction,% + lineto code={% + \draw [\LP@c@bg@track,line width=0.15cm*\LP@scale,double=LP@c@track,double distance=.3cm*\LP@scale]% + (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);},% + curveto code={% + \draw [LP@c@track,line width=0.3cm*\LP@scale] (\tikzinputsegmentfirst) .. controls% + (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)% + ..(\tikzinputsegmentlast);}}] #1;% + \end{pgfonlayer}% + \egroup% +}% +% +\newcommand*\link[2][]% +{% + \LP@set@LP@color{\LP@env@prefix}% + \bgroup% + \def\LP@rel@tikzpath{.5}% + \LP@Line[color=\LP@color,#1]{#2}% + \egroup% +}% +% +\newcommand*\mlline[1]% +{% + \draw[color=black, line width=\LP@thicklines] #1;% +}% +% +\newcommand*\MasyuW% +{% + \begin{tikzpicture}[scale=0.7*\LP@scale]% + \draw[color=black,fill=white] (0.5,0.5) circle (0.5cm);% + \end{tikzpicture}% +}% +% +\newcommand*\MasyuB% +{% + \begin{tikzpicture}[scale=0.7*\LP@scale]% + \fill[color=black] (0.5,0.5) circle (0.5cm);% + \end{tikzpicture}% +}% +% +\newcommand*\masyuline[1]% +{% + \LP@set@LP@color{\LP@env@prefix}% + \begin{puzzleforeground}% + \bgroup% + \def\LP@rel@tikzpath{.5}% + \draw[color=\LP@color, line width=\LP@thicklines] #1;% + \egroup% + \end{puzzleforeground}% +}% +% +\newcommand*\PMH[1]% +{% + \LP@set@LP@fontsize{\LP@env@prefix}% + \foreach \LP@fe@column/\LP@fe@row in {#1}% + {% + \setcounter{LP@counti}{\LP@fe@column}% + \setcounter{LP@countii}{\LP@fe@row}% + \draw[line width=\LP@thicklines,fill=white] (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(2,1);% + \node[font=\LP@fontsize\bfseries] at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$+$};% + \stepcounter{LP@counti} + \node[font=\LP@fontsize\bfseries] at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$-$};% + };% +}% +% +\newcommand*\MPH[1]% +{% + \LP@set@LP@fontsize{\LP@env@prefix}% + \foreach \LP@fe@column/\LP@fe@row in {#1}% + {% + \setcounter{LP@counti}{\LP@fe@column}% + \setcounter{LP@countii}{\LP@fe@row}% + \draw[line width=\LP@thicklines,fill=white] (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(2,1);% + \node[font=\LP@fontsize\bfseries] at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$-$};% + \stepcounter{LP@counti} + \node[font=\LP@fontsize\bfseries] at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$+$};% + };% +}% +% +\newcommand*\PMV[1]% +{% + \LP@set@LP@fontsize{\LP@env@prefix}% + \foreach \LP@fe@column/\LP@fe@row in {#1}% + {% + \setcounter{LP@counti}{\LP@fe@column}% + \setcounter{LP@countii}{\LP@fe@row}% + \draw[line width=\LP@thicklines,fill=white] (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(1,2);% + \node[font=\LP@fontsize\bfseries] at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$+$};% + \stepcounter{LP@countii} + \node[font=\LP@fontsize\bfseries] at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$-$};% + };% +}% +% +\newcommand*\MPV[1]% +{% + \LP@set@LP@fontsize{\LP@env@prefix}% + \foreach \LP@fe@column/\LP@fe@row in {#1}% + {% + \setcounter{LP@counti}{\LP@fe@column}% + \setcounter{LP@countii}{\LP@fe@row}% + \draw[line width=\LP@thicklines,fill=white] (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(1,2);% + \node[font=\LP@fontsize\bfseries] at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$-$};% + \stepcounter{LP@countii} + \node[font=\LP@fontsize\bfseries] at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$+$};% + };% +}% +% +\newcommand*\magnetsH[1]% +{% + \foreach \LP@fe@column/\LP@fe@row in {#1}% + {% + \draw[line width=\LP@thicklines,fill=white] (\LP@fe@column,\LP@fe@row) rectangle ++(2,1);% + };% +}% +% +\newcommand*\magnetsV[1]% +{% + \foreach \LP@fe@column/\LP@fe@row in {#1}% + {% + \draw[line width=\LP@thicklines,fill=white] (\LP@fe@column,\LP@fe@row) rectangle ++(1,2);% + };% +}% +% % get package options with prefix % \newcommand*\LP@set@LP@scale[1]% |