%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Documentation for the tikzmarmots package
% A package to bring little marmots into tikz
% Maintained by samcarter
%
% Project repository and bug tracker:
% https://github.com/samcarter/tikzmarmots
%
% Released under the LaTeX Project Public License v1.3c or later
% See http://www.latex-project.org/lppl.txt
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% !TeX program = txs:///arara
% arara: latexmk: {
% arara: --> engine: pdflatex,
% arara: --> options: [
% arara: -->    '-shell-escape',
% arara: -->    '-synctex=1',
% arara: -->    '-interaction=nonstopmode',
% arara: -->  ]
% arara: --> }
\documentclass{scrartcl}

% meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{The \texorpdfstring{\tikzmarmots}{tikzmarmots} package}
\subtitle{using marmots in \TikZ}
\author{%
  \texorpdfstring{
    \begin{tikzpicture}
     \marmot
    \end{tikzpicture}\\[0.8em]
    \texttt{samcarter}\\
    \url{https://github.com/samcarter/tikzmarmots}\\
    \url{https://www.ctan.org/pkg/tikzmarmots}
  }{samcarter}}
\date{Version v2.1 \textendash{} 2024/04/24}

\usepackage[
  themecolor=sammagenta
]{\jobname-settings}

\colorlet{blue}{samlblue}

\usepackage{tikzducks}
\usetikzlibrary{ducks}
\usepackage{tikzmarmots}
\usetikzlibrary{marmots}
\usepackage{tikzlings-addons}
\usepackage{marvosym}
\usepackage{fontawesome}

% including commented lines from the .sty files %%%%%%%%%%%%%%%%%%%%%%
% thanks to Phelype Oleinik https://topanswers.xyz/tex?q=1861#a2092
\ExplSyntaxOn
\makeatletter
\iow_new:N \l__tikzlings_iow
\tl_new:N \l__tikzlings_file_name_tl
\NewDocumentCommand \CommentInput { m }
  { \tikzlings_comment_input:n {#1} }
\cs_new_protected:Npn \tikzlings_comment_input:n #1
  {
    \file_get_full_name:nNTF {#1} \l__tikzlings_file_name_tl
      { \__tikzlings_comment_input: }
      { \msg_error:nnn { tikzlings } { file-not-found } {#1} }
  }
\msg_new:nnn { tikzlings } { file-not-found } { File~'#1'~not~found. }
\cs_new_protected:Npn \__tikzlings_comment_input:
  {
    \group_begin:
      \cctab_select:N \c_other_cctab
      \int_set:Nn \tex_endlinechar:D { `\^^M }
      \use:x { \tex_everyeof:D { \exp_not:N \q_nil \char_generate:nn { 13 } { 13 } } }
      \char_set_active_eq:NN \^^M \__tikzlings_process_line:w
      \char_set_catcode_active:N \^^M
      \iow_open:Nn \l__tikzlings_iow { \c_sys_jobname_str . cif } % cif => comment input file
      \exp_after:wN \__tikzlings_process_line:w
        \tex_input:D { \l__tikzlings_file_name_tl }
      \iow_close:N \l__tikzlings_iow
    \group_end:
    \declare@file@substitution { \l__tikzlings_file_name_tl } { \c_sys_jobname_str . cif }
    \input { \l__tikzlings_file_name_tl }
    \undeclare@file@substitution { \l__tikzlings_file_name_tl }
  }
\group_begin:
\char_set_catcode_active:N \^^M
\char_set_active_eq:NN \^^M \scan_stop:
\cs_new_protected:Npx \__tikzlings_process_line:w #1 ^^M
  { \exp_not:N \__tikzlings_parse_line:w ^^M #1 ^^M \c_percent_str \s_stop }
\cs_set_protected:Npn \__tikzlings_tmp:w #1
  {
    \cs_new_protected:Npn \__tikzlings_parse_line:w ##1 ^^M #1 ##2 \s_stop
      {
        \tl_if_empty:nTF {##1}
          {
            \peek_charcode_remove:NTF #1
              { \__tikzlings_ignore_line:w }
              { \__tikzlings_output_line:w }
            ##2 \s_stop ^^M
          }
          {
            \tl_set:Nx \l_tmpa_tl { \tl_tail:n {##1} }
            \tl_if_eq:NNF \l_tmpa_tl \q_nil { ^^M }
          }
      }
    \cs_new_protected:Npn \__tikzlings_output_line:w ##1 ^^M #1 \s_stop
      { \iow_now:Nn \l__tikzlings_iow {##1} }
    \cs_new_protected:Npn \__tikzlings_ignore_line:w ##1 \s_stop { }
  }
\exp_args:No \__tikzlings_tmp:w { \c_percent_str }
\group_end:
\makeatother
\ExplSyntaxOff

% customisation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\footnotemargin}{0.7em}
\setlength{\footheight}{45pt}

\cfoot{%
  \begin{tikzpicture}[scale=0.5]
    \marmot
    \thing[scale=0.8,signpost=\scalebox{0.6}{\thepage}]
  \end{tikzpicture}
}
\pagestyle{scrheadings}

\begin{document}
\maketitle
\thispagestyle{scrheadings}

\begin{tcolorbox}[coltext=themecolor,width=.8\textwidth,center,sidebyside=false,title={Note}]
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.

To access the previous version, use \saminline|\usepackage{tikzmarmots}[v1]|.
\end{tcolorbox}


\section{Introduction}
\label{intro}

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.

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.

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!
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.
If you seek any other assistance (not bug reports/feature requests), I suggest asking on \href{https://tex.stackexchange.com}{TeX.Stackexchange}.

Copyright \raisebox{0.2em}{\tiny\fontfamily{cmr}\selectfont\textcopyright}
\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{http://www.latex-project.org/lppl.txt}.

The shown example marmots are purely fictional characters, any resemblance to real marmots or persons is purely coincidental and no copyright infringement is intended.

\begingroup
  \tcbset{tikz lower}
  \CommentInput{tikzlings-marmots.sty}
\endgroup

If the size of the marmots should be changed or shifted:

\begin{tcblisting}{title={Scaled and shifted marmots}, righthand width=3cm}
\begin{tikzpicture}[scale=0.6]
  \marmot
  \marmot[xshift=90pt, scale=.5,
          yshift=150pt,body=brown!80!gray]
  \marmot[xshift=60pt, scale=.5,
          yshift=100pt,body=brown!80!yellow]
  \marmot[xshift=80pt, scale=.5,
          yshift=50pt,body=brown!80!red]
\end{tikzpicture}
\end{tcblisting}

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:

\begin{tcolorbox}[title={\TikZ library ``marmots''}]
\begin{samcode}
\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{marmots}

\begin{document}

\begin{tikzpicture}
\draw (0,0) pic[
    marmot/body=blue,
    marmot/blush,
  ] {marmot};
\draw (2,0) pic[
    scale=1.4,
  ] {marmot};
\end{tikzpicture}

\end{document}
\end{samcode}

\tcblower
\begin{tikzpicture}
\draw (0,0) pic[
    marmot/body=blue,
    marmot/blush,
  ] {marmot};
\draw (2,0) pic[
    scale=1.4,
  ] {marmot};
\end{tikzpicture}
\end{tcolorbox}

\section{Further customisation}

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.

\begin{tcblisting}{title={Adding things to the marmot}}
\begin{tikzpicture}
  \marmot
  \fill[blue] (0,0) rectangle (1,1);
\end{tikzpicture}
\end{tcblisting}

%\begin{tcblisting}{title={Monochrome marmot}}
%\begin{tikzpicture}
%  \selectcolormodel{gray}
%  \marmot
%\end{tikzpicture}
%\end{tcblisting}

\section{Re-using accessories from the \tikzlings package}

As already said in the introduction, this package focuses on the marmots themselves and does not provide additional accessories.
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}).

\addtocounter{footnote}{1}
\footnotetext[\thefootnote]{The Marmot Queen is inspired by \href{http://www.ilregnodeifanes.it/inglese/summary.htm}{The Fanes' saga}}
\begin{tcblisting}{title={Marmot Queen$^{\thefootnote}$}}
%\usepackage{tikzlings-addons}
\begin{tikzpicture}
  \marmot
  \thing[crown]
\end{tikzpicture}
\end{tcblisting}


The items can be modified with the usual \TikZ keys and come with additional options. Here one example:
\begin{tcblisting}{title={Happy Birthday!}}
%\usepackage{tikzlings-addons}
\begin{tikzpicture}
  \marmot
  \thing[cake=red!50!violet,
         scale=1.2]
\end{tikzpicture}
\end{tcblisting}

 Please consult the \href{http://mirrors.ctan.org/graphics/pgf/contrib/tikzlings/tikzlings-doc.pdf}{\tikzlings package documentation} for an exhaustive list of options.

\end{document}
