%  chadstyle.sty   Chad Jones, 5/1/08
%
%  Chad's style file for nice paper format.
%  Various ideas for this style are taken from
%    -- Matthias Doepke and Michele Tertilt
%    -- Tony Roberts

\special{papersize=8.5in,11in}
%\usepackage{palatino,amssymb,amsfonts,amsmath,latexsym,setspace}
\usepackage{utopia,amssymb,amsfonts,amsmath,latexsym,setspace}
\usepackage[dvips]{graphicx}
\usepackage{natbib,fancyhdr}


% example file to change the style of LaTeX
% Tony Roberts May 2004
% first colour for latex or pdflatex
% Aug 2021: changing "color" to "xcolor" fixes a bunch of "incompatible color definition" problems!
\ifx\pdfoutput\@undefined\usepackage[usenames,dvips]{xcolor}
\else\usepackage[usenames,dvipsnames]{xcolor}
% and fix pdf colour problems
%\IfFileExists{pdfcolmk.sty}{\usepackage{pdfcolmk}}{} 
\fi

% Chad's colors:
% See http://web.njit.edu/~kevin/rgb.txt.html for possibilities
\definecolor{ChadDarkBlue}{rgb}{.1,0,.2}  
\definecolor{ChadBlue}{rgb}{.1,.1,.5}  
\definecolor{ChadCiteColor}{rgb}{.1,.1,.65} % Old was blue=0.4 
\definecolor{ChadRoyal}{rgb}{.2,.2,.8}  
%\definecolor{ChadGreen}{rgb}{0,.35,.1}
%\definecolor{ChadGreen}{rgb}{0,.5,.25}  % Too bright
%\definecolor{ChadGreen}{rgb}{0,.4,.2}    % Still too bright
\definecolor{ChadGreen}{rgb}{0,.4,0}    % Dark Green
%\definecolor{ChadRed}{rgb}{.8,.1,.2}    % Too bright
\definecolor{ChadRed}{rgb}{.3,0,.7}  % purple .5,0,.5

%%% HYPERLINKS %%%%%%%%%%%%%%%%%%%%%
\usepackage[colorlinks,breaklinks,   % deleted ps2pdf 11/6/15, Keep breaklinks -- needed for bibtex refs! 2021
     bookmarks=false,
     pdfstartview=Fit,  % for fitting entire page; FitW just fits width
     pdfview=Fit,       % after traversing a hyperlink
     linkcolor=ChadRed,
     urlcolor=ChadGreen,
     citecolor=ChadCiteColor,
     hyperfootnotes=false
         ]{hyperref}
\usepackage[figure,table]{hypcap} % Correct a problem with hyperref
\urlstyle{rm} %so it doesn't use a typewriter font for url's.

%%%%%%%%%%%%%%%%%%%%%


% Fix title, sections, etc.

