-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy paththmboxes_white.sty
162 lines (147 loc) · 4.69 KB
/
thmboxes_white.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
158
159
160
161
162
% inspired by
% https://texblog.org/2015/09/30/fancy-boxes-for-theorem-lemma-and-proof-with-mdframed/
% https://tex.stackexchange.com/questions/391443/new-theorem-environment-with-manual-theorem-number
% notation:
% types: thm (theorem) / def (definition) / xmp (examples) / rem (remark)
% \begin{thm}[Name]{Label}{Reference Number}
% \end{thm}
% ============= %
% THEOREM %
% ============= %
% new counter (idk what this does ngl but it's needed)
\newcounter{thm}[section]\setcounter{thm}{0}
% set up new environment theorem with 3 arguments
\newenvironment{thm}[3][]{%
% newcommand thethm outputs argument 3 (Theorem Number)
\renewcommand{\thethm}{#3}
% step counter for reference(?)
\refstepcounter{thm}%
% Set up bounding boxes in tikz
% if there is no argument 1 (Title), then box
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!20]
{\strut Theorem~\thethm};}}
}%
% if there is argument 1 (Title), then add title
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!20]
{\strut Theorem~\thethm:~#1};}}%
}%
% set bounds of box
\mdfsetup{innertopmargin=5pt,linecolor=blue!20,%
linewidth=2pt,topline=true,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
% start environment with label as argument 2
\begin{mdframed}[]\relax%
\label{#2}}{\end{mdframed}}
% ================ %
% DEFINITION %
% ================ %
% new counter (idk what this does ngl but it's needed)
\newcounter{dfn}[section]\setcounter{dfn}{0}
% set up new environment theorem with 3 arguments
\newenvironment{dfn}[3][]{%
% newcommand thedef outputs argument 3 (Theorem Number)
\renewcommand{\thedfn}{#3}
% step counter for reference(?)
\refstepcounter{dfn}%
% Set up bounding boxes in tikz
% if there is no argument 1 (Title), then box
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=green!20]
{\strut Definition~\thedfn};}}
}%
% if there is argument 1 (Title), then add title
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=green!20]
{\strut Definition~\thedfn:~#1};}}%
}%
% set bounds of box
\mdfsetup{innertopmargin=5pt,linecolor=green!20,%
linewidth=2pt,topline=true,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
% start environment with label as argument 2
\begin{mdframed}[]\relax%
\label{#2}}{\end{mdframed}}
% ============ %
% REMARK %
% ============ %
% new counter (idk what this does ngl but it's needed)
\newcounter{rem}[section]\setcounter{rem}{0}
% set up new environment theorem with 3 arguments
\newenvironment{rem}[3][]{%
% newcommand therem outputs argument 3 (Theorem Number)
\renewcommand{\therem}{#3}
% step counter for reference(?)
\refstepcounter{rem}%
% Set up bounding boxes in tikz
% if there is no argument 1 (Title), then box
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=purple!20]
{\strut Remark~\therem};}}
}%
% if there is argument 1 (Title), then add title
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=purple!20]
{\strut Remark~\therem:~#1};}}%
}%
% set bounds of box
\mdfsetup{innertopmargin=5pt,linecolor=purple!20,%
linewidth=2pt,topline=true,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
% start environment with label as argument 2
\begin{mdframed}[]\relax%
\label{#2}}{\end{mdframed}}
% ============= %
% EXAMPLE %
% ============= %
% new counter (idk what this does ngl but it's needed)
\newcounter{xmp}[section]\setcounter{rem}{0}
% set up new environment theorem with 3 arguments
\newenvironment{xmp}[3][]{%
% newcommand therem outputs argument 3 (Theorem Number)
\renewcommand{\thexmp}{#3}
% step counter for reference(?)
\refstepcounter{xmp}%
% Set up bounding boxes in tikz
% if there is no argument 1 (Title), then box
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=yellow!40]
{\strut Example~\thexmp};}}
}%
% if there is argument 1 (Title), then add title
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=yellow!40]
{\strut Example~\thexmp:~#1};}}%
}%
% set bounds of box
\mdfsetup{innertopmargin=5pt,linecolor=yellow!40,%
linewidth=2pt,topline=true,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
% start environment with label as argument 2
\begin{mdframed}[]\relax%
\label{#2}}{\end{mdframed}}