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

% tune table of contents
\usepackage{tocloft}

% 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}
\usepackage{relsize}
\usepackage{setspace}
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
\setmainfont{DejaVu Sans}
\setmonofont{DejaVu Sans Mono}

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

% simple commands

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

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

% handle multiple languages

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

\newcommand{\warn}[1]{/!\textbackslash\_#1\_/!\textbackslash}

\newcommand{\ml}[2]{%
\ifstr{\mainlanguage}{en}{\ifstrempty{#1}{\warn{TRANSLATION}}{#1}}{%
\ifstr{\mainlanguage}{fr}{\ifstrempty{#2}{\warn{TRADUCTION}}{#2}}{%
SHOULD\_NOT\_HAPPEN!%
}}%
}

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

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