%% ----------------------------------------------------------------
%%
%%
%%   .sty file for the course paper
%%        by Ole J. Forsberg
%%
%%
%% ----------------------------------------------------------------



%% ---------------------------------------------------------------- General packages

\usepackage{amsmath,amssymb,amsthm}                    % AMS Math

\usepackage{stmaryrd}                                  % More symbols
\usepackage{graphicx}                                  % Graphics formats

\usepackage{bbold}
\usepackage[hidelinks]{hyperref}

\usepackage{bbm}                                       % Fonts
\usepackage{textcomp}                                  % Fonts
\usepackage{courier}                                   % Use a different fixed-width font

\usepackage{enumerate}

\usepackage[vcentering,dvips,top=1.25in, bottom=1.25in, left=1.5in, right=1.5in]{geometry}                % Help with margins
\usepackage{setspace}                                  % Line spacing
\usepackage{dcolumn}                                   % Decimal alignment in tables

\usepackage{fancyvrb}                                  % The new verbatim package
\usepackage{rotating}                                  %
\usepackage{colortbl}                                  % Allows for color in tables
\usepackage[font=small,format=plain,labelfont=bf,up,textfont=it,up]{caption}
                                                       % Formats captions to look nicer
%
\usepackage{booktabs}                                  % Nicer tables
\usepackage{listings}                                  % Allow code listing
\usepackage{multicol}                                  % Formats multiple column sections
\usepackage{titling}                                   % Allows for title hooks


\usepackage{natbib}[comma,authoryear]





\pagestyle{empty}











%% ---------------------------------------------------------------- Math things
%% ----------------------------------------------------------------
%%
%%    Frequently used symbols
%%    	written by Ole J. Forsberg
%%
%% ----------------------------------------------------------------


