Debian Codegraph @

texmf-dist/tex/latex/tikzpeople/tikzpeople.sty

raw
1 %% Copyright 2016 Nils Fleischhacker
2 %%
3 %% This work may be distributed and/or modified under the
4 %% conditions of the LaTeX Project Public License, either
5 %% version 1.3 of this license or (at your option) any later
6 %% version. The latest version of this license is in
7 %%
8 %% http://www.latex-project.org/lppl.txt
9 %%
10 %% and version 1.3 or later is part of all distributions of
11 %% LaTeX version 2005/12/01 or later.
12 %%
13 %% This work has the LPPL maintenance status `maintained'.
14 %%
15 %% The Current Maintainer of this work is Nils Fleischhacker.
16 %%
17 %% This work consists of the files tikzpeople.tex, tikzpeople.sty,
18 %% tikzpeople.shape.alice.sty, tikzpeople.shape.bob.sty,
19 %% tikzpeople.shape.bride.sty, tikzpeople.shape.builder.sty,
20 %% tikzpeople.shape.businessman.sty, tikzpeople.shape.charlie.sty,
21 %% tikzpeople.shape.chef.sty, tikzpeople.shape.conductor.sty,
22 %% tikzpeople.shape.cowboy.sty, tikzpeople.shape.criminal.sty,
23 %% tikzpeople.shape.dave.sty, tikzpeople.shape.devil.sty,
24 %% tikzpeople.shape.duck.sty, tikzpeople.shape.graduate.sty,
25 %% tikzpeople.shape.groom.sty, tikzpeople.shape.guard.sty,
26 %% tikzpeople.shape.jester.sty, tikzpeople.shape.judge.sty,
27 %% tikzpeople.shape.maninblack.sty, tikzpeople.shape.mexican.sty,
28 %% tikzpeople.shape.nun.sty, tikzpeople.shape.nurse.sty,
29 %% tikzpeople.shape.physician.sty, tikzpeople.shape.pilot.sty,
30 %% tikzpeople.shape.police.sty, tikzpeople.shape.priest.sty,
31 %% tikzpeople.shape.sailor.sty, tikzpeople.shape.santa.sty,
32 %% tikzpeople.shape.surgeon.sty
33 \NeedsTeXFormat{LaTeX2e}
34 \ProvidesPackage{tikzpeople}[2017/04/22 v0.4 People shaped nodes for Tikz]
35
36 \RequirePackage{tikz}
37 \RequirePackage{calc}
38 \RequirePackage{etoolbox}
39 \newif\if@tikzpeople@draft\@tikzpeople@draftfalse
40 \DeclareOption{draft}{
41 \@tikzpeople@drafttrue
42 }
43 \newif\if@tikzpeople@demo\@tikzpeople@demofalse
44 \DeclareOption{demo}{
45 \@tikzpeople@demotrue
46 }
47 \newif\if@tikzpeople@nobeards\@tikzpeople@nobeardsfalse
48 \DeclareOption{nobeards}{
49 \@tikzpeople@nobeardstrue
50 }
51 \newif\if@tikzpeople@saturated\@tikzpeople@saturatedfalse
52 \DeclareOption{saturated}{
53 \@tikzpeople@saturatedtrue
54 }
55 \ProcessOptions\relax
56 \usepgflibrary{intersections}
57 \usetikzlibrary{decorations.markings,decorations.pathmorphing,calc,positioning,arrows.meta}
58
59 \newif\if@tikzpeople@mirrored
60 \pgfkeys{/tikz/mirrored/.is if=@tikzpeople@mirrored}
61 \newif\if@tikzpeople@female
62 \pgfkeys{/tikz/female/.is if=@tikzpeople@female}
63 \newif\if@tikzpeople@evil
64 \pgfkeys{/tikz/evil/.is if=@tikzpeople@evil}
65 \newif\if@tikzpeople@good
66 \pgfkeys{/tikz/good/.is if=@tikzpeople@good}
67 \newif\if@tikzpeople@monitor
68 \pgfkeys{/tikz/monitor/.is if=@tikzpeople@monitor}
69 \newif\if@tikzpeople@shield
70 \pgfkeys{/tikz/shield/.is if=@tikzpeople@shield}
71 \newif\if@tikzpeople@sword
72 \pgfkeys{/tikz/sword/.is if=@tikzpeople@sword}
73 \pgfkeys{/tikz/saturated/.is if=@tikzpeople@saturated}
74
75 \newcommand{\tikzpeople@addcolorkey}[1]{
76 \expandafter\def\csname tikzpeople@#1\endcsname{#1}
77 \pgfkeys{/tikz/#1/.code=\expandafter\def\csname tikzpeople@#1\endcsname{##1}}
78 }
79
80 \newcommand{\tikzpeople@addtextkey}[2]{
81 \expandafter\def\csname tikzpeople@#1\endcsname{#2}
82 \pgfkeys{/tikz/#1/.code=\expandafter\def\csname tikzpeople@#1\endcsname{##1}}
83 }
84
85 \tikzpeople@addcolorkey{horns}
86 \tikzpeople@addcolorkey{halo}
87 \tikzpeople@addcolorkey{shirt}
88 \tikzpeople@addcolorkey{undershirt}
89 \tikzpeople@addcolorkey{skin}
90 \tikzpeople@addcolorkey{hair}
91 \tikzpeople@addcolorkey{hat}
92 \tikzpeople@addcolorkey{pc}
93 \tikzpeople@addcolorkey{shieldmid}
94 \tikzpeople@addcolorkey{shieldedge}
95 \tikzpeople@addcolorkey{shieldrivets}
96 \tikzpeople@addcolorkey{swordblade}
97 \tikzpeople@addcolorkey{swordgrip}
98 \tikzpeople@addcolorkey{swordguard}
99 \tikzpeople@addcolorkey{swordpommel}
100
101 \pgfdeclareshape{person}{
102 \saveddimen{\scalingfactor}{
103 \setlength{\pgf@xa}{\pgfshapeminwidth}
104 \setlength{\pgf@xb}{9.075pt}
105 \ifdim\pgf@xa<\pgf@xb
106 \pgfsetshapeminwidth{9.075pt}
107 \fi
108 \setlength{\pgf@xa}{\pgfshapeminheight}
109 \setlength{\pgf@xb}{0.5cm}
110 \ifdim\pgf@xa<\pgf@xb
111 \pgfsetshapeminheight{0.5cm}
112 \fi
113 \setlength{\pgf@xa}{1pt*\ratio{\pgfshapeminwidth}{9.075pt}}
114 \setlength{\pgf@xb}{1pt*\ratio{\pgfshapeminheight}{12.1pt}}
115 \ifdim\pgf@xa<\pgf@xb
116 \setlength{\pgf@x}{1pt*\ratio{\pgfshapeminheight}{12.1pt}}
117 \else
118 \setlength{\pgf@x}{1pt*\ratio{\pgfshapeminwidth}{9.075pt}}
119 \fi
120 }
121
122 \saveddimen{\width}{
123 \pgf@x=\wd\pgfnodeparttextbox
124 }
125
126 \saveddimen{\height}{
127 \pgf@x=\ht\pgfnodeparttextbox
128 }
129
130 \saveddimen{\depth}{
131 \pgf@x=\dp\pgfnodeparttextbox
132 }
133
134 \savedanchor{\mouth}{
135 \if@tikzpeople@mirrored
136 \pgfpoint{-2.075}{1.7}
137 \else
138 \pgfpoint{2.4}{1.7}
139 \fi
140 }
141
142 \anchor{mouth}{
143 \pgfpointscale{\scalingfactor}{\mouth}
144 }
145 \anchor{north west}{
146 \pgfpointscale{\scalingfactor}{\pgfpoint{-4.375}{6.3}}
147 }
148 \anchor{north}{
149 \pgfpointscale{\scalingfactor}{\pgfpoint{0.1625}{6.3}}
150 }
151 \anchor{north east}{
152 \pgfpointscale{\scalingfactor}{\pgfpoint{4.7}{6.3}}
153 }
154 \anchor{east}{
155 \pgfpointscale{\scalingfactor}{\pgfpoint{4.7}{0.25}}
156 }
157 \anchor{south east}{
158 \pgfpointscale{\scalingfactor}{\pgfpoint{4.7}{-5.8}}
159 }
160 \anchor{south}{
161 \pgfpointscale{\scalingfactor}{\pgfpoint{0.1625}{-5.8}}
162 }
163 \anchor{south west}{
164 \pgfpointscale{\scalingfactor}{\pgfpoint{-4.375}{-5.8}}
165 }
166 \anchor{west}{
167 \pgfpointscale{\scalingfactor}{\pgfpoint{-4.375}{0.25}}
168 }
169 \anchor{center}{
170 \pgfpointscale{\scalingfactor}{\pgfpoint{0.1625}{0.25}}
171 }
172 \anchor{text}{
173 \pgfpoint{\scalingfactor*0.1625-0.5*\width}{\scalingfactor*-6.3-\depth-\height}
174 }
175 \anchor{base}{
176 \pgfpoint{\scalingfactor*0.1625}{\scalingfactor*-6.3-\depth-\height}
177 }
178 \anchor{base west}{
179 \pgfpoint{\scalingfactor*-4.375}{\scalingfactor*-6.3-\depth-\height}
180 }
181 \anchor{base east}{
182 \pgfpoint{\scalingfactor*4.7}{\scalingfactor*-6.3-\depth-\height}
183 }
184 \anchor{mid}{
185 \pgfpoint{\scalingfactor*0.1625}{\scalingfactor*-6.3-\depth-\height+.5ex}
186 }
187 \anchor{mid west}{
188 \pgfpoint{\scalingfactor*-4.375}{\scalingfactor*-6.3-\depth-\height+.5ex}
189 }
190 \anchor{mid east}{
191 \pgfpoint{\scalingfactor*4.7}{\scalingfactor*-6.3-\depth-\height+.5ex}
192 }
193
194 \anchorborder{
195 \@tempdima=\pgf@x
196 \@tempdimb=\pgf@y
197 \pgftransformshift{\pgfpoint{\scalingfactor*-0.1625}{\scalingfactor*0.4pt}}
198 \pgfpointborderellipse{\pgfpoint{\@tempdima}{\@tempdimb}}{\pgfpoint{\scalingfactor*5.9pt}{\scalingfactor*6.9pt}}
199 }
200
201
202 \beforebackgroundpath{
203 \pgftransformscale{\scalingfactor}
204 \if@tikzpeople@mirrored
205 \pgftransformxscale{-1}
206 \pgftransformxshift{-0.325}
207 \fi
208 \pgftransformshift{\pgfpoint{-0.3}{3.3}}
209 \if@tikzpeople@draft
210 \tikzpeople@person@draftstyles
211 \tikzpeople@person@paintshirt
212 \tikzpeople@person@paintrighthorn
213 \tikzpeople@person@painthead
214 \tikzpeople@person@paintgoatee
215 \tikzpeople@person@paintlefthorn
216 \tikzpeople@person@painthalo
217 \if@tikzpeople@shield
218 \tikzpeople@person@paintshield
219 \fi
220 \if@tikzpeople@sword
221 \tikzpeople@person@paintsword
222 \fi
223 \if@tikzpeople@monitor
224 \tikzpeople@person@paintmonitor
225 \fi
226 \else
227 \tikzpeople@definecommoncolors
228 \tikzpeople@definecommonstyles
229 \tikzpeople@person@paintshirt
230 \tikzpeople@person@paintrighthorn
231 \tikzpeople@person@painthead
232 \tikzpeople@person@painthair
233 \tikzpeople@person@paintlefthorn
234 \tikzpeople@person@paintgoatee
235 \tikzpeople@person@painthalo
236 \if@tikzpeople@shield
237 \tikzpeople@person@paintshield
238 \fi
239 \if@tikzpeople@sword
240 \tikzpeople@person@paintsword
241 \fi
242 \if@tikzpeople@monitor
243 \tikzpeople@person@paintmonitor
244 \fi
245 \fi
246 }
247 }
248
249 \newcommand{\tikzpeople@definecommonstyles}{
250 \if@tikzpeople@saturated
251 \tikzset{
252 shirt/.style= {color=\tikzpeople@shirt,top color=\tikzpeople@shirt!70, bottom color=\tikzpeople@shirt,shading angle=45},
253 hat/.style= {color=\tikzpeople@hat,top color=\tikzpeople@hat!70, bottom color=\tikzpeople@hat,shading angle=45},
254 undershirt/.style= {color=\tikzpeople@undershirt,top color=\tikzpeople@undershirt!70, bottom color=\tikzpeople@undershirt,shading angle=45},
255 skin/.style= {color=\tikzpeople@skin,top color=\tikzpeople@skin!70, bottom color=\tikzpeople@skin,shading angle=45},
256 hair/.style= {color=\tikzpeople@hair,top color=\tikzpeople@hair!70, bottom color=\tikzpeople@hair,shading angle=45},
257 goatee/.style= {color=\tikzpeople@hair,top color=\tikzpeople@hair!70, bottom color=\tikzpeople@hair,shading angle=45},
258 horns/.style= {color=\tikzpeople@horns,top color=\tikzpeople@horns!70, bottom color=\tikzpeople@horns,shading angle=45},
259 halo/.style= {color=\tikzpeople@halo,top color=\tikzpeople@halo!70, bottom color=\tikzpeople@halo,shading angle=45},
260 shieldmid/.style= {color=\tikzpeople@shieldmid,top color=\tikzpeople@shieldmid!70, bottom color=\tikzpeople@shieldmid,shading angle=45,line join=bevel},
261 shieldedge/.style= {color=\tikzpeople@shieldedge,top color=\tikzpeople@shieldedge!70, bottom color=\tikzpeople@shieldedge,shading angle=45,line join=bevel},
262 shieldrivets/.style={color=\tikzpeople@shieldrivets,top color=\tikzpeople@shieldrivets!70, bottom color=\tikzpeople@shieldrivets,shading angle=45},
263 swordblade/.style= {color=\tikzpeople@swordblade,top color=\tikzpeople@swordblade!70, bottom color=\tikzpeople@swordblade,shading angle=45},
264 swordguard/.style= {color=\tikzpeople@swordguard,top color=\tikzpeople@swordguard!70, bottom color=\tikzpeople@swordguard,shading angle=45},
265 swordpommel/.style= {color=\tikzpeople@swordpommel,top color=\tikzpeople@swordpommel!70, bottom color=\tikzpeople@swordpommel,shading angle=45},
266 swordgrip/.style= {color=\tikzpeople@swordgrip,top color=\tikzpeople@swordgrip!70, bottom color=\tikzpeople@swordgrip,shading angle=45},
267 monitor1/.style= {color=\tikzpeople@pc, top color=\tikzpeople@pc, bottom color=\tikzpeople@pc!70,shading angle=90},
268 monitor2/.style= {color=\tikzpeople@pc, top color=\tikzpeople@pc, bottom color=\tikzpeople@pc!90,shading angle=90},
269 monitor3/.style= {color=\tikzpeople@pc, top color=\tikzpeople@pc!80, bottom color=\tikzpeople@pc!70,shading angle=90},
270 monitor4/.style= {color=\tikzpeople@pc, top color=\tikzpeople@pc!60, bottom color=\tikzpeople@pc!50,shading angle=90},
271 }
272 \else
273 \tikzset{
274 shirt/.style= {color=\tikzpeople@shirt!80,top color=\tikzpeople@shirt!40, bottom color=\tikzpeople@shirt!80,shading angle=45},
275 hat/.style= {color=\tikzpeople@hat!80,top color=\tikzpeople@hat!40, bottom color=\tikzpeople@hat!80,shading angle=45},
276 undershirt/.style= {color=\tikzpeople@undershirt!80,top color=\tikzpeople@undershirt!40, bottom color=\tikzpeople@undershirt!80,shading angle=45},
277 skin/.style= {color=\tikzpeople@skin!80,top color=\tikzpeople@skin!40, bottom color=\tikzpeople@skin!80,shading angle=45},
278 hair/.style= {color=\tikzpeople@hair!80,top color=\tikzpeople@hair!40, bottom color=\tikzpeople@hair!80,shading angle=45},
279 goatee/.style= {color=\tikzpeople@hair!80,top color=\tikzpeople@hair!40, bottom color=\tikzpeople@hair!80,shading angle=45},
280 horns/.style= {color=\tikzpeople@horns!80,top color=\tikzpeople@horns!40, bottom color=\tikzpeople@horns!80,shading angle=45},
281 halo/.style= {color=\tikzpeople@halo!80,top color=\tikzpeople@halo!40, bottom color=\tikzpeople@halo!80,shading angle=45},
282 shieldmid/.style= {color=\tikzpeople@shieldmid!80,top color=\tikzpeople@shieldmid!40, bottom color=\tikzpeople@shieldmid!80,shading angle=45,line join=bevel},
283 shieldedge/.style= {color=\tikzpeople@shieldedge!80,top color=\tikzpeople@shieldedge!40, bottom color=\tikzpeople@shieldedge!80,shading angle=45,line join=bevel},
284 shieldrivets/.style={color=\tikzpeople@shieldrivets!80,top color=\tikzpeople@shieldrivets!40, bottom color=\tikzpeople@shieldrivets!80,shading angle=45},
285 swordblade/.style= {color=\tikzpeople@swordblade!80,top color=\tikzpeople@swordblade!40, bottom color=\tikzpeople@swordblade!80,shading angle=45},
286 swordguard/.style= {color=\tikzpeople@swordguard!80,top color=\tikzpeople@swordguard!40, bottom color=\tikzpeople@swordguard!80,shading angle=45},
287 swordpommel/.style= {color=\tikzpeople@swordpommel!80,top color=\tikzpeople@swordpommel!40, bottom color=\tikzpeople@swordpommel!80,shading angle=45},
288 swordgrip/.style= {color=\tikzpeople@swordgrip!80,top color=\tikzpeople@swordgrip!40, bottom color=\tikzpeople@swordgrip!80,shading angle=45},
289 monitor1/.style= {color=\tikzpeople@pc!80, top color=\tikzpeople@pc!80, bottom color=\tikzpeople@pc!40,shading angle=90},
290 monitor2/.style= {color=\tikzpeople@pc!80, top color=\tikzpeople@pc!80, bottom color=\tikzpeople@pc!70,shading angle=90},
291 monitor3/.style= {color=\tikzpeople@pc!80, top color=\tikzpeople@pc!60, bottom color=\tikzpeople@pc!50,shading angle=90},
292 monitor4/.style= {color=\tikzpeople@pc!80, top color=\tikzpeople@pc!40, bottom color=\tikzpeople@pc!30,shading angle=90},
293 }
294 \fi
295 }
296
297 \newcommand{\tikzpeople@person@draftstyles}{
298 \tikzset{
299 shirt/.style= {color=black,fill=white},
300 skin/.style= {color=black,fill=white},
301 goatee/.style= {color=black,fill=white},
302 horns/.style= {color=black,fill=white},
303 halo/.style= {color=black,fill=white},
304 shieldedge/.style= {color=black,fill=white},
305 swordblade/.style= {color=black,fill=white},
306 swordguard/.style= {color=black,fill=white},
307 swordpommel/.style= {color=black,fill=white},
308 swordgrip/.style= {color=black,fill=white},
309 }
310 }
311
312 \newcommand{\tikzpeople@definecommoncolors}{
313 \definecolor{horns}{named}{red}
314 \definecolor{halo}{named}{yellow}
315 \definecolor{skin}{rgb}{0.84,0.58,0.24}
316 \definecolor{shirt}{rgb}{0.34,0.56,0.22}
317 \definecolor{hair}{rgb}{0.45,0.24,0}
318 \definecolor{pc}{rgb}{.2,.2,.2}
319 \definecolor{shieldedge}{RGB}{83,84,85}
320 \definecolor{shieldrivets}{RGB}{25,25,26}
321 \definecolor{shieldmid}{RGB}{197,22,9}
322 \definecolor{swordblade}{RGB}{83,84,85}
323 \definecolor{swordguard}{RGB}{147,131,104}
324 \definecolor{swordpommel}{RGB}{147,131,104}
325 \definecolor{swordgrip}{RGB}{81,57,48}
326 }
327
328 \newcommand{\tikzpeople@person@paintshirt}{
329 \draw[shirt]
330 (-4.0pt,-8.0pt) .. controls (-2pt,-10pt) and ( 3pt,-9pt) ..
331 ( 5.0pt,-7.0pt) .. controls ( 5pt, 0pt) and (-5pt, 0pt) ..
332 (-4.0pt,-8.0pt) -- cycle;
333 }
334
335 \newcommand{\tikzpeople@person@painthead}{
336 \draw[skin] (0pt,0pt) circle (3pt);
337 }
338
339 \newcommand{\tikzpeople@person@painthair}{
340 \if@tikzpeople@female
341 \tikzpeople@person@paintfemalehair
342 \else
343 \draw[hair]
344 (25:3pt) arc (25:210:3pt) -- (-2.6pt,-0.5pt) -- (-1.7pt,-1pt) --
345 (-1.7pt,0.8pt) to[out=350,in=210] (25:3pt) -- cycle;
346 \fi
347 }
348
349 \newcommand{\tikzpeople@person@painthairstyletwo}{
350 \if@tikzpeople@female
351 \tikzpeople@person@paintfemalehairstyletwo
352 \else
353 \draw[hair]
354 (15:3pt) arc (15:210:3pt) -- ++(0.3pt,0pt) -- ++(0.1pt,0.5pt)
355 .. controls +(310:.2pt) .. ++(0.2pt,-0.6pt) -- ++(0.4pt,0pt)
356 .. controls +(90:1pt) .. (-1.7pt,0.4pt) to[out=350,in=210]
357 (15:3pt) -- cycle;
358 \fi
359 }
360
361 \newcommand{\tikzpeople@person@paintfemalehairstyletwo}{
362 \draw[hair]
363 (15:3pt) arc (15:165:3pt) .. controls +(260:1pt) .. (215:4.5pt) --
364 ++(4:0.5pt) -- ++(70:0.5pt) -- ++(285:0.4pt) -- ++(0:1.5pt) --
365 (-1.6pt,0pt) to [out=350,in=210] (15:3pt) -- cycle;
366 }
367
368 \newcommand{\tikzpeople@person@paintfemalehairstylethree}{
369 \draw[hair]
370 (15:3pt) arc (15:180:3.3pt) .. controls +(269:3pt) and +(190:1.5pt)
371 .. (250:3.4pt) .. controls +(118:1.2pt) .. (-1.6pt,0pt) to [out=350,in=210]
372 (15:3pt)-- cycle;
373 }
374
375 \newcommand{\tikzpeople@person@paintgoatee}{
376 \if@tikzpeople@nobeards
377 \else
378 \if@tikzpeople@evil
379 {
380 \pgftransformrotate{5}
381 \draw[goatee] (285:1.75pt)
382 -- ++(0:1pt) arc[start angle=90, end angle=0, x radius=.55pt, y radius=.5pt]
383 -- ++(270:.5pt) arc[start angle=0, end angle=-90, x radius=.55pt, y radius=.5pt]
384 -- ++(180:1pt) arc[start angle=-90, end angle=-180, x radius=.55pt, y radius=.5pt]
385 -- ++(90:.5pt) arc[start angle=180, end angle=90, x radius=.55pt, y radius=.5pt]
386 (285:1.75pt) ++(.1875pt,-.3pt)
387 arc[start angle=90,end angle=270,x radius=.45pt, y radius=.3pt]
388 -- ++(0:.6pt) arc[start angle=-90,end angle=90,x radius=.45pt, y radius=.3pt]
389 -- ++(180:.6pt);
390 }
391 \fi
392 \fi
393 }
394
395 \newcommand{\tikzpeople@person@paintlefthorn}{
396 \if@tikzpeople@evil
397 \draw[horns]
398 (140:2.5pt) arc (-90:-170:2pt) arc (0:180:0.04pt) arc (190:240:4pt)
399 to[out=70,in=290] (140:2.5pt) -- cycle;
400 \fi
401 }
402
403 \newcommand{\tikzpeople@person@paintrighthorn}{
404 \if@tikzpeople@evil
405 \draw[horns]
406 (40:2.5pt) arc (-90:-10:2pt) arc (180:0:0.04pt) arc (-10:-60:4pt)
407 to[out=110,in=250] (40:2.5pt) -- cycle;
408 \fi
409 }
410
411 \newcommand{\tikzpeople@person@painthalo}{
412 \if@tikzpeople@good
413 \draw[fill,halo,even odd rule]
414 (0.1pt,4.5pt) ellipse (2.8pt and 0.8pt) ++(0pt,.1pt) ellipse
415 (2pt and 0.5pt);
416 \fi
417 }
418
419 \newcommand{\tikzpeople@person@paintfemalehair}{
420 \draw[hair]
421 (15:3pt) arc (15:180:3pt) .. controls +(273:2pt) and +(190:2pt) ..
422 (260:3.3pt) .. controls +(140:1pt) .. (-1.6pt,0pt) to [out=350,in=210]
423 (15:3pt) -- cycle;
424 }
425
426 \newcommand{\tikzpeople@person@paintshield}{
427 \path
428 (1pt,-3.7pt) coordinate (tikzpeople@shield1) +(-.2pt,.1pt) coordinate
429 (tikzpeople@shield6) ++(1.2pt,1.2pt) coordinate (tikzpeople@shield2)
430 ++(3.5pt,1.3pt) coordinate (tikzpeople@shield3) ++(.8pt,-.75pt) coordinate
431 (tikzpeople@shield4) ++(-2pt,-6.5pt) coordinate (tikzpeople@shield5)
432 --cycle;
433 \draw[shieldedge]
434 (tikzpeople@shield1) -- (tikzpeople@shield6) to[out=0,in=270]
435 ++(1.2pt,1.2pt) -- (tikzpeople@shield2) to[out=270,in=0]
436 (tikzpeople@shield1) --cycle;
437 \draw[shieldedge]
438 (tikzpeople@shield3) -- ++(-.2pt,.1pt) to[out=265,in=220]
439 ++(.8pt,-.75pt) -- (tikzpeople@shield4) to[out=220,in=265]
440 (tikzpeople@shield3) --cycle;
441 \draw[shieldedge]
442 (tikzpeople@shield2) -- ++(-.2pt,.1pt) .. controls +(5:1.5pt) and
443 +(220:1.5pt) .. ++(3.5pt,1.3pt) -- (tikzpeople@shield3) .. controls
444 +(220:1.5pt) and +(5:1.5pt) .. (tikzpeople@shield2) --cycle;
445 \draw[shieldedge]
446 (tikzpeople@shield5) -- ++(-.2pt,.1pt) .. controls +(170:1.5pt) and
447 +(270:3pt) .. (tikzpeople@shield6) -- (tikzpeople@shield1) .. controls
448 +(270:3pt) and +(170:1.5pt) .. (tikzpeople@shield5) --cycle;
449 \draw[shieldedge]
450 (tikzpeople@shield1) to[out=0,in=270] (tikzpeople@shield2) .. controls
451 +(5:1.5pt) and +(220:1.5pt) .. (tikzpeople@shield3) to[out=265,in=220]
452 (tikzpeople@shield4) .. controls +(270:3pt) and +(30:1.5pt) ..
453 (tikzpeople@shield5) .. controls +(170:1.5pt) and +(270:3pt) ..
454 (tikzpeople@shield1) --cycle;
455 \if@tikzpeople@draft\else
456 \draw[shieldmid]
457 ($(tikzpeople@shield1)+(315:.5pt)$) to[out=10,in=260]
458 ($(tikzpeople@shield2)+(315:.5pt)$) .. controls +(7:1.2pt) and
459 +(215:1.2pt) .. ($(tikzpeople@shield3)+(250:.75pt)$) to[out=280,in=180]
460 ($(tikzpeople@shield4)+(235:.625pt)$) .. controls +(270:2.2pt) and
461 +(30:1.1pt) .. ($(tikzpeople@shield5)+(90:.5pt)$) .. controls
462 +(172:1.1pt) and +(271:2.2pt) .. ($(tikzpeople@shield1)+(315:.5pt)$)
463 --cycle;
464 \begin{scope}
465 \clip
466 ($(tikzpeople@shield1)+(315:.3pt)$) coordinate (tikzpeople@rivet1) circle (.05pt)
467 ($(tikzpeople@shield2)+(315:.3pt)$) coordinate (tikzpeople@rivet2) circle (.05pt)
468 ($(tikzpeople@shield3)+(250:.45pt)$) coordinate (tikzpeople@rivet3) circle (.05pt)
469 ($(tikzpeople@shield4)+(235:.4pt)$) coordinate (tikzpeople@rivet4) circle (.05pt)
470 ($(tikzpeople@shield5)+(90:.3pt)$) coordinate (tikzpeople@rivet5) circle (.05pt);
471 \path[shieldrivets] (tikzpeople@rivet1) ++(-.025pt,.025pt) circle (.12pt);
472 \path[shieldrivets] (tikzpeople@rivet2) ++(-.025pt,.025pt) circle (.12pt);
473 \path[shieldrivets] (tikzpeople@rivet3) ++(-.025pt,.025pt) circle (.12pt);
474 \path[shieldrivets] (tikzpeople@rivet4) ++(-.025pt,.025pt) circle (.12pt);
475 \path[shieldrivets] (tikzpeople@rivet5) ++(-.025pt,.025pt) circle (.12pt);
476 \end{scope}
477 \fi
478 }
479
480 \newcommand{\tikzpeople@person@paintsword}{
481 \begin{scope}
482 \pgftransformrotate{-30}
483 \pgftransformshift{\pgfpoint{1.7pt}{-.2pt}}
484 \draw[swordpommel]
485 (-.4pt,-8.9pt) -- ++(0pt,-.1pt) arc (180:360:.4pt and .15pt) --
486 ++(0pt,.1pt); ellipse (.4pt and .15pt);
487 \draw[swordpommel] (0pt,-8.9pt) ellipse (.4pt and .15pt);
488 \draw[swordgrip]
489 (-.2pt,-7.1pt) to[out=265,in=95] (-.2pt,-8.9pt) to[out=345,in=195]
490 (.2pt,-8.9pt) to[out=85,in=275] (.2pt,-7.1pt);
491 \draw[skin] (0pt,-8.1pt) ellipse (.6pt and .7pt);
492 \draw[swordguard]
493 (0pt,-7.45pt) to[out=0,in=270] (1.4pt,-6.5pt) -- ++(-.1pt,-.1pt)
494 to[out=270,in=0] (0pt,-7.45pt); to[out=0,in=270] (1.2pt,-6.6pt) --
495 ++(.1pt,.1pt) to[out=270,in=0] (0pt,-6.8pt);
496 \draw[swordguard]
497 (0pt,-6.8pt) to[out=180,in=270] (-1.1pt,-6.5pt) -- ++(-.1pt,-.1pt)
498 to[out=270,in=180] (0pt,-7.2pt) to[out=0,in=270] (1.2pt,-6.6pt) --
499 ++(.1pt,.1pt) to[out=270,in=0] (0pt,-6.8pt);
500 \draw[swordguard]
501 (-1.2pt,-6.6pt) -- ++(0.1pt,0.1pt) -- ++(-0.1pt,0pt) -- ++(-0.1pt,-0.1pt)
502 --cycle;
503 \draw[swordguard]
504 (1.2pt,-6.6pt) -- ++(0.1pt,0.1pt) -- ++(0.1pt,0pt) -- ++(-0.1pt,-0.1pt)
505 --cycle;
506 \draw[swordguard]
507 (0pt,-7.2pt) to[out=180,in=270] (-1.2pt,-6.6pt) -- ++(-.1pt,0pt)
508 to[out=270,in=180] (0pt,-7.45pt) to[out=0,in=270] (1.3pt,-6.6pt) --
509 ++(-.1pt,0pt) to[out=270,in=0] (0pt,-7.2pt);
510 \draw[swordblade]
511 (-.4pt,-7pt) -- (-.4pt,-1.5pt) to[out=90,in=240] (0pt,2pt)
512 to[out=300,in=90] (.4pt,-1.5pt) -- (.4pt,-7pt) to[out=190,in=350]
513 (-.4pt,-7pt);
514 {
515 \clip
516 (-.4pt,-7pt) -- (-.4pt,-1.5pt) to[out=90,in=240] (0pt,1pt)
517 to[out=300,in=90] (.4pt,-1.5pt) -- (.4pt,-7pt) to[out=190,in=350]
518 (-.4pt,-7pt);
519 \draw[swordblade, line width=.05*\scalingfactor,cap=round]
520 (0pt,-7.04pt) -- (0pt,.7pt);
521 }
522 \end{scope}
523 }
524
525 \newcommand{\tikzpeople@person@paintmonitor}{
526 \if@tikzpeople@draft
527 \path[draw=black,fill=white]
528 (2.3pt,-2.3pt) -- ++(14:7.3pt) -- ++(340:.27pt) coordinate (tikzpeople@tmp) --
529 ++(264:6.2pt) -- ++(195.5:7.35pt) coordinate (tikzpeople@tmp2) -- ++(135:.3pt)
530 --cycle;
531 \path[draw=black]
532 (2.3pt,-2.3pt) ++(330:.28pt) coordinate (tikzpeople@tmp3)
533 (tikzpeople@tmp2) -- (tikzpeople@tmp3) -- (tikzpeople@tmp);
534 \path[draw=black]
535 (3pt,-3pt) -- ++(14.5:6.4pt) -- ++(264:5.3pt) -- ++(195.5:6.35pt)
536 coordinate (tikzpeople@tmp) --cycle;
537 \path[draw=black,line width=.15*\scalingfactor,cap=butt]
538 (tikzpeople@tmp) -- (3pt,-3pt) -- ++(14.5:6.4pt);
539 \path[draw=black,fill=white]
540 (6.1pt,-4.8pt) ++(190:.6pt) ++(280:4pt) ++(-1.5pt,.2pt) coordinate (tikzpeople@tmp)
541 -- ++(325:1.6pt) -- ++(15:3.7pt) -- ++(145:1.6pt) --cycle;
542 \path[draw=black]
543 (tikzpeople@tmp) -- ++(0,-.2pt) -- ++(325:1.6pt) -- ++(15:3.7pt) -- ++(0,.2pt);
544 \path (6.1pt,-4.8pt) ++(17:.8pt) coordinate (tikzpeople@tmp);
545 \path[draw=black,fill=white]
546 (tikzpeople@tmp) ++(0,.01pt) -- ++(194:1.5pt) -- ++(280:4pt) -- ++(0:.07pt) --
547 ++(17:.5pt) --cycle;
548 \path[draw=black,fill=white]
549 (6.1pt,-4.8pt) ++(190:.6pt) -- ++(280:4pt) coordinate (tikzpeople@tmp2) -- ++(15:2pt)
550 -- (tikzpeople@tmp) --cycle;
551 \else
552 \path[monitor1]
553 (2.3pt,-2.3pt) -- ++(14:7.3pt) -- ++(340:.27pt) coordinate (tikzpeople@tmp) --
554 ++(195:7.3pt) -- ++(264:6.2pt) coordinate (tikzpeople@tmp2) -- ++(150:.27pt) --cycle;
555 \path[monitor3]
556 (2.3pt,-2.3pt) ++(330:.28pt) -- (tikzpeople@tmp) -- ++(264:6.2pt) -- (tikzpeople@tmp2) --cycle;
557 \path[monitor4]
558 (3pt,-3pt) -- ++(14.5:6.4pt) -- ++(264:5pt) -- ++(195:6.35pt)
559 coordinate (tikzpeople@tmp) --cycle;
560 \path[draw,color=\tikzpeople@pc\if@tikzpeople@saturated\else!80\fi,line width=.15*\scalingfactor,cap=butt]
561 (tikzpeople@tmp) -- (3pt,-3pt) -- ++(14.5:6.4pt);
562 \begin{scope}
563 \pgftransformshift{\pgfpoint{6pt}{-4.7pt}}
564 \pgftransformxslant{0.15}
565 \path[monitor1]
566 (0,0) ellipse (1.3pt and 2pt);
567 \path[monitor3]
568 (.1pt,-.1pt) ellipse (1.3pt and 2pt);
569 \end{scope}
570 \path[monitor2]
571 (6.05pt,-4.8pt) ++(160:.9pt) -- ++(15:2pt) -- ++(265:1pt) -- ++(195:2pt)
572 --cycle;
573 \path (6.1pt,-4.8pt) ++(17:.8pt) coordinate (tikzpeople@tmp);
574 \path[monitor1]
575 (6.1pt,-4.8pt) ++(190:.6pt) ++(280:4pt) ++(-1.5pt,.2pt) -- ++(0,-.2pt) --
576 ++(325:1.6pt) -- ++(15:3.7pt) -- ++(0,.2pt) -- cycle;
577 \path[monitor3]
578 (6.1pt,-4.8pt) ++(190:.6pt) ++(280:4pt) ++(-1.5pt,.2pt) -- ++(325:1.6pt)
579 -- ++(15:3.7pt) -- ++(145:1.6pt) --cycle;
580 \path[monitor2]
581 (6.1pt,-4.8pt) ++(190:.6pt) ++(280:4pt) ++(-.6pt,.2pt) -- ++(325:.8pt) --
582 ++(15:2.5pt) -- ++(145:.8pt) --cycle;
583 \path[monitor2]
584 (tikzpeople@tmp) ++(0,.01pt) -- ++(194:1.5pt) -- ++(280:4pt) -- ++(0:.07pt) --
585 ++(17:.5pt) --cycle;
586 \path[monitor3]
587 (6.1pt,-4.8pt) ++(190:.6pt) -- ++(280:4pt) coordinate (tikzpeople@tmp2) -- ++(15:2pt)
588 -- (tikzpeople@tmp) --cycle;
589 \fi
590 }
591
592
593 \newcommand{\tikzpeople@declareshape}[1]{
594 \if@tikzpeople@draft
595 \pgfdeclareshape{#1}{
596 \inheritsavedanchors[from={person}]
597 \inheritanchor[from={person}]{north west}
598 \inheritanchor[from={person}]{north}
599 \inheritanchor[from={person}]{north east}
600 \inheritanchor[from={person}]{east}
601 \inheritanchor[from={person}]{south east}
602 \inheritanchor[from={person}]{south}
603 \inheritanchor[from={person}]{south west}
604 \inheritanchor[from={person}]{west}
605 \inheritanchor[from={person}]{center}
606 \inheritanchor[from={person}]{text}
607 \inheritanchor[from={person}]{base}
608 \inheritanchor[from={person}]{base west}
609 \inheritanchor[from={person}]{base east}
610 \inheritanchor[from={person}]{mid}
611 \inheritanchor[from={person}]{mid west}
612 \inheritanchor[from={person}]{mid east}
613 \inheritanchor[from={person}]{mouth}
614 \inheritanchorborder[from={person}]
615
616 \beforebackgroundpath{
617 \pgftransformscale{\scalingfactor}
618 \if@tikzpeople@mirrored
619 \pgftransformxscale{-1}
620 \pgftransformxshift{-0.325}
621 \fi
622 \pgftransformshift{\pgfpoint{-0.3}{3.3}}
623 \tikzpeople@person@draftstyles
624 \tikzpeople@person@paintshirt
625 \tikzpeople@person@paintrighthorn
626 \tikzpeople@person@painthead
627 \tikzpeople@person@paintgoatee
628 \tikzpeople@person@paintlefthorn
629 \tikzpeople@person@painthalo
630 \if@tikzpeople@shield
631 \tikzpeople@person@paintshield
632 \fi
633 \if@tikzpeople@sword
634 \tikzpeople@person@paintsword
635 \fi
636 \if@tikzpeople@monitor
637 \tikzpeople@person@paintmonitor
638 \fi
639 }
640 }
641 \else
642 \input{tikzpeople.shape.#1.sty}
643 \pgfdeclareshape{#1}{
644 \inheritsavedanchors[from={person}]
645 \inheritanchor[from={person}]{north west}
646 \inheritanchor[from={person}]{north}
647 \inheritanchor[from={person}]{north east}
648 \inheritanchor[from={person}]{east}
649 \inheritanchor[from={person}]{south east}
650 \inheritanchor[from={person}]{south}
651 \inheritanchor[from={person}]{south west}
652 \inheritanchor[from={person}]{west}
653 \inheritanchor[from={person}]{center}
654 \inheritanchor[from={person}]{text}
655 \inheritanchor[from={person}]{base}
656 \inheritanchor[from={person}]{base west}
657 \inheritanchor[from={person}]{base east}
658 \inheritanchor[from={person}]{mid}
659 \inheritanchor[from={person}]{mid west}
660 \inheritanchor[from={person}]{mid east}
661 \inheritanchor[from={person}]{mouth}
662 \inheritanchorborder[from={person}]
663
664 \beforebackgroundpath{
665 \pgftransformscale{\scalingfactor}
666 \if@tikzpeople@mirrored
667 \pgftransformxscale{-1}
668 \pgftransformxshift{-0.325}
669 \fi
670 \pgftransformshift{\pgfpoint{-0.3}{3.3}}
671 \tikzpeople@definecommoncolors
672 \csname tikzpeople@#1@definecolors\endcsname
673 \tikzpeople@definecommonstyles
674 \csname tikzpeople@#1@definestyles\endcsname
675 \begin{scope}
676 \csname tikzpeople@#1@paint\endcsname
677 \end{scope}
678 \if@tikzpeople@shield
679 \tikzpeople@person@paintshield
680 \fi
681 \if@tikzpeople@sword
682 \tikzpeople@person@paintsword
683 \fi
684 \if@tikzpeople@monitor
685 \tikzpeople@person@paintmonitor
686 \fi
687 }
688 }
689 \fi
690 \if@tikzpeople@demo
691 \ifdef{\tikzpeople@shapelist}{
692 \appto\tikzpeople@shapelist{,#1}
693 }{
694 \def\tikzpeople@shapelist{#1}
695 }
696 \stepcounter{tikzpeople@totalshapes}
697 \fi
698 }
699
700 \if@tikzpeople@demo
701 \RequirePackage{xparse}
702 \RequirePackage{capt-of}
703 \RequirePackage{xifthen}
704 \newcounter{tikzpeople@shaperow}
705 \newcounter{tikzpeople@shapecolumn}
706 \newcounter{tikzpeople@shapenum}
707 \newcounter{tikzpeople@totalshapes}
708 \newlength{\tikzpeople@figwidth}
709 \newlength{\tikzpeople@captionht}
710
711 \newcommand{\tikzpeople@horizontalseparation}[1]{
712 \draw
713 ($#1*(-1,1.25) + {2.5*#1}*(0,-\value{tikzpeople@shaperow})$) --
714 +(${2*#1}*(\value{tikzpeople@shapecolumn},0)$);
715 }
716
717 \newcommand{\tikzpeople@verticalseparation}[1]{
718 \draw
719 ($#1*(-1,1.25) + {2*#1}*(\value{tikzpeople@shapecolumn},0) + {2.5*#1}*(0,-\value{tikzpeople@shaperow})$)
720 -- +($2.5*(0,-#1)$);
721 }
722
723 \NewDocumentCommand\alltikzpeople{smm}{%
724 \setlength{\tikzpeople@figwidth}{#2cm}
725 \edef\tikzpeople@foreachshape{\noexpand\foreach \noexpand\tikzpeople@shape in {\tikzpeople@shapelist}}
726 \edef\tikzpeople@numcols{\the\numexpr(\textwidth-(\tikzpeople@figwidth))/(2*\tikzpeople@figwidth)\relax}
727 \addtocounter{figure}{10}
728 \settototalheight{\tikzpeople@captionht}{%
729 \vbox{\captionof{figure}{All available characters with \texttt{minimum width=#2cm} and no additional options.}}
730 }%
731 \addtocounter{figure}{-11}
732 \edef\tikzpeople@numrows{\the\numexpr(2*(\textheight-\tikzpeople@captionht)-(5*\tikzpeople@figwidth/2))/(5*\tikzpeople@figwidth)\relax}
733 \edef\tikzpeople@numshapes{\the\numexpr\tikzpeople@numcols*\tikzpeople@numrows\relax}
734 \edef\tikzpeople@numfigs{\the\numexpr\value{tikzpeople@totalshapes}/\tikzpeople@numshapes\relax}
735 \ifthenelse{\numexpr\tikzpeople@numfigs*\tikzpeople@numshapes\relax<\value{tikzpeople@totalshapes}}{
736 \edef\tikzpeople@numfigs{\the\numexpr\tikzpeople@numfigs+1\relax}
737 }{}
738 \foreach \tikzpeople@fignum in {1,...,\tikzpeople@numfigs}{
739 \begin{figure}[htp]
740 \centering
741 \setcounter{tikzpeople@shapecolumn}{0}
742 \setcounter{tikzpeople@shaperow}{0}
743 \setcounter{tikzpeople@shapenum}{0}
744 \begin{tikzpicture}
745 \tikzpeople@foreachshape{
746 \stepcounter{tikzpeople@shapenum}
747 \ifthenelse{\value{tikzpeople@shapenum} > \numexpr(\tikzpeople@fignum-1)*\tikzpeople@numshapes\relax}{
748 \ifthenelse{\value{tikzpeople@shapenum} < \numexpr\tikzpeople@fignum*\tikzpeople@numshapes+1\relax}{
749 \coordinate (\tikzpeople@shape) at (${2*#2}*(\value{tikzpeople@shapecolumn},0) + {2.5*#2}*(0,-\value{tikzpeople@shaperow})$);
750 \node[minimum width=#2cm,\tikzpeople@shape,#3] at (\tikzpeople@shape) {\texttt{\IfBooleanTF#1{}{\tikzpeople@shape}}};
751 \tikzpeople@verticalseparation{#2}
752 \stepcounter{tikzpeople@shapecolumn}
753 \ifthenelse{\value{tikzpeople@shapecolumn}=\tikzpeople@numcols}{
754 \tikzpeople@verticalseparation{#2}
755 \ifthenelse{\value{tikzpeople@shaperow}=0}{\tikzpeople@horizontalseparation{#2}}{}
756 \stepcounter{tikzpeople@shaperow}
757 \tikzpeople@horizontalseparation{#2}
758 \setcounter{tikzpeople@shapecolumn}{0}
759 }{}
760 }{}
761 }{}
762 }
763 \ifthenelse{\value{tikzpeople@shapecolumn}=0}{}{
764 \tikzpeople@verticalseparation{#2}
765 \ifthenelse{\value{tikzpeople@shaperow}=0}{\tikzpeople@horizontalseparation{#2}}{}
766 \stepcounter{tikzpeople@shaperow}
767 \tikzpeople@horizontalseparation{#2}
768 }
769 \end{tikzpicture}
770 \caption{\tikzpeople@captiontext{#2}{#3}}
771 \label{fig:tikzpeoplefigure\tikzpeople@fignum}
772 \end{figure}
773 }
774 }
775
776 \newcommand{\tikzpeople@captiontext}[2]{
777 \ifstrempty{#2}{
778 All available characters with \texttt{minimum width=#1cm} and no additional options. %
779 }{%
780 All available characters with \texttt{minimum width=#1cm} and \texttt{#2} options. %
781 }%
782 \ifnum\tikzpeople@numfigs>1%
783 (Part \tikzpeople@fignum~of \tikzpeople@numfigs)
784 \fi
785 }
786
787 \newcommand{\tikzpeoplecolors}[1]{
788 \begin{minipage}{.95\textwidth}
789 \begin{center}
790 \centering
791 \expandafter\let\expandafter\tikzpeople@peoplecolors\csname tikzpeople@#1@colors\endcsname
792 \begin{tikzpicture}
793 \node[minimum width=2.5cm,#1] {};
794 \foreach \tikzpeople@name/\tikzpeople@angle/\tikzpeople@coords in \tikzpeople@peoplecolors{
795 \node (label) at (\tikzpeople@angle:2.5) {\tikzpeople@name};
796 \foreach \x/\y in \tikzpeople@coords{
797 \draw (label) edge (\x,\y);
798 }
799 }
800 \end{tikzpicture}
801 \captionof{figure}{The available color-keys for \texttt{#1} tikzpeople.}
802 \end{center}
803 \end{minipage}
804 }
805
806 \fi
807
808 \tikzpeople@declareshape{alice}
809 \tikzpeople@declareshape{bob}
810 \tikzpeople@declareshape{bride}
811 \tikzpeople@declareshape{builder}
812 \tikzpeople@declareshape{businessman}
813 \tikzpeople@declareshape{charlie}
814 \tikzpeople@declareshape{chef}
815 \tikzpeople@declareshape{conductor}
816 \tikzpeople@declareshape{cowboy}
817 \tikzpeople@declareshape{criminal}
818 \tikzpeople@declareshape{dave}
819 \tikzpeople@declareshape{devil}
820 \tikzpeople@declareshape{duck}
821 \tikzpeople@declareshape{graduate}
822 \tikzpeople@declareshape{groom}
823 \tikzpeople@declareshape{guard}
824 \tikzpeople@declareshape{jester}
825 \tikzpeople@declareshape{judge}
826 \tikzpeople@declareshape{maninblack}
827 \tikzpeople@declareshape{mexican}
828 \tikzpeople@declareshape{nun}
829 \tikzpeople@declareshape{nurse}
830 \tikzpeople@declareshape{physician}
831 \tikzpeople@declareshape{pilot}
832 \tikzpeople@declareshape{police}
833 \tikzpeople@declareshape{priest}
834 \tikzpeople@declareshape{sailor}
835 \tikzpeople@declareshape{santa}
836 \tikzpeople@declareshape{surgeon}
837
838 \let\pgfmath@function@veclen\relax
839 \pgfmathdeclarefunction{veclen}{2}{%
840 \begingroup%
841 \pgfmath@x#1pt\relax%
842 \pgfmath@y#2pt\relax%
843 \ifdim\pgfmath@x<0pt\relax%
844 \pgfmath@x-\pgfmath@x%
845 \fi%
846 \ifdim\pgfmath@y<0pt\relax%
847 \pgfmath@y-\pgfmath@y%
848 \fi%
849 \ifdim\pgfmath@x=0pt\relax%
850 \pgfmath@x\pgfmath@y%
851 \else%
852 \ifdim\pgfmath@y=0pt\relax%
853 \else%
854 \ifdim\pgfmath@x>\pgfmath@y%
855 \pgfmath@xa\pgfmath@x%
856 \pgfmath@x\pgfmath@y%
857 \pgfmath@y\pgfmath@xa%
858 \fi%
859 % We use a scaling factor to reduce errors.
860 % First, see if we should scale down
861 \let\pgfmath@tmp@scale=\divide
862 \let\pgfmath@tmp@restore=\multiply
863 \ifdim\pgfmath@y>10000pt\relax%
864 \c@pgfmath@counta1500\relax%
865 \else%
866 \ifdim\pgfmath@y>1000pt\relax%
867 \c@pgfmath@counta150\relax%
868 \else%
869 \ifdim\pgfmath@y>100pt\relax%
870 \c@pgfmath@counta50\relax%
871 \else%
872 % Not scaling down, should we scale up?
873 \let\pgfmath@tmp@scale=\multiply
874 \let\pgfmath@tmp@restore=\divide
875 \ifdim\pgfmath@y<0.00001pt\relax%
876 \c@pgfmath@counta1500\relax%
877 \else%
878 \ifdim\pgfmath@y<0.0001pt\relax%
879 \c@pgfmath@counta150\relax%
880 \else%
881 \ifdim\pgfmath@y<0.001pt\relax%
882 \c@pgfmath@counta50\relax%
883 \else
884 \c@pgfmath@counta1\relax%
885 \fi%
886 \fi%
887 \fi%
888 \fi%
889 \fi%
890 \fi%
891 \pgfmath@tmp@scale\pgfmath@x\c@pgfmath@counta\relax%
892 \pgfmath@tmp@scale\pgfmath@y\c@pgfmath@counta\relax%
893 \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}%
894 \pgfmath@x\pgfmathresult\pgfmath@x%
895 \pgfmath@xa\pgfmath@tonumber{\pgfmath@x}\pgfmath@x%
896 \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@xa}}%
897 %
898 % Use A+x^2*(B+x^2*(C+x^2*(D+E*x^2)))
899 % where
900 % A = +1.000012594
901 % B = +0.4993615349
902 % C = -0.1195159052
903 % D = +0.04453994279
904 % E = -0.01019210944
905 %
906 \[email protected]\pgfmath@xa%
907 \advance\[email protected]\relax%
908 \pgfmath@x\pgfmath@temp\pgfmath@x%
909 \advance\[email protected]\relax%
910 \pgfmath@x\pgfmath@temp\pgfmath@x%
911 \advance\[email protected]\relax%
912 \pgfmath@x\pgfmath@temp\pgfmath@x%
913 \advance\[email protected]\relax%
914 \ifdim\pgfmath@y<0pt\relax%
915 \pgfmath@y-\pgfmath@y%
916 \fi%
917 \pgfmath@x\pgfmath@tonumber{\pgfmath@y}\pgfmath@x%
918 % Invert the scaling factor.
919 \pgfmath@tmp@restore\pgfmath@x\c@pgfmath@counta\relax%
920 \fi%
921 \fi%
922 \pgfmath@returnone\pgfmath@x%
923 \endgroup%
924 }