-
Notifications
You must be signed in to change notification settings - Fork 5
/
sctkzsym-base.sty
157 lines (157 loc) · 5.5 KB
/
sctkzsym-base.sty
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
%%
%% This is file `sctkzsym-base.sty', part of scsnowman package.
%% Maintained on GitHub:
%% https://github.com/aminophen/scsnowman
%%
%% Copyright (c) 2015-2023 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{sctkzsym-base}
[2023/02/23 v1.3c Base for emoji variants using TikZ]
\RequirePackage{tikz}% pgfutil-latex.def requires everyshi
\RequirePackage{keyval}
%
\ifx\pfmtversion\@undefined\else
\ifx\@EveryShipout@Output\@undefined
% LaTeX2e 2020-10-01: an emulation by ``everyshi-ltx.sty''
% => pLaTeX2e 2020-10-01 natively supports it
\else
% older: the real ``everyshi.sty'' is loaded
\IfFileExists{pxeveryshi.sty}{\RequirePackage{pxeveryshi}}{}
\fi
\fi
%
% prepare for options
\newif\ifsctkzsym@document
\newif\ifsctkzsym@qed
\newif\ifsctkzsym@item
%
% options
\DeclareOption{documentX}{\sctkzsym@documenttrue}
\DeclareOption{nodocumentX}{\sctkzsym@documentfalse}
\DeclareOption{qedX}{\sctkzsym@qedtrue}
\DeclareOption{noqedX}{\sctkzsym@qedfalse}
\DeclareOption{itemX}{\sctkzsym@itemtrue}
\DeclareOption{noitemX}{\sctkzsym@itemfalse}
\ExecuteOptions{documentX,qedX,itemX}
\ProcessOptions\relax
%
% save QED symbol before change (joke)
\ifsctkzsym@qed
\def\sctkzsym@saving@qedsymbol{%
\ifx\qedsymbol\@undefined\else
\let\sctkzsym@saved@qedsymbol\qedsymbol
\fi
}
% if `amsthm' is already loaded, save it now
\sctkzsym@saving@qedsymbol
% otherwise, saving is delayed till \begin{document}
% (hope \makeqed... is not already executed...)
\ifx\sctkzsym@saved@qedsymbol\@undefined
\AtBeginDocument{\sctkzsym@saving@qedsymbol}
\fi
\newcommand{\makeqedother}{%
\let\qedsymbol\sctkzsym@saved@qedsymbol
}
\fi
%
% save item label before change (joke)
\ifsctkzsym@item
\let\sctkzsym@saved@labelitemi\labelitemi
\let\sctkzsym@saved@labelitemii\labelitemii
\let\sctkzsym@saved@labelitemiii\labelitemiii
\let\sctkzsym@saved@labelitemiv\labelitemiv
\newcommand{\makeitemother}{%
\let\labelitemi\sctkzsym@saved@labelitemi
\let\labelitemii\sctkzsym@saved@labelitemii
\let\labelitemiii\sctkzsym@saved@labelitemiii
\let\labelitemiv\sctkzsym@saved@labelitemiv
}
\fi
%
% key definitions
% * any value; if none, 'true' is assumed
\newcommand{\sctkzsym@define@key@withbool}[2]{%
\define@key{sctkzsym@#1}{#2}[true]{\expandafter\def\csname sctkzsym@#1@#2\endcsname{##1}}%
\expandafter\newif\csname ifsctkzsym@#1@#2\endcsname
}
% * any value; if none, an error will be raised
\newcommand{\sctkzsym@define@key@wodefault}[2]{%
\define@key{sctkzsym@#1}{#2}{\expandafter\def\csname sctkzsym@#1@#2\endcsname{##1}}%
}
% * one from arg #3; arg #3 should be comma-separated list of candidates
\newcommand{\sctkzsym@define@key@withword}[3]{%
\define@key{sctkzsym@#1}{#2}{\expandafter\def\csname sctkzsym@#1@#2\endcsname{##1}}%
% register known values (used in key handling)
\sctkzsym@hndlcnt\z@
\edef\@tempa{\zap@space#3 \@empty}%
\@for\@tempa:=\@tempa\do{%
\advance\sctkzsym@hndlcnt\@ne
\expandafter\let\csname sctkzsym@#1@#2@\romannumeral\sctkzsym@hndlcnt\endcsname\@tempa}%
}
% other known values (used in key handling)
\def\sctkzsym@true{true} % for bool strcmp
\def\sctkzsym@false{false} % for bool strcmp
%
% key handling
\newcount\sctkzsym@hndlcnt % for withword loop
\let\sctkzsym@status\relax % for withword status
\newcommand{\sctkzsym@hndl@key@withbool}[2]{%
\expandafter\ifx\csname sctkzsym@#1@#2\endcsname\sctkzsym@false\relax
\csname sctkzsym@#1@#2false\endcsname % <key>=false
\else
\csname sctkzsym@#1@#2true\endcsname % <key>=true/<color>
\expandafter\ifx\csname sctkzsym@#1@#2\endcsname\sctkzsym@true\relax
% <key>=true; <default-color>
\expandafter\def\csname sctkzsym@#1@#2\endcsname{\sctkzsym@defaultcolor}%
\fi
\fi
}
\newcommand{\sctkzsym@hndl@key@onlybool}[2]{%
\expandafter\ifx\csname sctkzsym@#1@#2\endcsname\sctkzsym@false\relax
\csname sctkzsym@#1@#2false\endcsname % <key>=false
\else
\expandafter\ifx\csname sctkzsym@#1@#2\endcsname\sctkzsym@true\relax
\csname sctkzsym@#1@#2true\endcsname % <key>=true
\else
\PackageError{sc#1}{Only true/false allowed for key `#2'}\@ehc
\csname sctkzsym@#1@#2false\endcsname % <key>=false
\fi
\fi
}
\newcommand{\sctkzsym@hndl@key@withword}[2]{{%
% initialize
\@tempcnta\@ne
\let\sctkzsym@status\relax
% check through the registered candidate values
\loop\expandafter\ifx\csname sctkzsym@#1@#2@\romannumeral\@tempcnta\endcsname\relax\else
\ifx\sctkzsym@status\relax
\expandafter\ifx\csname sctkzsym@#1@#2\expandafter\endcsname
\csname sctkzsym@#1@#2@\romannumeral\@tempcnta\endcsname\relax
\def\sctkzsym@status{0}%
\fi
\fi
\advance\@tempcnta\@ne
\repeat
% if the status is still not zero, user-specified value is invalid; throw an error
\ifx\sctkzsym@status\relax
\PackageError{sc#1}{Unsupported value `\csname sctkzsym@#1@#2\endcsname' for #2}\@ehc
\fi
}}
%
% setup for tikzpicture
\newlength{\sctkzsym@coord@baseline}
\newlength{\sctkzsym@coord@scl}
\newcommand*{\set@sctkzsym@coord@scl}[1]{\pgfmathsetlength{\sctkzsym@coord@scl}{#1\p@}}
\newcommand{\sctkzsym@beginyokobox}{\ifx\tate\@undefined\else\leavevmode\hbox\bgroup\yoko\fi}
\newcommand{\sctkzsym@endyokobox}{\ifx\tate\@undefined\else\egroup\fi}
\newcommand{\sctkzsym@defaultcolor}{}
\newcommand{\sctkzsym@defaultanticolor}{white}
%
\endinput
%%
%% End of file `sctkzsym-base.sty'.