| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% |
| 3 |
% Documentation for the tikzmarmots package |
| 4 |
% A package to bring little marmots into tikz |
| 5 |
% Maintained by samcarter |
| 6 |
% |
| 7 |
% Project repository and bug tracker: |
| 8 |
% https://github.com/samcarter/tikzmarmots |
| 9 |
% |
| 10 |
% Released under the LaTeX Project Public License v1.3c or later |
| 11 |
% See https://www.latex-project.org/lppl.txt |
| 12 |
% |
| 13 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 14 |
% arara: latexmk |
| 15 |
\documentclass{scrartcl} |
| 16 |
|
| 17 |
% meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 18 |
\title{The \texorpdfstring{\tikzmarmots}{tikzmarmots} package} |
| 19 |
\subtitle{using marmots in \TikZ} |
| 20 |
\author{% |
| 21 |
\texorpdfstring{ |
| 22 |
\begin{tikzpicture} |
| 23 |
\marmot |
| 24 |
\end{tikzpicture}\\[0.8em] |
| 25 |
\texttt{samcarter}\\ |
| 26 |
\url{https://github.com/samcarter/tikzmarmots}\\ |
| 27 |
\url{https://www.ctan.org/pkg/tikzmarmots} |
| 28 |
}{samcarter}} |
| 29 |
\date{Version v2.2 \textendash{} 2024/12/11} |
| 30 |
|
| 31 |
\usepackage[ |
| 32 |
themecolor=sammagenta |
| 33 |
]{\jobname-settings} |
| 34 |
|
| 35 |
\colorlet{blue}{samlblue} |
| 36 |
|
| 37 |
\usepackage{tikzducks} |
| 38 |
\usetikzlibrary{ducks} |
| 39 |
\usepackage{tikzmarmots} |
| 40 |
\usetikzlibrary{marmots} |
| 41 |
\usepackage{tikzlings-addons} |
| 42 |
\usepackage{marvosym} |
| 43 |
\usepackage{fontawesome} |
| 44 |
|
| 45 |
% including commented lines from the .sty files %%%%%%%%%%%%%%%%%%%%%% |
| 46 |
% thanks to Phelype Oleinik https://topanswers.xyz/tex?q=1861#a2092 |
| 47 |
\ExplSyntaxOn |
| 48 |
\makeatletter |
| 49 |
\iow_new:N \l__tikzlings_iow |
| 50 |
\tl_new:N \l__tikzlings_file_name_tl |
| 51 |
\NewDocumentCommand \CommentInput { m } |
| 52 |
{ \tikzlings_comment_input:n {#1} } |
| 53 |
\cs_new_protected:Npn \tikzlings_comment_input:n #1 |
| 54 |
{ |
| 55 |
\file_get_full_name:nNTF {#1} \l__tikzlings_file_name_tl |
| 56 |
{ \__tikzlings_comment_input: } |
| 57 |
{ \msg_error:nnn { tikzlings } { file-not-found } {#1} } |
| 58 |
} |
| 59 |
\msg_new:nnn { tikzlings } { file-not-found } { File~'#1'~not~found. } |
| 60 |
\cs_new_protected:Npn \__tikzlings_comment_input: |
| 61 |
{ |
| 62 |
\group_begin: |
| 63 |
\cctab_select:N \c_other_cctab |
| 64 |
\int_set:Nn \tex_endlinechar:D { `\^^M } |
| 65 |
\use:x { \tex_everyeof:D { \exp_not:N \q_nil \char_generate:nn { 13 } { 13 } } } |
| 66 |
\char_set_active_eq:NN \^^M \__tikzlings_process_line:w |
| 67 |
\char_set_catcode_active:N \^^M |
| 68 |
\iow_open:Nn \l__tikzlings_iow { \c_sys_jobname_str . cif } % cif => comment input file |
| 69 |
\exp_after:wN \__tikzlings_process_line:w |
| 70 |
\tex_input:D { \l__tikzlings_file_name_tl } |
| 71 |
\iow_close:N \l__tikzlings_iow |
| 72 |
\group_end: |
| 73 |
\declare@file@substitution { \l__tikzlings_file_name_tl } { \c_sys_jobname_str . cif } |
| 74 |
\input { \l__tikzlings_file_name_tl } |
| 75 |
\undeclare@file@substitution { \l__tikzlings_file_name_tl } |
| 76 |
} |
| 77 |
\group_begin: |
| 78 |
\char_set_catcode_active:N \^^M |
| 79 |
\char_set_active_eq:NN \^^M \scan_stop: |
| 80 |
\cs_new_protected:Npx \__tikzlings_process_line:w #1 ^^M |
| 81 |
{ \exp_not:N \__tikzlings_parse_line:w ^^M #1 ^^M \c_percent_str \s_stop } |
| 82 |
\cs_set_protected:Npn \__tikzlings_tmp:w #1 |
| 83 |
{ |
| 84 |
\cs_new_protected:Npn \__tikzlings_parse_line:w ##1 ^^M #1 ##2 \s_stop |
| 85 |
{ |
| 86 |
\tl_if_empty:nTF {##1} |
| 87 |
{ |
| 88 |
\peek_charcode_remove:NTF #1 |
| 89 |
{ \__tikzlings_ignore_line:w } |
| 90 |
{ \__tikzlings_output_line:w } |
| 91 |
##2 \s_stop ^^M |
| 92 |
} |
| 93 |
{ |
| 94 |
\tl_set:Nx \l_tmpa_tl { \tl_tail:n {##1} } |
| 95 |
\tl_if_eq:NNF \l_tmpa_tl \q_nil { ^^M } |
| 96 |
} |
| 97 |
} |
| 98 |
\cs_new_protected:Npn \__tikzlings_output_line:w ##1 ^^M #1 \s_stop |
| 99 |
{ \iow_now:Nn \l__tikzlings_iow {##1} } |
| 100 |
\cs_new_protected:Npn \__tikzlings_ignore_line:w ##1 \s_stop { } |
| 101 |
} |
| 102 |
\exp_args:No \__tikzlings_tmp:w { \c_percent_str } |
| 103 |
\group_end: |
| 104 |
\makeatother |
| 105 |
\ExplSyntaxOff |
| 106 |
|
| 107 |
% customisation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 108 |
\setlength{\footnotemargin}{0.7em} |
| 109 |
\setlength{\footheight}{45pt} |
| 110 |
|
| 111 |
\cfoot{% |
| 112 |
\begin{tikzpicture}[scale=0.5] |
| 113 |
\marmot |
| 114 |
\thing[scale=0.8,signpost=\scalebox{0.6}{\thepage}] |
| 115 |
\end{tikzpicture} |
| 116 |
} |
| 117 |
\pagestyle{scrheadings} |
| 118 |
|
| 119 |
\begin{document} |
| 120 |
\maketitle |
| 121 |
\thispagestyle{scrheadings} |
| 122 |
|
| 123 |
\begin{tcolorbox}[coltext=themecolor,width=.8\textwidth,center,sidebyside=false,title={Note}] |
| 124 |
The \tikzmarmots package was merged into the Ti\emph{k}Zlings package and, starting with version 2.0, is now a wrapper around the \saminline|tikzlings-marmots| package. |
| 125 |
|
| 126 |
To access the previous version, use \saminline|\usepackage{tikzmarmots}[v1]|. |
| 127 |
\end{tcolorbox} |
| 128 |
|
| 129 |
|
| 130 |
\section{Introduction} |
| 131 |
\label{intro} |
| 132 |
|
| 133 |
Inspired by the enthusiasms of the TeX.Stackexchange user \href{https://tex.stackexchange.com/users/121799/marmot}{@marmot} for beings of the same species, this little package can draw marmots using \TikZ. |
| 134 |
|
| 135 |
Unlike its older sibling, the \tikzducks package, this packages focuses on drawing the marmot itself. Additional accessories are not part of the package, but can be taken from other sources. |
| 136 |
|
| 137 |
This package is work in progress, therefore I would be happy to hear your feedback and ideas how to improve the package. The head version of the source code can be found on \url{github.com/samcarter/tikzmarmots}, including a bug tracker -- please make constructive use of it! |
| 138 |
A more stable package version can be found on \CTAN (\url{www.ctan.org/pkg/tikzmarmots}) and is included in both \miktex and \texlive as \tikzmarmots. |
| 139 |
If you seek any other assistance (not bug reports/feature requests), I suggest asking on \href{https://tex.stackexchange.com}{TeX.Stackexchange}. |
| 140 |
|
| 141 |
Copyright \raisebox{0.2em}{\tiny\fontfamily{cmr}\selectfont\textcopyright} |
| 142 |
\texttt{samcarter}. Permission is granted to copy, distribute and\slash or modify this software under the terms of the LaTeX project public licence, version 1.3c or later \url{https://www.latex-project.org/lppl.txt}. |
| 143 |
|
| 144 |
The shown example marmots are purely fictional characters, any resemblance to real marmots or persons is purely coincidental and no copyright infringement is intended. |
| 145 |
|
| 146 |
\begingroup |
| 147 |
\tcbset{tikz lower} |
| 148 |
\CommentInput{tikzlings-marmots.sty} |
| 149 |
\endgroup |
| 150 |
|
| 151 |
If the size of the marmots should be changed or shifted: |
| 152 |
|
| 153 |
\begin{tcblisting}{title={Scaled and shifted marmots}, righthand width=3cm} |
| 154 |
\begin{tikzpicture}[scale=0.6] |
| 155 |
\marmot |
| 156 |
\marmot[xshift=90pt, scale=.5, |
| 157 |
yshift=150pt,body=brown!80!gray] |
| 158 |
\marmot[xshift=60pt, scale=.5, |
| 159 |
yshift=100pt,body=brown!80!yellow] |
| 160 |
\marmot[xshift=80pt, scale=.5, |
| 161 |
yshift=50pt,body=brown!80!red] |
| 162 |
\end{tikzpicture} |
| 163 |
\end{tcblisting} |
| 164 |
|
| 165 |
To make the usage easier for the \TikZ-savvy users, the marmots can also be used as \TikZ library. It can be loaded with \saminline|\usetikzlibrary{marmots}|. In addition to the normal functionality of the \tikzmarmots package, the marmots are now also available as \saminline|pic|. A short example: |
| 166 |
|
| 167 |
\begin{tcolorbox}[title={\TikZ library ``marmots''}] |
| 168 |
\begin{samcode} |
| 169 |
\documentclass{standalone} |
| 170 |
|
| 171 |
\usepackage{tikz} |
| 172 |
\usetikzlibrary{marmots} |
| 173 |
|
| 174 |
\begin{document} |
| 175 |
|
| 176 |
\begin{tikzpicture} |
| 177 |
\draw (0,0) pic[ |
| 178 |
marmot/body=blue, |
| 179 |
marmot/blush, |
| 180 |
] {marmot}; |
| 181 |
\draw (2,0) pic[ |
| 182 |
scale=1.4, |
| 183 |
] {marmot}; |
| 184 |
\end{tikzpicture} |
| 185 |
|
| 186 |
\end{document} |
| 187 |
\end{samcode} |
| 188 |
|
| 189 |
\tcblower |
| 190 |
\begin{tikzpicture} |
| 191 |
\draw (0,0) pic[ |
| 192 |
marmot/body=blue, |
| 193 |
marmot/blush, |
| 194 |
] {marmot}; |
| 195 |
\draw (2,0) pic[ |
| 196 |
scale=1.4, |
| 197 |
] {marmot}; |
| 198 |
\end{tikzpicture} |
| 199 |
\end{tcolorbox} |
| 200 |
|
| 201 |
\section{Further customisation} |
| 202 |
|
| 203 |
The above list of available customisations does not sound very exhaustive, but there are basically infinite possibilities for further customisation, as the marmots are just shapes in a \TikZ picture -- all the heavy weapons of the \TikZ package are thus available for further customisation. |
| 204 |
|
| 205 |
\begin{tcblisting}{title={Adding things to the marmot}} |
| 206 |
\begin{tikzpicture} |
| 207 |
\marmot |
| 208 |
\fill[blue] (0,0) rectangle (1,1); |
| 209 |
\end{tikzpicture} |
| 210 |
\end{tcblisting} |
| 211 |
|
| 212 |
%\begin{tcblisting}{title={Monochrome marmot}} |
| 213 |
%\begin{tikzpicture} |
| 214 |
% \selectcolormodel{gray} |
| 215 |
% \marmot |
| 216 |
%\end{tikzpicture} |
| 217 |
%\end{tcblisting} |
| 218 |
|
| 219 |
\section{Re-using accessories from the \tikzlings package} |
| 220 |
|
| 221 |
As already said in the introduction, this package focuses on the marmots themselves and does not provide additional accessories. |
| 222 |
However there is no need to despair! There are many accessories available from the \saminline|tikzlings-addons| package (\url{https://www.ctan.org/pkg/tikzlings}). |
| 223 |
|
| 224 |
\begin{tcblisting}{title={Marmot Queen\footnote{The Marmot Queen is inspired by \href{http://www.ilregnodeifanes.it/inglese/summary.htm}{The Fanes' saga}}}} |
| 225 |
%\usepackage{tikzlings-addons} |
| 226 |
\begin{tikzpicture} |
| 227 |
\marmot |
| 228 |
\thing[crown] |
| 229 |
\end{tikzpicture} |
| 230 |
\end{tcblisting} |
| 231 |
|
| 232 |
|
| 233 |
The items can be modified with the usual \TikZ keys and come with additional options. Here one example: |
| 234 |
\begin{tcblisting}{title={Happy Birthday!}} |
| 235 |
%\usepackage{tikzlings-addons} |
| 236 |
\begin{tikzpicture} |
| 237 |
\marmot |
| 238 |
\thing[cake=red!50!violet, |
| 239 |
scale=1.2] |
| 240 |
\end{tikzpicture} |
| 241 |
\end{tcblisting} |
| 242 |
|
| 243 |
Please consult the \href{https://mirrors.ctan.org/graphics/pgf/contrib/tikzlings/tikzlings-doc.pdf}{\tikzlings package documentation} for an exhaustive list of options. |
| 244 |
|
| 245 |
\end{document} |