\let\LaTeXtitle\title
\renewcommand{\title}[1]{\LaTeXtitle{\color{ChadBlue}{\LARGE #1}}}
\renewcommand{\abstractname}{\color{ChadBlue}Abstract}
\renewcommand{\figurename}{\color{ChadBlue}Figure}
\renewcommand{\tablename}{\color{ChadBlue}Table}


% Creates hyperlinks around {Table 3} when called by \autoref{tab:robustness}
\renewcommand{\sectionautorefname}{Section}
\renewcommand{\figureautorefname}{Figure}
\renewcommand{\tableautorefname}{Table}
\renewcommand{\appendixautorefname}{Appendix}

\let\LaTeX@startsection\@startsection 
\renewcommand{\@startsection}[6]{\LaTeX@startsection%
{#1}{#2}{#3}{#4}{#5}{\color{ChadBlue}\raggedright #6}} 

%% % Fix periods at end of section numbers
%% \renewcommand \thesection {\@arabic\c@section.}
%% \renewcommand\thesubsection   {\thesection\@arabic\c@subsection}%.}
%% \renewcommand\thesubsubsection{\thesubsection \@arabic\c@subsubsection}%.}


% Add a period *only* after Section and *only* in title, not cross ref
% April 2017
\makeatletter
\renewcommand{\@seccntformat}[1]{%
  \csname the#1\endcsname% Print sectional counter
  \ifnum\pdfstrcmp{#1}{section}=0 .\fi% If \section, print .
  \quad% Space between number and title
}
\makeatother



% Margin, Paragraph Setup
\onehalfspacing
%\textheight=21.5cm \textwidth=14.95cm \topmargin=-5.5mm
%\oddsidemargin=8mm \evensidemargin=8mm
\textheight=20.5cm \textwidth=14.35cm \topmargin=0mm
\oddsidemargin=11mm \evensidemargin=11mm
%\setlength{\parindent}{0em} 
%\setlength{\parskip}{1.5ex plus0.5ex minus0.5ex}
%\setlength{\parsep}{0pt}
\setlength{\parskip}{0pt}

% This is how to control linespacing using setspace
% (\singlespacing or doublespacing just call this command)
\setstretch{1.4}

%% Setting up page headers
\pagestyle{fancy}
\rhead[]{\thepage}
\lhead[\thepage]{}
\cfoot[]{} 
\renewcommand{\headrulewidth}{0pt}

\newcommand{\runningheads}[2]{
   \chead[\color{ChadGreen}{\uppercase {\footnotesize #1}}]  % Author page header
   {\color{ChadGreen}{\uppercase {\footnotesize #2}}}  % Short title
  }

% Make hyperlinks jump more accurately
\makeatletter
\newcommand\org@hypertarget{}
\let\org@hypertarget\hypertarget
\renewcommand\hypertarget[2]{%
\Hy@raisedlink{\org@hypertarget{#1}{}}#2%
} \makeatother 


% Spacing in Tables and Figures
%\renewcommand{\tabcolsep}{1pt}   % space between columns
\renewcommand{\arraystretch}{1.5} % space between rows
\addtolength{\textfloatsep}{0pt} % space between floats and text
\addtolength{\abovecaptionskip}{0pt} % space above caption
\addtolength{\belowcaptionskip}{.15in} % space below caption

\newcommand{\spc}[0]{\vspace{.1in}}
\newcommand{\fignote}[2]{\begin{center}\parbox[c]{#1}{\footnotesize #2} \end{center}}
\newcommand{\tabnote}[2]{\begin{center}\parbox[c]{#1}{\footnotesize #2} \end{center}}
\newcommand{\clr}[1]{{\color{ChadBlue} #1}}
\newcommand{\boxeq}[1]{\boxed{\hspace{.25in} #1 \hspace{.25in}}} 

\newcommand{\bb}[1]{\color{ChadBlue}{#1}}
\newcommand{\mybl}[1]{\color{ChadBlue}{#1}}
\newcommand{\mygr}[1]{\color{ChadGreen}{#1}}
\newcommand{\gn}[1]{{\color{ChadGreen}{#1}}}
\newcommand{\gr}[1]{\footnotesize\textcolor{ChadGreen}{#1}} % green4
\newcommand{\rd}[1]{\textcolor{ChadRed}{#1}}
\newcommand{\rr}[1]{\textcolor{red}{#1}}
\newcommand{\imp}[0]{$\Rightarrow \,$} % implies

%% Shortcut commands
\newcommand{\growth}[1]{\frac{\dot{#1}_t}{{#1}_t}}
\newcommand{\prtl}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\prtlsec}[2]{\frac{\partial^2 #1}{\partial #2^2}}
\newcommand{\commentno}[2]{\underset{\mbox{#2}}{#1}}
\newcommand{\comment}[2]{\underbrace{#1}_{\mbox{{\small \color{ChadGreen}#2}}}}
\newcommand{\cn}[1]{\citet*{#1}}
\newcommand{\cnp}[1]{(\citealt{#1})}  % (Jones 2002)
\newcommand{\up}[0]{\uparrow \hspace{-.5ex}}  % \! is a negative thinspace
\newcommand{\down}[0]{\downarrow \hspace{-.5ex}}
\newcommand{\query}[1]{{\it \color{red}[??? #1]}}


%\newcommand{\fignote}[2]{\begin{center}\parbox[c]{#1}{\footnotesize #2} \end{center}}
%\newcommand{\tabnote}[2]{\begin{center}\parbox[c]{#1}{\footnotesize #2} \end{center}}
\newcommand{\Prob}[1]{\mbox{\textnormal{Pr}} \left[ \, #1 \, \right] }
\newcommand{\SubSubSection}[1]{\subsubsection{#1} \baselineskip=18pt}
\newcommand{\problem}[2]{\hspace{.1in} {{\color{ChadBlue}{\bf #1:} #2}}}
\newcommand{\proptitle}[1]{\color{ChadBlue} \textnormal{(#1):}}
\newtheorem{proposition}{\color{ChadGreen} Proposition}
\newcommand{\assume}[2]{{\bf{Assumption #1}} (#2)} 
\newcommand{\Ex}[0]{\mbox{ }\mathbb{E}}
\newcommand{\Proof}[2]{{\hspace{-\parindent} {\color{ChadGreen}\bf Proof of Proposition}~\ref{#1}.}
{\color{ChadBlue} #2} \vspace{.1in}}

\setlength{\abovecaptionskip}{13pt} % Chosen fairly arbitrarily

\newcommand{\pfrac}[2]{\left( \frac{#1}{#2} \right)}  % frac with large paren
\newcommand{\chad}[1]{\textbf{\color{red}{ZZZ Chad Comment: #1}}}
