summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/scrabble/doc/Scrabble-doc-en.tex
blob: e854e66201070643681f269428e2a82f648f62bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
% !TeX TXS-program:compile = txs:///arara
% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode}
% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)')

\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{Scrabble}
%\usepackage[upright]{fourier}
%\usepackage[scaled=0.875]{helvet}
%\renewcommand\ttdefault{lmtt}
%\usepackage[scaled=0.875]{cabin}
\usepackage{amsmath,amssymb}
\usepackage{fontawesome5}
\usepackage{enumitem}
\usepackage{tabularray}
\usepackage{fancyvrb}
\usepackage{fancyhdr}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\lfoot{\sffamily\small [Scrabble]}
\cfoot{\sffamily\small - \thepage{} -}
\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}}

\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}
\usepackage[margin=1.5cm]{geometry}
\setlength{\parindent}{0pt}
\definecolor{LightGray}{gray}{0.9}

\def\TPversion{0.1.5}
\def\TPdate{23/01/2024}

\usepackage[most]{tcolorbox}
\tcbuselibrary{minted}
\NewTCBListing{PresentationCode}{ O{blue} m }{%
	sharp corners=downhill,enhanced,arc=12pt,skin=bicolor,%
	colback=#1!1!white,colframe=#1!75!black,colbacklower=white,%
	attach boxed title to top right={yshift=-\tcboxedtitleheight},title=Code \LaTeX,%
	boxed title style={%
		colframe=#1!75!black,colback=#1!15!white,%
		,sharp corners=downhill,arc=12pt,%
	},%
	fonttitle=\color{#1!90!black}\itshape\ttfamily\footnotesize,%
	listing engine=minted,minted style=colorful,
	minted language=tex,minted options={tabsize=4,fontsize=\footnotesize,autogobble},
	#2
}

\newcommand\Cle[1]{{\bfseries\sffamily\textlangle #1\textrangle}}

\begin{document}

\pagestyle{fancy}

\thispagestyle{empty}

\vspace{2cm}

\begin{center}
	\begin{minipage}{0.75\linewidth}
	\begin{tcolorbox}[colframe=yellow,colback=yellow!15]
		\begin{center}
			\begin{tabular}{c}
				{\Huge \texttt{Scrabble [en]}}\\
				\\
				{\LARGE A board of Scrabble,} \\
				\\
				{\LARGE with words or not.} \\
				\\
				{Scrabble\texttrademark{}, from Hasbro\texttrademark{} and Mattel\texttrademark{}.}
			\end{tabular}
			
			\medskip
			
			{\small \texttt{Version \TPversion{} -- \TPdate}}
		\end{center}
	\end{tcolorbox}
\end{minipage}
\end{center}

\vspace{0.5cm}

\begin{center}
	\begin{tabular}{c}
	\texttt{Cédric Pierquet}\\
	{\ttfamily c pierquet -- at -- outlook . fr}\\
	\texttt{\url{https://github.com/cpierquet/Scrabble}}
\end{tabular}
\end{center}

\vspace{0.5cm}

{$\blacktriangleright$~~Some commands to display a Scrabble board, with or without words.}

\smallskip

{$\blacktriangleright$~~English, French, German or Spanish version for points and labels.}

\smallskip

{$\blacktriangleright$~~Ideas from \url{https://tex.stackexchange.com/questions/194780/tikz-drawing-a-rectangle-with-spikes-on-borders}}

\vspace{0.15cm}

\begin{center}
	\ScrabbleBoard[Scale=0.5]
	~~~~
	\begin{EnvScrabble}[Scale=0.5]
		\ScrabblePutWord{TIKZ}{1,13}
		\ScrabblePutWord[V]{pstricks}{1,15}
		\ScrabblePutWord[V]{KaTeX}{3,13}
		\ScrabblePutWord{cleveref}{1,10}
		\ScrabblePutWord[V]{METAPOST}{7,11}
		\ScrabblePutWord{LUALATEX}{5,8}
		\ScrabblePutWord[V]{ProfLy*ee}{11,15}
		\ScrabblePutWord{PROFCOLLE*E}{1,1}
		\ScrabblePutWord{SYNTAX}{7,5}
		\ScrabblePutWord[V]{STRIN*}{10,6}
	\end{EnvScrabble}
\end{center}

\vspace{0.5cm}

\hfill{}\textit{Thanks to Denis Bitouzé and Patrick Bideault for help and ideas !}

\vfill

\hrule

\medskip

\TableauDocumentation

\medskip

\hrule

\medskip

\newpage

\part*{Introduction}

\section{The Scrabble package}

\subsection{Source}

Some ideas are from \url{https://tex.stackexchange.com/questions/194780/tikz-drawing-a-rectangle-with-spikes-on-borders}, with propostion from Mark Wibrow.

\smallskip

This package is \textit{build} within styles and ideas from Mark Wibrow.

\subsection{Loading of the package, used packages}

The package \textsf{Scrabble} loads within the preamble :

\begin{PresentationCode}{listing only}
\usepackage{Scrabble}
\end{PresentationCode}

It's mostly compatible with \textsf{latex}, \textsf{pdflatex}, \textsf{lualatex} or \textsf{xelatex} compilation !

\medskip

It loads the following packages and libraries :

\begin{itemize}
	\item \texttt{tikz} with \Cle{calc} with the tikzlibraries \Cle{calc} and \Cle{shapes.geometric} ;
	\item \texttt{pgf} and \texttt{pgffor} ;
	\item \texttt{xstring}, \texttt{xparse}, \texttt{simplekv} and \texttt{listofitems}.
\end{itemize}

\subsection{The package itself}

The idea is to, thanks to \TikZ, propose commands or environments to display a Scrabble\texttrademark{} board :

\begin{itemize}
	\item \textit{independent} ;
	\item in an \textit{environment} with words.
\end{itemize}

\begin{PresentationCode}{listing only}
%independent command for the empty board
\ScrabbleBoard<language>[keys]

%environment with word(s)
\begin{EnvScrabble}<language>[keys]
	\ScrabblePutWord[orientation]{word}{coordinates of the beginning cell}
\end{EnvScrabble}
\end{PresentationCode}

\subsection{Languages}

The \textsf{commands}, \textsf{environments} et \textsf{keys} are in english, but cells can be displayed in :

\begin{itemize}
	\item english (code ISO 639-1 EN) ;
	\item french (code ISO 639-1 FR) ;
	\item german (code ISO 639-1 DE) ;
	\item spanish (code ISO 639-1 ES).
\end{itemize}

\pagebreak

\section{Commands, keys and options}

\subsection{The board, standalone}

The first argument, \textit{optional}, between \texttt{<...>} is the \Cle{langage} of the display, form the list :

\hfill\Cle{EN} (english, default), \Cle{FR} (french), \Cle{DE} (german) et \Cle{ES} (spanish).\hfill~

\smallskip

The second argument, \textit{optional}, between \texttt{[...]} give the \Cle{keys} :

\begin{itemize}
	\item \Cle{Scale} for the display (the initial unit is 1~cm) ; \hfill~default : \Cle{1}
	\item \Cle{ScaleLabels} for the cell's names ; \hfill~défaut : \Cle{1}
	\item the boolean \Cle{Border} pour print a border outside the board ; \hfill~default : \Cle{true}
	\item the boolean \Cle{Labels} to print \textit{names} of the special cells ;\hfill~default : \Cle{true}
	\item the boolean \Cle{Help} pour print numbers to reperate th cells ;\hfill~default : \Cle{false}
\end{itemize}

\begin{PresentationCode}{}
\ScrabbleBoard[Labels=false,Scale=0.55]\\      %board without cell's names
\ScrabbleBoard<ES>[Scale=0.55,Border=false]     %board in spanish, without border
\end{PresentationCode}

\newpage

\subsection{The board with words}

Here we can use the \textsf{environment} with the specific \textsf{command} in order to print words on the board.

\smallskip

For the \textit{environment}, the options are the same as for the independent \textsf{command} !

\smallskip

For putting word on the board :

\begin{itemize}
	\item the first argument, \textit{optional}, between \texttt{[...]} is the orientation of the word, \Cle{H} (by default) or \Cle{V} ;
	\item the second argument, \textit{mandatory}, between \texttt{\{...\}}, is the word, with uppercase or lowercase letters ;
	\item the last argument, \textit{mandatory}, between \texttt{\{...\}}, is the coordinates of the first cell for fisrt lettre (the cell (1;\,1) is south-west corner).
\end{itemize}

\textbf{Observation 1 :} the chosen language will display the right points in the til !

\smallskip

\textbf{Observation 2 :} the \textit{white} (or \textit{joker}) is coded by the character \texttt{*}.

\begin{PresentationCode}{}
\begin{EnvScrabble}[Scale=0.75,Labels=false,Help]
	\ScrabblePutWord{TIKZ}{1,13}
	\ScrabblePutWord[V]{pstricks}{1,15}
	\ScrabblePutWord[V]{KaTeX}{3,13}
	\ScrabblePutWord{cleveref}{1,10}
	\ScrabblePutWord[V]{METAPOST}{7,11}
	\ScrabblePutWord{LUALATEX}{5,8}
	\ScrabblePutWord[V]{ProfLy*ee}{11,15}
	\ScrabblePutWord{PROFCOLLE*E}{1,1}
	\ScrabblePutWord{SYNTAX}{7,5}
	\ScrabblePutWord[V]{STRIN*}{10,6}
\end{EnvScrabble}
\end{PresentationCode}

\begin{PresentationCode}{}
\begin{EnvScrabble}[Scale=0.55]
	\ScrabblePutWord{tikz}{1,13} \ScrabblePutWord[V]{PSTRiCKS}{1,15}
	\draw (7,15) node[font=\LARGE\sffamily] {English version} ;
\end{EnvScrabble}~~~
\begin{EnvScrabble}<FR>[Scale=0.55]
	\ScrabblePutWord{tikz}{1,13} \ScrabblePutWord[V]{PSTRiCKS}{1,15}
	\draw (7,15) node[font=\LARGE\sffamily] {French version} ;
\end{EnvScrabble}\\
\begin{EnvScrabble}<DE>[Scale=0.55]
	\ScrabblePutWord{tikz}{1,13} \ScrabblePutWord[V]{PSTRiCKS}{1,15}
	\draw (7,15) node[font=\LARGE\sffamily] {German version} ;
\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 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

\subsection{Special letters}

It is possible to use special characters, for the languages \textsf{<DE>} and \textsf{<ES>}, but for compatibility reasons, special characters are \textit{coded} by numbers :

\begin{itemize}
	\item \texttt{0} code the letter \fbox{\"A} with 6 points ;
	\item \texttt{1} code the letter \fbox{\"O} with 8 points ;
	\item \texttt{4} code the letter \fbox{\"U} with 6 points ;
	\item \texttt{6} code the \textit{letter} \fbox{CH} with 5 points ;
	\item \texttt{7} code the letter \fbox{\~{N}} with 8 points ;
	\item \texttt{8} code the \textit{letter} \fbox{RR} with 8 points ;
	\item \texttt{9} code the \textit{letter} \fbox{LL} with 8 points.
\end{itemize}

\begin{PresentationCode}{}
{\Huge \ScrabbleWord[Lang=DE,Font=\ttfamily,Scale=0.75]{104AAA}}

{\Huge \ScrabbleWord[Lang=ES,Font=\sffamily,Scale=0.75]{RO7OSO}}
\end{PresentationCode}

\newpage

\part*{History}

\verb|v0.1.5|~:~~~~Special letters for \textsf{<DE>} and \textsf{<ES>}

\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

\verb|v0.1  |~:~~~~Initial version

\end{document}