\NeedsTeXFormat{LaTeX2e}

% Le package se présente
\def\fileversion{1.0}%
\def\filedate{2015/04/01}%
\ProvidesPackage{monstyle_freds_2015}%
	[\filedate\space\fileversion\space monstyle_freds_2015 package]% %

%\usepackage[upright]{fourier} % Au moins 5 heures pour comprendre que si fourier n'est pas avant je ne sais pas quoi \Roman{compteur} ne se met pas en gras!
\usepackage{fourier} % Au moins 5 heures pour comprendre que si fourier n'est pas avant je ne sais pas quoi \Roman{compteur} ne se met pas en gras!

% Pour neutraliser la police caligraphique de Fourier:
\DeclareSymbolFont{cmmathcal}{OMS}{cmsy}{m}{n}
\DeclareSymbolFontAlphabet{\mathcal}{cmmathcal}

\usepackage[greek,francais]{babel}
\frenchbsetup{StandardLists=true}


%\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm, marginparsep=0cm]{geometry}
%\DeclareOption{petitemarge}{\PassOptionsToPackage{left=0cm,right=0cm,top=2cm,bottom=2cm, marginparsep=0cm}{geometry}}
%\DeclareOption{petitemarge}{
%  \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm, marginparsep=0cm]{geometry}}
%\ProcessOptions
%\PassOptionsToPackage{left=2cm,right=2cm,top=2cm,bottom=2cm, marginparsep=0cm}{geometry}

% En cours 

\DeclareOption{marge1}{
\PassOptionsToPackage{left=1cm,right=1cm,top=2cm,bottom=2cm, marginparsep=0cm}{geometry}
}
\DeclareOption{marge2}{
\PassOptionsToPackage{left=2cm,right=2cm,top=2cm,bottom=2cm, marginparsep=0cm}{geometry}
}
\DeclareOption{marge3}{
\PassOptionsToPackage{left=1cm,right=1cm,top=2cm,bottom=2.5cm, marginparsep=0cm}{geometry}
}



\DeclareOption{marge4}{
\PassOptionsToPackage{left=0cm,right=0cm,top=2cm,bottom=2.5cm, marginparsep=0cm}{geometry}
}
\DeclareOption{marge5}{
\PassOptionsToPackage{left=1cm,right=1cm,top=0cm,bottom=0cm, marginparsep=0cm}{geometry}
}

\ExecuteOptions{marge3}
\ExecuteOptions{marge4}
\ExecuteOptions{marge5}
\ProcessOptions*
\RequirePackage{geometry}



\usepackage{fontspec}
\usepackage{xunicode}


%%%%%%%%%%%%%%%%
% PACKAGE fonts
%%%%%%%%%%%%%%%%
%
% il parait qu'il ne faut plus l'utiliser avec xelatex
% package de symbole http://home.online.no/~pjacklam/latex/textcomp.pdf
%\usepackage{textcomp}

% selectionne la family de font. lmr c'est latin modern roman  mais j'ai l'impression que cela ne
% sert à rien, la police est selectionnee par defaut!!
% ne sert à rien avec xelatex !
%\renewcommand{\rmdefault}{lmr}
%\renewcommand{\rmdefault}{ygoth}

\setmainfont{FreeSerif}

%\setmainfont{URWGroteskT}

% avec lmodern j'ai des trucs bizarres
%\usepackage{lmodern}
%\DeclareFontFamily{OMX}{lmex}{}
%\DeclareFontShape{OMX}{lmex}{m}{n}{<->lmex10}{}


\usepackage{pifont}     % Police symbole pour \ding
\usepackage{amsmath}    % Police de maths
\usepackage[psamsfonts]{amssymb}    % Police de maths
\usepackage{mathrsfs}
% font de math pour N R ..
\newcommand\hmmax{0}
\newcommand\bmmax{0}
\usepackage{bbm}
\usepackage{eurosym}


%%%\usepackage{fancyref}
\usepackage{float}
%%%\usepackage{marvosym}
%\usepackage{txfonts} %fonts pour les math

%\DeclareOption{paperf}{%
%	%\addtolength{\hoffset}{-0.5cm}     % marges de 2cm
%	\addtolength{\hoffset}{-0.3cm}     % marges de 2cm
%	%\setlength{\textwidth}{18cm}
%	\setlength{\textwidth}{17.7cm}
%	\addtolength{\voffset}{.5cm}     % marges de 2cm
%	%\addtolength{\voffset}{0cm}     % marges de 2cm
%	\setlength{\textheight}{250cm}}
%	%\setlength{\textheight}{25.5cm}}
%\ProcessOptions

%

%%%%%%%%%%%%%%%%%%%%%%%%
% PACKAGE Divers
%%%%%%%%%%%%%%%%%%%%%%%
%
\usepackage{rotating}
% fait des ligne diago : slash (utilité ?)
\usepackage{cancel}
\usepackage{calc}
\usepackage{calculator,calculus}
\usepackage{multido}
\usepackage{ifthen}
\usepackage{lastpage}
%\definecolor{trust}{rgb}{0.71,0.14,0.07}
\usepackage{filecontents}
\usepackage{xr}
%\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}

%

%%%%%%%%%%%%%%%%%%%%%%%%%%
% PACKAGE Mise en page 
%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% orientation
\usepackage{lscape}
\usepackage{verbatim}
\usepackage{multicol}
\usepackage{url}
\usepackage{xspace}	    % Pour bien gérer les espaces à la fin de macros 
\usepackage{setspace}
\usepackage{fancybox,fancyhdr}
% faire reference à une page
\usepackage{varioref}
% pareil que minipage mais avec largeur automatique
\usepackage{varwidth}
% for quotations
\usepackage{csquotes}
\usepackage{empheq}
\usepackage{marginnote}

