%%
%% This is file `scsnowman.sty', part of scsnowman package.
%% Maintained on GitHub:
%% https://github.com/aminophen/scsnowman
%%
%% Copyright (c) 2015-2017 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}[2017/01/22 v1.1 Snowman variants using TikZ]
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{sctkzsym-base}}
\ProcessOptions\relax
\RequirePackage{sctkzsym-base}[2017/01/22]
%
% 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
%
% key initialization
\newcommand\sctkzsym@snowman@initkeys{%
  \def\sctkzsym@snowman@init{false}%
  \def\sctkzsym@snowman@scale{1}%
  \def\sctkzsym@snowman@body{false}%
  \def\sctkzsym@snowman@eyes{true}%  default on
  \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@adjustbaseline{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@withbool{snowman}{body}
\sctkzsym@define@key@withbool{snowman}{eyes}
\sctkzsym@define@key@wodefault{snowman}{mouthshape}
\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}{adjustbaseline}
%
% count definitions for \sctkzsym@hndl@key@wodefault
\newcount\sctkzsym@snowman@mouthshape@c
%
% 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@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@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 mouth (currently mouth=<color> not supported; falling back to default-(anti)color)
  \sctkzsym@hndl@key@wodefault{snowman}{mouthshape}{smile}{frown}{tight}%
  \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 adjustbaseline
  \sctkzsym@hndl@key@onlybool{snowman}{adjustbaseline}%
  %
  % drawing snowman
  \set@sctkzsym@coord@scl{\sctkzsym@snowman@scale}%
  \ifdim\sctkzsym@coord@scl<0pt\set@sctkzsym@coord@scl{-\sctkzsym@snowman@scale}\fi%
  %
  %%%%% input from def file
  %
  \sctkzsym@snowman@normal
  %
  %%%%%
  %
  % 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
}
%
% load shape definitions
\input{scsnowman-normal.def}
%
\endinput
%%
%% End of file `scsnowman.sty'.
