diff options
Diffstat (limited to 'graphics/pgf/contrib/tikzducks/tikzducks-doc.tex')
-rw-r--r-- | graphics/pgf/contrib/tikzducks/tikzducks-doc.tex | 180 |
1 files changed, 62 insertions, 118 deletions
diff --git a/graphics/pgf/contrib/tikzducks/tikzducks-doc.tex b/graphics/pgf/contrib/tikzducks/tikzducks-doc.tex index 5cc8af0781..becc316cd5 100644 --- a/graphics/pgf/contrib/tikzducks/tikzducks-doc.tex +++ b/graphics/pgf/contrib/tikzducks/tikzducks-doc.tex @@ -8,20 +8,16 @@ % https://github.com/samcarter/tikzducks % % Released under the LaTeX Project Public License v1.3c or later -% See http://www.latex-project.org/lppl.txt +% See https://www.latex-project.org/lppl.txt % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% !TeX program = txs:///arara -% arara: latexmk: { -% arara: --> engine: pdflatex, -% arara: --> options: [ -% arara: --> '-shell-escape', -% arara: --> '-synctex=1', -% arara: --> '-interaction=nonstopmode', -% arara: --> ] -% arara: --> } +% arara: latexmk \documentclass{scrartcl} +\usepackage[ + themecolor=samlblue +]{\jobname-settings} + % meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \title{The \texorpdfstring{\tikzducks}{tikzducks} package} \subtitle{using ducks in \TikZ} @@ -32,13 +28,10 @@ \end{tikzpicture}\\[0.8em] \texttt{samcarter}\\ \url{https://github.com/samcarter/tikzducks}\\ - \url{https://www.ctan.org/pkg/tikzducks} + \url{https://ctan.org/pkg/tikzducks} }{samcarter}} -\date{Version v1.8 \textendash{} 2024/04/27} - -\usepackage[ - themecolor=samlblue -]{\jobname-settings} +\date{Version v2.0 \textendash{} 2025/01/31} +\packagename{tikzducks} \colorlet{blue}{samlblue} \colorlet{red}{samred} @@ -51,13 +44,12 @@ % customisation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfmathsetseed{2} -\setlength{\footheight}{41pt} +\setlength{\footheight}{45pt} \newlength{\duckoffset} \cfoot{% - \shuffleducks \begin{tikzpicture}[scale=0.5] - \duck[signpost=\scalebox{0.6}{\thepage},\randomhead] + \duck[signpost=\scalebox{0.6}{\thepage},randomhead] \end{tikzpicture} } \pagestyle{scrheadings} @@ -72,48 +64,13 @@ 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. This project is a continuation of \href{https://tex.stackexchange.com/a/347458/36296}{How can we draw a duck?}. -This package is work in progress (and will probably never be really finished as there is an infinite amount of things which could be added), therefore I would be happy to hear your feedback and ideas how to improve the package. -The head version of the source code can be found on \url{https://github.com/samcarter/tikzducks}, including a bug tracker -- please make constructive use of it! A more stable package version can be found on \CTAN (\url{https://www.ctan.org/pkg/tikzducks}) and is included in both \miktex and \texlive as \tikzducks. If you seek any other assistance (not bug reports/feature requests), I suggest asking a question at \url{https://topanswers.xyz/tex}. - -\subsection{Acknowledgements} - -Without the friendly and helpful community of \TeX{} users this package would not exist. I would like to thank a few fellow users in particular: - -First of all -% -Carla Maggi for pointing out the overwhelming need of having a \tikzducks package and valuable contribution to the package code, in particular the \hyperref[sec:footballducks]{football ducks}, -% -Paulo Cereda for his contagious enthusiasm for ducks (\emph{Quack!}) and -% -Ulrike Fischer for her useful \TikZ advices and contributions to the package and coming to rescue for keyword highlighting in the package documentation. - -Many other users contributed to this package (in random order): -% -Enrico Gregorio helped to implement the \saminline|\tikzset{}| interface which makes it much easier to adjust the properties of the ducks to fit the user needs, -% -Andrew Stacey contributed the \TikZ Library ``ducks'', -% -Symbol~1 solved a few problems with default key values, -% -Mihikma created the duck's beard, -% -Yudai Nakata helped with problems of \saminline|\pdfrandomseed|, -% -@marmot for his seemingly infinite knowledge of \TikZ which he shared with the world, -% -@JairoAdelRio for contributing the \ConTeXt{} User Module -% -and last but not least my thanks go to Martin Schr\"oder for his feedback to the code review. - -The ducks mostly consist of basic geometric shapes drawn in \TikZ. Some of the more complex shapes (e.g.\ the different hair styles) are first drawn in \texttt{inkscape} (\url{https://inkscape.org}) and then exported to \TikZ paths using the \texttt{svg2tikz} extension (\url{https://github.com/xyz2tex/svg2tikz}). +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! -\subsection{License} - -Copyright \raisebox{0.2em}{\tiny\fontfamily{cmr}\selectfont\textcopyright} -\texttt{samcarter}. Permission is granted to copy, distribute and\slash or modify this software under the terms of the LaTeX project public licence, version 1.3c or later \url{http://www.latex-project.org/lppl.txt}. +\blurb The shown example ducks are purely fictional characters, any resemblance to real ducks or persons is purely coincidental and no copyright infringement is intended. +\clearpage \section{Usage} The basic usage is fairly simple, to draw a duck: @@ -189,7 +146,7 @@ For everybody suffering from anatidaephobia, there is also a special option to n This can also be useful to recycle some of the accessories presented in \ref{sec:accessories}. -For the \TeX{} purists, there is also a picture mode variant: +For the purists, there is also a picture mode variant: { \setlength{\unitlength}{0.6mm} \begin{tcblisting}{title={\texttt{picture} mode duck}} @@ -199,46 +156,6 @@ For the \TeX{} purists, there is also a picture mode variant: \end{tcblisting} } -And thanks to @JairoAdelRio there is even a \ConTeXt{} User Module available. Some of the colours might look different and not being a \ConTeXt{} user myself, I can't guarantee maintenance of this module. - -\begin{tcolorbox}[title={\ConTeXt{} User Module}] -\begin{samcode} -\usemodule[tikzducks] -\usecolors[xwi] -\starttext - -\starttikzpicture - \duck[tophat,bowtie] -\stoptikzpicture - -\stoptext -\end{samcode} - -\tcblower -\begin{tikzpicture} - \duck[tophat,bowtie] -\end{tikzpicture} -\end{tcolorbox} - -For those who prefer to work with pdf\TeX: - -\begin{tcolorbox}[title={pdfTeX}] -\begin{samcode} -\input tikzducks-plain.tex - -\tikzpicture - \duck[bobblehat,cheese] -\endtikzpicture - -\bye -\end{samcode} - -\tcblower -\begin{tikzpicture} - \duck[bobblehat,cheese] -\end{tikzpicture} -\end{tcolorbox} - \subsection{Body parts} The various parts of the duck can also be coloured independently, i.e.\ \saminline|body|, \saminline|head| or \saminline|bill|: @@ -588,6 +505,17 @@ There is a multitude of things a duck might need. The following examples all als \end{tikzpicture} \end{tcblisting} +\begin{tcblisting}{title={Sombrero Duck\footnote{The sombrero was kindly contributed by Carla Maggi}}} +\begin{tikzpicture} + \duck[ + sombrero=orange!70!yellow, + sombreroa=green!70!blue, + sombrerob=red, + sombreroc=blue + ] +\end{tikzpicture} +\end{tcblisting} + \begin{tcblisting}{title={Glasses duck}} \begin{tikzpicture} \duck[glasses=red!50!black] @@ -889,6 +817,12 @@ There is a multitude of things a duck might need. The following examples all als \end{tikzpicture} \end{tcblisting} +\begin{tcblisting}{title={Megaphone Duck}} +\begin{tikzpicture} + \duck[megaphone=lightgray] +\end{tikzpicture} +\end{tcblisting} + \section{Random ducks} 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 ...) @@ -899,12 +833,11 @@ With all these available accessories it might be hard to decide which one to cho \end{tikzpicture} \end{tcblisting} -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 \saminline|\randomhead| and \saminline|\randomaccessories| for a random headpiece and a random accessories, respectively. Small caveat: Before using \saminline|\randomhead| or \saminline|\randomaccessories|, \saminline|\shuffleducks| has to be used to provide the random items (for \saminline|\randuck| this is done automatically). +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. \begin{tcblisting}{title={Random head gear and accessories}} \begin{tikzpicture} - \shuffleducks - \duck[\randomhead, \randomaccessories] + \duck[randomhead, randomaccessories] \end{tikzpicture} \end{tcblisting} @@ -932,7 +865,8 @@ For convenience the more complex paths of this package are stored in macros, whi \begin{tikzpicture} \duck \path[preaction={fill, red!50!black}, - pattern=fivepointed stars, + pattern={Stars[distance=1.7mm, + radius=0.5mm,angle=32]}, pattern color=yellow] \duckpathlonghair; \end{tikzpicture} @@ -982,12 +916,17 @@ To distinguish coordinates from multiple ducks in the same \saminline|tikzpictur 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: -\begin{samcode} -\duckhookbackground, \duckhookbody, \duckhookclothing, \duckhookhair, \duckhookhat, \duckhookforeground -\end{samcode} +\begin{itemize} +\item \saminline|\NewHook{tikzducks/background}| +\item \saminline|\NewHook{tikzducks/body}| +\item \saminline|\NewHook{tikzducks/clothing}| +\item \saminline|\NewHook{tikzducks/hair}| +\item \saminline|\NewHook{tikzducks/hat}| +\item \saminline|\NewHook{tikzducks/foreground}| +\end{itemize} \begin{center} -\texttt{\textbackslash duckhook}\dots +\saminline|\NewHook{tikzducks/...}| \begin{tikzpicture}[scale=1.59] \newcommand{\planes}{\fill[gray!20!white,opacity=0.9] (-0.1,-0.1) rectangle (2.4,2.4);} @@ -1039,21 +978,26 @@ Sometimes it might desirable to add things at a specific z-position, for example \end{tikzpicture} \end{center} -These hooks can be defined by the user as needed: +These hooks can be utilised by the user as needed: \begin{tcblisting}{title={Hooks}} \begin{tikzpicture} - \begingroup - \newcommand{\duckhookclothing}{ - \path[pattern=fivepointed stars, - pattern color=yellow] - \duckpathjacket; - } - \duck[witch=black!50!gray, - longhair=red!80!black, - jacket=black!50!gray, - magicwand] - \endgroup + + \AddToHook{tikzducks/clothing}{ + \path[pattern={Stars[distance=1.7mm, + radius=0.5mm,angle=32]}, + pattern color=yellow] + \duckpathjacket; + } + + \duck[witch=black!50!gray, + longhair=red!80!black, + jacket=black!50!gray, + magicwand] + + % optionally + \RemoveFromHook{tikzducks/clothing} + \end{tikzpicture} \end{tcblisting} |