\NeedsTeXFormat{LaTeX2e}
 
% extensions

\RequirePackage[utf8x]{inputenc}
\RequirePackage[francais]{babel}
\RequirePackage[T1]{fontenc}
\RequirePackage{amssymb}
\RequirePackage{amsmath}
\RequirePackage{amsfonts}
\RequirePackage{subfig}
\RequirePackage{graphicx}
\RequirePackage{color}
\RequirePackage{gensymb}
\RequirePackage{ifthen, calc}
\RequirePackage{tabularx}
% Symbole euro
\RequirePackage{eurosym}
% Faire des boites
\RequirePackage{fancybox}
% Espaces pour écrire les grands nombres
\RequirePackage[np]{numprint}
% Outils pour les tableaux et les fonctions
\RequirePackage{tkz-tab}
\RequirePackage{tkz-fct}
% Pour gérer les todo
\RequirePackage[french, textsize=small]{todonotes}
% Plusieurs colonnes
\RequirePackage{multicol}


%\RequirePackage{arev}
\RequirePackage{kpfonts}
\renewcommand*\familydefault{\sfdefault}
\RequirePackage[T1]{fontenc}

% Les tableaux
\renewcommand{\arraystretch}{2}

% Lecture des fichiers csv et affichage des csv en table
\RequirePackage{csvsimple}

%%%%%%%%%%%%%%%%%
%  Raccourcis  %
%%%%%%%%%%%%%%%%%

%  Ensembles 
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
%\newcommand{\D}{\mathbb{D}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}

