summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/scsnowman/scsnowman.sty
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/scsnowman/scsnowman.sty')
-rw-r--r--graphics/pgf/contrib/scsnowman/scsnowman.sty381
1 files changed, 381 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/scsnowman/scsnowman.sty b/graphics/pgf/contrib/scsnowman/scsnowman.sty
new file mode 100644
index 0000000000..609e7c69ce
--- /dev/null
+++ b/graphics/pgf/contrib/scsnowman/scsnowman.sty
@@ -0,0 +1,381 @@
+%%
+%% This is file `scsnowman.sty', part of scsnowman package.
+%% Maintained on GitHub:
+%% https://github.com/aminophen/scsnowman
+%%
+%% Copyright (c) 2015-2018 Hironobu Yamashita
+%% Email : h.y.acetaminophen[a t]gmail.com
+%% GitHub : https://github.com/aminophen
+%% Blog : http://acetaminophen.hatenablog.com/
+%% Twitter : @aminophen
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{scsnowman}[2018/06/07 v1.2d Snowman variants using TikZ]
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{sctkzsym-base}}
+\ProcessOptions\relax
+\RequirePackage{sctkzsym-base}[2017/08/08]
+%
+% make document snowman (joke)
+\ifsctkzsym@document
+\def\makedocumentsnowman{%
+ \ifx\documentclass\@notprerr
+ % Already after \begin{document}, throw an error
+ \def\sctkzsym@documentsnowman{%
+ \PackageError{scsnowman}{%
+ Use of \noexpand\makedocumentsnowman too late!\MessageBreak
+ Try using before \string\begin{document}}{%
+ I'll try to stop processing, but
+ this attempt can fail.\MessageBreak\@ehc}%
+ % If the above error is ignored, there's no way to
+ % exit successfully in all cases. So, try to continue
+ % processing by ignoring all LaTeX errors.
+ % TeX errors still remain; therefore, \makedocumentsnowman
+ % in internal vertical mode or math mode will fail.
+ \let\@latex@error\@gobbletwo\par
+ \scsnowman[init,scale=14,hat,muffler,buttons,snow]%
+ \scsnowman[init,scale=14,hat,muffler,buttons,arms]%
+ \scsnowman[init,scale=14,body,hat,muffler,buttons,snow]%
+ \end{document}}%
+ \else\ifx\documentclass\@twoclasseserror
+ \ifx\AtBeginDocument\@firstofone
+ % In preamble, inside \AtBeginDocument; avoid infinite loop
+ \def\sctkzsym@documentsnowman{%
+ \centering
+ \scsnowman[init,scale=14,hat,muffler,buttons,snow]%
+ \scsnowman[init,scale=14,hat,muffler,buttons,arms]%
+ \scsnowman[init,scale=14,body,hat,muffler,buttons,snow]%
+ \end{document}}%
+ \else
+ % In preamble; start document
+ \def\sctkzsym@documentsnowman{%
+ \pagestyle{empty}%
+ \begin{document}%
+ \centering
+ \scsnowman[init,scale=14,hat,muffler,buttons,snow]%
+ \scsnowman[init,scale=14,hat,muffler,buttons,arms]%
+ \scsnowman[init,scale=14,body,hat,muffler,buttons,snow]%
+ \end{document}}%
+ \fi
+ \else
+ % Before \documentclass{...}; load class and start document
+ \def\sctkzsym@documentsnowman{%
+ \documentclass{minimal}%
+ \begin{document}%
+ \centering
+ \scsnowman[init,scale=18,hat,muffler,buttons,snow]%
+ \scsnowman[init,scale=18,hat,muffler,buttons,arms]%
+ \scsnowman[init,scale=18,body,hat,muffler,buttons,snow]%
+ \end{document}}%
+ \fi\fi
+ \sctkzsym@documentsnowman
+}
+\fi
+%
+% change QED symbol (joke)
+\ifsctkzsym@qed
+ \def\sctkzsym@snowman@qedsymbol{\scsnowman[init,hat=true,muffler=red]}
+ \newcommand{\makeqedsnowman}{%
+ \ifx\qedsymbol\sctkzsym@snowman@qedsymbol\else
+ \let\sctkzsym@saved@qedsymbol\qedsymbol
+ \let\qedsymbol\sctkzsym@snowman@qedsymbol
+ \fi
+ }
+\fi
+%
+% change item label (joke)
+\ifsctkzsym@item
+ \def\sctkzsym@snowman@labelitemi{\scsnowman[init,hat=true,muffler=red]}
+ \def\sctkzsym@snowman@labelitemii{\scsnowman[init,hat=true,muffler=blue]}
+ \def\sctkzsym@snowman@labelitemiii{\scsnowman[init,hat=true,muffler=green]}
+ \def\sctkzsym@snowman@labelitemiv{\scsnowman[init,hat=true,muffler=yellow]}
+ \newcommand{\makeitemsnowman}{%
+ \ifx\labelitemi\sctkzsym@snowman@labelitemi\else
+ \let\sctkzsym@saved@labelitemi\labelitemi
+ \let\sctkzsym@saved@labelitemii\labelitemii
+ \let\sctkzsym@saved@labelitemiii\labelitemiii
+ \let\sctkzsym@saved@labelitemiv\labelitemiv
+ \let\labelitemi\sctkzsym@snowman@labelitemi
+ \let\labelitemii\sctkzsym@snowman@labelitemii
+ \let\labelitemiii\sctkzsym@snowman@labelitemiii
+ \let\labelitemiv\sctkzsym@snowman@labelitemiv
+ \fi
+ }
+\fi
+%
+%------------------------------- ZR something BEGIN
+
+% change enumerate label using \scsnowmannumeral (joke)
+% (this feature is `scsnowman'-specific, so the name-space
+% is intentionally set to \scsnowman@...)
+
+% unique token
+\def\scsnowman@end{\scsnowman@end@}
+
+\let\scsnowman@eight\relax
+
+%% \scsnowman@scan@option\CScontinue{<prologue>}
+\def\scsnowman@scan@option#1#2{%
+ \scsnowman@scan@option@a#2[]\scsnowman@end#1%
+}
+\def\scsnowman@scan@option@a#1[#2]#3\scsnowman@end#4{%
+ #4{#2}%
+}
+
+\def\enumsnowman#1#{%
+ \scsnowman@scan@option\scsnowman@enumsnowman{#1}%
+}
+\def\scsnowman@enumsnowman#1#2{%
+ \scsnowmanNumeral{#1}{\@nameuse{c@#2}}%
+}
+
+% For use with \pagenumbering.
+\def\@enumsnowman{%
+ \scsnowmanNumeral{}%
+}
+
+\def\scsnowmannumeral#1#{%
+ \scsnowman@scan@option\scsnowmanNumeral{#1}%
+}
+
+% \scsnowmanNumeral{<option>}{<number>}
+% change 8 to snowman in counters (joke)
+% (this feature is `scsnowman'-specific, so the name-space
+% is intentionally set to \scsnowman@...)
+
+% internal entry point
+\newcommand*\scsnowmanNumeral[2]{%
+ \expandafter\scsnowman@@numeral\number#2\relax\scsnowman@end{#1}%
+}
+\def\scsnowman@@numeral#1\relax#2\scsnowman@end#3{%
+ \scsnowman@numeral{#3}{#1}%
+}
+\DeclareRobustCommand*\scsnowman@numeral[2]{%
+ \begingroup
+ \def\scsnowman@eight{\scsnowman[#1]}%
+ \scsnowman@numeral@a#28\scsnowman@end
+ \endgroup
+}
+\def\scsnowman@numeral@a#18#2\scsnowman@end{%
+ \ifx\scsnowman@end#2\scsnowman@end
+ #1%
+ \else
+ #1\scsnowman@eight
+ \scsnowman@numeral@a#2\scsnowman@end
+ \fi
+}
+
+\providecommand*\pdfstringdefPreHook{}
+\g@addto@macro\pdfstringdefPreHook{%
+ \let\scsnowman@eight\scsnowman@hy@eight
+ \let\scsnowman@numeral\scsnowman@hy@numeral
+}
+\def\scsnowman@hy@numeral#1#2{% #1 is ignored
+ \scsnowman@numeral@a#28\scsnowman@end
+}
+
+\DeclareTextCommand{\scsnowman@hy@eight}{PU}{\9046\003}% U+2603
+\DeclareTextCommand{\scsnowman@hy@eight}{PD1}{8}%fallback
+\ifx\forcecjktoken\@undefined\else %upTeX
+ \begingroup
+ \kansujichar8="2603
+ \xdef\scsnowman@hy@eight{\kansuji8}
+ \endgroup
+\fi
+
+%------------------------------- ZR something END
+%
+% key initialization
+\newcommand\sctkzsym@snowman@initkeys{%
+ \def\sctkzsym@snowman@init{false}%
+ \def\sctkzsym@snowman@scale{1}%
+ \def\sctkzsym@snowman@shape{normal}%
+ \def\sctkzsym@snowman@body{false}%
+ \def\sctkzsym@snowman@eyes{true}% default on
+ \def\sctkzsym@snowman@nose{false}%
+ \def\sctkzsym@snowman@mouthshape{smile}%
+ \def\sctkzsym@snowman@mouth{true}% default on
+ \def\sctkzsym@snowman@sweat{false}%
+ \def\sctkzsym@snowman@hat{false}%
+ \def\sctkzsym@snowman@arms{false}%
+ \def\sctkzsym@snowman@muffler{false}%
+ \def\sctkzsym@snowman@buttons{false}%
+ \def\sctkzsym@snowman@snow{false}%
+ \def\sctkzsym@snowman@note{false}%
+ \def\sctkzsym@snowman@adjustbaseline{false}%
+ \def\sctkzsym@snowman@mikan{false}%
+ \def\sctkzsym@snowman@leaf{false}%
+ \def\sctkzsym@snowman@broom{false}%
+}
+\newcommand{\sctkzsym@snowman@defaultkeys}{%
+ \sctkzsym@snowman@initkeys
+}
+\sctkzsym@snowman@defaultkeys
+%
+% key definitions
+\sctkzsym@define@key@withbool{snowman}{init}
+\sctkzsym@define@key@wodefault{snowman}{scale}
+\sctkzsym@define@key@wodefault{snowman}{shape}
+\sctkzsym@define@key@withbool{snowman}{body}
+\sctkzsym@define@key@withbool{snowman}{eyes}
+\sctkzsym@define@key@withbool{snowman}{nose}
+\sctkzsym@define@key@withword{snowman}{mouthshape}{smile,frown,tight}
+\sctkzsym@define@key@withbool{snowman}{mouth}
+\sctkzsym@define@key@withbool{snowman}{sweat}
+\sctkzsym@define@key@withbool{snowman}{hat}
+\sctkzsym@define@key@withbool{snowman}{arms}
+\sctkzsym@define@key@withbool{snowman}{muffler}
+\sctkzsym@define@key@withbool{snowman}{buttons}
+\sctkzsym@define@key@withbool{snowman}{snow}
+\sctkzsym@define@key@withbool{snowman}{note}
+\sctkzsym@define@key@withbool{snowman}{adjustbaseline}
+\sctkzsym@define@key@withbool{snowman}{mikan}
+\sctkzsym@define@key@withbool{snowman}{leaf}
+\sctkzsym@define@key@withbool{snowman}{broom}
+%
+% definition of \scsnowman[...]
+\DeclareRobustCommand\scsnowman[1][]{%
+ % key initialization using default
+ \sctkzsym@snowman@defaultkeys
+ % read <key>=<value>
+ \setkeys{sctkzsym@snowman}{#1}%
+ % check init; if init=true, initialize and read keys again
+ \sctkzsym@hndl@key@onlybool{snowman}{init}%
+ \ifsctkzsym@snowman@init
+ \sctkzsym@snowman@initkeys
+ \setkeys{sctkzsym@snowman}{#1,init=false}%
+ \fi
+ %
+ % check body; determine whether "black snowman" or "white snowman"
+ \sctkzsym@hndl@key@withbool{snowman}{body}%
+ \ifsctkzsym@snowman@body % "black snowman"; black snow; white eyes/mouth/stroke
+ \def\sctkzsym@snowman@bodystroke{\sctkzsym@snowman@body}%
+ \def\sctkzsym@snowman@bodyfill{\sctkzsym@snowman@body}%
+ \def\sctkzsym@snowman@bodypath{\path[draw=\sctkzsym@snowman@bodystroke,fill=\sctkzsym@snowman@bodyfill]}%
+ \def\sctkzsym@snowman@snowstroke{\sctkzsym@snowman@snow}%
+ \def\sctkzsym@snowman@snowfill{\sctkzsym@snowman@snow}%
+ \def\sctkzsym@snowman@snowpath{\path[draw=\sctkzsym@snowman@snowstroke,fill=\sctkzsym@snowman@snowfill]}%
+ \def\sctkzsym@snowman@eyefill{\sctkzsym@defaultanticolor}%
+ \def\sctkzsym@snowman@nosestroke{\sctkzsym@defaultanticolor}%
+ \def\sctkzsym@snowman@nosefill{\sctkzsym@snowman@nose}%
+ \def\sctkzsym@snowman@mouthstroke{\sctkzsym@defaultanticolor}%
+ \def\sctkzsym@snowman@sweatstroke{\sctkzsym@defaultanticolor}%
+ \def\sctkzsym@snowman@sweatfill{\sctkzsym@snowman@sweat}%
+ \def\sctkzsym@snowman@mufflerstroke{\sctkzsym@defaultanticolor}%
+ \def\sctkzsym@snowman@mufflerfill{\sctkzsym@snowman@muffler}%
+ \def\sctkzsym@snowman@buttonstroke{\sctkzsym@defaultanticolor}%
+ \def\sctkzsym@snowman@buttonfill{\sctkzsym@snowman@buttons}%
+ \else % "white snowman"; white snow; black eyes/mouth/stroke; bodystroke should be there
+ \def\sctkzsym@snowman@bodystroke{\sctkzsym@defaultcolor}%
+ \def\sctkzsym@snowman@bodyfill{}%
+ \def\sctkzsym@snowman@bodypath{\path[draw=\sctkzsym@snowman@bodystroke]}%
+ \def\sctkzsym@snowman@snowstroke{\sctkzsym@snowman@snow}%
+ \def\sctkzsym@snowman@snowfill{}%
+ \def\sctkzsym@snowman@snowpath{\path[draw=\sctkzsym@snowman@snowstroke]}%
+ \def\sctkzsym@snowman@eyefill{\sctkzsym@defaultcolor}%
+ \def\sctkzsym@snowman@nosestroke{\sctkzsym@snowman@nose}%
+ \def\sctkzsym@snowman@nosefill{\sctkzsym@snowman@nose}%
+ \def\sctkzsym@snowman@mouthstroke{\sctkzsym@defaultcolor}%
+ \def\sctkzsym@snowman@sweatstroke{\sctkzsym@snowman@sweat}%
+ \def\sctkzsym@snowman@sweatfill{\sctkzsym@defaultanticolor}%
+ \def\sctkzsym@snowman@mufflerstroke{\sctkzsym@snowman@muffler}%
+ \def\sctkzsym@snowman@mufflerfill{\sctkzsym@snowman@muffler}%
+ \def\sctkzsym@snowman@buttonstroke{\sctkzsym@snowman@buttons}%
+ \def\sctkzsym@snowman@buttonfill{\sctkzsym@snowman@buttons}%
+ \fi
+ % check eyes (currently eyes=<color> not supported; falling back to default-(anti)color)
+ \sctkzsym@hndl@key@withbool{snowman}{eyes}%
+ \def\sctkzsym@snowman@eyepath{\path[fill=\sctkzsym@snowman@eyefill]}%
+ % check nose
+ \sctkzsym@hndl@key@withbool{snowman}{nose}%
+ \def\sctkzsym@snowman@nosepath{\path[draw=\sctkzsym@snowman@nosestroke,fill=\sctkzsym@snowman@nosefill]}%
+ % check mouth (currently mouth=<color> not supported; falling back to default-(anti)color)
+ \sctkzsym@hndl@key@withword{snowman}{mouthshape}%
+ \sctkzsym@hndl@key@withbool{snowman}{mouth}%
+ \def\sctkzsym@snowman@mouthpath{\path[draw=\sctkzsym@snowman@mouthstroke]}%
+ % check sweat
+ \sctkzsym@hndl@key@withbool{snowman}{sweat}%
+ \def\sctkzsym@snowman@sweatpath{\path[draw=\sctkzsym@snowman@sweatstroke,fill=\sctkzsym@snowman@sweatfill]}%
+ % check hat
+ \sctkzsym@hndl@key@withbool{snowman}{hat}%
+ \def\sctkzsym@snowman@hatstroke{\sctkzsym@snowman@hat}%
+ \def\sctkzsym@snowman@hatfill{\sctkzsym@snowman@hat}%
+ \def\sctkzsym@snowman@hatpath{\path[draw=\sctkzsym@snowman@hatstroke,fill=\sctkzsym@snowman@hatfill]}%
+ % check arms
+ \sctkzsym@hndl@key@withbool{snowman}{arms}%
+ \def\sctkzsym@snowman@armsstroke{\sctkzsym@snowman@arms}%
+ \def\sctkzsym@snowman@armsfill{\sctkzsym@snowman@arms}%
+ \def\sctkzsym@snowman@armspath{\path[draw=\sctkzsym@snowman@armsstroke,fill=\sctkzsym@snowman@armsfill]}%
+ % check muffler
+ \sctkzsym@hndl@key@withbool{snowman}{muffler}%
+ \def\sctkzsym@snowman@mufflerpath{\path[draw=\sctkzsym@snowman@mufflerstroke,fill=\sctkzsym@snowman@mufflerfill]}%
+ % check buttons
+ \sctkzsym@hndl@key@withbool{snowman}{buttons}%
+ \def\sctkzsym@snowman@buttonpath{\path[draw=\sctkzsym@snowman@buttonstroke,fill=\sctkzsym@snowman@buttonfill]}%
+ % check snow
+ \sctkzsym@hndl@key@withbool{snowman}{snow}%
+ % check note
+ \sctkzsym@hndl@key@withbool{snowman}{note}%
+ \def\sctkzsym@snowman@notefill{\sctkzsym@snowman@note}%
+ \def\sctkzsym@snowman@notepath{\path[fill=\sctkzsym@snowman@notefill]}%
+ % check adjustbaseline
+ \sctkzsym@hndl@key@onlybool{snowman}{adjustbaseline}%
+ % check mikan/leaf
+ \sctkzsym@hndl@key@withbool{snowman}{mikan}%
+ \sctkzsym@hndl@key@withbool{snowman}{leaf}%
+ \def\sctkzsym@snowman@mikanstroke{\sctkzsym@snowman@mikan}%
+ \def\sctkzsym@snowman@mikanfill{\sctkzsym@snowman@mikan}%
+ \def\sctkzsym@snowman@mikanpath{\path[draw=\sctkzsym@snowman@mikanstroke,fill=\sctkzsym@snowman@mikanfill]}%
+ \def\sctkzsym@snowman@leafstroke{\sctkzsym@snowman@leaf}%
+ \def\sctkzsym@snowman@leaffill{\sctkzsym@snowman@leaf}%
+ \def\sctkzsym@snowman@leafpath{\path[draw=\sctkzsym@snowman@leafstroke,fill=\sctkzsym@snowman@leaffill]}%
+ % check broom
+ \sctkzsym@hndl@key@withbool{snowman}{broom}%
+ \def\sctkzsym@snowman@broomstroke{\sctkzsym@snowman@broom}%
+ \def\sctkzsym@snowman@broompath{\path[draw=\sctkzsym@snowman@broomstroke]}%
+ %
+ % drawing snowman
+ \set@sctkzsym@coord@scl{\sctkzsym@snowman@scale}%
+ \ifdim\sctkzsym@coord@scl<\z@\set@sctkzsym@coord@scl{-\sctkzsym@snowman@scale}\fi%
+ %
+ %%%%% input from def file
+ %
+ \expandafter\ifx\csname sctkzsym@snowman@shape@\sctkzsym@snowman@shape\endcsname\relax
+ \PackageError{scsnowman}{%
+ Unsupported value `\sctkzsym@snowman@shape' for shape}\@ehc
+ \else
+ \csname sctkzsym@snowman@shape@\sctkzsym@snowman@shape\endcsname
+ \fi
+ %
+ %%%%%
+ %
+ % key initialization using default
+ \sctkzsym@snowman@defaultkeys
+}
+%
+% definition of \scsnowmandefault{...}
+\newcommand{\scsnowmandefault}[1]{%
+ \renewcommand{\sctkzsym@snowman@defaultkeys}{%
+ % key initialization
+ \sctkzsym@snowman@initkeys
+ % read <key>=<value> (init=true is silently ignored)
+ \setkeys{sctkzsym@snowman}{#1,init=false}%
+ }%
+ \sctkzsym@snowman@defaultkeys
+}
+%
+% definition of \usescsnowmanlibrary{...}
+\newcommand{\usescsnowmanlibrary}[1]{%
+ \edef\@tempa{\zap@space#1 \@empty}%
+ \@for\@tempa:=\@tempa\do{%
+ \chardef\sctkzsym@catcode=\catcode`\@\relax
+ \makeatletter\input{scsnowman-\@tempa.def}%
+ \catcode`\@=\sctkzsym@catcode\relax}%
+}
+\@onlypreamble\usescsnowmanlibrary
+%
+% load shape definitions
+\usescsnowmanlibrary{normal}% default
+%
+\endinput
+%%
+%% End of file `scsnowman.sty'.