From 86dcec5fc7fb9d6a8b5d4617d5eecaa1e59c0fb4 Mon Sep 17 00:00:00 2001
From: Blaise Thompson <blaise@untzag.com>
Date: Mon, 12 Mar 2018 16:43:35 -0500
Subject: 2018-03-12 16:43

---
 dissertation.cls | 37 +++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)

(limited to 'dissertation.cls')

diff --git a/dissertation.cls b/dissertation.cls
index 74cd49b..452057b 100644
--- a/dissertation.cls
+++ b/dissertation.cls
@@ -10,7 +10,7 @@
 \RequirePackage[letterpaper, margin=1in]{geometry}  % 1 inch margins required
 \RequirePackage{setspace}
 \RequirePackage{afterpage}
-\RequirePackage{color}
+\RequirePackage{xcolor}
 \RequirePackage{array} 
 
 % --- headers -------------------------------------------------------------------------------------
@@ -49,9 +49,6 @@
 
 \newcommand{\dsignature}[1]{\hfill \normalfont{-- #1}}
   
-% THE FOLLOWING IS DARK MAGIC THAT I DON'T UNDERSTAND
-% I'M SURE I COULD DO BETTER...
-% - Blaise 2018-03-06
 \RequirePackage[shortlabels]{enumitem}
 \setlist[enumerate, 1]{nosep}
 \setlist[enumerate, 2]{nosep, topsep=-5ex}
@@ -78,11 +75,35 @@
 % --- code environment ----------------------------------------------------------------------------
 
 \RequirePackage{etoolbox}
-\RequirePackage[chapter]{minted}
+\RequirePackage[section]{minted}
 \usemintedstyle{colorfuli}
-\BeforeBeginEnvironment{minted}{\begin{singlespace}}
-\AfterEndEnvironment{minted}{\end{singlespace}}
-\setminted[python]{linenos=false, frame=lines}
+\setminted[python]{linenos=false, frame=none}
+
+\definecolor{bg}{rgb}{0.95,0.95,0.95}
+
+\setmintedinline[python]{bgcolor=bg}
+
+\RequirePackage[many]{tcolorbox}
+\tcbuselibrary{minted}
+
+\NewTCBListing{codefragment}{mo}{%
+  colback=bg,
+  boxrule=1pt,
+  colframe=bg,
+  arc=0,
+  shadow=false,
+  boxsep=1ex, top=0pt, left=0pt, right=0pt, bottom=0pt,
+  comment={\hfill(\arabic{chapter}.\arabic{equation})},
+  listing outside comment,
+  righthand width=2.5em,
+  sidebyside gap=0pt,
+  minted language=#1,
+  before skip =-0.5\baselinestretch,
+  after skip=2\baselinestretch,
+}
+
+\BeforeBeginEnvironment{codefragment}{\begin{singlespace}\stepcounter{equation}}
+\AfterEndEnvironment{codefragment}{\end{singlespace}}
 
 % --- tables --------------------------------------------------------------------------------------
 
-- 
cgit v1.2.3

