summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzmarmots/tikzmarmots-doc.tex
blob: 52d20b781b57b73578b4fbf41492900d7b09c24d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 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
%
% Version 2.0
% Apr 17, 2024
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% !TeX program = txs:///arara
% arara: latexmk: {
% arara: --> engine: pdflatex,
% arara: --> options: [
% arara: -->    '-shell-escape',
% arara: -->    '-synctex=1',
% arara: -->    '-interaction=nonstopmode',
% arara: -->  ]
% arara: --> }
\documentclass[parskip=half]{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 2.0 -- \today}

\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,bottom=10pt,top=10pt]
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}
\begin{tcblisting}{title={Marmot Queen$^{\thefootnote}$}}
%\usepackage{tikzlings-addons}
\begin{tikzpicture}
  \marmot
  \thing[crown]
\end{tikzpicture}
\end{tcblisting}
\footnotetext[\thefootnote]{The Marmot Queen is inspired by \href{http://www.ilregnodeifanes.it/inglese/summary.htm}{The Fanes' saga}}

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}