This repository has been archived by the owner on Feb 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
macros.tex
218 lines (177 loc) · 6.59 KB
/
macros.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
214
215
216
217
218
%%macros for Advanced Algorthm Design; Fall 2008, Sanjeev Arora
\newcommand\p{\mbox{\bf P}\xspace}
\newcommand\np{\mbox{\bf NP}\xspace}
%%Computational problems
\newcommand\sat{\mbox{SAT}\xspace}
\newcommand\numsat{\mbox{$\sharp$ SAT}\xspace}
%% Notation for integers, natural numbers, reals, fractions, sets, cardinalities
%%and so on
\newcommand\bz{\mbox{\bf Z}}
\newcommand\nat{\mbox{\bf N}}
\newcommand\rea{\mbox{\bf R}}
\newcommand\B{\{0,1\}} % boolean alphabet use in math mode
\newcommand\Bs{\{0,1\}^*} % B star use in math mode
\newcommand\true{\mbox{\sc True}}
\newcommand\false{\mbox{\sc False}}
\DeclareRobustCommand{\fracp}[2]{{#1 \overwithdelims()#2}}
\DeclareRobustCommand{\fracb}[2]{{#1 \overwithdelims[]#2}}
\newcommand{\marginlabel}[1]%
{\mbox{}\marginpar{\it{\raggedleft\hspace{0pt}#1}}}
\newcommand\card[1]{\left| #1 \right|} %cardinality of set S; usage \card{S}
\newcommand\set[1]{\left\{#1\right\}} %usage \set{1,2,3,,}
\newcommand\poly{\mbox{poly}} %usage \poly(n)
\newcommand{\floor}[1]{\lfloor\, $#1$\,\rfloor}
\newcommand{\ceil}[1]{\lceil\, $#1$\,\rceil}
\newcommand{\comp}[1]{\overline{#1}}
\newcommand{\defeq}{\overset{\mathrm{def}}{=}}
\newcommand{\bits}{\set{0,1}}
%% Various things to write in small caps
\newcommand{\disclaimer}{\textbf{These notes may contain errors, and are not intended for use as a primary source.} I have included references at the end of the notes for those who wish detail surrounding skipped steps.}
\def\scand{\mbox{\sc and}}
\def\scor{\mbox{\sc or}}
\def\scnot{\mbox{\sc not}}
\def\scyes{\mbox{\sc yes}}
%% short-hands for relational simbols
%\newcommand\to{\rightarrow}
\newcommand{\from}{:}
\newcommand\xor{\oplus}
\newcommand\bigxor{\bigoplus}
\newcommand{\logred}{\leq_{\log}}
\def\iff{\Leftrightarrow}
\def\implies{\Rightarrow}
%% probability stuff
\newcommand\pr{\mathop{\mbox{\bf Pr}}}
\newcommand\av{\mathop{\mbox{\bf E}}}
\newcommand\var{\mathop{\mbox{\bf Var}}}
%% macros to write pseudo-code
\newlength{\pgmtab} % \pgmtab is the width of each tab in the
\setlength{\pgmtab}{1em} % program environment
\newenvironment{program}{\renewcommand{\baselinestretch}{1}%
\begin{tabbing}\hspace{0em}\=\hspace{0em}\=%
\hspace{\pgmtab}\=\hspace{\pgmtab}\=\hspace{\pgmtab}\=\hspace{\pgmtab}\=%
\hspace{\pgmtab}\=\hspace{\pgmtab}\=\hspace{\pgmtab}\=\hspace{\pgmtab}\=%
\+\+\kill}{\end{tabbing}\renewcommand{\baselinestretch}{\intl}}
\newcommand {\BEGIN}{{\bf begin\ }}
\newcommand {\ELSE}{{\bf else\ }}
\newcommand {\IF}{{\bf if\ }}
\newcommand {\FOR}{{\bf for\ }}
\newcommand {\TO}{{\bf to\ }}
\newcommand {\DO}{{\bf do\ }}
\newcommand {\WHILE}{{\bf while\ }}
\newcommand {\ACCEPT}{{\bf accept}}
\newcommand {\REJECT}{\mbox{\bf reject}}
\newcommand {\THEN}{\mbox{\bf then\ }}
\newcommand {\END}{{\bf end}}
\newcommand {\RETURN}{\mbox{\bf return\ }}
\newcommand {\HALT}{\mbox{\bf halt}}
\newcommand {\REPEAT}{\mbox{\bf repeat\ }}
\newcommand {\UNTIL}{\mbox{\bf until\ }}
\newcommand {\TRUE}{\mbox{\bf true\ }}
\newcommand {\FALSE}{\mbox{\bf false\ }}
\newcommand {\FORALL}{\mbox{\bf for all\ }}
\newcommand {\DOWNTO}{\mbox{\bf down to\ }}
%formatting commands
\newcounter{lecnum}
\newcommand{\lecture}[3]{%
\pagestyle{myheadings}%
\thispagestyle{plain}%
\newpage %
\setcounter{lecnum}{#1}%
\setcounter{page}{1}%
%\rule{\linewidth}{1mm}
\begin{center}
\shadowbox{\parbox{4.3in}{{\small {\bf {\sc princeton univ. F'18
\hfill cos 597F: Open Problems in AGT}}}
\medskip
\begin{center}
{\large Lecture #1: #2}
\end{center}
\medskip
Lecturer: {\em Matt Weinberg} \hfill Scribe:{\em #3}
\vspace{2pt}}}
\vspace{6pt}\end{center}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength{\tpush}
\setlength{\tpush}{2\headheight}
\addtolength{\tpush}{\headsep}
% Usage: \htitle{title}{datelec}{dateout}
\newcommand{\htitle}[4]{\noindent\vspace*{-\tpush}\newline\parbox{\textwidth}
{U.C. Berkeley --- \coursenum : \coursename \hfill #1 \newline
\courseprof \hfill #2 \newline
\mbox{#4}\hfill Last revised #3 \newline
\mbox{}\hrulefill\mbox{}}\vspace*{1ex}\mbox{}\newline
\bigskip
\begin{center}{\Large\bf #1}\end{center}
\bigskip}
% Usage: \handout{title}{datelec}{dateout}{scribe}
\newcommand{\handout}[4]{\thispagestyle{empty}
\markboth{Notes for #1: #2}{Notes for #1: #2}
\pagestyle{myheadings}\htitle{#1}{#2}{#3}{#4}}
\newcommand{\htitlewithouttitle}[2]{\noindent\vspace*{-\tpush}\newline\parbox{6.5in}{\coursenumber : \coursetitle
\hfill Columbia University\newline
Handout #1\hfill#2\vspace*{-.5ex}\newline
\mbox{}\hrulefill\mbox{}}\vspace*{1ex}\mbox{}\newline}
\newcommand{\handoutwithouttitle}[2]{\thispagestyle{empty}
\markboth{Handout #1}{Handout #1}
\pagestyle{myheadings}\htitlewithouttitle{#1}{#2}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Commands to include figures
%% PSfigure
\iffalse
\newcommand{\PSfigure}[3]{\begin{figure}[t]
\centerline{\vbox to #2 {\vfil \psfig{figure=#1.eps,height=#2} }}
\caption{#3}\label{#1}
\end{figure}}
\newcommand{\twoPSfigures}[5]{\begin{figure*}[t]
\centerline{%
\hfil
\begin{tabular}{c}
\vbox to #3 {\vfil\psfig{figure=#1.eps,height=#3}} \\ (a)
\end{tabular}
\hfil\hfil\hfil
\begin{tabular}{c}
\vbox to #3 {\vfil\psfig{figure=#2.eps,height=#3}} \\ (b)
\end{tabular}
\hfil}
\caption{#4}
\label{#5}
% \sublabel{#1}{(a)}
% \sublabel{#2}{(b)}
\end{figure*}}
\fi
\newcounter{fignum}
% fig
%command to insert figure. usage \fig{name}{h}{caption}
%where name.eps is the postscript file and h is the height in inches
%The figure is can be referred to using \ref{name}
\newcommand{\fig}[3]{%
\begin{minipage}{\textwidth}
\centering\epsfig{file=#1.eps,height=#2}
\caption{#3} \label{#1}
\end{minipage}
}%
\newcommand{\myfig}[4]{%
%\begin{minipage}{\textwidth}
\begin{figure}[h]
\begin{center}
\includegraphics[height=#2]{#1}
\newline
\caption{#3} \label{#4}
\end{center}
\end{figure}
%\end{figure}
%\end{minipage}
}%
% ffigure
% Usage: \ffigure{name of file}{height}{caption}{label}
\newcommand{\ffigure}[4]{\begin{figure}
\centerline{\vbox to #2 {\hfil \psfig{figure=#1.eps,height=#2} }}
\caption{#3}\label{#4}
\end{figure}}
% ffigureh
% Usage: \ffigureh{name of file}{height}{caption}{label}
\newcommand{\ffigureh}[4]{\begin{figure}[!h]
\centerline{\vbox to #2 {\vfil \psfig{figure=#1.eps,height=#2} }}
\caption{#3}\label{#4}
\end{figure}}