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

\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}
}

