-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcommands.tex
213 lines (189 loc) · 7.34 KB
/
commands.tex
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
% IMPORTANT NOTE
% --------------
% For your .tex files to be able to find this, it either needs to
% be in the same directory, or located as per
% https://tex.stackexchange.com/a/1167/243466 .
% You can make a symlink (or equivalent for non-Linux) so that the file
% can stay elsewhere
% Use with \input{commands.tex}
\usepackage{amssymb, amsmath, amsthm} % https://tex.stackexchange.com/a/32102
\usepackage{mathtools} % makes maths nicer
\usepackage[margin=1in]{geometry} % Gives smaller margins
\usepackage{algorithm}
\usepackage[noend]{algpseudocode} % algorithm and algopseudocode need to load before hyperref and caption (I think)
\usepackage[colorlinks=true,linkcolor=blue,citecolor=magenta]{hyperref} % For urls and to make references nicer
% http://www.ams.org/arc/tex/amscls/amsthdoc.pdf for theorems
% Possible packages:
% \usepackage{biblatex} % For bibliographies
\usepackage{graphicx} % For including images
\usepackage{float} % For [H] option for figures
\usepackage{enumitem} % For controlling lists better: see environments defiend below
\usepackage{xparse} % For helping with arguments of new environments/commands
\usepackage{bm} % For better bold maths (use \bm)
\usepackage{caption} % Makes sure that empty figure captions don't have a ":"
\usepackage{wrapfig} % to make wrapfigures - pretty self-explanatory
\usepackage{pdfpages} % To include other pdf pages (e.g. coversheets), use \includepdf[pages=-]{file.pdf} to include all of file.pdf .
\usepackage{fancyvrb} % To do fancy stuff with verbatim environments
\usepackage{polynom} % For poly long div with \polylongdiv
\usepackage{mathrsfs} % For mathscr fonts
% Cleveref package for nice references
\usepackage[capitalise,noabbrev]{cleveref} % capitalise figure names and don't abbreviate
% Tikz library for drawings
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{arrows.meta} % For drawing arrows in tikz
\usetikzlibrary{calc} % For calculating coordinates in tikz
\usepackage{lmodern} % Different monospace font
\usepackage[T1]{fontenc} % idk why
\usepackage{listings} % For including code
\usepackage{lstautogobble} % Remove leading tabs
\lstset{basicstyle=\ttfamily\bfseries, columns=fixed, tabsize=4, autogobble=true}
% You might want to add an autocomplete to your editor for:
% \begin{center}\vspace{-1.5em}\begin{tabular}{c}\begin{lstlisting}
% \end{lstlisting}\end{tabular}\vspace{-1em}\end{center}
% That will make a centered code listing.
% Change the document-wide spacings
\setlength{\parindent}{0in} % Make sure paragraphs don't indent
\setlength{\parskip}{1em} % Put a space between paragraphs
% Ensure that display maths environments aren't too spaced out
\setlength{\abovedisplayskip}{0.8em}
\setlength{\abovedisplayshortskip}{0.5em}
\setlength{\belowdisplayskip}{0.8em}
\setlength{\belowdisplayshortskip}{0.5em}
\allowdisplaybreaks % Lets equations run over pages
% amsthm definitions
\newtheoremstyle{plain}
{2\topsep} % ABOVESPACE
{0} % BELOWSPACE
{\itshape} % BODYFONT
{0pt} % INDENT (empty value is the same as 0pt)
{\bfseries} % HEADFONT
{.} % HEADPUNCT
{5pt plus 1pt minus 1pt} % HEADSPACE
{} % CUSTOM-HEAD-SPEC
\newtheoremstyle{case}
{6pt}
{6pt}
{}
{}
{\bfseries}
{:}
{.5em}
{}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\newtheorem{lem}{Lemma}
\newtheorem{prop}{Proposition}
\newtheorem{computation}{Computation}
\newtheorem*{rmk}{Remark}
\theoremstyle{definition}
\newtheorem{defn}{Definition}
\newtheorem*{example}{Example}
\theoremstyle{case}
\newtheorem{case}{Case}
\newtheorem*{BC}{Base Case}
\newtheorem*{BCs}{Base Cases}
\newtheorem*{IS}{Inductive Step}
\newtheorem*{IF}{Proof of ``if''}
\newtheorem*{OI}{Proof of ``only if''}
% For making an enumerate environment with the list items set into the margins of the page.
\newenvironment{insetenum}[1][]
{\begin{enumerate}[leftmargin=0pt,#1]}
{\end{enumerate}}
% For indenting things
\newenvironment{indentblock}
{\begin{itemize}[parsep=\parskip,topsep=0pt,partopsep=0pt,leftmargin=0.5cm]\item[]}
{\end{itemize}}
% Defines a compact enumerate and itemize with an optional argument to specify the top-spacing (default is -1em to cancel the \parskip).
\newenvironment{compenum}[1][-0.5em]
{\begin{enumerate}[noitemsep,topsep=#1,parsep=0.5ex,partopsep=0pt]}
{\end{enumerate}}
\newenvironment{compitem}[1][-0.5em]
{\begin{itemize}[noitemsep,topsep=#1,parsep=0pt,partopsep=0pt]}
{\end{itemize}}
% Use this when there are multiple steps in a proof of something, like each
% side of an inclusion or proving an isomorphism by proving homomorphism,
% surjective, injective.
\newenvironment{pflist}[1][-0.5em]
{\begin{itemize}[topsep=#1,partopsep=0pt]}
{\end{itemize}}
% https://tex.stackexchange.com/a/35934/243466
% I don't really use this much
\usepackage{changepage}
\newenvironment{ind}[1][2em]{\begin{adjustwidth}{#1}{}}{\end{adjustwidth}}
% Complexity classes
\renewcommand{\P}[0]{\ensuremath{\mathcal{P}}}
\newcommand{\NP}[0]{\ensuremath{\mathcal{NP}}}
% for function restrictions, use as \restr{f}{A}
\newcommand\restr[2]{{% we make the whole thing an ordinary symbol
\left.\kern-\nulldelimiterspace % automatically resize the bar with \right
#1 % the function
\vphantom{\big|} % pretend it's a little taller at normal size
\right|_{#2} % this is the delimiter
}}
% Defining maths symbol shortcuts
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\F}{\mathbb{F}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\e}{\varepsilon}
\newcommand{\p}{\varphi}
\newcommand{\bfb}{\mathbf{b}}
\NewDocumentCommand{\ddx}{s m}{
\IfBooleanTF {#1}
{ \frac{d}{dx}#2 }
{ \frac{d}{dx}\left(#2\right) }
}
\newcommand{\imp}{\Longrightarrow}
\newcommand{\stline}{\;\middle\vert\;}
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
\newcommand{\inv}{^{-1}}
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\newcommand{\abs}[1]{\left\lvert#1\right\rvert}
\newcommand{\lrangle}[1]{\left\langle#1\right\rangle} % Inner product
\newcommand{\sub}{\leqslant}
\newcommand{\nsub}{\triangleleft}
\newcommand{\card}[1]{\overline{\overline{#1}}}
\newcommand{\vect}[1]{\boldsymbol{#1}}
\newcommand*{\dd}{\mathop{\mathrm{d}\!}}
\newcommand{\code}[1]{\texttt{#1}}
% Defining some maths operators
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\lcm}{lcm} % gcd already exists
\DeclareMathOperator{\proj}{proj}
\DeclareMathOperator{\sgn}{sgn}
\DeclareMathOperator{\Span}{Span\,}
\DeclareMathOperator{\Nul}{Nul}
\DeclareMathOperator{\Col}{Col}
\DeclareMathOperator{\Row}{Row}
\DeclareMathOperator{\Area}{Area}
\DeclareMathOperator{\Arg}{Arg}
\DeclareMathOperator{\Img}{Im} % \Im is already something
\DeclareMathOperator{\Ker}{Ker}
\DeclareMathOperator{\Sym}{Sym}
\DeclareMathOperator{\Stab}{Stab}
\DeclareMathOperator{\Null}{Null}
\DeclareMathOperator{\Range}{Range}
\DeclareMathOperator{\Ann}{Ann}
\DeclareMathOperator{\GL}{GL} % General linear group
\DeclareMathOperator{\ord}{ord} % Order
\DeclareMathOperator{\Ind}{Ind}
\DeclareMathOperator{\Ext}{Ext}
\DeclareMathOperator*{\EV}{\mathbb{E}}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
% Define a question environment
\NewDocumentEnvironment{question}{m o}
{\IfNoValueTF{#2}{\section*{Question #1}}{\section*{Question #1: #2}}}
{
\clearpage\newpage
\setcounter{thm}{0}
\setcounter{lem}{0}
\setcounter{prop}{0}
\setcounter{defn}{0}
\setcounter{case}{0}
\setcounter{equation}{0}
}