summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tikzlings/tikzlings-bears.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-11-09 21:54:05 +0000
committerKarl Berry <karl@freefriends.org>2018-11-09 21:54:05 +0000
commit05a427a48fbea0f9183ca423dd19d4cbd5feb7a2 (patch)
tree0b736e6408d4684ab23ed146ad387fd7706a43cc /Master/texmf-dist/tex/latex/tikzlings/tikzlings-bears.sty
parentdd7f41a8a44bf912af9c15f9719f9dadc6339617 (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-bears.sty')
-rw-r--r--Master/texmf-dist/tex/latex/tikzlings/tikzlings-bears.sty117
1 files changed, 117 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tikzlings/tikzlings-bears.sty b/Master/texmf-dist/tex/latex/tikzlings/tikzlings-bears.sty
new file mode 100644
index 00000000000..33367c1b045
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tikzlings/tikzlings-bears.sty
@@ -0,0 +1,117 @@
+% !TeX root = ./examples/bear.tex
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% The tikzlings-bears package (part of the tikzlings collection)
+% A package to bring little teddy bears 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-bears}
+ [2018/11/09 v0.1 Draw teddy bears in TikZ]
+
+\RequirePackage{tikz}
+\RequirePackage{tikzlings-addons}
+
+\newcommand*{\bear}[1][]{%
+ \begin{scope}%
+ \tikzset{/bear/.cd,#1}%
+ \bear@draw%
+ \end{scope}%
+ \thing[#1]%
+}
+
+\newif\ifbear@threeD
+
+\tikzset{
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % Pass unknown keys on to tikz
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ /bear/.search also={/tikz,/pgf,/thing},
+ /bear/.cd,
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % body
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ body/.code = \def\bear@body{#1},
+ body = brown,
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % options
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ 3D/.code = \bear@threeDtrue,
+}
+
+\def\bear@draw{%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% minimal bounding box size
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\path (-0.8, 0.0) rectangle (0.8, 2.13);
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% switch between 2D and 3D, from
+% https://chat.stackexchange.com/transcript/message/45991801#45991801
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifbear@threeD
+ \def\bear@part@draw[##1]{\shade[ball color=##1]}
+\else
+ \def\bear@part@draw[##1]{\fill[##1]}
+\fi
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Body parts (center: x=0.925)
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Arms %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\bear@part@draw[\bear@body!70!black,rotate around={-50:(0.525,0.9)}] (0.525,0.9) ellipse (0.35 and 0.15);
+\bear@part@draw[\bear@body!70!black,rotate around={50:(-0.525,0.9)}] (-0.525,0.9) ellipse (0.35 and 0.15);
+%
+% Body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\bear@part@draw[\bear@body!70!black] (0,0.75) ellipse (0.55 and 0.65);
+\bear@part@draw[\bear@body!50!white] (0,0.7) ellipse (0.35 and 0.4);
+%
+% Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\bear@part@draw[\bear@body!70!black] (0.425, 0.3) circle (0.28);
+\bear@part@draw[\bear@body!70!black] (-0.425, 0.3) circle (0.28);
+\bear@part@draw[\bear@body!50!white] (0.425, 0.3) circle (0.17);
+\bear@part@draw[\bear@body!50!white] (-0.425, 0.3) circle (0.17);
+%
+% Ears %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\bear@part@draw[\bear@body!70!black] (0.375, 1.95) circle (0.15);
+\bear@part@draw[\bear@body!70!black] (-0.375, 1.95) circle (0.15);
+\bear@part@draw[\bear@body!50!white] (0.375, 1.95) circle (0.1);
+\bear@part@draw[\bear@body!50!white] (-0.375, 1.95) circle (0.1);
+%
+% Head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\bear@part@draw[\bear@body!70!black] (0, 1.55) circle (0.5);
+%
+% Muzzle %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\bear@part@draw[\bear@body!50!white] (0, 1.4) ellipse (0.28 and 0.2);
+\bear@part@draw[\bear@body!70!white!80!red] (0, 1.5) ellipse (0.15 and 0.08);
+%
+% Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\bear@part@draw[\bear@body!30!black] (-0.155, 1.7) circle (0.05);
+\bear@part@draw[\bear@body!30!black] (0.155, 1.7) circle (0.05);
+%
+% Mouth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\fill[\bear@body!30!black] (0.145, 1.38) arc [start angle=-20, end angle=-160, radius=0.16] -- (-0.14, 1.38) -- (-0.14, 1.38) arc [start angle=-160, end angle=-20, radius=0.144] -- cycle;
+%
+} \ No newline at end of file