4

I'm using the tikzpeople package to draw some scenarios. Now I would like to give the hat, that the builder is wearing to alice, charlie, and dave. As it is not attribute like the monitor or the shield I don't know how to do that.

enter image description here

(I've built the example with inkscape.)

6

You could misuse one of the (unused) accessories:

\documentclass{article}
\usepackage{tikzpeople}
\begin{document}
\begin{tikzpicture}
\makeatletter 
\tikzpeople@builder@definecolors
\let\tikzpeople@person@paintshield\tikzpeople@builder@painthat
\node[alice,shield,minimum size=1.5cm] at (0,0) {};
\end{tikzpicture}
\end{document}

enter image description here

  • That should work for my case, but it would not work if I want to use the accessories like the shield as well. How could I define the hat as a new accessory? – white_gecko Sep 5 '19 at 18:46
  • 5
    Send the author a feature request. – Ulrike Fischer Sep 5 '19 at 18:49
5

Ok, I managed it by taking a closer look into the files of the tikzpeople package.

To define a new combination (builderalice in my case) you need to define a new file tikzpeople.shape.builderalice.sty where you combine the parts and the according colors. Then you need to call \tikzpeople@declareshape{builderalice} (as it is intended to not be called from outside and contains an @ you need to wrap it in \makeatletter and \makeatother).

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usepackage{tikzpeople}
\usepackage{filecontents}

\begin{filecontents}{tikzpeople.shape.builderalice.sty}
\newcommand{\tikzpeople@builderalice@paint}{
    \tikzpeople@person@paintshirt
    \tikzpeople@alice@paintshirtdetails
    \tikzpeople@person@paintrighthorn
    \tikzpeople@person@painthead
    \tikzpeople@alice@painthair
    \tikzpeople@person@paintgoatee
    \tikzpeople@person@paintlefthorn
    \tikzpeople@person@painthalo
    \tikzpeople@builder@painthat
}
\newcommand{\tikzpeople@builderalice@definecolors}{
    \definecolor{shirt}{RGB}{253,156,40}
    \definecolor{undershirt}{RGB}{232,232,232}
    \definecolor{skin}{RGB}{148,60,19}
    \definecolor{hair}{rgb}{0,0,0}
    \definecolor{hat}{RGB}{238,175,0}
}
\end{filecontents}

\makeatletter
\tikzpeople@declareshape{builderalice}
\makeatother

\begin{document}
\begin{tikzpicture}[]
  \node[builder,minimum size=1.5cm] (T) at (-1,0) {};
  \node[alice,minimum size=1.5cm] (N) at (1,0) {};
  \node[builderalice,minimum size=1.5cm] (A) at (3,0) {};
\end{tikzpicture}
\end{document}

enter image description here

5

This seems to be an XY question. What you might be really looking for is the TikZlings package in which you can add the accessories at will.

\documentclass[tikz,border=1mm]{standalone}
\usepackage{tikzlings}
\begin{document}
\begin{tikzpicture}
 \owl
 \thing[tophat,scale=1.5,yshift=-0.6cm,xshift=-0.05cm]
 \begin{scope}[xshift=2cm]
  \bear[magichat=violet,
   magicstars=yellow!80!brown]
 \end{scope}  
\end{tikzpicture}
\end{document}

enter image description here

  • :-D Yes if the tikzpeople are build like tikzlings, that would work I guess. – white_gecko Sep 5 '19 at 18:45
  • @white_gecko Who needs Bob if one can have a bear instead? ;-) – Schrödinger's cat Sep 5 '19 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.