Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

A question with a large mea culpa. I've tried thinking about how I would add this shape and I've come up completely empty. Not strong enough with Tex to even give it a shot.

I'm trying to put together a visual aid of people numbers in a particular area, so I imagine using something like

\begin{tikzpicture}[every node/.style={human,draw,fill=black}]
\node (sci) {scientist};
\node [right=1mm of sci] (sol) {gurus};
\node [right=1mm of sol] (joe) {workers};
\end{tikzpicture}

My question is: Is there simple shape that already exists (its not in the shapes library) that does something similar. or is this easily coded as a new shape in which case could some kind soul post it as an example or is there a simple way to combine two existing shapes into a new one (A basic version I'd be happy with would be a long-ish down ward pointing isoceles triangle with a circle on top).

Image of what I'm sort of after below. Thanks

enter image description here

As a worst case I could use lots of \includegraphics commands in nodes but that is likely to be the most manual approach and would prefer something else if a solution exists.


Update: Really tough to pick the answer for this one. I picked the one I went with in a hurry but there is a lot of material there for alternative ways to make this work.

I'd really like to thank all three responders for their help. Now if only I could get a shape definition too ... :-)

share|improve this question

5 Answers 5

up vote 18 down vote accepted

Do you really need tikz?

The marvosym package provides the commands \Gentsroom and Ladiesroom :

enter image description here

A good place to look for such common-use symbols is the comprehensive LaTeX symbol list.

share|improve this answer
    
Thanks @TVerron unfortunately I need to put several of them side by side and color them according to each category so that it shows numbers of people in groups. I'm not sure how I'd do that outside tikz, ... perhaps a table structure... will try it and revert –  Tahnoon Pasha Nov 26 '12 at 8:50
    
@TahnoonPasha These commands are usable in text mode, so you can definitely use them in nodes of a tikz picture, and use the standards commands you would use to control the size or color of the text of a node. –  T. Verron Nov 26 '12 at 9:03
    
That is extremely useful @TVerron. It may be a new question but is there an easy way to shade out half the image that you're aware of? e.g. If I'm using each figure to represent four people and I want to indicate 2 by using half a figure? –  Tahnoon Pasha Nov 26 '12 at 9:30
    
@TahnoonPasha : That would indeed make a new question. I must confess I have no idea how to do that, except maybe some low-level hacks if your symbol is tikz-defined and parametrized by its height. –  T. Verron Nov 26 '12 at 10:38
1  
The author created a new question for the partial filling of the shape problem: tex.stackexchange.com/questions/84420/… –  JLDiaz Nov 27 '12 at 8:29

These produce rather different effects than the one envisaged in the question. I'm posting them because I couldn't find anything similar when I searched and I hope that they may be useful to somebody sometime. (Basically the answers here were the closest I got to what I was looking for.)

In terms of questions, LaTeX Cartooning asks for something of the kind I hoped to find. But that question requests a much more comprehensive package far beyond anything I was searching for.

So, for what it is worth, this code defines pics which can be used a little like new node shapes but are much less flexible and powerful. I would love to have node shapes but have no idea how to make one.

People Pic I

I needed to be able to fill my people with spheres.So I wanted an outline rather than a filled picture. Moreover, I needed to be able to specify paths around the people in order to draw arrows, clip the background spheres etc. So, I needed nodes within the pic which I could refer to later.

The pic below let me do that. Perhaps it will help somebody else who wants to do something equally bizarre sometime.

Use \pgfkeyssetvalue{/cfr/soul base dimension}{} to specify the size of the pic but note that this size does not specify the final dimensions. Rather, it is the base unit used by the pic code to calculate those dimensions. I used 10pt for code designed for use in a beamer presentation.

The pic defines various nodes. If you give your pic a name, you can refer to these nodes later. For example, if you write

\pic (harry) {person};

Then

harry-head
harry-right arm
harry-right leg
harry-torso
harry-left leg
harry-left arm

refer to Harry's head, arms, legs and torso respectively.

\documentclass[tikz]{standalone}
\usetikzlibrary{calc,positioning}

\begin{document}
\pgfkeyssetvalue{/cfr/soul base dimension}{10pt}
\begin{tikzpicture}
  [
  font=\sffamily\bfseries,
  line width=0.1*\pgfkeysvalueof{/cfr/soul base dimension},
  outer sep=0pt,
  inner sep=0pt,
  person/.pic={%
    \node (-head) [circle, minimum size=4*\pgfkeysvalueof{/cfr/soul base dimension}] {};
    \node (-torso) [below=0pt of -head, rectangle, rounded corners=.4*\pgfkeysvalueof{/cfr/soul base dimension}, minimum width=3.5*\pgfkeysvalueof{/cfr/soul base dimension}, minimum height=6*\pgfkeysvalueof{/cfr/soul base dimension}] {};
    \node (-right arm) [right=0pt of -torso.north east, yshift=-3.1*\pgfkeysvalueof{/cfr/soul base dimension}, rectangle, minimum width=\pgfkeysvalueof{/cfr/soul base dimension}, minimum height=6*\pgfkeysvalueof{/cfr/soul base dimension}, rounded corners=.4*\pgfkeysvalueof{/cfr/soul base dimension}] {};
    \node (-left arm) [left=0pt of -torso.north west, yshift=-3.1*\pgfkeysvalueof{/cfr/soul base dimension}, rectangle, minimum width=\pgfkeysvalueof{/cfr/soul base dimension}, minimum height=6*\pgfkeysvalueof{/cfr/soul base dimension}, rounded corners=.4*\pgfkeysvalueof{/cfr/soul base dimension}] {};
    \node (-left leg) [below=0pt of -torso.south, rectangle, minimum width=1.5*\pgfkeysvalueof{/cfr/soul base dimension}, minimum height=6*\pgfkeysvalueof{/cfr/soul base dimension}, rounded corners=.2*\pgfkeysvalueof{/cfr/soul base dimension}, anchor=north east] {};
    \node (-right leg) [below=0pt of -torso.south, rectangle, minimum width=1.5*\pgfkeysvalueof{/cfr/soul base dimension}, minimum height=6*\pgfkeysvalueof{/cfr/soul base dimension}, rounded corners=.2*\pgfkeysvalueof{/cfr/soul base dimension}, anchor=north west] {};
    \draw [rounded corners=.2*\pgfkeysvalueof{/cfr/soul base dimension}] (-right leg.south) -- (-right leg.south west) -- (-left leg.south east) -- (-left leg.south west)  -- (-torso.south west) [rounded corners=.4*\pgfkeysvalueof{/cfr/soul base dimension}] -- (-left arm.south east) -- (-left arm.south west) -- (-left arm.north west) -- (-torso.north west) -- ($(-head.south) - (.5*\pgfkeysvalueof{/cfr/soul base dimension},0)$) arc [start angle=255.5, end angle=-74.5, radius=2*\pgfkeysvalueof{/cfr/soul base dimension}] -- (-torso.north east) -- (-right arm.north east) -- (-right arm.south east)  -- (-right arm.south west) [rounded corners=.2*\pgfkeysvalueof{/cfr/soul base dimension}] -- (-torso.south east)  -- (-right leg.south east) -- (-right leg.south west);
  }
  ]
  \pic (human being) {person};
  \pic (got the blues) [right=of human being-head, xshift=4*\pgfkeysvalueof{/cfr/soul base dimension}, blue] {person};
  \pic (in the pink) [right=of got the blues-head, xshift=4*\pgfkeysvalueof{/cfr/soul base dimension}, magenta] {person};
  \pic (half gone) [right=of in the pink-head, xshift=4*\pgfkeysvalueof{/cfr/soul base dimension},opacity=.5] {person};
  \pgfkeyssetvalue{/cfr/soul base dimension}{5pt}
  \pic (feeling small) [right=of half gone-right arm.east, xshift=4*\pgfkeysvalueof{/cfr/soul base dimension}, fill=red] {person};
\end{tikzpicture}
\end{document}

People

People Pic II

This is a similar idea to the first but also draws on the solutions others have posted for filled person shapes. It creates a person in the colour of your choice, rotated at the angle of your choice and labelled with the text of your choice. It could be adapted for various other permutations.

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning,fit}
\begin{document}

