% Standard Latex style for academic papers 
% Chris Adolph
% July 2004

% Load packages
\usepackage{graphicx,natbib}
\usepackage{setspace}
\usepackage{pstricks}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{fancyhdr}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{lscape}
\usepackage{soul}
\usepackage{bold-extra}

% Shortcuts
\newcommand{\subG}{\mathrm{\scriptscriptstyle G}}
\newcommand{\subF}{\mathrm{\scriptscriptstyle F}}
\newcommand{\subLR}{\mathrm{\scriptscriptstyle LR}}
\newcommand{\subC}{\mathrm{\scriptscriptstyle C}}
\newcommand{\subI}{\mathrm{\scriptscriptstyle I}}
\newcommand{\subL}{\mathrm{\scriptscriptstyle L}}
\newcommand{\subR}{\mathrm{\scriptscriptstyle R}}
\newcommand{\ba}{$\bullet$}
\newcommand{\bb}{$\circ$}
\newcommand{\bc}{\bullet}
\newcommand{\bd}{\bullet}
\newcommand{\mb}{\mathbf}
%\newcommand{\sb}{\boldsymbol}

% Gray line in header
\def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
    \color{gray}\hrule\@height\headrulewidth\@width\headwidth \color{black} \vskip-\headrulewidth}}

%\let\oldfootnoterule\footnoterule
%\renewcommand{\footnoterule}{\color{gray}\oldfootnoterule\color{black}}

\renewcommand{\footnoterule}{%
\color{gray}
\kern -3pt % call this kerna
\hrule height 0.6pt width 0.4\columnwidth
\kern 2.6pt % call this kernb
\color{black}
}

% San-serif headings
\def\@part[#1]#2{
  \ifnum \c@secnumdepth >\m@ne 
     \refstepcounter{part}
     \addcontentsline{toc}{part}{\thepart \hspace{1em}#1}
  \else
     \addcontentsline{toc}{part}{#1}
  \fi 
  { 
    \thispagestyle{empty}
    \begin{center}
      \lineskip 3em
      \parindent 0pt 
      \ifnum \c@secnumdepth >\m@ne 
         \Large \bf\sf Part \thepart \par\nobreak 
      \fi 
      \vskip 3em
      \huge \bf\sf #2\markboth{}{}\par 
    \end{center}
  } 
  \nobreak 
  \vskip 3ex 
  \@afterheading 
}

\def\@makechapterhead#1{%
  \vspace*{20\p@}%
  {\parindent \z@ \center
    \ifnum \c@secnumdepth >\m@ne
     {\Large\sc \@chapapp{}~\thechapter}
     \par
     \vskip 8\p@ \fi
    \Large \bf \sf
    #1\par
    \nobreak
    \vskip 15\p@
  }}
\def\@makeschapterhead#1{%
  \vspace*{20\p@}%
  {\parindent \z@ \center
    \Large \bf \sf
    #1\par
    \nobreak
    \vskip 15\p@
  }}

\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus-1ex minus
    -.2ex}{2.3ex plus.2ex}{\reset@font\Large\bf\sf}}

\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus-1ex
    minus-.2ex}{1.5ex plus.2ex}{\reset@font\large\sf}}

\def\subsubsection{\@startsection{subsubsection}{2}{\z@}{-3ex plus-1ex
    minus-.2ex}{1.2ex plus.2ex}{\reset@font\large\sf}}

% Small footnotes and captions
\renewcommand{\footnotesize}{\small}
\newcommand{\captionfonts}{\small}


% Sanserif captions with bold labels
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{{\captionfonts #1: #2}}%
  \ifdim \wd\@tempboxa >\hsize
    {\captionfonts #1: #2\par}
  \else
    \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}

\def\@maketitle{\newpage
 \null
 \vskip 6em
 \begin{center}%
  {\LARGE \sf \@title \par}%
  \vskip 2.5em
  {\large
   \lineskip .5em
   \begin{tabular}[t]{c}{\sf \@author}
   \end{tabular}\par}%
  \vskip 1em
  {\large \textsf{\@date}}%
 \end{center}%
 \par
 \vskip 2.5em}

\renewcommand{\fnum@figure}[1]{\textsf{\textbf{\figurename~\thefigure}}: \sffamily}
\renewcommand{\fnum@table}[1]{\textsf{\textbf{\tablename~\thetable}}: \sffamily}

% Abstracts
\def\abstract{\if@twocolumn
\section*{\abstractname}%
\else \small
\begin{center}%
{\large \bf \sf \abstractname\vspace{-.5em}\vspace{\z@}}%
\end{center}%
\quotation
\fi}

% Set up dcolumn package for tables
\usepackage{dcolumn}
\newcolumntype{.}{D{.}{.}{-1}}
\newcolumntype{d}[1]{D{.}{.}{#1}}

% Page layout and spacing
\tolerance = 1500
\parindent = 20 pt
\linespread{1.1}
\addtolength{\textwidth}{3.5cm}
\addtolength{\hoffset}{-1.75cm}
\addtolength{\textheight}{3.5cm}
\addtolength{\voffset}{-1.5cm}

% Manage floats
\renewcommand{\topfraction}{0.9}        % 90% of page top can be a float
\renewcommand{\bottomfraction}{0.9}     % 90% of page bottom can be a float
\renewcommand{\textfraction}{0.1}       % only 10% of page must to be text

% Allow ragged right in tables
\newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}


\endinput