summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pas-crosswords
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-12-04 00:04:06 +0000
committerKarl Berry <karl@freefriends.org>2013-12-04 00:04:06 +0000
commit719a9e9a590bc355560176568cfaac1f10fb9a97 (patch)
tree4dfc8a804d19466a3a9b90d6838014ab21bd4389 /Master/texmf-dist/tex/latex/pas-crosswords
parent2667ac5383dea9c9fe17ac47780210373d753580 (diff)
pas-crosswords (3dec13)
git-svn-id: svn://tug.org/texlive/trunk@32313 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pas-crosswords')
-rw-r--r--Master/texmf-dist/tex/latex/pas-crosswords/pas-crosswords.sty182
1 files changed, 182 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/pas-crosswords/pas-crosswords.sty b/Master/texmf-dist/tex/latex/pas-crosswords/pas-crosswords.sty
new file mode 100644
index 00000000000..dec9924d04d
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/pas-crosswords/pas-crosswords.sty
@@ -0,0 +1,182 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% pas-motscroises.sty 1.02 encodage : UTF8 %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% Créé par Stéphane PASQUET %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+% Informations générales
+\NeedsTeXFormat{LaTeX2e}[1999/01/01]
+\ProvidesPackage{pas-crosswords}[2011/04/11]
+
+% Chargement des packages nécessaires
+\RequirePackage{xkeyval}[2005/11/25]
+\@ifpackageloaded{xstring}{}{\RequirePackage{xstring}}
+\@ifpackageloaded{tikz}{}{\RequirePackage{tikz}}
+\@ifpackageloaded{multido}{}{\RequirePackage{multido}}
+\@ifpackageloaded{fp}{}{\RequirePackage{fp}}
+
+
+% Définitions diverses
+\newcommand{\cRM}[1]{\MakeUppercase{\tiny\romannumeral #1}}
+\tikzstyle{blackcasestyle}=[fill=black]
+\tikzstyle{gridstyle}=[draw=black]
+\tikzstyle{numberstyle}=[text=black]
+\tikzstyle{wordstyle}=[text=black]
+
+% Environnement "crossgrid"
+
+\define@cmdkey [PAS] {grille} {h}{}
+\define@cmdkey [PAS] {grille} {v}{}
+\define@cmdkey [PAS] {grille} {pas}{}
+\presetkeys [PAS] {grille} {h=1, v=1, pas=.5}{}
+
+\newenvironment*{crossgrid}[1][]
+{
+ \setkeys[PAS]{grille}{#1}
+ \begin{scope}
+ \draw[step=\cmdPAS@grille@pas,gridstyle] (0,0) grid +(\cmdPAS@grille@h*\cmdPAS@grille@pas,\cmdPAS@grille@v*\cmdPAS@grille@pas);
+ \foreach \x in {1,...,\cmdPAS@grille@h}
+ {
+ \node[numberstyle] at (\x*\cmdPAS@grille@pas-.5*\cmdPAS@grille@pas,\cmdPAS@grille@v*\cmdPAS@grille@pas+0.25) {\tiny\x};
+ }
+ \pgfmathparse{\cmdPAS@grille@v*\cmdPAS@grille@pas}
+ \foreach \y in {1,2,...,\cmdPAS@grille@v}
+ {
+ \node[left,numberstyle] at (0,\pgfmathresult-\y*\cmdPAS@grille@pas+.5*\cmdPAS@grille@pas) {\cRM{\y}};
+ }
+}
+{
+ \end{scope}
+}
+
+
+% Commande "blackcase"
+
+\newcommand*{\blackcase}[2]
+{
+ \fill[blackcasestyle] (#1*\cmdPAS@grille@pas,\pgfmathresult-#2*\cmdPAS@grille@pas) rectangle +(-\cmdPAS@grille@pas,\cmdPAS@grille@pas);
+}
+
+% Commande "blackcases"
+
+\newcommand*{\blackcases}[1]
+{
+ \foreach \x/\y in {#1}
+ {
+ \blackcase{\x}{\y}
+ }
+}
+
+% Commande \word
+
+\define@boolkey[PAS] {mot} {h}[true]{}
+\define@boolkey[PAS] {mot} {v}[true]{}
+\presetkeys [PAS] {mot} {h=false,v=false}{}
+
+\newcommand*{\word}[4][]
+{
+ \setkeys[PAS]{mot}{#1}
+ \pgfmathparse{\cmdPAS@grille@pas/2+\cmdPAS@grille@pas*(#2-1)}\let\debutX\pgfmathresult
+ \pgfmathparse{\cmdPAS@grille@v*\cmdPAS@grille@pas-#3*\cmdPAS@grille@pas+\cmdPAS@grille@pas/2}\let\debutY\pgfmathresult
+ \StrLen{#4}[\n]
+ \ifPAS@mot@h
+ \foreach \i in {1,...,\n}
+ {
+ \pgfmathparse{\debutX+(\i-1)*\cmdPAS@grille@pas}\let\posX\pgfmathresult
+ \node[wordstyle] at (\posX,\debutY) {\StrChar{#4}{\i}};
+ }
+ \fi
+ \ifPAS@mot@v
+ \foreach \i in {1,...,\n}
+ {
+ \pgfmathparse{\debutY-(\i-1)*\cmdPAS@grille@pas}\let\posY\pgfmathresult
+ \node[wordstyle] at (\debutX,\posY) {\StrChar{#4}{\i}};
+ }
+ \fi
+}
+
+% Commande "words"
+
+\define@boolkey[PAS] {mots} {h}[true]{}
+\define@boolkey[PAS] {mots} {v}[true]{}
+\presetkeys [PAS] {mots} {h=false,v=false}{}
+
+\newcommand*{\words}[2][]
+{
+ \setkeys[PAS]{mots}{#1}
+ \foreach \x/\y/\m in {#2}
+ {
+ \ifPAS@mots@h
+ \word[h]{\x}{\y}{\m}
+ \fi
+ \ifPAS@mots@v
+ \word[v]{\x}{\y}{\m}
+ \fi
+
+ }
+}
+
+% Commande \gridcross
+
+\newcommand*{\gridcross}[1]
+{
+ \begin{scope}
+ \coordinate (case1_0) at (0,0);
+ \newcounter{L}
+ \setcounter{L}{1}
+ \foreach \ligne in {#1}
+ {
+ \StrLen{\ligne}[\n]
+ \multido{\i=1+1}{\n}
+ {
+ \ifnum\i<2
+ \tikzstyle{position}=[below,minimum width=.7cm,minimum height=.7cm,outer sep=0pt,wordstyle]
+ \def\namecase{case1_\theL}
+ \FPsub{\pr}{\theL}{1}
+ \FPclip{\p}{\pr}
+ \def\pos{case1_\p.south}
+ \else
+ \tikzstyle{position}=[right,minimum width=.7cm,minimum height=.7cm,outer sep=0pt,wordstyle]
+ \def\namecase{case}
+ \ifnum\i<3
+ \def\pos{case1_\theL.east}
+ \else
+ \def\pos{case.east}
+ \fi
+ \fi
+ \StrChar{\ligne}{\i}[\caractere]
+ \IfStrEq{\caractere}{*}
+ {\node[draw,position,blackcasestyle] (\namecase) at (\pos) {};}
+ {\node[draw,position] (\namecase) at (\pos) {\caractere};}
+ \ifnum\theL<2
+ \node[above,outer sep=2pt,numberstyle] at (\namecase.north) {\i};
+ \fi
+ }
+ \node[left,numberstyle] at (case1_\theL.west) {\cRM{\theL}};
+ \stepcounter{L}
+ }
+ \end{scope}
+}
+
+% Commande % \def{h/v}{<texte>}
+
+\def\symbsep{--}
+\def\symbnext{}
+\newcounter{cntdef}
+
+\newcommand*\newlist{\setcounter{cntdef}{0}}
+
+\newlist
+
+\newcommand*\printDef[3][] % #1 = <s> pour indiquer une séparation de définitions au même niveau, #2 = <h|v>, #3 = Texte
+{%
+ \IfSubStr{#2}{v}{\def\num{\thecntdef}}{\def\num{\MakeUppercase{\romannumeral\thecntdef}}}
+ \IfSubStr{#1}{s}{\symbsep\hspace*{1em}#3}{\addtocounter{cntdef}{1}\ifnum\thecntdef=1\else\symbnext\fi\textbf{\num}\hspace*{1em}#3}
+}
+
+\endinput