diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikzlings/tikzlings-moles.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/tikzlings/tikzlings-moles.sty | 110 |
1 files changed, 69 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/latex/tikzlings/tikzlings-moles.sty b/Master/texmf-dist/tex/latex/tikzlings/tikzlings-moles.sty index a64afa5720e..6363a8944cc 100644 --- a/Master/texmf-dist/tex/latex/tikzlings/tikzlings-moles.sty +++ b/Master/texmf-dist/tex/latex/tikzlings/tikzlings-moles.sty @@ -9,10 +9,10 @@ %% https://github.com/samcarter/tikzlings %% %% Released under the LaTeX Project Public License v1.3c or later -%% See http://www.latex-project.org/lppl.txt +%% See https://www.latex-project.org/lppl.txt %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\ProvidesPackage{tikzlings-moles}[2022/06/17 version v1.0 Drawing moles in TikZ] +\ProvidesPackage{tikzlings-moles}[2025/01/05 version v2.2 Drawing moles in TikZ] \RequirePackage{tikz} \RequirePackage{tikzlings-addons} @@ -26,12 +26,15 @@ % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \csname moleshookforeground\endcsname \csname tikzlinghookforeground\endcsname - % + % } \newif\ifmoles@threeD +\newif\ifmoles@leftstep +\newif\ifmoles@rightstep \newif\ifmoles@back \newif\ifmoles@contour +\newif\ifmoles@openmouth \tikzset{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -49,13 +52,13 @@ body/.store in = \moles@body, body = gray, eye/.store in = \moles@eye, - eye = \moles@body!60!black, + eye = \moles@body!60!black, feet/.store in = \moles@feet, feet = red!20!white!50!brown, hands/.store in = \moles@hands, - hands = red!20!white!50!brown, + hands = red!20!white!50!brown, muzzle/.store in = \moles@muzzle, - muzzle = red!20!white!50!brown, + muzzle = red!20!white!50!brown, mouth/.store in = \moles@mouth, mouth = \moles@body!60!black, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -63,20 +66,26 @@ % options % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - 3D/.code = \moles@threeDtrue, - back/.code = \moles@backtrue, + openmouth/.code = \moles@openmouthtrue, + open mouth/.forward to = /moles/openmouth, + 3D/.code = \moles@threeDtrue, + leftstep/.code = \moles@leftsteptrue, + left step/.forward to = /moles/leftstep, + rightstep/.code = \moles@rightsteptrue, + right step/.forward to = /moles/rightstep, + back/.code = \moles@backtrue, contour/.code = \moles@contourtrue \def\moles@contour{#1} \def\moles@mouth{#1} \def\moles@eye{#1}, - contour/.default = black, - outline/.forward to = /moles/contour, + contour/.default = black, + outline/.forward to = /moles/contour, } \def\moles@draw{% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - % minimal bounding box size + % minimal bounding box size % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \path (-0.625,0.1) rectangle (0.905, 2.17); @@ -93,7 +102,7 @@ \pgfmathsetmacro{\yscalefactor}{\tmpscaleD} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % + % % switch between 2D, 3D and contours, from % https://chat.stackexchange.com/transcript/message/45991801#45991801 % @@ -111,7 +120,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Body parts - % + % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -119,8 +128,16 @@ \csname tikzlinghookbackground\endcsname % % Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - \moles@part@draw[\moles@feet] (-0.255,0.2) ellipse[x radius=0.23, y radius=0.09]; - \moles@part@draw[\moles@feet] (0.255,0.2) ellipse[x radius=0.23, y radius=0.09]; + \ifmoles@leftstep + \moles@part@draw[\moles@feet] (-0.255,0.25) ellipse[x radius=0.23, y radius=0.09]; + \else% step + \moles@part@draw[\moles@feet] (-0.255,0.2) ellipse[x radius=0.23, y radius=0.09]; + \fi% step + \ifmoles@rightstep + \moles@part@draw[\moles@feet] (0.255,0.25) ellipse[x radius=0.23, y radius=0.09]; + \else% step + \moles@part@draw[\moles@feet] (0.255,0.2) ellipse[x radius=0.23, y radius=0.09]; + \fi% step % % Tail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \unless\ifmoles@back @@ -173,15 +190,19 @@ % % Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ifmoles@threeD - \fill[\moles@eye] (-0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=-15]; - \fill[\moles@eye!50!black] (0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=15]; + \fill[\moles@eye] (-0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=-15]; + \fill[\moles@eye!50!black] (0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=15]; \else% 3D - \fill[\moles@eye] (-0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=-15]; - \fill[\moles@eye] (0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=15]; + \fill[\moles@eye] (-0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=-15]; + \fill[\moles@eye] (0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=15]; \fi% 3D % % Mouth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - \draw[\moles@mouth, line width=\scalingfactor*0.4pt] (0.145,1.51) arc [start angle=-20, end angle=-160, radius=0.16] ; + \ifmoles@openmouth + \filldraw[\moles@mouth, line width=\scalingfactor*0.4pt] (0.145,1.51) arc [start angle=-20, end angle=-160, radius=0.16] ; + \else + \draw[\moles@mouth, line width=\scalingfactor*0.4pt] (0.145,1.51) arc [start angle=-20, end angle=-160, radius=0.16]; + \fi % \fi% back % @@ -203,58 +224,65 @@ % %\subsection{Package name} % -%\begin{tcolorbox}[lower separated=false, lefthand width=.8\linewidth] -%\vspace*{0.5cm} -%\lstinline|\usepackage{tikzlings-moles}| -%\vspace*{0.5cm} +%\begin{tcolorbox}[title={Package usage}] +%\begin{samcode} +%\usepackage{tikzlings-moles} +%\end{samcode} %\end{tcolorbox} % %\subsection{Basic Usage} % -%\textcolor{red!60!black}{\textbf{Attention:} In contrast to the other \tikzlings the macro name is the plural form to avoid conflicts with \lstinline|siunitx| and similar packages.} -%\begin{tcblisting}{} +%\textcolor{samred}{\textbf{Attention:} In contrast to the other \tikzlings the macro name is the plural form to avoid conflicts with \saminline|siunitx| and similar packages.} +%\begin{tcblisting}{title={Basic mole}} %\moles %\end{tcblisting} % %\subsection{Options} % %The basic mole can be modified by changing its colour: -%\begin{tcblisting}{} +%\begin{tcblisting}{title={Body colour}} %\moles[body=blue] %\end{tcblisting} % %In addition to the colour of the body, the colour of various body parts can be adjusted: -%\begin{tcblisting}{} +%\begin{tcblisting}{title={Eye colour}} %\moles[eye=red] %\end{tcblisting} -% -%\begin{tcblisting}{} +%\begin{tcblisting}{title={Muzzle colour}} %\moles[muzzle=red] %\end{tcblisting} -% -%\begin{tcblisting}{} +%\begin{tcblisting}{title={Hand colour}} %\moles[hands=red] %\end{tcblisting} -% -%\begin{tcblisting}{} +%\begin{tcblisting}{title={Foot colour}} %\moles[feet=red] %\end{tcblisting} -% -%\begin{tcblisting}{} +%\begin{tcblisting}{title={Mouth colour}} %\moles[mouth=red] %\end{tcblisting} % +% The mole can open its mouth: +%\begin{tcblisting}{title={Open mouth}} +%\moles[openmouth] +%\end{tcblisting} +% +%And the mole can lift its legs: +%\begin{tcblisting}{title={Walking}} +%\moles[leftstep] +%\moles[rightstep,xshift=2cm] +%\end{tcblisting} +% %To view the mole from behind: -%\begin{tcblisting}{} +%\begin{tcblisting}{title={Back view}} %\moles[back] %\end{tcblisting} % -%The key \lstinline|3D| will make the mole 3-dimensional: -%\begin{tcblisting}{} +%The key \saminline|3D| will make the mole 3-dimensional: +%\begin{tcblisting}{title={3D view}} %\moles[3D] %\end{tcblisting} % -%And finally the \lstinline|contour| key will only draw the outlines: -%\begin{tcblisting}{} +%And finally the \saminline|contour| key will only draw the outlines: +%\begin{tcblisting}{title={Contours}} %\moles[contour=black] %\end{tcblisting} |