masters-thesis

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

kaotheorems.sty (11789B)


      1 \ProvidesPackage{kaotheorems}
      2 
      3 %----------------------------------------------------------------------------------------
      4 %	PACKAGE OPTIONS AND DEPENDENCIES
      5 %----------------------------------------------------------------------------------------
      6 
      7 \RequirePackage{kvoptions} % Handle package options
      8 \SetupKeyvalOptions{
      9 	family = kaotheorems,
     10 	prefix = kaotheorems@
     11 }
     12 
     13 \DeclareBoolOption{framed}% If true, put theorems into colorful boxes, otherwise write them like normal text
     14 
     15 % Define the options to finely tune the background color of each element.
     16 % If only the 'background' option is specified, all types of theorem will have that background. If more specific options are set, the previous option will be overwritten.
     17 \newcommand{\kaotheorems@defaultbg}{Goldenrod!45!white}
     18 \DeclareStringOption[\kaotheorems@defaultbg]{background}
     19 \DeclareStringOption[\kaotheorems@defaultbg]{theorembackground}
     20 \DeclareStringOption[\kaotheorems@defaultbg]{propositionbackground}
     21 \DeclareStringOption[\kaotheorems@defaultbg]{lemmabackground}
     22 \DeclareStringOption[\kaotheorems@defaultbg]{corollarybackground}
     23 \DeclareStringOption[\kaotheorems@defaultbg]{definitionbackground}
     24 \DeclareStringOption[\kaotheorems@defaultbg]{assumptionbackground}
     25 \DeclareStringOption[\kaotheorems@defaultbg]{remarkbackground}
     26 \DeclareStringOption[\kaotheorems@defaultbg]{examplebackground}
     27 \DeclareStringOption[\kaotheorems@defaultbg]{exercisebackground}
     28 
     29 \ProcessKeyvalOptions{kaotheorems} % Process the options
     30 
     31 \let\openbox\relax % Workaround to avoid a nasty error
     32 \RequirePackage{amsmath} % Improved mathematics
     33 \RequirePackage{amsthm} % Mathematical environments
     34 \RequirePackage{thmtools} % Theorem styles
     35 
     36 %----------------------------------------------------------------------------------------
     37 %	STYLE DEFINITIONS
     38 %----------------------------------------------------------------------------------------
     39 
     40 \ifkaotheorems@framed% Define the style of the mdframed boxes for theorems
     41 	\RequirePackage[most]{tcolorbox}
     42 
     43 	% Box style
     44 	\tcbset{tcbkao/.style={
     45 		breakable,
     46 		before skip=\topskip,
     47 		after skip=\topskip,
     48 		left skip=0pt,
     49 		right skip=0pt,
     50 		top=5pt,
     51 		bottom=3pt,
     52 		left=2pt,
     53 		right=2pt,
     54 		sharp corners,
     55 		boxrule=0pt,
     56 		frame hidden,
     57 	}}
     58 
     59 	% Theorem styles
     60 	\declaretheoremstyle[
     61 		%spaceabove=.5\thm@preskip,
     62 		%spacebelow=.5\thm@postskip,
     63 		%headfont=\normalfont\bfseries,%\scshape,
     64 		%notefont=\normalfont, notebraces={ (}{)},
     65 		bodyfont=\normalfont\itshape,
     66 		%headformat={\NAME\space\NUMBER\space\NOTE},
     67 		headpunct={},
     68 		%postheadspace={.5em plus .1em minus .1em},
     69 		%prefoothook={\hfill\qedsymbol}
     70 	]{kaoplain}
     71 	\declaretheoremstyle[
     72 		%spaceabove=.5\thm@preskip,
     73 		%spacebelow=.5\thm@postskip,
     74 		%headfont=\normalfont\bfseries,%\scshape,
     75 		%notefont=\normalfont, notebraces={ (}{)},
     76 		bodyfont=\normalfont\itshape,
     77 		%headformat={\NAME\space\NUMBER\space\NOTE},
     78 		headpunct={},
     79 		postheadspace={.5em plus .1em minus .1em},
     80 		%prefoothook={\hfill\qedsymbol}
     81 	]{kaodefinition}
     82 	\declaretheoremstyle[
     83 		%spaceabove=.5\thm@preskip,
     84 		%spacebelow=.5\thm@postskip,
     85 		%headfont=\normalfont\bfseries,%\scshape,
     86 		%notefont=\normalfont, notebraces={ (}{)},
     87 		bodyfont=\normalfont\itshape,
     88 		%headformat={\NAME\space\NUMBER\space\NOTE},
     89 		headpunct={},
     90 		postheadspace={.5em plus .1em minus .1em},
     91 		%prefoothook={\hfill\qedsymbol}
     92 	]{kaoassumption}
     93 	\declaretheoremstyle[
     94 		%spaceabove=.5\thm@preskip,
     95 		%spacebelow=.5\thm@postskip,
     96 		%headfont=\normalfont\bfseries,
     97 		%notefont=\normalfont, notebraces={ (}{)},
     98 		%bodyfont=\normalfont,
     99 		%headformat={\footnotesize$\triangleright$\space\normalsize\NAME\space\NUMBER\space\NOTE},
    100 		%headformat={\NAME\space\NUMBER\space\NOTE},
    101 		headpunct={},
    102 		postheadspace={.5em plus .1em minus .1em},
    103 		%refname={theorem,theorems},
    104 		%Refname={Theorem,Theorems},
    105 	]{kaoremark}
    106 	\declaretheoremstyle[
    107 		%spaceabove=.5\thm@preskip,
    108 		%spacebelow=.5\thm@postskip,
    109 		%headfont=\normalfont\bfseries,
    110 		%notefont=\normalfont, notebraces={ (}{)},
    111 		%bodyfont=\normalfont,
    112 		%headformat={\NAME\space\NUMBER\space\NOTE},
    113 		headpunct={},
    114 		postheadspace={.5em plus .1em minus .1em},
    115 		%prefoothook={\hfill\qedsymbol}
    116 		%refname={theorem,theorems},
    117 		%Refname={Theorem,Theorems},
    118 	]{kaoexample}
    119 	\declaretheoremstyle[
    120 		%spaceabove=.5\thm@preskip,
    121 		%spacebelow=.5\thm@postskip,
    122 		%headfont=\normalfont\bfseries,
    123 		%notefont=\normalfont, notebraces={ (}{)},
    124 		%bodyfont=\small,
    125 		%headformat={\NAME\space\NUMBER\space\NOTE},
    126 		headpunct={},
    127 		postheadspace={.5em plus .1em minus .1em},
    128 		%prefoothook={\hfill\qedsymbol}
    129 		%refname={theorem,theorems},
    130 		%Refname={Theorem,Theorems},
    131 	]{kaoexercise}
    132 
    133 	% Theorems using the 'kaoplain' style
    134 	\theoremstyle{kaoplain}
    135 	\declaretheorem[
    136 		name=Theorem,
    137 		style=kaoplain,
    138 		%refname={theorem,theorems},
    139 		refname={Theorem,Theorems},
    140 		Refname={Theorem,Theorems},
    141 		numberwithin=section,
    142 	]{theorem}
    143 	\tcolorboxenvironment{theorem}{
    144 		colback=\kaotheorems@theorembackground,tcbkao
    145 	}
    146 	\declaretheorem[
    147 		name=Proposition,
    148 		%refname={proposition,propositions},
    149 		refname={Proposition,Propositions},
    150 		Refname={Proposition,Propositions},
    151 		sibling=theorem,
    152 	]{proposition}
    153 	\tcolorboxenvironment{proposition}{
    154 		colback=\kaotheorems@propositionbackground,tcbkao
    155 	}
    156 	\declaretheorem[
    157 		name=Lemma,
    158 		%refname={lemma,lemmas},
    159 		refname={Lemma,Lemmas},
    160 		Refname={Lemma,Lemmas},
    161 		sibling=theorem,
    162 	]{lemma}
    163 	\tcolorboxenvironment{lemma}{
    164 		colback=\kaotheorems@lemmabackground,tcbkao
    165 	}
    166 	\declaretheorem[
    167 		name=Corollary,
    168 		%refname={corollary,corollaries},
    169 		refname={Corollary,Corollaries},
    170 		Refname={Corollary,Corollaries},
    171 		sibling=theorem,
    172 	]{corollary}
    173 	\tcolorboxenvironment{corollary}{
    174 		colback=\kaotheorems@corollarybackground,tcbkao
    175 	}
    176 
    177 	% Theorems using the 'kaodefinition' style
    178 	\theoremstyle{kaodefinition}
    179 	\declaretheorem[
    180 		name=Definition,
    181 		%refname={definition,definitions},
    182 		refname={Definition,Definitions},
    183 		Refname={Definition,Definitions},
    184 		numberwithin=section,
    185 	]{definition}
    186 	\tcolorboxenvironment{definition}{
    187 		colback=\kaotheorems@definitionbackground,tcbkao
    188 	}
    189 
    190 	% Theorems using the 'kaoassumption' style
    191 	\theoremstyle{kaoassumption}
    192 	\declaretheorem[
    193 		name=Assumption,
    194 		%refname={assumption,assumptions},
    195 		refname={Assumption,Assumptions},
    196 		Refname={Assumption,Assumptions},
    197 		numberwithin=section,
    198 	]{assumption}
    199 	\tcolorboxenvironment{assumption}{
    200 		colback=\kaotheorems@assumptionbackground,tcbkao
    201 	}
    202 
    203 	% Theorems using the 'kaoremark' style
    204 	\theoremstyle{kaoremark}
    205 	\declaretheorem[
    206 		name=Remark,
    207 		%refname={remark,remarks},
    208 		refname={Remark,Remarks},
    209 		Refname={Remark,Remarks},
    210 		numberwithin=section,
    211 	]{remark}
    212 	\tcolorboxenvironment{remark}{
    213 		colback=\kaotheorems@remarkbackground,tcbkao
    214 	}
    215 
    216 	% Theorems using the 'kaoexample' style
    217 	\theoremstyle{kaoexample}
    218 	\declaretheorem[
    219 		name=Example,
    220 		%refname={example,examples},
    221 		refname={Example,Examples},
    222 		Refname={Example,Examples},
    223 		numberwithin=section,
    224 	]{example}
    225 	\tcolorboxenvironment{example}{
    226 		colback=\kaotheorems@examplebackground,tcbkao
    227 	}
    228 
    229 	% Theorems using the 'kaoexercise' style
    230 	\theoremstyle{kaoexercise}
    231 	\declaretheorem[
    232 		name=Exercise,
    233 		%refname={exercise,exercises},
    234 		refname={Exercise,Exercises},
    235 		Refname={Exercise,Exercises},
    236 		numberwithin=section,
    237 	]{exercise}
    238 	\tcolorboxenvironment{exercise}{
    239 		colback=\kaotheorems@exercisebackground,tcbkao
    240 	}
    241 
    242 	%\renewcommand{\thetheorem}{\arabic{chapter}.\arabic{section}.\arabic{theorem}}
    243 	%\renewcommand{\thetheorem}{\arabic{subsection}.\arabic{theorem}}
    244 	%\renewcommand{\qedsymbol}{$\blacksquare$}
    245 \else % If not using mdframed
    246 	% Theorem styles
    247 	\declaretheoremstyle[
    248 		spaceabove=.6\thm@preskip,
    249 		spacebelow=.1\thm@postskip,
    250 		%headfont=\normalfont\bfseries,%\scshape,
    251 		%notefont=\normalfont, notebraces={ (}{)},
    252 		bodyfont=\normalfont\itshape,
    253 		%headformat={\NAME\space\NUMBER\space\NOTE},
    254 		headpunct={},
    255 		%postheadspace={.5em plus .1em minus .1em},
    256 		%prefoothook={\hfill\qedsymbol}
    257 	]{kaoplain}
    258 	\declaretheoremstyle[
    259 		spaceabove=.6\thm@preskip,
    260 		spacebelow=.1\thm@postskip,
    261 		%headfont=\normalfont\bfseries,%\scshape,
    262 		%notefont=\normalfont, notebraces={ (}{)},
    263 		bodyfont=\normalfont\itshape,
    264 		%headformat={\NAME\space\NUMBER\space\NOTE},
    265 		headpunct={},
    266 		%postheadspace={.5em plus .1em minus .1em},
    267 		%prefoothook={\hfill\qedsymbol}
    268 	]{kaodefinition}
    269 	\declaretheoremstyle[
    270 		spaceabove=.6\thm@preskip,
    271 		spacebelow=.1\thm@postskip,
    272 		%headfont=\normalfont\bfseries,%\scshape,
    273 		%notefont=\normalfont, notebraces={ (}{)},
    274 		bodyfont=\normalfont\itshape,
    275 		%headformat={\NAME\space\NUMBER\space\NOTE},
    276 		headpunct={},
    277 		%postheadspace={.5em plus .1em minus .1em},
    278 		%prefoothook={\hfill\qedsymbol}
    279 	]{kaoassumption}
    280 	\declaretheoremstyle[
    281 		spaceabove=.6\thm@preskip,
    282 		spacebelow=.1\thm@postskip,
    283 		%headfont=\normalfont\bfseries,
    284 		%notefont=\normalfont, notebraces={ (}{)},
    285 		%bodyfont=\normalfont,
    286 		%headformat={\footnotesize$\triangleright$\space\normalsize\NAME\space\NUMBER\space\NOTE},
    287 		%headformat={\NAME\space\NUMBER\space\NOTE},
    288 		headpunct={},
    289 		%postheadspace={.5em plus .1em minus .1em},
    290 		%refname={theorem,theorems},
    291 		%Refname={Theorem,Theorems},
    292 	]{kaoremark}
    293 	\declaretheoremstyle[
    294 		spaceabove=.6\thm@preskip,
    295 		spacebelow=.1\thm@postskip,
    296 		%headfont=\normalfont\bfseries,
    297 		%notefont=\normalfont, notebraces={ (}{)},
    298 		%bodyfont=\normalfont,
    299 		%headformat={\NAME\space\NUMBER\space\NOTE},
    300 		headpunct={},
    301 		%postheadspace={.5em plus .1em minus .1em},
    302 		%prefoothook={\hfill\qedsymbol}
    303 		%refname={theorem,theorems},
    304 		%Refname={Theorem,Theorems},
    305 	]{kaoexample}
    306 	\declaretheoremstyle[
    307 		%spaceabove=.5\thm@preskip,
    308 		%spacebelow=.5\thm@postskip,
    309 		%headfont=\normalfont\bfseries,
    310 		%notefont=\normalfont, notebraces={ (}{)},
    311 		%bodyfont=\normalfont,
    312 		%headformat={\NAME\space\NUMBER\space\NOTE},
    313 		headpunct={},
    314 		postheadspace={.5em plus .1em minus .1em},
    315 		%prefoothook={\hfill\qedsymbol}
    316 		%refname={theorem,theorems},
    317 		%Refname={Theorem,Theorems},
    318 	]{kaoexercise}
    319 
    320 	% Theorems using the 'kaoplain' style
    321 	\theoremstyle{kaoplain}
    322 	\declaretheorem[
    323 		name=Theorem,
    324 		refname={Theorem,Theorems},
    325 		Refname={Theorem,Theorems},
    326 		numberwithin=section,
    327 	]{theorem}
    328 	\declaretheorem[
    329 		name=Proposition,
    330 		refname={Proposition,Propositions},
    331 		Refname={Proposition,Propositions},
    332 		sibling=theorem,
    333 	]{proposition}
    334 	\declaretheorem[
    335 		name=Lemma,
    336 		refname={Lemma,Lemmas},
    337 		Refname={Lemma,Lemmas},
    338 		sibling=theorem,
    339 	]{lemma}
    340 	\declaretheorem[
    341 		name=Corollary,
    342 		refname={Corollary,Corollaries},
    343 		Refname={Corollary,Corollaries},
    344 		sibling=theorem,
    345 	]{corollary}
    346 
    347 	% Theorems using the 'kaodefinition' style
    348 	\theoremstyle{kaodefinition}
    349 	\declaretheorem[
    350 		name=Definition,
    351 		refname={Definition,Definitions},
    352 		Refname={Definition,Definitions},
    353 		numberwithin=section,
    354 	]{definition}
    355 	
    356 	% Theorems using the 'kaoassumption' style
    357 	\theoremstyle{kaoassumption}
    358 	\declaretheorem[
    359 		name=Assumption,
    360 		refname={Assumption,Assumptions},
    361 		Refname={Assumption,Assumptions},
    362 		numberwithin=section,
    363 	]{assumption}
    364 
    365 	% Theorems using the 'kaoremark' style
    366 	\theoremstyle{kaoremark}
    367 	\declaretheorem[
    368 		name=Remark,
    369 		refname={Remark,Remarks},
    370 		Refname={Remark,Remarks},
    371 		numberwithin=section,
    372 	]{remark}
    373 
    374 	% Theorems using the 'kaoexample' style
    375 	\theoremstyle{kaoexample}
    376 	\declaretheorem[
    377 		name=Example,
    378 		refname={Example,Examples},
    379 		Refname={Example,Examples},
    380 		numberwithin=section,
    381 	]{example}
    382 
    383 	% Theorems using the 'kaoexercise' style
    384 	\theoremstyle{kaoexercise}
    385 	\declaretheorem[
    386 		name=Exercise,
    387 		refname={Exercise,Exercises},
    388 		Refname={Exercise,Exercises},
    389 		numberwithin=section,
    390 	]{exercise}
    391 
    392 	%\renewcommand{\thetheorem}{\arabic{chapter}.\arabic{section}.\arabic{theorem}}
    393 	%\renewcommand{\thetheorem}{\arabic{subsection}.\arabic{theorem}}
    394 	%\renewcommand{\qedsymbol}{$\blacksquare$}
    395 \fi
    396