tikzlings icon indicating copy to clipboard operation
tikzlings copied to clipboard

Feature request: overall TikZling styles

Open marmotghost opened this issue 4 years ago • 4 comments

In TikZ one can say \tikzset{every node/.append style={blue}}. Therefore, I wonder if it is possible to add styles of the form every tikzling or every sheep tikzling (or just every sheep) so that one can say something like \tikzset{tikzlings/every marmot/.append style={whiskers,teeth} and all \marmots automatically have whiskers and teeth. Or \tikzset{tikzlings/every tikzling/.append style={3D}, and all TikZlings are by default 3D. (I do not know if tikzlings is an appropriate choice for the path.)

marmotghost avatar Mar 24 '21 03:03 marmotghost

If I understand the code correctly, each animal has its own path. Unless the code is refactored so that all tikzlings share the same pgfkeys path (I believe this is the better way to handle the keys), I don't think that is possible.

joulev avatar Mar 24 '21 04:03 joulev

For modifying every marmot, you could use

\documentclass{standalone}

\usepackage{tikzlings}
\tikzset{/marmot/teeth=white,/marmot/whiskers=gray}

\begin{document}

\begin{tikzpicture}
\bear
\end{tikzpicture}
\begin{tikzpicture}
\penguin
\end{tikzpicture}
\begin{tikzpicture}
\marmot
\end{tikzpicture}
\end{document}

samcarter avatar Mar 24 '21 09:03 samcarter

To make all TikZlings 3D, one can modify this nice answer https://topanswers.xyz/tex?q=1569#a1820

\documentclass{standalone}

\usepackage{tikzlings}
\tikzset{tikzling 3D/.code={\tikzset{/#1/3D}}}
\tikzset{tikzling 3D/.list={anteater,bear,bee,cat,chicken,coati,  hippo,koala,marmot,mouse,moles,owl,panda,penguin,pig,rhino,sheep,  sloth,snowman,squirrel}}

\begin{document}

\begin{tikzpicture}
\bear
\end{tikzpicture}
\begin{tikzpicture}
\penguin
\end{tikzpicture}
\begin{tikzpicture}
\marmot
\end{tikzpicture}
\end{document}

P.S. If there is anyone with the necessary safety equipment to handle explosives, it might be possible to adapt https://github.com/samcarter/tikzlings/blob/4aa9e467f24312d200e4f643ae18457cc890b160/tikzlings-addons.sty#L35-L50 to automatically generate this list from \tikzling@list

samcarter avatar Mar 24 '21 10:03 samcarter

Thanks for the suggestions! I was thinking more of something like

\documentclass{article}
\usepackage{tikzlings}
\begin{document}
\tikzset{explicit every marmot/.style={/marmot/whiskers,/marmot/teeth}}
\tikz{\marmot[explicit every marmot]}

\tikz{\marmot}

\tikzset{every marmot set style/.code={\tikzset{/marmot/#1}},
every marmot/.code={\tikzset{every marmot set style/.list={#1}}}}
\tikzset{every marmot={whiskers,teeth}}

\tikz{\marmot}
\end{document}

but I am also not sure.

marmotghost avatar Mar 24 '21 14:03 marmotghost