% Defines common elements for Imperial College LaTeX styles
% James Keirstead
% 19 June 2014

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{imperial-common}[2014/06/19 Imperial College common package]

% Define logo
\RequirePackage{graphicx}
\ifx\placelogo\undefined
\newcommand{\placelogocmd}{ }
\else
\newcommand{\placelogocmd}{\includegraphics{\placelogo}}
\fi

% Define colors
\RequirePackage{xcolor}
\definecolor{ImperialBlue}{rgb}{0.082,0.416,0.608}
\definecolor{ImperialLightBlue}{rgb}{0.545,0.682,0.8}
\definecolor{ImperialBrown}{rgb}{0.612,0.278,0.086}

% Change date style
\RequirePackage{datetime}
\newdateformat{UKdate}{\THEDAY\ \monthname[\THEMONTH]\ \THEYEAR}
\UKdate

% Define some constants
\newcommand{\college}{Imperial College London}

% Defines fonts
\RequirePackage{ifxetex}
\ifxetex
  \RequirePackage{fontspec}
  \defaultfontfeatures{Mapping=tex-text}
  %\setmainfont{FreeSans}
  %\setsansfont[Scale=0.875]{FreeSans}
  %\setmonofont[Scale=0.9]{FreeSans}

  \setmainfont
   [Path = ../Fonts/IBM-Plex-Serif/,
     UprightFont = *-Regular,
     ItalicFont = *-Italic,
     BoldFont = *-Bold,
     BoldItalicFont = *-BoldItalic,
     FontFace = {t}{n}{*-Thin},
     FontFace = {t}{it}{*-ThinItalic},
     FontFace = {l}{n}{*-Light},
     FontFace = {l}{it}{*-LightItalic},
     FontFace = {sb}{n}{*-SemiBold},
     FontFace = {sb}{it}{*-SemiBoldItalic},
     FontFace = {m}{n}{*-Medium},
     FontFace = {m}{it}{*-MediumItalic},
     FontFace = {b}{n}{*-Bold},
     FontFace = {b}{it}{*-BoldItalic},
     Ligatures=TeX]
    {IBMPlexSerif}
  \setsansfont
   [Path = ../Fonts/IBM-Plex-Sans/,
     UprightFont = *-Regular,
     ItalicFont = *-Italic,
     BoldFont = *-Bold,
     BoldItalicFont = *-BoldItalic,
     FontFace = {t}{n}{*-Thin},
     FontFace = {t}{it}{*-ThinItalic},
     FontFace = {l}{n}{*-Light},
     FontFace = {l}{it}{*-LightItalic},
     FontFace = {sb}{n}{*-SemiBold},
     FontFace = {sb}{it}{*-SemiBoldItalic},
     FontFace = {m}{n}{*-Medium},
     FontFace = {m}{it}{*-MediumItalic},
     FontFace = {b}{n}{*-Bold},
     FontFace = {b}{it}{*-BoldItalic},
     Ligatures=TeX]
    {IBMPlexSans}
  \setmonofont
   [Path = ../Fonts/IBM-Plex-Mono/,
     UprightFont = *-Regular,
     ItalicFont = *-Italic,
     BoldFont = *-Bold,
     BoldItalicFont = *-BoldItalic,
     FontFace = {t}{n}{*-Thin},
     FontFace = {t}{it}{*-ThinItalic},
     FontFace = {l}{n}{*-Light},
     FontFace = {l}{it}{*-LightItalic},
     FontFace = {sb}{n}{*-SemiBold},
     FontFace = {sb}{it}{*-SemiBoldItalic},
     FontFace = {m}{n}{*-Medium},
     FontFace = {m}{it}{*-MediumItalic},
     FontFace = {b}{n}{*-Bold},
     FontFace = {b}{it}{*-BoldItalic},
     Ligatures=TeX]
    {IBMPlexMono}
\else
  \PackageWarning{Custom fonts not supported.  Please use xelatex instead.}
\fi