%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PACKAGE Graphisme 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\usepackage{graphicx}
\usepackage[cmyk,dvipsnames,svgnames,table]{xcolor}
\usepackage{pst-bezier}
\usepackage{pstricks-add}
%\usepackage[cmyk,table]{xcolor}
%\usepackage{pstcol}
\usepackage{pst-3d}
\usepackage{pst-text}
\usepackage{pst-tree}
\usepackage{pst-eucl}
\usepackage{pst-func}
\usepackage{pst-grad}
\usepackage{pst-math}
\usepackage{etex} % pour que cela ne plante pas tikz
\usepackage{pgf,tikz,tkz-tab}
\usepackage[np]{numprint} %pour utiliser la commande \nombre{} qui met des espaces
\usepackage{verbatimbox} 
\usepackage{eso-pic}
% graphics sur toute la page
\usepackage{incgraph}
\usepackage{tcolorbox}
\tcbuselibrary{raster}
\tcbuselibrary{skins}
\tcbuselibrary{xparse}
\tcbuselibrary{breakable}
\tcbuselibrary{hooks}
\usetikzlibrary{shadings,shadows}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.text}
\usetikzlibrary{patterns}
\usetikzlibrary{spy}
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PACKAGE Gestion des tableaux % %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\RequirePackage{array}     % Nouveau package de tableau
\RequirePackage{tabularx}  % Nouveau package de tableau de
\RequirePackage{dcolumn}   % alignement sur la virgule
\RequirePackage{hhline}    % Nouvelle gestion des lignes 
\RequirePackage{multirow} 
\usepackage{slashbox}
\usepackage{diagbox}
\usepackage{cellspace}
% des couleurs dans les tableaux
\usepackage{colortbl}
% Pour avoir des tableaux avec colonne de largeur fixe
\newcolumntype{Z}{>{\centering\arraybackslash} X } % pour centrer horizontalement
\newcolumntype{Y}[1]{|Z*{#1}{|Z} |}
\usepackage{tableau}
%

%%%%%%%%%%%%%%%%%%%%%%%%%
% PACKAGE pour les math
%%%%%%%%%%%%%%%%%%%%%%%%%
%
% diagramme rectangulaire
%\usepackage{yhmath}
\usepackage[xcas]{pro-suites}
\usepackage{amscd}
\usepackage[exercise]{amsthm}
\usepackage{algorithme}
% commande pour mettre en bold les symboles de math \bm{..}
\usepackage{bm}
\usepackage{amssymb, amsmath, mathtools} 
\usepackage{stmaryrd}

\newcommand{\dayOfWeek}[1]
{
  \ifthenelse{\equal{#1}{0}}{Sunday}{}
  \ifthenelse{\equal{#1}{1}}{Monday}{}
  \ifthenelse{\equal{#1}{2}}{Tuesday}{}
  \ifthenelse{\equal{#1}{3}}{Wednesday}{}
  \ifthenelse{\equal{#1}{4}}{Thursday}{}
  \ifthenelse{\equal{#1}{5}}{Friday}{}
  \ifthenelse{\equal{#1}{6}}{Saturday}{}
}
%
%%%%%%%%%%%%%%%%%%%%%%ù
% Paquet pour insérer du code python et def des proprietes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{listings}
\lstset{ %
  backgroundcolor=\color{white},   % choose the background color; you must add \usepackage{color} or \usepackage{xcolor}
  basicstyle=\footnotesize,        % the size of the fonts that are used for the code
  breakatwhitespace=false,         % sets if automatic breaks should only happen at whitespace
  breaklines=true,                 % sets automatic line breaking
  captionpos=b,                    % sets the caption-position to bottom
  commentstyle=\color{mygreen},    % comment style
  deletekeywords={...},            % if you want to delete keywords from the given language
  escapeinside={\%*}{*)},          % if you want to add LaTeX within your code
  extendedchars=true,              % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
  frame=single,                    % adds a frame around the code
  keepspaces=true,                 % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
  keywordstyle=\color{blue},       % keyword style
  language=Octave,                 % the language of the code
  morekeywords={*,...},            % if you want to add more keywords to the set
  numbers=left,                    % where to put the line-numbers; possible values are (none, left, right)
  numbersep=5pt,                   % how far the line-numbers are from the code
  numberstyle=\tiny\color{mygray}, % the style that is used for the line-numbers
  rulecolor=\color{black},         % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
  showspaces=false,                % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
  showstringspaces=false,          % underline spaces within strings only
  showtabs=false,                  % show tabs within strings adding particular underscores
  stepnumber=2,                    % the step between two line-numbers. If it's 1, each line will be numbered
  stringstyle=\color{mymauve},     % string literal style
  tabsize=2,                       % sets default tabsize to 2 spaces
  title=\lstname,                   % show the filename of files included with \lstinputlisting; also try caption instead of title
literate=
{á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1
{Á}{{\'A}}1 {É}{{\'E}}1{Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1
{à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1{ù}{{\`u}}1
{À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1
{ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1
{Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
{â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1
{Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1
{œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1
{ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1
{ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1
{€}{{\EUR}}1 {£}{{\pounds}}1
}

\lstdefinestyle{stylepython}{
        language=Python, 
        basicstyle=\ttfamily,
%       name=iciNOM,
%        title={uu}, 
%       caption={iciTitre},
%       label={iciNom},
        commentstyle=\footnotesize\color{green!50!black}, 
        keywordstyle=\color{blue},   
        stringstyle=\color{olive},   
        numberstyle=\tiny,  
%       mathescape,  
%       showstringspaces=false,   
%       tabsize=2,   
        framexleftmargin=5mm,  
%       framexrightmargin=5pt,
%       framexbottommargin=5pt
        xleftmargin=0mm,  
        keepspaces=false,   
        classoffset=1,     
        numbers=left,    
        stepnumber=1,    
        numbersep=8pt,   
        showstringspaces=false,  
        frame=single,
        framerule=1pt,
        rulecolor=\color{black}, 
%       breaklines=true,  
%       rulesepcolor=\color{blue}, %avec frame=shadowsbox
        %backgroundcolor=\color{yellow!30},
        backgroundcolor=\color{white},
		columns = fullflexible
}


%%%%%%%%%%%%%%%%%%%%%%%%%
% PACKAGE  math issue de mesMacros.sty (site dupuy de lomes)
% pour les kholles
%%%%%%%%%%%%%%%%%%%%%%%%%

% Commande à redefinir à la volée
\newcommand{\generiquea}{R}
\newcommand{\generiqueb}{U}


% ==================================================
% IfEmpty
% ==================================================
\newcommand{\ifempty}[3]{\ifx\hfuzz#1\hfuzz #2 \else #3\fi}
% \hfuzz sert seulement à ne pas être présent dans #1
% \ifstrempty : incompatible avec latexml
% \ifblank : inactif
% ==================================================
% Ensembles de nombres
% ==================================================
\newcommand{\ensemblenombre}[1]{\mathbb{#1}}
\newcommand{\N}{\ensemblenombre{N}}
\newcommand{\Z}[1][]{\ifempty{#1}{\ensemblenombre{Z}}{\Z/#1\Z}}
\newcommand{\Q}{\ensemblenombre{Q}}
\newcommand{\R}{} % Probleme LateXML
\renewcommand{\R}{\ensemblenombre{R}}
\def\U{\ensemblenombre{U}} % U dans latexml
\def\C{\ensemblenombre{C}}
\newcommand{\K}{\ensemblenombre{K}}
\def\ind{{\bf 1}}

% ==================================================
% Opérations
% ==================================================
\let\oldstar=\star
\def\star{\mathbin{\oldstar}}
\newcommand*\divise{\mathrel{\mid}}
\renewcommand{\bigoplus}{\mathop{\hbox{\large $\oplus$}}}
\newcommand*{\Bigoplus}{\mathop{\hbox{\Large $\oplus$}}}
\newcommand*\obot{\mathbin{\oplus^{\bot}}}
\newcommand*\bigobot{\mathop{\hbox{\large$\oplus\smash{\mathrlap{^{\bot}}}$}}} % Une faute d'espacement à la suite...
\def\.{}
\def\loiproduit{.}
\newcommand{\nfrac}[2]{#1/#2}
\let\lleq\ll
% ==================================================
% Opérateurs
% ==================================================
\newcommand{\raisebot}{\raisebox{1pt}{$\scriptstyle\bot$}}
\newcommand{\factorial}[1]{#1!\,}
% ==================================================
% Raccourcis d'éditions
% ==================================================
\newcommand{\dotpourvariable}{\:\cdot\:}
\newcommand{\X}{\mathopen{[}X\mathclose{]}}
\newcommand{\Cte}{C^{te}}
% ==================================================
% Lettres remarquables
% ==================================================
\def\L{\mathop{}\mathopen{}\mathrm{L}}
\def\D{\mathop{}\mathopen{}\mathrm{D}}
\renewcommand{\d}{\mathop{}\mathopen{}\mathrm{d}}
\def\dx{\d{}x}
\def\ds{\d{}s}
\def\dt{\d{}t}
\def\du{\d{}u}
\newcommand*{\e}{\ensuremath{\mathrm{e}}}
\def\o{\mathrm{o}}
\def\O{\mathrm{O}}
\renewcommand*{\i}{\ensuremath{\mathrm{i}}}
\newcommand*{\I}{\ensuremath{\mathrm{I}}}
\newcommand*{\Id}{\ensuremath{\mathrm{Id}}}
\newcommand*{\E}{\ensuremath{\mathrm{E}}}
\newcommand*{\V}{\ensuremath{\mathrm{V}}}
\def\P{\ensuremath{\mathrm{P}}}
% ==================================================
% Matrices
% ==================================================
\newcommand{\cycle}[1]{\begin{pmatrix}#1\end{pmatrix}}
\newcommand{\colonne}[1]{\begin{pmatrix}#1\end{pmatrix}}
\newcommand{\coord}[1]{\left|\begin{matrix}#1\end{matrix}\right.}
\newcommand{\ligne}[1]{\begin{pmatrix}#1\end{pmatrix}}
\newcommand{\bloc}[3]{\smash{\mathclap{\raisebox{#2}{\hspace{#1}\large$(#3)$}}}}
\newcommand{\blocsup}[1]{\bloc{-8pt}{-4pt}{#1}}
\newcommand{\blocinf}[1]{\bloc{10pt}{3pt}{#1}}
\newcommand{\dettaille}[1]{\mathrlap{[#1]}}
%\newcommand{\transpose}[1]{
%  \ifthenelse{\equal{\unexpanded{#1}}{A}}{\prescript{t}{}{\!A}}
%  {\ifthenelse{\equal{\unexpanded{#1}}{J}}{\prescript{t}{}{\!J}}
%    {\ifthenelse{\equal{\unexpanded{#1}}{M}}{\prescript{t}{}{\!M}}
%      {\prescript{t}{}{#1}}}}
%}
\newcommand{\transpose}[1]{#1^{T}} 
\newcommand{\transp}[1]{#1^{T}} 

% ==================================================
% Outils mathématiques divers
% ==================================================
\makeatletter
\def\revddots
{\mathinner{\mkern1mu\raise\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu\raise4\p@\hbox{.}\mkern2mu\raise7\p@\hbox{.}\mkern1mu}}
\makeatother

\renewcommand{\pmod}[1]{\;\mathopen{}\left[#1\mathclose{}\right]}
\renewcommand{\mod}[3]{#1\equiv #2 \;\mathopen{}\left[#3\mathclose{}\right]}
\newcommand{\restrict}{\mathclose{}|\mathopen{}}
\newcommand{\eval}[2]{\left.#1\mathclose{}\right|_{#2}}
\newcommand{\eqdef}{\overset{\text{d\'ef}}{=}}
\renewcommand{\=}{\mathop{=} \limits}
\newcommand{\lsim}{\mathop{\sim} \limits}
\newcommand{\lto}[1]{\xrightarrow[#1]{}}
\newcommand{\plusmoins}{\raisebox{-3pt}{${\overset{+}{-}}$}}
% \newcommand{\lto}[1]{\underset{#1}{\longrightarrow}}

% ==================================================
% Événements probabilités
% ==================================================
\newcommand*{\evt}[1]{(#1)}
\newcommand*{\bigevt}[1]{\bigl(#1\bigr)}
\newcommand*{\evtval}[1]{`#1'}
\newcommand*{\evttext}[1]{\hbox{\og{}#1\fg{}}}
\newcommand*{\PC}[2]{\P(#1 \!\mid\! #2)}
\newcommand*{\bigPC}[2]{\P\bigl(#1 \!\mid\! #2\bigr)}
\newcommand*{\BigPC}[2]{\P\Bigl(#1 \!\mid\! #2\Bigr)}


% ==================================================
% Outils de mise en forme
% ==================================================
\def\_#1{\mathcal{#1}}
\newcommand{\novskip}{\vspace{-\baselineskip}}
\newcommand{\baisse}[1]{\rule[-#1pt]{0pt}{#1pt}}


% ==================================================
% Articulation du discours
% ==================================================
%\newcommand{\sensdirect}{\par\smallbreak\mbox{$\implies)$}\xspace}
\newcommand{\sensdirect}{\par\smallbreak\mbox{$(\Rightarrow)$}\xspace}
%\newcommand{\sensindirect}{\par\smallbreak\mbox{$\impliedby)$}\xspace}
\newcommand{\sensindirect}{\par\smallbreak\mbox{$(\Leftarrow)$}\xspace}
\newcommand{\implication}[2]{\par\smallbreak\mbox{(\romannumeral#1)$\implies$(\romannumeral#2)}}
\newcommand\analyse{\mbox{\sl Analyse:}\xspace}
\newcommand\synthese{\mbox{\sl Synthèse:}\xspace}
\newcommand\existence{\mbox{\sl Existence:}\xspace}
\newcommand\unicite{\mbox{\sl Unicité:}\xspace}
%\newcommand\cas[1]{\mbox{{\sl Cas:}\xspace #1.}\xspace}
\newcommand\casgeneral{\mbox{\sl Cas général:}\xspace}
\newcommand{\Python}{\textbf{Python}}
% ==================================================
% Locutions latines
% ==================================================
\def\afortiori{\textsl{a fortiori}\xspace}
\def\Afortiori{\textsl{A fortiori}\xspace}
\def\aposteriori{\textsl{a posteriori}\xspace}
\def\Aposteriori{\textsl{A posteriori}\xspace}
\def\apriori{\textsl{a priori}\xspace}
\def\Apriori{\textsl{A priori}\xspace}
\def\adhoc{\textsl{ad~hoc}\xspace}
\def\mutatis{\textsl{mutatis mutandis}\xspace}
\def\Mutatis{\textsl{Mutatis mutandis}\xspace}
\def\ie{\textsl{i.e.}\xspace}
\def\cad{c'est-à-dire\xspace}
\def\eg{\textsl{e.g.}\xspace}
% ==================================================
% Bavardages dans les équations
% ==================================================
\def\et{\ \text{~et~} \ }
\def\ou{\ \text{~ou~}\ }
\def\quadet{\quad\text{et}\quad}
\def\quadou{\quad\text{ou}\quad}
\def\pour{\text{~pour~}}
\def\quadpour{\text{\quad pour\quad}}
\def\car{\text{~car~}}
\def\quadcar{\text{\quad car\quad}}
\def\avec{\text{~avec~}}
\def\quadavec{\text{\quad avec\quad}}
\def\donc{\text{~donc~}}
\def\quaddonc{\text{\quad donc\quad}}
\def\sur{\text{~sur~}}
\def\quadsur{\text{\quad sur~}}
\def\quadpuis{\text{\quad puis\quad}}
\def\si{\text{~si~}}
\def\sinon{\text{~sinon}}
\def\CVS{\text{CVS}}
\def\CVU{\text{CVU}}
\def\CV{\text{CV}}
\def\pt{\text{.}}
\def\qspace{,\quad}
\newcommand\nopt[1]{}
\def\mathog{\ensuremath{\text{\guillemotleft\,}}}
\def\mathfg{\ensuremath{\text{\,\guillemotright}}}


% ==================================================
% Parenthèses
% ==================================================
\makeatletter
\let\bBigg@@\bBigg@
\renewcommand{\bBigg@}[2]{{%
  \mathchoice
    {\bBigg@@{#1}{#2}}% Displaysize
    {\bBigg@@{#1}{#2}}% Textesize
    {\big@size=.7\big@size\bBigg@@{#1}{#2}}% Scriptsize
    {\big@size=.5\big@size\bBigg@@{#1}{#2}}}}% Subscriptsize
\def\biggg{\bBigg@{3}}
\def\bigggl{\mathopen{}\biggg}
\def\bigggr{\mathclose{}\biggg}
\def\Biggg{\bBigg@{3.5}}
\def\Bigggl{\mathopen{}\Biggg}
\def\Bigggr{\mathclose{}\Biggg}
\makeatother
% ==================================================
% Valeur absolue
% ==================================================
\newcommand{\abs}[1]{\left\lvert\ifempty{#1}{\dotpourvariable}{#1}\right\rvert}
\newcommand{\bigabs}[1]{\bigl\lvert#1\bigr\rvert}
\newcommand{\Bigabs}[1]{\Bigl\lvert#1\Bigr\rvert}
\newcommand{\biggabs}[1]{\biggl\lvert#1\biggr\rvert}
\newcommand{\Biggabs}[1]{\Biggl\lvert#1\Biggr\rvert}
% ==================================================
% Norme
% ==================================================
\newcommand{\norme}[1]{\left\lVert\ifempty{#1}{\dotpourvariable}{#1}\right\rVert}
\newcommand{\bignorme}[1]{\bigl\lVert#1\bigr\rVert}
\newcommand{\Bignorme}[1]{\Bigl\lVert#1\Bigr\rVert}
\newcommand{\biggnorme}[1]{\biggl\lVert#1\biggr\rVert}
\newcommand{\Biggnorme}[1]{\Biggl\lVert#1\Biggr\rVert}
% ==================================================
% Produit scalaire
% ==================================================
\newcommand{\ps}[2]{\mathopen(\ifempty{#1}{\dotpourvariable}{#1}\!\mid\!\ifempty{#2}{\dotpourvariable}{#2}\mathclose)}
\newcommand{\bigps}[2]{\bigl( #1 \!\mid\! #2 \bigr)}
\newcommand{\Bigps}[2]{\Bigl( #1 \!\mid\! #2 \Bigr)}
\newcommand{\biggps}[2]{\biggl( #1 \!\mid\! #2 \biggr)}
\newcommand{\Biggps}[2]{\Bigl( #1 \!\mid\! #2 \Biggr)}
% ==================================================
% Produit scalaire crochet
% ==================================================
\newcommand{\psc}[2]{\mathopen\langle \ifempty{#1}{\dotpourvariable}{#1},\ifempty{#2}{\dotpourvariable}{#2}\mathclose\rangle}
\newcommand{\bigpsc}[2]{\bigl\langle #1,#2 \bigr\rangle}
\newcommand{\Bigpsc}[2]{\Bigl\langle #1,#2 \Bigr\rangle}
\newcommand{\biggpsc}[2]{\biggl\langle #1,#2 \biggr\rangle}
\newcommand{\Biggpsc}[2]{\Biggl\langle #1,#2 \Biggr\rangle}
% ==================================================
% Norme triple
% ==================================================
\newcommand{\normetriple}[1]{\lvert\hspace{-0.1em}\lvert\hspace{-0.1em}\lvert\ifempty{#1}{\dotpourvariable}{#1}\rvert\hspace{-0.1em}\rvert\hspace{-0.1em}\rvert}
\newcommand{\bignormetriple}[1]{\bigl\lvert\hspace{-0.1em}\bigl\lvert\hspace{-0.1em}\bigl\lvert#1\bigr\rvert\hspace{-0.1em}\bigr\rvert\hspace{-0.1em}\bigr\rvert}
% ==================================================
% Ensemble
% ==================================================
\newcommand{\tq}{\space\mid\space}
\newcommand{\set}[1]{\def\tq{\:\lvert\:}\left\{#1\right\}}
\newcommand{\bigset}[1]{\def\tq{\:\big\lvert\:}\bigl\{#1\bigr\}}
\newcommand{\Bigset}[1]{\def\tq{\:\Big\lvert\:}\Bigl\{#1\Bigr\}}
\newcommand{\biggset}[1]{\def\tq{\:\Big\lvert\:}\biggl\{#1\biggr\}}
\newcommand{\Biggset}[1]{\def\tq{\:\Big\lvert\:}\Biggl\{#1\Biggr\}}
\newcommand{\hugeset}[1]{\def\tq{\:\Big\lvert\:}\left\{#1\right\}}
% ==================================================
% Partie entière
% ==================================================
\newcommand{\floor}[1]{\left\lfloor\ifempty{#1}{\dotpourvariable}{#1}\right\rfloor}
\newcommand{\bigfloor}[1]{\bigl\lfloor #1 \bigr\rfloor}
\newcommand{\Bigfloor}[1]{\Bigl\lfloor #1 \Bigr\rfloor}
\newcommand{\biggfloor}[1]{\biggl\lfloor #1 \biggr\rfloor}
\newcommand{\Biggfloor}[1]{\Biggl\lfloor #1 \Biggr\rfloor}
% ==================================================
% Partie supérieure
% ==================================================
\newcommand{\ceil}[1]{\left\lceil\ifempty{#1}{\dotpourvariable}{#1}\right\rceil}
% ==================================================
% Angle orienté
% ==================================================
\renewcommand{\angle}[2]{\bigl(#1;#2\bigr)}
% ==================================================
% Intervalles
% ==================================================
%\newcommand{\intervalle}[4]{\mathopen{#1}#2\mathpunct{};#3\mathclose{#4}}
\newcommand{\intff}[2]{\intervalle{[}{#1}{#2}{]}}
\newcommand{\intof}[2]{\intervalle{]}{#1}{#2}{]}}
\newcommand{\intfo}[2]{\intervalle{[}{#1}{#2}{[}}
\newcommand{\intoo}[2]{\intervalle{]}{#1}{#2}{[}}
\newcommand{\intn}[2]{\intervalle{\llbracket}{#1}{#2}{\rrbracket}}
\newcommand{\bigintervalle}[4]{\bigl{#1}#2\mathpunct{};#3\bigr{#4}}
\newcommand{\bigintff}[2]{\bigintervalle{[}{#1}{#2}{]}}
\newcommand{\bigintof}[2]{\bigintervalle{]}{#1}{#2}{]}}
\newcommand{\bigintfo}[2]{\bigintervalle{[}{#1}{#2}{[}}
\newcommand{\bigintoo}[2]{\bigintervalle{]}{#1}{#2}{[}}
\newcommand{\bigintn}[2]{\bigintervalle{\llbracket}{#1}{#2}{\rrbracket}}
\newcommand{\Bigintervalle}[4]{\Bigl{#1}#2\mathpunct{};#3\Bigr{#4}}
\newcommand{\Bigintff}[2]{\Bigintervalle{[}{#1}{#2}{]}}
\newcommand{\Bigintof}[2]{\Bigintervalle{]}{#1}{#2}{]}}
\newcommand{\Bigintfo}[2]{\Bigintervalle{[}{#1}{#2}{[}}
\newcommand{\Bigintoo}[2]{\Bigintervalle{]}{#1}{#2}{[}}
\newcommand{\Bigintn}[2]{\Bigintervalle{\llbracket}{#1}{#2}{\rrbracket}}
\newcommand{\biggintervalle}[4]{\biggl{#1}#2\mathpunct{};#3\biggr{#4}}
\newcommand{\biggintff}[2]{\biggintervalle{[}{#1}{#2}{]}}
\newcommand{\biggintof}[2]{\biggintervalle{]}{#1}{#2}{]}}
\newcommand{\biggintfo}[2]{\biggintervalle{[}{#1}{#2}{[}}
\newcommand{\biggintoo}[2]{\biggintervalle{]}{#1}{#2}{[}}
\newcommand{\biggintn}[2]{\biggintervalle{\llbracket}{#1}{#2}{\rrbracket}}
\newcommand{\Biggintervalle}[4]{\Biggl{#1}#2\mathpunct{};#3\Biggr{#4}}
\newcommand{\Biggintff}[2]{\Biggintervalle{[}{#1}{#2}{]}}
\newcommand{\Biggintof}[2]{\Biggintervalle{]}{#1}{#2}{]}}
\newcommand{\Biggintfo}[2]{\Biggintervalle{[}{#1}{#2}{[}}
\newcommand{\Biggintoo}[2]{\Biggintervalle{]}{#1}{#2}{[}}
\newcommand{\Biggintn}[2]{\Biggintervalle{\llbracket}{#1}{#2}{\rrbracket}}
% Variations
\newcommand{\var}[1]{\mathop{}\left[\rule{0pt}{12pt} #1 \mathclose{}\right]}




% ==================================================================
% Introduction d'un espace supplémentaire devant certains opérateurs
% ==================================================================
% \let\oldBiggl=\Biggl
% \def\Biggl#1#2{\oldBiggl#1%
% \ifthenelse{\equal{\unexpanded{#2}}{\unexpanded{\sum}}}{\,}{}%
% \ifthenelse{\equal{\unexpanded{#2}}{\unexpanded{\prod}}}{\,}{}%
% \ifthenelse{\equal{\unexpanded{#2}}{\unexpanded{\bigcup}}}{\,}{}%
% \ifthenelse{\equal{\unexpanded{#2}}{\unexpanded{\bigcap}}}{\,}{}%
% #2}

% ==================================================
% Opérateurs remarquables
% ==================================================
%\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\rg}{rg}
\DeclareMathOperator{\Sp}{Sp}
\DeclareMathOperator{\Aut}{Aut}
\DeclareMathOperator{\GL}{GL}
\DeclareMathOperator{\GO}{\O}
\DeclareMathOperator{\SL}{SL}
\DeclareMathOperator{\SO}{SO}
\DeclareMathOperator{\GM}{\mathcal{M}_{n}}
\DeclareMathOperator{\codim}{codim}
\DeclareMathOperator{\Ent}{Ent}
\DeclareMathOperator{\Aire}{Aire}
\DeclareMathOperator{\Vect}{Vect}
\DeclareMathOperator{\Mat}{Mat}
\DeclareMathOperator{\diag}{diag}
\DeclareMathOperator{\Rot}{Rot}
\DeclareMathOperator{\grad}{\nabla\!}
\DeclareMathOperator{\gradd}{grad}
\DeclareMathOperator{\Fr}{Fr}
\DeclareMathOperator{\Adh}{Adh}
\DeclareMathOperator{\Com}{Com}
\DeclareMathOperator{\com}{Com}
\DeclareMathOperator{\Card}{Card}
\DeclareMathOperator{\cor}{cor}
\DeclareMathOperator{\Cov}{Cov}
\DeclareMathOperator{\ch}{ch}
\DeclareMathOperator{\sh}{sh}
\DeclareMathOperator{\sgn}{signe}
\DeclareMathOperator{\sym}{sym}
\DeclareMathOperator{\argsh}{argsh}
\DeclareMathOperator{\argch}{argch}
\DeclareMathOperator{\argth}{argth}
\DeclareMathOperator{\cotan}{cotan}
\DeclareMathOperator{\sinc}{sinc}
\DeclareMathOperator{\PGCD}{PGCD}
\DeclareMathOperator{\PPCM}{PPCM}
%\DeclareMathOperator{\pgcd}{pgcd}
\DeclareMathOperator{\ppcm}{ppcm}
\DeclareMathOperator{\Jac}{Jac}
\DeclareMathOperator{\non}{non}
\DeclareMathOperator{\Det}{Det}
\DeclareMathOperator{\Cl}{Cl}
\DeclareMathOperator{\ord}{ordre}
%\DeclareMathOperator{\gr}{gr}
\newcommand{\gr}[1]{\mathopen\langle \ifempty{#1}{\dotpourvariable}{#1}\mathclose\rangle}
\DeclareMathOperator{\card}{card}
\renewcommand\Re{\operatorname{Re}}
\renewcommand\th{\operatorname{th}}
\renewcommand\Im{\operatorname{Im}}
\renewcommand\det{\operatorname{det}}
\renewcommand\ker{\operatorname{Ker}}

% ==================================================
% Macros "complexes"
% ==================================================
% Calcul la différence d'espace entre deux boîtes
\newlength{\mydeltalength}
\newcommand{\deltaspace}[2]{%
  \setbox1=\hbox{#1}\setbox2=\hbox{#2}%
  \setlength{\mydeltalength}{\wd1}\addtolength{\mydeltalength}{-\wd2}%
  \hspace{\mydeltalength}}


% ==================================================
% Environnements
% ==================================================
\newenvironment{enumi}{\begin{enumerate}[label=(\roman*)\space]}{\end{enumerate}}
\newenvironment{enum1}{\begin{enumerate}[label=\arabic*)\space]}{\end{enumerate}}
\newenvironment{enuma}{\begin{enumerate}[label=\alph*)\space]}{\end{enumerate}}
\newenvironment{application}{\left\{ \begin{array}{@{\,}r@{\;}c@{\;}l@{\,}}}{\end{array}\right.}
%\newenvironment{systeme}[1][]
%{\left\lbrace
%  \ifempty{#1}{\begin{array}{@{}r*{20}{@{}>{\strut}l<{\strut}}}}{\begin{array}{#1}}}
%                                                                   {\end{array}\right.}


%%%%%%%%%%%%%%%%%%%%%%%%ù
% pour hyperref
%%%%%%%%%%%%%%%%%%%%%%%
%
% le premier arg décide si on met les liens ou pas le deuxime si lien indication ou pas le troisieme
% si correction ou pas.

% si \flagpasdindication=1 alors il n'y a pas d'espace réservé pour le mot indication, ie
% \phantom{indications} n'est pas écrit dans la boite
\def\flagpasdindication{0}
\newcommand{\refenonce}[3]{
  \hypertarget{ancreenonce\theexoptp}{}
\ifthenelse{\equal{#1}{1}}
{\ifthenelse{\equal{#2}{1}}{\hyperlink{ancreindication\theexoptp}{indications}}{\ifthenelse{\equal{\flagpasdindication}{1}}{}{\phantom{indications}}}
\ifthenelse{\equal{#3}{1}}{\hyperlink{ancrecorrection\theexoptp}{correction}}{\phantom{correction}}
}
{}
}

%sauvegarde
%\def\flagpasdindication{0}
%\newcommand{\refenonce}[3]{\ifthenelse{\equal{#1}{1}}
%{\ifthenelse{\equal{#2}{1}}{\hyperlink{ancreindication\theexoptp}{indications}}{\ifthenelse{\equal{\flagpasdindication}{1}}{}{\phantom{indications}}}
%\ifthenelse{\equal{#3}{1}}{\hyperlink{ancrecorrection\theexoptp}{correction}}{\phantom{correction}}
%}
%{}
%\hypertarget{ancreenonce\theexoptp}
%}

%\newcommand{\refenonce}{\hyperlink{ancreindication\theexoptp}{indications}\hyperlink{ancrecorrection\theexoptp}{correction}\hypertarget{ancreindication\theexoptp}{}
%}
\newcommand{\refindication}[3]{\ifthenelse{\equal{#1}{1}}
{\ifthenelse{\equal{#2}{1}}{\hyperlink{ancreenonce\theexoptp}{énoncé}}{\phantom{enonce}}
\ifthenelse{\equal{#3}{1}}{\hyperlink{ancrecorrection\theexoptp}{correction}}{\phantom{correction}}
}
{}
\hypertarget{ancreindication\theexoptp}}

% le premier arg décide si on met les liens ou pas le deuxime si lien enonce ou pas le troisieme
% si indication ou pas.
% pb avecrefcorrecgtion voir pb dans les lignes 
% d'ici %%%%%%%%%%%%%%
\newcommand{\refcorrection}[3]{
\hypertarget{ancrecorrection\theexoptp}{}
\ifthenelse{\equal{#1}{1}}
{\ifthenelse{\equal{#2}{1}}{\hyperlink{ancreenonce\theexoptp}{énoncé}}{\phantom{enonce}}
\ifthenelse{\equal{#3}{1}}{\hyperlink{ancreindication\theexoptp}{indications}}{
 \ifthenelse{\equal{\flagpasdindication}{1}}{}{\phantom{indications}}}}
{}
}
% a la %%%%%%%%%%%%%%%%%%%%%%%


\newcommand{\augcom}{\addtocounter{exoptp}{1}}
%\newcommand{\refindication}{\hyperlink{ancreenonce\theexoptp}{enoncé}\hyperlink{ancrecorrection\theexoptp}{correction}\hypertarget{ancreindication\theexoptp}{}
%}
%\newcommand{\refcorrection}{\hyperlink{ancreenonce\theexoptp}{enoncé}\hypertarget{ancrecorrection\theexoptp}{}
%}
%

%%%% package graphique ici pour eviter les clash
\usepackage{fp}
\usepackage{tkz-fct}
\usepackage{tkz-euclide}
%\usetkzobj{all}
\usepackage[tikz]{bclogo}
\usetikzlibrary{arrows,shadows,decorations.pathmorphing,patterns}
\usepackage{arydshln}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macro pour les math
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%\makeatletter
%\DeclareRobustCommand\sfrac[1]{\@ifnextchar/{\@sfrac{#1}}%
%                                            {\@sfrac{#1}/}}
%\def\@sfrac#1/#2{\leavevmode\kern.1em\raise.5ex
%         \hbox{$\m@th\mbox{\fontsize\sf@size\z@
%                           \selectfont#1}$}\kern-.1em
%         /\kern-.15em\lower.25ex
%          \hbox{$\m@th\mbox{\fontsize\sf@size\z@
%                            \selectfont#2}$}}
%\makeatother
%


\renewcommand{\i}{\text{i}}
\newcommand{\GC}{\ensuremath{\mathbbm{C}}}
\newcommand{\tzC}[1][z]{\forall #1 \in \GC \quad}
\newcommand{\tzc}[2][z]{\forall #1 \in \GC #2 \quad}

\newcommand{\GR}{\ensuremath{\mathbbm{R}}}
\newcommand{\txR}[1][x]{\forall #1 \in \GR \quad}
\newcommand{\txr}[2][x]{\forall #1 \in \GR #2 \quad}

\newcommand{\GQ}{\mathbbm{Q}}
\newcommand{\txQ}[1][x]{\forall #1 \in \GQ \quad}
\newcommand{\txq}[2][x]{\forall #1 \in \GQ #2 \quad}

\newcommand{\GD}{\mathbbm{D}}
\newcommand{\txD}[1][x]{\forall #1 \in \GD \quad}
\newcommand{\txd}[2][x]{\forall #1 \in \GD #2 \quad}

\newcommand{\GZ}{\mathbbm{Z}}
\newcommand{\tkZ}[1][k]{\forall #1 \in \GZ \quad}
\newcommand{\tkz}[2][k]{\forall #1 \in \GZ #2 \quad}

\newcommand{\GN}{\mathbbm{N}}
\newcommand{\tnN}[1][n]{\forall #1 \in \GN \quad}
\newcommand{\tnn}[2][n]{\forall #1 \in \GN #2 \quad}

\newcommand{\GF}{\ensuremath{\mathbbm{F}}}

% ensemble polynome
%\newcommand{\RX}{\GR \mathopen{[} X \mathclose{]}}
\newcommand{\RX}{\GR [ X ]}

\newcommand{\GK}{\mathbbm{K}}

% point virgule séparteur
\newcommand{\pv}{\ensuremath{\: ; \,}}
% point virgule pour ponctuation
\newcommand{\pvv}{\mathpunct{};}

% Limite 
\newcommand{\Lim}[2][x]{\ensuremath{\displaystyle{\lim_{#1 \rightarrow #2}}}}
% %%% Fausse limite
\newcommand{\Tendvers}[2][h]{\underset{#1\rightarrow #2}{\longrightarrow}}

\newcommand{\ensdef}[1][f]{\ensuremath{\mathscr{D}_{\! #1}}\xspace}
%%%%%%%%%macro tracer de droites %%%%%%%%%%ù
\newcommand{\droite}[4]{\psplot[plotpoints=2]{#1}{#2}{x #3 mul #4 add}}
%%%%%%%%% inegalite: symbole plus classe %%%%%
\renewcommand{\leq}{\leqslant}
\renewcommand{\geq}{\geqslant}
%%%%%%% implcation equivalence %%%%%%%%%%%%%%
\newcommand{\impli}{\ensuremath{\quad \Rightarrow \quad}}
\newcommand{\ssif}{\ensuremath{\quad \Longleftrightarrow \quad}}
\newcommand{\ssifl}{\ensuremath{\quad \text{\underline{\textit{\textbf{ssi}}}} \quad}}
\newcommand{\ssifll}{ si, et seulement si, }
%macro pour prix ds mbox avec euro
%\newcommand{\prix}[1]{\mbox{\ensuremath{\nombre{#1}} \textgreek{\euro}}}
\newcommand{\prix}[1]{\mbox{\ensuremath{\nombre{#1}} \euro }}
% Parties reelle et imaginaire

%\DeclareMathOperator{\arg}{arg}
\DeclareMathOperator{\re}{Re}
\DeclareMathOperator{\im}{Im}
\DeclareMathOperator{\tr}{tr}
%\DeclareMathOperator{\ker}{ker}
%\renewcommand{\Re}{\text{Re}}
%\renewcommand{\Im}{\text{Im}}
\newcommand{\ii}{\text{i}}

%exponentielle
%\newcommand{\expf}[1]{\ensuremath{\, \text{e}^{#1}}}
\newcommand{\expf}[1]{\, \text{e}^{#1}}
\newcommand{\lnf}[1]{\, \text{ln}({#1})}
% i 


\newcommand{\vecteur}[1]{\mathchoice% 
{\overrightarrow{\displaystyle\mathstrut#1\,\,}}% 
{\overrightarrow{\textstyle\mathstrut#1\,\,}}% 
{\overrightarrow{\scriptstyle\mathstrut#1\,\,}}% 
{\overrightarrow{\scriptscriptstyle\mathstrut#1\,\,}}}

\newcommand{\vect}[1]{\mathchoice%
{\overrightarrow{\displaystyle\mathstrut#1\,\,}}%
{\overrightarrow{\textstyle\mathstrut#1\,\,}}%
{\overrightarrow{\scriptstyle\mathstrut#1\,\,}}%
{\overrightarrow{\scriptscriptstyle\mathstrut#1\,\,}}}

\newcommand{\evenement}[1]{#1}
\newcommand{\coo}[2]{\left( #1 \pv #2 \right)}
\newcommand{\cooe}[3]{\left( #1 \pv #2 \pv #3 \right)}
\newcommand{\bary}[1]{\text{bar}\left\{ #1 \right\}}

% %%% Commande pour décaler les parenthéses vers le bas autour
% %%% des vecteurs par exemple :
\newcommand{\DecalV}[2][2pt]{%
	\raisebox{#1}{%
		$\left(\raisebox{-#1}{\ensuremath{#2}}\right)$}}



% %%% AXES OI, OJ, OK
\newcommand{\oi}{\DecalV[.8pt]{O;\vec{\imath}\,}}
\newcommand{\oj}{\DecalV[.8pt]{O;\vec{\jmath}\,}}
\newcommand{\ok}{\DecalV[.8pt]{O;\vec{k}\,}}
\newcommand{\oou}{\DecalV[.8pt]{O;\vec{u}}}
\newcommand{\ov}{\DecalV[.8pt]{O;\vec{v}}}

% %%% REPERE OIJ
\newcommand{\oij}{\DecalV[.8pt]{O\, ; \vec{\imath},\vec{\jmath}\,}}
\newcommand{\oik}{\DecalV[.8pt]{O;\vec{\imath},\vec{k}\,}}
\newcommand{\ojk}{\DecalV[.8pt]{O;\vec{\jmath},\vec{k}\,}}

% %%% REPERE OUV
\newcommand{\ouv}{\DecalV[.8pt]{O;\vec{u},\vec{v}}}

% %%% REPERE OIJK
\newcommand{\oijk}{\DecalV[.8pt]{O;\vec{\imath},\vec{\jmath},\vec{k}\,}}


% %%% Coordonnées verticales dans le plan
\newcommand{\coordp}[2]{%
	\begin{pmatrix}
	#1 \\ #2
	\end{pmatrix}}

% %%% Coordonnées verticales dans l'espace
\newcommand{\coordpp}[3]{%
	%\scalebox{.7}{%
		\begin{pmatrix}
		#1 \\ #2 \\ #3
		\end{pmatrix}}
		%}

% couple et triplet
\newcommand{\couple}[2]{\left( #1 \mathpunct{}, #2\right)}
\newcommand{\triplet}[3]{\left( #1 \mathpunct{}, #2\mathpunct{}, #3\right)}
% produit scalaire
\newcommand{\prds}[2]{\left( #1 \mid #2\right)}
% transposée
%\newcommand{\transp}[1]{{}^t\!#1}

% %%% Intégrales
%\newcommand{\Int}[2]{\displaystyle{\int\limits_{#1}^{#2}}}
\newcommand{\Int}[2]{\displaystyle{\int_{#1}^{#2}}}
%\newcommand{\dd}{\medspace\mathrm{d}}
\newcommand{\dd}{\mathop{}\mathopen{}\mathrm{d}}


% %%% Equivalent en 
\newcommand{\Equiv}[1]{\underset{#1}{\sim}}

% %%% Modulo 2pi ou autre
\newcommand{\Mod}[1][2\pi]{\enspace_{(#1)}}

% %%% Congruence
\newcommand{\congru}[3]{#1\equiv #2\thickspace (#3)}
\newcommand{\ncongru}[3]{#1\not\equiv #2\thickspace (#3)}


% %%% Cardinal
%\newcommand{\Card}{\text{Card}}


% %%% Angle de vecteur
\newcommand{\anglevec}[2]{%
	\DecalV{%
	\widehat{%
	\vecteur{#1};\vecteur{#2}
	}}}


% %%% cfrac avec un petit espace en plus
\renewcommand{\cfrac}[2]{%
	\displaystyle{\frac{#1}{#2}}}
    
    
% %%% Fraction en exposant
\newcommand{\expfrac}[2]{%
	\raisebox{.3ex}{\scriptsize{$#1$}}\negmedspace\slash
	\negthinspace\raisebox{-.2ex}{\scriptsize{$#2$}}}
	
% %%% Fraction en oblique
\newcommand{\obfrac}[2]{%
\mathsurround=0em%
	\raisebox{.3ex}{$#1$}\negthinspace\slash%
	\raisebox{-.2ex}{$#2$}%
\mathsurround=0.15em%
}
\newcommand{\obsfrac}[2]{%
\mathsurround=0em%
\scriptsize
	\raisebox{.3ex}{$#1$}\negthinspace\slash%
	\negthinspace\raisebox{-.2ex}{$#2$}%
\mathsurround=0.15em%
}


% %%% Intégration par parties
\newcommand{\intpp}[4]{%
	$\left\{%
	\begin{matrix}
	#1 & #3 \\
	\stackrel{}{#2} & \stackrel{}{#4} \\
	\end{matrix}
	\right.$}

% %%% Somme majuscule
\newcommand{\Sum}{\displaystyle{\sum}}


%%%% Autorisation des documents et calculettes
\newcommand{\calculette}[1][est interdite]{%
	{\large
	%La qualité de la rédaction, la clarté et la précision des
	%raisonnements entreront pour une part
	%importante dans l'appréciation des copies.

	L'utilisation des calculatrices #1.

	\vspace{1em}

	}}


%%%% Macro qui donne le pgcd
	\newcommand{\pgcd}[2]{\mathrm{PGCD}\couple{#1}{#2}}
	\newcommand{\pgcdm}[2]{#1\wedge #2}


\newcommand{\ssi}[1][,]{si, et seulement si#1 }

%%%% Tournez la page sauf sur la dernière page
%%%% Utilise le packahe fancyhdr

%\newcommand{\TournezPage}{%
%	\rfoot{\ifthenelse%
%		{\equal{\thepage}{\pageref{LastPage}}}%
%		{}%
%		{\large
%		%\small
%		\bf Tournez la page, SVP}}}
\newcommand{\TournezPage}[1]{%
	\rfoot{\ifthenelse%
		{\equal{\thepage}{#1}}%
		{\large
		%\small
		\textbf{\textit{Tournez la page, SVP}}}
		{}
		}}


%%%% Pour faire des systemes
\newenvironment{systeme}[1]{%
	\setlength{\arraycolsep}{1.2pt}
	\left\{\begin{array}{*{#1}{rcl}}}
	{\end{array}\right.}


\newcommand{\Annee}{ 2014 -- 2015 }

% %%% Notation scientifique.
\newcommand{\Sc}[2]{%
	\ensuremath{%
	#1\cdot 10^{#2}}}

% %%% Dgré d'un polynome
\newcommand{\Degpol}[1]{%
	\ensuremath{\text{d}\degres #1}}

% %%% Mes d'un angle
\newcommand{\Mes}[1]{%
	\ensuremath{%
	\mathrm{mes}
	\DecalV{\widehat{#1}}
	}}

% %%% 
\newlength{\Hauteur}
\newcommand{\Hautf}[1]{%
	\setlength{\Hauteur}{#1\baselineskip}
	\setlength{\Hauteur}{.5\Hauteur}
	\rule{0pt}{\Hauteur}}

% %%% Utilisation de la police caligraphique.
\newcommand{\Calig}[1]{\ensuremath{\mathscr{#1}}}
\newcommand{\Ccc}{\Calig{C}\xspace}
\newcommand{\Courbe}[1][f]{\ensuremath{\Calig{C}_{\! #1}}\xspace}





% %%% Des intervalles
\newcommand{\intervalle}[4]{\mathopen{#1}#2\mathclose{}\mathpunct{};#3\mathclose{#4}}

%%%%
% intervalle avec des crochets plus marqués
%Voici une autre version des commandes (comme dans [tex.stackexchange.com]). C'est peut-être mieux car on utilise les fontsizes du mode math au lieu de (\normalsize,\scriptsize,\tiny). En dehors du mode math, on peut toujours appeler par exemple \CrochetG[\scriptsize], voire {\scriptsize\CrochetG} (il vaut d'ailleurs mieux enlever l'option \normalsize par défaut).
\newcommand{\CrochetGSize}[1][] {%
\begin{tikzpicture}[baseline]%
  {#1 \draw[rounded corners=0pt]  (0.46ex,1.84ex)--(0ex,1.84ex)--(0ex,-0.46ex)--(0.46ex,-0.46ex);%
%\draw  (0.07,0.28)--(0,0.28)--(0,-0.07)--(0.07,-0.07);%
}%
\end{tikzpicture}}

\newcommand{\CrochetDSize}[1][] {%
\begin{tikzpicture}[baseline]%
{#1 \draw[rounded corners=0pt]  (-0.46ex,1.84ex)--(0ex,1.84ex)--(0ex,-0.46ex)--(-0.46ex,-0.46ex) (0.197ex,0ex);%
%\draw  (-0.07,0.28)--(0,0.28)--(0,-0.07)--(-0.07,-0.07) (0.03,0);%
}%
\end{tikzpicture}}

\makeatletter
\newcommand\MathSize[1]{\mathchoice
  {\hbox{\fontsize{\tf@size}{\tf@size}\selectfont#1}}
  {\hbox{\fontsize{\tf@size}{\tf@size}\selectfont#1}}
  {\hbox{\fontsize{\sf@size}{\sf@size}\selectfont#1}}
  {\hbox{\fontsize{\ssf@size}{\ssf@size}\selectfont#1}}
}

\newcommand{\CrochetG}[1][]{\ifmmode\MathSize{\CrochetGSize}\else\CrochetGSize[#1]\fi}
\newcommand{\CrochetD}[1][]{\ifmmode\MathSize{\CrochetDSize}\else\CrochetDSize[#1]\fi}  


\newcommand{\Intff}[2]{\ensuremath{\left[#1\pv #2\right]}}
\newcommand{\Intfo}[2]{\ensuremath{\left[#1\pv #2\right[}}
\newcommand{\Intof}[2]{\ensuremath{\left]#1\pv #2\right]}}
\newcommand{\Intoo}[2]{\ensuremath{\left]#1\pv #2\right[}}

% intervalle d'entier 
  \newcommand{\Intffn}[2]{\intervalle{\llbracket}{#1}{#2}{\rrbracket}}
  \newcommand{\Intfon}[2]{\intervalle{\llbracket}{#1}{#2}{\llbracket}}


% valeur absolue norme
 % \newcommand{\abs}[1]{\left\lvert#1\right\rvert}
 % \newcommand{\norme}[1]{\left\lVert#1\right\rVert}

% partie entiere
  \newcommand{\partent}[1]{\left\lfloor#1\right\rfloor}

% max  
  \newcommand{\maxf}[2]{\max\left( #1 \mathpunct{}, #2\right)}

  \newcommand{\ico}{\text{i}}
%\DeclareMathOperator{\deg}{deg}
%\DeclareMathOperator{\max}{max}
%\DeclareMathOperator{\min}{min}

%

%%%%%%%%%%% fonctions mathématiques pour Pstricks %%%%%%%%%%%%%%%
%
\newcommand{\ppi}{ 3.1416 }
\newcommand{\pe}{ 2.718 }
\newcommand{\prd}{ 180 \ppi div mul }                 %% transforme des rd en degres
\newcommand{\pdeg}{ \ppi mul 180 div }                %% transforme des degres en rd
\newcommand{\pExp}{ \pe exch exp }                    %% exponentielle
\newcommand{\pCos}{ \prd cos }                        %% cosinus (argument en radian)
\newcommand{\pSin}{ \prd sin }                        %% sinus (argument en radian)
\newcommand{\ptan}{ dup sin exch cos div }            %% tangente (argument en degré)
\newcommand{\pcotan}{ dup cos exch sin div }          %% cotangente (argument en degré)
\newcommand{\pTan}{ dup \pSin exch \pCos div }        %% tangente (argument en radian)
\newcommand{\pcoTan}{ dup \pCos exch \pSin div }      %% cotangente (argument en radian)
\newcommand{\parctan}{ dup 0 ge {1 atan} {neg 1 atan neg} ifelse }
                                                      %% arctan résultat en degré
\newcommand{\pArctan}{ \parctan \pdeg }               %% arctan résultat en radian
\newcommand{\parccos}{ dup dup mul neg 1 add sqrt exch atan } %% arccos -> degré
\newcommand{\pArccos}{ \parccos \pdeg }               %% arccos -> radian
\newcommand{\parcsin}{ dup dup mul neg 1 add sqrt atan dup 90 lt {} {360 sub} ifelse }
                                                      %% arcsin -> degré
\newcommand{\pArcsin}{ \parcsin \pdeg }               %% arcsin -> radian
\newcommand{\pcosh}{ dup \pExp exch neg \pExp add 2 div }     %% cosinus hyperbolique
\newcommand{\psinh}{ dup \pExp exch neg \pExp sub 2 div }     %% sinus hyperbolique
\newcommand{\ptanh}{ dup \psinh exch \pcosh div }     %% tangente hyperbolique
\newcommand{\pcotanh}{ dup \pcosh exch \psinh div }   %% cotangente hyperbolique
\newcommand{\pfactorielle}{ dup 0 eq {pop 1} {dup 1 sub \pfactorielle mul} ifelse }
                                                      %% factorielle

\newcommand{\parctanh}{ dup 1 add exch neg 1 add  div sqrt ln }
                                                      %% tangente hyperbolique inverse
\newcommand{\parcsinh}{ dup 2 exp 1 add sqrt add ln } %% sinus hyperbolique inverse
\newcommand{\parccosh}{ dup 2 exp 1 sub sqrt add ln } %% cosinus hyperbolique inverse



%%%% Style des grilles
\newpsstyle{grille}{gridlabels=0,subgriddiv=0,gridwidth=0.5pt,griddots=10}

\newcommand{\MaGrille}[5][10]{%
	\psgrid[gridlabels=0,%
	        subgriddiv=0,%
			gridwidth=0.5pt,%
			griddots=#1](0,0)(#2,#3)(#4,#5)}

\newcommand{\MesAxes}[5][.6pt]{%
	\psaxes[ showorigin=false,linewidth=#1]{->}(0,0)(#2,#3)(#4,#5)
	\pnode(#4,0){XX}\pnode(0,#5){YY}}

\newcommand{\MesAxesEtiquettes}[2]{%
	\SpecialCoor
	\uput{.2cm}[270](XX){#1}
	\uput{.2cm}[180](YY){#2}}

\newcommand{\MonRepereij}{%
	\psline[arrowsize=3pt 3,linewidth=1.2pt]{<->}(1,0)(0,0)(0,1)
	\uput{.2cm}[270](0.5,0){$\vec{\imath}$}
	\uput{.25cm}[180](0,0.5){$\vec{\jmath}$}}

\newcommand{\MonRepereuv}{%
	\psline[arrowsize=3pt 3,linewidth=1.2pt]{<->}(1,0)(0,0)(0,1)
	\uput{.2cm}[270](0.5,0){$\vec{u}$}
	\uput{.25cm}[180](0,0.5){$\vec{v}$}}

%%%% Mes pointillés
\newpsstyle{pointilles}{linewidth=0.015,linestyle=dashed,%
		dash=0.015 0.085,arrows=cc-cc}
%% Pointillés pour une réponses
\newcommand{\points}[1][5cm]{\makebox[#1][l]{\dotfill}}

%%%% hachures plus fines dans les 2 sens
\newpsstyle{hachured}{fillstyle=hlines,hatchwidth=0.2pt,hatchsep=2pt}
\newpsstyle{hachureg}{fillstyle=vlines,hatchwidth=0.2pt,hatchsep=2pt}

%%%% Des gris
\newgray{grisclair}{.75}
\newgray{grisfonce}{.25}
%

%%%%%%%%%%%%%%%%%
% Macro pour pstricks
%%%%%%%%%%%%%%%%
%\placenb: on rentre l'abscisse et le nombre
\newcommand{\placenb}[2]{\rput[B]{0}( #1 ,0){ #2 }}
%place trait vertical
\newcommand{\placetr}[2]{\rput[B]{0}(#1,0){\psline[linewidth=0.5pt](0,-0.18)(0,0.45)} \rput[B]{0}( #1 ,0){ #2 } }
\newcommand{\tracevec}[8]{
	\ADD{#2}{#5}{\lex}
	\ADD{#3}{#6}{\ley}
  \pnode(#2,#3){#1}
  \pnode(\lex,\ley){#4}
  \psline[arrowsize=3pt 3, arrowlength=1.4, arrowinset= 0.35]{->}(#1)(#4)
	\MULTIPLY{0.5}{#5}{\tempmul}
   \ADD{#2}{\tempmul}{\fredlabelx}
	\MULTIPLY{0.5}{#6}{\tempmul}
  \ADD{#3}{\tempmul}{\fredlabely}
	\pnode(\fredlabelx,\fredlabely){#1#4}
	%\psset{labelsep=4pt}
	\uput[#7](#1#4){#8}}




%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macro mise en page
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%

\newlength{\temppp}

\setlength{\parindent}{0pt}
% definition de longueur qui sont utilisées pour placer deux minipages
\newlength{\largeurpremier}
\newlength{\espaceentre}
\newlength{\tempp}
\newlength{\largeursecond}

\setlength{\fboxsep}{2mm}
%couleur de l'entete
\makeatletter
\def\headrule{{\color{Apricot!70!Black}\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
\hrule\@height\headrulewidth\@width\headwidth
\vskip-\headrulewidth}}
\makeatother

%\setlength{\parindent}{0cm}

%parametres pour multicol
\setlength{\columnsep}{9mm}
\setlength{\columnseprule}{.5pt}

% config des sections
\renewcommand{\thesection}{\Roman{section}}	
\renewcommand{\thesubsection}{\arabic{subsection}.}	


%\titleformat{\subsubsection}
%   {\normalfont\fontsize{12pt}{13pt}\selectfont\bfseries}% apparence commune au titre et au numéro
%   {\alph{subsubsection}}% apparence du numéro
%   {1em}% espacement numéro/texte
%   {}% apparence du titre
\usepackage{titlesec} % pour la mise en forme des sections
\usepackage{sectsty} % pour la mise en forme des sections (les deux sont necessaire apparamment
\renewcommand{\thesubsubsection}{(\alph{subsubsection})}	
%\titleformat{\subsubsection}{\Large\bfseries}

%\titleformat % design des titres des sous-sous-sections
%{\subsubsection}
%[block]
%{\itshape\normalsize\bfseries}
%{\normalfont\bfseries \thesubsubsection~)}
%{\baselineskip}
%{}
%[\vspace{0\baselineskip}]
\subsubsectionfont{\normalsize }

\newcommand{\sectbox}[1]{%
\setlength{\parindent}{0cm}
  \noindent%\protect
  %\addtocounter{compteursection}{1}
%\Roman{compteursection}
  \begin{tikzpicture}
  \node [draw=Apricot!70!Black, fill=white!20,rounded corners, very thick]
  (box){\begin{minipage}{.98\textwidth}#1\end{minipage}};
\end{tikzpicture}}

%\newcommand{\sectbox}[1]{#1}
%\sectionfont{\color{blue}\itshape\selectfont}
\sectionfont{\sectbox}

%pour background
\newcommand\BackgroundPic{
\put(0,0){
\parbox[b][\paperheight]{\paperwidth}{%
\quad \quad \quad     %\vfill
%\centering
\includegraphics[width=\paperwidth,height=\paperheight,
keepaspectratio]{oo.ps}%
%\vfill
}}}

%titre des sections des exos =========================

%    couleur pour exercice 
\colorlet{exercicegrandcadrecolback}{gray!50!black}
\colorlet{exercicegrandcadrecolframe}{gray!50!black}

\newcommand{\sectionexo}[1]{
\begin{tcolorbox}[colback=exercicegrandcadrecolback, colframe=exercicegrandcadrecolframe,
coltext=white, arc=0mm, top=1mm, bottom=1mm]
  \begin{center}
    {\usefont{T1}{cmss}{bx}{n} \large #1}
  \end{center}
\end{tcolorbox}
\bigskip
}
%
\def\flagexo{0}
\newcommand{\nomexo}[1]{\ifthenelse{\equal{\flagexo}{1}}{Nom : \textbf{\textit{\textcolor{red}{#1}}}\\}{}}

%Pour les tableaux
\colorlet{tableaufilet}{Apricot!100}
\colorlet{tableaucolback}{Apricot!20}
\colorlet{tableaucolframe}{Apricot!100}
\colorlet{tableaucolbacktitle}{Apricot!100}
\colorlet{tableaucoltitle}{black}
\newlength\epaisLigne 
\newcolumntype{W}{>{\centering\arraybackslash}X}
\newcolumntype{I}{!{\color{tableaufilet}\vrule width 2pt}}
%  Place verticale dans un tableau
\newcommand{\vtab}{\rule[-0.9em]{0pt}{2.1em}}
%  Place verticale dans un tableau
\newcommand{\vtabplus}{\rule[-1.2em]{0pt}{3em}}

% %%% Double Place verticale dans un tableau
\newcommand{\vtabb}{\rule[-1.6em]{0pt}{4em}}
% %%% Place verticale dans un systeme
\newcommand{\systab}{\rule[-1.05em]{0pt}{1.05em}}



% Diverses macro de tarassconf pour pouvoir compiler les exos

%% Inclusion d'un dessin à partir d'un fichier eps externe
\newcommand{\dessin}[4][ Exercice \theex]%
{\centering %\begin{center}
%\graphicspath{{#2}}
\includegraphics{#2#3}
\figtitre[#1]{#4}
%\end{center}
}

%% Référence à un tableau à une figure
\newcommand{\reference}[1]{\textit{(figure~\ref{#1}, page~\pageref{#1})}}

%% Référence à un tableau à un tableau
\newcommand{\referencetab}[1]{\textit{(tableau~\ref{#1}, page~\pageref{#1})}}
%% titre d'une figure
\newcommand{\figtitre}[2][Exercice \theex]
{\caption{\textsc{#1}\label{#2}}}

\newcommand{\figtitremanuel}[3][Exercice ]
{\caption{\textsc{#1}\label{#2} #3}}


%%%% Macros pour un Vrai-Faux

\newcommand{\VF}{%
	\hfill\makebox[1cm][s]{\bf V\hfill F}
	}
\newcommand{\Rep}{%
	\hfill\makebox[1cm][s]{\ding{114}\hfill  \ding{114}}
  }
% %%% Enumerate de second niveau sur deux colonnes.
\newenvironment{Sliste}[1][\alph*)]%
	{\setlength{\multicolsep}{8pt}
	 \begin{multicols}{2}
	 \begin{enumerate}[label=#1]}%
	{\end{enumerate}
	 \end{multicols}}
%\renewcommand{\labelenumii}{\theenumii)}

\newenvironment{listetr}%
	{\begin{list}{$\blacktriangleright$}{}}%
	{\end{list}}

\newenvironment{listerd}%
	{\begin{list}{$\bullet$}{}}%
	{\end{list}}

\newenvironment{listecr}%
	{\begin{list}{$\blacksquare$}{}}%
	{\end{list}}

\newenvironment{qcm}%
{\begin{list}{\ding{114}}{\setlength{\leftmargin}{1cm}}}%
	{\end{list}}

%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macro mise en page math
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%

%Pour diminuer l'espace avant et apres les formules de math
%normalsize est redefinie car elle remet les valeurs par default
% je crois que si j'utilise \small ou autre cela va être le cas.
\setlength\abovedisplayskip{3pt plus 2pt minus 2pt}
\makeatletter
\g@addto@macro \normalsize {%
 \setlength\abovedisplayskip{3pt plus 2pt minus 2pt}%
 \setlength\belowdisplayskip{3pt plus 2pt minus 2pt}%
}
\makeatother
%espace supplementaire autour de $ $.
\mathsurround=0.15em
%%


%%%%%%%%%%%%%%%%%%%%%%
% Macro pour la typographie
%%%%%%%%%%%%%%%%%%%%%%
%%
% macro pour mettre des guillemets 
\newcommand{\guille}[1]{\guillemotleft~#1~\guillemotright}
\newcommand{\Euro}{\euro{}\ }
%%

%%%%%%%%%%%%%%%%%%%%%%%
% Macro diverses
%%%%%%%%%%%%%%%%%%%%%%%
%%
%% macro pour la date
\def\today{\ifnum\day=1\relax 1\raisebox{.6ex}{small er} \else \number\day\fi%
\space\ifcase\month\or%
janvier\or f\'evrier\or mars\or avril\or%
mai\or juin\or juillet\or ao\^ut\or%
septembre\or octobre\or novembre\or d\'ecembre\fi%
\space\number\year}



% Pour mettre l'image video dans la marge
\usepackage{zref-savepos}

\newcounter{savepos}
\def\envideo{%
  \addtocounter{savepos}{1}  
\zsavepos{\thesavepos}%
%%%%%%--------
\ifnum20000000<\number\zposx{\thesavepos}%
\ifthenelse{\equal{\flaglivre}{1}}{
    \begin{tikzpicture}[remember picture,overlay]
	  \node[inner sep=0pt] (russell) at (9,0.5)
	  {\scalebox{0.35}{\rotatebox{0}{\includegraphics{\cheminimage/imagevid.png}}}};
	\end{tikzpicture}}%to prevent adding extra space before text
	{
    \begin{tikzpicture}[remember picture,overlay]
	  \node[inner sep=0pt] (russell) at (13.3,0.5)
	  {\scalebox{0.35}{\rotatebox{0}{\includegraphics{\cheminimage/imagevid.png}}}};
	\end{tikzpicture}%to prevent adding extra space before text
	}
\else
    \begin{tikzpicture}[remember picture,overlay]
	  \node[inner sep=0pt] (russell) at (-1,0.5)
	  {\scalebox{0.35}{\rotatebox{0}{\includegraphics{\cheminimage/imagevid.png}}}};
    \end{tikzpicture}%to prevent adding extra space before text
\fi%
\ignorespaces
}

\newcounter{saveposs}
%  \addtocounter{savepos}{1}  
%\zsavepos{\thesavepos}%

%\newcommand{\shiftleft}[2]{\makebox[0pt][r]{\makebox[#1][l]{#2}}}



%%ùù
%\def\exodifficile{
%    \begin{tikzpicture}[remember picture,overlay]
%	  \node[inner sep=0pt] (russell) at (-0.18,0.7)
%	  {\scalebox{2.35}{\textcolor{red}{$\bullet$}}};
%    \end{tikzpicture}
%}

\newcommand{\dangerf}{\raisebox{3pt}{\Large \textcolor{red}{\danger}}}


%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% parametres mise en page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
\renewcommand{\columnseprulecolor}{\color{Apricot!70!Black}}
% pour supprimer espace vertical tabbing
\usepackage{etoolbox}
\AtBeginEnvironment{tabbing}{\setlength\topsep{0pt}\setlength\partopsep{0pt}}
%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition des envirronnements theo def remarques..
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%

% j'ai mis ceci car j'ai une erreur avec la classe article pas de counter chapter defini
\makeatletter
\@ifclassloaded{book}{%
	\newcounter{exoptp}[chapter]
	%\renewcommand{\theequation}{\arabic{equation}}
	%%%%%% Numérotation de l'exercice qui fait le cours
	}{%
	\newcounter{exoptp}}
\makeatother
\setcounter{exoptp}{1}
%% Exercice

%\newcounter{ex}
%\newenvironment{exercice}[2][]{%
%	\pagebreak[3]
%	\refstepcounter{ex}
%	\vspace{0.5em}
%	%\setcounter{equation}{0} %remise du compteur equation à zero
%				  %à chaque nouvel exercice    
%
%	{\Large \textbf{\textsc{Exercice \theex}}}
%	%\qquad{\large \textit{#1} }
%	\quad{ \textit{#1}}  
%	%question: modifier le tarassconf pour ajouter un 2e arg ou pas?
%	% pas la peine si je dev une lecture des fichiers insérer ds le texte.
%	
%	%\quad{\large \textit{#1} \hrulefill {\scriptsize\textit{#2}}}
%	
%%	\nopagebreak[4]
%
%  }%
%	{\vspace{1em}}

\newcounter{ex}
\setcounter{ex}{1}

\usepackage{xifthen}
\newenvironment{exercice}[2][]{%
	\pagebreak[3]
	\addtocounter{exoptp}{-1} % bidouille des compteurs pour avoir la bonne ref
	\refstepcounter{exoptp}
	\vspace{0.5em}
	%\setcounter{equation}{0} %remise du compteur equation à zero
				  %à chaque nouvel exercice    
	{\Large \textbf{\textsc{Exercice \theexoptp}}}
	%ici diese 1 vaut : #1 oo 
	\ifthenelse
	% on teste si l'argument 2 est vide ou pas
	{\isempty{#2}}
	% si il est vide 
	{\quad{\textit{#1}}}
	{
	   \ifthenelse
	   % on teste si on doit mettre le lien 
	   {
		 \equal{\string #2}{\string \refenonce{0}{1}{1}}\or
	     \equal{\string #2}{\string \refenonce{0}{0}{1}}\or
	     \equal{\string #2}{\string \refenonce{0}{1}{0}}\or
	     \equal{\string #2}{\string \refenonce{0}{0}{0}}
	   }
	   {
         % non on ne met pas de lien
          \quad{\textit{#1}}
         % oui on met un lien 
       }
	   {\tcbox[nobeforeafter, baseline=1.5mm,left=1mm, right=1mm,
	   top=0.5mm,bottom=0mm,colback=white!90!black]{#2}  \quad  \textbf{#1} }
	 }
	\nopagebreak[4]}%
	{\addtocounter{exoptp}{1}% on rajoute le 1 enlevé avant
	  \vspace{1em}}

%{\tcbox[nobeforeafter, baseline=1.5mm,left=1mm, right=1mm, top=0.5mm,bottom=0mm,colback=gray!100!black]{#2} ici diese 2   \quad \textbf{ici diese 1  #1}}


		 % pb avec refenonce et refcorrection a voir plus tard !!
\newtheorem*{remf}{Remarque}
  
\theoremstyle{exemplef}
\newtheorem*{exoaf}{Exercice(s) à faire}

\newenvironment{exemplef}[1][]{%
\begin{minipage}[t]{\textwidth}
	%\vspace{0.5em}
	%\setcounter{equation}{0} %remise du compteur equation à zero
				  %à chaque nouvel exercice    
	{ \textbf{ Exemple : }}
	%\qquad{\large \textit{#1} }
	%\quad{ \textit{#1}  } \small
	%question: modifier le tarassconf pour ajouter un 2e arg ou pas?
	% pas la peine si je dev une lecture des fichiers insérer ds le texte.
	
	%\quad{\large \textit{#1} \hrulefill {\scriptsize\textit{#2}}}
	}%
	{\end{minipage}\vspace{1em}}

%% Exercice
  \newcounter{exocours}
  \setcounter{exocours}{0}

\newenvironment{exercice-cours}[1][]{%
	\pagebreak[3]
	\refstepcounter{exocours}
	\vspace{0.5em}
	{ \textbf{\textsc{\small Exercice \theexocours}}}
	\quad{ \textit{#1}  } \small
	\nopagebreak[4]}%
	{\vspace{1em}}

%%% théorèmes et définitions encadrées %%%%%%%%%%
\usetikzlibrary{shapes,snakes}

% inner sep et inner ysep donne les marges de la boite
\tikzstyle{mybox} = [draw=Apricot!100, fill=Apricot!20, very thick,
    rectangle, rounded corners, inner sep=10pt, inner ysep=12pt]
%\tikzstyle{myfancytitle} =[fill=Apricot!100, text=white]
\tikzstyle{myfancytitle} =[fill=Apricot!100]
\tikzstyle{myfancyname} =[fill=Apricot!100]

\newcommand\mytheotikztitre{} % astuce  pour une option en fin de bloc
\newcommand\mytheotikznom{}
\newcommand\myheartsuit{}

\newcommand{\titre}[2]{
\renewcommand\mytheotikztitre{GGGG}%
\renewcommand\myheartsuit{}%
\renewcommand\mytheotikznom{\textbf{\Large  #1 #2}}
  \par\medskip
  \begin{tikzpicture}%
       {\node[ draw=Apricot!70!Black, fill=Apricot!20, very thick,
    rectangle, rounded corners, inner sep=8pt, inner ysep=8pt]{\mytheotikznom};}%
  \end{tikzpicture}\par\medskip%
  } 

\newcommand{\videc}[2]{
\renewcommand\mytheotikztitre{}%
\renewcommand\myheartsuit{}%
%\renewcommand\mytheotikznom{\ifthenelse{\equal{#1}{}}{}{#1}}
\renewcommand\mytheotikznom{\sffamily #1}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox] (box)\bgroup%
    \begin{minipage}{0.96\linewidth}  \sffamily #2 %
    \end{minipage}\egroup;%
    %\node[myfancytitle, rounded corners,right=10pt] at (box.north west){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}% c'est le sffamily de l'arg 1 car sinon il met
% noeud et ça fait un point.
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%
  } 

\newcommand{\auchoixc}[2]{
\renewcommand\mytheotikztitre{\sffamily #1 }%
\renewcommand\myheartsuit{}%
%\renewcommand\mytheotikznom{\ifthenelse{\equal{#1}{}}{}{#1}}
\renewcommand\mytheotikznom{\sffamily}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox] (box)\bgroup%
    \begin{minipage}{0.96\linewidth}  \sffamily #2 %
    \end{minipage}\egroup;%
    \node[myfancytitle, rounded corners,right=10pt] at (box.north west){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}% c'est le sffamily de l'arg 1 car sinon il met
% noeud et ça fait un point.
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%
  } 

\newcommand{\theoc}[2]{
\renewcommand\mytheotikztitre{\sffamily Th\'eor\`eme}%
\renewcommand\myheartsuit{}%
%\renewcommand\mytheotikznom{\ifthenelse{\equal{#1}{}}{}{#1}}
\renewcommand\mytheotikznom{\sffamily #1}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox] (box)\bgroup%
    \begin{minipage}{0.96\linewidth}  \sffamily #2 %
    \end{minipage}\egroup;%
    \node[myfancytitle, rounded corners,right=10pt] at (box.north west){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}% c'est le sffamily de l'arg 1 car sinon il met
% noeud et ça fait un point.
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%
  } 

\newcommand{\rappelc}[2]{
\renewcommand\mytheotikztitre{\sffamily Rappel(s)}%
\renewcommand\myheartsuit{}%
\renewcommand\mytheotikznom{\sffamily #1}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox] (box)\bgroup%
    \begin{minipage}{.96\linewidth}  \sffamily #2 %
    \end{minipage}\egroup;%
    \node[myfancytitle, rounded corners,right=10pt] at (box.north west){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}%
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%
  } 

\newcommand{\coroc}[2]{
\renewcommand\mytheotikztitre{\sffamily Corollaire}%
\renewcommand\myheartsuit{}%
\renewcommand\mytheotikznom{\sffamily #1}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox] (box)\bgroup%
    \begin{minipage}{.96\linewidth}  \sffamily #2 %
    \end{minipage}\egroup;%
    \node[myfancytitle, rounded corners,right=10pt] at (box.north west){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}%
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%

} 

\newcommand{\defic}[2]{
\renewcommand\mytheotikztitre{\sffamily Définition}%
\renewcommand\myheartsuit{}%
\renewcommand\mytheotikznom{\sffamily #1}
  \par%\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox] (box)\bgroup%
    \begin{minipage}{.96\linewidth}  \sffamily #2 %
    \end{minipage}\egroup;%
    \node[myfancytitle, rounded corners,right=10pt] at (box.north west){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}%
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%

} 

\newcommand{\propoc}[2]{
\renewcommand\mytheotikztitre{\sffamily Proposition}%
\renewcommand\myheartsuit{}%
\renewcommand\mytheotikznom{\sffamily #1}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox] (box)\bgroup%
    \begin{minipage}{.96\linewidth}  \sffamily #2 %
    \end{minipage}\egroup;%
    \node[myfancytitle, rounded corners,right=10pt] at (box.north west){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}%
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%

}

\newcommand{\proprc}[2]{
\renewcommand\mytheotikztitre{\sffamily Propriété}%
\renewcommand\myheartsuit{}%
\renewcommand\mytheotikznom{\sffamily #1}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox] (box)\bgroup%
    \begin{minipage}{.96\linewidth}  \sffamily #2 %
    \end{minipage}\egroup;%
    \node[myfancytitle, rounded corners,right=10pt] at (box.north west){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}%
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%

}

\newcommand{\lemmec}[2]{
\renewcommand\mytheotikztitre{\sffamily Lemme}%
\renewcommand\myheartsuit{}%
\renewcommand\mytheotikznom{\sffamily #1}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox] (box)\bgroup%
    \begin{minipage}{.96\linewidth}  \sffamily #2 %
    \end{minipage}\egroup;%
    \node[myfancytitle, rounded corners,right=10pt] at (box.north west){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}%
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%

}

\newcommand{\aidec}[2]{
\renewcommand\mytheotikztitre{\sffamily Aide}%
\renewcommand\myheartsuit{}%
\renewcommand\mytheotikznom{\sffamily #1}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox] (box)\bgroup%
    \begin{minipage}{.96\linewidth}  \sffamily #2 %
    \end{minipage}\egroup;%
    \node[myfancytitle, rounded corners,right=10pt] at (box.north west){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}%
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%
}

\newcommand{\methodec}[2]{
\renewcommand\mytheotikztitre{\sffamily Méthode}%
\renewcommand\myheartsuit{}%
\renewcommand\mytheotikznom{\sffamily #1}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox] (box)\bgroup%
    \begin{minipage}{.96\linewidth}  \sffamily #2 %
    \end{minipage}\egroup;%
    \node[myfancytitle, rounded corners,right=10pt] at (box.north west){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}%
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%

}

\tikzstyle{mybox2} = [draw=Apricot!100, fill=Apricot!20, very thick,
    rectangle, rounded corners, inner sep=10pt, inner ysep=10pt]
\newcommand{\prerequis}[2]{
\renewcommand\mytheotikztitre{\sffamily Prérequis}%
\renewcommand\myheartsuit{}%
\renewcommand\mytheotikznom{\sffamily #1}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox2] (box)\bgroup%
    \begin{minipage}{.9\linewidth}  \sffamily 
	  #2 %
	  %\vspace{-1cm}
	\end{minipage}\egroup;%
    \node[name=oo, below=-1pt ] at (box.north west){};%
    \node[myfancytitle, rounded corners, right=10pt] at (oo.north){\mytheotikztitre};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}%
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%
}

\tikzstyle{mybox2} = [draw=Apricot!100, fill=Apricot!20, very thick,
    rectangle, rounded corners, inner sep=10pt, inner ysep=10pt]
\newcommand{\quelconquec}[3]{
  \renewcommand\mytheotikztitre{\sffamily #1}%
\renewcommand\myheartsuit{}%
\renewcommand\mytheotikznom{\sffamily #2}
  \par\medskip
  \noindent
  \begin{tikzpicture}%
    \node [mybox2] (box)\bgroup%
    \begin{minipage}{.9\linewidth}  \sffamily 
	  #3 %
	  %\vspace{-1cm}
	\end{minipage}\egroup;%
    \node[name=oo, below=-1pt ] at (box.north west){};%
	\node[myfancytitle, rounded corners, right=10pt] at (oo.north){\mytheotikztitre{}};%
    \ifthenelse{\equal{\mytheotikznom}{\sffamily }}%
       {}%
       {\node[myfancyname,rounded corners,left=30pt,font=\upshape] at (box.north east){\mytheotikznom};}%
    \ifthenelse{\equal{\myheartsuit}{}}%
       {}%
       {\node[myfancytitle, rounded corners] at (box.east){\myheartsuit};}%
  \end{tikzpicture}\par\medskip%
}

% ancien sf qui pose des pb depuis passage xelatex
%\newenvironment{savoirfaire}[1][]{%
%	\pagebreak[3]
%	\refstepcounter{exocours}
%	\vspace{0.5em}
%	\renewcommand\mytheotikztitre{\textbf{Savoir-faire \theexocours } }%
%	\begin{tikzpicture}[anchor=base, baseline]%
%     %\node [mybox] (box)\bgroup%
%     \node[myfancytitle, rounded corners,right=10pt,below=-12] {\mytheotikztitre};%
%     %\node[myfancytitle, rounded corners,right=10pt,below=12] (P) at (0, 0){\mytheotikztitre};%
%     %\node[myfancytitle, rounded corners,right=10pt] (P) at (0,0){\mytheotikztitre};%
%     %\draw[myfancytitle, rounded corners,right=10pt];
%     %\node[draw] at (P.west){\textbf{#1} };%
%    \end{tikzpicture} 
%	\begin{tikzpicture}[anchor=base, baseline]%
%     \node[] {	\textbf{#1} };%
%	    \end{tikzpicture}
%	\par\medskip%
%
%	\nopagebreak[4]
%    %\begin{minipage}[t]{\textwidth}
%	  %\begin{shaded}
%	}%
%	{%\end{minipage}
%  %\end{shaded}
%	\vspace{1em}}
%
%nobeforeafter, baseline=1.5mm, left skip=0mm, left=2mm, right=2mm, top=1mm, bottom=1mm, colback=gray, coltext=white,
%	  arc=0mm, boxrule=0mm

	\newenvironment{savoirfaire}[1][]{%
	\pagebreak[3]
	\refstepcounter{exocours}
%\tcbset{colframe=blue!50!black,colback=white,colupper=red!50!black,
%fonttitle=\bfseries,nobeforeafter,center title}
	%\vspace{0.5em}
	\renewcommand\mytheotikztitre{\textbf{Savoir-faire \theexocours } }%
		%\begin{spacing}{1.5}
	  \noindent\tcbox[tcbox raise base,colframe=Apricot!100, nobeforeafter,colback=Apricot!100,coltext=black, rounded
	  corners,right=3pt,left=3pt,bottom=0pt, top=0pt,]{\mytheotikztitre}\textbf{ $\ $ #1}
 \vspace{1em}
\nopagebreak

  %\newline
}%
{
	  \vspace{1em}}

%Inserer des lignes (quadrillage)
\newcommand{\DesLignes}[2]{
\begin{minipage}[t]{#1cm}
   
    \psset{xunit=1cm,yunit=1cm}
    \begin{pspicture}(#1,#2)
	    %\MaGrille[10,xunit=1,yunit=1]{0}{0}{#1}{#2}
	    	\psgrid[gridlabels=0,%
	        subgriddiv=2,%
			gridwidth=0.5pt,%
			griddots=10,subgriddots=5](0,0)(0,0)(#1,#2)

    %\psgrid[gridlabels=0,subgriddiv=2,gridwidth=0.15pt](#1, #2)
    \end{pspicture}
\end{minipage}}

%% environnement exemple, rem et dem et definition des lignes pour compléter
\newcommand\acompleter[1][gray!80!white]{{\color{#1}\hrulefill}}
  \newcounter{ccA}
  \newcounter{ccB}
\newcommand{\mettreligne}{\hspace{0.00cm}\mbox{}\acompleter\\
% ici un saut pour avoir l'espace

}
% La commandes des lignes
\newcommand{\mettrelignesans}{\hspace{0.00cm}\mbox{}\acompleter}

\newcommand{\deslignes}[1]{
  \setcounter{ccA}{#1}
  \setcounter{ccB}{\value{ccA}-1}
  %\begin{spacing}{#1} pb : il passe à la ligne 
  \multido{}{\value{ccB}}{ \noindent\mettreligne  }
%\end{spacing}
  \noindent\mettrelignesans
}

% la commande \deslignescoroupas sert à mettre des lignes dans le fichier exo pour la correction au
% tableau. Il faut renseigner les drapeau \deslignescor en début de fichier.
\newcommand{\deslignescoroupas}[1]{\ifthenelse{\equal{\deslignescor}{0}}{}{\deslignes{#1}}}
% la commande nouvpagecor fait un changement de page si \deslignescor est à 1
\newcommand{\nouvpagecor}{\ifthenelse{\equal{\deslignescor}{0}}{}{\newpage}}

\colorlet{fond-environement}{white}

\colorlet{surbri-texte}{black}
\newcounter{compteurexempleff}[section]
\setcounter{compteurexempleff}{0}
\newenvironment{exempleff}[1][]{%
  \addtocounter{compteurexempleff}{1}
 % \begin{tcolorbox}[enhanced ,breakable,boxrule=0mm, left=0mm, top=1mm, bottom=1mm, right=0mm,bottomsep at
%	break=-4mm,topsep at break=-4mm,colback=fond-environement, colframe=fond-environement]
  \begin{spacing}{\interlignespacing}
	%\textbf{\textcolor{surbri-texte}{Exemple#1  \textbf{\thecompteurexempleff} :} }
	\textbf{\textcolor{surbri-texte}{Exemple#1  :} }
  }
  {\end{spacing}
%	\end{tcolorbox}
\colorlet{surbri-texte}{black}
  }

\newenvironment{exempleffsans}[1][]{%
  \addtocounter{compteurexempleff}{1}
  \begin{tcolorbox}[enhanced ,breakable,boxrule=0mm, left=0mm, top=1mm, bottom=1mm, right=0mm,bottomsep at
	break=-4mm,topsep at break=-4mm,colback=fond-environement, colframe=fond-environement]
  \begin{spacing}{\interlignespacing}
	\textbf{\textcolor{surbri-texte}{Exemple#1 :} }
  }
  {\end{spacing}
	\end{tcolorbox}
\colorlet{surbri-texte}{black}
  }

\newenvironment{remff}[1][]{%
  \begin{tcolorbox}[enhanced ,breakable,boxrule=0mm, top=1mm, bottom=1mm, left=0mm, right=0mm,bottomsep at
	break=-4mm,topsep at break=-4mm,colback=fond-environement, colframe=fond-environement]
  \begin{spacing}{\interlignespacing}
	\textbf{\textcolor{surbri-texte}{Remarque#1 :}}
  }
  {\end{spacing}
	\end{tcolorbox}
  }

\newenvironment{prooff}[1][]{%
  \begin{tcolorbox}[enhanced ,breakable,boxrule=0mm, top=1mm, bottom=1mm, left=0mm, right=0mm,bottomsep at
	break=-4mm,topsep at break=-4mm,colback=white, colframe=white]
  \begin{spacing}{\interlignespacing}
	\textit{Démonstration#1 :}
  }
  {\end{spacing}
	\end{tcolorbox}
  }


\newcommand{\unegrille}[1]{%
  \begin{tcolorbox}[enhanced ,breakable,arc=0mm, boxrule=.3mm, top=-1mm, bottom=-1mm, left=0mm, right=0mm,bottomsep at
	break=-4mm,topsep at break=-4mm,colback=white, colframe=Apricot!80!black,
	underlay={\begin{tcbclipinterior}
		\draw[help lines, step=5mm, Apricot!80!black, shift={(interior.north west)}]
		(interior.south west) grid (interior.north east);
	  \end{tcbclipinterior}
	}]
  \begin{spacing}{0}
	\psset{xunit=1cm,yunit=1cm}
 \setcounter{ccA}{#1}
  \setcounter{ccB}{\value{ccA}-1}
\begin{pspicture}(0,0)(15,1)\end{pspicture}
\multido{}{\value{ccB}}{  \vspace{-0.4mm}\begin{pspicture}(0,0)(15,1)\end{pspicture}}
	\end{spacing}
\end{tcolorbox}
  }

%\usepackage{indentfirst}
\newenvironment{citeff}[1][]{%
  \begin{tcolorbox}[enhanced ,breakable,boxrule=0.0mm, left=0mm, right=0mm, top=0mm,bottom=-4mm,bottomsep at
	break=-4mm,topsep at break=-4mm,colback=white, colframe=white, parbox=false]
	%parbox=false permet d'avoir l'indentation
  \begin{spacing}{\interlignespacing}
	%\setlength{\parindent}{0pt}
	\tcbox[colframe=white, colback=Apricot!80!white,left skip=-1mm,left=1mm, right=1mm, top=1mm,
	bottom=1mm]{\sffamily #1}
  }
  {\end{spacing}
	\end{tcolorbox}
  }


\newenvironment{demf}[1][]{%
  \begin{tcolorbox}[enhanced ,breakable,boxrule=0mm, left=0mm, right=0mm,bottomsep at
	break=-4mm,topsep at break=-4mm,colback=white, colframe=white]
  \begin{spacing}{\interlignespacing}
	\textit{Démonstration#1 :}
  }
  {
	\MULTIPLY{-0.4}{\interlignespacing}{\temp}
	\ADD{\temp}{-0.46}{\decalagevert}
	\COPY{\decalagevert cm}{\decalagevert}
	\vspace{\decalagevert}
	\begin{flushright}
	  \psset{xunit=1cm,yunit=1cm}
	  \begin{pspicture}(-0.1,0)(-0.1,0)
		\psframe[linestyle=none, dimen=middle, fillstyle=solid, fillcolor=white](-.5,-.5)(.5,.5)
		%\MesAxes[.6pt,Dx=1,Dy=1]{0}{0}{1}{1}
		\uput{0}[225](0,0){$\openbox$}
	  \end{pspicture}
	\end{flushright}
  \end{spacing}
	\end{tcolorbox}
  }

%pour enrober les tableaux
  \NewTCBox{\enrobe}{s m s}{
	title={#2}, nobeforeafter, enhanced,  left=-5.7mm, right=-2mm, top=0mm, bottom=0mm,
	  boxsep=0mm, bottomtitle=0.4mm, toptitle=0.6mm, fonttitle=\sffamily\bfseries,
	  fontupper=\normalsize\sffamily,  colback=tableaucolback, colframe=tableaucolframe,
	   colbacktitle=tableaucolbacktitle, coltitle=tableaucoltitle, center title}


%	\refstepcounter{exoptp}
%\addtocounter{exoptp}{1}
  %\setcounter{exoptp}{1} je n'arrive pas a initialiser le compteur ici donc j'ai mis dans le texte
  %cette instruction, c'est moche mais bon..

	\newenvironment{exerciceptp}[2][]{%
	\pagebreak[3]
\addtocounter{exoptp}{-1} % bidouille des compteurs pour avoir la bonne ref
	\refstepcounter{exoptp} %si refstep n'est pas là les ref ne sont pas bonne
	% Lors de la mise en page des exo pour le spe-divisibilite, j'ai enlevé le spacing qui ajoutait
	% des espaces avant les enumerate. Dans le input-exercice j'ai ajouté
	% \setlist[enumerate]{parsep=0pt,topsep=0pt} pour supprimer l'espace avant et diminuer les
	% espace entre les item.
	% Attention je n'ai par retester les feuilles d'exo
	% TOUTES modif de cette partie necessite les tests des exo de cours spé, des exo
	% TS-approffondissement, des feuilles exo avec correction et indication.
	%	\begin{spacing}{1.5}
	% J'ai aussi modifié la taille des boites.
	  %\noindent\tcbox[nobeforeafter, baseline=1.5mm, left skip=0mm, left=2mm, right=2mm, top=1mm, bottom=1mm, colback=gray, coltext=white, arc=0mm, boxrule=0mm]{\usefont{T1}{cmss}{bx}{n} \theexoptp}
	  \noindent\tcbox[nobeforeafter, baseline=1.5mm, left skip=0mm, left=1mm, right=1mm, top=0mm,
	  bottom=0mm, colback=gray, coltext=white, arc=0.2mm, boxrule=0mm]{\usefont{T1}{cmss}{bx}{n} \theexoptp}
%\tcbox[nobeforeafter, left=2mm, right=2mm, top=0mm, bottom=0.3mm,
%arc=0mm, boxrule=0mm, colframe=white, opacityback=0]{\usefont{T1}{cmss}{bx}{n}\textbf{#1}}
%\hfill
%
% On teste si il y a des hyperliens
%\(\NOT \isempty{#2}\
	  \ifthenelse{ %\equal{#2}{}\or
	  \equal{\string #2}{\string vide}\or
	  \equal{\string #2}{\string \refenonce{0}{1}{1}}\or
	  \equal{\string #2}{\string \refenonce{0}{1}{1}}\or
	    \equal{\string #2}{\string \refenonce{0}{0}{1}}\or
	  \equal{\string #2}{\string \refenonce{0}{1}{0}}\or
	  \equal{\string #2}{\string \refenonce{0}{0}{0}}}{
%si il n'y en a pas
{\usefont{T1}{cmss}{bx}{n}\textbf{#1}}
\smallskip


% si il en a
}{ \tcbox[nobeforeafter, baseline=1.5mm,left=1mm, right=1mm, top=0.5mm, bottom=0mm, colback=gray!100!black]{#2}
%	\smallskip
	\noindent{\hspace{-0.4em}\usefont{T1}{cmss}{bx}{n}\textbf{#1}}    %\hfill \phantom{o}
\smallskip

  }
		%\end{spacing}
%	\pagebreak[1]
\nopagebreak
  %\newline
}%
{\addtocounter{exoptp}{1}% on rajoute le 1 enlevé avant
	  \vspace{1em}}

\def\exodifficile{
  \hspace{0.05cm}
  \makebox[0pt]{\begin{pspicture}(0,0)(0.5,0)
	  \uput{0}[0](-0.4,0.06){\scalebox{2.35}{\textcolor{red}{$\bullet$}}}
	\end{pspicture}}
  }

%\def\exodifficile{
%  \begin{pspicture}(0,0)(0,0)
%	  \uput{0}[0](-0.5,0.0){\scalebox{2.35}{\textcolor{red}{$\bullet$}}}
%	\end{pspicture}
%  }


	\newenvironment{exerciceptpcor}[1]{%
	  \csname @\ifnum#1=1 first\else second\fi oftwo\endcsname
	  {\vspace{-0.7cm}\dotfill 

	  {\usefont{T1}{cmss}{bx}{n}\textit{\textbf{Correction~~}}}
\nopagebreak
		%\\*
		\ignorespaces
	  }
	  {
\expandafter\let\csname end\csname @currenvir\endcsname\endcsname=\endcomment
      \comment
	  }
	}
	{
\ignorespacesafterend
	}

%	\newenvironment{exerciceptpcor}[2][]{%
%	\pagebreak[3]
%\ifthenelse{\equal{\variablecor}{vraie}}{
%  \dotfill
%
%  {\usefont{T1}{cmss}{bx}{n}\textbf{Correction}}
%\nopagebreak
%#1 
%}%
%{
%}{}
%  }


\newenvironment{exerciceptpexodiff}[2][]{%
	\pagebreak[3]
\addtocounter{exoptp}{-1} % bidouille des compteurs pour avoir la bonne ref
	\refstepcounter{exoptp} %si refstep n'est pas là les ref ne sont pas bonne
	% Lors de la mise en page des exo pour le spe-divisibilite, j'ai enlevé le spacing qui ajoutait
	% des espaces avant les enumerate. Dans le input-exercice j'ai ajouté
	% \setlist[enumerate]{parsep=0pt,topsep=0pt} pour supprimer l'espace avant et diminuer les
	% espace entre les item.
	% Attention je n'ai par retester les feuilles d'exo
	% TOUTES modif de cette partie necessite les tests des exo de cours spé, des exo
	% TS-approffondissement, des feuilles exo avec correction et indication.
	%	\begin{spacing}{1.5}
	% J'ai aussi modifié la taille des boites.
	  %\noindent\tcbox[nobeforeafter, baseline=1.5mm, left skip=0mm, left=2mm, right=2mm, top=1mm, bottom=1mm, colback=gray, coltext=white, arc=0mm, boxrule=0mm]{\usefont{T1}{cmss}{bx}{n} \theexoptp}
	  \noindent\tcbox[nobeforeafter, baseline=1.5mm, left skip=0mm, left=1mm, right=1mm, top=0mm,
	  bottom=0mm, colback=gray, coltext=white, arc=0.2mm, boxrule=0mm]{\usefont{T1}{cmss}{bx}{n} \exodifficile\theexoptp}
%\tcbox[nobeforeafter, left=2mm, right=2mm, top=0mm, bottom=0.3mm,
%arc=0mm, boxrule=0mm, colframe=white, opacityback=0]{\usefont{T1}{cmss}{bx}{n}\textbf{#1}}
%\hfill
%
% On teste si il y a des hyperliens
	  \ifthenelse{\equal{\string #2}{\string \refenonce{0}{1}{1}}\or
	    \equal{\string #2}{\string \refenonce{0}{0}{1}}\or
	  \equal{\string #2}{\string \refenonce{0}{1}{0}}\or
	  \equal{\string #2}{\string \refenonce{0}{0}{0}}}{
%si il n'y en a pas
{\usefont{T1}{cmss}{bx}{n}\textbf{#1}}
\smallskip


% si il en a
}{ \tcbox[nobeforeafter, baseline=1.5mm,left=1mm, right=1mm, top=0.5mm, bottom=0mm, colback=gray!100!black]{#2}
%	\smallskip
	\noindent{\hspace{-0.4em}\usefont{T1}{cmss}{bx}{n}\textbf{#1}}    %\hfill \phantom{o}
\smallskip

  }
		%\end{spacing}
%	\pagebreak[1]
\nopagebreak
  %\newline
}%
{\addtocounter{exoptp}{1}% on rajoute le 1 enlevé avant
	  \vspace{1em}}

%%

%%%%%%%%%%%%%%%%%%%%%%
% Les listes 
%%%%%%%%%%%%%%%%%%%%%%
%%
	  % Voir ce qui est encore utile ici car j'utilise maintenant enumitem
%\RequirePackage{enumerate}	% Redefinir les etiquettes
                            % des listes enumerate a la volee

%\renewcommand{\Frlabelitemi}{\scalebox{0.8}{$\rhd$}}
%\renewcommand{\Frlabelitemi}{\scalebox{0.8}{$\bullet$}}
%\renewcommand{\Frlabelitemii}{\scalebox{0.6}{$\square$}}
%\renewcommand{\Frlabelitemii}{\scalebox{0.6}{$\bullet$}}


%\def\bbl@frenchitemize{%
%    \let\@ltiORI\labelitemi
%    \let\@ltiiORI\labelitemii
%    \let\@ltiiiORI\labelitemiii
%    \let\@ltivORI\labelitemiv
%    \let\itemizeORI\itemize
%    \let\labelitemi\Frlabelitemi
%    \let\labelitemii\Frlabelitemii
%    \let\labelitemiii\Frlabelitemiii
%    \let\labelitemiv\Frlabelitemiv
%    \ifFrenchItemizeSpacing
%      \def\itemize{\let\@trivlist\@trivlistORI
%        \ifnum \@itemdepth >\thr@@\@toodeep\else
%        \advance\@itemdepth\@ne
%        \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
%        \expandafter
%        \listORI
%        \csname\@itemitem\endcsname
%        {\settowidth{\labelwidth}{\csname\@itemitem\endcsname}%
%         \setlength{\leftmargin}{\labelwidth}%
%         \addtolength{\leftmargin}{\labelsep}%
%         \ifnum\@listdepth=0
%           \setlength{\itemindent}{\parindent}%
%         \else
%           \addtolength{\leftmargin}{\parindent}%
%         \fi
%         \setlength{\itemsep}{\z@}%
%         \setlength{\parsep}{\z@}%
%         \setlength{\topsep}{\z@}%
%         \setlength{\partopsep}{\z@}%
%         \@tempdima=\parskip
%         \addtolength{\topsep}{-\@tempdima}%
%         \addtolength{\partopsep}{\@tempdima}}%
%        \fi}%
%     \fi}
%

% Pour décaler enumerate sur la gauche
\def\maxenumi{0}
\def\saveenumi{0}
\makeatletter
\AtEndDocument{%
  \immediate\write\@auxout{%
    \string\gdef\string\maxenumi{\saveenumi}}}
\makeatother

\usepackage[shortlabels]{enumitem}
%\setlist{noitemsep}
%\setlist[1]{\labelindent=\parindent}

\setlist[itemize,1]{label=\scalebox{0.6}{$\boldsymbol{\square}$},
 leftmargin=0.8cm
}
\setlist[itemize,2]{label=\scalebox{0.4}{$\boldsymbol{\square}$},
 leftmargin=*
}

\setlist[enumerate,1]{%
  label=\textbf{\arabic*.},
  leftmargin=0cm, itemindent=*,listparindent=0cm,
%  leftmargin=* % ancienne ligne, celle d'audessus permet d'avoir le texte qui revient sous les
%  %nombres.
  widest=\maxenumi,
  after=\ifnum\value{enumi}>\saveenumi\xdef\saveenumi{\the\value{enumi}}\fi
}

\setlist[enumerate,2]{
  label=\textbf{(\alph*)},  leftmargin=0cm, align=left,listparindent=0cm, itemindent=*
  %labelsep=0.1cm,  labelindent*=0.0cm
}
\setlist[enumerate,3]{
  label=\textbf{(\roman*)},  leftmargin=1.5cm, align=left,listparindent=0cm,
  itemindent=*,labelindent=0.6cm
  %labelsep=0.1cm,  labelindent*=0.0cm
}

 % \setlist[itemize]{label=\scalebox{0.4}{$\square$}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%commande pour cocher des cases ds les qcm
\newcommand{\qcmsol}{\ding{114}\negthickspace \negthickspace \negmedspace {\large\ding{55}}}

%commande pour les Vrais faux
\newcommand{\RepV}{%
	\hfill\makebox[1cm][s]{ \ding{114}\negthickspace \negthickspace \negmedspace {\large\ding{55}} \hfill  \ding{114}}
	}
\newcommand{\RepF}{%
	\hfill\makebox[1cm][s]{\ding{114}\hfill \ding{114}\negthickspace \negthickspace \negmedspace {\large\ding{55}}  }
	}

	% a modifier et à mettre dans le setlist au dessus !!
%\renewcommand{\theenumi}{\textbf{\arabic{enumi}}}
%\renewcommand{\labelenumi}{\textbf{\theenumi .}}
%\renewcommand{\labelenumii}{\textbf{(\theenumii)}}
%\renewcommand{\labelenumiii}{\textbf{\theenumiii)}}

%\makeatletter
%\newenvironment{MyEnumerate}
% {\enumerate[wide]%
%  \edef\sauter@saveditemindent{\the\itemindent}%
%  \advance\itemindent-\parindent
%  \patchcmd{\@item}{\ignorespaces}{\sauter@restoreitemindent\ignorespaces}{}{}}
% {\endenumerate}
%\newcommand\sauter@restoreitemindent{%
%  \itemindent=\sauter@saveditemindent
%  \def\sauter@restoreitemindent{}}
%\makeatother

\newlist{MyEnumeratef}{enumerate}{2}
\setlist[MyEnumeratef,1]{
  label=\textbf{\arabic*. },      % define the label
    align=left,           % align the label to the left
    itemindent=\parindent,% fit the label and the space following in this width
    labelwidth=\parindent,% fit the label and the space following in this width
    labelsep=0pt,
    listparindent=\parindent,
    leftmargin=0pt,% New lines in paragraph are to be aligned on the left
    }
\setlist[MyEnumeratef,2]{% settings for second level 
  label=\textbf{(\alph*)}, %start=1, % define the label
    align=left,           % align the label to the left
    itemindent=2\parindent,% fit the label and the space following in this width
    labelwidth=\parindent,% fit the label and the space following in this width
    leftmargin=0.5cm,% New lines in paragraph are to be aligned on the left
    }

%%


%Pour les references croisee 
% ceci permet de faire une ref croisée : dans input{*exercices.tex} le compteur exoptp
% est incrémenté et il est transmit via le .aux à nombredexo
\makeatletter
\newcommand*{\storecounter}[2]{%
  \edef\@currentlabel{\csname the#1\endcsname}% Store current counter value in \@currentlabel
  \label{#2}% Store label
}
\makeatother
\newcommand*{\getcounter}[2]{%
  \setcounterref{#1}{#2}% Retrieve label value and store it in a counter
}
\newcounter{nombredexo}

\usepackage{hyperref}
  \hypersetup{                    % parametrage des hyperliens
    colorlinks=true,                % colorise les liens
    breaklinks=true,                % permet les retours à la ligne pour les liens trop longs
    urlcolor= blue,                 % couleur des hyperliens
    linkcolor= blue,                % couleur des liens internes aux documents (index, figures, tableaux, equations,...)
    citecolor= green                % couleur des liens vers les references bibliographiques
    }

%cross reference
\usepackage{cleveref}

%%%%%%%%% pour les video : surbri


\definecolor{surbri-ombre}{RGB}{89,160,255}
%\colorlet{surbri-fond}{gray!40}
\definecolor{surbri-fond}{RGB}{225,236,255}
%\definecolor{surbri-fond}{RGB}{192,231,255}
%\colorlet{surbri-fond}{gray!40}
\colorlet{surbri-cadre}{gray!41}

%\newenvironment{surbri}{
%\tcbset{enhanced,colback=surbri-cadre,colframe=surbri-fond}
%\begin{tcolorbox}[boxrule=0mm, colback=surbri-cadre,enlarge left by=-1.7cm, width=\linewidth+2.8cm,
%	left=1.58cm, right=1cm,fuzzy shadow={0mm}{0mm}{-1.5mm}{0.45mm}{surbri-ombre}]
%}
%{
% \end{tcolorbox}
%}
\newcounter{pagepdf}
\newcounter{flagtitrecompteur}
\newcounter{flagpropocompteur}
\setcounter{flagtitrecompteur}{0}
\setcounter{flagpropocompteur}{0}
\def\flagsurbri{0}
\def\flagitem{0}
%\def\flagtitreplus{0}
%\newcommand{\flagtitreplus}[1]{\setcounter{flagtitrecompteur}{#1}\storecounter{flagtitrecompteur}{lelabel}}


% pour mettre les item en bleu:
\newif\ifgooditem
\gooditemtrue
\newcommand\gitem{\gooditemtrue\item}
\newcommand\bitem{\gooditemfalse\item}

  \newcommand{\citem}[1]{\ifthenelse{\equal{#1}{1}}{\gitem}{\bitem}}
  %\newcommand{\citem}[1]{\ifthenelse{\equal{#1}{1}}{\gitem\setcounter{pagepdf}{\thepage}\storecounter{pagepdf}{ougaouga}}{\bitem}}
\def\labelbleu{\ifgooditem\color{RoyalBlue}\scalebox{0.6}{$\boldsymbol{\blacksquare}$}\setcounter{pagepdf}{\thepage}\storecounter{pagepdf}{ougaouga}\else\color{black}\scalebox{0.6}{$\boldsymbol{\square}$}\fi}
\def\labelbleup{\ifgooditem\color{RoyalBlue}\scalebox{0.4}{$\boldsymbol{\blacksquare}$}\else\color{black}\scalebox{0.4}{$\boldsymbol{\square}$}\fi}


% pour insérer un objet comme occurence

\newcommand{\insertionobjet}[2]{\ifthenelse{\equal{#1}{1}}{#2}{}}


\makeatletter
\def\mathcolor#1#{\@mathcolor{#1}}
\def\@mathcolor#1#2#3{%
  \protect\leavevmode
  \begingroup
    \color#1{#2}#3%
  \endgroup
}
\makeatother

\newcounter{factice}
\setcounter{factice}{0}
% J'ai ajoute ce compteur factice car, chose très bizarre, en début de page, parfois le 
% \setcounter{pagepdf}{\thepage}\storecounter{pagepdf}{ougaouga} ajoutait un espace 
% j'ai donc mis la même commande quand le fond est blanc.

% Pour mettre du texte en bleu
\newcommand{\textbleu}[3][Blue]{\ifthenelse{\equal{#2}{1}}{\textcolor{#1}{#3}\setcounter{pagepdf}{\thepage}\storecounter{pagepdf}{ougaouga}}{#3}}
\newcommand{\textgbleu}[2][Blue]{\ifthenelse{\equal{#2}{1}}{\color{#1}\setcounter{pagepdf}{\thepage}\storecounter{pagepdf}{ougaouga}}{}}
\newcommand{\textmbleu}[3][Blue]{\ifthenelse{\equal{#2}{1}}{\mathcolor{#1}{#3}\setcounter{pagepdf}{\thepage}\storecounter{pagepdf}{ougaouga}}{#3}}

\newenvironment{surbri}[1]{
  \def\pourpasser{#1}%car je n'arrivais pas à passer #1 dans le 2eme if
  \ifthenelse{\equal{\pourpasser}{0}}{\colorlet{surbri-fonddef}{white}\storecounter{pagepdf}{factice}}{\colorlet{surbri-fonddef}{surbri-fond}\setcounter{pagepdf}{\thepage}\storecounter{pagepdf}{ougaouga}\colorlet{fond-environement}{surbri-fond}}
	
 % \ifthenelse{\equal{\pourpasser}{0}}{\colorlet{surbri-fonddef}{white}\setcounter{factice}{\thepage}\storecounter{pagepdf}{factice}}{\colorlet{surbri-fonddef}{surbri-fond}\colorlet{fond-environement}{surbri-fond}\setcounter{pagepdf}{\thepage}\storecounter{pagepdf}{ougaouga}}

  \ifthenelse{\equal{\theflagpropocompteur}{1}}{ \medskip}{}

%	\tcbset{enhanced,colback=surbri-fond,colframe=surbri-fond,before={\vspace{-0.5cm}},after={\vspace{-0.5cm}}}
	%before skip=-0.2cm,after skip=-0.2cm,
	%enlarge bottom by=-0.5cm, enlarge top by=-0.5cm,
\tcbset{enhanced,colback=surbri-fonddef,colframe=surbri-fonddef,nobeforeafter}
%\tcbset{enhanced,colback=surbri-fonddef,colframe=surbri-fonddef}


\begin{tcolorbox}[shrink tight,enlarge bottom by=-0.1cm, extrude top by=.2cm,
	extrude bottom by=.2cm,boxrule=0mm, colback=surbri-fonddef,enlarge left by=-1.9cm, width=\linewidth+3.8cm,
	colframe=surbri-fonddef,
	left=1.88cm, right=1.78cm%,fuzzy shadow={0mm}{0mm}{-1.5mm}{0.45mm}{surbri-ombre}
  ]
%\getcounter{flagtitrecompteur}{lelabel}
  \ifthenelse{\equal{\theflagtitrecompteur}{1}}{\vspace{.25cm}}{}
  \ifthenelse{\equal{\theflagpropocompteur}{1}}{ \vspace{-.2cm}}{}
  %\setcounter{flagtitrecompteur}{0}
  %\setcounter{flagpropocompteur}{0}
  \vspace{0cm}
  }
{
%\def\flagtitreplus{0}
  %\ifthenelse{\equal{\pourpasser}{0}}{}{
%\def\flagtitreplus{0}
\end{tcolorbox}
\colorlet{fond-environement}{white}
%\def\flagtitreplus{0}
}%}

%\newenvironment{surbri}[1]{
%  \def\pourpasser{#1}%car je n'arrivais pas à passer #1 dans le 2eme if
%  \ifthenelse{\equal{\pourpasser}{0}}{}{
%	\colorlet{fond-environement}{surbri-fond}
%	
%	\tcbset{enhanced,colback=surbri-fond,colframe=surbri-fond,before={\vspace{-1cm}}}
%%\tcbset{enhanced,colback=surbri-fond,colframe=surbri-fond,nobeforeafter}
%\begin{tcolorbox}[boxrule=0mm, colback=surbri-fond,enlarge left by=-2cm, width=\linewidth+3.8cm,
%	colframe=surbri-fond,
%	%enlarge right by=1.7cm,
%	left=1.88cm, right=1.78cm%,fuzzy shadow={0mm}{0mm}{-1.5mm}{0.45mm}{surbri-ombre}
%  ]
%%\getcounter{flagtitrecompteur}{lelabel}
%  \ifthenelse{\equal{\theflagtitrecompteur}{1}}{\vspace{.25cm}}{}
%  \ifthenelse{\equal{\theflagpropocompteur}{1}}{\vspace{-.2cm}}{}
%  %\setcounter{flagtitrecompteur}{0}
%  %\setcounter{flagpropocompteur}{0}
%  \vspace{0cm}
%  }}
%{
%%\def\flagtitreplus{0}
%  \ifthenelse{\equal{\pourpasser}{0}}{}{
%%\def\flagtitreplus{0}
%\end{tcolorbox}
%\colorlet{fond-environement}{white}
%\setcounter{pagepdf}{\thepage}\storecounter{pagepdf}{ougaouga}
%%\def\flagtitreplus{0}
%}}
	
