\usepackage{amsmath,amssymb,amsthm,amsfonts,latexsym,bbm,xspace,graphicx,float,mathtools,epigraph}
\usepackage[backref,colorlinks,citecolor=blue,bookmarks=true]{hyperref}
\usepackage{enumitem,manyfoot,fullpage}
\usepackage{subfig,tikz,framed}
\usepackage[compact]{titlesec}
\hfuzz2pt

% environments
%\renewcommand{\chaptername}{Lecture}
\newtheorem{theorem}{Theorem}
\renewcommand{\thetheorem}{\lecnum.\arabic{theorem}}
\newtheorem*{namedtheorem}{\theoremname}
\newcommand{\theoremname}{testing}
\newenvironment{named}[1]{ \renewcommand{\theoremname}{#1} \begin{namedtheorem}} {\end{namedtheorem}}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{corollary}[theorem]{Corollary}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{observation}[theorem]{Observation}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{example}[theorem]{Example}
\newtheorem{examples}[theorem]{Examples}

\renewcommand{\theequation}{\lecnum.\arabic{equation}}
\renewcommand{\thefigure}{\lecnum.\arabic{figure}}

% \numberwithin{section}{chapter}
% \numberwithin{equation}{chapter}
% \numberwithin{figure}{chapter}

\newfootnote{B}
\makeatletter
\def\scribenote#1#2{\ifx\protect\@typeset@protect
    $^*$\FootnotetextB{*}{Lecturer: #1. Scribe: #2.}%
  \else
    \relax
  \fi
}

\newenvironment{quotenote}{
\begin{quote}
  \footnotesize
\noindent{\bf Note:}}
{\end{quote}
}

\newcommand{\lecture}[4]{\setcounter{chapter}{#1-1}\chapter[#2]{#2\scribenote{#3}{#4}}}
\newcommand{\insertbibliography}[1]{\bibliographystyle{alpha}\bibliography{#1}}

% probability and other mathops
\renewcommand{\Pr}{\mathop{\bf Pr\/}}
\newcommand{\E}{\mathop{\bf E\/}}
\newcommand{\Ex}{\mathop{\bf E\/}}
\newcommand{\Var}{\mathop{\bf Var\/}}
\newcommand{\Cov}{\mathop{\bf Cov\/}}
\newcommand{\stddev}{\mathop{\bf stddev\/}}
\newcommand{\littlesum}{\mathop{{\textstyle \sum}}}
\newcommand{\apx}{\mathop{\approx}}


% mathrm terms
\newcommand{\poly}{\mathrm{poly}}
\newcommand{\polylog}{\mathrm{polylog}}
\newcommand{\size}{\mathrm{size}}
\newcommand{\avg}{\mathop{\mathrm{avg}}}
\newcommand{\sgn}{\mathrm{sgn}}
\newcommand{\dist}{\mathrm{dist}}
\newcommand{\spn}{\mathrm{span}}
\newcommand{\supp}{\mathrm{supp}}
\newcommand{\Val}{\mathrm{Val}}
\newcommand{\Opt}{\mathrm{Opt}}
\newcommand{\LPOpt}{\mathrm{LPOpt}}
\newcommand{\SDPOpt}{\mathrm{SDPOpt}}
\newcommand{\vol}{\mathrm{vol}}

% number systems
\newcommand{\R}{\mathbbm R}
\newcommand{\C}{\mathbbm C}
\newcommand{\N}{\mathbbm N}
\newcommand{\Z}{\mathbbm Z}
\newcommand{\F}{\mathbbm F}
\newcommand{\Q}{\mathbbm Q}

% complexity classes
\newcommand{\PTIME}{\mathsf{P}}
\newcommand{\NP}{\mathsf{NP}} \newcommand{\np}{\NP}

% short forms
\newcommand{\eps}{\epsilon}
\newcommand{\lam}{\lambda}
\newcommand{\vphi}{\varphi}
\newcommand{\la}{\langle}
\newcommand{\ra}{\rangle}
\newcommand{\wt}[1]{\widetilde{#1}}
\newcommand{\wh}[1]{\widehat{#1}}
\newcommand{\ul}[1]{\underline{#1}}
\newcommand{\ol}[1]{\overline{#1}}
\newcommand{\ot}{\otimes}
\newcommand{\Ra}{\Rightarrow}
\newcommand{\half}{\tfrac{1}{2}}
\newcommand{\grad}{\nabla}
\newcommand{\sse}{\subseteq}


% calligraphic letters
\newcommand{\calA}{\mathcal{A}}
\newcommand{\calB}{\mathcal{B}}
\newcommand{\calC}{\mathcal{C}}
\newcommand{\calD}{\mathcal{D}}
\newcommand{\calE}{\mathcal{E}}
\newcommand{\calF}{\mathcal{F}}
\newcommand{\calG}{\mathcal{G}}
\newcommand{\calH}{\mathcal{G}}
\newcommand{\calI}{\mathcal{I}}
\newcommand{\calJ}{\mathcal{J}}
\newcommand{\calK}{\mathcal{K}}
\newcommand{\calL}{\mathcal{L}}
\newcommand{\calM}{\mathcal{M}}
\newcommand{\calN}{\mathcal{N}}
\newcommand{\calO}{\mathcal{O}}
\newcommand{\calP}{\mathcal{P}}
\newcommand{\calQ}{\mathcal{Q}}
\newcommand{\calR}{\mathcal{R}}
\newcommand{\calS}{\mathcal{S}}
\newcommand{\calT}{\mathcal{T}}
\newcommand{\calU}{\mathcal{U}}
\newcommand{\calV}{\mathcal{V}}
\newcommand{\calW}{\mathcal{W}}
\newcommand{\calX}{\mathcal{X}}
\newcommand{\calY}{\mathcal{Y}}
\newcommand{\calZ}{\mathcal{Z}}



%%%%%%%%%%%% document-writing macros %%%%%%%%%%%%

\newcommand{\ignore}[1]{}
\newcommand{\myfig}[4]{\begin{figure}[H] \begin{center} \includegraphics[width=#1\textwidth]{#2} \caption{#3} \label{#4} \end{center} \end{figure}} 

\newcommand{\makemyheader}{%
{\centering\textbf{\large{15-859E: Advanced Algorithms}} \hfill
    \textbf{CMU, Spring 2015}}
\\ 
{\bf Lecture \#\lecnum: \lectopic % (draft!!)
} \hfill {\lecdate} \\
Lecturer: Anupam Gupta \hfill {Scribe: \scribe}
\\ \rule[0.2in]{\textwidth}{0.05pt} 
}

\newcommand{\agcomment}[1]{{\color{blue} \textbf{#1} -- Anupam}}
%\newcommand{\agcomment}[1]{}

%%%%%%%%%%%% formatting instructions %%%%%%%%%%%%

\makeatletter
 \setlength{\parindent}{0pt}
 \addtolength{\partopsep}{-2mm}
 \setlength{\parskip}{5pt plus 1pt}
 % \addtolength{\theorempreskipamount}{-1mm}
 % \addtolength{\theorempostskipamount}{-1mm}
 \addtolength{\abovedisplayskip}{-3mm}
 \addtolength{\textheight}{35pt}
 \addtolength{\footskip}{-20pt}
\makeatother
