Skip to content

Commit

Permalink
added thought and speech bubble
Browse files Browse the repository at this point in the history
  • Loading branch information
samcarter committed Sep 27, 2017
1 parent 231e7c1 commit b664813
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 12 deletions.
36 changes: 25 additions & 11 deletions tikzducks-doc.tex
Expand Up @@ -55,7 +55,7 @@
commentstyle={\color{green!50!black}\slshape},
columns=fullflexible,
emphstyle=\color{orange!70!black},
emph=[1]{water,body,head,eye,pupil,bill,grumpy,tshirt,jacket,tie,cape,shorthair,longhair,crazyhair,recedinghair,eyebrow,glasses,sunglasses,alien,hat,cap,santa,chef,graduate,tassel,beret,crown,unicorn,icecream,flavoura,flavourb,flavourc,book,bookcolour,signpost,signcolour,signback,magichat,magicstars,magicwand,witch,cricket,rollingpin,lightsaber,cake,pizza,hockey,baguette,wing,football,mask,bunny,inear,necklace,milkshake,wine,peakedcap,prison,tophat},
emph=[1]{water,body,head,eye,pupil,bill,grumpy,tshirt,jacket,tie,cape,shorthair,longhair,crazyhair,recedinghair,eyebrow,glasses,sunglasses,alien,hat,cap,santa,chef,graduate,tassel,beret,crown,unicorn,icecream,flavoura,flavourb,flavourc,book,bookcolour,signpost,signcolour,signback,magichat,magicstars,magicwand,witch,cricket,rollingpin,lightsaber,cake,pizza,hockey,baguette,wing,football,mask,bunny,inear,necklace,milkshake,wine,peakedcap,prison,tophat,speech,bubblecolour,think},
texcsstyle=*\color{duckblue}\bfseries,
keywordstyle=\color{red!60!black}\bfseries,
morekeywords={tikzpicture,scope,patterns,pgfinterruptboundingbox},
Expand Down Expand Up @@ -407,15 +407,6 @@ \subsection{Accessories}
\end{tikzpicture}
\end{tcblisting}
\begin{tcblisting}{title={Book duck}}
\begin{tikzpicture}
\duck[book=\scalebox{0.5}{\TeX}]
\end{tikzpicture}
\begin{tikzpicture}
\duck[book=\scalebox{0.6}{$\pi$}, bookcolour=blue!50!black]
\end{tikzpicture}
\end{tcblisting}
\begin{tcblisting}{title={Signpost duck}}
\begin{tikzpicture}
\duck[signpost=42]
Expand All @@ -429,6 +420,29 @@ \subsection{Accessories}
\end{tikzpicture}
\end{tcblisting}
\addtocounter{footnote}{1}
\begin{tcblisting}{title={Speaking duck$^\thefootnote$}}
\begin{tikzpicture}
\duck[speech={Bla},bubblecolour=white!95!gray]
\end{tikzpicture}
\end{tcblisting}
\begin{tcblisting}{title={Thinking duck$^\thefootnote$}}
\begin{tikzpicture}
\duck[think={Blub},bubblecolour=white!95!yellow]
\end{tikzpicture}
\end{tcblisting}
\footnotetext[\thefootnote]{Both the speech and thought bubble are inspired by the wonderful \href{https://www.ctan.org/pkg/ducksay}{ducksay package}}
\begin{tcblisting}{title={Book duck}}
\begin{tikzpicture}
\duck[book=\scalebox{0.5}{\TeX}]
\end{tikzpicture}
\begin{tikzpicture}
\duck[book=\scalebox{0.6}{$\pi$}, bookcolour=blue!50!black]
\end{tikzpicture}
\end{tcblisting}
\begin{tcblisting}{title={Cricket duck}}
\begin{tikzpicture}
\duck[cricket=red!50!black]
Expand Down Expand Up @@ -520,7 +534,7 @@ \subsection{Accessories}
\end{tcblisting}
\footnotetext[\thefootnote]{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}
\clearpage
%\clearpage
\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 \lstinline|\randuck|, which automatically creates a duck with a randomly chosen accessories and something on top of the head (hair, a hat, ears, alien antenna ...)
Expand Down
22 changes: 21 additions & 1 deletion tikzducks.sty
Expand Up @@ -85,6 +85,8 @@
\newif\ifduck@milkshake
\newif\ifduck@wine
\newif\ifduck@prison
\newif\ifduck@speech
\newif\ifduck@think

\tikzset{
/duck/.cd,
Expand Down Expand Up @@ -214,6 +216,9 @@
milkshake/.code = \duck@milkshaketrue \def\duck@milkshake{#1},
wine/.code = \duck@winetrue \def\duck@wine{#1},
prison/.code = \duck@prisontrue \def\duck@prison{#1},
speech/.code = \duck@speechtrue \def\duck@speech{#1},
think/.code = \duck@thinktrue \def\duck@think{#1},
bubblecolour/.code = \def\duck@bubblecolour{#1},
% setting defaults %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
glasses/.default = black,
sunglasses/.default = black,
Expand All @@ -236,6 +241,7 @@
milkshake/.default = red!20!white,
wine/.default = red!70!black,
prison/.default = gray,
bubblecolour = gray!30!white,
}

\def\duck@draw{
Expand Down Expand Up @@ -576,14 +582,28 @@
\node[rotate=-20, color=white] at (0.88,0.70) {\duck@book};%
\fi
%
% signpost %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% signpost %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifduck@signpost
\fill[\duck@signcolour, rounded corners=1, rotate=-20] (0.8,0.75) rectangle (0.9,1.75);
\fill[\duck@signcolour, rounded corners=1, rotate=-20] (0.4,1.7) rectangle (1.3,2.4);
\fill[\duck@signback, rounded corners=1, rotate=-20] (0.45,1.75) rectangle (1.25,2.35);
\node[rotate=-20, color=white] at (1.5,1.65) {\duck@signpost};
\fi
%
% speech bubble %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifduck@speech
\fill[\duck@bubblecolour] (-0.5,1.8) ellipse (0.7 and 0.3);
\fill[\duck@bubblecolour] (-0.2,1.54) -- (0.2,1.35) -- (0.0,1.6) -- cycle;
\node at (-0.5,1.8) {\duck@speech};
\fi
%
% think bubble %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifduck@think
\fill[\duck@bubblecolour] (2,2.4) ellipse (0.7 and 0.35);
\fill[\duck@bubblecolour] (1.55,2.35) circle (0.25) (2.0,2.15) circle (0.25) (2.4,2.25) circle (0.25) (1.6,2.55) circle (0.25) (2.0,2.6) circle (0.25) (2.35,2.5) circle (0.25) (1.65,1.95) circle (0.1) (1.55,1.80) circle (0.06) (1.47,1.70) circle (0.03);
\node at (2,2.4) {\duck@think};
\fi
%
% magic wand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifduck@magicwand
\fill[black,rotate=-30] (0.27,1.23) rectangle (0.37,0.65);
Expand Down

0 comments on commit b664813

Please sign in to comment.