% set default size and document class
\documentclass[12pt]{report}

% acronyms, glossary
\usepackage[acronym,toc]{glossaries}
\makeglossaries

% tune table of contents
\usepackage{tocloft}

% links
\usepackage[colorlinks,
citecolor=blue,
filecolor=blue,
linkcolor=blue,
urlcolor=blue,
]{hyperref}

% adjust chapter titles
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makechapterhead}{50\p@}{0pt}{}{}
\patchcmd{\@makeschapterhead}{50\p@}{0pt}{}{}
\makeatother

% set paper geometry
\usepackage[a4paper,portrait,
bmargin=20mm,lmargin=20mm,rmargin=20mm,tmargin=20mm]{geometry}

% images
\usepackage{graphicx}

% set fonts
\usepackage{fontspec}
% set relative sizes
\usepackage{relsize}
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
\setmainfont{DejaVu Sans}
\setmonofont{DejaVu Sans Mono}

% set spacings
\usepackage{setspace}

% lists of figures, tables
\usepackage{tocbibind}

% set languages
\usepackage{polyglossia}
% recommended
\usepackage{csquotes}
\setmainlanguage{\mainlanguage}
\setotherlanguages{\otherlanguages}

% references after polyglossia
\usepackage[sorting=anyt]{biblatex}
\bibliography{\name}

% simple commands

\newcommand{\hr}{\rule{\textwidth}{1pt}}

\newcommand{\hrq}{\rule{.25\textwidth}{1pt}}

% handle multiple languages

\newcommand{\ifstreq}[4]{\expandafter\ifstrequal\expandafter{#1}{#2}{#3}{#4}}

\def\todo{TODO}

\newcommand{\ml}[2]{%
\ifstreq{\mainlanguage}{en}{\ifstrempty{#1}{\todo}{#1}}{%
\ifstreq{\mainlanguage}{fr}{\ifstrempty{#2}{\todo}{#2}}{%
ERROR%
}}%
}

\newcommand{\en}[1]{\textenglish{#1}}

\newcommand{\fr}[1]{\textfrench{#1}}
