Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: overall TikZling styles #18

Open
marmotghost opened this issue Mar 24, 2021 · 4 comments
Open

Feature request: overall TikZling styles #18

marmotghost opened this issue Mar 24, 2021 · 4 comments

Comments

@marmotghost
Copy link

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.)

@joulev
Copy link

joulev commented Mar 24, 2021

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.

@samcarter
Copy link
Owner

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
Copy link
Owner

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

\ExplSyntaxOn
\cs_new:Npn \tikzlings_iteratesearch:N #1 {
\clist_map_function:NN #1 \__tikzlings_slashed_items:n
}
\cs_new:Npn \__tikzlings_slashed_items:n #1 {
/
\exp_not:N {
\__tikzlings_before_slashsearch:w #1 / \s_stop
}
,
}
\cs_new:Npn \__tikzlings_before_slashsearch:w #1 / #2 \s_stop {
\tl_trim_spaces:n {#1}
}
\cs_new_eq:NN \tikzling@iteratesearch \tikzlings_iteratesearch:N
\ExplSyntaxOff
to automatically generate this list from \tikzling@list

@marmotghost
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants