\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{monpatchwork}[07/09/2021 Mon premier patchwork]

% https://www.overleaf.com/latex/templates/lecture-outline-template/zprvgkrcwhmv

\usepackage[dvipsnames]{xcolor}

\usepackage{amsmath, amsthm, amssymb, amsfonts, calrsfs, wasysym, verbatim, bbm, color, graphics, geometry, tcolorbox, graphicx, frcursive, mathtools, array, boldline, cancel, listings}
\geometry{tmargin=.75in, bmargin=.75in, lmargin=.75in, rmargin = .75in}

\setlength{\parindent}{0pt}
\let\phi\varphi

% Mémo : matrix, pmatrix, bmatrix, Bmatrix, vmatrix, Vmatrix
% None, parentheses, brackets, curly brackets, vertical, 2x vertical bar

%%%%%%% INDEX %%%%%%

\usepackage[style=numeric,citestyle=numeric,sorting=nyt,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}
\usepackage{calc, makeidx, titletoc, hyperref, bookmark, mathptmx}
\makeindex
\hypersetup{hidelinks,backref=true,pagebackref=true,hyperindex=true,colorlinks=false,breaklinks=true,urlcolor=bleu,bookmarks=true,bookmarksopen=false}
\usepackage{bookmark}
\bookmarksetup{open, numbered, addtohook={\ifnum\bookmarkget{level}=0 \bookmarksetup{bold} \fi \ifnum\bookmarkget{level}=-1 \bookmarksetup{color=bleu,bold} \fi } }


%%%%%%% RACCOURCIS %%%%%%

