%% PACKAGES %%
\RequirePackage[english]{babel} % multilingual support
\RequirePackage[utf8]{inputenc} % encoding
\RequirePackage{graphicx}
\RequirePackage{tikz}
\RequirePackage{fontawesome}
\RequirePackage{multicol}

% Set the default font
\RequirePackage{tgpagella}

% set the page layout
\RequirePackage{geometry}
\geometry{
  a4paper,
  left=10mm,
  right=15mm,
  bottom=10mm,
  top=15mm}

% to write a short phrase on the document
\usepackage{verse}
% to attribute that phrase to the author, and print it on the right
\newcommand{\attrib}[1]{%
\nopagebreak{\raggedleft\footnotesize #1\par}}
\renewcommand{\poemtitlefont}{\normalfont\large\itshape\centering}

% empty the headers, footers, pagenumbers…
\pagestyle{empty}

% Custom sectioning with secsty
\RequirePackage{sectsty}

% For links
\RequirePackage[citecolor=., urlcolor=., linkcolor=., colorlinks]{hyperref}

\sectionfont{%                        
  \large % make sections smaller
  \fontfamily{qag}\selectfont % change font family
  \sectionrule{0pt}{0pt}{-5pt}{0.7pt} % insert a thin rule
}

%% BIBLIOGRAPHY FOR PAPERS %%  
\RequirePackage[style=numeric-comp,%
sorting=ydnt,%
maxbibnames=3,%
minbibnames=3,%
maxcitenames=1,%
mincitenames=1,%
isbn=false,%
url=false,%
doi=false,%
eprint=false,%
related=false]{biblatex}
\renewbibmacro{in:}{}
% then remove these two properties to avoid printing the "visited on" string on the URL
\AtEveryBibitem{
    \clearfield{urlyear}
    \clearfield{urlmonth}
}

%% MACROS %%
% size of the boxes used to align text
\newlength{\spacebox}
\settowidth{\spacebox}{12345678912345}
% vertical space separator between entries
\newcommand{\sepspace}{\vspace*{1.8em}}

% name
\newcommand{\name}[1]{
\Huge % font size
\fontfamily{phv}\selectfont % font family
% print name centered and bold
\begin{center} \textbf{#1} \end{center}\par
% back to normal size and font
\normalsize\normalfont}

% motto
\newcommand{\motto}[1]{
  \large % font size
  \fontfamily{phv}\selectfont % font family
% print motto centered and slanted
  \begin{center} \textsl{#1}\end{center}\par
% back to normal size and font
  \normalsize \normalfont}

% picture
\newcommand{\avatar}[1]{
  \begin{tikzpicture}[baseline=(ola.center),inner sep=0pt]
    \clip (0,0)  circle (2cm) node (ola) {\includegraphics[width=4cm]{#1}};
  \end{tikzpicture}
}

% personal information
\newcommand{\info}[2]{
  % set specific indentation for personal information
  \noindent\hangindent=2em\hangafter=0
  % create a box to align two pieces of text
  \parbox{\spacebox}{%
    \textsl{#1}} % slanted entry name
  #2 \par} % entry value

% skill
\newcommand{\skill}[2]{
  % set specific indentation for personal information
  \noindent\hangindent=1em\hangafter=0
  % create a box to align two pieces of text
  \begin{minipage}[t]{0.1\linewidth}
    #1
  \end{minipage} \hfill \begin{minipage}[t]{0.8\linewidth}
    {\footnotesize #2}
  \end{minipage}
  \par \vspace{0.5em}} % entry value

% language level
\newcommand{\lang}[3]{
  % set specific indentation for personal information
  \noindent\hangindent=1em\hangafter=0
  % create a box to align two pieces of text
  \parbox{0.7\spacebox}{\textbf{#1}} \parbox{0.5\spacebox}{#2} \parbox{0.5\spacebox}{#3}% bold font entry name
   \par \vspace{0.5em}}    % entry value

% education entry
\newcommand{\education}[4]{
  % name of the studies
  \noindent  \textbf{#1}
  % at the right the duration
  \hfill 
    \parbox{7em}{%
      \centering #2} \par
  % new paragraph with the school in italics
  \vspace{1em} \noindent\hangindent=2em\hangafter=0 \faMapPin \quad \textit{#3} \par
  % description with no hanging and in smaller text
  \vspace*{0.5em}
  \noindent\hangindent=2em\hangafter=0 \faQuoteLeft \quad \small #4 
  % back to normal size
  \normalsize \par}

% work experience
\newcommand{\work}[4]{
  % name of the work
  \noindent \textbf{#1}
  % at the right the duration
  \hfill 
  \parbox{7em}{%
    \centering #2} \par
  % new paragraph with the school in italics
  \vspace{1em} \noindent\hangindent=2em\hangafter=0 \faMapPin \quad \textit{#3} \par
  % description with no hanging and in smaller text
  \vspace*{0.5em}
  \noindent\hangindent=2em\hangafter=0 \faBriefcase \quad \small #4 
  % back to normal size
  \normalsize \par}

% grants and fellowships
\newcommand{\grant}[4]{
  % name of the work
  \noindent \textbf{#1} $\cdot$ #2 \par
  \noindent\hangindent=1em\hangafter=0 {\footnotesize #3} \par \vspace{0.5em}
}

% awards obtained
\newcommand{\award}[4]{
  % name of the work
  \noindent \textbf{#1} $\cdot$ #2 \par
  \noindent\hangindent=1em\hangafter=0 {\footnotesize #3} \par \vspace{0.5em}
}
