% Author     : C. Pierquet
% licence    : Released under the LaTeX Project Public License v1.3c
% or later, see http://www.latex-project.org/lppl.txtf

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ProfLycee}[2022/05/07 - v1.1.4 - Aide pour l'utilisation de LaTeX en lycée]
% 1.1.4	Ajout d'une commande cercletrigoPL pour, en \TikZ, créer facilement un cercle trigo avec options
% 1.1.3	Ajout d'une commande ensemble pour créer un ensemble à partir d'une liste
% 1.1.2	Modifs mineures
% 1.1.1	Modification mineure de l'environnement CF, avec prise de charge de la taille du texte !
% 1.1.0	Ajout d'une commande tetraPL pour un tetraèdre dans un environnement TikZ
% 1.0.9	Ajout d'une commande pavePL pour un pave droit dans un environnement TikZ
% 1.0.8 Ajout d'une commande liencapytale pour créer un cartouche "comme sur capytale"
% 1.0.7	Option [build] pour placer les fichiers temporaires dans un répertoire build (désactivée par défaut)
% 1.0.6	Option [nominted] pour éviter de charger minted & nettoyage amssymb
% 1.0.5	Environnement code python avec minted
% 1.0.4	Environnement pour simuler terminal windows & linux
% 1.0.3	Environnement pour présenter du pseudocode
% 1.0.2	Environnement pour présenter du code python (avec pythontex)
% 1.0.1	Modif mineure du chargement de xcolor (compatibilité avec d'autres packages notamment...)
% 1.0	Version initiale

%------Option(s)
\newif\if@nominted \@nomintedfalse
\DeclareOption{nominted}{\@nomintedtrue}
\newif\if@build \@buildfalse
\DeclareOption{build}{\@buildtrue}
\DeclareOption*{}
\ProcessOptions\relax

%------Packages utiles
\RequirePackage[table,svgnames]{xcolor}%Gestion des couleurs
\RequirePackage{tikz}
\RequirePackage{tkz-tab}
\RequirePackage{mathtools}
\RequirePackage{pgf,pgffor}
\RequirePackage{ifthen}
\RequirePackage{xparse}
\RequirePackage{xkeyval}
\RequirePackage{xfp}
\RequirePackage{xstring}
\RequirePackage{xintexpr}
\RequirePackage{simplekv}
\RequirePackage{listofitems}
\RequirePackage{xintexpr}
\RequirePackage{tabularray}
\RequirePackage{fontawesome5}
%librairies tikz
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows,arrows.meta}
%tcolorbox
\RequirePackage[most]{tcolorbox}
%divers
\RequirePackage{ifluatex}
%python
\RequirePackage{fancyvrb}
\RequirePackage[gobble=auto]{pythontex}
\setpythontexlistingenv{pythont} %pour ne pas télescoper lstlistings (?)
\if@build
	\setpythontexoutputdir{./build/pythontex-files-\jobname} %essai de modif pythontex répertoire build
\fi

%---------------SPLINES----------------------
%------commande utile pour extraire des infos d'une liste
\newcommand\extractcoeff[2]{% #1=liste & #2=numero
	\setsepchar{§}%
	\readlist\lcoeffs{#1}
	\ifnum \lcoeffslen=1
		\def\COEFFA{#1}
		\def\COEFFB{#1}
	\else
		\itemtomacro\lcoeffs[#2]\COEFF
		\IfSubStr{\COEFF}{/}%
			{\StrCut{\COEFF}{/}{\COEFFA}{\COEFFB}}%
			{\def\COEFFA{\COEFF}\def\COEFFB{\COEFF}}
	\fi
}

%------splines en tikz avec ..controls
\defKV[spline]{%
	liste=\def\SPLliste{#1},%
	width=\def\SPLepaisseur{#1},%
	couleur=\def\SPLcouleur{#1},%
	coeffs=\def\SPLcoeffs{#1},%
	couleurpoints=\def\SPLcouleurpoints{#1},%
	taillepoints=\def\SPLtaillepoints{#1},%
	style=\def\SPLstyle{#1}
}

\setKVdefault[spline]{%
	liste=,%
	width=1.25pt,%
	couleur=red,%
	coeffs=3,%
	couleurpoints=black,%
	taillepoints=2pt,%
	affpoints=false,%
	style=
}

\newcommand\splinetikz[1][]{%
	\useKVdefault[spline]
	\setKV[spline]{#1}% on paramètres les nouvelles clés et on les simplifie
	%on lit la liste des points/nbderivés et on stocke dans \listepoints
	\setsepchar[.]{§./}%
	\readlist\SPLlistepoints\SPLliste
	\def\SPLnbsplines{\inteval{\SPLlistepointslen-1}}
	%si uniquement deux points, pas de boucle...
	\ifnum \SPLlistepointslen=2
		%extraction des coeffs de compensation
		\extractcoeff{\SPLcoeffs}{1}%
		%extraction des coordonnées
		\itemtomacro\SPLlistepoints[1,1]\xa
		\itemtomacro\SPLlistepoints[1,2]\ya
		\itemtomacro\SPLlistepoints[1,3]\fprimea
		\itemtomacro\SPLlistepoints[2,1]\xb
		\itemtomacro\SPLlistepoints[2,2]\yb
		\itemtomacro\SPLlistepoints[2,3]\fprimeb
		\draw[line width=\SPLepaisseur,\SPLcouleur,\SPLstyle] (\xa,\ya) ..controls +({atan \fprimea}:{(\xb-\xa)/\COEFFA}) and +({-180 + atan \fprimeb}:{(\xb-\xa)/\COEFFA}).. (\xb,\yb) ;%
	%sinon on construit bout par bout !
	\else
		\foreach \i in {1,2,...,\SPLnbsplines}{
			%extraction des coeffs de compensation
			\extractcoeff{\SPLcoeffs}{\i}
			\def\j{\inteval{\i+1}}
			\itemtomacro\SPLlistepoints[\i,1]\xa
			\itemtomacro\SPLlistepoints[\i,2]\ya
			\itemtomacro\SPLlistepoints[\i,3]\fprimea
			\itemtomacro\SPLlistepoints[\j,1]\xb
			\itemtomacro\SPLlistepoints[\j,2]\yb
			\itemtomacro\SPLlistepoints[\j,3]\fprimeb
			\draw[line width=\SPLepaisseur,\SPLcouleur,\SPLstyle] (\xa,\ya) ..controls +({atan \fprimea}:{(\xb-\xa)/\COEFFA}) and +({-180 + atan \fprimeb}:{(\xb-\xa)/\COEFFB}).. (\xb,\yb) ;%
		}
	\fi
	\ifboolKV[spline]{affpoints}%on affiche les points de contrôle
	{%
		\foreach \i in {1,2,...,\SPLlistepointslen}{%
			\itemtomacro\SPLlistepoints[\i,1]\xa
			\itemtomacro\SPLlistepoints[\i,2]\ya
			\filldraw[\SPLcouleurpoints] (\xa,\ya) circle[radius=\SPLtaillepoints] ;%
		}
	}
	{}
}

%------tangente(s) en TikZ, avec point/dérivée ou liste points/dérivées
\defKV[tgte]{%
	liste=\def\TGTliste{#1},%
	width=\def\TGTepaisseur{#1},%
	couleur=\def\TGTcouleur{#1},%
	xl=\def\TGTXL{#1},%
	xr=\def\TGTXR{#1},%
	style=\def\TGTstyle{#1},%
	point=\def\TGTnumpt{#1}
}

\setKVdefault[tgte]{
	liste=,%
	width=1.25pt,%
	couleur=red,%
	xl=0.5,xr=0.5,%
	style=,%
	point=1
}

\newcommand\tangentetikz[1][]{%
	\useKVdefault[tgte]%
	\setKV[tgte]{#1}% on paramètres les nouvelles clés et on les simplifie
	\setsepchar[.]{§./}%
	\readlist\TGTlistepoints\TGTliste
	\itemtomacro\TGTlistepoints[\TGTnumpt,1]\xa
	\itemtomacro\TGTlistepoints[\TGTnumpt,2]\ya
	\itemtomacro\TGTlistepoints[\TGTnumpt,3]\fprimea
	\def\TGTDEB{\fpeval{\xa-\TGTXL}}\def\TGTFIN{\fpeval{\xa+\TGTXR}}%
	\draw[line width=\TGTepaisseur,\TGTcouleur,domain=\TGTDEB:\TGTFIN,\TGTstyle] plot (\x,{\fprimea*(\x-\xa)+\ya}) ;%
}

%----------------FENÊTRE CALCUL FORMEL
\newcommand\CFchap{\textasciicircum}
\newcounter{CFnum}
%def des clés
\defKV[paramfenxcas]{%
	larg=\def\CFlarg{#1},%
	esplg=\def\CFesplg{#1},%
	premcol=\def\CFpremcol{#1},%
	hpremcol=\def\CFhpremcol{#1},%
	taille=\def\CFtaille{#1},%
	couleur=\def\CFcouleur{#1},%
	tailletitre=\def\CFtailletitre{#1},%
	couleurcmd=\def\CFcoulcmd{#1},%
	couleurres=\def\CFcoulres{#1},%
	poscmd=\def\CFposcmd{#1},%
	posres=\def\CFposres{#1},%
	labeltitre=\def\CFlabeltitre{#1}%
}
\setKVdefault[paramfenxcas]{%
	larg=16,esplg=2pt,premcol=0.3,hpremcol=0.4,%
	couleur=darkgray,menu=true,titre=false,tailletitre=\normalsize,taille=\normalsize,%
	sep=true,posres=centre,poscmd=gauche,%
	couleurcmd=red,couleurres=blue,%
	labeltitre={Résultats obtenus avec un logiciel de Calcul Formel}}
\newcommand\paramCF[1][]{%
	\setcounter{CFnum}{0}
	\useKVdefault[paramfenxcas]%
	\setKV[paramfenxcas]{#1}% on paramètres les nouvelles clés et on les simplifie
}
%def des clés
\defKV[paramlgxcas]{%
	hc=\def\CFhle{#1},%
	hr=\def\CFhlr{#1}
}
\setKVdefault[paramlgxcas]{hc=0.75,hr=0.75}
\newcommand\ligneCF[3][]{%
	\addtocounter{CFnum}{1}
	\def\CFL{\theCFnum}
	\def\CFLA{\inteval{\CFL-1}}%
	\useKVdefault[paramlgxcas]%
	\setKV[paramlgxcas]{#1}% on paramètres les nouvelles clés et on les simplifie
	\def\CFLA{\inteval{\CFL-1}}%
	%DÉCLARATION DES NŒUDS (les "6" coins des lignes commande et résultat)
	\xintifboolexpr{\CFL == 1}%si c'est la première ligne
		{\coordinate (A0\CFL) at (0,0);}
		{\coordinate (A0\CFL) at ($(A2\CFLA) + (0,{-\CFesplg})$);}
	\coordinate (A1\CFL) at ($(A0\CFL) +  (0,{-\CFhle})$);
	\coordinate (A2\CFL) at ($(A1\CFL) +  (0,{-\CFhlr})$);
	\coordinate (A3\CFL) at ($(A0\CFL) +  ({\CFlarg},0)$);
	\coordinate (A4\CFL) at ($(A1\CFL) +  ({\CFlarg},0)$);
	\coordinate (A5\CFL) at ($(A2\CFL) +  ({\CFlarg},0)$);
	%DÉCLARATION DES NŒUDS INTERMÉDIAIRES (pour les commandes et les résultats)
	\coordinate (C1\CFL) at ($(A0\CFL) + (0,{-0.5*\CFhle})$);
	\coordinate (C2\CFL) at ($(A0\CFL) + ({0.5*\CFlarg},{-0.5*\CFhle})$);
	\coordinate (C3\CFL) at ($(A0\CFL) + ({\CFlarg},{-0.5*\CFhle})$);
	\coordinate (R1\CFL) at ($(A1\CFL) + (0,{-0.5*\CFhlr})$);
	\coordinate (R2\CFL) at ($(A1\CFL) + ({0.5*\CFlarg},{-0.5*\CFhlr})$);
	\coordinate (R3\CFL) at ($(A1\CFL) + ({\CFlarg},{-0.5*\CFhlr})$);
	%RECTANGLE DE BASE
	\draw[\CFcouleur] (A0\CFL) rectangle (A5\CFL) ;
	%LA COMMANDE EN ROUGE
	\IfStrEq{\CFposcmd}{centre}%si poscmd=center
		{\draw (C2\CFL) node[\CFcoulcmd,font=\CFtaille] {#2} ;}
		{}
	\IfStrEq{\CFposcmd}{gauche}%si poscmd=left
		{\draw (C1\CFL) node[right,\CFcoulcmd,font=\CFtaille] {#2} ;}
		{}
	\IfStrEq{\CFposcmd}{right}%si poscmd=right
		{\draw (C3\CFL) node[left,\CFcoulcmd,font=\CFtaille] {#2} ;}
		{}
	%LA LIGNE DE SÉPARATION
	\ifboolKV[paramfenxcas]{sep}%si sep=true
		{\draw[\CFcouleur] (A1\CFL) -- (A4\CFL);}
		{}
	%LE RÉSULTAT
	\IfStrEq{\CFposres}{centre}%si posrep=center
		{\draw (R2\CFL) node[\CFcoulres,font=\CFtaille] {#3} ;}
		{}
	\IfStrEq{\CFposres}{gauche}%si posrep=left
		{\draw (R1\CFL) node[right,\CFcoulres,font=\CFtaille] {#3} ;}
		{}
	\IfStrEq{\CFposres}{right}%si posrep=right
		{\draw (R3\CFL) node[left,\CFcoulres,font=\CFtaille] {#3} ;}
		{}
	\ifboolKV[paramfenxcas]{sep}%si sep=true
		{\draw[\CFcouleur] (A1\CFL) -- (A4\CFL);}%
		{}
	%LE PETIT NUMÉRO
	\draw[\CFcouleur] (A0\CFL) rectangle ++ ({-\CFpremcol},{-\CFhpremcol}) node[\CFcouleur,midway,font=\small\sffamily\bfseries] {\CFL} ;
	%LE RECTANGLE "MENU"
	\ifboolKV[paramfenxcas]{menu}%si menu=true
		{\draw[\CFcouleur,fill=\CFcouleur!25] (A5\CFL) rectangle ++ (-0.65,0.25) node[black,midway,font=\tiny\sffamily\bfseries] {MENU} ;}%
		{}
	%LE BLOC "TITRE"
	\ifboolKV[paramfenxcas]{titre}%si titre=true
		{\draw[\CFcouleur,fill=lightgray!25,rounded corners] ($(A01) + (0,2pt)$) rectangle ++ ($({\CFlarg},2em)$) node[ForestGreen!50!\CFcouleur,midway,font=\CFtailletitre\ttfamily\bfseries] {\CFlabeltitre};}
		{}
}

%=========CONSOLEPYTHON=========== OK !!
\defKV[envpythonconsole]{%
	largeur=\def\CSPYlargeur{#1},%
	centre=\testboolKV{#1}
		{\def\hookcenterpre{\begin{center}}\def\hookcenterpost{\end{center}}}
		{\def\hookcenterpre{\begin{flushleft}}\def\hookcenterpost{\end{flushleft}}}
}

\setKVdefault[envpythonconsole]{%
	largeur=\linewidth,%
	centre=true,%
	label=true
}

\newenvironment{envconsolepythontex}[1][]{%
	\useKVdefault[envpythonconsole]%
	\setKV[envpythonconsole]{#1}% on paramètres les nouvelles clés et on les simplifie
	\VerbatimEnvironment
	\hookcenterpre
	\begin{minipage}{\CSPYlargeur}
		\ifboolKV[envpythonconsole]{label}%si sep=true
		{\begin{pyconsole}[][%
				framesep=3mm,frame=single,fontsize=\footnotesize,framerule=1pt,rulecolor=\color{ForestGreen},label={[\scriptsize Début de la console python]\scriptsize Fin de la console python}]}%
		{\begin{pyconsole}[][%
				framesep=3mm,frame=single,fontsize=\footnotesize,framerule=1pt,rulecolor=\color{ForestGreen}]}
			}
			{
		\end{pyconsole}
	\end{minipage}
	\hookcenterpost
}

%=========CODEPYTHONTEX=========== OK!!
\defKV[envpythonverb]{%
	largeur=\def\CODPYlargeur{#1},%
	centre=\testboolKV{#1}
		{\def\verbcenterpre{\begin{center}}\def\verbcenterpost{\end{center}}}
		{\def\verbcenterpre{}\def\verbcenterpost{}}
}

\setKVdefault[envpythonverb]{%
	largeur=\linewidth,%
	centre=true,%
	lignes=true
}

\tcbset{stylepythontex/.style={%
		enhanced,boxrule=1.25pt,%
		sharp corners=downhill,arc=12pt,
		before skip=12pt,after skip=12pt,%
		top=10pt,bottom=1mm,rightupper=4pt,%leftupper=25pt,
		attach boxed title to top right={yshift=-\tcboxedtitleheight},
		boxed title style={
			size=small,colback=ForestGreen!25,boxrule=1.25pt,
			colframe=Green,boxsep=1.25pt,
			sharp corners=downhill,
			arc=12pt,
			top=2pt,bottom=1pt,left=6pt,right=6pt
		},
		fonttitle=\color{ForestGreen}\itshape\ttfamily\footnotesize,
		title={\scriptsize\faPython}\:Code Python\vphantom{p},
		watermark text={\faPython},watermark opacity=0.175,watermark zoom=0.50,
	}
}

\tcbset{stylepythonnolineos/.style={%
		stylepythontex,leftupper=10pt,
		colframe=Green,colback=ForestGreen!5,%
		fontlower=\small,%
		before upper = \renewcommand\theFancyVerbLine{\scriptsize\ttfamily\color{Green}\arabic{FancyVerbLine}}
	}
}

\tcbset{stylepythonlineos/.style={%
		stylepythontex,leftupper=25pt,
		colframe=Green,colback=ForestGreen!5,%
		fontlower=\small,%
		before upper = \renewcommand\theFancyVerbLine{\scriptsize\ttfamily\color{Green}\arabic{FancyVerbLine}}
	}
}

\newtcolorbox{tcpythontexcode}[1][\linewidth]{%
	width=#1,stylepythonlineos
}

\newtcolorbox{tcpythontexcodeno}[1][\linewidth]{%
	width=#1,stylepythonnolineos
}

\newenvironment{envcodepythontex}[1][]{%
	\useKVdefault[envpythonverb]%
	\setKV[envpythonverb]{#1}% on paramètres les nouvelles clés et on les simplifie
	\VerbatimEnvironment
	\verbcenterpre
	\ifboolKV[envpythonverb]{lignes}%si lignes=true
		{\begin{tcpythontexcode}[\CODPYlargeur]}
		{\begin{tcpythontexcodeno}[\CODPYlargeur]}
	\ifboolKV[envpythonverb]{lignes}%si lignes=true
		{\begin{pyverbatim}[][fontsize=\footnotesize,numbers=left,numbersep=10pt,commandchars=\\\{\},mathescape]}
		{\begin{pyverbatim}[][numbers=none,numbersep=0pt,fontsize=\footnotesize,commandchars=\\\{\},mathescape]}
		}
		{
	\end{pyverbatim}
	\ifboolKV[envpythonverb]{lignes}%si lignes=true
		{\end{tcpythontexcode}}
		{\end{tcpythontexcodeno}}
	\verbcenterpost
}

%=========PYTHONMINTED========= OK !!
\if@nominted
	%on ne charge pas minted et la librairie tcbox
\else
	\if@build
		%on charge minted avec le répertoire build
		\RequirePackage[outputdir=build]{minted}
	\fi
	%on charge minted via la librairie tcbox
	\tcbuselibrary{minted}
\fi

\tcbset{pytmintedno/.style={%
	listing engine=minted,minted style=colorful,
	minted language=python,listing only,
	minted options={tabsize=4,fontsize=\small,autogobble},
	}
}

\tcbset{pytminted/.style={%
	listing engine=minted,minted style=colorful,
	minted language=python,listing only,
	minted options={tabsize=4,fontsize=\small,autogobble,xleftmargin=16pt,linenos,numbersep=10pt},
	}
}

\DeclareTCBListing{envcodepythonminted}{ s O{12cm} O{} }{% étoilée sans numéro, taille puis option...
	\IfBooleanTF{#1}{pytmintedno}{pytminted},
	enhanced,width=#2,#3,
	colframe=Green,colback=ForestGreen!5,%
	boxrule=1.25pt,
	sharp corners=downhill,arc=12pt,
	before skip=12pt,after skip=12pt,%
	leftupper=8pt,top=10pt,bottom=4pt,rightupper=4pt,%
	attach boxed title to top right={yshift=-\tcboxedtitleheight},
	boxed title style={
		size=small,colback=ForestGreen!25,boxrule=1.25pt,
		colframe=Green,boxsep=1.25pt,
		sharp corners=downhill,
		arc=12pt,
		top=2pt,bottom=1pt,left=6pt,right=6pt
	},
	fonttitle=\color{ForestGreen}\itshape\ttfamily\footnotesize,
	title={\scriptsize\faPython}\:Code Python\vphantom{y},
	watermark text={\faPython},watermark opacity=0.175,watermark zoom=0.50,
	before upper = \renewcommand{\theFancyVerbLine}{\scriptsize\ttfamily\color{Green}\arabic{FancyVerbLine}}
}

%=========PSEUDOCODE=========== OK !!
\ifluatex
	\tcbuselibrary{listings}
	\lstdefinelanguage{langnat}{%
		keywords={},
		inputencoding=utf8,
		comment=[l]{}}
\else
	\tcbuselibrary{listingsutf8}
	\lstdefinelanguage{langnat}{%
		keywords={},
		inputencoding=utf8/latin1,
		comment=[l]{}}
\fi

%language pseudocode listings
\lstdefinestyle{pseudocodePL}{%
	language=langnat,
	basicstyle=\footnotesize\ttfamily,
	numberstyle=\scriptsize\ttfamily\color{gray},
	keywordstyle=\bfseries,
	stringstyle=\color{red!75},
	keepspaces=true,
	tabsize=4,numbersep=10pt,
	xleftmargin=14pt,
	numbers=left,
	morestring=[b]",
	showstringspaces=false,
	%showtabs=false,
	escapeinside={(*}{*)}
}

\lstdefinestyle{pseudocodenoPL}{%
	language=langnat,
	basicstyle=\footnotesize\ttfamily,
	numberstyle=\scriptsize\ttfamily\color{gray},
	keywordstyle=\bfseries,
	stringstyle=\color{red!75},
	keepspaces=true,
	tabsize=4,numbersep=10pt,
	numbers=none,
	showstringspaces=false,
	morestring=[b]",
	%showtabs=true,
	escapeinside={(*}{*)}
}

%style tcbox pseudocode avec bannière hautdroite
\tcbset{stylepseudocodePL/.style={%
		%fontupper=\small\sffamily,%
		enhanced,boxrule=1.25pt,sharp corners=downhill,arc=12pt,
		before skip=12pt,after skip=12pt,leftupper=10pt,top=8pt,bottom=2pt,rightupper=4pt,%
		attach boxed title to top right={yshift=-\tcboxedtitleheight},
		boxed title style={
			size=small,colback=gray!25,boxrule=1.25pt,
			colframe=darkgray,boxsep=1.25pt,
			sharp corners=downhill,
			arc=12pt,
			top=2pt,bottom=1pt,left=6pt,right=6pt
		},
		fonttitle=\color{darkgray}\ttfamily\footnotesize,
		title={\scriptsize\faFileCode}\:\textit{Pseudo-Code}\vphantom{p},
		watermark text={\faCode},watermark opacity=0.175,watermark zoom=0.50,
	}
}

\ifluatex
	\newcommand\algomathttPL[1]{\symtt{#1}}
\else
	\newcommand\algomathttPL[1]{\mathtt{#1}}
\fi

\DeclareTCBListing{envpseudocode}{ s O{12cm} O{} }{% étoilée sans numéro, taille puis option...
	width=#2,#3,
	stylepseudocodePL,
	listing only,listing engine=listings,
	listing options={
		style=\IfBooleanTF{#1}{pseudocodenoPL}{pseudocodePL},%version étoilée sans numéro de lignes
		aboveskip=2pt,belowskip=2pt,
		columns=fullflexible,
		literate={é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1% 
		{ú}{{\'u}}1 {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}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%
		{€}{{\texteuro}}1 {£}{{\pounds}}1%
		{=}{\textleftarrow}1 {==}{=}1%
		{*}{$\algomathttPL{\times}$}{1}%
	}
}

%============FakeTerm=========== OK !!
%couleurs (inspirées par termsim !)
\definecolor{PLmpurple}{RGB}{48,10,36}
\definecolor{PLmgray}{RGB}{70,72,67}
\definecolor{PLogray}{RGB}{148,147,141}
\definecolor{PLoorange}{RGB}{233,101,56}
\definecolor{PLterminal}{RGB}{80,78,70}
\definecolor{PLlinux}{RGB}{0,39,51}
\definecolor{PLwinblue}{HTML}{1883D7}
\definecolor{PLosxgray}{HTML}{D8D6D9}

%WINDOWS
\tcbset{PLfaketermwin/.style={%
		enhanced,boxrule=1pt,sharp corners,before skip=12pt,after skip=12pt,%
		colframe=PLwinblue,colback=black,colbacktitle=white,colupper=white,coltitle=black,%
		titlerule=0.4pt,left=2pt,top=2pt,bottom=2pt,right=2pt,middle=2pt,%
		fonttitle=\bfseries\small\sffamily
	}
}

\setKVdefault[fakeTERMwin]{titre={Terminal Windows}}

\newcommand\PLcommandeswin{%
	\begin{tikzpicture}[thick,scale=0.66]
		\draw (0,0)--(1em,0) ; \draw (2em,0) rectangle (3em,1em) ; \draw (4em,1em)--(5em,0) (4em,0)--(5em,1em) ;
	\end{tikzpicture}%
}

\newcommand\termwintitre[1][]{%
	\restoreKV[fakeTERMwin]
	\setKV[fakeTERMwin]{#1}
	\begin{tblr}{colsep=0pt,rowsep=0pt,width=\linewidth,colspec={X[l]r}}
		{\footnotesize\faTerminal}~~\useKV[fakeTERMwin]{titre} & \PLcommandeswin \\ %
	\end{tblr}
}

\DeclareTCBListing{PLtermwin}{ O{\linewidth} m !O{} }{%[taille] puis {titre=...} puis [option]
	PLfaketermwin,title={\termwintitre[#2]},%
	listing only,listing engine=listings,%
	listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},%
	width=#1,#3
}

%LINUX
\newcommand{\PLUbuntuWhite}{%
	\begin{tikzpicture}[thick,anchor=base,baseline]
		\filldraw[PLmgray] (0,0.25em) circle[radius=0.5em] ;
	\end{tikzpicture}%
}
\newcommand{\PLUbuntuMin}{%
	\begin{tikzpicture}[thick,anchor=base,baseline]
		\filldraw[color=PLogray!50!white] (0,0.25em) circle[radius=0.5em];
		\draw[PLterminal](-0.35em,0.25em)--(0.35em,0.25em);
	\end{tikzpicture}%
}
\newcommand{\PLUbuntuClose}{%
	\begin{tikzpicture}[thick,anchor=base,baseline]
		\filldraw[color=PLoorange!70!white] (0,0.25em) circle[radius=0.5em];
		\draw[PLterminal] (-0.32em,-0.07em)--(0.32em,0.57em);
		\draw[PLterminal] (-0.32em,0.57em)--(0.32em,-0.07em);
	\end{tikzpicture}%
}
\newcommand{\PLUbuntuMax}{%
	\begin{tikzpicture}[thick,anchor=base,baseline]
		\filldraw[color=PLogray!50!white] (0,0.25em) circle[radius=0.5em];
		\draw[PLterminal] (-0.32em,0.5em) rectangle (0.32em,0);
	\end{tikzpicture}%
}

\tcbset{PLtermlinux/.style={%
		enhanced,boxrule=1pt,arc=4pt,before skip=12pt,after skip=12pt,%
		colframe=PLmgray,colback=PLmpurple,colbacktitle=PLmgray,colupper=white,coltitle=white,%
		titlerule=0.4pt,left=2pt,top=2pt,bottom=2pt,right=2pt,middle=2pt,%
		fonttitle=\bfseries\small\sffamily
	}
}

\setKVdefault[fakeTERMnux]{titre={Terminal UNiX}}

\newcommand\termnuxtitre[1][]{%
	\restoreKV[fakeTERMnux]
	\setKV[fakeTERMnux]{#1}
	\begin{tblr}{colsep=0pt,rowsep=0pt,width=\linewidth,colspec={lX[c]r}}
		\PLUbuntuWhite~~\PLUbuntuWhite~~\PLUbuntuWhite & \vphantom{p}\useKV[fakeTERMnux]{titre} & \PLUbuntuMin~~\PLUbuntuMax~~\PLUbuntuClose \\
	\end{tblr}
}

\DeclareTCBListing{PLtermunix}{ O{\linewidth} m !O{} }{%[taille] puis {titre=...} puis [option]
	PLtermlinux,title={\termnuxtitre[#2]},%
	listing only,listing engine=listings,%
	listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},%
	width=#1,#3
}

%OSX
\tcbset{PLfaketermosx/.style={%
	enhanced,boxrule=1pt,arc=6pt,before skip=12pt,after skip=12pt,%
	colframe=PLosxgray,colback=lightgray!15,colbacktitle=PLosxgray,colupper=black,coltitle=black,%
	titlerule=0.4pt,left=2pt,top=2pt,bottom=2pt,right=2pt,middle=2pt,%
	fonttitle=\bfseries\small\sffamily
	}
}

\newcommand{\PLOSXRed}{%
	\begin{tikzpicture}[thick,anchor=base,baseline]
		\filldraw[red] (0,0.25em) circle[radius=0.45em] ;
	\end{tikzpicture}%
}

\newcommand{\PLOSXOrange}{%
	\begin{tikzpicture}[thick,anchor=base,baseline]
		\filldraw[orange] (0,0.25em) circle[radius=0.45em] ;
	\end{tikzpicture}%
}

\newcommand{\PLOSXGreen}{%
	\begin{tikzpicture}[thick,anchor=base,baseline]
		\filldraw[ForestGreen] (0,0.25em) circle[radius=0.45em] ;
	\end{tikzpicture}%
}

\newcommand{\PLOSXLG}{%
	\begin{tikzpicture}[thick,anchor=base,baseline]
		\filldraw[PLosxgray] (0,0.25em) circle[radius=0.45em] ;
	\end{tikzpicture}%
}

\setKVdefault[fakeTERMosx]{titre={Terminal OSX}}

\newcommand\termosxtitre[1][]{%
	\restoreKV[fakeTERMosx]
	\setKV[fakeTERMosx]{#1}
	\begin{tblr}{colsep=0pt,rowsep=0pt,width=\linewidth,colspec={lX[c]r}}
		\PLOSXRed~\PLOSXOrange~\PLOSXGreen & \vphantom{p}\useKV[fakeTERMosx]{titre} & \PLOSXLG~\PLOSXLG~\PLOSXLG \\
	\end{tblr}
}

\DeclareTCBListing{PLtermosx}{ O{\linewidth} m !O{} }{%[taille] puis {titre=...} puis [option]
	PLfaketermosx,title={\termosxtitre[#2]},%
	listing only,listing engine=listings,%
	listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},%
	width=#1,#3
}

%============CartoucheCapytale========= OK !!
\definecolor{vertcapyt}{HTML}{008000}
\DeclareTotalTCBox{\liencapytale}{ s O{} m }
	{enhanced,size=fbox,on line,arc=3pt,colback=vertcapyt,colframe=vertcapyt,fontupper=\IfBooleanTF{#1}{\ttfamily}{\sffamily}\bfseries,colupper=white}%
	{#3#2~{\scriptsize\faLink}}

%============PaveDroitTikZ============= OK !!
\defKV[paramspave]{%
	largeur=\xdef\PFPaveLg{#1},%
	profondeur=\xdef\PFPavePf{#1},%
	hauteur=\xdef\PFPaveHt{#1},%
	angle=\xdef\PFPaveAngl{#1},%
	fuite=\xdef\PFPaveFuite{#1},%
	sommets=\def\PFPaveSommets{#1},%
	epaisseur=\xdef\PFPaveThick{#1}
}
\setKVdefault[paramspave]{%
	aff=false,%
	plein=false,%
	largeur=2,%
	profondeur=1,%
	hauteur=1.25,%
	angle=30,%
	fuite=0.5,%
	epaisseur=thick,%
	sommets=A§B§C§D§E§F§G§H,%
	cube=false
}

\newcommand\pavePL[1][]{%
	\useKVdefault[paramspave]%
	\setKV[paramspave]{#1}%
	\ifboolKV[paramspave]{cube}
	{\xdef\PFPavePf{\PFPaveLg}%
		\xdef\PFPaveHt{\PFPaveLg}}
	{}
	\setsepchar{§}%
	\readlist\PFListeSommets\PFPaveSommets
	\itemtomacro\PFListeSommets[1]\PaveA
	\itemtomacro\PFListeSommets[2]\PaveB
	\itemtomacro\PFListeSommets[3]\PaveC
	\itemtomacro\PFListeSommets[4]\PaveD
	\itemtomacro\PFListeSommets[5]\PaveE
	\itemtomacro\PFListeSommets[6]\PaveF
	\itemtomacro\PFListeSommets[7]\PaveG
	\itemtomacro\PFListeSommets[8]\PaveH
	%les nœuds du pave
	\coordinate (\PaveA) at (0,0) ;
	\coordinate (\PaveB) at ({\PFPaveLg},0) ;
	\coordinate (\PaveC) at ($(\PaveB) + ({\PFPaveAngl}:{\PFPaveFuite*\PFPavePf})$) ;
	\coordinate (\PaveD) at ($(\PaveA) + ({\PFPaveAngl}:{\PFPaveFuite*\PFPavePf})$) ;
	\coordinate (\PaveE) at ($(\PaveA) + (0,{\PFPaveHt})$) ;
	\coordinate (\PaveF) at ($(\PaveB) + (0,{\PFPaveHt})$) ;
	\coordinate (\PaveG) at ($(\PaveC) + (0,{\PFPaveHt})$) ;
	\coordinate (\PaveH) at ($(\PaveD) + (0,{\PFPaveHt})$) ;
	\ifboolKV[paramspave]{aff}
		{\draw (\PaveA) node[below left] {\PaveA} ;
			\draw (\PaveB) node[below right] {\PaveB} ;
			\draw (\PaveC) node[above right] {\PaveC} ;
			\ifboolKV[paramspave]{plein}
				{}
				{\draw (\PaveD) node[above left] {\PaveD} ;}
				\draw (\PaveE) node[below left] {\PaveE} ;
				\draw (\PaveF) node[below right] {\PaveF} ;
				\draw (\PaveG) node[above right] {\PaveG} ;
				\draw (\PaveH) node[above left] {\PaveH} ;}
		{}%on affiche rien
	\draw[\PFPaveThick] (\PaveA)--(\PaveB)--(\PaveF)--(\PaveE)--cycle
	                    (\PaveB)--(\PaveC)--(\PaveG)--(\PaveF)--cycle
	                    (\PaveG)--(\PaveH)--(\PaveE) ;
	\ifboolKV[paramspave]{plein}
		{}
		{\draw[dashed,\PFPaveThick] (\PaveA)--(\PaveD)--(\PaveC)
		                            (\PaveD)--(\PaveH) ;}
}

%============TétraèdreTikZ============= OK !!
\defKV[paramstetra]{%
	largeur=\xdef\PFTetraLg{#1},%
	profondeur=\xdef\PFTetraPf{#1},%
	hauteur=\xdef\PFTetraHt{#1},%
	alpha=\xdef\PFTetraAlpha{#1},%
	beta=\xdef\PFTetraBeta{#1},%
	sommets=\def\PFTetraSommets{#1},%
	epaisseur=\xdef\PFTetraThick{#1}
}
\setKVdefault[paramstetra]{%
	aff=false,%
	plein=false,%
	largeur=4,%
	profondeur=1.25,%
	hauteur=3,%
	alpha=40,%
	beta=60,%
	epaisseur=thick,%
	sommets=A§B§C§D,%
}

\newcommand\tetraPL[1][]{%
	\useKVdefault[paramstetra]%
	\setKV[paramstetra]{#1}%
	\setsepchar{§}%
	\readlist\PFListeSommets\PFTetraSommets
	\itemtomacro\PFListeSommets[1]\TetraA
	\itemtomacro\PFListeSommets[2]\TetraB
	\itemtomacro\PFListeSommets[3]\TetraC
	\itemtomacro\PFListeSommets[4]\TetraD
	%les nœuds du tétraèdre
	\coordinate (\TetraA) at (0,0) ;
	\coordinate (\TetraB) at ($(\TetraA) + ({-\PFTetraAlpha}:{\PFTetraPf})$) ;
	\coordinate (\TetraC) at ({\PFTetraLg},0) ;
	\coordinate (\TetraD) at ($(\TetraA) + ({\PFTetraBeta}:{\PFTetraHt})$) ;
	\ifboolKV[paramstetra]{aff}
	{\draw (\TetraA) node[left] {\TetraA} ;
		\draw (\TetraB) node[below] {\TetraB} ;
		\draw (\TetraC) node[right] {\TetraC} ;
		\draw (\TetraD) node[above] {\TetraD} ;}
		{}%on affiche rien
	\draw[\PFTetraThick] (\TetraA)--(\TetraD)--(\TetraC)--(\TetraB)--cycle
						(\TetraD)--(\TetraB) ;
	\ifboolKV[paramstetra]{plein}
		{}
		{\draw[dashed,\PFTetraThick] (\TetraA)--(\TetraC) ;}
}

%============EnsembleList============== OK !!
\defKV[kvensemble]{%
	sep=\def\PLenssep{#1},%
	option=\def\PLensopt{#1}
}

\setKVdefault[kvensemble]{%
	sep={;},%
	option=,%
	mathpunct=true
}

\newcommand\ensPL[2][1]{%
	\useKVdefault[kvensemble]
	\setKV[kvensemble]{#1}
	\ifboolKV[kvensemble]{mathpunct}%
		{\left\lbrace \PLensopt{} \mathpunct{} \StrSubstitute{#2}{/}{\mathpunct{}{\PLenssep}\mathpunct{}} \mathpunct{} \right\rbrace}%
		{\left\lbrace \PLensopt{} \StrSubstitute{#2}{/}{{\PLenssep}} \right\rbrace}
}

%===============SimplFrac============== OK !!
\DeclareDocumentCommand\convertfraction{ O{} m }{% argument optionnel [d ou t] puis argument mandataire {calcul ou fraction}
	\def\calculargument{\xintPRaw{\xintIrr{\xinteval{#2}}}}%on calcule et on transforme en A/B
	\IfSubStr{\calculargument}{/}%on teste si le symbole / apparaît
	{%si oui := fraction
		\StrBefore{\calculargument}{/}[\numerateur]%on extrait le numérateur
		\StrBehind{\calculargument}{/}[\denominateur]%on extrait le dénominateur
		\ifblank{#1}{\ensuremath{\frac{\numerateur}{\denominateur}}}{}%si l'argument optionnel est vide
		\IfStrEq{#1}{d}{\ensuremath{\dfrac{\numerateur}{\denominateur}}}{}%si l'arg opt est d
		\IfStrEq{#1}{t}{\ensuremath{\tfrac{\numerateur}{\denominateur}}}{}%si l'arg opt est t
	}{%si non := entier
		\num{\calculargument}%on affiche l'entier, avec le package siunitx
	}
}

%================CabWeb================ OK !!
\defKV[webrecurr]{%
	fct=\def\PLRecurfct{#1},%
	nom=\def\PLRecurnom{#1},%
	no=\def\PLRecurno{#1},%
	nb=\def\PLRecurnb{#1},%
	uno=\def\PLRecuruno{#1},%
	poslabel=\def\PLRecurposlab{#1},%
	decallabel=\def\PLRecuroffset{#1},%
	taillelabel=\def\PLRecurlabelsize{#1},%
}

\setKVdefault[webrecurr]{
	no=0,%
	nom=u,%
	nb=5,%
	afftermes=true,%
	poslabel=below,%
	decallabel=6pt,%
	taillelabel=\small
}

%\newcommand\recurr[1][]{%
	\NewDocumentCommand\recurrPL{ O{} O{thick,color=magenta} O{dotted} }{
		%<clés> + <style cabweb> + <style supplémentaire pointillés>
		\useKVdefault[webrecurr]%
		\setKV[webrecurr]{#1}% on paramètres les nouvelles clés et on les simplifie
		\foreach \i [remember=\i as \x (initially \PLRecuruno)] in {1,...,\PLRecurnb}{%
			\def\y{\fpeval{\PLRecurfct}}
			%test de la position courbe / bissectrice ?
			\ifnum \i=1
				\newdimen \X
				\newdimen \Y
				\X = \x pt
				\Y = \y pt
				\ifdim \Y < \X
					\draw[#2] (\x,\y)--(\y,\y) ;
				\else
					\draw[#2] (\x,\x)--(\x,\y)--(\y,\y) ;
				\fi
			\else
				\draw[#2] (\x,\x)--(\x,\y)--(\y,\y) ;
			\fi
			\ifboolKV[webrecurr]{afftermes}
				{\def\indice{\fpeval{\i+\PLRecurno-1}}
				 \draw[#2,#3] (\x,\y)--(\x,0) node[\PLRecurposlab=\PLRecuroffset,font=\PLRecurlabelsize]{$\PLRecurnom_\indice$};}
				{}
			\def\i{\fpeval{\y}}%
		}
	}

%================CercleTrigo=========== OK !!
\defKV[cercletrigo]{%
	rayon=\def\PLcerclerayon{#1},%
	epaisseur=\def\PLcerclethick{#1},%
	epaisseursol=\def\PLcerclesolthick{#1},%
	marge=\def\PLcerclemarge{#1},%
	taillevaleurs=\def\PLcerclevaleurs{#1},%
	tailleangles=\def\PLcercleangles{#1},%
	couleurfond=\def\PLcerclefond{#1},%
	decal=\def\PLcercledecal{#1},%
	cos=\def\PLcerclevalcos{#1},%
	sin=\def\PLcerclevalsin{#1},%
	couleursol=\def\PLcerclecoleq{#1}
}

\setKVdefault[cercletrigo]{
	rayon=3,%
	marge=0.25,%
	decal=10pt,%
	epaisseur=thick,%
	epaisseursol=very thick,%
	affangles=true,%
	afftraits=true,%
	affvaleurs=true,%
	moinspi=true,%
	taillevaleurs=\scriptsize,%
	tailleangles=\footnotesize,%
	couleurfond=white,%
	equationcos=false,%
	equationsin=false,%
	cos=45,%
	sin=30,%
	couleursol=blue
}

\newcommand\cercletrigoPL[1][]{%
	\useKVdefault[cercletrigo]
	\setKV[cercletrigo]{#1}
	\tikzset{PLval/.style={inner sep=1pt,font=\PLcerclevaleurs,fill=\PLcerclefond}}
	\tikzset{PLagl/.style={inner sep=1pt,font=\PLcercleangles,fill=\PLcerclefond}}
	%valeurs remarquables
	\ifboolKV[cercletrigo]{affangles}
		{%valeursdudessus
		\draw ({\PLcerclerayon},0) node[above right=2pt,font=\PLcercleangles] {0} ;
		\draw ($(30:{\PLcerclerayon})+(30:\PLcercledecal)$) node[PLagl] {$\tfrac{\pi}{6}$} ;
		\draw ($(45:{\PLcerclerayon})+(45:\PLcercledecal)$) node[PLagl] {$\tfrac{\pi}{4}$} ;
		\draw ($(60:{\PLcerclerayon})+(60:\PLcercledecal)$) node[PLagl] {$\tfrac{\pi}{3}$} ;
		\draw (0,{\PLcerclerayon}) node[above right=2pt,PLagl] {$\tfrac{\pi}{2}$} ;
		\draw ({-\PLcerclerayon},0) node[above left=2pt,PLagl] {$\pi$} ;
		\draw ($(150:{\PLcerclerayon})+(150:\PLcercledecal)$) node[PLagl] {$\tfrac{5\pi}{6}$} ;
		\draw ($(135:{\PLcerclerayon})+(135:\PLcercledecal)$) node[PLagl] {$\tfrac{3\pi}{4}$} ;
		\draw ($(120:{\PLcerclerayon})+(120:\PLcercledecal)$) node[PLagl] {$\tfrac{2\pi}{3}$} ;
		\draw ($(30:{\PLcerclerayon})+(30:\PLcercledecal)$) node[PLagl] {$\tfrac{\pi}{6}$} ;
		%valeursdudessous
		\draw ($(-30:{\PLcerclerayon})+(-30:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-}{11}\pi}{6}$} ;
		\draw ($(-45:{\PLcerclerayon})+(-45:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-}{7}\pi}{4}$} ;
		\draw ($(-60:{\PLcerclerayon})+(-60:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-}{5}\pi}{3}$} ;
		\draw (0,{-\PLcerclerayon}) node[below right=2pt,PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-}{3}\pi}{2}$} ;
		\draw ($(-120:{\PLcerclerayon})+(-120:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-2}{4}\pi}{3}$} ;
		\draw ($(-135:{\PLcerclerayon})+(-135:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-3}{5}\pi}{4}$} ;
		\draw ($(-150:{\PLcerclerayon})+(-150:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-5}{7}\pi}{6}$} ;
		\ifboolKV[cercletrigo]{moinspi}
			{\draw ({-\PLcerclerayon},0) node[below left=2pt,PLagl] {$-\pi$} ;}
			{\draw ({\PLcerclerayon},0) node[below right=2pt,PLagl] {$2\pi$} ;}
		}%
		{}
	%tracés
	\draw[\PLcerclethick,->] ({-\PLcerclerayon-\PLcerclemarge},0)--({\PLcerclerayon+\PLcerclemarge},0) ;
	\draw[\PLcerclethick,->] (0,{-\PLcerclerayon-\PLcerclemarge})--(0,{\PLcerclerayon+\PLcerclemarge}) ;
	\draw[\PLcerclethick] (0,0) circle[radius=\PLcerclerayon] ;
	\draw (0,0) node[below left=2pt,PLval] {0} ;
	%equations
	\ifboolKV[cercletrigo]{equationcos}
		{%traitsdeconstructioncos
		\draw[\PLcerclethick,dotted,gray] (-45:\PLcerclerayon) -- (135:\PLcerclerayon)
										  (-135:\PLcerclerayon) -- (45:\PLcerclerayon)
										  (30:\PLcerclerayon) -- (150:\PLcerclerayon)
										  (-30:\PLcerclerayon) -- (-150:\PLcerclerayon)
										  (-60:\PLcerclerayon)--(60:\PLcerclerayon)
										  (-120:\PLcerclerayon)--(120:\PLcerclerayon) ;
		\draw[\PLcerclesolthick,\PLcerclecoleq] ({\PLcerclevalcos}:\PLcerclerayon)--({-\PLcerclevalcos}:\PLcerclerayon) ;
		\filldraw[\PLcerclecoleq] ({\PLcerclevalcos}:\PLcerclerayon) circle[radius=2pt] ({-\PLcerclevalcos}:\PLcerclerayon) circle[radius=2pt] ;%
		}
		{}
	\ifboolKV[cercletrigo]{equationsin}
		{%traitsdeconstructioncos
		\draw[\PLcerclethick,dotted,gray] (-45:\PLcerclerayon) -- (135:\PLcerclerayon)
										  (-135:\PLcerclerayon) -- (45:\PLcerclerayon)
										  (30:\PLcerclerayon) -- (150:\PLcerclerayon)
										  (-30:\PLcerclerayon) -- (-150:\PLcerclerayon)
										  (-60:\PLcerclerayon)--(60:\PLcerclerayon)
										  (-120:\PLcerclerayon)--(120:\PLcerclerayon) ;
		\draw[\PLcerclesolthick,\PLcerclecoleq] ({\PLcerclevalsin}:\PLcerclerayon)--({180-\PLcerclevalsin}:\PLcerclerayon) ;
		\filldraw[\PLcerclecoleq] ({\PLcerclevalsin}:\PLcerclerayon) circle[radius=2pt] ({180-\PLcerclevalsin}:\PLcerclerayon) circle[radius=2pt] ;%
		}
		{}
	%valeurs
	\ifboolKV[cercletrigo]{affvaleurs}
		{%
		\draw ({0.5*\PLcerclerayon},0) node[below=2pt,PLval] {$\tfrac{1}{2}$} ;
		\draw ({-0.5*\PLcerclerayon},0) node[below=2pt,PLval] {$-\tfrac{1}{2}$} ;
		\draw (0,{0.5*\PLcerclerayon}) node[left=2pt,PLval] {$\tfrac{1}{2}$} ;
		\draw (0,{-0.5*\PLcerclerayon}) node[left=2pt,PLval] {$-\tfrac{1}{2}$} ;
		\draw ({0.866*\PLcerclerayon},0) node[below=2pt,PLval] {$\tfrac{\sqrt{3}}{2}$} ;
		\draw ({-0.866*\PLcerclerayon},0) node[below=2pt,PLval] {$-\tfrac{\sqrt{3}}{2}$} ;
		\draw (0,{0.866*\PLcerclerayon}) node[left=2pt,PLval] {$\tfrac{\sqrt{3}}{2}$} ;
		\draw (0,{-0.866*\PLcerclerayon}) node[left=2pt,PLval] {$-\tfrac{\sqrt{3}}{2}$} ;
		\draw ({0.707*\PLcerclerayon},0) node[above=2pt,PLval] {$\tfrac{\sqrt{2}}{2}$} ;
		\draw ({-0.707*\PLcerclerayon},0) node[above=2pt,PLval] {$-\tfrac{\sqrt{2}}{2}$} ;
		\draw (0,{0.707*\PLcerclerayon}) node[right=2pt,PLval] {$\tfrac{\sqrt{2}}{2}$} ;
		\draw (0,{-0.707*\PLcerclerayon}) node[right=2pt,PLval] {$-\tfrac{\sqrt{2}}{2}$} ;
		}%
		{}
	%valeurs remarquables en dernier
	\ifboolKV[cercletrigo]{afftraits}
		{%
		\draw[\PLcerclethick,dotted,gray] (-120:\PLcerclerayon) rectangle (60:\PLcerclerayon) ;
		\draw[\PLcerclethick,dotted,gray] (-150:\PLcerclerayon) rectangle (30:\PLcerclerayon) ;
		\draw[\PLcerclethick,dotted,gray] (-135:\PLcerclerayon) rectangle (45:\PLcerclerayon) ;
		\draw[\PLcerclethick,dotted,gray] (-120:\PLcerclerayon)--(60:\PLcerclerayon) ;
		\draw[\PLcerclethick,dotted,gray] (-150:\PLcerclerayon)--(30:\PLcerclerayon) ;
		\draw[\PLcerclethick,dotted,gray] (-135:\PLcerclerayon)--(45:\PLcerclerayon) ;
		\draw[\PLcerclethick,dotted,gray] (120:\PLcerclerayon)--(-60:\PLcerclerayon) ;
		\draw[\PLcerclethick,dotted,gray] (150:\PLcerclerayon)--(-30:\PLcerclerayon) ;
		\draw[\PLcerclethick,dotted,gray] (135:\PLcerclerayon)--(-45:\PLcerclerayon) ;
		}%
		{}
}


\endinput