diff options
author | Karl Berry <karl@freefriends.org> | 2018-11-09 21:54:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-11-09 21:54:05 +0000 |
commit | 05a427a48fbea0f9183ca423dd19d4cbd5feb7a2 (patch) | |
tree | 0b736e6408d4684ab23ed146ad387fd7706a43cc /Master/texmf-dist/tex/latex/tikzlings/tikzlings-snowmans.sty | |
parent | dd7f41a8a44bf912af9c15f9719f9dadc6339617 (diff) |
tikzlings (9nov18)
git-svn-id: svn://tug.org/texlive/trunk@49113 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikzlings/tikzlings-snowmans.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/tikzlings/tikzlings-snowmans.sty | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tikzlings/tikzlings-snowmans.sty b/Master/texmf-dist/tex/latex/tikzlings/tikzlings-snowmans.sty new file mode 100644 index 00000000000..b1f9cb02fe6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikzlings/tikzlings-snowmans.sty @@ -0,0 +1,121 @@ +% !TeX root = ./examples/snowman.tex +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The tikzlings-snowmans package (part of the tikzlings collection) +% A package to bring snowmans into tikz +% Maintained by samcarter +% +% Project repository and bug tracker: +% https://github.com/samcarter/tikzlings +% +% Released under the LaTeX Project Public License v1.3c or later +% See http://www.latex-project.org/lppl.txt +% +% Version 0.1 +% Nov 9, 2018 +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ProvidesPackage{tikzlings-snowmans} + [2018/11/09 v0.1 Draw snowmans in TikZ] + +\RequirePackage{tikz} +\RequirePackage{tikzlings-addons} + +\newcommand*{\snowman}[1][]{% + \begin{scope}% + \tikzset{/snowman/.cd,#1}% + \snowman@draw% + \end{scope}% + \thing[#1]% +} + +\newif\ifsnowman@threeD + +\tikzset{ + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % Pass unknown keys on to tikz + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + /snowman/.search also={/tikz,/pgf,/thing}, + /snowman/.cd, + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % body + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + body/.code = \def\snowman@body{#1}, + body = white!95!black, + eye/.code = \def\snowman@eye{#1}, + eye = black, + nose/.code = \def\snowman@nose{#1}, + nose = orange, + mouth/.code = \def\snowman@mouth{#1}, + mouth = black, + buttons/.code = \def\snowman@buttons{#1}, + buttons = black, + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % options + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + 3D/.code = \snowman@threeDtrue, +} + +\def\snowman@draw{% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% minimal bounding box size +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\path (-0.75, 0.0) rectangle (0.75, 2.13); +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% switch between 2D and 3D, from +% https://chat.stackexchange.com/transcript/message/45991801#45991801 +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifsnowman@threeD + \def\snowman@part@draw[##1]{\shade[ball color=##1]} +\else + \def\snowman@part@draw[##1]{\fill[##1]} +\fi +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Body parts (center: x=0.925) +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Arms %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\snowman@part@draw[\snowman@body,rotate around={-50:(0.5,1.1)}] (0.5,1.1) ellipse (0.3 and 0.12); +\snowman@part@draw[\snowman@body,rotate around={50:(-0.5,1.1)}] (-0.5,1.1) ellipse (0.3 and 0.12); +% +% Body + Head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\snowman@part@draw[\snowman@body] (0,0.5) ellipse (0.6 and 0.5); +\snowman@part@draw[\snowman@body] (0,1.1) ellipse (0.5 and 0.4); +\snowman@part@draw[\snowman@body] (0,1.7) circle (0.4); +% +% Mouth% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\fill[\snowman@mouth] (0,1.5) circle (0.016); +\fill[\snowman@mouth] (0.04,1.507) circle (0.016); +\fill[\snowman@mouth] (-0.04,1.507) circle (0.016); +\fill[\snowman@mouth] (0.08,1.522) circle (0.016); +\fill[\snowman@mouth] (-0.08,1.522) circle (0.016); +\fill[\snowman@mouth] (0.12,1.543) circle (0.016); +\fill[\snowman@mouth] (-0.12,1.543) circle (0.016); +% +% Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\snowman@part@draw[\snowman@eye] (-0.155,1.8) circle (0.04); +\snowman@part@draw[\snowman@eye] (0.155,1.8) circle (0.04); +% +% Nose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\snowman@part@draw[\snowman@nose] (0,1.67) circle (0.05) (0,1.72) -- (0,1.62) -- (0.15,1.64) -- cycle; +% +% buttons %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\snowman@part@draw[\snowman@buttons] (0,1.15) circle (0.04); +\snowman@part@draw[\snowman@buttons] (0,0.95) circle (0.04); +\snowman@part@draw[\snowman@buttons] (0,0.75) circle (0.04); +% +} |