forked from david-abel/latex_docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.tex
173 lines (139 loc) · 4.48 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
% COMMANDS:
% - bigmid: Dynamically sized mid bar.
% - spacerule: add a centered dashed line with space above and below
% - \dbox{#1}: Adds a nicely formatted slightly grey box around #1
% - \begin{dproof} ... \end{dproof}: A nicely formatted proof. Use \qedhere to place qed
% - \ddef{#1}{#2}: Makes a definition (and counts defs). #1 goes inside parens at beginning, #2 is actual def.
% - \begin{dtable}{#1} ... \end{dtable}: Makes a minimalist table. #1 is the alignment, for example: {clrr} would be a 4 column, center left right right table.
% Dynamically sized mid bar.
\newcommand{\bigmid}{\mathrel{\Big|}}
% ---- Colors and Notes ----
\definecolor{dblue}{RGB}{140, 212, 251}
\definecolor{dlblue}{RGB}{79, 142, 230}
\definecolor{dgray}{RGB}{205, 204, 204}
\definecolor{dred}{RGB}{239, 133, 125}
\definecolor{dorange}{RGB}{230, 169, 132}
% TODO
\newcounter{WenhaoDefCounterTodo}
\setcounter{WenhaoDefCounterTodo}{1}
\newcommand{\remark}[2]
{
\begin{mdframed}[roundcorner=1pt, backgroundcolor=dblue]
\vspace{1mm}
{\bf Remark \theWenhaoDefCounterTodo} {\it #1}
\stepcounter{WenhaoDefCounterTodo}
\end{mdframed}
}
% NOTE
\newcounter{WenhaoDefCounterNote}
\setcounter{WenhaoDefCounterNote}{1}
\newcommand{\note}[2]
{
\begin{mdframed}[roundcorner=1pt, backgroundcolor=dred]
\vspace{1mm}
{\bf Note \theWenhaoDefCounterNote} {\it #1}
\stepcounter{WenhaoDefCounterNote}
\end{mdframed}
}
% Idea
\newcounter{WenhaoDefCounterIdea}
\setcounter{WenhaoDefCounterIdea}{1}
\newcommand{\idea}[2]
{
\begin{mdframed}[roundcorner=1pt, backgroundcolor=dorange]
\vspace{1mm}
{\bf Idea \theWenhaoDefCounterIdea} {\it #1}
\stepcounter{WenhaoDefCounterIdea}
\end{mdframed}
}
% theorems
\newtheorem{conjecture}{Conjecture}[section]
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{assumption}{Assumption}
\newtheorem{mov}{Motivation}
% URL
\newcommand{\durl}[1]{\textcolor{dblue}{\underline{\url{#1}}}}
% Circled Numbers
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{\node[shape=circle,draw,inner sep=0.7pt] (char) {\footnotesize{#1}};}}
% From: http://tex.stackexchange.com/questions/7032/good-way-to-make-textcircled-numbers
% Under set numbered subset of equation
\newcommand{\numeq}[3]{\underset{\textcolor{#2}{\circled{#1}}}{\textcolor{#2}{#3}}}
% ---- Abbreviations -----
\newcommand{\tc}[2]{\textcolor{#1}{#2}}
\newcommand{\ubr}[1]{\underbrace{#1}}
\newcommand{\uset}[2]{\underset{#1}{#2}}
\newcommand{\eps}{\varepsilon}
% Typical limit:
\newcommand{\nlim}{\underset{n \rightarrow \infty}{\lim}}
\newcommand{\nsum}{\sum_{i = 1}^n}
\newcommand{\nprod}{\prod_{i = 1}^n}
% Add an hrule with some space
\newcommand{\spacerule}{\begin{center}\hdashrule{2cm}{1pt}{1pt}\end{center}}
% Mathcal and Mathbb
\newcommand{\mc}[1]{\mathcal{#1}}
\newcommand{\indic}{\mathbbm{1}}
\newcommand{\bE}{\mathbb{E}}
\newcommand{\ra}{\rightarrow}
\newcommand{\la}{\leftarrow}
% ---- Figures, Boxes, Theorems, Etc. ----
% Basic Image
\newcommand{\img}[1]{
\begin{center}
\includegraphics[\width=0.6\textwidth]{#1}
\end{center}}
% Put a fancy box around things.
\newcommand{\dbox}[1]{
\begin{mdframed}[roundcorner=4pt, backgroundcolor=gray!5]
\vspace{1mm}
{#1}
\end{mdframed}
}
% --- PROOFS ---
% Inner environment for Proofs
\newmdenv[
topline=false,
bottomline=false,
rightline = false,
leftmargin=10pt,
rightmargin=0pt,
innertopmargin=0pt,
innerbottommargin=0pt
]{innerproof}
% Proof Command
%\newenvironment{dproof}{\begin{proof} \text{\vspace{2mm}} \begin{innerproof}}{\end{innerproof}\end{proof}\vspace{4mm}}
\newenvironment{dproof}[1][Proof]{\begin{proof}[#1] \text{\vspace{2mm}} \begin{innerproof}}{\end{innerproof}\end{proof}\vspace{4mm}}
% Dave Definition
\newcounter{DaveDefCounter}
\setcounter{DaveDefCounter}{1}
\newcommand{\ddef}[2]
{
\begin{mdframed}[roundcorner=1pt, backgroundcolor=white]
\vspace{1mm}
{\bf Definition \theDaveDefCounter} (#1): {\it #2}
\stepcounter{DaveDefCounter}
\end{mdframed}
}
% Block Quote
\newenvironment{dblockquote}[2]{
\begin{blockquote}
#2
\vspace{-2mm}\hspace{10mm}{#1} \\
\end{blockquote}}
% Algorithm
\newenvironment{dalg}[1]
{\begin{algorithm}\caption{#1}\begin{algorithmic}}
{\end{algorithmic}\end{algorithm}}
% Dave Table
\newenvironment{dtable}[1]
{\begin{figure}[h]
\centering
\begin{tabular}{#1}\toprule}
{\bottomrule
\end{tabular}
\end{figure}}
% For numbering the last of an align*
\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}