Skip to content

Commit

Permalink
based on an idea of Ulrike Fischer (https://chat.stackexchange.com/tr…
Browse files Browse the repository at this point in the history
…anscript/message/40734939#40734939) the ducks can now be named to distinguish between the coordinates of multiple ducks in the same picture
  • Loading branch information
samcarter committed Oct 24, 2017
1 parent b664813 commit a8fb3f0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
Binary file modified documentation.pdf
Binary file not shown.
26 changes: 23 additions & 3 deletions tikzducks-doc.tex
Expand Up @@ -32,6 +32,7 @@
\usepackage{marvosym}
\usepackage{fontawesome}
\usepackage[hang,flushmargin,bottom]{footmisc}
\usepackage{imakeidx}

% macros %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\CTAN}{\textsc{CTAN}\xspace}
Expand Down Expand Up @@ -59,9 +60,10 @@
texcsstyle=*\color{duckblue}\bfseries,
keywordstyle=\color{red!60!black}\bfseries,
morekeywords={tikzpicture,scope,patterns,pgfinterruptboundingbox},
moretexcs={duck,path,definecolor,duckpathjacket,duckpathbody,duckpathgrumpybill,duckpathbill,duckpathtshirt,duckpathcape,duckpathshorthair,duckpathlonghair,duckpathcrazyhair,duckpathrecedinghair,duckpathcrown,scalebox,foreach,node,PassOptionsToPackage,usetikzlibrary,selectcolormodel,colorlet,insignia,stripes,color,includegraphics,mcap,setboardfontcolors,setboardfontencoding,WhiteQueenOnWhite,WhiteKingOnWhite,superstripes,shuffleducks,randuck,randomhead,randomaccessories},
moretexcs={duck,path,definecolor,duckpathjacket,duckpathbody,duckpathgrumpybill,duckpathbill,duckpathtshirt,duckpathcape,duckpathshorthair,duckpathlonghair,duckpathcrazyhair,duckpathrecedinghair,duckpathcrown,scalebox,foreach,node,draw,PassOptionsToPackage,usetikzlibrary,selectcolormodel,colorlet,insignia,stripes,color,includegraphics,mcap,setboardfontcolors,setboardfontencoding,WhiteQueenOnWhite,WhiteKingOnWhite,superstripes,shuffleducks,randuck,randomhead,randomaccessories},
delim ={[s][\ttfamily\color{green!50!black}]{$}{$}},
moredelim=[is][\footnotesize\ttfamily\color{orange!70!black}]{|}{|},
index=[1][emph]
}
\tcbset{%
Expand Down Expand Up @@ -100,6 +102,8 @@
% \tikzexternalize[prefix=tikzducks-doc-figures/]
%\fi
\makeindex
% meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{The \texorpdfstring{\tikzducks}{tikzducks} package}
\subtitle{using ducks in \TikZ}
Expand Down Expand Up @@ -423,7 +427,7 @@ \subsection{Accessories}
\addtocounter{footnote}{1}
\begin{tcblisting}{title={Speaking duck$^\thefootnote$}}
\begin{tikzpicture}
\duck[speech={Bla},bubblecolour=white!95!gray]
\duck[speech={Bla},bubblecolour=cyan!20!white]
\end{tikzpicture}
\end{tcblisting}
Expand Down Expand Up @@ -606,7 +610,20 @@ \section{Further customisation}
\end{tikzpicture}
\end{tcblisting}
}
An example making use this option are the \hyperref[starducks]{``Live long and prosper'' ducks}..
An example making use this option are the \hyperref[starducks]{``Live long and prosper'' ducks}.
To distinguish coordinates from multiple ducks in the same \lstinline|tikzpicture|, one can name the ducks using the option \lstinline[emph={name}]|name|. If this option is used, the coordinates are prefixed with the respective name and a dash: \lstinline|<name>-<coordinate>|.
\begin{tcblisting}{title={Named coordinates},listing options={style={duckstyle}, emph={name,wing}}}
\begin{tikzpicture}
\duck[name=foo]
\begin{scope}[xshift=90pt,
scale=.3, yshift=150pt]
\duck[name=bar]
\end{scope}
\draw (foo-wing) -- (bar-wing);
\end{tikzpicture}
\end{tcblisting}
\clearpage
\section{Football ducks -- contributed by Carla Maggi}
Expand Down Expand Up @@ -1041,4 +1058,7 @@ \section{Showcase}
\end{tikzpicture}
\end{tcblisting}
\clearpage
\printindex
\end{document}
7 changes: 7 additions & 0 deletions tikzducks.sty
Expand Up @@ -34,6 +34,7 @@
/duck/.cd,#1}\duck@draw%
}

\newif\ifduck@name
% Environment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifduck@water
% body parts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -90,6 +91,7 @@

\tikzset{
/duck/.cd,
name/.code = \duck@nametrue \def\duck@name{#1},
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Environment
Expand Down Expand Up @@ -257,6 +259,11 @@
% defining some coordinates
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifduck@name
\coordinate (\duck@name-wing) at (0.8,0.7);
\coordinate (\duck@name-head) at (0.9,2);
\coordinate (\duck@name-bill) at (0.5,1.3);
\fi
\coordinate (wing) at (0.8,0.7);
\coordinate (head) at (0.9,2);
\coordinate (bill) at (0.5,1.3);
Expand Down

0 comments on commit a8fb3f0

Please sign in to comment.