% ---- VISUALISATION ----

% UTF-8 encoding
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}


% Improve visual appearance by tuning spacing between letters
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,factor=1100,stretch=10,shrink=10]{microtype}

% Necessary? to avoid some overfull hboxes appearing
\emergencystretch=1em

% Allow to adjust line spacing
\usepackage{setspace}

% ---- BIBLIOGRAPHY ----

\usepackage[backend=biber,style=ieee,dashed=false,urldate=long]{biblatex}
\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
       \step[fieldsource=reportNumber, fieldtarget=number]
    }
  }
}
\addbibresource{literature.bib}

% Remove mandatory year for @online resource
\usepackage{xpatch}
\xpatchbibdriver{online}
  {\printtext[parens]{\usebibmacro{date}}}
  {\iffieldundef{year}{}{\printtext[parens]{\usebibmacro{date}}}}
  {}{}


% ---- FUNCTIONALITY ----

% Increase PDF version from 1.5 to 1.7
\pdfminorversion=7

% Multilangual support, british by default NOTE: needs to come after bibliography!
\usepackage[british]{babel}

% Provide math environments like align
\usepackage{amsmath}

% SI Units
\usepackage[exponent-product=\cdot,separate-uncertainty]{siunitx}
\DeclareSIUnit\litre{l} %Small letter for litre and liter
\DeclareSIUnit\permille{\text{\textperthousand}}
\DeclareSIUnit\barn{\text{b}}
\DeclareSIUnit{\belmilliwatt}{Bm}
\DeclareSIUnit{\dBm}{\deci\belmilliwatt}


% Referencing packages (note: the order matters!)
% - hyperref allows to use \autoref{fig:xyz} instead of Fig.~\ref{fig:xyz}
% - varioref allows to use \vref to also get the corresponding page number
% - cleveref adapts the formatting automatically
% - hypcap improves digital links such that you get to the figure instead of the caption
\usepackage[nospace]{varioref}
\usepackage[hidelinks]{hyperref} % hidelinks hides any colored links
\usepackage[capitalise]{cleveref}
\usepackage[figure,figure*]{hypcap}


% Suppress "on the facing page etc." when using \vref and \Vref
\makeatletter
\vref@addto\extrasenglish{%
  \def\reftextfaceafter{}
  \def\reftextfacebefore{}
  \def\reftextafter{}
  \def\reftextbefore{}
  \def\reftextcurrent{}
}
\makeatother

% Captions
\usepackage[labelfont=bf, format=plain]{caption}
\usepackage{subcaption} %subfigures

% Enhance quality of tables
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{threeparttable} % Table with notes underneath
\renewcommand{\arraystretch}{1.2} % More space between rows

% Enhance functionality of lists
\usepackage{enumitem}
\setlist[itemize,1]{label=\rule[0.3ex]{0.8ex}{0.8ex}}

% Reset footnote counter on each page
\usepackage[perpage]{footmisc}


% ---- USEFUL ALIASES ----
\newcommand{\overbar}[1]{\mkern 1.5mu\overline{\mkern-1.5mu#1\mkern-1.5mu}\mkern 1.5mu}

% ---- NAMING CONVENTIONS -----
\newcommand{\scifitracker}{SciFi Tracker}
\newcommand{\lhcbexperiment}{LHCb experiment}
\newcommand{\cframe}{\mbox{C-Frame}}
\newcommand{\cframes}{\mbox{C-Frames}}
\newcommand{\MB}{Master Board}
\newcommand{\MBs}{Master Boards}
\newcommand{\CB}{Cluster Board}
\newcommand{\CBs}{Cluster Boards}
\newcommand{\PB}{PACIFIC Board}
\newcommand{\PBs}{PACIFIC Boards}
\newcommand{\DCDC}{\mbox{DC-DC}}
\newcommand{\HalfROB}{\mbox{HalfROB}}
\newcommand{\HalfROBs}{\mbox{HalfROBs}}

\newcommand{\Scurve}{\mbox{S-curve}}
\newcommand{\Scurves}{\mbox{S-curves}}

\newcommand{\Vbd}{\ensuremath{V_\text{BD}}}
\newcommand{\Vbias}{\ensuremath{V_\text{BIAS}}}
\newcommand{\OV}{\ensuremath{\Delta V}}
\newcommand{\IIC}{\ensuremath{\text{I}^2\text{C}}}

\newcommand{\winccoa}{\mbox{WinCC OA}}
\newcommand{\CC}{C\nolinebreak\hspace{-.05em}\raisebox{.4ex}{\tiny\textbf +}\nolinebreak\hspace{-.10em}\raisebox{.4ex}{\tiny\textbf +}}


% ---- SYMBOL DEFINITIONS -----
\newcommand{\luminosity}{\mathcal{L}}

% ---- AVOID FIGURES ON NEW PAGES -----
\renewcommand{\topfraction}{.75}
\renewcommand{\floatpagefraction}{.75}

% ---- ONLY WHILE EDITING ----
\usepackage{todonotes}
%\usepackage[switch,pagewise]{lineno}
%\linenumbers
% Highlight overfull hbox with a 2cm black bar
%\overfullrule=2cm
