Debian Codegraph @

texmf-dist/doc/latex/tikzducks/tikzducks-doc.tex

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % Documentation for the tikzducks package
4 % A package to bring rubber ducks into tikz
5 % Maintained by samcarter
6 %
7 % Project repository and bug tracker:
8 % https://github.com/samcarter/tikzducks
9 %
10 % Released under the LaTeX Project Public License v1.3c or later
11 % See https://www.latex-project.org/lppl.txt
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 % arara: latexmk
15 \documentclass{scrartcl}
16
17 \usepackage[
18 themecolor=samlblue
19 ]{\jobname-settings}
20
21 % meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22 \title{The \texorpdfstring{\tikzducks}{tikzducks} package}
23 \subtitle{using ducks in \TikZ}
24 \author{%
25 \texorpdfstring{
26 \begin{tikzpicture}
27 \duck
28 \end{tikzpicture}\\[0.8em]
29 \texttt{samcarter}\\
30 \url{https://github.com/samcarter/tikzducks}\\
31 \url{https://ctan.org/pkg/tikzducks}
32 }{samcarter}}
33 \date{Version v2.2 \textendash{} 2025/12/11}
34 \packagename{tikzducks}
35
36 \colorlet{blue}{samlblue}
37 \colorlet{red}{samred}
38
39 % packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 \usepackage{tikzducks}
41 \usetikzlibrary{ducks,3d}
42 \usepackage{marvosym}
43 \usepackage{fontawesome}
44
45 % customisation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 \pgfmathsetseed{2}
47 \setlength{\footheight}{45pt}
48 \newlength{\duckoffset}
49
50 \cfoot{%
51 \begin{tikzpicture}[scale=0.5]
52 \duck[signpost=\scalebox{0.6}{\thepage},randomhead]
53 \end{tikzpicture}
54 }
55 \pagestyle{scrheadings}
56
57 \tcbset{%
58 tikz lower,
59 height plus=3cm,
60 }
61
62 \begin{document}
63 \maketitle
64 \thispagestyle{scrheadings}
65
66 \section{Introduc(k)tion}
67 \label{intro}
68
69 Rubber ducks can be made of latex, but can they also be made with \LaTeX? Yes! The \tikzducks package is a \LaTeX{} package for rubber ducks to be used in \TikZ pictures.
70 This project is a continuation of \href{https://tex.stackexchange.com/a/347458/36296}{How can we draw a duck?}.
71
72 Without the friendly and helpful community of \TeX{} users this package would not exist. A big thanks to all the users and contributors of this package!
73
74 \blurb
75
76 The shown example ducks are purely fictional characters, any resemblance to real ducks or persons is purely coincidental and no copyright infringement is intended.
77
78 \clearpage
79 \section{Usage}
80
81 The basic usage is fairly simple. Inside of a \saminline|tikzpicture|, one can draw a duck like this:
82 \begin{tcblisting}{title={Basic duck}}
83 \duck
84 \end{tcblisting}
85
86 To customise this basic duck, the package uses \saminline|pgf| keys. For almost all parts the colour can be changed using \saminline|<shape name>=<colour name>|. For example to change the colour of the duck:
87 \begin{tcblisting}{title={Blue duck}}
88 \duck[
89 body=blue
90 ]
91 \end{tcblisting}
92
93 If the keyword consists of multiples words, it works both with and without spaces. In the following usually the version without spaces is given.
94
95 In addition to the keys defined in this package, all usual \TikZ and \saminline|pgf| keys can also be used. For example if the size of the ducks should be changed or shifted:
96
97 \begin{tcblisting}{title={Scaled duck and \emph{The Ugly Duckling}}, righthand width=4cm}
98 \duck
99
100 \duck[
101 shift={(2.5,1)},
102 scale=.3,
103 ]
104
105 \duck[
106 shift={(3.3,1.5)},
107 scale=.3,
108 ]
109
110 \duck[
111 body=lightgray,
112 shift={(3,0.5)},
113 scale=.3,
114 ]
115 \end{tcblisting}
116
117 To make the usage easier for the \TikZ-savvy users, Andrew Stacey contributed a \TikZ library. It can be loaded with \saminline|\usetikzlibrary{ducks}|. In addition to the normal functionality of the \tikzducks package, the ducks are now also available as \saminline|pic|. A short example:
118 \begin{tcolorbox}[title={\TikZ library ``ducks''}]
119 \begin{samcode}
120 \documentclass{standalone}
121
122 \usepackage{tikz}
123 \usetikzlibrary{ducks}
124
125 \begin{document}
126
127 \begin{tikzpicture}
128 \draw (0,0) pic[
129 duck/water=blue,
130 duck/alien,
131 ] {duck};
132 \draw (4,0) pic[
133 scale=1.4,
134 ] {duck};
135 \end{tikzpicture}
136
137 \end{document}
138 \end{samcode}
139
140 \tcblower
141 \begin{tikzpicture}
142 \draw (0,0) pic[
143 duck/water=blue,
144 duck/alien=samdgreen,
145 ] {duck};
146 \draw (2,1) pic[
147 scale=1.4,
148 ] {duck};
149 \end{tikzpicture}
150 \end{tcolorbox}
151
152 For everybody suffering from anatidaephobia, there is also a special option to not draw the duck:
153 \begin{tcblisting}{title={Invisible duck}}
154 \duck[
155 invisible
156 ]
157 \end{tcblisting}
158
159 This can also be useful to recycle some of the accessories presented in \ref{sec:accessories}.
160
161 For the purists, there is also a picture mode variant:
162 {
163 \setlength{\unitlength}{0.6mm}
164 \begin{tcolorbox}[title={\texttt{picture} mode duck},height=3.5cm,valign=center]
165 \begin{samcode}
166 \begin{picture}(42,44)
167 \picduck
168 \end{picture}
169 \end{samcode}
170 \tcblower
171 \raisebox{-1.3cm}{%
172 \begin{picture}(42,44)
173 \picduck
174 \end{picture}
175 }
176 \end{tcolorbox}
177 }
178
179 \subsection{Body parts}
180
181 The various parts of the duck can also be coloured independently, i.e.\ \saminline|body|, \saminline|head| or \saminline|bill|:
182
183 \begin{tcblisting}{title={Crazy colour duck}}
184 \duck[
185 body=yellow,
186 head=yellow!50!orange,
187 bill=red,
188 eye=green
189 ]
190 \end{tcblisting}
191
192 Furthermore using the keywords \saminline|grumpy|, \saminline|laughing| or \saminline|parrot| the shape of the bill can be changed:
193
194 \begin{tcblisting}{title={Grumpy duck}}
195 \duck[
196 grumpy
197 ]
198
199 \duck[
200 grumpy,
201 bill=cyan,
202 shift={(2.5,0)}
203 ]
204 \end{tcblisting}
205
206 \begin{tcblisting}{title={Laughing duck}}
207 \duck[
208 laughing
209 ]
210
211 \duck[
212 laughing,
213 bill=red,
214 shift={(2.5,0)}
215 ]
216 \end{tcblisting}
217
218 \begin{tcblisting}{title={Parrot duck}}
219 \duck[
220 parrot
221 ]
222
223 \duck[
224 parrot,
225 bill=blue,
226 shift={(2.5,0)}
227 ]
228 \end{tcblisting}
229
230 \subsection{Hair styles}
231
232 Some duck also like to have nice hair cuts, several different hair styles are available:
233
234 \begin{tcblisting}{title={Long hair duck}}
235 \duck[
236 longhair
237 ]
238 \end{tcblisting}
239
240 \begin{tcblisting}{title={Short hair duck}}
241 \duck[
242 shorthair
243 ]
244 \end{tcblisting}
245
246 \begin{tcblisting}{title={Parting hair duck}}
247 \duck[
248 parting
249 ]
250 \end{tcblisting}
251
252 \begin{tcblisting}{title={Crazy hair duck}}
253 \duck[
254 crazyhair
255 ]
256 \end{tcblisting}
257
258 \begin{tcblisting}{title={Receding hair duck}}
259 \duck[
260 recedinghair
261 ]
262 \end{tcblisting}
263
264 \begin{tcblisting}{title={Mohican duck}}
265 \duck[
266 mohican
267 ]
268 \end{tcblisting}
269
270 \begin{tcblisting}{title={Mullet duck}}
271 \duck[
272 mullet
273 ]
274 \end{tcblisting}
275
276 And of course the colour of each hair style can be adjusted:
277 \begin{tcblisting}{title={Coloured hair duck}}
278 \duck[
279 longhair=teal
280 ]
281 \end{tcblisting}
282
283 Eyebrows and a beard are also part of the package. The colour choice is more tricky for them -- if a colour is explicitly specified (\saminline|eyebrow=<colour name>| or \saminline|beard=<colour name>|) this colour is of course used, but if no colour is given, it first falls back to the hair colour and only if the duck does not have any hairs, the default colour is applied.
284
285 \begin{tcblisting}{title={Eye brow duck}}
286 \duck[
287 eyebrow
288 ]
289
290 \duck[
291 longhair=blue,
292 eyebrow,
293 shift={(2.5,0)}
294 ]
295
296 \duck[
297 crazyhair=red,
298 eyebrow=blue,
299 shift={(1.25,-2.5)}
300 ]
301 \end{tcblisting}
302
303 \begin{tcblisting}{title={Beard duck\footnote{The beard is based on an answer by Mihikma, see \url{https://tex.stackexchange.com/a/401777/36296}}}}
304 \duck[
305 beard=white!80!brown
306 ]
307
308 \duck[
309 recedinghair=white,
310 beard,
311 shift={(2.5,0)}
312 ]
313 \end{tcblisting}
314
315 Please note that not all of the accessories, especially hats, shown in the following sections, will suite every hairstyle. In case the desired combination of hair style and hat does not work well, there is always the possibility to look up the original definition of the hat in the \saminline|tikzducks| source code and recreate it with a more suitable position or size.
316
317 \subsection{Clothing}
318
319 A respectable duck needs a suitable wardrobe. It can choose from several different garments. In it's infinite wardrobe these items are available in all colours definable in the current colour model.
320
321 \begin{tcblisting}{title={T-shirt duck}}
322 \duck[
323 tshirt=red
324 ]
325 \end{tcblisting}
326
327 \begin{tcblisting}{title={Jacket duck}}
328 \duck[
329 jacket=blue
330 ]
331 \end{tcblisting}
332
333 \begin{tcblisting}{title={Tie duck}}
334 \duck[
335 tshirt,
336 jacket=gray,
337 tie
338 ]
339 \end{tcblisting}
340
341 \begin{tcblisting}{title={Bowtie duck}}
342 \duck[
343 tshirt,
344 jacket=gray,
345 bowtie
346 ]
347 \end{tcblisting}
348
349 \begin{tcblisting}{title={Áo dài duck}}
350 \duck[
351 tshirt=cyan,
352 aodai=blue!65!black
353 ]
354 \end{tcblisting}
355
356 \begin{tcblisting}{title={Cape duck}}
357 \duck[
358 cape
359 ]
360 \end{tcblisting}
361
362 For more ways to customise the clothing also have a look at the \hyperref[sec:footballducks]{football ducks in Section \ref{sec:footballducks}}.
363
364 \subsection{Accessories}
365 \label{sec:accessories}
366
367 There is a multitude of things a duck might need. The following examples all also work without specifying a colour, but giving both an example with and one without explicit colour just makes this overview unnecessary long, so only one is given.
368
369 \begin{tcblisting}{title={Swimming duck}}
370 \duck[
371 water=cyan!50!blue
372 ]
373 \end{tcblisting}
374
375 \begin{tcblisting}{title={Alien duck}}
376 \duck[
377 alien=green!50!brown
378 ]
379 \end{tcblisting}
380
381 \begin{tcblisting}{title={Hat duck}}
382 \duck[
383 hat=red!50!black
384 ]
385 \end{tcblisting}
386
387 \begin{tcblisting}{title={Tophat duck}}
388 \duck[
389 tophat=blue!20!black
390 ]
391 \end{tcblisting}
392
393 \begin{tcblisting}{title={Strawhat duck}}
394 \duck[
395 strawhat=brown!50!white,
396 ribbon=gray
397 ]
398 \end{tcblisting}
399
400 \begin{tcblisting}{title={Basecap duck}}
401 \duck[
402 cap=red!80!black
403 ]
404 \end{tcblisting}
405
406 \begin{tcblisting}{title={Conical hat duck}}
407 \duck[
408 conicalhat=brown
409 ]
410 \end{tcblisting}
411
412 \begin{tcblisting}{title={Santa duck}}
413 \duck[
414 santa=red!80!black,
415 beard=white!80!brown
416 ]
417 \end{tcblisting}
418
419 \begin{tcblisting}{title={Graduate duck}}
420 \duck[
421 graduate=gray!20!black,
422 tassel=red!70!black
423 ]
424 \end{tcblisting}
425
426 \begin{tcblisting}{title={Beret duck}}
427 \duck[
428 beret=red!70!black
429 ]
430 \end{tcblisting}
431
432 \begin{tcblisting}{title={Peaked cap duck}}
433 \duck[
434 peakedcap=blue!50!black
435 ]
436 \end{tcblisting}
437
438 \begin{tcblisting}{title={Harlequin duck}}
439 \duck[
440 harlequin=blue,
441 niuqelrah=red
442 ]
443 \end{tcblisting}
444
445 \begin{tcblisting}{title={Sailor duck}}
446 \duck[
447 sailor=white
448 ]
449 \end{tcblisting}
450
451 \begin{tcblisting}{title={Bobble hat duck}}
452 \duck[
453 bobblehat=red!70!red
454 ]
455 \end{tcblisting}
456
457 \begin{tcblisting}{title={Crown duck}}
458 \duck[
459 body=black!75!white,
460 crown=yellow!70!brown
461 ]
462
463 \duck[
464 queencrown=gray,
465 shift={(2.5,0)}
466 ]
467
468 \duck[
469 kingcrown=brown!70!red,
470 shift={(1.25,2.5)}
471 ]
472 \end{tcblisting}
473
474 \begin{tcblisting}{title={Knight duck}}
475 \duck[
476 helmet=gray
477 ]
478 \end{tcblisting}
479
480 \begin{tcblisting}{title={Viking duck}}
481 \duck[
482 viking=gray
483 ]
484 \end{tcblisting}
485
486 \begin{tcblisting}{title={Devil duck}}
487 \duck[
488 devil=red
489 ]
490 \end{tcblisting}
491
492 \begin{tcblisting}{title={Unicorn duck}}
493 \duck[
494 body=pink,
495 unicorn=magenta!60!violet,
496 longhair=magenta!60!violet
497 ]
498 \end{tcblisting}
499
500 \begin{tcblisting}{title={Bunny duck\footnote{Unless an explicit colour is specified, the bunny ears will take the body colour as default colour, the inner parts will be drawn in a lighter shade.}}}
501 \duck[
502 body=white!80!brown,
503 bill=white!60!brown,
504 bunny
505 ]
506
507 \duck[
508 bunny=red,
509 inear=blue,
510 shift={(2.5,0)}
511 ]
512 \end{tcblisting}
513
514 \begin{tcblisting}{title={Sheep duck\footnote{The in-ear colour of the sheep is chosen to be the same as the bill}}}
515 \duck[
516 body=white!80!brown,
517 bill=white!60!brown,
518 sheep
519 ]
520 \end{tcblisting}
521
522 \begin{tcblisting}{title={Horse duck\footnote{If no colour is specified, the horse tail will have the same colour as the hair}}}
523 \duck[
524 body=brown!80!white,
525 longhair=brown!50!black,
526 horsetail
527 ]
528 \end{tcblisting}
529
530 \begin{tcblisting}{title={Witch duck}}
531 \duck[
532 witch=black!50!gray,
533 longhair=red!80!black,
534 jacket=black!50!gray,
535 magicwand
536 ]
537 \end{tcblisting}
538
539 \begin{tcblisting}{title={Magic duck}}
540 \duck[
541 magichat,
542 magicwand
543 ]
544
545 \duck[
546 magichat=teal,
547 magicstars=blue!30!cyan,
548 magicwand,
549 shift={(2.5,0)}
550 ]
551 \end{tcblisting}
552
553 \begin{tcblisting}{title={Sombrero duck\footnote{The sombrero was kindly contributed by Carla Maggi}}}
554 \duck[
555 sombrero=orange!70!yellow,
556 sombreroa=green!70!blue,
557 sombrerob=red,
558 sombreroc=blue
559 ]
560 \end{tcblisting}
561
562 \begin{tcblisting}{title={Glasses duck}}
563 \duck[
564 glasses=red!50!black
565 ]
566
567 \duck[
568 squareglasses=blue!50!black,
569 shift={(2.5,0)}
570 ]
571 \end{tcblisting}
572
573 \begin{tcblisting}{title={Sunglasses duck}}
574 \duck[
575 sunglasses=blue
576 ]
577 \end{tcblisting}
578
579 \begin{tcblisting}{title={Superhero duck}}
580 \duck[
581 mask=teal,
582 cape=teal
583 ]
584 \end{tcblisting}
585
586 \begin{tcblisting}{title={Signpost duck}}
587 \duck[
588 signpost=42
589 ]
590
591 \duck[
592 signpost=\parbox{2cm}{\tiny\color{black}
593 \centering Science\\ first},
594 signcolour=brown!70!gray,
595 signback=white!80!brown,
596 shift={(2.5,0)}
597 ]
598 \end{tcblisting}
599
600 \begin{tcblisting}{title={Speaking duck\footnote{Both the speech and thought bubble are inspired by the wonderful \href{https://www.ctan.org/pkg/ducksay}{ducksay package}}}}
601 \duck[
602 speech={Bla},
603 bubblecolour=cyan!20!white,
604 laughing
605 ]
606 \end{tcblisting}
607
608 \begin{tcblisting}{title={Thinking duck\footnotemark[\thefootnote]}}
609 \duck[
610 think={Blub},
611 bubblecolour=white!95!yellow
612 ]
613 \end{tcblisting}
614
615 \begin{tcblisting}{title={Buttons duck\footnote{In case the duck is wearing a jacket, the buttons are positioned a bit lower}}}
616 \duck[
617 buttons=brown!50!black
618 ]
619
620 \duck[
621 jacket=red,
622 buttons,
623 shift={(2.5,0)}
624 ]
625 \end{tcblisting}
626
627 \begin{tcblisting}{title={Dinner jacket duck}}
628 \duck[
629 jacket=gray,
630 lapel=black,
631 buttons
632 ]
633 \end{tcblisting}
634
635 \begin{tcblisting}{title={Book duck}}
636 \duck[
637 book=\scalebox{0.5}{\TeX}
638 ]
639
640 \duck[
641 book=\scalebox{0.6}{$\pi$},
642 bookcolour=blue!50!black,
643 shift={(2.5,0)}
644 ]
645 \end{tcblisting}
646
647 \begin{tcblisting}{title={Cricket duck}}
648 \duck[
649 cricket=red!50!black
650 ]
651 \end{tcblisting}
652
653 \begin{tcblisting}{title={Football duck\footnote{The football duck is simplified version from an answer by Carla Maggi, \url{https://tex.stackexchange.com/a/387126/36296}}}}
654 \duck[
655 football=white!85!yellow
656 ]
657 \end{tcblisting}
658
659 \begin{tcblisting}{title={Hockey duck}}
660 \duck[
661 hockey=brown!70!black
662 ]
663 \end{tcblisting}
664
665 \begin{tcblisting}{title={Lightsaber duck\footnote{Dedicated to the Counter Wizard (aka Christian Hupfer)}}}
666 \duck[
667 lightsaber=red,
668 darthvader=black!30!gray
669 ]
670 \end{tcblisting}
671
672 \begin{tcblisting}{title={Torch duck}}
673 \duck[
674 torch=black!30!gray
675 ]
676 \end{tcblisting}
677
678 \begin{tcblisting}{title={Prison duck}}
679 \duck[
680 prison=gray
681 ]
682 \end{tcblisting}
683
684 \begin{tcblisting}{title={Shepherd duck}}
685 \duck[
686 crozier=brown!80!black
687 ]
688 \end{tcblisting}
689
690 \begin{tcblisting}{title={Necklace duck}}
691 \duck[
692 necklace=gray!20!white
693 ]
694 \end{tcblisting}
695
696 \begin{tcblisting}{title={Icecream duck}}
697 \duck[
698 icecream
699 ]
700
701 \duck[
702 icecream=brown,
703 flavoura=green!50!brown,
704 flavourb=white,
705 flavourc=red,
706 shift={(2.5,0)}
707 ]
708 \end{tcblisting}
709
710 \begin{tcblisting}{title={Chef duck\footnote{The chef duck is based on an idea by Carla Maggi, please see the following link for a more sophisticated version of the toque and the rolling pin: \url{https://tex.stackexchange.com/a/387126/36296}}}}
711 \duck[
712 chef=white!95!yellow,
713 rollingpin=brown!80!black
714 ]
715 \end{tcblisting}
716
717 \begin{tcblisting}{title={Cake duck}}
718 \duck[
719 cake=red!50!violet!80!black
720 ]
721 \end{tcblisting}
722
723 \begin{tcblisting}{title={Pizza duck}}
724 \duck[
725 pizza
726 ]
727 \end{tcblisting}
728
729 \begin{tcblisting}{title={Baguette duck}}
730 \duck[
731 baguette=brown
732 ]
733 \end{tcblisting}
734
735 \begin{tcblisting}{title={Cheese duck}}
736 \duck[
737 cheese=orange
738 ]
739 \end{tcblisting}
740
741 \begin{tcblisting}{title={Milkshake duck}}
742 \duck[
743 milkshake=red!20!white
744 ]
745 \end{tcblisting}
746
747 \begin{tcblisting}{title={Wine duck\footnote{According to the resident Italian wine expert of the \href{https://chat.stackexchange.com/transcript/message/40103109}{ TeX.SE chatroom}, the duck is drinking a fine Brunello di Montalcino}}}
748 \duck[
749 wine=red!70!black
750 ]
751 \end{tcblisting}
752
753 \begin{tcblisting}{title={Cocktail duck}}
754 \duck[
755 cocktail
756 ]
757 \end{tcblisting}
758
759 \begin{tcblisting}{title={Banana duck\footnote{The banana and the stick were kindly contributed by @NuzzleTOO}}}
760 \duck[
761 banana=yellow!80!orange
762 ]
763 \end{tcblisting}
764
765 \begin{tcblisting}{title={Stick duck\footnotemark[\thefootnote]}}
766 \duck[
767 stick=red!60!green,
768 leaf=green!70!red
769 ]
770 \end{tcblisting}
771
772 \begin{tcblisting}{title={Basket duck\footnote{The basket and Easter basket was kindly contributed by Benito van der Zander}}}
773 \duck[
774 basket=brown
775 ]
776 \end{tcblisting}
777
778 \begin{tcblisting}{title={Easter duck\footnotemark[\thefootnote]}}
779 \duck[
780 bunny,
781 easter
782 ]
783
784 \duck[
785 bunny,
786 easter=brown,
787 egga=cyan,
788 eggb=orange,
789 eggc=teal,
790 shift={(2.5,0)}
791 ]
792 \end{tcblisting}
793
794 \begin{tcblisting}{title={Wing duck}}
795 \duck[
796 wing=yellow!90!brown
797 ]
798 \end{tcblisting}
799
800 \begin{tcblisting}{title={Doctor duck}}
801 \duck[
802 stethoscope=gray!80!black
803 ]
804 \end{tcblisting}
805
806 \begin{tcblisting}{title={Neckerchief duck}}
807 \duck[
808 neckerchief=red!70!black,
809 woggle=blue!60!black
810 ]
811 \end{tcblisting}
812
813 \begin{tcblisting}{title={Winter duck}}
814 \duck[
815 bobblehat=red!70!black,
816 scarf=red!70!black
817 ]
818 \end{tcblisting}
819
820 \begin{tcblisting}{title={Snow duck\footnote{The snowduck is dedicated to all Japanese \TeX\ users}}}
821 \duck[
822 snowduck=white
823 ]
824 \end{tcblisting}
825
826 \begin{tcblisting}{title={Shovelling duck}}
827 \duck[
828 shovel=gray
829 ]
830 \end{tcblisting}
831
832 \begin{tcblisting}{title={Pickaxe duck}}
833 \duck[
834 pickaxe=gray
835 ]
836 \end{tcblisting}
837
838 \begin{tcblisting}{title={Sweeping duck}}
839 \duck[
840 strawbroom=brown!50!white,
841 strawbroomstick=brown,
842 strawbroomribbon=red!50!black
843 ]
844
845 \duck[
846 broom=brown,
847 broomstick=gray!50!black,
848 shift={(2.5,0)}
849 ]
850 \end{tcblisting}
851
852 \begin{tcblisting}{title={Umbrella duck}}
853 \duck[
854 umbrella=cyan
855 ]
856
857 \duck[
858 umbrellaclosed=cyan,
859 shift={(2.5,0)}
860 ]
861 \end{tcblisting}
862
863 \begin{tcblisting}{title={Fortune Quacker\footnote{The crystal ball is kindly contributed by @marmot}}}
864 \duck[
865 crystalball=cyan
866 ]
867 \end{tcblisting}
868
869 \begin{tcblisting}{title={Handbag duck}}
870 \duck[
871 handbag=red!70!black
872 ]
873 \end{tcblisting}
874
875 \begin{tcblisting}{title={Vampire duck}}
876 \duck[
877 vampire=white
878 ]
879
880 \duck[
881 laughing,
882 vampire=white,
883 shift={(2.5,0)}
884 ]
885 \end{tcblisting}
886
887 \begin{tcblisting}{title={Overleaf duck\footnote{added to celebrate that \tikzducks are now also available on overleaf, see \url{https://www.overleaf.com/blog/tex-live-upgrade-september-2019}}}}
888 \duck[
889 overleaf
890 ]
891 \end{tcblisting}
892
893 \begin{tcblisting}{title={Megaphone duck}}
894 \duck[
895 megaphone=lightgray
896 ]
897 \end{tcblisting}
898
899 \begin{tcblisting}{title={Towel duck}}
900 \duck[
901 towel=violet
902 ]
903 \end{tcblisting}
904
905 \begin{tcblisting}{title={Present duck\footnote{The present was kindly contributed by Carla Maggi}}}
906 \duck[
907 present=violet
908 ]
909
910 \duck[
911 present,
912 present top=cyan,
913 present bottom=blue,
914 present ribbon=teal,
915 shift={(2.5,0)}
916 ]
917 \end{tcblisting}
918
919 \clearpage
920 \section{Random ducks}
921 With all these available accessories it might be hard to decide which one to choose, but don't worry the \tikzducks provide a solution for this dilemma, the random duck, or short \saminline|\randuck|, which automatically creates a duck with a randomly chosen accessories and something on top of the head (hair, a hat, ears, alien antenna ...)
922
923 \begin{tcblisting}{title={Random duck}}
924 \randuck
925
926 \randuck[
927 shift={(2.5,0)},
928 scale=0.7
929 ]
930 \end{tcblisting}
931
932 In case the duck should not be completely random, but only some of the random elements are desired, these can be accessed independently by using the \saminline|randomhead| and \saminline|randomaccessories| options for a random headpiece and a random accessories, respectively.
933
934 \begin{tcblisting}{title={Random head gear and accessories}}
935 \duck[
936 randomhead,
937 randomaccessories
938 ]
939 \end{tcblisting}
940
941 \section{Further customisation}
942
943 This package will never be able to do everything every potential user might want to do, as this number quickly approaches $\infty$ -- but as the ducks are simply things inside \saminline|tikzpicture|s, all the heavy weapons of the \TikZ package are available for further customisation.
944
945 \begin{tcblisting}{title={Adding things to the duck}}
946 \duck
947 \fill[blue] (2,0) rectangle (1,1);
948 \end{tcblisting}
949
950 \begin{tcblisting}{title={Monochrome duck}}
951 \selectcolormodel{gray}
952 \duck
953 \end{tcblisting}
954
955 For convenience the more complex paths of this package are stored in macros, which can easily be reused:
956
957 \begin{tcblisting}{title={Redraw parts}}
958 \duck
959 \path[
960 preaction={fill, red!50!black},
961 pattern={Stars[distance=1.7mm,
962 radius=0.5mm,angle=32]},
963 pattern color=yellow
964 ] \duckpathlonghair;
965 \end{tcblisting}
966
967 In detail, the following paths are available:
968
969 \begin{samcode}
970 \duckpathbody, \duckpathgrumpybill, \duckpathbill, \duckpathtshirt,
971 \duckpathjacket,\duckpathcape, \duckpathshorthair, \duckpathlonghair,
972 \duckpathcrazyhair, \duckpathrecedinghair, \duckpathcrown,
973 \duckpathmohican, \duckpathmullet, \duckpathqueencrown,
974 \duckpathkingcrown, \duckpathdarthvader, \duckpathhorsetail,
975 \duckpathtowel
976 \end{samcode}
977
978 In case one of the other shapes is needed, please have a look at the package source code, which can be found in \saminline|tikzducks.sty|.
979
980 To ease the placement of further accessories, some particular spots of the duck are marked with \TikZ coordinates, namely the \saminline|wing|, \saminline|head|, \saminline|bill| and \saminline|tail|.
981
982 {
983 \footnotesize\ttfamily
984 \begin{tcblisting}{title={\normalfont\normalsize\bfseries Coordinates}}
985 \duck[scale=2]
986
987 \begin{scope}[
988 every node/.style={fill,circle,inner sep=1pt}
989 ]
990 \node[label=0:wing] at (wing) {};
991 \node[label=0:head] at (head) {};
992 \node[label=0:bill] at (bill) {};
993 \node[label=0:tail] at (tail) {};
994 \end{scope}
995 \end{tcblisting}
996 }
997
998 To distinguish coordinates from multiple ducks in the same \saminline|tikzpicture|, one can name the ducks using the option \saminline|name|. If this option is used, the coordinates are prefixed with the respective name and a dash: \saminline|<name>-<coordinate>|.
999
1000 \begin{tcblisting}{title={Named coordinates},listing options={style={duckstyle}, emph={name,wing}}}
1001 \duck[
1002 name=foo
1003 ]
1004
1005 \duck[
1006 name=bar,
1007 shift={(3,1)},
1008 scale=.3
1009 ]
1010
1011 \draw (foo-wing) -- (bar-wing);
1012 \end{tcblisting}
1013
1014 Sometimes it might desirable to add things at a specific z-position, for example re-draw a t-shirt with some pattern that should be below the duck's hair and accessories. To facilitate this the \tikzducks provide a couple of hooks:
1015
1016 \begin{itemize}
1017 \item \saminline|\NewHook{tikzducks/background}|
1018 \item \saminline|\NewHook{tikzducks/body}|
1019 \item \saminline|\NewHook{tikzducks/clothing}|
1020 \item \saminline|\NewHook{tikzducks/hair}|
1021 \item \saminline|\NewHook{tikzducks/hat}|
1022 \item \saminline|\NewHook{tikzducks/foreground}|
1023 \end{itemize}
1024
1025 \begin{center}
1026 \saminline|\NewHook{tikzducks/...}|
1027 \begin{tikzpicture}[scale=1.59]
1028 \newcommand{\planes}{\fill[gray!20!white,opacity=0.9] (-0.1,-0.1) rectangle (2.4,2.4);}
1029 \newcommand{\hooks}{\draw[themecolor, rounded corners=3pt, line width=1pt] (-0.1,-0.1) rectangle (2.4,2.4);}
1030 \node[font=\ttfamily] at (-0.8,-1.4) {\strut background};
1031 \begin{scope}[canvas is zy plane at x=0]
1032 \hooks
1033 \end{scope}
1034 \begin{scope}[canvas is zy plane at x=0.8]
1035 \planes
1036 \duck
1037 \end{scope}
1038 \node[font=\ttfamily] at (0.8,-1.4) {\strut body};
1039 \begin{scope}[canvas is zy plane at x=1.6]
1040 \hooks
1041 \end{scope}
1042 \begin{scope}[canvas is zy plane at x=2.4]
1043 \planes
1044 \duck[invisible,jacket=black!50!gray]
1045 \end{scope}
1046 \node[font=\ttfamily] at (2.4,-1.4) {\strut clothing};
1047 \begin{scope}[canvas is zy plane at x=3.2]
1048 \hooks
1049 \end{scope}
1050 \begin{scope}[canvas is zy plane at x=4.0]
1051 \planes
1052 \duck[invisible,longhair=red!80!black]
1053 \end{scope}
1054 \node[font=\ttfamily] at (4.0,-1.4) {\strut hair};
1055 \begin{scope}[canvas is zy plane at x=4.8]
1056 \hooks
1057 \end{scope}
1058 \begin{scope}[canvas is zy plane at x=5.6]
1059 \planes
1060 \duck[invisible,witch=black!50!gray];
1061 \end{scope}
1062 \node[font=\ttfamily] at (5.6,-1.4) {\strut hat};
1063 \begin{scope}[canvas is zy plane at x=6.4]
1064 \hooks
1065 \end{scope}
1066 \begin{scope}[canvas is zy plane at x=7.2]
1067 \planes
1068 \duck[invisible,magicwand]
1069 \end{scope}
1070 \node[font=\ttfamily] at (7.2,-1.4) {\strut foreground};
1071 \begin{scope}[canvas is zy plane at x=8.0]
1072 \hooks
1073 \end{scope}
1074 \end{tikzpicture}
1075 \end{center}
1076
1077 These hooks can be utilised by the user as needed:
1078
1079 \begin{tcblisting}{title={Hooks}}
1080 \AddToHook{tikzducks/clothing}{
1081 \path[
1082 pattern={Stars[distance=1.7mm,
1083 radius=0.5mm,angle=32]},
1084 pattern color=yellow
1085 ] \duckpathjacket;
1086 }
1087
1088 \duck[
1089 witch=black!50!gray,
1090 longhair=red!80!black,
1091 jacket=black!50!gray,
1092 magicwand
1093 ]
1094
1095 % optionally
1096 \RemoveFromHook{tikzducks/clothing}
1097 \end{tcblisting}
1098
1099 \clearpage
1100 \section{Football ducks -- contributed by Carla Maggi}
1101 \label{sec:footballducks}
1102
1103 \tikzducks are huge sports fans! They do a lot of different sports themselves (see all the piece of sports equipment amongst the accessories), but to cheer their favourite teams, they need suitable fan clothing. In \href{https://tex.stackexchange.com/a/387126/36296}{The Duck Pond} Carla Maggi was so kind to contribute the necessary code to dress the ducks in their team's colours.
1104
1105 A (non-representative) survey\footnote{see the selection of jerseys in \url{https://tex.stackexchange.com/a/387126/36296}} showed that most sports jerseys can be emulated by drawing stripes of various colours, sizes and orientations -- and this is exactly what the \saminline|stripes| macro does, drawing stripes across the shape of the duck's jacket. In order to preserve the whole flexibility of this powerful macro, it was integrated as an independent command into the \tikzducks package, this means it can simply be used on top of a drawn duck:
1106
1107 \begin{tcblisting}{title={\texttt{stripes} macro}}
1108 \duck
1109 \stripes
1110 \end{tcblisting}
1111
1112 This may be impractical as the stripes are drawn on top of any accessories or hair the duck may have. Therefore the option \saminline|stripes| let's you inject any code you would normally use to draw the stripes at the correct layer above the duck's clothing but beneath the hair and accessories:
1113
1114 \begin{tcblisting}{title={Using \texttt{stripes} for \texttt{tikzducks}}}
1115 \duck[
1116 longhair,
1117 stripes={\stripes}
1118 ]
1119 \end{tcblisting}
1120
1121 Not all teams wear vertically stripped jerseys, therefore many parameters can be adjusted to best emulate your favourite teams jerseys. The available options are:
1122
1123 \nopagebreak[4]
1124 \begin{tabular}{@{}ll@{}}
1125 \saminline|color| & colour of the stripes, default:
1126 \saminline|black| \\
1127 \saminline|distance| & periodicity length of the stripes, default:
1128 \saminline|0.3| \\
1129 \saminline|width| & stripe width, default: \saminline|0.15| \\
1130 \saminline|height| & length of the stripes, default:
1131 \saminline|2.7| \\
1132 \saminline|initialx| & x coordinate of staring point, default:
1133 \saminline|0.1| \\
1134 \saminline|initialy| & y coordinate of staring point, default:
1135 \saminline|-0.3| \\
1136 \saminline|rotate| & rotation angle in degree, default:
1137 \saminline|-10|\\
1138 \saminline|emblem| & possibility to add logos etc., default: empty\\
1139 \end{tabular}
1140
1141 Please note that the colour of the stripes only affects the stripes themselves, to influence the colour of the empty space between the stripes, clothe the duck with a \saminline|tshirt| or \saminline|jacket| of the desired colour underneath the stripes.
1142
1143 \begin{tcblisting}{title={\texttt{stripes} options}}
1144 \duck[
1145 stripes
1146 ]
1147 \duck[
1148 stripes={\stripes[color=blue]},
1149 shift={(2.5,0)}
1150 ]
1151
1152 \duck[
1153 stripes={\stripes[distance=0.6]},
1154 shift={(0,-3.6)}
1155 ]
1156 \duck[
1157 stripes={\stripes[width=0.03]},
1158 shift={(2.5,-3.6)}
1159 ]
1160
1161 \duck[
1162 stripes={\stripes[emblem={
1163 \includegraphics[width=.3cm]{example-image-a}
1164 }]},
1165 shift={(0,-7.3)}
1166 ]
1167 \duck[
1168 stripes={\stripes[height=1.0]},
1169 shift={(2.5,-7.3)}
1170 ]
1171
1172 \duck[
1173 stripes={\stripes[initialx=1]},
1174 shift={(0,-11.5)}
1175 ]
1176 \duck[
1177 stripes={\stripes[initialy=0.8]},
1178 shift={(2.5,-11.5)}
1179 ]
1180
1181 \duck[
1182 stripes={\stripes[rotate=45]},
1183 shift={(0,-15.5)}
1184 ]
1185 \duck[
1186 stripes={\stripes[rotate=-45]},
1187 shift={(2.5,-15.5)}
1188 ]
1189 \end{tcblisting}
1190
1191 For more complex or multicoloured designs the stripes can easily be stacked on top of each other:
1192 \begin{tcblisting}{title={multicoloured \texttt{stripes}}}
1193 \duck[
1194 tshirt=red,
1195 stripes={
1196 \stripes[color=yellow, width=0.1]
1197 \stripes[color=orange, width=0.1,
1198 initialx=0.0]
1199 }
1200 ]
1201 \end{tcblisting}
1202
1203 A few examples to see \saminline|stripes| in action:
1204 \begin{tcblisting}{title={Inter duck}}
1205 \definecolor{blueinter}{RGB}{0,102,170}%
1206 \duck[
1207 tshirt=black,
1208 stripes={\stripes[color=blueinter]},
1209 football
1210 ]
1211 \end{tcblisting}
1212
1213 \begin{tcblisting}{title={Juve duck}}
1214 \duck[
1215 tshirt=black,
1216 stripes={\stripes[color=white]},
1217 football
1218 ]
1219 \end{tcblisting}
1220
1221 \begin{tcblisting}{title={Milan duck}}
1222 \duck[
1223 tshirt=black,
1224 stripes={\stripes[color=red]},
1225 football
1226 ]
1227 \end{tcblisting}
1228
1229 \begin{tcblisting}{title={M\"{o}nchengladbach duck}}
1230 \definecolor{mggreen}{RGB}{37,166,89}%
1231 \duck[
1232 tshirt=mggreen,
1233 stripes={\stripes},
1234 football
1235 ]
1236 \end{tcblisting}
1237
1238 \begin{tcblisting}{title={Palmeiras duck}}
1239 \definecolor{verdep}{RGB}{0,100,55}%
1240 \duck[
1241 tshirt=green,
1242 jacket=verdep,
1243 football
1244 ]
1245 \end{tcblisting}
1246
1247 \begin{tcblisting}{title={Cagliari duck}}
1248 \definecolor{rossocagliari}{RGB}{149,20,38}%
1249 \definecolor{blucagliari}{RGB}{23,52,84}%
1250 \duck[
1251 tshirt=white,
1252 jacket=blucagliari,
1253 stripes={
1254 \stripes[
1255 color=rossocagliari,
1256 width=0.46,
1257 distance=3
1258 ]
1259 },
1260 football
1261 ]
1262 \end{tcblisting}
1263
1264 \begin{tcblisting}{title={Sampdoria duck}}
1265 \duck[
1266 tshirt=blue,
1267 jacket=blue,
1268 stripes={
1269 \stripes[color=white,rotate=-90,
1270 width=0.6,distance=1]
1271 \stripes[color=red,rotate=-90,
1272 width=0.2,distance=1.2]
1273 \stripes[color=black,rotate=-90,
1274 width=0.1,distance=1.3]
1275 },
1276 football
1277 ]
1278 \end{tcblisting}
1279
1280 \begin{tcblisting}{title={Brescia duck}}
1281 \duck[
1282 tshirt=blue,
1283 jacket=blue,
1284 stripes={
1285 \stripes[color=white, rotate=-70,
1286 width=0.22,distance=1.1,
1287 initialy=0.01]
1288 \stripes[color=white, rotate=40,
1289 width=0.2, distance=1.8,
1290 initialy=1.0,initialx=0.285]
1291 },
1292 football
1293 ]
1294 \end{tcblisting}
1295
1296 \section{Examples}
1297
1298 To see more examples of what can be done with the \tikzducks, you are invited to visit \url{https://github.com/samcarter/tikzducks}.
1299
1300 If you have created a duck you would like to share with the community, I would be happy to add it to this collection, just make a pull request or open an issue in the bug tracking system.
1301
1302 \end{document}