\newcommand{\intOO}[2]{\left]{#1}\,{;}\,{#2}\right[} % intervalles ouvert ouvert
\newcommand{\intOF}[2]{\left]{#1}\,{;}\,{#2}\right]} % intervalles ouvert fermé 
\newcommand{\intFO}[2]{\left[{#1}\,{;}\,{#2}\right[} % intervalles fermé ouvert
\newcommand{\intFF}[2]{\left[{#1}\,{;}\,{#2}\right]} % intervalles fermé fermé


% Vecteurs
\renewcommand{\vec}[1]{\overrightarrow{#1}} 	% représentation d'un vecteur
\newcommand{\norme}[1]{||\vec{#1}||} 			% Norme d'un vecteur
\newcommand{\scal}[2]{\vec{#1} \cdot \vec{#2}}  	% Produit scalaire 
\newcommand{\vectCoord}[2]{{\renewcommand{\arraystretch}{1}%
    \left(\begin{array}{c} #1 \\ #2 \end{array}  \right)%
}}

% Proba
\newcommand{\coefBino}[2]{\vectCoord{#1}{#2}}

% Logique
\renewcommand{\equiv}{\Leftrightarrow}

% Calculatrice
\usepackage{listings}
\newcommand{\calc}[1]{\Ovalbox{\lstinline|#1|}}
%\newcommand{\calc}[1]{\verb!#1!}

% Autres
\newcommand{\TODO}[1]{\textcolor{red}{note(#1)}}

% Poser des opérations
\RequirePackage[letterspace=500]{microtype}

\newcommand{\poseOP}[3]{
    \textls{
    $\begin{array}{cr}
        & #1 \\[-0.3cm]
        #2 & #3 \\
        \hline
        &
    \end{array}$}
}


%%%%%%%%%%%%%%%%%%%%%%
%  Environment Exo  %
%%%%%%%%%%%%%%%%%%%%%%

\newcounter{exo}[section]
\setcounter{exo}{0}
\newenvironment{Exo}[1][0]{%
    \addtocounter{exo}{1}       
    \medskip
	\noindent%
	\textbf{\color{exercice}{Exercice \theexo}} \hspace{0.5cm} \color{line}\hrulefill \hspace{0.5cm} \color{exercice}
	\ifthenelse{\lengthtest{#1 pt=0 pt}}{}{
			\ifthenelse{\lengthtest{#1 pt = 1pt}}{#1 point}{#1 points}}%
	\par
    \medskip
	\color{text}
}{\par%
}

\newcommand{\exo}[1]{{\centering \textbf{#1} \par}}

% New environment définitions
\newenvironment{Def}{%
    \medskip
    \noindent \textbf{Définition:}
}{%
}

% New environment exemples 
\newenvironment{Ex}{%
    \medskip
    \noindent \textbf{Exemples:}
}{%
}

% New environment propriété 
\newenvironment{Prop}{%
    \medskip
    \noindent \textbf{Propriété:}
}{%
}

% New environment Démo
\newenvironment{Demo}{%
    \medskip
    \noindent \textbf{Démonstration:}
}{%
\\ $\triangle$
}

% New environment remarque
\newenvironment{Rmq}{%
    \medskip
    \noindent \textbf{Remarque:}
}{%
}

% New environment methode
\newenvironment{Mthd}{%
    \medskip
    \noindent \textbf{Méthode:}
}{%
}


\newenvironment{hint}{%
    Indication:
    \begin{itshape}
}{%
\end{itshape}
}

\def\title#1{\gdef\@title{#1}\gdef\Thetitle{#1}}
\def\date#1{\gdef\@date{#1}\gdef\Thedate{#1}}

% ##########################
% Tikz shortcuts
% ##########################

% Les dessins
\RequirePackage{tikz}

%% le cercle trigo
\newcommand{\cercleTrigo}%
{%
    \draw[->, very thick] (-1.2,0) -- (1.3, 0);
    \draw[->, very thick] (0,-1.2) -- (0,1.3);
    \draw[very thick] (0,0) circle (1);
    \draw (0,0) node[below left] {$O$};
    \draw (1,0) node[below right] {$I$};
    \draw (0,1) node[above left] {$J$};
}

%% Le repère orthonormé avec la grille
%%% \repere{xmin}{xmax}{ymin}{ymax}
\newcommand{\repere}[4]%
{%
        \draw[very thin, gray] (#1,#3) grid (#2,#4);
        \draw[->, very thick] (#1,0) -- (#2,0);
        \draw[->, very thick] (0,#3) -- (0,#4);
        \draw (0,0) node[below right, scale=0.7 ] {$O$};
        \draw (0,1) node {-} node[left] {$J$};
        \draw (1,0) node[rotate=90] {-} node[below] {$I$};
    }
\newcommand{\repereNoGrid}[4]%
{%
        \draw[->, very thick] (#1,0) -- (#2,0);
        \draw[->, very thick] (0,#3) -- (0,#4);
    }

%% Diagramme boite
%%% \boxplot{Vertical Center}{min}{Q1}{Me}{Q3}{Max}
\newcommand{\boxplot}[6]%
{%
    \filldraw[color=highlightbg, draw=text] (#3, {#1 - 0.5}) rectangle (#5, {#1 + 0.5});
    \draw (#2, {#1 - 0.5}) -- (#2, {#1 + 0.5}) node[above] {$Min$};
    \draw (#3, {#1 - 0.5}) -- (#3, {#1 + 0.5}) node[above] {$Q_1$};
    \draw (#4, {#1 - 0.5}) -- (#4, {#1 + 0.5}) node[above] {$Me$};
    \draw (#5, {#1 - 0.5}) -- (#5, {#1 + 0.5}) node[above] {$Q_3$};
    \draw (#6, {#1 - 0.5}) -- (#6, {#1 + 0.5}) node[above] {$Max$};

    \draw (#2, #1) -- (#3, #1);
    \draw (#5, #1) -- (#6, #1);

    %\draw ({(#2 +#3)/2}, #1) node[above] {25\%};
    %\draw ({(#3 +#4)/2}, #1) node[above] {25\%};
    %\draw ({(#4 +#5)/2}, #1) node[above] {25\%};
    %\draw ({(#5 +#6)/2}, #1) node[above] {25\%};

}
\newcommand{\boxplotNoNames}[6]%
{%
    \filldraw[color=highlightbg, draw=text] (#3, {#1 - 0.5}) rectangle (#5, {#1 + 0.5});
    \draw (#2, {#1 - 0.5}) -- (#2, {#1 + 0.5});
    \draw (#3, {#1 - 0.5}) -- (#3, {#1 + 0.5});
    \draw (#4, {#1 - 0.5}) -- (#4, {#1 + 0.5});
    \draw (#5, {#1 - 0.5}) -- (#5, {#1 + 0.5});
    \draw (#6, {#1 - 0.5}) -- (#6, {#1 + 0.5});

    \draw (#2, #1) -- (#3, #1);
    \draw (#5, #1) -- (#6, #1);
}


