\usepackage{graphicx}
\usepackage{geometry}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{xparse}
\usepackage{xcolor}
\usepackage{titlesec}

\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}

\graphicspath{{images/}}
\geometry{
  a4paper,
  left=2.5cm,
  right=2.5cm,
  top=1.5cm,
  bottom=1.5cm
}

\newcommand{\subtitle}[1]{\def\@subtitle{#1}}
\newcommand{\@subtitle}{}

\newcommand{\coverpage}[3] {
	\begin{titlepage}

	\begin{figure}[h]
	    \centering
	    \includegraphics[width=0.20\textwidth]{#2}
	\end{figure}

	\begin{center}
		\large #1

		\vspace{0.5cm}

		\rule{\textwidth}{1pt}

		\Huge \@title

		\large \@subtitle

		\rule{\textwidth}{1pt}

		\large Par \@author
		
		\large Le \today 
	\end{center}

	\vspace{0.5cm}

	\begin{figure}[h]
	    \centering
	    \includegraphics[width=0.75\textwidth]{#3}
	\end{figure}

	\end{titlepage}
}

\NewDocumentCommand{\crfigure}{O{0.75\textwidth} m m}{
	\begin{figure}[h]
	    \centering
	    \includegraphics[width=#1]{#2}
	    \caption{#3}
	\end{figure}
}

\NewDocumentCommand{\twofigures}{O{0.75\textwidth} m m m m}{
	\begin{figure}[h]
	    \centering
      \begin{minipage}[t]{0.45\dimexpr#1}
        \centering
	      \includegraphics[width=\textwidth]{#2}
        \caption{#3}
      \end{minipage}
      \hspace{0.05\textwidth}
      \begin{minipage}[t]{0.45\dimexpr#1}
        \centering
	      \includegraphics[width=\textwidth]{#4}
        \caption{#5}
      \end{minipage}
	\end{figure}
}

\definecolor{reference}{RGB}{255, 0, 0}
\definecolor{titre}{RGB}{102, 0, 102}
\definecolor{texte}{RGB}{0, 0, 204}
\definecolor{refexi}{RGB}{0, 102, 0}
\definecolor{note}{RGB}{89, 89, 89}
\definecolor{reffsc}{RGB}{255, 102, 0}

\newcommand{\reference}[1]{
	\color{reference}
	\noindent
	\textbf{#1}
	\color{black}
}

\newcommand{\titre}[1]{
	\color{titre}
	\noindent
	\textbf{#1}
	\color{black}
}

\newcommand{\texte}[1]{
	\color{texte}
	\noindent
	#1
	\color{black}
}

\newcommand{\refexi}[1]{
	\color{refexi}
	\noindent
	#1
	\color{black}
}

\newcommand{\note}[1]{
	\color{note}
	\noindent
	#1
	\color{black}
}

\newcommand{\reffsc}[1]{
	\color{reffsc}
	\noindent
	#1
	\color{black}
}

\newcommand{\bp}[6] {

	\reference{#1}

	\vspace{0.2cm}

	\titre{#2}

	\vspace{0.2cm}

	\texte{#3}

	\vspace{0.2cm}

	\refexi{#4}

	\vspace{0.2cm}

	\note{#5}

	\vspace{0.2cm}

	\reffsc{#6}
}


\titleclass{\subsubsubsection}{straight}[\subsubsection]
\newcounter{subsubsubsection}
\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\titleformat{\subsubsubsection}
  {\normalfont\normalsize\bfseries}{\thesubsubsubsection}{1em}{}
\titlespacing*{\subsubsubsection}
  {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}


\titleclass{\subsubsubsubsection}{straight}[\subsubsubsection]
\newcounter{subsubsubsubsection}
\renewcommand\thesubsubsubsubsection{\thesubsubsubsection.\arabic{subsubsubsubsection}}
\titleformat{\subsubsubsubsection}
  {\normalfont\normalsize\bfseries}{\thesubsubsubsubsection}{1em}{}
\titlespacing*{\subsubsubsubsection}
  {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}