\tikzset{
  pobl/.style={
    inner sep=0pt, outer sep=0pt, fill=#1,
  },
  pobl gron/.style n args={2}{
    pobl=#1, rounded corners=#2,
  },
  pics/person/.style n args={3}{
    code={
      \node (-corff) [pobl=#1, minimum width=.25*#2, minimum height=.375*#2, rotate=#3, pic actions] {};
      \node (-pen) [minimum width=.3*#2, circle, pobl=#1, outer sep=.01*#2, anchor=south, rotate=#3, pic actions] at (-corff.north) {};
      \node (-coes dde) [pobl gron={#1}{1pt}, anchor=north west, minimum width=.12125*#2, minimum height=.25*#2, rotate=#3, pic actions] at (-corff.south west) {};
      \node [pobl=#1, anchor=north, minimum width=.12125*#2, minimum height=.15*#2, rotate=#3, pic actions] at (-coes dde.north) {};
      \node (-coes chwith) [pobl gron={#1}{1pt}, anchor=north east, minimum width=.12125*#2, minimum height=.25*#2, rotate=#3, pic actions] at (-corff.south east) {};
      \node [pobl=#1, anchor=north, minimum width=.12125*#2, minimum height=.15*#2, rotate=#3, pic actions] at (-coes chwith.north) {};
      \node (-braich dde) [pobl gron={#1}{.75pt}, minimum width=.075*#2, minimum height=.325*#2, outer sep=.0064*#2, anchor=north west, rotate=#3, pic actions] at (-corff.north east)  {};
      \node [pobl=#1, minimum width=.05*#2, minimum height=.2*#2, outer sep=.0064*#2, anchor=north west, rotate=#3, pic actions] at (-corff.north east) {};
      \node (-braich chwith) [pobl gron={#1}{.75pt}, minimum width=.075*#2, minimum height=.325*#2, outer sep=.0064*#2, anchor=north east, rotate=#3, pic actions] at (-corff.north west) {};
      \node [pobl=#1, minimum width=.0375*#2, minimum height=.2*#2, outer sep=.0064*#2, anchor=north east, rotate=#3, pic actions] at (-corff.north west) {};
      \node (-fit person) [fit={(-pen.north) (-braich dde.east) (-coes chwith.south) (-braich chwith.west)}] {};
      \node (-pwy) [below=25pt of -fit person, every pin] {\tikzpictext};
      \draw [every pin edge] (-fit person) -- (-pwy);
    },
  },
}

\begin{tikzpicture}
  [
    every pin edge/.append style={latex-, shorten <=-2.5pt},
  ]
  \draw pic (person) [pic text={A Person}] {person={blue}{25pt}{0}};
  \draw pic (sleepy) [right=35pt of person-braich dde.east, pic text={Sleepy Person}] {person={green}{25pt}{90}};
  \draw pic (gymnast) [right=70pt of person-braich dde.east, pic text={Gymnast}] {person={orange}{25pt}{180}};
  \draw pic (giant) [right=50pt of gymnast-braich dde.south east, pic text={Sleepy Giant}] {person={pink}{75pt}{-90}};
\end{tikzpicture}

\end{document}

people pics

share|improve this answer

Well since you are using TikZ environment anyhow, then loading marvosym becomes redundant (though nothing wrong with that by the way)

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows}
\begin{document}
\begin{tikzpicture}
\node[circle,fill,minimum size=5mm] (head) {};
\node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {};
\draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm);
\draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(-90:6mm);
\draw[thick,white,-round cap] (body.south) --++(90:5.5mm);
\end{tikzpicture}
\end{document}

enter image description here

then a little digression

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.callouts}
\begin{document}
\begin{tikzpicture}[manstyle/.style={line width=4pt,line cap=round,line join=round}]
\node[fill,circle,inner sep=2.5pt,outer sep=1pt] (head) at (-0.2mm,7.1mm) {}; 
\node[above left,anchor=pointer,scale=0.4,cloud callout, cloud puffs=10, aspect=2, cloud puff arc=120,
fill,text=white,callout relative pointer={(-4mm,-4mm)}] at (2mm,8mm){$\displaystyle\int_\pi l(d,t)\mathrm{d}t$};
\draw[manstyle] (0,0.5) -- ++(0,-1.2cm);
\draw[manstyle] (-1.5pt,-1pt) -- ++(0,0.535cm) (1.2pt,1pt) --(0,5mm)--++(-80:5mm) coordinate (g);
\draw[-latex] (g) -| (-25:8mm);
\draw[|-|,ultra thin] ([shift={(1mm,2mm)}]g) --++ (5.15mm,0) node [midway,above,scale=0.5] {$l$};
\node[fill,minimum height=7mm,rounded corners=2pt,outer xsep=1pt,outer ysep=0] (syphon) at (1.1cm,-0.45cm) {};
\fill[rounded corners=1pt] (syphon.south west) |-++(140:7mm) coordinate (d) arc (180:230:4mm) |- (syphon.south west) --cycle;
\draw[|-|,ultra thin] (d)++(-0.1mm,0) --++ (-3.1mm,0) node[midway,above,scale=0.5] {$d$};
\node[font=\scshape, align=center] (motto) at (5mm,-1.5cm) {Gents \\ Do It With \\ Precision};
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
7  
The restrooms in my university need one of these :) –  henrique Nov 27 '12 at 23:43

Here is a basic version as per your description, and added an option to control the smiley:

enter image description here

References:

Code:

\documentclass{article}
\usepackage{tikz}

% http://tex.stackexchange.com/questions/58901/something-between-frownie-and-smiley
\newcommand{\Simley}[3][]{%
    % #1 = draw options
    % #2 = smile factor
    % #3 = location
    %\begin{tikzpicture}[scale=0.4]
    \begin{scope}[shift={(#3)}, scale=0.4]
        \newcommand*{\SmileyRadius}{1.0}%
        \draw [thick, fill=brown!10, #1] (0,0) circle (\SmileyRadius);% outside circle

        \pgfmathsetmacro{\eyeX}{0.5*\SmileyRadius*cos(30)}
        \pgfmathsetmacro{\eyeY}{0.5*\SmileyRadius*sin(30)}
        \draw [fill=cyan,draw=none] (\eyeX,\eyeY) circle (0.15cm);
        \draw [fill=cyan,draw=none] (-\eyeX,\eyeY) circle (0.15cm);

        \pgfmathsetmacro{\xScale}{2*\eyeX/180}
        \pgfmathsetmacro{\yScale}{1.0*\eyeY}
        \draw[color=brown, thick, domain=-\eyeX:\eyeX]   
            plot ({\x},{
                -0.1+#2*0.15 % shift the smiley as smile decreases
                -#2*1.75*\yScale*(sin((\x+\eyeX)/\xScale))-\eyeY});
    \end{scope}
    %\end{tikzpicture}%
}%

\newcommand*{\Symbol}[3][]{%
    % #1 = draw options
    % #2 = smile factor
    % #3 = location
    %
    \begin{scope}[shift={(#3)}]
        %\draw [thick, fill=brown!25, #1] (0,0) circle (0.30cm);% Use this for no-smiley version
        \Simley[#1]{#2}{0,0.1}% Comment this out if you don't want smiley
        \draw [thick, fill=brown!10, #1] 
            (-0.4, -0.40) -- (0.4, -0.40) -- (0,-2.5) -- cycle;
    \end{scope}%
}%


\begin{document}
\begin{tikzpicture}
    \Symbol{1}{0,0}
    \Symbol[draw=black, fill=red!25, ultra thick]{0.25}{1,0}
    \Symbol[draw=blue, fill=green!20, ultra thick]{-1}{2,0}
\end{tikzpicture}
\end{document}
share|improve this answer
    
thanks @PeterGrill. If I want to put several \Symbol in a row or postion them above each other what would the correct coding be? –  Tahnoon Pasha Nov 26 '12 at 8:48
    
Have updated solution to show how to position them in a row. You can adjust the coordinate where they are placed to get them in a row. –  Peter Grill Nov 27 '12 at 1:17

An option if you're willing to includegraphics is to go to openclipart.org (or any other clip art site, download an icon in svg, convert it to pdf and simply include it. That's what I do for globes and such in my figures.

Update: To re-use the icon, you can define a new command:

\newcommand{\usericon}[1]{\includegraphics[width=#1\textwidth]{usericon}}

Then, wherever you want to put it, simply put it in a node like so:

\node (user) {\usericon{0.2}}; 
share|improve this answer
    
Thanks @recluze. Do you know if there is some way to put the \includegraphics into a \tikzset enivronment and then just call it in the style for each node? –  Tahnoon Pasha Nov 26 '12 at 9:25
    
Updated the answer :) –  recluze Nov 26 '12 at 11:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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