samcarter
For testing purposes I would like to pass a key and value (e.g. body=red) to all Ti*k*Zlings. Is there an easier way than repeating it for each Ti*k*Zling?


\documentclass{standalone}

\usepackage{tikzlings}

\begin{document}

\begin{tikzpicture}
\bear[body=red]
\end{tikzpicture}
\begin{tikzpicture}
\penguin[body=red]
\end{tikzpicture}
\begin{tikzpicture}
\marmot[body=red]
\end{tikzpicture}

\end{document}

marmot
A very simpleminded approach.

\documentclass{standalone}

\usepackage{tikzlings}
\tikzset{tikzling body red/.code={\tikzset{/#1/body=red}}}
\begin{document}
\tikzset{tikzling body red/.list={bear,penguin,marmot}}
\begin{tikzpicture}
\bear
\end{tikzpicture}
\begin{tikzpicture}
\penguin
\end{tikzpicture}
\begin{tikzpicture}
\marmot
\end{tikzpicture}
\end{document}

![Screen Shot 2020-12-21 at 9.19.28 AM.png](/image?hash=c9478e92debb68c44c8f68b19347c06ba72685e1cb5b2ca84969451ede9797e6)

and of course

\tikzset{tikzling body red/.list={bear,marmot}}

gives
![Screen Shot 2020-12-21 at 9.20.26 AM.png](/image?hash=572004d5122fb18c7d0877ee3c72b279445b4877fd641dec0f9c7f5e01338690)

BTW, some time ago I experimented a bit with keys that allow you to build the union or complement of two lists, but I never finalized this. Such tools might be useful for coloring all Ti*k*Zlings. However, if you play with such lists, the /.expanded may be important:

\def\lstTikzlings{{bear,penguin,marmot}}
\tikzset{tikzling body red/.list/.expanded=\lstTikzlings}


Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.