summaryrefslogtreecommitdiff
path: root/montgomery.cls
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-11-29 17:01:13 -0500
committerBenji Dial <benji@benjidial.net>2024-11-29 17:01:13 -0500
commit5b7d5be5f7718a293ff4026c70a171749ce7c852 (patch)
treef53473645b1eea42e79c9f14e304ff930f1b738b /montgomery.cls
downloadlatex-classes-5b7d5be5f7718a293ff4026c70a171749ce7c852.tar.gz
first commit
Diffstat (limited to 'montgomery.cls')
-rw-r--r--montgomery.cls118
1 files changed, 118 insertions, 0 deletions
diff --git a/montgomery.cls b/montgomery.cls
new file mode 100644
index 0000000..e8a9f56
--- /dev/null
+++ b/montgomery.cls
@@ -0,0 +1,118 @@
+% montgomery.cls
+% https://git.benjidial.net/latex-classes
+% Written by Benji Dial, 2024
+% Released under CC0 1.0
+% https://creativecommons.org/publicdomain/zero/1.0/
+
+\ProvidesClass{montgomery}
+\LoadClass{book}
+
+\usepackage{amssymb}
+\usepackage{geometry}
+\usepackage{enumitem}
+\usepackage{amsthm}
+\usepackage[svgnames]{xcolor}
+\usepackage{thmtools}
+\usepackage{unicode-math}
+\usepackage{pdftexcmds}
+\usepackage[skins,breakable]{tcolorbox}
+\usepackage{hyperref}
+\usepackage[capitalize]{cleveref}
+\usepackage{rotating}
+\usepackage{environ}
+
+\setmainfont{CMU Sans Serif}
+\setmathfont{Concrete Math}
+
+\makeatletter
+
+\newcommand{\barcolor}[1]{%
+ \ifnum\pdf@strcmp{#1}{definition}=0
+ DarkBlue%
+ \else\ifnum\pdf@strcmp{#1}{example}=0
+ DarkGreen%
+ \else\ifnum\pdf@strcmp{#1}{exercise}=0
+ OrangeRed%
+ \else\ifnum\pdf@strcmp{#1}{theorem}=0
+ Maroon%
+ \else\ifnum\pdf@strcmp{#1}{suggestion}=0
+ MediumVioletRed%
+ \fi\fi\fi\fi\fi
+}
+
+\newcommand{\myenvir}{\@currenvir}
+
+\renewenvironment{proof}[1][\proofname]{
+ \par\pushQED{\qed}\normalfont
+ \relax{\itshape \bfseries #1\@addpunct{.}}\hspace\labelsep\ignorespaces
+}{\popQED\par}
+
+\newcounter{solution}
+
+\newcommand{\solutions}{\setcounter{solution}{0}}
+
+\newcommand{\addsolution}[1]{
+ \g@addto@macro\solutions{
+ \stepcounter{solution}
+ \begin{proof}[\cref{solution-\thesolution-exercise}]
+ \par
+ \label{solution-\thesolution}
+ #1
+ \end{proof}
+ }
+}
+
+\newenvironment{solution}{%
+ \stepcounter{solution}
+ \label{solution-\thesolution-exercise}
+ \par
+ \textit{Solution: Page \pageref{solution-\thesolution}.}
+ \Collect@Body\addsolution
+}{}
+
+\makeatother
+
+\declaretheoremstyle[
+ spaceabove=0pt,
+ spacebelow=0pt,
+ headfont=\bfseries,
+ notefont=\mdseries,
+ bodyfont=\mdseries,
+ notebraces={(}{)},
+ preheadhook={
+ \edef\mycolor{\barcolor{\myenvir}}
+ \begin{tcolorbox}[
+ enhanced,
+ frame hidden,
+ interior hidden,
+ borderline west={2pt}{0pt}{\mycolor},
+ left*=\topsep,
+ right*=0pt,
+ top=0pt,
+ bottom=0pt,
+ parbox=false,
+ breakable
+ ]
+ },
+ postfoothook={
+ \end{tcolorbox}
+ }
+]{boxedthm}
+
+\declaretheorem[style=boxedthm,numbered=no]{definition}
+\declaretheorem[style=boxedthm,numbered=no]{example}
+\declaretheorem[style=boxedthm,parent=chapter]{exercise}
+\declaretheorem[style=boxedthm,parent=chapter]{theorem}
+\declaretheorem[style=boxedthm,numbered=no]{suggestion}
+
+\setlist[itemize]{itemsep=0pt,topsep=0pt}
+\setlist[enumerate]{itemsep=0pt,topsep=0pt,label=\alph*)}
+\setlist[enumerate,2]{label=\roman*)}
+
+\DeclareMathOperator{\arity}{arity}
+\DeclareMathOperator{\free}{free}
+
+\AtBeginDocument{
+ \setlength{\parskip}{\topsep}
+ \setlength{\parindent}{0pt}
+}