%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%																											%
%													Packages LATEX											%
%																											%		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{etex}							%Pour ne pas être limité par le nombre de registre
\RequirePackage{tikz}							%Dessins - Graphiques
\usetikzlibrary{scopes}							%Pour définir des zones d'intersections \clip entre des figures et les colorer  \fill
\usetikzlibrary{decorations.pathreplacing}				% Pour les accolades avec Tikz
\RequirePackage{pgfplots}
\usetikzlibrary{plotmarks}
\usetikzlibrary{patterns}							% Pour placer une décoration ?
\RequirePackage[utf8]{inputenc}
\RequirePackage[french]{babel}
\RequirePackage[T1]{fontenc}
\RequirePackage{setspace}
\RequirePackage{graphicx}
\RequirePackage{amsmath}
\RequirePackage{amsfonts}
\RequirePackage{amssymb}
%\RequirePackage{graphicx}
\RequirePackage[scientific-notation=true]{siunitx}							%Pour les unités et gérer l'écriture scientifique
\RequirePackage{tabularx}						%Pour automatiser la gestion de la colonne la plus large - à éliminer à terme 
\RequirePackage{array}							% Pour faire des tableaux avec un nouveau type de mise en forme de colonnes					

\RequirePackage{multido}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%																											%
%											Gestion des compteurs 												%
%																											%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcounter{CompteurApplication}					% Compteur servant à indexer les encadrés Document
\setcounter{CompteurApplication}{1}	

\newcounter{CompteurDocument}					% Compteur servant à indexer les encadrés Document
\setcounter{CompteurDocument}{1}	


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%																											%
%										Packages Mise en forme - TextColorBox 										%
%																											%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\RequirePackage{color}
\RequirePackage{tcolorbox}						%Pour générer les boîtes encadrant les documents
\tcbuselibrary{breakable}
\tcbuselibrary{skins}
\RequirePackage{xcolor}
\RequirePackage{colortbl}

\RequirePackage{enumitem}							%Pour gérer la mise en forme des listes
\RequirePackage{pifont}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%																											%
%									Packages propres à la Physique Chimie											%
%																											%		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RequirePackage{mhchem}						%Pour écrire les formules brutes
\RequirePackage{chemfig}						%Pour écrire les formules fsd - fd - f topologique - représentation de Cram
\RequirePackage{pgf-spectra}
\RequirePackage[inline]{asymptote}					%Pour insérer du code Asymptote avec l'environnement asy


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%																											%
%										Réglages mise en page													%
%																											%		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RequirePackage[left=1cm,right=1cm,top=1cm,bottom=1cm]{geometry}





\setlength{\parindent}{0cm}											% Pour ne pas avoir d'indentation
\pagestyle{empty}													% Pour ne pas numéroter les pages









