- Commit
- c389afd8338939bf5bd033d8d012b94ef4127489
- Parent
- 0025360cc4e2f69e42d7dff29ff4901c263f0eb7
- Author
- Pablo <pablo-escobar@riseup.net>
- Date
Cleaned the code for boxed theorem environments
Source code for my notes on representations of semisimple Lie algebras and Olivier Mathieu's classification of simple weight modules
Cleaned the code for boxed theorem environments
1 file changed, 33 insertions, 28 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | preamble.tex | 61 | 33 | 28 |
diff --git a/preamble.tex b/preamble.tex @@ -51,41 +51,46 @@ % Configure the enumerate environment to use bold roman numerals \setenumerate[0]{label={\color{mosgreen}\normalfont \bfseries(\roman*)}} -% Useful theorem definitions -\BeforeBeginEnvironment{tcolorbox}{\savenotes} -\AfterEndEnvironment{tcolorbox}{\spewnotes} +% Macro for creating boxed theorem environments +\newcounter{theorem}[chapter] +\renewcommand{\thetheorem}{\thechapter.\arabic{theorem}} +\newcommand{\newboxedtheorem}[2] + { + \newtheorem{inner#1}[theorem]{#2} + \newenvironment{#1}[1][{}] + { + \begin{tcolorbox}[colback=thmbackground, colframe=thmrule] + \if\relax\detokenize{##1}\relax + \begin{inner#1} + \else + \begin{inner#1}[##1] + \fi + } + {\end{inner#1}\end{tcolorbox}} + } + +% Green theorem styles \newtheoremstyle{coloredtheorem}{}{}{\em}{}{\bf\color{mosgreen}}{.}{.5em}{} \newtheoremstyle{coloreddefinition}{}{}{}{}{\bf\color{mosgreen}}{.}{.5em}{} \newtheoremstyle{coloredremark}{}{}{}{}{\itshape\color{mosgreen}}{.}{.5em}{} -% ----------------------------------------------------------------------------- + +% Useful theorem definitions \theoremstyle{coloredtheorem} -\newtheorem{innertheorem}{Theorem}[chapter] -\newtheorem{innerlemma}[innertheorem]{Lemma} -\newtheorem{innercorollary}[innertheorem]{Corollary} -\newtheorem{innerproposition}[innertheorem]{Proposition} -\theoremstyle{coloreddefinition} -\newtheorem{innerdefinition}[innertheorem]{Definition} -% ----------------------------------------------------------------------------- +\newboxedtheorem{theorem}{Theorem} +\newboxedtheorem{lemma}{Lemma} +\newboxedtheorem{corollary}{Corollary} +\newboxedtheorem{proposition}{Proposition} \theoremstyle{coloreddefinition} -\newtheorem{example}[innertheorem]{Example} +\newboxedtheorem{definition}{Definition} +\newtheorem{example}[theorem]{Example} \theoremstyle{coloredremark} \newtheorem*{note}{Remark} -% ----------------------------------------------------------------------------- -\newenvironment{theorem}[1][{}] - {\begin{tcolorbox}[colback=thmbackground, colframe=thmrule]\begin{innertheorem}[#1]} - {\end{innertheorem}\end{tcolorbox}} -\newenvironment{lemma}[1][{}] - {\begin{tcolorbox}[colback=thmbackground, colframe=thmrule]\begin{innerlemma}[#1]} - {\end{innerlemma}\end{tcolorbox}} -\newenvironment{corollary}[1][{}] - {\begin{tcolorbox}[colback=thmbackground, colframe=thmrule]\begin{innercorollary}[#1]} - {\end{innercorollary}\end{tcolorbox}} -\newenvironment{proposition}[1][{}] - {\begin{tcolorbox}[colback=thmbackground, colframe=thmrule]\begin{innerproposition}[#1]} - {\end{innerproposition}\end{tcolorbox}} -\newenvironment{definition}[1][{}] - {\begin{tcolorbox}[colback=thmbackground, colframe=thmrule]\begin{innerdefinition}[#1]} - {\end{innerdefinition}\end{tcolorbox}} + +% Prevent tcolorbox from bundling footnotes inside color boxes. +% This prevents footnotes inside of boxed theorems from pilling up inside of +% the corresponding boxes +\BeforeBeginEnvironment{tcolorbox}{\savenotes} +\AfterEndEnvironment{tcolorbox}{\spewnotes} % Custom page style \fancypagestyle{custom}{%