\ProvidesPackage{f1000_styles}
% Packages
\usepackage{authblk}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[bitstream-charter]{mathdesign}
\usepackage{colortbl}
\usepackage[usenames,dvipsnames,table]{xcolor}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage[labelsep=period,justification=justified]{caption}
\usepackage{lastpage}
\usepackage{xifthen}
\usepackage{todonotes}
\usepackage[hmargin=1.8cm,vmargin=2.2cm]{geometry}

% Define the versionDate and flogo commands
\newcommand{\versionDate}{\footnotesize \textit{F1000Research} 2016 - DRAFT ARTICLE (PRE-SUBMISSION)}
\newcommand{\flogo}{\includegraphics[height=12pt]{F1000header.png}}
           
% Section heading styles
\usepackage[compact]{titlesec} 

\titleformat*{\section}{\Large\usefont{OT1}{phv}{b}{n}\color{darkgray}}
\titleformat*{\subsection}{\large\usefont{OT1}{phv}{b}{n}\color{MidnightBlue}}
\titleformat*{\subsubsection}{\large\usefont{OT1}{phv}{b}{n}\color{MidnightBlue}}

% Section heading spacing (reduced space below headings)
\titlespacing\section{0pt}{3.5ex plus 1.2ex minus .2ex}{0ex}
\titlespacing\subsection{0pt}{3.25ex plus 1.2ex minus .2ex}{0ex}
\titlespacing\subsubsection{0pt}{3.25ex plus 1.2ex minus .2ex}{0ex}

% Caption style
\captionsetup{labelfont={color=red,bf},textfont={color=black,bf}}

% Table style
\definecolor{DarkKhaki}{rgb}{0.74,0.72,0.42}
\colorlet{tableheadcolor}{DarkKhaki} % Table header colour = 25% gray
\newcommand{\header}{\rowcolor{tableheadcolor}} %
\colorlet{tablerowcolor}{DarkKhaki!50} % Table row separator colour = 10% gray
\newcommand{\row}{\rowcolor{tablerowcolor}} %
\newenvironment{tabledata}[1][1]{%
  \renewcommand*{\extrarowheight}{0.1cm}%
  \tabular%
}{%
  \endtabular
}

% Define a title note command
\newcommand\titlenote[1]{\renewcommand\@titlenote{#1}}
\newcommand\@titlenote{}

% Column separation
\setlength{\columnsep}{0.25in}

% Page margins, headers and footers
% 1 For the main body of the article
\fancypagestyle{main}{
\newgeometry{hmargin=3.3cm,vmargin=2.2cm}
\fancyheadoffset{1.5cm} % Set header width to match front pages
\fancyfootoffset{1.5cm} % Set footer width to match front pages
\setlength{\parindent}{0pt}
\setlength{\headheight}{16.5pt}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lhead{}
\chead{}
\rhead{\versionDate}
\lfoot{}
\cfoot{}
\rfoot{\footnotesize Page \thepage\ of \pageref{LastPage}}
}

% 2 For the front page(s)
\fancypagestyle{front}{
\newgeometry{hmargin=1.8cm,vmargin=2.2cm}
\setlength{\parindent}{0pt}
\setlength{\headheight}{16.5pt}
\renewcommand{\footrulewidth}{1pt}
\lhead{\textsc{\flogo}}
\chead{}
\rhead{\versionDate}
\lfoot{}
\cfoot{}
\rfoot{\footnotesize Page \thepage\ of \pageref{LastPage}}
}

%
\renewenvironment{abstract}{%
\usefont{OT1}{phv}{m}{n}
\begin{minipage}{0.65\textwidth}
\rule{\textwidth}{1pt}\\ \textcolor{Orange}{\textbf{\abstractname}}}
{\par\noindent\rule{\textwidth}{1pt}\end{minipage}}
%
\makeatletter
\renewcommand\@maketitle{%
\begin{minipage}{0.95\textwidth}
\vskip 2em
\let\footnote\thanks 
{\fontsize{20}{22}\usefont{OT1}{phv}{b}{n} \@title \par {\small{\@titlenote}} }
\vskip 1.5em
{\@author \par}
\end{minipage}
\vskip 1em \par
}
\makeatother
\renewcommand\Authfont{\fontsize{16}{18}\usefont{OT1}{phv}{b}{n}}
\renewcommand\Affilfont{\fontsize{10}{12}\usefont{OT1}{phv}{b}{n}}