\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\K}{\mathbb{K}}
\newcommand{\pnt}{\boldsymbol{\cdot}}
\newcommand{\vect}{\overrightarrow}
\newcommand{\circonf}{\mathbin{\char`\^}}
\newcommand{\grandefleche}{\longrightarrow}
\newcommand{\fleche}{\rightarrow}
\newcommand{\fleched}{\leftarrow}
\newcommand{\traitfleche}{\longmapsto}
\newcommand{\inclu}{\subset}
\newcommand{\noninclu}{\not\subset}
\newcommand{\appartient}{\in}
\newcommand{\appartientpas}{\not\in}
\newcommand{\different}{\neq}
\newcommand{\inter}{\cap}
\newcommand{\union}{\cup}
\newcommand{\infini}{\infty}
\newcommand{\incluegal}{\subseteq}
\newcommand{\inclupasegal}{\subsetneq}
\newcommand{\rond}{\circ}
\newcommand{\doublefleche}{\longleftrightarrow}
\newcommand{\equivalent}{\Leftrightarrow}
\newcommand{\implique}{\implies}
\newcommand{\supeq}{\ge}
\newcommand{\infeq}{\le}
\newcommand{\diff}{\ne}
\newcommand{\pourtout}{\forall}
\newcommand{\ilexiste}{\exists}
\newcommand{\equival}{\Leftrightarrow}
\newcommand{\moins}{\backslash}
\newcommand{\congru}{\equiv}
\newcommand{\environ}{\simeq}
\newcommand{\plusmoins}{\pm}
%\newcommand{\tilde}{\sim}
\newcommand{\espace}{\qquad}
\newcommand{\vectoriel}{\wedge}
\newcommand{\scalaire}{\wedge} % Compatibilité uniquement
\newcommand{\prop}{\propto}
\newcommand{\pr}{\oplus}
\newcommand{\incluenvers}{\supset}
\newcommand{\ssi}{\textit{ssi }}



\newcommand{\chapeau}[1]{\widehat{#1}}
\newcommand{\gras}[1]{\textbf{#1}}
\newcommand{\italique}[1]{\textit{#1}}
\newcommand{\souligne}[1]{\underline{#1}}
\newcommand{\sous}[2]{\underset{#2}{#1}}
\newcommand{\sur}[2]{\overset{#1}{#2}}
\newcommand{\centrer}[1]{$$\text{{#1}}$$}
\newcommand{\barre}[1]{\overline{#1}}
\newcommand{\cpl}[1]{\underline{#1}} % Complexe
\newcommand{\joli}[1]{\textcursive{#1}}
\newcommand{\ch}[1]{\left[#1\right]}
\newcommand{\chff}[1]{\left[#1\right]}
\newcommand{\chfo}[1]{\left[#1\right[}
\newcommand{\chof}[1]{\left]#1\right]}
\newcommand{\choo}[1]{\left]#1\right[}
\newcommand{\systeme}[1]{$\left \{\begin{array}{l}#1\end{array}\right.$}
\newcommand{\systemd}[1]{$\left|\begin{array}{l}#1\end{array}\right.$}
\newcommand{\parmi}[2]{\left(\begin{array}{rcl}#1\\#2\end{array}\right)}
\newcommand{\vecteur}[1]{\left(\begin{array}{rcl}#1\end{array}\right)}
\newcommand{\integrale}[4]{\(\int_{#1}^{#2} #3 \,#4\)}
\newcommand{\matrice}[1]{\begin{pmatrix}#1\end{pmatrix}}




\newcommand{\img}[2]{\includegraphics[width=#2]{Annexes/#1}}


\newcommand{\imgtxt}[2]{\begin{minipage}{.35\textwidth}\includegraphics[width=\textwidth]{Annexes/#1}\end{minipage}\hfill\begin{minipage}{.6\textwidth}#2\end{minipage}}

\newcommand{\txtimg}[2]{\begin{minipage}{.6\textwidth}#1\end{minipage}\hfill\begin{minipage}{.35\textwidth}\includegraphics[width=\textwidth]{Annexes/#2}\end{minipage}}

\newcommand{\txtimgp}[4]{\begin{minipage}{#3}#1\end{minipage}\hfill\begin{minipage}{#4}\includegraphics[width=\textwidth]{Annexes/#2}\end{minipage}}

\newcommand{\txttxt}[2]{
\begin{minipage}{.5\textwidth}#1
\end{minipage}
\hfill
\begin{minipage}{.5\textwidth}#2
\end{minipage}}

\newcommand{\txttxtp}[4]{\begin{minipage}{#3}#1\end{minipage}\hfill\begin{minipage}{#4}#2\end{minipage}}





\newtheorem{thm}{Théorème}
\newtheorem{defn}{Définition}
\newtheorem{conv}{Convention}
\newtheorem{rem}{Remarque}
\newtheorem{lem}{Lèmme}
\newtheorem{cor}{Corollaire}

%%%%%%% BOITES & COULEURS %%%%%%

\definecolor{jaune}{RGB}{248, 194, 145}
\definecolor{bleu}{RGB}{34, 166, 179}
\definecolor{rouge}{RGB}{215, 56, 104}
\definecolor{vert}{RGB}{22, 160, 133}
\definecolor{gris}{RGB}{52, 73, 94}

\DeclareOption{imprimante}{
    % ...
}\ProcessOptions\relax

\newtcolorbox{jaune}[1]{colback=white,colframe=jaune,fonttitle=\bfseries,title=#1}
\newtcolorbox{bleu}[1]{colback=white,colframe=bleu,fonttitle=\bfseries,title=#1}
\newtcolorbox{rouge}[1]{colback=white,colframe=rouge,fonttitle=\bfseries,title=#1}
\newtcolorbox{verte}[1]{colback=white,colframe=vert,fonttitle=\bfseries,title=#1}
\newtcolorbox{gris}[1]{colback=white,colframe=gris,fonttitle=\bfseries,title=#1}


%%%%%%%% STABILO %%%%%%%%%

\usepackage{soul}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathmorphing}

\makeatletter

\newcommand{\defhighlighter}[3][]{%
  \tikzset{every highlighter/.style={color=#2, fill opacity=#3, #1}}%
}

\defhighlighter{red}{.5}

\newcommand{\stabilo@DoHighlight}{
  \fill [ decoration = {random steps, amplitude=0.5pt, segment length=15pt}
        , outer sep = -15pt, inner sep = 0pt, decorate
        , every highlighter, this highlighter ]
        ($(begin stabilo)+(0,8pt)$) rectangle ($(end stabilo)+(0,-3pt)$) ;
}

\newcommand{\stabilo@BeginHighlight}{
  \coordinate (begin stabilo) at (0,0) ;
}

\newcommand{\stabilo@EndHighlight}{
  \coordinate (end stabilo) at (0,0) ;
}

\newdimen\stabilo@previous
\newdimen\stabilo@current

\DeclareRobustCommand*\stabilo[1][]{%
  \tikzset{this highlighter/.style={#1}}%
  \SOUL@setup
  %
  \def\SOUL@preamble{%
    \begin{tikzpicture}[overlay, remember picture]
      \stabilo@BeginHighlight
      \stabilo@EndHighlight
    \end{tikzpicture}%
  }%
  %
  \def\SOUL@postamble{%
    \begin{tikzpicture}[overlay, remember picture]
      \stabilo@EndHighlight
      \stabilo@DoHighlight
    \end{tikzpicture}%
  }%
  %
  \def\SOUL@everyhyphen{%
    \discretionary{%
      \SOUL@setkern\SOUL@hyphkern
      \SOUL@sethyphenchar
      \tikz[overlay, remember picture] \stabilo@EndHighlight ;%
    }{%
    }{%
      \SOUL@setkern\SOUL@charkern
    }%
  }%
  %
  \def\SOUL@everyexhyphen##1{%
    \SOUL@setkern\SOUL@hyphkern
    \hbox{##1}%
    \discretionary{%
      \tikz[overlay, remember picture] \stabilo@EndHighlight ;%
    }{%
    }{%
      \SOUL@setkern\SOUL@charkern
    }%
  }%
  %
  \def\SOUL@everysyllable{%
    \begin{tikzpicture}[overlay, remember picture]
      \path let \p0 = (begin stabilo), \p1 = (0,0) in \pgfextra
        \global\stabilo@previous=\y0
        \global\stabilo@current =\y1
      \endpgfextra (0,0) ;
      \ifdim\stabilo@current < \stabilo@previous
        \stabilo@DoHighlight
        \stabilo@BeginHighlight
      \fi
    \end{tikzpicture}%
    \the\SOUL@syllable
    \tikz[overlay, remember picture] \stabilo@EndHighlight ;%
  }%
  \SOUL@
}
\makeatother
