\SIdecimalsign{,}
%\input{mes_unites.sty} % Unites perso

% Pour l'optique:
\newcommand{\ov}{\overline}
% complexes
\newcommand{\und}{\underline}
\newcommand{\uvec}{\underline}
% vecteurs
\newcommand{\ovec}{\overrightarrow}

% Dérivation
\def\d					{{\rm d}}
\def\deriv		#1#2{	{{\rm d}\mkern+1mu{#1}\over{\rm d}\mkern+1mu {#2}}}
\def\dderiv		#1#2{	{{\rm d}^2\mkern+1mu{#1}\over{\rm d}\mkern+1mu {#2}^2}}
\def\accolade#1{\left\{\begin{matrix}{#1}\end{matrix}\right.} %%%%%%%%%%%%%% écrire x=... \cr y=...\cr z=...

%% Ecriture indice mode texte
\newcommand{\e}[1]{_\mathrm{ #1}}

% Compteur énumération
\newcounter{Count} % liste principale
\newcounter{Counti} % liste secondaire
\newcommand{\setcountout}{\setcounter{Count}{\value{enumi}}}
\newcommand{\setcountin}{\setcounter{enumi}{\value{Count}}}

% Pour mille
\newcommand{\promille}{%
  \relax\ifmmode\promillezeichen
        \else\leavevmode\(\mathsurround=0pt\promillezeichen\)\fi}
\newcommand{\promillezeichen}{%
  \kern-.05em%
  \raise.5ex\hbox{\the\scriptfont0 0}%
  \kern-.15em/\kern-.15em%
  \lower.25ex\hbox{\the\scriptfont0 00}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% ELEMENTS DE MISE-EN-PAGE %%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\bmp}[1]{\begin{minipage}{{#1}\linewidth}}
\newcommand{\emp}{\end{minipage}}
% Remarques - Definitions - Conclusion - Propriété
\newcommand{\interpr}{\noindent {\sc Interprétation~:~}\hangindent=1cm}
\newcommand{\csq}{\noindent {\sc Conséquence~:~}\hangindent=1cm}
\newcommand{\csqs}{\noindent {\sc Conséquences~:~}}
\newcommand{\rmq}{\noindent {\sc Remarque~:~}\hangindent=1cm}
\newcommand{\rmqs}{\noindent {\sc Remarques~:~}}
\newcommand{\Remarque}[1][]{
	\noindent {\sc Remarque~:~}\hangindent=0.83cm {\textsf {#1}}
}

\newcommand{\definition}{\noindent {\sc Définition~:~}\hangindent=1cm}
\newcommand{\definitions}{\noindent {\sc Définitions~:~}}
\newcommand{\ccl}{\noindent {\sc Conclusion~:~}\hangindent=1cm}
\newcommand{\prop}{\noindent {\sc Propriété~:~}\hangindent=1cm}
\newcommand{\props}{\noindent {\sc Propriétés~:~}}
\newcommand{\theo}{\noindent {\sc Théorème~:~}\hangindent=1cm}
\newcommand{\exemple}{\noindent \textbf{\slshape Exemple~:~}\hangindent=1cm}
\newcommand{\exemples}{\noindent  \textbf{\slshape Exemples~:~}}

%% from M. Piteira:
\newcommand\pa[1]{\vspace{.5cm}\textbf{\underline{#1}}\vspace{.5cm}}

%% TABLEAUX
% Aérer le tableau
\renewcommand{\arraystretch}{1.45}
%\setlength{\tabcolsep}{1cm}
\newcommand{\toprule}{\hline}
\newcommand{\midrule}{\hline}
\newcommand{\bottomrule}{\hline}
\newcommand{\tabularnewline}{\\}

%%%%%%% TITLES %%%%%%%%%%%%%%
%\newcommand{\titre}[1]{\LARGE{\fontfamily{phv} \fontshape{bX} \selectfont #1}}
\newcommand{\titre}[1]{
	\setlength{\fboxsep}{5pt}
	\setlength{\fboxrule}{1pt}
	\fbox{\LARGE{\sffamily\bfseries #1}}
}

% Exercices
\newcounter{iexo}
\setcounter{iexo}{1}
\newcommand{\exercice}[1]{
\medskip
\noindent {\sffamily\large\bfseries EX~\arabic{iexo}~--~{#1}}
\addtocounter{iexo}{1}

\medskip
}

% Problèmes 
\newcounter{ipb}
\setcounter{ipb}{1}
\newcommand{\probleme}[1]{
\medskip
\noindent {\sffamily\large\bfseries PB~\arabic{ipb}~--~{#1}}
\addtocounter{ipb}{1}

\medskip
}

% Solutions Exercices
\newcounter{isolex}
\setcounter{isolex}{1}
\newcommand{\solex}[1]{
\medskip
\noindent {\sffamily\bfseries EX~\arabic{isolex}~--~{#1}}
\addtocounter{isolex}{1}

\medskip
}

% Solutions Problemes
\newcounter{isolpb}
\setcounter{isolpb}{1}
\newcommand{\solpb}[1]{
\medskip
\noindent {\sffamily\bfseries PB~\arabic{isolpb}~--~{#1}}
\addtocounter{isolpb}{1}

\medskip
}


%% Questions (TPs)
\newcounter{iquestion}
\setcounter{iquestion}{1}
\newcommand{\question}{\noindent {\textbf{Q\arabic{iquestion}}.~}\hangindent=0.83cm \addtocounter{iquestion}{1}}
% Version majuscule (TP infos et autres)
%\newcommand{\Question}{\noindent {\textbf{Q\arabic{iquestion}}.~}\hangindent=0.83cm \addtocounter{iquestion}{1}}
\newcommand{\Question}[1][]{
	{\noindent \textbf{Q\arabic{iquestion}}.~}\hangindent=0.83cm {\textsf {#1}}
	\addtocounter{iquestion}{1}
}

% Solutions (TPs)
%\newcounter{iquestion}
%\setcounter{iquestion}{1}
\newcommand{\Solution}{\addtocounter{iquestion}{-1}
\noindent {\textbf{Q\arabic{iquestion}}.~}\hangindent=0.83cm \addtocounter{iquestion}{1}}


%\theoremstyle{plain}
\theoremstyle{break}
\theorembodyfont{\rmfamily}
%upshape %itshape %slshape %scshape %normalfont %bfseries
\theoremheaderfont{\bfseries\slshape}
%\newtheorem{Question}{Q}
%\newtheorem{manip}{Manip}
%\newtheorem{manip}{$\Rrightarrow$ Manip}
%\newtheorem{manip}{$\blacktriangleright$ Manip}
%\newtheorem{manip}{$\bullet$ Manip}
%\newcommand{\manip}[1]{$\bullet$ \textbf{{\slshape Manip~{#1}}}}
%\newcommand{\manip}[2][]{$\bullet$ \textbf{{\slshape Manip~{#2}~:~{#1}}}}

%%%%%% MANIP %%%%%%%
\newcounter{imanip}
\setcounter{imanip}{1}
\makeatletter % @ peut participer aux noms de fonctions
\newcommand{\manip}[2][]{
 	\@ifmtarg{#1}{% test si arg #1 est vide
 	\noindent $\bullet$ \textbf{{\textsf{\slshape MANIP~\arabic{imanip}}}}\\ %\hangindent=0.8cm %{#2} % si oui
	\begin{minipage}{\columnwidth}%-0.8cm}
	%\vspace{0.1cm}
	{\textsf {#2}}
	\end{minipage}
	}{
	\noindent $\bullet$ \textbf{{\textsf{\slshape MANIP~\arabic{imanip}~:~{#1}}}}\\ %\hangindent=0.8cm %{#2} % si non
	\begin{minipage}{\columnwidth}%-0.8cm}
	%\vspace{0.1cm}
	{\textsf {#2}}
	\end{minipage}
	}
	\addtocounter{imanip}{1}% incrémente le compteur de manips
}
\makeatother % @ ne peut plus participer aux noms de fonctions


%%%%%%% COULEURS %%%%%%%%%
\definecolor{vertolive}{RGB}{128,128,0}
\definecolor{violetpale}{RGB}{153,51,153}
\definecolor{bordeau}{RGB}{102,0,0}
\definecolor{mon_vert}{RGB}{0,102,0}
%\definecolor{eqholebox_color}{RGB}{230,230,230}
\definecolor{eqholebox_color}{RGB}{255,255,255}

%%%%%%% BOITES TEXTE %%%%%%%%%
%%%%%% SCHEMA %%%%%%%%
\newcommand{\schema}{
\setlength{\fboxsep}{5pt}
\setlength{\fboxrule}{2pt}
%\flushright{
\fcolorbox{mon_vert}{white}{\textcolor{mon_vert}{\sffamily \textbf{SCHEMA}}}
%}
\setlength{\fboxsep}{3pt}
\setlength{\fboxrule}{0.5pt}% standard
}

%%%%%%% EXPERIENCE (COURS) %%%%%%%%%
\newcounter{iexpecours}
\setcounter{iexpecours}{1}
%
\makeatletter % @ peut participer aux noms de fonctions
\newcommand{\expecours}[2][]{
\setlength{\fboxsep}{10pt}
\setlength{\fboxrule}{3pt}
	\begin{center}
	\fcolorbox{vertolive}{white}{ 
		\begin{minipage}{0.9\columnwidth}
		\textcolor{vertolive}{
		\@ifmtarg{#2}{% test si arg #1 est vide
		\textbf{\textsf{EXPERIENCE~\arabic{iexpecours}~:~{#1}}}
		}{
		\textbf{\textsf{EXPERIENCE~\arabic{iexpecours}~:~{#1}}}\\
		{\textsf{#2}}
		}
		}
		\end{minipage}%
	}
	\end{center}
	\addtocounter{iexpecours}{1}% incrémente le compteur 
\setlength{\fboxsep}{3pt}
\setlength{\fboxrule}{0.5pt}% standard
}
\makeatother % @ ne peut plus participer aux noms de fonctions

%%%%%%% PROJECTION (COURS) %%%%%%%%%
\newcounter{iproj}
\setcounter{iproj}{1}
%
\makeatletter % @ peut participer aux noms de fonctions
\newcommand{\projection}[2][]{
\setlength{\fboxsep}{10pt}
\setlength{\fboxrule}{3pt}
	\begin{center}
	\fcolorbox{bordeau}{white}{ 
		\begin{minipage}{0.9\columnwidth}
		\textcolor{bordeau}{
		\@ifmtarg{#2}{% test si arg #1 est vide
		\textbf{\textsf{PROJECTION~\arabic{iproj}~:~{#1}}}
		}{
		\textbf{\textsf{PROJECTION~\arabic{iproj}~:~{#1}}}\\
		{\textsf{#2}}
		}
		}
		\end{minipage}%
	}
	\end{center}
	\addtocounter{iproj}{1}% incrémente le compteur 
\setlength{\fboxsep}{3pt}
\setlength{\fboxrule}{0.5pt}% standard
}
\makeatother % @ ne peut plus participer aux noms de fonctions

%%%%%%% SIMULATION (COURS) %%%%%%%%%
\newcounter{isimul}
\setcounter{isimul}{1}
%
\makeatletter % @ peut participer aux noms de fonctions
\newcommand{\simulation}[2][]{
\setlength{\fboxsep}{10pt}
\setlength{\fboxrule}{3pt}
	\begin{center}
	\fcolorbox{violetpale}{white}{ 
		\begin{minipage}{0.9\columnwidth}
		\textcolor{violetpale}{
		\@ifmtarg{#2}{% test si arg #1 est vide
		\textbf{\textsf{SIMULATION~\arabic{isimul}~:~{#1}}}
		}{
		\textbf{\textsf{SIMULATION~\arabic{isimul}~:~{#1}}}\\
		{\textsf{#2}}
		}
		}
		\end{minipage}%
	}
	\end{center}
	\addtocounter{isimul}{1}% incrémente le compteur 
\setlength{\fboxsep}{3pt}
\setlength{\fboxrule}{0.5pt}% standard
}
\makeatother % @ ne peut plus participer aux noms de fonctions

%%%%%%% EQUATION (POLY A TROUS) %%%%%%%%%
\makeatletter % @ peut participer aux noms de fonctions
\newcommand{\eqholebox}[1]{
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{1pt}
	\begin{center}
	\fcolorbox{eqholebox_color}{white}{ 
		\begin{minipage}{0.97\linewidth}
		\@ifmtarg{#1}{~\vspace{1cm}	}{~\vspace{#1}}
%		~\vspace{{#1}cm}
		\end{minipage}%
	}
	\end{center}
\setlength{\fboxsep}{3pt}
\setlength{\fboxrule}{0.5pt}% standard
}
\makeatother % @ ne peut plus participer aux noms de fonctions


%%%%%%% LISTS %%%%%%%
% Itemize à la française (sans package babel...) - cf beamer "listes.pdf" par Bertrand Masson
%\setitemize[1]{label=--,itemsep=0pt}
%\setitemize[2]{label=--,itemsep=0pt}
%\setitemize[3]{label=--,itemsep=0pt}
% idem pour enumerate: \setenumerate[]{}...
% http://forum.mathematex.net/latex-f6/options-pour-itemize-t10815.html :
%\frenchbsetup{StandardItemLabels=true, CompactItemize=false,ReduceListSpacing=true}
%\renewcommand{\labelitemi}{--}

%%%%%%%%%
\makeatletter
\def\saveenum{\xdef\@savedenum{\the\c@enumi\relax}}
\def\resetenum{\global\c@enumi\@savedenum}
\makeatother

%%%%%%%%%%%%% ENUMERATED LISTS %%%%%%%%%%%%%
\renewcommand{\theenumi}{\arabic{enumi}.}
\renewcommand{\labelenumi}{\theenumi}
\renewcommand{\theenumii}{\alph{enumii})}
\renewcommand{\labelenumii}{\theenumii}

%%%%%%%%%%%%% LISTE D'ARGUMENTS (raisonnement/demo) %%%%%%%%%%%% 
\newenvironment{listargs}%
{ \begin{list}%
	{\ding{212}}%
	{\setlength{\labelwidth}{9pt}%
	 \setlength{\leftmargin}{15pt}%
	 \setlength{\itemsep}{\parsep}%{0pt}
	}
}%
{ \end{list} }


%%%%%%% Raccourcis écritures %%%%%%%%%%
\newcommand\C{\,\mathrm{{}^\circ C}}
\newcommand\an{application numérique}
\newcommand\An{Application numérique}


%%%%%%% TIKZ %%%%%%%
%% Circuits élec %%
%% Flèches non courbées, à l'allemande:
\makeatletter

\newif\ifpgf@circuit@germanvoltage
\ctikzset{voltage/german/.code = {\pgf@circuit@germanvoltagetrue } }

%% Output routine for generic bipoles

\def\pgf@circ@drawvoltagegeneric{
    \pgfextra{
        \ifnum \ctikzvalof{mirror value}=-1
                        \ifpgf@circuit@bipole@voltage@below\pgf@circuit@bipole@voltage@belowfalse\else\pgf@circuit@bipole@voltage@belowtrue\fi
        \fi

        \ifpgf@circuit@bipole@voltage@below
            \def\pgf@circ@voltage@angle{90}
        \else
            \def\pgf@circ@voltage@angle{-90} 
        \fi 

        \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node}
        \pgfkeysifdefined{\pgf@temp}
            { \edef\distacefromnode{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node}} }
            { \edef\distacefromnode{\ctikzvalof{voltage/distance from node}} }
        \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b}
        \pgfkeysifdefined{\pgf@temp}
            { \edef\bumpb{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b}} }
            { \edef\bumpb{\ctikzvalof{voltage/bump b}} }
    }

    coordinate (pgfcirc@mid) at ($(\tikztostart) ! \distacefromnode ! (\ctikzvalof{bipole/name}.left)$)
    coordinate (pgfcirc@Vfrom) at ($(pgfcirc@mid) ! -\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen ! \pgf@circ@voltage@angle:(\ctikzvalof{bipole/name}.left)$) 

    coordinate (pgfcirc@mid) at ($(\tikztotarget) ! \distacefromnode ! (\ctikzvalof{bipole/name}.right)$)
    coordinate (pgfcirc@Vto) at ($(pgfcirc@mid) ! \ctikzvalof{voltage/distance from line}\pgf@circ@Rlen ! \pgf@circ@voltage@angle : (\ctikzvalof{bipole/name}.right)$)

    \ifpgf@circuit@bipole@voltage@below
        coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
        coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
    \else
        coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
        coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
    \fi

    \ifpgf@circuit@germanvoltage
      \ifpgf@circuit@bipole@voltage@below
        coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.-120)$)
        coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.-60)$)
    \else
        coordinate (pgfcirc@Vcont1) at ($ (\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.120)$)
        coordinate (pgfcirc@Vcont2) at ($ (\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.60)$)
      \fi
    \fi

    \ifpgf@circuit@europeanvoltage
        \ifpgf@circuit@germanvoltage
          \ifpgf@circuit@bipole@voltage@backward
            (pgfcirc@Vcont2)  -- node[currarrow, sloped,  allow upside down, pos=1] {} (pgfcirc@Vcont1)
          \else
            (pgfcirc@Vcont1)  -- node[currarrow, sloped,  allow upside down, pos=1] {} (pgfcirc@Vcont2)
          \fi
        \else
          \ifpgf@circuit@bipole@voltage@backward
            (pgfcirc@Vto) .. controls (pgfcirc@Vcont2)  and (pgfcirc@Vcont1) .. 
                node[currarrow, sloped,  allow upside down, pos=1] {} 
            (pgfcirc@Vfrom) 
          \else
            (pgfcirc@Vfrom) .. controls (pgfcirc@Vcont1)  and (pgfcirc@Vcont2) ..
                node[currarrow, sloped,  allow upside down, pos=1] {}
            (pgfcirc@Vto)   
          \fi  
        \fi      
    \else
        \ifpgf@circuit@bipole@voltage@backward
            (pgfcirc@Vfrom) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{\scriptsize$+$}   
            (pgfcirc@Vto) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{$-$}
        \else
            (pgfcirc@Vfrom) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{\scriptsize$-$}   
            (pgfcirc@Vto) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{$+$}
        \fi 
    \fi
}
\makeatother
