diff options
author | Karl Berry <karl@freefriends.org> | 2023-12-03 21:08:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-12-03 21:08:31 +0000 |
commit | e9800175c3dd0bc97f50e3fcd9da85d43811612e (patch) | |
tree | dec7a92675579e6632d43bed0df01c4202d5bc24 | |
parent | a64a596d6cef435825f85588b2dd6118dc1f46fc (diff) |
scrabble (3dec23)
git-svn-id: svn://tug.org/texlive/trunk@69024 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-en.pdf | bin | 481429 -> 540950 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-en.tex | 81 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-fr.pdf | bin | 520790 -> 582871 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-fr.tex | 93 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/scrabble/Scrabble.sty | 104 |
5 files changed, 248 insertions, 30 deletions
diff --git a/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-en.pdf b/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-en.pdf Binary files differindex 4ec7478db80..cf1cabf2cc4 100644 --- a/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-en.pdf +++ b/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-en.pdf diff --git a/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-en.tex b/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-en.tex index 3bbae9eae40..eb6f8d5eaa1 100644 --- a/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-en.tex +++ b/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-en.tex @@ -23,7 +23,22 @@ \cfoot{\sffamily\small - \thepage{} -} \rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}} -\usepackage{hvlogos} +\usepackage{hologo} +\usepackage{xspace} +\newcommand\tikzlogo{Ti\textit{k}Z} +\newcommand\TeXLive{\hologo{TeX}Live\xspace} +\let\TikZ\tikzlogo +\newcommand\TableauDocumentation{% + \begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\sffamily}} + {\huge \LaTeX} & & & & &\\ + & {\huge \hologo{pdfLaTeX}} & & & & \\ + & & {\huge \hologo{LuaLaTeX}} & & & \\ + & & & {\huge \TikZ} & & \\ + & & & & {\huge \TeXLive} & \\ + & & & & & {\huge \hologo{MiKTeX}} \\ + \end{tblr} +} + \usepackage{hyperref} \urlstyle{same} \hypersetup{pdfborder=0 0 0} @@ -31,8 +46,8 @@ \setlength{\parindent}{0pt} \definecolor{LightGray}{gray}{0.9} -\def\TPversion{0.1.3} -\def\TPdate{09/01/2023} +\def\TPversion{0.1.4} +\def\TPdate{03/12/2023} \usepackage[most]{tcolorbox} \tcbuselibrary{minted} @@ -104,7 +119,7 @@ {$\blacktriangleright$~~Ideas from \url{https://tex.stackexchange.com/questions/194780/tikz-drawing-a-rectangle-with-spikes-on-borders}} -\vspace{0.5cm} +\vspace{0.15cm} \begin{center} \ScrabbleBoard[Scale=0.5] @@ -133,14 +148,7 @@ \medskip -\begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\sffamily}} -{\huge \LaTeX} & & & & &\\ -& {\huge \pdfLaTeX} & & & & \\ -& & {\huge \LuaLaTeX} & & & \\ -& & & {\huge \TikZ} & & \\ -& & & & {\huge \TeXLive} & \\ -& & & & & {\huge \MiKTeX} \\ -\end{tblr} +\TableauDocumentation \medskip @@ -295,14 +303,61 @@ For putting word on the board : \end{EnvScrabble}~~~ \begin{EnvScrabble}<ES>[Scale=0.55] \ScrabblePutWord{LaTeX}{1,14} \ScrabblePutWord[V]{Madrid}{2,15} - \draw (7,15) node[font=\LARGE\sffamily] {Spanish vesion} ; + \draw (7,15) node[font=\LARGE\sffamily] {Spanish version} ; \end{EnvScrabble} \end{PresentationCode} \newpage +\subsection{\textit{Inline} word} + +The idea is to propose a command to insert a word in \textit{online} mode, with automatic adjustment of size and position. + +\begin{PresentationCode}{listing only} +%command to put inline word +\ScrabbleWord[keys]{word} +\end{PresentationCode} + +The first argument, \textit{optional}, between \texttt{[...]} allows you to configure the \Cle{keys}: + +\begin{itemize} + \item \Cle{Colback} for the color of the pieces ; \hfill~default: \Cle{yellow!40} + \item \Cle{Font} for the font ; \hfill~default: \Cle{\textbackslash bfseries\textbackslash sffamily} + \item \Cle{Colfonte} for the color of the characters ; \hfill~default: \Cle{black} + \item \Cle{Lang} to choose the language (for the number of points) ; \hfill~default: \Cle{EN} + \item \Cle{Offset} to specify horizontal spacing between pieces ; \hfill~default: \Cle{0.1pt} + \item \Cle{Scale} to specify a base scale for texts ; \hfill~default: \Cle{0.6} + \item \Cle{Score} which is a boolean to display the score of each piece. \hfill~default: \Cle{true} +\end{itemize} + +\textbf{Note 1 :} the code is responsible for positioning the pieces for \textit{satisfactory} alignment and scaling based on the active font. + +\smallskip + +\textbf{Note 2 :} the \textit{blank} (or \textit{wildcard}) is obtained by the character \texttt{*}. + +\begin{PresentationCode}{} +Online Scrabble word test positioning \ScrabbleWord{TE*ST} to see ! +\end{PresentationCode} + +\begin{PresentationCode}{} +{\Huge\sffamily Test positioning \ScrabbleWord[Colback=teal!5,Colfonte=orange]{PYTHAG*RE} to see !} +\end{PresentationCode} + +\begin{PresentationCode}{} +\scalebox{3}[3]{Positioning \ScrabbleWord[Lang=DE,Font=\ttfamily,Scale=0.75]{PYTHAG*RE} to see !} +\end{PresentationCode} + +\begin{PresentationCode}{} +{\LARGE Test positioning \ScrabbleWord[Score=false,Offset=1pt,Colback=orange!50]{PSTRICKS} to see !} +\end{PresentationCode} + +\newpage + \part*{History} +\verb|v0.1.4|~:~~~~Command to insert \textit{inline} words + \verb|v0.1.3|~:~~~~Words in uppercase or lowercase, adjusted codes for language (ISO 639-1) \verb|v0.1.2|~:~~~~Key \textsf{<ScaleLabels>} to modify scale of the cell's names diff --git a/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-fr.pdf b/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-fr.pdf Binary files differindex 04bb85d6fc2..659b47854af 100644 --- a/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-fr.pdf +++ b/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-fr.pdf diff --git a/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-fr.tex b/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-fr.tex index 05d0ae1f4d4..560ad35342a 100644 --- a/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-fr.tex +++ b/Master/texmf-dist/doc/latex/scrabble/Scrabble-doc-fr.tex @@ -23,7 +23,24 @@ \cfoot{\sffamily\small - \thepage{} -} \rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}} -\usepackage{hvlogos} +%\usepackage{hvlogos} +\usepackage{hologo} +\providecommand\tikzlogo{Ti\textit{k}Z} +\providecommand\TeXLive{\TeX{}Live\xspace} +\providecommand\PSTricks{\textsf{PSTricks}\xspace} +\let\pstricks\PSTricks +\let\TikZ\tikzlogo +\newcommand\TableauDocumentation{% + \begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\sffamily}} + {\huge \LaTeX} & & & & &\\ + & {\huge \hologo{pdfLaTeX}} & & & & \\ + & & {\huge \hologo{LuaLaTeX}} & & & \\ + & & & {\huge \TikZ} & & \\ + & & & & {\huge \TeXLive} & \\ + & & & & & {\huge \hologo{MiKTeX}} \\ + \end{tblr} +} + \usepackage{hyperref} \urlstyle{same} \hypersetup{pdfborder=0 0 0} @@ -31,8 +48,8 @@ \setlength{\parindent}{0pt} \definecolor{LightGray}{gray}{0.9} -\def\TPversion{0.1.3} -\def\TPdate{9 Janvier 2023} +\def\TPversion{0.1.4} +\def\TPdate{3 décembre 2023} \usepackage[most]{tcolorbox} \tcbuselibrary{minted} @@ -102,14 +119,18 @@ \smallskip +{$\blacktriangleright$~~Possibilité d'insérer un mot en mode \textit{en ligne}.} + +\smallskip + {$\blacktriangleright$~~Idée(s) venant de \url{https://tex.stackexchange.com/questions/194780/tikz-drawing-a-rectangle-with-spikes-on-borders}} -\vspace{0.5cm} +\vspace{0.15cm} \begin{center} - \PlateauScrabble[Echelle=0.4] + \PlateauScrabble[Echelle=0.5] ~~~~ - \begin{EnvScrabbleFR}[Echelle=0.4] + \begin{EnvScrabbleFR}[Echelle=0.5] \ScrabblePlaceMot{TIKZ}{1,13} \ScrabblePlaceMot[V]{pstricks}{1,15} \ScrabblePlaceMot[V]{KaTeX}{3,13} @@ -135,14 +156,7 @@ \medskip -\begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\sffamily}} -{\huge \LaTeX} & & & & &\\ -& {\huge \pdfLaTeX} & & & & \\ -& & {\huge \LuaLaTeX} & & & \\ -& & & {\huge \TikZ} & & \\ -& & & & {\huge \TeXLive} & \\ -& & & & & {\huge \MiKTeX} \\ -\end{tblr} +\TableauDocumentation \medskip @@ -258,8 +272,8 @@ Pour le placement des mots : \begin{itemize} \item le premier argument, \textit{optionnel}, entre \texttt{[...]} est l'orientation du mot, à choisir entre \Cle{H} (par défaut) et \Cle{V} (en fait toute autre lettre que \Cle{H} !) ; - \item le deuxième argument, \textit{mandataire}, entre \texttt{\{...\}}, est le mot à placer, en majuscules ou minuscules ; - \item le dernier argument, \textit{mandataire}, entre \texttt{\{...\}}, correspond aux coordonnées de la case sur laquelle sera placée le début du mot (la case (1;\,1) étant la case au bord Bas/Gauche). + \item le deuxième argument, \textit{obligatoire}, entre \texttt{\{...\}}, est le mot à placer, en majuscules ou minuscules ; + \item le dernier argument, \textit{obligatoire}, entre \texttt{\{...\}}, correspond aux coordonnées de la case sur laquelle sera placée le début du mot (la case (1;\,1) étant la case au bord Bas/Gauche). \end{itemize} \textbf{Remarque 1 :} la langue choisie permettra également d'avoir les jetons avec le \textit{bon} nombre de points ! @@ -304,6 +318,51 @@ Pour le placement des mots : \newpage +\subsection{Mot \textit{en ligne}} + +Il s'agit ici de proposer une commande pour insérer un mot en mode \textit{en ligne}, avec ajustement automatique de la taille et de la position. + +\begin{PresentationCode}{listing only} +%commande pour placer un mot en ligne +\MotScrabble[clés]{mot} +\end{PresentationCode} + +Le premier argument, \textit{optionnel}, entre \texttt{[...]} permet de paramétrer les \Cle{clés} : + +\begin{itemize} + \item \Cle{CouleurFond} pour la couleur des cases ; \hfill~défaut : \Cle{yellow!40} + \item \Cle{Police} pour la police des caractères ; \hfill~défaut : \Cle{\textbackslash bfseries\textbackslash sffamily} + \item \Cle{CouleurPolice} pour la couleur des caractères ; \hfill~défaut : \Cle{black} + \item \Cle{Langue} pour choisir la langue (pour les nombres de points) ; \hfill~défaut : \Cle{FR} + \item \Cle{Offset} pour spécifier un espacement horizontal entre les jetons ; \hfill~défaut : \Cle{0.1pt} + \item \Cle{Echelle} pour spécifier une échelle de base pour les textes ; \hfill~défaut : \Cle{0.6} + \item \Cle{Score} qui est un booléen pour afficher le score de chaque jeton.\hfill~défaut : \Cle{true} +\end{itemize} + +\textbf{Remarque 1 :} le code se charge de positionner le jeton pour un alignement et une mise à l'échelle \textit{satisfaisants} en fonction de la police active. + +\smallskip + +\textbf{Remarque 2 :} le \textit{blanc} (ou \textit{joker}) est obtenu par le caractère \texttt{*}. + +\begin{PresentationCode}{} +Essai de mot de Scrabble en ligne \MotScrabble{TE*ST} pour voir ! +\end{PresentationCode} + +\begin{PresentationCode}{} +{\Huge\sffamily En ligne \MotScrabble[CouleurFond=teal!5,CouleurPolice=orange]{PYTHAG*RE} pour voir !} +\end{PresentationCode} + +\begin{PresentationCode}{} +\scalebox{3}[3]{En ligne \MotScrabble[Langue=EN,Police=\ttfamily,Echelle=0.75]{PYTHAG*RE} pour voir !} +\end{PresentationCode} + +\begin{PresentationCode}{} +{\LARGE En ligne \MotScrabble[Score=false,Offset=1pt,CouleurFond=orange!50]{PSTRICKS} pour voir !} +\end{PresentationCode} + +\newpage + \subsection{Commandes anglaises} Le package ayant potentiellement une portée \textit{internationale}, les commandes existent également en version \textit{anglaise}. Dans ce cas, les \Cle{clés} sont également à donner en anglais. @@ -327,6 +386,8 @@ Le package ayant potentiellement une portée \textit{internationale}, les comman \part*{Historique} +\verb|v0.1.4|~:~~~~Ajout d'une commande pour placer en \textit{mot} en mode \og en ligne \fg + \verb|v0.1.3|~:~~~~Meilleure gestion de la saisie des mots (sans virgule, majuscule ou minuscule) \verb|v0.1.2|~:~~~~Clé \textsf{<EchelleLabels>} pour modifier l'échelle des noms des cases diff --git a/Master/texmf-dist/tex/latex/scrabble/Scrabble.sty b/Master/texmf-dist/tex/latex/scrabble/Scrabble.sty index 6c87e7e370c..0d610ea1179 100644 --- a/Master/texmf-dist/tex/latex/scrabble/Scrabble.sty +++ b/Master/texmf-dist/tex/latex/scrabble/Scrabble.sty @@ -4,7 +4,8 @@ % Inspiration : Mark Wibrow in https://tex.stackexchange.com/questions/194780/tikz-drawing-a-rectangle-with-spikes-on-borders \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{Scrabble}[2023/01/09 v0.1.3 Scrabble] +\ProvidesPackage{Scrabble}[2023/12/03 0.1.4 Scrabble] +% 0.1.4 Ajout d'un mode inline % 0.1.3 Refonte des commandes fr/en + gestion mot % 0.1.2 Clé <EchelleLabels> pour les labels des cases % 0.1.1 Commandes en/fr @@ -17,6 +18,7 @@ \RequirePackage{xparse} \RequirePackage{simplekv} \RequirePackage{listofitems} +\RequirePackage{calc} %librairies tikz \usetikzlibrary{calc,shapes.geometric} @@ -312,4 +314,104 @@ \end{tikzpicture}% } +%place mot inline +\newlength{\tmp@scrabword@total@height} +\newlength{\tmp@scrabword@depth} + +\defKV[SCRABBLEWORDINLINEFR]{% + CouleurFond=\def\ScrWordInlColFond{#1},% + Police=\def\ScrWordInlFonte{#1},% + CouleurPolice=\def\ScrWordInlColFonte{#1},% + Langue=\def\ScrWordInlLang{#1},% + Offset=\def\ScrWordInlOffset{#1},% + Echelle=\def\ScrWordInlScale{#1} +} + +\setKVdefault[SCRABBLEWORDINLINEFR]{% + CouleurFond=yellow!40,% + Police=\bfseries\sffamily,% + CouleurPolice=black,% + Langue=FR,% + Offset=0.1pt,% + Score=true,% + Echelle=0.6 +} + +\NewDocumentCommand\MotScrabble{ O{} m }{% + \useKVdefault[SCRABBLEWORDINLINEFR]% + \setKV[SCRABBLEWORDINLINEFR]{#1}% + \settototalheight{\tmp@scrabword@total@height}{\hbox{ABCDEFGHIJKLMNOPQQRSTUVWXYZabcdefghijklmnopqqrstuvwxyz}}% + \settodepth{\tmp@scrabword@depth}{\hbox{q}}% + \StrLen{#2}[\lgmot]% + \raisebox{-\tmp@scrabword@depth+0.025\tmp@scrabword@total@height}{% + \foreach \l in {1,2,...,\lgmot}% + {% + \StrChar{#2}{\l}[\ll]% + \IfStrEq{\ll}{*}% + {% + {\tikz \filldraw[\ScrWordInlColFond,rounded corners={0.15\tmp@scrabword@total@height}] (0,0) rectangle++ ({0.9\tmp@scrabword@total@height},{0.9\tmp@scrabword@total@height}) ;}% + }% + {% + {\tikz {% + \filldraw[\ScrWordInlColFond,rounded corners={0.15\tmp@scrabword@total@height}] (0,0) rectangle++ ({0.9\tmp@scrabword@total@height},{0.9\tmp@scrabword@total@height}) node[inner sep=0pt,midway,font=\ScrWordInlFonte,scale=\ScrWordInlScale,text=\ScrWordInlColFonte] {\expandafter\MakeUppercase\expandafter{\ll}};% + \ifboolKV[SCRABBLEWORDINLINEFR]{Score}% + {\draw ({0.9\tmp@scrabword@total@height},0) node[inner sep=0pt,above left={0.075\tmp@scrabword@total@height},font=\ScrWordInlFonte,scale={0.25*\ScrWordInlScale},text=\ScrWordInlColFonte] { \scrabblescorelettre[\ScrWordInlLang]{\ll} } ;} + {}% + }% + }% + }% + \ifnum \l<\lgmot\hspace*{\ScrWordInlOffset}\fi% + }% + }% +} + +\defKV[SCRABBLEWORDINLINEEN]{% + Colback=\def\ScrWordInlColFond{#1},% + Font=\def\ScrWordInlFonte{#1},% + Colfonte=\def\ScrWordInlColFonte{#1},% + Lang=\def\ScrWordInlLang{#1},% + Offset=\def\ScrWordInlOffset{#1},% + Scale=\def\ScrWordInlScale{#1} +} + +\setKVdefault[SCRABBLEWORDINLINEEN]{% + Colback=yellow!40,% + Font=\bfseries\sffamily,% + Colfonte=black,% + Lang=EN,% + Offset=0.1pt,% + Score=true,% + Scale=0.6 +} + +\NewDocumentCommand\ScrabbleWord{ O{} m }{% + \useKVdefault[SCRABBLEWORDINLINEEN]% + \setKV[SCRABBLEWORDINLINEEN]{#1}% + \settototalheight{\tmp@scrabword@total@height}{\hbox{ABCDEFGHIJKLMNOPQQRSTUVWXYZabcdefghijklmnopqqrstuvwxyz}}% + \settodepth{\tmp@scrabword@depth}{\hbox{q}}% + \StrLen{#2}[\lgmot]% + \raisebox{-\tmp@scrabword@depth+0.025\tmp@scrabword@total@height}{% + \foreach \l in {1,2,...,\lgmot}% + {% + \StrChar{#2}{\l}[\ll]% + \IfStrEq{\ll}{*}% + {% + {\tikz \filldraw[\ScrWordInlColFond,rounded corners={0.15\tmp@scrabword@total@height}] (0,0) rectangle++ ({0.9\tmp@scrabword@total@height},{0.9\tmp@scrabword@total@height}) ;}% + }% + {% + {\tikz {% + \filldraw[\ScrWordInlColFond,rounded corners={0.15\tmp@scrabword@total@height}] (0,0) rectangle++ ({0.9\tmp@scrabword@total@height},{0.9\tmp@scrabword@total@height}) node[inner sep=0pt,midway,font=\ScrWordInlFonte,scale=\ScrWordInlScale,text=\ScrWordInlColFonte] {\expandafter\MakeUppercase\expandafter{\ll}};% + \ifboolKV[SCRABBLEWORDINLINEEN]{Score}% + {\draw ({0.9\tmp@scrabword@total@height},0) node[inner sep=0pt,above left={0.075\tmp@scrabword@total@height},font=\ScrWordInlFonte,scale={0.25*\ScrWordInlScale},text=\ScrWordInlColFonte] { \scrabblescorelettre[\ScrWordInlLang]{\ll} } ;} + {}% + }% + }% + }% + \ifnum \l<\lgmot\hspace*{\ScrWordInlOffset}\fi% + }% + }% +} + + + \endinput
\ No newline at end of file |