% *******************************************

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{Commandes}[2011/08/28 Commandes de mise en forme LFB]

\newcommand{\scd}{Seconde 3}
\newcommand{\trois}{Troisième 5}
\newcommand{\preml}{Première L-ES}
\newcommand{\prems}{Première S4}
% \newcommand{\ts}{Terminale 7 S - 2010/2011}
% \newcommand{\tstg}{Terminale 8 STG - 2010/2011}

\RequirePackage{amsmath,amssymb,mathrsfs}
\RequirePackage{mathtools}

\RequirePackage[np]{numprint}


\newcommand{\ds}{\displaystyle}

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

%%%%%%%%%%% Intervalles %%%%%%%%%%%%
\newcommand{\intervalleOO}[2]{\left]{#1}\,{;}\,{#2}\right[}
\newcommand{\intervalleOF}[2]{\left]{#1}\,{;}\,{#2}\right]}
\newcommand{\intervalleFO}[2]{\left[{#1}\,{;}\,{#2}\right[}
\newcommand{\intervalleFF}[2]{\left[{#1}\,{;}\,{#2}\right]}

\newcommand{\couple}[2]{\left(#1\,{;}\,{#2}\right)}
\newcommand{\triplet}[3]{\left(#1\,{;}\,{#2}\,{;}\,{#3}\right)}


\newcommand{\calb}{\mathscr{B}}
\newcommand{\calc}{\mathscr{C}}
\newcommand{\cald}{\mathscr{D}}
\newcommand{\cale}{\mathscr{E}}
\newcommand{\calf}{\mathscr{F}}
\newcommand{\calp}{\mathscr{P}}
\newcommand{\cals}{\mathscr{S}}
\newcommand{\calt}{\mathscr{T}}

%%%%%%%%%%%% Vecteurs %%%%%%%%%%%%%%%
\RequirePackage[e]{esvect}
\newcommand{\vect}[1]{\vv{#1}}
\newcommand{\repere}[3]{\left(#1\,{;}\,\vect{#2}{,}\,\vect{#3} \right)}
\newcommand{\oij}{\repere{O}{\imath}{\jmath}}
\newcommand{\ouv}{\repere{O}{u}{v}}

\newcommand{\reperetd}[4]{\left(#1\,{;}\,\vect{#2}{,}\,\vect{#3}{,}\,\vect{#4} \right)}

\newcommand{\oijk}{\reperetd{O}{\imath}{\jmath}{k}}
\newcommand{\barre}[1]{\overline{#1\rule{0.1em}{0ex}}}
\newcommand{\norme}[1]{\left\lVert#1\right\rVert}

%%%%%%%%%%% Barycentres %%%%%%%%%%%%
\newcommand{\bard}[2]{%
                   \text{Bar}\left\{\left( #1 \right);\left( #2 \right)\right\}}
\newcommand{\bart}[3]{%
                   \text{Bar}\left\{\left( #1 \right);\left( #2 \right);\left( #3 \right)\right\}}

\newcommand{\barq}[4]{%
                   \text{Bar}\left\{\left( #1 \right);\left( #2 \right);\left( #3 \right);\left( #4 \right)\right\}}

%%%%%%%%%%% Suites %%%%%%%%%%%%
\newcommand{\suite}[1][u]{\left( #1_{n} \right)_{n\in\N}}
\newcommand{\suitep}[1][u]{\left( #1_{n} \right)_{n\in\N^{*}}}
\newcommand{\suiteno}[2][u]{\left( #1_{n} \right)_{n\geqslant#2}}


%%%%%%%%%%% Limites %%%%%%%%%%%%
\newcommand{\limn}{\ds\lim_{n\rightarrow +\infty}}
\newcommand{\limo}[1][x]{\ds\lim_{#1\rightarrow 0}}
\newcommand{\limite}[2][x]{\ds\lim_{#1\rightarrow #2}}
\newcommand{\limpinf}[1][x]{\ds\lim_{#1\rightarrow +\infty}}
\newcommand{\limminf}[1][x]{\ds\lim_{#1\rightarrow -\infty}}
\newcommand{\limiteg}[2][x]{\ds\lim_{#1\xrightarrow{<}#2}}
\newcommand{\limited}[2][x]{\ds\lim_{#1\xrightarrow{>}#2}}

%%%%%%%%%%%%% Intégrales %%%%%%%%%%%%%
\newcommand*\Int[4][x]{\int_{#2}^{#3} #4 \, \mathrm{d}#1}
\newcommand*\dInt[4][x]{\ds\int_{#2}^{#3} #4 \, \mathrm{d}#1}


\newcommand{\redlim}[2]{%
         \left.%
         \begin{aligned}
         #1 \\
         #2
         \end{aligned}
         \right\rbrace}
         
   
%%%%%%%%%%%% Coordonnées %%%%%%%%%%%%%%%
\newcommand{\cp}[2]{%
        \begin{pmatrix}
        #1\\
        #2
        \end{pmatrix}%
        }

\newcommand{\ce}[3]{%
        \begin{pmatrix}
        #1\\
        #2\\
        #3
        \end{pmatrix}%
        }

\newcommand{\smallce}[3]{%
        \left(\begin{smallmatrix}
        #1\\
        #2\\
        #3
        \end{smallmatrix}%
        \right)}

%%%%%%%%%%%% Systèmes %%%%%%%%%%%%%%%
\newcommand{\sysd}[2]{%
       \left\{
       \begin{aligned}
          #1\\
          #2\\
       \end{aligned}
       \right.%
       }

\newcommand{\coefsysd}[2]{%
        \left|%
        \begin{aligned}
        &\times #1\\
        &\times #2
        \end{aligned}
        \right.%
}
\newcommand{\syst}[3]{%
       \left\{
       \begin{aligned}
          #1\\
          #2\\
          #3\\
       \end{aligned}
       \right.%
       }

\newcommand{\sysq}[4]{%
       \left\{
       \begin{aligned}
          #1\\
          #2\\
          #3\\
          #4\\
       \end{aligned}
       \right.%
       }


%%%%%%%%%%%% Complexes %%%%%%%%%%%%%%%
\AtBeginDocument{\renewcommand{\i}{\mathrm{i}}}
\renewcommand{\Re}{\operatorname{Re}}
\renewcommand{\Im}{\operatorname{Im}}

%%%%%%%%%%%% Divers %%%%%%%%%%%%%%%
\newcommand{\e}{\mathrm{e}}
%
\DeclareMathOperator{\card}{Card}
\DeclareMathOperator{\ch}{ch}
\DeclareMathOperator{\sh}{sh}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% Algorithmes %%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RequirePackage[french,ruled,lined,linesnumbered,inoutnumbered]{algorithm2e}

\SetKwInput{Lire}{Lire}
\SetKwInput{Afficher}{Afficher}

\SetKwFor{VarAlgo}{Variables}{}{finVariables}
\newcommand{\Variables}[1]{\SetAlgoVlined%
                           \VarAlgo{}{#1}
                           \SetAlgoLined}

\SetKwFor{EntrAlgo}{Entrées}{}{fin}
\newcommand{\Entrees}[1]{\SetAlgoVlined%
                           \EntrAlgo{}{#1}
                           \SetAlgoLined}

\SetKwFor{TraitAlgo}{Traitement}{}{fin}
\newcommand{\Traitement}[1]{\SetAlgoVlined%
                           \TraitAlgo{}{#1}
                           \SetAlgoLined}

\SetKwFor{SortAlgo}{Sorties}{}{fin}
\newcommand{\Sorties}[1]{\SetAlgoVlined%
                           \SortAlgo{}{#1}
                           \SetAlgoLined}
\newsavebox{\LFB@lgo}

\newenvironment{algoLFB}[2][1]%
               {\setlength{\fboxsep}{0pt}\begin{lrbox}{\LFB@lgo}
               \small\begin{minipage}{#1\linewidth}%
                \begin{algorithm}[H]%
                \caption{#2}}%
               {\end{algorithm}%
                \end{minipage}%
                \end{lrbox}%
                \begin{center}
                \fcolorbox{black}{LFBcoultable1}{\usebox{\LFB@lgo}}
%                \fcolorbox{LFBcoultable2}{LFBcoultable1}{\usebox{\LFB@lgo}}
                \end{center}}

\newcommand{\recoit}{\ensuremath{\leftarrow}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% Tableaux %%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{tabularx}
\RequirePackage{array}
\RequirePackage{cellspace}
%\RequirePackage{arydshln}
\RequirePackage{hhline}
%\RequirePackage{slashbox}

\newcolumntype{M}{>{\columncolor{LFBcoultable1}\centering\arraybackslash}m{6ex}}
\renewcommand{\tabularxcolumn}[1]{>{\arraybackslash}m{#1}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% Tableurs %%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Environnement OOocalc
%%% Auteur : Christian Tellechea
%%% Provenance : Doc de spreadtab
%\RequirePackage{xcolor}
\newcount\cntlin
\newcount\cntcol

\newtoks\t@b
\long\def\ifremain@lines#1\\#2\@nil{%
        \csname @\ifx\@empty#2\@empty second\else first\fi oftwo\endcsname}
\long\def\subst@eol#1\\#2\@nil{\addtot@b{#1\\\cline{1-1}\hdashline}%
        \ifremain@lines#2\\\@nil{\addtot@b&\subst@eol#2\@nil}{\addtot@b{#2\end{tabular}}}}
\long\def\mycollect@body#1\end{\subst@eol#1\@nil\end}

\newcommand\addtot@b[1]{\t@b\expandafter{\the\t@b#1}}
\newcommand\edftot@b[1]{\edef\temp@{#1}\expandafter\addtot@b\expandafter{\temp@}}

\newenvironment{OOocalc}[2][1.5cm]{% #1=largeur colonnes #2 = nombre de colonnes
        \newcolumntype w{>{\centering\arraybackslash}m{#1}}%
        \arrayrulewidth0.4pt\dashlinedash0.4pt\relax\dashlinegap3pt
        \global\cntlin\m@ne\global\cntcol\z@
        \tabfont
        \tabcolsep0pt
        \t@b{\begin{tabular}{%
                |>{\cellcolor{tabheadcolor}%
                        \global\cntcol\z@\global\advance\cntlin\@ne
                        \centering\arraybackslash
                        \ifnum\cntlin>\z@\tableheadformat\number\cntlin\fi}
                m{2em}|*{#2}{w:}}%
                \hline
                \rowcolor{tabheadcolor}}%
        \loop
                \ifnum\cntcol<#2
                        \advance\cntcol\@ne
                        \addtot@b{&\multicolumn{1}{>\centering m{#1}|}}%
                        \edftot@b{{\noexpand\tableheadformat\@Alph\cntcol}}%
        \repeat
        \addtot@b{\\\hline&}%
        \mycollect@body}{\the\t@b}

% commandes de personnalisation de OOcalc
\@ifpackageloaded{xcolor}%
         {}
         {\RequirePackage[svgnames,table]{xcolor}}
\newcommand*\tabfont{\fontfamily{phv}\selectfont\footnotesize}% police du tableau (helvetica ici)
\newcommand*\tableheadformat{\bfseries}% police des en-têtes du tableau (en gras)
\colorlet{tabheadcolor}{gray!40}% couleur de font des en-têtes du tableau
\colorlet{palepink}{pink!80}
\colorlet{lightpink}{pink!30}
\colorlet{palegreen}{green!60}
\colorlet{lightgreen}{green!30}
\newcommand\CC[1]{\cellcolor{#1}}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% Divers %%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%% caption %%%%%%%%%%

\RequirePackage{caption}
\renewcommand{\thefigure}{\arabic{figure}}
\renewcommand{\thetable}{\arabic{table}}


%%%%%%%%%%%% tableaux var %%%%%%%%%%
\RequirePackage{tkz-tab}


%%%%%%%%%%%% Dés %%%%%%%%%%
\RequirePackage{epsdice}

\newcommand{\kmh}{\ensuremath{\textrm{km.h}^{-1}}}


%%%%%%%%%%%%% Mots Cachés %%%%%%%%%%%%%%%
\RequirePackage[normalem]{ulem}

\colorlet{bg}{white}
\colorlet{coulrep}{blue}
\colorlet{coulcache}{bg}

\newif\ifmotsvisibles
\motsvisiblesfalse


\newcommand{\cache}[1][coulcache]{\bgroup\color{#1}\markoverwith
                   {\textcolor{black}{\rule[-0.2ex]{3pt}{0.4pt}}%
                    \textcolor{bg}{\rule[-0.2ex]{2pt}{0.4pt}}%
                    }\ULon}

\newcommand{\motcache}[1]{%
                       \ifmotsvisibles
                            \colorlet{op@coulmots}{coulrep}
                       \else
                            \colorlet{op@coulmots}{bg}
                       \fi
                        \ifmmode%
                          \mbox{\begin{Large}\cache[op@coulmots]{$#1$}\end{Large}}%
                        \else%
                          \begin{Large}\cache[op@coulmots]{#1}\end{Large}%
                        \fi}%


% \colorlet{opcoultexte}{blue}

\newenvironment{repcache}{%
                          \ifmotsvisibles
                            \colorlet{opcoultexte}{coulrep}
                         \else
                            \colorlet{opcoultexte}{bg}
                         \fi
                         \begin{repex}
                          }{%
                          \end{repex}
                          }
                          
                          
\newcommand{\motdef}[1]{\textcolor{LFBcouleur5}{\textbf{#1}}}                          
\newcommand{\motimp}[1]{\textcolor{LFBcouleur5}{\textbf{#1}}}