diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikzlings/tikzlings-marmots.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/tikzlings/tikzlings-marmots.sty | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tikzlings/tikzlings-marmots.sty b/Master/texmf-dist/tex/latex/tikzlings/tikzlings-marmots.sty new file mode 100644 index 00000000000..49bee258299 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikzlings/tikzlings-marmots.sty @@ -0,0 +1,209 @@ +% !TeX root = ./examples/marmot.tex +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The tikzlings-marmots package (part of the tikzlings collection) +% A package to bring little marmots 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-marmots} + [2018/11/09 v0.1 Drawing marmots in TikZ] + +\RequirePackage{tikz} +\RequirePackage{tikzlings-addons} +\usetikzlibrary{shadows.blur} +\usetikzlibrary{fadings} + +\tikzfading[name=marmot@blush,inner color=transparent!50,outer color=transparent!100] + +\RequirePackage{ifluatex} +\RequirePackage{ifxetex} + +\ifluatex + \let\pdfrandomseed\randomseed +\fi + +\ifxetex + \pgfmathsetseed{\time} +\else + \pgfmathsetseed{\number\pdfrandomseed} +\fi + +\newcommand*{\marmot}[1][]{% + \begin{scope}% + \tikzset{/marmot/.cd,#1}% + \marmot@draw% + \end{scope}% + \thing[#1]% +} + +\newif\ifmarmot@blush +\newif\ifmarmot@whiskers +\newif\ifmarmot@teeth +\newif\ifmarmot@threeD +\newif\ifmarmot@shadow +\newif\ifmarmot@askphil +\newif\ifmarmot@leftstep +\newif\ifmarmot@rightstep + +\tikzset{ + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % Pass unknown keys on to tikz + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + /marmot/.search also={/tikz,/pgf,/thing}, + /marmot/.cd, + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % body + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + body/.code = \def\marmot@body{#1}, + body = brown, + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % options + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + blush/.code = \marmot@blushtrue, + whiskers/.code = \marmot@whiskerstrue + \def\marmot@whiskers{#1}, + whiskers/.default = gray, + teeth/.code = \marmot@teethtrue + \def\marmot@teeth{#1}, + teeth/.default = white, + 3D/.code = \marmot@threeDtrue, + shadow/.code = \marmot@shadowtrue, + askphil/.code = \marmot@askphiltrue, + ask phil/.forward to = /marmot/askphil, + leftstep/.code = \marmot@leftsteptrue, + left step/.forward to = /marmot/leftstep, + rightstep/.code = \marmot@rightsteptrue, + right step/.forward to = /marmot/rightstep, +} + +\def\marmot@draw{% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% minimal bounding box size +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\path (-0.625,0.1) rectangle (0.905, 2.17); +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% switch between 2D and 3D, from +% https://chat.stackexchange.com/transcript/message/45991801#45991801 +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifmarmot@threeD + \def\marmot@part@draw[##1]{\shade[ball color=##1]} +\else + \def\marmot@part@draw[##1]{\fill[##1]} +\fi +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% shadow +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\ifmarmot@askphil + \pgfmathparse{int(random(1,120))} + \let\marmot@random=\pgfmathresult + \ifnum\marmot@random>17 + \marmot@shadowtrue + \fi +\fi +% +\ifmarmot@shadow + \fill[opacity=0,blur shadow,rotate around={-80:(0.3,0.5)}] (0.3,0.5) ellipse (0.28 and 0.8); +\fi +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Body parts (center: x=0) +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifmarmot@leftstep + \marmot@part@draw[\marmot@body!50!black] (-0.255,0.25) ellipse (0.23 and 0.09); +\else + \marmot@part@draw[\marmot@body!50!black] (-0.255,0.2) ellipse (0.23 and 0.09); +\fi + +\ifmarmot@rightstep + \marmot@part@draw[\marmot@body!50!black] (0.255,0.25) ellipse (0.23 and 0.09); +\else + \marmot@part@draw[\marmot@body!50!black] (0.255,0.2) ellipse (0.23 and 0.09); +\fi +% +% Ears %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\marmot@part@draw[\marmot@body!50!black] (0.255,2.03) ellipse (0.09 and 0.13); +\marmot@part@draw[\marmot@body!50!black] (-0.255,2.03) ellipse (0.09 and 0.13); +% +% Tail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\marmot@part@draw[\marmot@body!50!black] (0.885, 0.67) .. controls (0.865, 0.4) and (0.345, 0.24) .. (0.335, 0.44) .. controls (0.315, 0.56) and (0.445, 0.51) .. (0.575, 0.53) .. controls (0.695, 0.54) and (0.885, 0.72) .. (0.885, 0.67) -- cycle; +% +% Body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\marmot@part@draw[\marmot@body] (0.595, 0.92) .. controls (0.595, 0.26) and (0.355, 0.18) .. (0, 0.18) .. controls (-0.355, 0.18) and (-0.595, 0.26) .. (-0.595, 0.92) .. controls (-0.605, 1.58) and (-0.335, 2.11) .. (0, 2.11) .. controls (0.335, 2.11) and (0.605, 1.58) .. (0.595, 0.92) -- cycle; +% +% Belly %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\marmot@part@draw[\marmot@body!50!white] (0.425, 0.71) .. controls (0.425, 0.41) and (0.245, 0.37) .. (0, 0.37) .. controls (-0.245, 0.37) and (-0.425, 0.41) .. (-0.425, 0.71) .. controls (-0.425, 1.01) and (-0.225, 1.26) .. (0, 1.26) .. controls (0.225, 1.26) and (0.425, 1.01) .. (0.425, 0.71) -- cycle; +% +% Arms %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\marmot@part@draw[\marmot@body!50!black,rotate around={70:(0.385,0.93)}] (0.385,0.93) ellipse (0.24 and 0.13); +\marmot@part@draw[\marmot@body!50!black,rotate around={-70:(-0.385,0.93)}] (-0.385,0.93) ellipse (0.24 and 0.13); +% +% Muzzle %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\marmot@part@draw[\marmot@body!50!white] (0,1.47) ellipse (0.23 and 0.13); +% +% Nose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\marmot@part@draw[\marmot@body!50!black] (0,1.6) circle (0.08); +% +% Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\marmot@part@draw[\marmot@body!50!black] (-0.155,1.77) circle (0.05); +\marmot@part@draw[\marmot@body!50!black] (0.155,1.77) circle (0.05); +% +% Mouth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\fill[\marmot@body!50!black] (0.145,1.51) arc [start angle=-20, end angle=-160, radius=0.16] -- (-0.14,1.51) -- (-0.14,1.51) arc [start angle=-160, end angle=-20, radius=0.144] -- cycle ; +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% optional +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Blushed %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifmarmot@blush + \fill[red,path fading=marmot@blush] (-0.295,1.6) circle (0.1); + \fill[red,path fading=marmot@blush] (0.295,1.6) circle (0.1); +\fi +% +% Wiskers %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifmarmot@whiskers + \foreach \X in {10,20,33}{% + \fill[\marmot@whiskers] (0,1.6) + (\X:0.08) to[out=\X,in={180-\X}] ++({\X-20}:0.3) --++(0,0.005) to[out={180-\X},in=\X] cycle (0,1.6) + ({180-\X}:0.08) to[out={180-\X},in=\X] ++({200-\X}:0.3) --++(0,0.005) to[out=\X,in={180-\X}] cycle; + } +\fi +% +% Teeth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifmarmot@teeth + \fill[\marmot@body!50!black] (0.048,1.413) rectangle (-0.048,1.373); + \fill[\marmot@teeth] (-0.045,1.407) rectangle (-0.004,1.376); + \fill[\marmot@teeth] (0.045,1.407) rectangle (0.004,1.376); +\fi +% +} + |