\newcommand{\degree}{\ensuremath{^\circ}}              % The degree symbol
\newcommand{\ensuretext}[1]{\ensuremath{\text{#1}}}    % Ensure text environment
\newcommand{\textunderlinewide}{\,\rule{0.6em}{0.4pt}\,} % wide underscore



%% ---------------------------------------------------------------- math definitions

\newcommand{\norm}[1]{\left\Vert\ #1\ \right\Vert}     % Norm
\newcommand{\abs}[1]{\left\vert\ #1\ \right\vert}      % Absolute value
\newcommand{\set}[1]{\big\{#1\big\}}                   % Set notation
\newcommand{\given}{\ \vert \ }                        % given
\newcommand{\Given}{\ \Big\vert \ }                    % Given


\newcommand{\eps}{\varepsilon}                         % Varepsilon
\newcommand{\To}{\rightarrow}                          % The 'to' rightarrow
\newcommand{\E}[1]{\mathbb E \left[ #1 \right]}        % Expected Value [ ]
\newcommand{\V}[1]{\mathbb V \left[ #1 \right]}        % Variance [ ]
\newcommand{\cov}[1]{\mathbb Cov \left[ #1 \right]}    % Covariance [ ]
\newcommand{\cor}[1]{\mathbb Cor \left[ #1 \right]}    % Correlation [ ]
\newcommand{\PR}[1]{\mathbb P \, \left[ #1 \right]}    % Probability [ ]

\newcommand{\oldSigma}{\ensuremath{\pmb{\Sigma\!\!\!_{/}}}}  % Correlation matrix symbol
\newcommand{\e}{\mathbb{e}}                            % Euler's number
\newcommand{\likely}{\mathcal{L}}                      % Likelihood
\newcommand{\lnlikely}{l}                              % Log-likelihood


\newcommand{\defeq}{:=}                                % Defined in equality
\newcommand{\seteq}{\, \stackrel{\text{set}}{=} \, }   % Set equal


\newcommand{\Xbar}{\overline{X}}                       % X-bar
\newcommand{\xbar}{\overline{x}}                       % x-bar
\newcommand{\Ybar}{\overline{Y}}                       % Y-bar
\newcommand{\ybar}{\overline{y}}                       % y-bar
\newcommand{\Zbar}{\overline{Z}}                       % Z-bar
\newcommand{\zbar}{\overline{z}}                       % z-bar

\newcommand{\Xtilde}{\widetilde{X}}                    % X-tilde
\newcommand{\xtilde}{\widetilde{x}}                    % x-tilde
\newcommand{\Ytilde}{\widetilde{Y}}                    % Y-tilde
\newcommand{\ytilde}{\widetilde{y}}                    % y-tilde


\newcommand{\floor}[1]{\lfloor #1 \rfloor}             % Floor
\newcommand{\ceil}[1]{\lceil #1 \rceil}                % Ceiling


\newcommand{\1}[1]{ \, \mathbb{I}_{\left\{ #1 \right\}} \, }     % Indicator function
\newcommand{\inlaw}{\, \stackrel{\mathcal{L}}{\rightarrow} \, }  % Converges in law
\newcommand{\inprob}{\, \stackrel{P}{\rightarrow} \, }           % Converges in probability
\newcommand{\indist}{\, \stackrel{d}{\rightarrow} \, }           % Converges in distribution

\renewcommand{\lg}{\log_2}                             % Log base 2
\newcommand{\half}{\frac{1}{2}}                        % One-half
\newcommand{\third}{\frac{1}{3}}                       % One-third
\newcommand{\quarter}{\frac{1}{4}}                     % One-quarter

\newcommand{\dx}{\ \mathrm{d}x}                        % integral dx
\newcommand{\dy}{\ \mathrm{d}y}                        % integral dy
\newcommand{\dz}{\ \mathrm{d}z}                        % integral dz
\newcommand{\dt}{\ \mathrm{d}t}                        % integral dt
\newcommand{\D}[1]{\ \mathrm{d}#1}                     % integration d thingie
\newcommand{\M}{\mathcal{M}}                           % Metric space

\newcommand{\mat}[1]{\ensuremath{\mathbf{#1}}}         % Matrix
\renewcommand{\vector}[1]{\mathbf{#1}}                 % Vector
\newcommand{\trace}{\ensuretext{tr\ }}                 % Trace




%%                                                               %% New maths functions
\DeclareMathOperator{\logit}{logit}
\DeclareMathOperator{\logistic}{logistic}
\DeclareMathOperator{\loglog}{loglog}
\DeclareMathOperator{\cloglog}{cloglog}
\DeclareMathOperator{\argmax}{argmax}
\DeclareMathOperator{\argmin}{argmin}
\DeclareMathOperator{\acos}{acos}



%%                                                               %% Number sets
\newcommand{\Reals}{\mathbb R}                         % The reals
\newcommand{\Integers}{\mathbb Z}                      % The integers
\newcommand{\Naturals}{\mathbb N}                      % The naturals
\newcommand{\Rationals}{\mathbb Q}                     % The rationals






%%                                                               %% Distributions

\newcommand{\Bernoulli}{Bern}                          % Bernoulli
\newcommand{\Binomial}{Bin}                            % Binomial
\newcommand{\Geometric}{\mathcal{G}\text{eom}}         % Geometric
\newcommand{\Hypergeometric}{\mathcal{H}}              % Hypergeometric
\newcommand{\NegBin}{NegBin}                           % Negative Binomial
\newcommand{\Poisson}{\mathcal{P}}                     % Poisson

\newcommand{\Uniform}{\mathcal{U}}                     % Uniform
\newcommand{\Exponential}{\mathcal{E}\!xp}             % Exponential
\newcommand{\GAMMA}{\text{GAM}}                        % Gamma
\newcommand{\Normal}{\mathcal{N}}                      % Normal




\newcommand{\dist}{\sim \, }                           % dist
\newcommand{\iid}{\stackrel{\text{iid}}{\sim} \, }     % dist iid
\newcommand{\ind}{\stackrel{\text{ind}}{\sim} \, }     % dist independently
\newcommand{\adist}{\stackrel{\cdot}{\thicksim} \, }   % approximately distributed as
\newcommand{\ndist}{\nsim \, }                         % not dist




\newcommand{\mle}[1]{ \hat{#1}_{\text{\tiny{MLE}}}}    % MLE Estimator
\newcommand{\mom}[1]{ \hat{#1}_{\text{\tiny{MOM}}}}    % MOM Estimator





%%


%%




%% ---------------------------------------------------------------- Theorem-type things


\newcommand{\problem}[2]{
	\phantomsection
	\addcontentsline{toc}{section}{#1}
	\noindent {\textsc {\large{Problem: #1}}} \hfill {$\llbracket #2 \rrbracket$}\\[3pt]
	}

\newcommand{\subproblem}[1]{\vspace{9pt}\noindent{\textbf {Part #1}}: \hspace{2pt} }



\newtheorem*{theorem*}{Theorem}
\newtheorem{theorem}{Theorem}

\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{definition}[theorem]{Definition}

\newtheorem*{note}{Note}
\newtheorem*{remark}{Remark}


\newenvironment{solution}[1][Solution]
     {\vspace{6pt}
       \begin{spacing}{1.0}
       \begin{list}{}
       { \setlength{\leftmargin}{0.25in}
         \setlength{\rightmargin}{0.5in}
       }
       \color{webred}
%       \color{white}
       \item
	  }
     {\vspace{18pt}
       \end{list}
       \end{spacing}
     }


\newenvironment{subproof}[1][Sub-Proof]
     {\begin{list}{\setlength{\leftmargin}{3in}}
          \item{\itshape #1:}\hspace{10pt} }
     {\hfill $\diamond$ \vspace{18pt}\end{list} }





%% ---------------------------------------------------------------- The code includes

\lstset{ %
  backgroundcolor=\color{white},
  basicstyle=\footnotesize,     
  breakatwhitespace=true,       
  captionpos=b,                 
  extendedchars=true,           
  keepspaces=true,              
  keywordstyle=\color{black},   
  language=R,                   
  numbers=none,                 
  numbersep=5pt,                
  rulecolor=\color{black},      
  showspaces=false,             
  showstringspaces=false,       
  showtabs=false,               
  stepnumber=1,                 
  tabsize=2,	                
%
literate={~}{{$\sim$}}1{^}{{$^\wedge$}}1
}
%
\lstloadlanguages{R}



%%% This is for lines of code (input)
\lstnewenvironment{codein}[1][]{ 
	\lstset{language=R, 
		basicstyle=\color{black}\ttfamily\footnotesize, 
		framesep=2em, 
		aboveskip=1em, 
		belowskip=1em, 
		xleftmargin=0pt}
    }{}%







%% ---------------------------------------------------------------- The text-like includes

\newcommand{\asterism}{\begin{center}
      \textcolor{knoxdark}{$\star \star \star$}
      \end{center}}

\newcommand{\R}{\textcolor{webblue}{\texttt{R}}}            % The R language letter
\newcommand{\var}[1]{\texttt{#1}}                           % Typesetting variable names
\newcommand{\rcom}[1]{\texttt{\textcolor{webred4}{#1}}}     % Typesetting R Commands
\newcommand{\data}[1]{\texttt{\textcolor{webblue}{#1}}}     % Typesetting data file and data set names







%% ---------------------------------------------------------------- Page geometry

\vfuzz2pt                        % Don't report over-full v-boxes if over-edge is small
\hfuzz2pt                        % Don't report over-full h-boxes if over-edge is small
\allowdisplaybreaks[1]           % Allow eqnarray to break
\raggedbottom                    % Don't force all pages to be the same length









%% ---------------------------------------------------------------- color definitions
\definecolor{webgreen}{rgb}{0.0, 0.5, 0.0}
\definecolor{webred}  {rgb}{1.0, 0.0, 0.0}
\definecolor{webred4} {rgb}{0.8, 0.0, 0.0}
\definecolor{webblue} {rgb}{0.0, 0.0, 0.5}
\definecolor{webblack}{rgb}{0.2, 0.2 ,0.2}
\definecolor{yellow}  {rgb}{0.8, 0.8, 0.5}
\definecolor{orange}  {rgb}{1.0, 0.4, 0.2}
\definecolor{white}   {rgb}{1.0, 1.0, 1.0}
\definecolor{knoxdark}{rgb}{0.4, 0.0, 0.5}
\definecolor{knox}    {rgb}{0.7, 0.0, 0.8}
\definecolor{lightgray}{gray}{0.93}
\definecolor{darkblue}{rgb}{0.0, 0.2, 0.2}













%% ---------------------------------------------------------------- maketitle

\renewcommand{\maketitle}{%
%
\clearpage%
\thispagestyle{empty}%
\begin{flushright}%
%
  {\color{orange}{\rule{3pt}{\textheight}}} % Vertical line
  {\color{orange}{\rule{1pt}{\textheight}}} % Vertical line
  \hspace{0.05\textwidth} % Whitespace between the vertical line and title page text
%
  \parbox[b]{0.8\textwidth}{%
    \begin{flushleft}%
    {\LARGE\bfseries\thetitle\unskip\strut}\\[2\baselineskip]%
%	{\scshape\large MATH 321: Mathematical Statistics I\strut\par}%
	{\scshape\large\theauthor\unskip\strut\par}%
	{\scshape\large\thedate\unskip\strut\par}%
	\end{flushleft}%
    \vspace{5in}%
  }
%
\end{flushright}
}






%% ---------------------------------------------------------------- End of .sty file