Debian Codegraph @

texmf-dist/doc/latex/wordle/wordle-doc-en.tex

raw
1 % !TeX TS-program = pdflatex
2
3 \documentclass[svgnames]{report}
4 \usepackage{wordle}
5 \usepackage{manfnt}
6 \usepackage{enumitem}
7 \setlist[description]{font=\sffamily\bfseries\color{ForestGreen},labelwidth=\textwidth}
8 \usepackage{booktabs}
9 \usepackage[a4paper,margin=18mm]{geometry}
10 \synctex=1
11 \parindent=0pt
12 \parskip=2mm
13
14 \usepackage{cmap} % fix search and cut-and-paste in Acrobat
15 \setcounter{secnumdepth}{0}
16
17 \usepackage{listings}\lstset{language=[LaTeX]TeX,framerule=2pt}
18 \lstset{language=[LaTeX]TeX,
19 texcsstyle=*\bfseries\color{Peru},
20 backgroundcolor=\color{Ivory},
21 numbers=none,
22 breaklines=true,
23 keywordstyle=\color{Sienna},
24 commentstyle=\color{BurlyWood},
25 tabsize=2,
26 morekeywords={Wordle,wordle,GrilleSutom},
27 resetmargins=true,
28 }
29 % hyperref links to ctan
30 \newcommand\ctan[1]{\href{https://www.ctan.org/pkg/#1}{\texttt{#1}}}
31
32 \newcommand\Section[1]{\subsection{\textcolor{DarkGreen}{#1}}}
33
34 \ExplSyntaxOn
35 \NewDocumentCommand\option{ omo }{%
36 \IfNoValueTF{#1}{\textsf{#2}}
37 {%
38 \textbf{\textcolor{Crimson}{#2}}
39 \str_if_empty:nF {#1}{~(default:~\textcolor{DarkRed}{#1})}%
40 \IfNoValueF{#3}{\hfill\textcolor{Gray}{[accepts:~#3]}}%
41 }%
42 \index{#2}%
43 }
44 \ExplSyntaxOff
45
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 \usepackage{imakeidx}
48 \indexsetup{level=\section*, toclevel=section, noclearpage}
49 \makeindex[intoc,columns=3]
50
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 \usepackage[skins,listings]{tcolorbox}
53 \usetikzlibrary{backgrounds, shapes.geometric} % for tikz={framed,...}
54
55 \DeclareTotalTCBox\keyword{ O{} v }{
56 fontupper=\sffamily,
57 nobeforeafter,
58 skin=tile,
59 verbatim,
60 on line,
61 tcbox raise base,
62 top=0pt,bottom=0pt,left=0mm,right=0mm,
63 colback=OldLace,
64 colupper=ForestGreen,
65 #1}
66 {#2}
67
68 \lstdefinestyle{tikz}{style=tcblatex,
69 classoffset=0,
70 texcsstyle=*\color{DarkGoldenrod},%
71 deletetexcs={begin, end},
72 moretexcs={,%
73 node,
74 draw,
75 true,
76 false
77 },%
78 classoffset=1,
79 keywordstyle=\color{ForestGreen},%
80 morekeywords={wordle,GrilleSutom},
81 classoffset=2,
82 keywordstyle=\color{Crimson},%
83 morekeywords={
84 absent,
85 align,
86 border,
87 borders,
88 case,
89 color,
90 colors,
91 colour,
92 colours,
93 correct,
94 empty,
95 font,
96 frame,
97 frames,
98 letters,
99 lower,
100 name,
101 natural,
102 noalign,
103 noletters,
104 params,
105 present,
106 rounded,
107 rows,
108 scale,
109 sensitive,
110 separation,
111 shape,
112 shapes,
113 size,
114 strict,
115 style,
116 style,
117 text,
118 thickness,
119 tikz,
120 tile,
121 upper,
122 },
123 classoffset=3,
124 keywordstyle=\color{DarkOrange},%
125 morekeywords={
126 hard,
127 standard,
128 sutom,
129 }
130 }
131
132 \DeclareTCBListing{example}{ !O{} }{%
133 skin=bicolor,
134 colframe=MediumSeaGreen,
135 colbacklower=OldLace,
136 colback=LawnGreen!20,
137 lefthand width=50mm,
138 listing style=tikz,
139 sidebyside,
140 sidebyside align=center,
141 sidebyside gap=4mm,
142 text and listing,
143 text outside listing,
144 boxsep = 0pt,
145 #1
146 }
147
148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
149
150
151 \makeatletter
152 \author{Andrew Mathas and Cédric Pierquet}
153 \usepackage{tikz}
154 \usetikzlibrary{shadows.blur}
155 \tikzset{shadowed/.style={blur shadow={shadow blur steps=5},
156 bottom color=ForestGreen!30,
157 draw=MediumSeaGreen!70,
158 shade,
159 font=\normalfont\Huge\bfseries\scshape,
160 rounded corners=8pt,
161 top color=SeaGreen,
162 },
163 boxes/.style={draw=SeaGreen,
164 fill=Cornsilk,
165 font=\sffamily\small,
166 inner sep=5pt,
167 rectangle,
168 rounded corners=8pt,
169 text=DarkGreen,
170 }
171 }
172 \newcommand\Wordle{%
173 \begin{tikzpicture}[remember picture,overlay]
174 \node[yshift=-3cm] at (current page.north west)
175 {\begin{tikzpicture}[remember picture, overlay]
176 \draw[shadowed](30mm,0) rectangle node[white]{wordle} (\paperwidth-30mm,16mm);
177 \node[anchor=west,boxes] at (4cm,0cm) {\@author};
178 \node[anchor=east,boxes] at (\paperwidth-4cm,0) {Version \wordle@version};
179 \end{tikzpicture}
180 };
181 \end{tikzpicture}
182 \vspace*{20mm}
183 }
184
185 \def\@oddfoot{\textsc{Wordle} --- \wordle@version~(released~\wordle@release)\hfill\thepage}
186
187 \usepackage[colorlinks=true,linkcolor=blue,urlcolor=MediumBlue]{hyperref}
188 \hypersetup{
189 pdfcreator={ Generated by pdfLaTeX },
190 pdfinfo={
191 Author ={ Andrew Mathas and Cédric Pierquet},
192 Keywords={ wordle },
193 License ={ LaTeX Project Public License v1.3c or later },
194 Subject ={ LaTeXing Wordle puzzles },
195 Title ={ Wordle - \wordle@version }
196 },
197 }
198 \makeatother
199
200 \begin{document}
201
202 \Wordle
203
204 This package provides a stupidly feature-rich way of creating
205 \keyword{Wordle} puzzles in \LaTeX, which
206 \href{https://en.wikipedia.org/wiki/Wordle}{Wikipedia} describes as a
207 hugely popular web-based word game created and developed by Welsh
208 software engineer Josh Wardle. This package is an enhanced version of
209 one of the solutions to a question asked by \textcolor{FireBrick}{valerio\_new}
210 on
211 \href{https://tex.stackexchange.com/questions/659860/wordle-like-colored-letter-boxes-in-latex/660056#660056}{tex.stackexchange.com}.
212
213 This package provides the \keyword{wordle} environment, which uses the
214 syntax:
215
216 \begin{tcblisting}{
217 listing only,
218 skin=bicolor,
219 colframe=MediumSeaGreen,
220 colbacklower=OldLace,
221 colback=LawnGreen!20,
222 listing style=tikz,
223 boxsep = 0pt,
224 }
225 % \usepackage{wordle}
226 \begin{wordle}[wordle settings]{solution}[optional tikz commands]
227 guess1 guess2 ...
228 \end{wordle}
229 \end{tcblisting}
230 \index{environment!wordle}
231 \index{wordle}
232
233 and the \keyword{GrilleSutom} environment, for \keyword{Sutom}, the French version of
234 the games:
235
236 \begin{tcblisting}{
237 listing only,
238 skin=bicolor,
239 colframe=MediumSeaGreen,
240 colbacklower=OldLace,
241 colback=LawnGreen!20,
242 listing style=tikz,
243 boxsep = 0pt,
244 }
245 % \usepackage{wordle}
246 \begin{GrilleSutom}[sutom settings]{solution}[optional TikZ commands]
247 guess1 guess2 ...
248 \end{GrilleSutom}
249 \end{tcblisting}
250 \index{environment!GrilleSutom}
251 \index{GrilleSutom}
252 \index{sutom}
253
254 The words in the puzzle can be entered on a single lines, or on separate
255 lines. Here are some examples:
256
257 \begin{example}
258 \begin{wordle}{ANVIL}
259 % English version of sutom (wordle)
260 CRANE
261 NATAL
262 ANVIL
263 \end{wordle}
264 \end{example}
265
266 \begin{example}
267 % French version of wordle (sutom)
268 \begin{GrilleSutom}{REBUS}
269 ABRIS
270 ROUTE
271 REBUS
272 \end{GrilleSutom}
273 \end{example}
274
275 As in the online puzzles, the \keyword{wordle} environment
276 automatically colours the letter tiles
277 \keyword[colback=WordleCorrect,colupper=White]{green}
278 when the letter is in the same position as the solution, and as
279 \keyword[colback=WordlePresent,colupper=White]{gold} when
280 the letter is in the solution but it is not in the correct position.
281 Similarly, \keyword{GrilleSutom} colours the correct letters
282 \keyword[colback=WordleSutomCorrect,colupper=White]{red}
283 and the present letters
284 \keyword[colback=WordleSutomPresent,colupper=White]{gold}.
285 As described below, these colours can be changed to suit your tastes.
286
287 The number of letters in the puzzle is determined by the solution,
288 being constrained only by the page width.
289
290 \begin{example}
291 \begin{wordle}[rows=4]{orange}
292 normal
293 orders
294 orange
295 \end{wordle}
296 \end{example}
297
298 The letters in the puzzle can be entered in upper case, lower case, or
299 mixed case. By default, the case of the letters is ignored when
300 determining the colours of the letter tiles.
301
302 As described below, the \keyword{wordle} and \keyword{GrilleSutom}
303 environments accept an array of different options that change the
304 colours, fonts, and shapes of the tile. In addition, you can the case
305 sensitivity of the environments, add extra rows to the puzzle, disable
306 special formatting of the \textit{letter tiles}. These options are
307 given as a comma separated list key-value pairs. They can be set
308 locally, using the optional argument of the \keyword|wordle|
309 environment, or they can be set globally (more accurately, in the
310 current \LaTeX\ group) using the \keyword{\WordleSetup} command
311 \index{\textbackslash WordleSetup}, or as global package options, via
312 \keyword{\usepackage[options]{wordle}}. The order of the options does
313 not matter, except that later options take precedence over earlier
314 ones, with the exception of \option{tikz} and \option{tile style} keys
315 which are always applied last.
316
317 The \keyword{wordle} puzzles are drawn using \ctan{TikZ}, with each
318 letter in the puzzle sitting inside a \ctan{TikZ} node. Many of the
319 options control the settings of these nodes.
320
321 The descriptions of the options below are grouped according to their
322 function.
323
324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
325 \Section{Wordle styles}
326
327 The \option{style} key can be used to change many characteristics of
328 the tiles in a \keyword{wordle} puzzle, including their colours, the
329 fonts and so on. The more common settings can be setting using the
330 \option{style} keyword. \textit{The style should always be set first
331 because, otherwise, the style settings may override earlier settings.}
332
333 The following styles are supported:
334
335 \textcolor{DarkOrange}{sutom}
336 \index{style!sutom}
337 \index{sutom}
338
339 \begin{example}
340 \begin{wordle}[style=sutom]{ANVIL}
341 CRANE
342 NATAL
343 ANVIL
344 \end{wordle}
345 \end{example}
346
347 The \textcolor{DarkOrange}{sutom} style is the default
348 style for the \keyword{GrilleSutom} environment.
349
350 \textcolor{DarkOrange}{standard}
351 \index{style!standard}
352
353 \begin{example}
354 \begin{wordle}[style=standard]{ANVIL}
355 CRANE
356 NATAL
357 ANVIL
358 \end{wordle}
359 \end{example}
360
361 The \textcolor{DarkOrange}{standard} style is the default style for the
362 \keyword{wordle} environment.
363
364 \textcolor{DarkOrange}{hard}
365 \index{style!hard}
366
367 \begin{example}
368 \begin{wordle}[style=hard]{ANVIL}
369 CRANE
370 NATAL
371 ANVIL
372 \end{wordle}
373 \end{example}
374
375 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
376 \Section{Options for the individual styles of the letter tiles}
377
378 There are four types of letter tiles in \keyword{wordle}:
379 \option{absent}, \option{present}, \option{correct} and
380 \option{empty}, corresponding to letters not in the solution,
381 incorrectly placed letters, correctly placed letters, and empty
382 tiles, respectively. The options in this section can be used to set
383 the text, tile and border colours, shapes, and frames of these tiles.
384
385 The letter tiles in a \keyword{wordle} environment are typeset inside
386 a \ctan{TikZ} \keyword{\node}. The options below control the different
387 style settings of these nodes.
388
389 \option[--]{colours}[comma separated list of valid colours]
390
391 The \option{colours} option is a short-hand for specifying the colours
392 of the \option{absent}, \option{present}, \option{correct} and
393 \option{empty} tiles, in that order. Later colours can be omitted but
394 the colours should be given in this order, from left to right.
395 If only one colour is given then this colour is applied to all tiles.
396
397 \begin{example}
398 \begin{wordle}[colours={LightGray,Orange,Teal}]{cellar}
399 pounds
400 taylor
401 cellar
402 \end{wordle}
403 \end{example}
404
405 The colours can also be set individually using \option{absent colour},
406 \option{present colour}, \option{correct colour} and \option{empty
407 colour}. To support north American dialects, is also possible to use
408 \option{colors}, \option{absent color}, \option{present color},
409 \option{correct color} and \option{empty color}.
410
411 \begin{example}
412 \begin{wordle}[absent colour=DarkGray,present color=Salmon,
413 correct color=SeaGreen]{cellar}
414 pounds
415 taylor
416 cellar
417 \end{wordle}
418 \end{example}
419
420 \option[white]{borders}[comma separated list of valid colours]
421
422 Similar to the \option{colours} option, this is a short-hand for the
423 setting border colour of the \option{absent}, \option{present},
424 \option{correct} and \option{empty} tiles, in that order.
425 If only one colour is given then this colour is applied to all tiles.
426
427 \begin{example}
428 \begin{wordle}[borders={red, orange,blue}]{ANVIL}
429 CRANE
430 NATAL
431 ANVIL
432 \end{wordle}
433 \end{example}
434
435 You can set the border borders of the individual tiles using
436 \option{absent border}, \option{present border}, \option{correct
437 border} and \option{empty border}
438
439 \option[false]{frames}[comma separated list of true/false]
440
441 This is a short-hand for adding a rectangular frame around the
442 \option{absent}, \option{present}, \option{correct} and \option{empty}
443 tiles, in that order, with the same background colour as the
444 \option{absent} file. This is only useful for non-square tiles.
445
446 \begin{example}
447 \begin{wordle}[frames={false,true,true}, shapes=circle]{ANVIL}
448 CRANE
449 NATAL
450 ANVIL
451 \end{wordle}
452 \end{example}
453
454 You can set the frames of the individual tiles using
455 \option{absent frame}, \option{present frame},
456 \option{correct frame} and \option{empty~frame}.
457
458 \option[rectangle]{shapes}[comma separated list of TikZ shapes]
459
460 Similar to the \option{colours} option, this is a short-hand for the
461 setting shape colour of the \option{absent}, \option{present},
462 \option{correct} and \option{empty} tiles, in that order.
463
464 \begin{example}
465 \begin{wordle}[shapes={circle, rectangle, circle}]{ANVIL}
466 CRANE
467 NATAL
468 ANVIL
469 \end{wordle}
470 \end{example}
471
472 You can set the shape shapes of the individual tiles using
473 \option{absent shape}, \option{present shape},
474 \option{correct shape} and \option{empty shape}
475 You can use the shapes provided by the \ctan{TikZ}
476 \texttt{shapes.geometric} package, including \texttt{diamond},
477 \texttt{ellipse}, \texttt{trapezium} and \texttt{star}; see
478 section~71.2 of the \ctan{TikZ} manual.
479
480 \begin{example}
481 % \usepackage{shapes.geometric}
482 \begin{wordle}[shapes={diamond, ellipse, star}]{LADLE}
483 FLAIL
484 LAPEL
485 *
486 LADLE
487 LOVER
488 \end{wordle}
489 \end{example}
490
491 \option[white]{text}[comma separated list of valid colours]
492
493 This is a short-hand for the setting the text colours of the
494 \option{absent}, \option{present}, \option{correct} and \option{empty}
495 tiles, in that order.
496
497 \begin{example}
498 \begin{wordle}[text={red, orange,blue}]{ANVIL}
499 CRANE
500 NATAL
501 ANVIL
502 \end{wordle}
503 \end{example}
504
505 You can set the text borders of the individual tiles using
506 \option{absent text}, \option{present border}, \option{correct
507 text} and \option{empty border}
508
509
510 \Section{Common tile characteristics}
511
512 The following options apply to all tiles.
513
514 \option[]{noalign} (default) \qquad
515 \option[]{align}
516
517 The options tweak the vertical alignment of the letters in each row of
518 the puzzle. This is only likely to be useful if you have lower case
519 letters in your puzzle.
520
521 \begin{example}
522 \begin{wordle}[align]{agony}
523 groan
524 angry
525 agony
526 \end{wordle}
527 \end{example}
528
529 \begin{example}
530 \begin{wordle}[noalign]{agony} % the default
531 groan
532 angry
533 agony
534 \end{wordle}
535 \end{example}
536
537 \option[\textbackslash Large\textbackslash bfseries\textbackslash sffamily]{font}
538 [LaTeX font specification]
539
540 Sets the font used by all \keyword{wordle} letters. Any valid sequence
541 of \LaTeX\ font commands can be used.
542
543 \begin{example}
544 \begin{wordle}[font=\large\sffamily]{ANVIL}
545 CRANE
546 NATAL
547 ANVIL
548 \end{wordle}
549 \end{example}
550
551 \option[1mm]{rounded}[a length]
552
553 Set TikZ \texttt{rounded corners} key for the \keyword{wordle} letter tiles.
554
555 \begin{example}
556 \begin{wordle}[rounded=2mm]{ANVIL}
557 CRANE
558 NATAL
559 ANVIL
560 \end{wordle}
561 \end{example}
562
563 \option[0.5mm]{separation}[a length]
564
565 Sets the separation distance between the \keyword{wordle} letter
566 tiles.
567
568 \begin{example}
569 \begin{wordle}[separation=2mm, borders=black]{ANVIL}
570 CRANE
571 NATAL
572 ANVIL
573 \end{wordle}
574 \end{example}
575
576 \option[1]{scale}[a number]
577
578 The \option{scale} option rescales the \keyword{wordle} environment.
579 The \option{scale} alters the dimensions sets by the \option{rounded},
580 \option{separation} \option{size} and \option{thickness} options. If
581 you change the scale, then you will almost certainly want
582 to change font size font as well, which you can do using the
583 \option{font} option:
584
585 \begin{example}
586 \begin{wordle}[scale=1.5, font=\huge\bfseries]{SIZE}
587 HELP
588 WISE
589 SIZE
590 \end{wordle}
591 \end{example}
592
593 \option[8mm]{size}[a length]
594
595 The \option{size} option sets the size of the \keyword{wordle} letter
596 tiles. Unlike the \option{scale} option, \option{size} only changes
597 the dimensions of the letter tiles.
598
599 \begin{example}
600 \begin{wordle}[size=10mm, font=\huge\bfseries]{LADLE}
601 FLAIL LAPEL * LADLE
602 \end{wordle}
603 \end{example}
604
605 \option[0.25mm]{thickness}[a length]
606
607 Sets the border thickness of the \keyword{wordle} letter tiles. By
608 default, the borders of the tiles are white, which makes this setting
609 hard to see, so the following example changes the border to red.
610
611 \begin{example}
612 \begin{wordle}[thickness=1mm, borders=red]{LADLE}
613 FLAIL
614 LAPEL
615 LADLE
616 \end{wordle}
617 \end{example}
618
619 \option[--]{tile style}[comma separated list of TikZ style keys]
620
621 A comma-separated list of \ctan{Tikz} node keys that are appended to
622 the style of the \ctan{TikZ} node that contains each of the
623 \keyword{wordle} letters. Some of the options given above can be set
624 directly using the \option{tile style} option. When using the
625 \option{tile style}, be careful not to break the special formatting of
626 letters provided by the \keyword{wordle} environment.\par
627
628 With most of the \keyword{wordle} options, the latter options take
629 precedence, however, the \option{tile style} option is applied last,
630 so it overrides any competing options.
631
632 % TODO: Fix this because it looks like this style is being applied
633 % twice because the PDF file shows a rotation of 90 = 2*45...
634 \begin{example}
635 \begin{wordle}[tile style={rotate=45}]{ANVIL}
636 CRANE
637 NATAL
638 ANVIL
639 \end{wordle}
640 \end{example}
641
642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
643 \Section{Extra rows and columns}
644
645 By default, all of the words in a \keyword{wordle} puzzle are assumed
646 to have the same number of letters as the solution, and the number of
647 rows in the puzzle is number of words given in the environment. The
648 options below give more control over the number of rows and columns in
649 the puzzle.
650
651 \option[]{letters} (default)\qquad
652 \option[]{noletters}
653
654 By default, the letters in the puzzle are printed. You can hide the
655 letters from the puzzle, while still keeping the \keyword{wordle} tile
656 colouring, using \option{noletters}.
657
658 \begin{example}
659 \begin{wordle}[letters]{CRAZE} % the default
660 TRACE
661 CREAM
662 CRAZE
663 \end{wordle}
664 \end{example}
665
666 \begin{example}
667 \begin{wordle}[noletters]{CRAZE}
668 TRACE
669 CREAM
670 CRAZE
671 \end{wordle}
672 \end{example}
673
674 \option[false]{strict}[true/false/--]
675
676 By default, the \keyword{wordle} environment does not check that each
677 word in the puzzle has the same length as the solution, so missing
678 and extra letters receive no special processing.
679
680 \begin{example}
681 \begin{wordle}[strict=false]{CRAZE} % the default
682 GRAIL
683 CRAMPS
684 CRAM
685 CRABS
686 \end{wordle}
687 \end{example}
688
689 The \option{strict} option enforces the word length in the puzzle by
690 marking missing letters as incorrect and striking out extra letters.
691
692 \begin{example}
693 \begin{wordle}[strict]{CRAZE}
694 GRAIL
695 CRAMPS
696 CRAM
697 CRABS
698 \end{wordle}
699 \end{example}
700
701 \option[--]{rows}
702
703 By default, a \keyword{wordle} environment displays the words
704 in the puzzle environment with one word per row. You can add extra
705 (blank) rows to the puzzle with the \option{rows} option.
706
707 \begin{example}
708 \begin{wordle}[rows=4]{ANVIL}
709 CRANE
710 NATAL
711 ANVIL
712 \end{wordle}
713 \end{example}
714
715 The \option{rows} option only adds extra rows to the puzzle if they
716 are needed. This option does not prevent ``extra'' rows from
717 appearing.
718
719 \begin{example}
720 \begin{wordle}[rows=2]{ANVIL}
721 CRANE
722 NATAL
723 ANVIL
724 \end{wordle}
725 \end{example}
726
727
728 \option[]{*}
729
730 You can disable the special colouring of letter tiles in a
731 \keyword{wordle} puzzle by adding an asterisk,~\option{*}, as a
732 \textit{word}, into the puzzle.
733
734 \begin{example}
735 \begin{wordle}{ANVIL}
736 CRANE
737 NATAL
738 * % disable wordle colouring
739 ANNUL
740 ANVIL
741 \end{wordle}
742 \end{example}
743
744
745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
746 \Section{Case sensitivity}
747 \index{case~sensitive}
748 \index{case~sensitive!lower case}
749 \index{case~sensitive!natural case}
750 \index{case~sensitive!upper case}
751
752 By default, the letters are printed in upper and lower case, exactly
753 as typed, and the letter comparisons are not case sensitive.
754
755 \option[false]{case~sensitive}
756
757 By default the \keyword{wordle} puzzles are not case sensitive, but
758 you can make them case sensitive using this option. Note that
759 \keyword{case sensitive} is the same as \keyword{case sensitive=true}
760 (and the default option is the same as
761 \keyword{case sensitive=false}).
762
763 \begin{example}
764 \begin{wordle}[case sensitive=false]{youth} % the default
765 North
766 South
767 Youth
768 \end{wordle}
769 \end{example}
770
771 Here is a case sensitive version of this puzzle.
772
773 \begin{example}
774 \begin{wordle}[case sensitive]{youth}
775 North
776 South
777 Youth
778 \end{wordle}
779 \end{example}
780
781 As this puzzle is case sensitive, the \keyword{Y} on the last line is
782 not marked as being correct because it does not match the \keyword{y}
783 in the solution.
784
785 \option[]{natural case} (default) \qquad
786 \option[]{lower case} \qquad
787 \option[]{upper case}
788
789 The \option{lower case} and \option{upper case} options force all
790 letters in the puzzle to be in lower or upper case, respectively.
791
792 \begin{example}
793 \begin{wordle}[lower case]{YOUTH}
794 North
795 South
796 Youth
797 \end{wordle}
798 \end{example}
799
800 \begin{example}
801 \begin{wordle}[upper case]{youth}
802 North
803 South
804 Youth
805 \end{wordle}
806 \end{example}
807
808 As these examples show, both of these options disable the case
809 sensitivity of the tests for colouring the \keyword{wordle} tiles;
810 that is, they set \option{case sensitive=false}. To balance the
811 \option{lower case} and \option{upper case} options, the
812 \option{natural case} option makes the \keyword{wordle} environment
813 restores the default behaviour, which respects the case of the letters
814 as typed into the environment. The \option{natural case} option does
815 not change the \option{case sensitive} setting.
816
817 \begin{example}
818 \begin{wordle}[natural case]{youth} % the default
819 North
820 South
821 youth
822 \end{wordle}
823 \end{example}
824
825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
826 \Section{Adding \ctan{TikZ} code}
827
828 The \keyword{wordle} environment is a fancy wrapper around a
829 \keyword{tikzpicture} environment, with some code under the hood that
830 automatically colours the letter tiles according to how well they
831 match the solution. The options in this section describe how to access
832 the underlying \ctan{TikZ} layer.
833
834 \option[]{tikz}[TikZ commands]
835
836 The \option{tikz} option passes \ctan{TikZ} keys to the underlying
837 \keyword{tikzpicture} environment. The \option{tikz} option is almost
838 the same as using a \keyword{\tikzset{...}} command before the
839 \keyword{wordle} environment except that it is applied to the
840 \keyword{tikpicture} environment, which contains the \keyword{wordle}
841 puzzle, such that the \option{tikz} keys are applied \textit{after}
842 all of options above and \textit{before} \option{tile style} is
843 applied.
844
845 \begin{example}
846 % \usetikzlibrary{backgrounds}
847 \begin{wordle}[
848 tikz={framed,
849 background rectangle/.style={
850 double,ultra thick, draw=SteelBlue
851 }
852 }]{youth}
853 North South youth
854 \end{wordle}
855 \end{example}
856
857 As this example indicates, it is advisable to enclose complicated
858 \ctan{TikZ} settings inside braces.
859
860 \option[W]{name}
861
862 All of the tiles in a \keyword{wordle} puzzle are given node names of
863 the form $\langle$\textsf{name}$\rangle$-$\mathsf{r}$-$\mathsf{c}$,
864 for the tile in row~$\mathsf{r}$ and column~$\mathsf{c}$. By default,
865 the prefix \textsf{name} is \texttt{W}. Within reason, the
866 \option{name} prefix can be changed to anything you like using the
867 \option{name} option.
868
869 One way to use the named nodes for the letter tiles is with
870 \ctan{TikZ} \texttt{overlay} and \texttt{remember picture} keys:
871
872 \begin{example}
873 \begin{wordle}[tikz={remember picture}]{CRAZE}
874 TRACE
875 CREAM
876 CRAZE
877 \end{wordle}
878 \end{example}
879
880 This makes it possible, for example, to draw arrows to tiles in a
881 \keyword{wordle} puzzle:
882
883 \begin{example}
884 \tikz[remember picture]\draw[overlay, very thick, opacity=0.5,->,red](0,0)node{No M!} to [out=90, in=180](W-2-5);
885 \end{example}
886
887 A second use of the tile node names is in conjunction with \ctan{TikZ}
888 commands that can be added to a \keyword{wordle} puzzle using the
889 second optional argument to the environment. As with the \option{tikz}
890 option, it is advisable to enclose complicated \ctan{TikZ} commands
891 inside braces.
892
893 \begin{example}
894 \begin{wordle}[name=M,
895 tikz={arr/.style={Red,ultra thick,->}}
896 ]{MACAW}
897 [{
898 \draw[arr](M-1-3.south)--(M-3-2.north)--(M-4-2.north);
899 \draw[arr](M-1-1.south)--(M-3-5)--(M-4-3.north east);
900 }]
901 CRANE HOTLY BASIC MACAW
902 \end{wordle}
903 \end{example}
904
905 In practice, we are not convinced that anyone will find a real use for this!
906
907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
908 \Section{The package code}
909
910 The \keyword{wordle} package is a \LaTeX3 package. There are many
911 comments in the code explaining how the code works. The automatic
912 colouring of the letter tiles is a fun exercise in \LaTeX3
913 programming, which was motivated by a
914 \href{https://tex.stackexchange.com/questions/659860/wordle-like-colored-letter-boxes-in-latex/660056#660056}{tex.stackexchange.com} post.
915
916 Bug reports and feature requests can be made on \href{https://github.com/AndrewMathas/Wordle}{github}.
917
918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
919 \printindex
920
921 \end{document}