\usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math}
\usepackage[math-style=french,Scale=0.98]{fourier-otf}

\defaultfontfeatures{Renderer=HarfBuzz}

\setmathfont{STIXTwoMath}[range={scr,\blacktriangledown},Scale=MatchUppercase]

\newfontfamily\myfontScratch[Scale=0.725]{DejaVu Sans}
\newfontfamily\myfontCursive{QTBrushStroke}

\usepackage{imakeidx}
\makeindex
\makeindex[columns=3,name=cle,title=Index des clés]

\usepackage{lipsum}
%
\makeatletter
\let\mygobble\@gobble
\makeatother
%
\makeatletter
\renewcommand*\l@section[2]{%
  \ifnum \c@tocdepth >\z@
    \addpenalty\@secpenalty
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{2em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil
      \nobreak\hb@xt@\@pnumwidth{\hss #2%
                                 \kern-\p@\kern\p@}\par
    \endgroup
  \fi}
%Si on veut pousser la numérotation des chapitres vers la droite.
%\renewcommand*\numberline[1]{%
%  \hb@xt@\@tempdima{\hfil#1 }%
%}
\makeatother
%
\usepackage{mflogo}

\usepackage[margin=2cm,nohead,includefoot]{geometry}

\newlength{\PfCLargeurTableau}

\newlength{\appui}
\setlength{\appui}{-20pt}

\newlength{\lnttxt}
\newcommand\dispo[3]{
\setlength{\lnttxt}{\linewidth}
\setbox#1=\hbox{#2}
\addtolength{\lnttxt}{-\wd#1}
\addtolength{\lnttxt}{\appui}
\begin{minipage}{\wd#1}
#2
\end{minipage}
\hfill
\begin{minipage}{\lnttxt}
#3
\end{minipage}
}

\tcbset{%
  tikzcle/.style={%
    before skip=1em,%
    enhanced,%
    breakable,%
    colback=Cornsilk,%
    colframe=black,%
  }%
}%

\tcbset{%
  tikzexemple/.style={%
    before skip=1em,
    enhanced,
    breakable,
    colback=LightSteelBlue,
    colframe=black,
  }
}

\title{%
  \begin{minipage}{0.75\linewidth}
    \begin{tcolorbox}[colframe=myyellow,colback=myyellow!45]
      \begin{center}
          \begin{tabular}{c}
    \lstinline!ProfCollege!\\
    \\
    Une aide pour utiliser \LaTeX{} au collège
  \end{tabular}
      \end{center}
    \end{tcolorbox}
  \end{minipage}
}
\author{
  \begin{tabular}{c}
    Christophe {\sc Poulain}\\
    {\ttfamily chr poulain -- at -- gmail . com}
  \end{tabular}
}
\date{Version \PfCfileversion\space -- \PfCfiledate}

\usepackage{graphicx}
\graphicspath{{figures/}}

\usepackage{lscape}

\usepackage{listings}

\lstset{%
  classoffset = 0,%
    language     = [LaTeX]TeX,%
    basicstyle   = \ttfamily,%
    breaklines = true,%
    commentstyle =\color{gray},%
    columns=fullflexible,%
    keepspaces,
    frame=tb,%
    %texcsstyle=*\color{blue},%pour colorer la contre-oblique
    morekeywords={\\Distri,\\Pythagore,\\SommeAngles,\\Resultat,\\Thales,\\Trigo,\\RedactionTrigo,\\Stat,\\EffectifTotal,\\Etendue,\\Moyenne,\\Mediane,\\QuartileUn,\\QuartileTrois,\\ResolEquation,\\FlechesPH,\\FlechesPB,\\FlechesPD,\\FlechesPG,\\FlechePCG,\\FlechePCD,\\FlechePCH,\\FlechePCB,\\FlecheCoef,\\FlecheCoefDebut,\\FlecheLineaireH,\\FlecheLineaireB,\\FlecheLineaireD,\\FlecheLineaireG,\\FonctionAffine,\\Fonction,\\Proba,\\Reperage,\\Pourcentage,\\ProprieteDroites,\\ResultatPytha,\\NomTriangle,\\NomSommetA,\\NomSommetB,\\NomSommetC,\\NomA,\\NomB,\\NomC,\\NomAngleDroit,\\RedactionSomme,\\RedactionPythagore,\\RedactionCalculsPythagore,\\RedactionReciPythagore,\\RedactionCalculsReciPythagore,\\RedactionCalculsPythagore,\\RedactionConclusionReciPythagore,\\RedactionThales,\\NomPointA,\\NomPointB,\\NomPointC,\\NomPointM,\\NomPointN,\\ResultatTrigo,\\ResultatThalesx,\\ResultatThalesy,\\ResultatThalesz,\\Puissances,\\Relie,\\QCM,\\QCMPfC,\\QFlash,\\Fraction,\\Tableau,\\Simplification,\\Decomposition,\\Formule,\\Propor,\\ResultatPourcentage,\\ResultatAngle,\\Ratio,\\FlecheRatio,\\FlecheInvRatio,\\pointilles,\\Lignespointilles,\\Calculatrice,\\Tables,\\Radar,\\Jauge,\\Labyrinthe,\\Lg,\\Aire,\\Vol,\\MasseVol,\\Vitesse,\\Masse,\\Capa,\\Octet,\\Conso,\\Temps,\\Temp,\\BoiteFlash,\\Rangement,\\Demain,\\MultiCol,\\Cartes,\\Dominos,\\Papiers,\\Prix,\\LabyNombre,\\DessinGradue,\\Colorilude,\\ColoriludeEnonce,\\ColoriludeListeCouleur,\\Quisuisje,\\QuisuisjeEnonce,\\QuisuisjeTableau,\\QuisuisjeCodePerso,\\Autonomie,\\BonSortie,\\PyramideNombre,\\ProgCalcul,\\MotsEmpiles,\\Mosaique,\\DessineMosaique,\\MotsCodes,\\MotsCodesTableau,\\Ecriture,\\FractionDecimale,\\Triomino,\\Rapido,\\BoiteRapido,\\Cartographie,\\Addition,\\MultiAddition,\\Soustraction,\\Multiplication,\\Division,\\DivisionD,\\AdditionColore,\\SoustractionColore,\\MultiplicationColore,\\DefiTable,\\DefiTableTexte,\\FicheMemo,\\ModeleBarre,\\MotsCroises,\\Enquete,\\ListePersonnages,\\ListeObjets,\\ListeLieux,\\ListeQuestions,\\AffichageQuestions,\\AffichageTableau,\\CourseNombre,\\Frise,\\ChoixAlea,\\VariableAlea,\\RepresenterEntier,\\Billard,\\PQuatre,\\RoseMul,\\Yohaku,\\PixelArt,\\KenKen,\\Kakuro,\\Shikaku,\\CalculsCroises,\\Mentalo,\\NombreAstral,\\CompteBon,\\Engrenages,\\CodageRLE,\\VueCubes,\\Tortue,\\CNReponse,\\Solide,\\BarresCalculs,\\EnigmeAire,\\Calisson,\\Tectonic,\\PuzzlePyramide,\\MessageCache,\\RondeInfernale,\\Futoshiki,\\Garam,\\SquarO,\\Grades,\\MidPoint,\\Kakurasu,\\DecompositionDecimale,\\PfCCardsEcartH,\\PfCCardsEcartV,\\Factorisation,\\AddFraction,\\SousFraction,\\MulFraction,\\DivFraction,\\PfCTexteJai,\\PfCTexteJesuis,\\PfCTexteQuia,\\Trio,\\TrioCourt,\\DefiRangement,\\Nonogramme,\\Pavage,\\GlisseNombre,\\Dobble,\\Erathostene,\\Patron,\\BoiteCartes,\\NumberHive,\\Automatismes,\\PyraVoca,\\LectureGraphique,\\PfCChoixImage,\\PfCChoixAntecedent,\\Cible,\\PuzzleMul,\\Horloge,\\ReperageZoom,\\Grimuku,\\TableauMultiplicatif,\\DefiCalculatrice,\\CryptarithmeAdd,\\CryptarithmeMAdd,\\CryptarithmeSous,\\CryptarithmeMul,\\CryptarithmeDiv,\\MulJaponaise,\\Fubuki,\\MelangeLettres,\\CibleQuatreOperations,\\MulJalousie,\\FractionAireCarre,\\Horaire,\\FractionNombre,\\Serpent,\\Maya,\\Babylone,\\Chinoise,\\VisualPattern,\\Bonbon,\\DessinAlgo,\\Jeton,\\Lego,\\Critere,\\Eratosthene,\\PointsSuspension,\\Convertir,\\PfCSymbolTimes,\\PfCSymbolDiv,\\NeComptePasPoints,\\PfCNbSolutionH,\\PfCNbSolutionV,\\PfCNbSolutionDD,\\PfCNbSolutionDM,\\LogoRecyclage,\\TicketCaisse,\\AssemblageSolides,\\ArbreChiffre,\\VisualisationMulDecimaux,\\ArbreCalcul,\\ProbaFrequence,\\SchemaProba,\\ListeACompleter,\\CalculDetaille,\\Cheque},%\\cellcolor,\\multido,\\ang,
    alsoletter={5\\},%
    keywordstyle=\color{blue},%
    emph=[1]{ProfCollege,siunitx,mathtools,amssymb,multicol,xcolor,xlop,xfp,modulus,simplekv,ifthen,xstring,xinttools,xintexpr,gmp,tikz,hhline,environ,datatool,iftex,microtype,fontawesome5,frame,Mind,Bulle,bclogo,alphalph,pdflscape,gridpapers,scratch3,sesamanuel,enumitem,tcolorbox,verbatim,luamplib,listofitems,multido,suffix,longtable,stackengine,cancel,pifont,nicematrix,fmtcount,ifoddpage,luacas,Geometrie,Tableur,Scratch,Allumettes,Facebook,Twitter,Snapchat,Instagram,Mastodon},%
    emphstyle=[1]{\color{DodgerBlue}},%
    emph=[3]{beamer},%
    emphstyle=[3]{\color{Crimson}},%
    classoffset=1,%
    keywords={Ecran,Decimaux,PuissancesSeules,Entiers,Prefixes,Millions,Milliards,Partie,CouleurG,CouleurM,Couleurm,Couleuru,Couleurd,Incline,Classes,Micro,Nano,NbLignes,Virgule,Nombres,Puissances,Metre,Carre,CarreA,Are,Cube,CubeA,Octet,Capacite,Colonnes,Litre,Gramme,Fleches,FlechesH,FlechesB,Solution,LargeurG,LargeurD,Ecart,Stretch,Alterne,Reponses,Largeur,Titre,Nom,Alph,AlphT,Couleur,VF,Depart,NomV,NomF,Noms,Simple,Kahout,Intrus,Numeration,Decimal,Mental,Expression,Daily,Mesure,Heure,Numerique,Seul,Pause,Hauteur,Evaluation,Aire,Surface,Perimetre,Volume,Solide,Ancre,Angle,Soustraction,Perso,Reciproque,ReciColonnes,Faible,Egalite,Exact,Entier,Racine,Precision,Unite,Figure,FigureSeule,ValeurA,ValeurB,ValeurC,EnchaineA,EnchaineB,EnchaineC,AvantRacine,Detail,Isocele,Droites,Segment,Propor,IntroCalculs,Figurecroisee,FigurecroiseeSeule,ChoixCalcul,CouleurNum,CouleurDen,Cosinus,Sinus,Tangente,Num,CitePropriete,Brouillon,Remediation,AffichageNom,DemiDroite,Unitex,Unitey,Unitez,Pasx,Pasy,Pasz,ValeurOrigine,ValeurUnitex,ValeurUnitey,Plan,Trace,ListeSegment,AffichageCoord,AffichageGrad,AffichageAbs,LectureCoord,Espace,EchelleEspace,Sphere,AnglePhi,Tableau,TableauVertical,TableauVerticalVide,Dot,Potence,Exposant,Longue,All,AllNombre,Arbre,ArbreComplet,ArbreVide,ArbreDessine,ArbreDessineVide,Entoure,CouleurTronc,CouleurFeuillage,CouleurFruits,Diviseurs,DiviseursT,Disque,Rectangle,Regulier,Eprouvette,Reponse,Rayon,Cotes,Hachures,Triangle,Parts,Longueur,Multiple,Contraire,Details,Vertical,GrandeurA,GrandeurB,Math,CouleurTab,Appliquer,Decimal,Fractionnaire,Concret,Augmenter,AideTableau,Reduire,MotReduction,Formule,Calculer,Qualitatif,Donnee,TableauVide,Effectif,Frequence,PrecisionF,Angle,SemiAngle,Batons,Lecture,LectureFine,AideLecture,DonneesSup,AngleRotationAbscisse,AffichageDonnees,AffichageAngle,ListeCouleurs,ListeCouleursB,AbscisseRotation,LectureInverse,EcartHachures,EpaisseurHachures,EpaisseurBatons,CouleurDefaut,LegendesVides,Bicolore,Graphique,EffectifTotal,SET,Etendue,Mediane,Moyenne,MoyenneA,ValeurExacte,Total,Origine,ECC,Histogramme,UniteAire,DepartHisto,Liste,Sondage,EffVide,ColVide,CasesVides,AngVide,ECCVide,FreqVide,TotalVide,Coupure,Echelle,LongueurEchelle,Grille,Affichage,Arbre,Branche,Angle,Definition,Ecriture,Image,Ligne,ProgCalcul,Variable,Antecedent,Retrouve,Redaction,VoirCoef,ACoef,Calcul,Etape,NomExpression,Fin,CouleurFH,CouleurFB,AideMul,AideAdda,AideAddb,Reduction,CouleurReduction,CouleurAide,Somme,Difference,RAZ,Oppose,Remarquable,Echange,Tuile,Vide,Simplification,Lettre,LettreSol,Verification,Nombre,Egalite,Decomposition,CouleurSous,Ecart,FlecheDiv,Pose,Terme,CouleurTerme,Composition,CouleurCompo,Symbole,CouleurSymbole,Bloc,Produit,Facteurs,Pointilles,CTrace,Epaisseur,CFond,Equivalence,Laurent,TexteTotal,TextePart,CouleurUn,CouleurDeux,CouleurTrois,FigureCours,Debut,Seul,Addition,Reference,Pas,Disciplines,MoyenneClasse,TexteOrigine,TexteReference,CouleurBarre,CouleurFond,Graduation,CouleurGraduation,Niveau,LimiteR,LimiteV,CouleurF,Passages,EcartH,EcartV,Logo,SensImpose,Lignes,Decroissant,Strict,Fraction,LargeurUn,Bandeau,Cellule,Colonne,PasL,PasC,Landscape,Trame,TrameVisible,RayonArc,Jointes,Theme,ThemeJaiQuiA,NomTitre,Loop,Trivial,JaiQuia,Marge,ThemeSol,BackgroundAv,BackgroundAr,ImageAv,ImageAr,Ratio,Superieur,Cinq,Seyes,Isometrique,IsometriquePointe,GrillePointe,Millimetre,PageEntiere,ZoneTexte,Numerotation,Impression,Naturel,Points,Catmull,Splines,Lagrange,PasX,PasY,UniteX,UniteY,Tangentes,Prolonge,Xmax,Xmin,Ymax,Ymin,Xstep,Ystep,Grille,LabelX,LabelY,LabelC,NomCourbe,CouleurTrace,Bornea,Borneb,PasGrilleX,PasGrilleY,PasGradX,PasGradY,Graduations,Representation,Invisible,Relie,RelieSegment,CouleurPoint,XDepart,YDepart,XArrivee,YArrivee,Murs,LignesIdentiques,EcartVertical,Coef,Legende,TitreAtoi,TexteCorrection,AfficheMarge,MemeEnonce,Etages,Inverse,Direct,SansCalcul,Enonce,Nom,CouleurCadre,ThemePerso,Application,Label,Type,LargeurT,Tradition,Majuscule,E,Zero,SansZero,Complete,CodePerso,Auteur,Heure,EchelleLogo,Publie,Texte,Piece,Numero,EchelleCarte,AfficheEchelle,Europe,Asie,Amsud,Amcentre,Amnord,Caraibes,Afrique,Pays,Villes,VillesI,Projection,TypeProjection,CouleurPays,CouleurVirgule,CouleurFond,Thermometre,Mercure,CouleurMercure,Kelvin,Farenheit,Barre,EcartBarre,Croises,Escalier,Cours,Exercice,NbQ,Ordre,Dossier,Maitre,CoefQ,CoefR,CoefJ,Nom,CAN,Sup,Compact,Vrai,Multiplication,Aide,Autre,Relatif,Puissance,FacteurMin,FacteurMax,CaseVide,Produits,ProduitVide,Petales,Polygone,Taille,TLargeur,THauteur,Case,Pair,Impair,Premier,Relatif,Bordure,CouleurResultat,CouleurZone,CodeAfter,Lettres,ListeNombres,Marque,CouleurSolution,Creation,Graine,AllPerso,SansMots,Questions,ValeurMin,ValeurMax,NombreCalculs,Plaques,Original,Relatifs,EntreeSortie,Entree,Sortie,CouleurChemin,Face,Profondeur,CouleurCube,CouleurFleche,Trou,Grilles,TortueD,TortueF,HauteurG,Axes,Cases,CartonReponse,CoinHD,CoinBG,TypeTrace,Resultats,RayonCylindre,HauteurCylindre,Traces,ListeSommets,Sommets,Aretes,Anglex,DecalageSommet,SommetsPyramide,Reguliere,RayonCone,HauteurCone,RayonSphere,Section,CoefSection,PointsSection,CouleurSection,Distance,Phi,Theta,ObjetSection,Litteral,Decimaux,Modele,PointsCourbe,Plateau,OrigineVariable,Cle,ListeOperations,Etapes,StyleTexte,Colore,Parentheses,ResultatSeul,SansMul,ParenthesesFin,Resultat,Globe,CouleurE,Repere,Cible,VideRepere,Deno,Motif,Complete,ArrierePlan,Quadrilatere,Escher,Position,Reseau,Basei,Basej,Cote,CouleurNombre,CouleurGN,CadreGN,CouleurCadre,Einstein,Vampire,CouleurP,CouleurNP,Separation,AccoladesH,AccoladesB,Pave,Arete,Double,Jetons,UniteHexa,Negatif,Fractions,Priorites,ListeHachures,DebutAngle,LesSommes,LesProduits,LesNombres,NbPoints,ThemeJeu,Flechettes,AffichageUnites,MarquePrimaire,Cadre,Aiguilles,Secondes,Reperes,CouleurS,Operations,SchemaEnonce,ListeTouches,ListeLettres,Indices,CouleurBloc,DessinSeul,Vierge,Condense,Base,Hard,Format,HauteurTheme,AffichageSolution,Restreint,DivE,Style,PasGrillex,PasGrilley,ListeParts,Quadrillage,HautQuad,LargQuad,UniteAire,Consignes,Diametre,Diviseur,ListePerso,Largeura,Largeurb,Unique,RemarqueAll,Div,Remarque,OpReciproques,ReponsesCalculs,Retour,Ombre,ModeleBarre,DebutColonnes,DebutLignes,Vol,Capa,Masse,Sans,Melange,CDot,Div,NbSolution,Papier,Carton,Espaces,Enseigne,Especes,Rendu,HeureAchat,DateAchat,SansRendu,Service,Separations,HauteurD,HauteurCylindre,HauteurPyramideA,HauteurPyramideB,HauteurConeA,HauteurConeB,Chiffre,Dixiemes,EclateX,EclateY,EclateZ,ACompleter,Correction,LargeurC,Expressions,Substitue,Maillage,Lancers,Legendes,Repartition,RepartitionC,RepartitionN,Roue,SansRemise,CouleurLigne,CouleurColonne,RepartitionLigne,RepartitionColonne,ListeColonne,ListeLigne,Different,Casino,Geant,Deforme,Borne,Coefx,Coefy,ToutesOperations,Poisson,AngleArete,CouleurPoisson,ElementsVisibles,StyleTrace,LegendesH,LegendesV,Totaux,DoubleEntree,Fluo,Under,Evidence,Date,Aleatoire,Sigle,Banque,Lieu,Lire,Destinataire,Ajust},%
    keywordstyle=\color{OliveDrab},%
    classoffset=0,%
    literate=*{[}{{\textcolor{orange}{[}}}{1}%
    {]}{{\textcolor{orange}{]}}}{1}%
    {\{}{\textcolor{amber}{\{}}{1}%
    {\}}{\textcolor{amber}{\}}}{1}%
    {\&}{\textcolor{red}{\&}}{1}%
    {\\[}{{\textcolor{purple}{\textbackslash[}}}{2}%
    {\\]}{{\textcolor{purple}{\textbackslash]}}}{2}%
    {$}{{\textcolor{purple}{\$}}}{1}%$
    {_}{{\textcolor{purple}{\_}}}{1}%
    {^}{{\textcolor{purple}{\^{}}}}{1}%,
}

\usepackage{textcomp}%pour les < de listings

\usepackage{hhline}

\usepackage{pifont}
\usepackage{fontawesome5}

\definecolor{mygray}{RGB}{245,245,245}%pour le background de listing
\definecolor{drab}{rgb}{0.59, 0.44, 0.09}
\definecolor{amber}{rgb}{1.0, 0.75, 0.0}
\definecolor{chocolate}{rgb}{0.82, 0.41, 0.12}
\colorlet{amber}{chocolate}

\newtcblisting{Code}{%
  top=0mm,bottom=0mm,left=2mm,right=2mm,%
  colback=white,%
  colframe=white!75!black,%
  listing side text,%
  listing options={%
    frame=,%
   backgroundcolor=,%
  },%
  righthand width=0.4\linewidth
}%

\newtcblisting{Codes}[3][]{%
  top=0mm,bottom=0mm,left=2mm,right=2mm,middle=0mm,%
  colback=white,%
  colframe=white!75!black,%
  every listing line={#3},%
  listing options={%
    frame=,%
    backgroundcolor=,%
  },%
  righthand width=#2\linewidth,%
  #1%
}%

\newtcblisting{Exemple}[2][]{%
  listing only,
  top=0mm,bottom=0mm,left=2mm,right=2mm,middle=0mm,%
  colback=LightSteelBlue!15,%
  colframe=black,%
  every listing line={#2},%
  listing options={%
    frame=,%
    backgroundcolor=,%
  },%
 #1 
}%

\newtcblisting{Codev}{%
    top=0mm,bottom=0mm,left=2mm,right=2mm,middle=0mm,%
  colback=white,%
  colframe=white!75!black,%
  listing options={%
    frame=,
    backgroundcolor=,
  }%
}

\newtcblisting{Codeh}{%
  colback=white,%
  colframe=white!75!black,%
  listing only,
  listing options={%
    frame=,
    backgroundcolor=,
  }%
}

\newtcblisting{CodeH}{%
  top=0mm,bottom=0mm,left=2mm,right=2mm,
  colback=white,%
  colframe=white!75!black,%
  listing only,
  listing options={%
    language=metapost,
    emph={trace,remplis,chemin,polygone,segment,droite,demidroite,coupdecompas,cercles,Codeangle,Codelongueur,codeperp,appelation,rotation,marque_s},
    emphstyle=\color{purple},
    numbers=left,
    numberstyle=\tiny,
    frame=,
    backgroundcolor=,
  }%
}

\newtcblisting{CodeHH}{%
  colback=white,%
  colframe=white!75!black,%
  listing only,
  listing options={%
    frame=,
    backgroundcolor=,
  }%
}

\usepackage{menukeys}
\newcommand\metamk[1]{\textlangle#1\textrangle}

\newcommand\Cle[1]{%
  {\bfseries\sffamily\textlangle #1\textrangle}%
}%

\newcommand\CleD[1]{%
  {\bfseries\sffamily\textlangle #1\textrangle}$^{\text{\faIcon{sync-alt}}}$%
}%

\newcommand\CleS[1]{%
  {\bfseries\sffamily\textlangle #1\textrangle}$^{\text{\faIcon{external-link-alt}}}$%
}%

\newcommand\CleDS[1]{%
  {\bfseries\sffamily\textlangle #1\textrangle}$^{\text{\faIcon{sync-alt}~\faIcon{external-link-alt}}}$%
}%

\newcommand\Defaut[1]{%
\hfill valeur par défaut : {\sffamily #1}\par%
}%
\newcommand\Defauts[1]{%
\hfill valeurs par défaut : {\sffamily #1}\par%
}%

\newcommand\DefautR[1]{%
(valeur par défaut : {\sffamily #1}) %
}%
\newcommand\DefautsR[1]{%
(valeurs par défaut : {\sffamily #1}) %
}%

%\usepackage{parskip}

\newenvironment{Description}
               {\list{}{\labelwidth0pt \leftmargin0pt \itemindent-\leftmargin
                        \let\makelabel\Descriptionlabel}}
               {\endlist}
\newcommand*\Descriptionlabel[1]{\hspace\labelsep \includegraphics{Trombone-mps.pdf}
  \normalfont\bfseries #1}

\newenvironment{SousDescription}
               {\list{}{\small\labelwidth0pt \leftmargin0.075\linewidth \itemindent0pt
                        \let\makelabel\SousDescriptionlabel}}
               {\endlist}
\newcommand*\SousDescriptionlabel[1]{\hspace\labelsep \includegraphics{Trombone-mps.pdf}%
  \normalfont\bfseries #1%
}%

\newenvironment{SousDescriptionR}
{\list{}{\labelwidth0pt \leftmargin0.075\linewidth \itemindent0pt
    \let\makelabel\SousDescriptionlabelR}}
{\endlist\medskip}

\newcommand*\SousDescriptionlabelR{\hspace\labelsep$\star$}

\newenvironment{SSDescription}
{\list{}{\labelwidth0pt \leftmargin0.15\linewidth \itemindent0pt
    \let\makelabel\SousDescriptionlabel}}
{\endlist}

\newenvironment{SSDescriptionR}
{\list{}{\labelwidth0pt \leftmargin0.15\linewidth \itemindent0pt
    \let\makelabel\SousDescriptionlabelR}}
{\endlist}

\parindent0pt

\usepackage{hologo}

\usepackage{pdflscape}
\usepackage{pdfpages}

% https://tex.stackexchange.com/questions/558709/tcolorbox-footnotes-at-end-of-each-page
\makeatletter
% restore footnote internals to those in normal page, not minipage
\def\tcb@restore@footnote{%
  \def\@mpfn{footnote}%
  \def\thempfn{\arabic{footnote}}%
  \let\@footnotetext\tcb@footnote@collect
}

% collect footnote text
\long\def\tcb@footnote@collect#1{%
  % expand \@thefnmark before appending before app to \tcb@footnote@acc
  \expandafter\gappto\expandafter\tcb@footnote@acc\expandafter{%
    \expandafter\footnotetext\expandafter[\@thefnmark]{#1}%
  }%
}

\def\tcb@footnote@use{%
  \tcb@footnote@acc
  \global\let\tcb@footnote@acc\@empty
}
\global\let\tcb@footnote@acc\@empty

\tcbset{
  % restore for every box
  every box/.style={%
    before title pre=\tcb@restore@footnote,
    before upper pre=\tcb@restore@footnote,
    before lower pre=\tcb@restore@footnote
  },
  % use for layer 1 boxes only
  every box on layer 1/.append style={
    after app=\tcb@footnote@use
  }
}
\makeatother

\NewDocumentEnvironment{Key}{mO{valeur}m+b}{%
  \begin{description}%
  \item[La clé \Cle{#1}]\hfill#2{} par défaut : {\sffamily #3}\par%
    #4%
}{\end{description}}%

\NewDocumentEnvironment{Keyl}{m O{valeur} m +b}{%
  \begin{description}
  \item[La clé #1]\hfill#2{} par défaut : {\sffamily #3}\par
    #4
  \end{description}
}{}

\NewDocumentEnvironment{KEYS}{m O{valeurs} m +b}{%
  \begin{description}
  \item[Les clés \Cle{#1}]\hfill#2{} par défaut : {\sffamily #3}\par
    #4
  \end{description}
}{}

\NewDocumentEnvironment{KEYSl}{m O{valeurs} m +b}{%
  \begin{description}
  \item[Les clés #1]\hfill#2{} par défaut : {\sffamily #3}\par
    #4
  \end{description}
}{}

\NewDocumentEnvironment{KeyS}{m O{valeur} m +b}{%
  \begin{description}
  \item[La clé \CleS{#1}]\hfill#2{} par défaut : {\sffamily #3}\par
    #4
  \end{description}
}{}

\NewDocumentEnvironment{KeyD}{m O{valeur} m +b}{%
  \begin{description}
  \item[La clé \CleD{#1}]\hfill#2{} par défaut : {\sffamily #3}\par
    #4
  \end{description}
}{}

\NewDocumentEnvironment{KeyDS}{m O{valeur} m +b}{%
  \begin{description}
  \item[La clé \CleDS{#1}]\hfill#2{} par défaut : {\sffamily #3}\par
    #4
  \end{description}
}{}


\newtcolorbox{Commande}[2][]{%
  enhanced,
  top=0mm,
  bottomtitle=0mm,
  arc=0pt,
  outer arc=0pt,
  colframe=LightSteelBlue,
  colback=white,
  bicolor,
  colbacklower=LightSteelBlue!15,
  coltitle=black,
  title={\bfseries La commande #2},
  #1%
}%

\newtcolorbox{Lenviron}[2][]{%
  enhanced,
  top=0mm,
  bottomtitle=0mm,
  arc=0pt,
  outer arc=0pt,
  colframe=Cornsilk,
  colback=white,
  bicolor,
  colbacklower=Cornsilk!15,
  coltitle=black,
  title={\bfseries L'environnement #2},
  #1%
}%

\NewEnviron{LenvironR}[1]{%
  \textbullet{} L'environnement {\bfseries #1} %
   \BODY\par
}

\newtcolorbox{PART}[1][]{%
  enhanced,
  top=0mm,
  bottomtitle=0mm,
  arc=0pt,
  outer arc=0pt,
  colframe=LightSteelBlue,
  colback=white,
  bicolor,
  colbacklower=LightSteelBlue!15,
  coltitle=black,
  title=\centering Partie,
  #1%
}%

\newcommand\TIKZ{Ti\textit{k}Z}

\tcbset{%
  tikzRemarque/.style={%
    before skip=1em,
    enhanced,
    breakable,
    colback=Crimson!15,
    colframe=Crimson!50,
    underlay unbroken and first={%
      \node[%
      name=A,
      ] at (frame.west){\reflectbox{\includegraphics[scale=0.25]{Attention-1}}};
      %% 
      \node[%
      name=B,
      ] at (frame.east){\includegraphics[scale=0.25]{Attention-1}};
      %% 
    }
  }
}

%https://tex.stackexchange.com/questions/181082/how-to-reproduce-this-box-in-tcolorbox#
\newcommand\PfCmylib{%
  \tikz[baseline=-0.5ex]{%
    \tikzset{lib/.style={%
        rectangle split,%
        rectangle split parts=2,%
        rectangle split horizontal,%
        rectangle split part fill={green!75!blue!50!white,green!10!white},%
        rectangle split draw splits=false,%
        rounded corners=2pt,%
        rectangle split part align={right,right},%
        draw=green!50!black,%
        minimum height=16pt}%
    }%
    \node[lib] (var){%
      \nodepart[text=green!25!black]{two}\tiny\PfCfileversion};%
    \node[text=white,font=\sffamily\bfseries\tiny,rotate=90] at ([xshift=6pt]var.west) {MAJ};%
  }%
}%

\newcommand\PfCMAJ[1]{%
  \StrCompare{#1}{\PfCfileversion}[\PfCRetourMAJ]%
  \xintifboolexpr{\PfCRetourMAJ==0}{\marginnote{\PfCmylib}}{}%
}%

\newcommand\DoubleFlecheDifference[9][]{%
  % #1 : option
  % #2 à #9 : les valeurs intervenant dans les deux distributivités.
\setKV[ClesDistributivite]{#1}%
\begin{align*}
  \useKV[ClesDistributivite]{NomExpression}&=\Distri[#1,RAZ,Etape=1]{#2}{#3}{#4}{#5}-\Distri[#1,Etape=1]{#6}{#7}{#8}{#9}\\
  \useKV[ClesDistributivite]{NomExpression}&=\Distri[Etape=2]{#2}{#3}{#4}{#5}-(\Distri[Etape=2]{#6}{#7}{#8}{#9})\\
  \useKV[ClesDistributivite]{NomExpression}&=\Distri[Etape=3]{#2}{#3}{#4}{#5}-(\Distri[Etape=3]{#6}{#7}{#8}{#9})\\
  \useKV[ClesDistributivite]{NomExpression}&=\ifboolKV[ClesDistributivite]{Oppose}{\Distri[Etape=4]{#2}{#3}{#4}{#5}-(\Distri[Etape=4]{#6}{#7}{#8}{#9})\\}{\Distri[Somme,Etape=4]{#2}{#3}{#4}{#5}-(\Distri[Difference,Etape=4]{#6}{#7}{#8}{#9})\\}%
  \ifboolKV[ClesDistributivite]{Oppose}{\useKV[ClesDistributivite]{NomExpression}&=\Distri[RAZ,Somme,Etape=4]{#2}{#3}{#4}{#5}+\Distri[Oppose,Difference,Etape=4]{#6}{#7}{#8}{#9}\\}{}
  \useKV[ClesDistributivite]{NomExpression}&=\Resultat
\end{align*}
}

%https://tex.stackexchange.com/questions/28465/multiple-footnotes-at-one-point
\let\oldFootnote\footnote
\newcommand\nextToken\relax

\renewcommand\footnote[1]{%
  \oldFootnote{#1}\futurelet\nextToken\isFootnote}

\newcommand\isFootnote{%
  \ifx\footnote\nextToken\textsuperscript{,}\fi}
%fin tex.stackexchange

%\newcounter{NumFig}

\definecolor{myyellow}{RGB}{242,226,149}
\definecolor{wolf}{RGB}{253,183,27}

\usepackage{setspace}
\usepackage{enumitem}

\usepackage{dirtree}

\usepackage{babel}
\usepackage[colorlinks=true,linkcolor=purple,luatex]{hyperref}
\usepackage{url}
\usepackage{bookmark}
\usepackage{marginnote}

\tcbset{%
  tikzfiche/.style={%
    before skip=1em,
    enhanced,
    breakable,
    colback=white,
    colframe=gray!50,
    overlay unbroken and first={%
      \node[%
      name=A,
      fill=white,
      anchor=west,
      xshift=10pt,
      ] at (frame.north west){\bfseries\sffamily Exercice};
    }%
  }%
}%

\newenvironment{exercice}[1][]{%
  \tcolorbox[%
  tikzfiche
  ]
}{\endtcolorbox%
}