-
Notifications
You must be signed in to change notification settings - Fork 2
/
homework.sty
151 lines (115 loc) · 3.61 KB
/
homework.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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{homework}
\usepackage[margin=1in]{geometry}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[many]{tcolorbox}
\usepackage{mathtools,amsthm,amssymb,amsfonts,bm}
\usepackage{thmtools,amsmath}
\usepackage{marginnote,sidenotes}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage{enumitem}
\usepackage{graphicx, svg}
\usepackage[bookmarks=true]{hyperref}
\usepackage{bookmark}
%% Constants %%
% Making epsilons look like epsilons...
\renewcommand{\epsilon}{\varepsilon}
\newcommand{\eps}{\epsilon}
\newcommand{\A}{\forall}
\newcommand{\E}{\exists}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
%% Frequently-used snippets %%
\newcommand{\abs}[1]{\left| #1 \right|}
\newcommand{\absle}[1]{\abs{#1} < \eps}
\newcommand{\absld}[1]{\abs{#1} < \delta}
\newcommand{\integral}[2]{\int_{#1}^{#2}}
\newcommand{\intab}{\integral{a}{b}}
\newcommand{\func}[2][f]{#1 \colon #2 \to \R}
\newcommand{\fabr}{\func[f]{[a,b]}}
\newcommand{\fog}{f \circ g}
\newcommand{\gof}{g \circ f}
\newcommand{\set}[1]{\left\{ #1 \right\}}
\newcommand{\partition}[1][P]{#1 = \set{x_0,x_1,\ldots,x_n}}
\newcommand{\deltaxi}{\Delta x_{i}}
\newcommand{\deltaxk}{\Delta x_{k}}
\newcommand{\lowersum}[1][f]{L(#1,P) = \sum^n_{i=1} m_i\deltaxi}
\newcommand{\uppersum}[1][f]{U(#1,P) = \sum^n_{i=1} M_i\deltaxi}
%% Convenience Wrappers %%
\newcommand{\hint}[1]{
\begin{tcolorbox}[title=Hint]
#1
\end{tcolorbox}
}
%% Document Setup %%
\makeatletter
\let\Title\@title
\let\Author\@author
\let\Date\@date
\makeatother
%% \usepackage{graphicx, svg} %%
\graphicspath{{images/}}
\svgpath{{images/}}
%% \usepackage{fancyhdr} %%
\pagestyle{fancy}
\setlength{\headheight}{25pt}
\lhead{\Title}
\rhead{\Author}
%% \usepackage{hyperref} %%
\hypersetup{
pdfauthor={\Author},
pdftitle={\Title},
linktoc={all}
}
%% \usepackage{titlesec} %%
\titleformat{\subsection} % command
[runin] % shape
{\normalfont\bfseries} % format
{\thesubsection} % label
{1em} % sep
{}
\titleformat{\subsubsection} % command
[runin] % shape
{\normalfont\bfseries} % format
{\thesubsubsection} % label
{1em} % sep
{}
%% Spacing/Formatting %%
\setstretch{1.3}
\newcommand{\resetpar}{
\setlength{\parskip}{0.5em}
}
%% tcolorbox Environments %%
\renewenvironment{proof}
{{\sffamily\bfseries Proof. }\resetpar}
{\qed}
\tcbset{
boxrule=0pt,
sharp corners,
enhanced jigsaw,
drop fuzzy shadow,
breakable
}
\newtcolorbox{answer}{
beforeafter skip balanced=25pt,
colback={White!90!CornflowerBlue},
borderline west={3pt}{0pt}{NavyBlue!80!white}
}
\tcolorboxenvironment{proof}{
beforeafter skip balanced=25pt,
colback={White!90!CornflowerBlue},
borderline west={3pt}{0pt}{NavyBlue!80!white}
}
%% Show code and output %%
%% (From: https://tex.stackexchange.com/questions/194854/how-to-show-latex-commands-in-text-mode/392818) %%
\newcommand{\gfcb}[1]{%
\fcolorbox{white}{gray!10!}{\quad\strut #1\quad}
} % gfcb := gray fcolorbox
\newcommand{\cop}[1]{%
\gfcb{\texttt{\detokenize{#1}}}
\ensuremath{\quad \longrightarrow \quad & #1}
} % cop := code output