%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%																											%
%		BOXES DE MISE EN  FORME (avec compteurs automatiques) pour les commandes 	\Applications  	\Cours	\Documents	%
%																											%		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%%Je n'ai pas pris l'option autocounter des tcolorbox sinon boxapplication et boxapplicationimage n'auraient pas le même compteur (idem pour boxdocument et boxdocumentimage)


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		boxapplication																							%
%																											%		
%		boxapplication: 		Boxe de mise en forme permettant d'incrémenter automatiquement les Applications élèves 				%
%													 		 												%		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtcolorbox							
{boxapplication}[1]{breakable,tikznode boxed title, 					
enhanced,attach boxed title to top center =
{yshift=-3mm,yshifttext=-1mm},
boxed title style={size=small,colback=green!80!black},colback=white,
title=Application~\theCompteurApplication:~#1\addtocounter{CompteurApplication}{1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		boxapplicationimage																						%
%																											%		
%		boxapplicationimage: 	Boxe de mise en forme permettant d'incrémenter automatiquement les Applications élèves 			%
%													 		 												%		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtcolorbox							
{boxapplicationimage}[1]{sidebyside,lower separated=true,tikznode boxed title, 					% sidebyside,lower separated = false,
enhanced,attach boxed title to top center =
{yshift=-3mm,yshifttext=-1mm},
boxed title style={size=small,colback=green!80!black},colback=white,
title=Application~\theCompteurApplication:~#1\addtocounter{CompteurApplication}{1}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		boxcours																								%
%																											%		
%		boxcours: 		Boxe de mise en forme permettant d'incrémenter automatiquement les Documents élèves 					%
%													 		 												%		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtcolorbox[auto counter]							% Nécessite un compteur
{boxcours}[1]{breakable,tikznode boxed title, 					% sidebyside,lower separated = false,
enhanced,attach boxed title to top center =
{yshift=-3mm,yshifttext=-1mm},
boxed title style={size=small,colback=red!80!black},colback=white,
title=Cours~\thetcbcounter:~#1}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		boxdocument																							%
%																											%		
%		boxdocument: 		Boxe de mise en forme permettant d'incrémenter automatiquement les Documents élèves 				%
%													 		 												%		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtcolorbox[auto counter]							% Nécessite un compteur
{boxdocument}[1]{tikznode boxed title, 					% sidebyside,lower separated = false,
enhanced,attach boxed title to top center =
{yshift=-3mm,yshifttext=-1mm},
boxed title style={size=small,colback=green!80!black},colback=white,
title=Document~\theCompteurDocument:~#1\addtocounter{CompteurDocument}{1}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		boxdocumentimage																						%
%																											%		
%		boxdocumentimage: 		Boxe de mise en forme permettant d'incrémenter automatiquement les Documents élèves 			%
%													 		 												%		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtcolorbox[auto counter]							% Nécessite un compteur
{boxdocumentimage}[1]{tikznode boxed title, 					% sidebyside,lower separated = false,
enhanced,attach boxed title to top center =
{yshift=-3mm,yshifttext=-1mm},
boxed title style={size=small,colback=green!80!black},colback=white,
title=Document~\theCompteurDocument:~#1\addtocounter{CompteurDocument}{1}}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%																											%
%		COMMANDES:		\EncadreApplication		  \EncadreCours 		\EncadreDocument								%
%																											%		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		\EncadreApplication{}{}																					%
%																											%		
%		\EncadreApplication{}{}: 	Première accolade: Titre de l'application.													%
%							Deuxième accolade: Contenu de l'application 												%		
%																											%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\EncadreApplication}[2]{
\begin{boxapplication}{#1}
#2
\end{boxapplication}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		\EncadreApplicationImage{}{}{}{}																			%
%																											%		
%		\EncadreApplicationImage{}{}{}{}: 	Première accolade: Titre de l'application.											%
%									Deuxième accolade: Contenu de l'application. 										%
%									Troisième accolade: Echelle de l'image	 										%		
%									Quatrième accolade: Nom du fichier		 										%
%																											%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\EncadreApplicationImage}[4]{
\begin{boxapplicationimage}{#1}
#2
\tcblower
\centering
\includegraphics[scale=#3]{#4}
\end{boxapplicationimage}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		\EncadreCours{}{}																						%
%																											%		
%		\EncadreCours{}{}: 		Première accolade: Titre du cours.														%
%							Deuxième accolade: Contenu du cours 													%		
%																											%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\EncadreCours}[2]{
\begin{boxcours}{#1}
#2
\end{boxcours}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		\EncadreDocument{}{}																					%
%																											%		
%		\EncadreDocument{}{}: 	Première accolade: Titre du document.													%
%							Deuxième accolade: Contenu du document 												%		
%																											%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\EncadreDocument}[2]{
\begin{boxdocument}{#1}
#2
\end{boxdocument}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		\EncadreDocumentImage{}{}{}{}																				%
%																											%		
%		\EncadreDocumentImage{}{}{}{}: 	Première accolade: Titre du Document.											%
%									Deuxième accolade: Contenu du Document. 										%
%									Troisième accolade: Echelle de l'image	 										%		
%									Quatrième accolade: Nom du fichier		 										%
%																											%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\EncadreDocumentImage}[4]{
\begin{boxdocumentimage}{#1}
#2
\tcblower
\centering
\includegraphics[scale=#3]{#4}
\end{boxdocumentimage}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		\Titre{}																								%
%																											%		
%		\Titre{}: Texte écrit en rouge, gras, lettres capitales et centré 														%		
%																											%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\Titre}[1]{					
\begin{center}
\huge\textbf{\textsc{\textcolor{red}{#1}}}			
\end{center}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		\Trou{}																								%
%																											%		
%		\Trou{}: Remplace le texte contenu entre les accolades par des pointillés.												%		
%																											%
% https://www.developpez.net/forums/d1404040/autres-langages/autres-langages/latex/programmation-tex-avancee/macro-texte-trous/		%	
%																											%	
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\iftrou\troutrue					
\newlength{\trouwidth}
 
\newcommand{\Trou}[1]{
\iftrou
	\settowidth{\trouwidth}{#1}
	\setlength{\trouwidth}{2 \trouwidth}
	\hbox to \trouwidth{\dotfill}%
\else%
	#1%
\fi
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%																											%
%		COMMANDES:		\Minipage		  																		%
%																											%		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		\Minipage{}{}																							%
%																											%		
%		\Minipage{}{}		Première accolade: Contenu du minipage de gauche 											%
%						Deuxième accolade: Contenu du minipage de droite												%
%																					 		 				%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\newcommand{\Minipage}[2]{
\begin{minipage}[c]{0.45\linewidth}
#1
\end{minipage}
\hfill
\begin{minipage}[c]{0.45\linewidth}
#2
\end{minipage}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		\GraphiqueVide{}{}{}{}{}{}{}{}{}																				%
%																											%		
%		\GraphiqueVide{}{}{}{}{}{}{}		Première accolade: Nbre d'intervalles dans la graduation principale	 						%
%								Deuxième accolade: xmax														%
%								Troisième accolade: ymax						 									%
%								Quatrième accolade: xlabel														%
%								Cinquième accolade: ylabel														%
%								Sixième accolade: Titre															%		
%								Septième accolade: Echelle														%
%																											%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\GraphiqueVide}[7]{
\begin{tikzpicture}
\begin{axis}[xmin=0,ymin=0,
minor tick num=#1,
xmax=#2, 
ymax=#3,
grid=both,
%xtick={0,1,...,},
xlabel={\textbf{#4}},
ylabel={\textbf{#5}},
title={\textbf{#6}},
scale=#7]
\end{axis}
\end{tikzpicture}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		\Graphique{}{}{}{}{}{}{}{}																					%
%																											%		
%		\Graphique{}{}{}{}{}{}{}{}		Première accolade: Nbre d'intervalles dans la graduation principale	 						%
%								Deuxième accolade: xmax														%
%								Troisième accolade: ymax						 									%
%								Quatrième accolade: xlabel														%
%								Cinquième accolade: ylabel														%
%								Sixième accolade: Titre															%		
%								Septième accolade: Echelle														%
%								Huitième accolade: Points															%
%																											%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\Graphique}[8]{
\begin{tikzpicture}
\begin{axis}[xmin=0,ymin=0,
minor tick num=#1,
xmax=#2, 
ymax=#3,
grid=both,
%xtick={0,1,...,},
xlabel={\textbf{#4}},
ylabel={\textbf{#5}},
title={\textbf{#6}},
scale=#7]
\addplot+[only marks] coordinates {#8};
\end{axis}
\end{tikzpicture}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		\Pointilles{}																							%
%																											%		
%		\Pointilles{}		Première accolade: Nbre de lignes à remplir							 						%
%																											%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\Pointilles}[1]{
\multido{}{#1}{.\dotfill~ \newline}
}