summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-piton.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/proflycee/proflycee-tools-piton.tex')
-rw-r--r--Master/texmf-dist/tex/latex/proflycee/proflycee-tools-piton.tex150
1 files changed, 139 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-piton.tex b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-piton.tex
index 2bb7dadcc83..7503f17894d 100644
--- a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-piton.tex
+++ b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-piton.tex
@@ -10,11 +10,15 @@
\RequirePackage{iftex}
-%%------PYTHONPITON
+%%=============PYTHONPITON
+
+%==Clés globales
\defKV[envpiton]{%
Largeur=\def\CODPITlargeur{#1},%
Alignement=\def\CODPITalign{#1},%
- TaillePolice=\def\CODPITfonte{#1}
+ TaillePolice=\def\CODPITfonte{#1},%
+ Style=\def\CODPITstyle{#1},%
+ Titre=\def\CODPITtitre{#1}
}
\setKVdefault[envpiton]{%
@@ -22,14 +26,20 @@
Alignement=center,%
Lignes=true,%
Gobble=true,%
- TaillePolice=\footnotesize
+ TaillePolice=\footnotesize,%
+ Filigrane=false,%
+ Style=Moderne,%
+ Cadre=true,%
+ BarreTitre=true,%
+ Titre={{\scriptsize\faCode} Code Python}
}
+%==Style Moderne
\tcbset{stylepiton/.style={%
enhanced,boxrule=1.25pt,%
sharp corners=downhill,arc=12pt,
- before skip=12pt,after skip=12pt,%
- top=10pt,bottom=1mm,rightupper=4pt,%leftupper=25pt,
+ before skip=\baselineskip,after skip=\baselineskip,%
+ top=\baselineskip,bottom=0mm,left=0.6em,right=5mm,%
attach boxed title to top right={yshift=-\tcboxedtitleheight},
boxed title style={
size=small,colback=ForestGreen!25,boxrule=1.25pt,
@@ -37,31 +47,149 @@
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
+ title={{\scriptsize\faPython}\:Code Python}
+ }
+}
+
+%==Style Classique
+\tcbset{thonnystyle/.style={%
+ enhanced,boxrule=0.75pt,colframe=DarkGray!25!Black,%
+ sharp corners,top=0mm,bottom=0mm,left=0.4em,right=5mm,%
+ before skip=\baselineskip,after skip=\baselineskip,%
+ colback=white
+ }
+}
+
+\tcbset{thonnystylelineos/.style={%
+ thonnystyle,%
+ underlay={%
+ \begin{tcbclipinterior}
+ \filldraw[lightgray!15] (interior.south west) rectangle ([xshift=1.3em]interior.north west) ;
+ \end{tcbclipinterior}%
+ }
}
}
+%==Création de la boîte
\ifluatex
\RequirePackage{piton}
\NewPitonEnvironment{CodePiton}{ O{} }%
{%
+ \tcbset{reset}
\useKVdefault[envpiton]%
\setKV[envpiton]{#1}% on paramètres les nouvelles clés et on les simplifie
+ %------les styles piton
\ifboolKV[envpiton]{Lignes}%si lignes=true
- {\PitonOptions{left-margin=auto,all-line-numbers}}%
+ {\PitonOptions{left-margin=0.75em,all-line-numbers}}%left-margin=auto,
{}%
\ifboolKV[envpiton]{Gobble}%si gobble=true
{\PitonOptions{tabs-auto-gobble}}%
{}%
- \PitonOptions{break-lines,indent-broken-lines}%
- \begin{tcolorbox}[stylepiton,leftupper=8pt,colframe=Green,colback=ForestGreen!5,width=\CODPITlargeur,fontupper=\CODPITfonte,fontlower=\CODPITfonte,\CODPITalign]
+ \PitonOptions{break-lines,indent-broken-lines}%,numbers-sep=0.65em}
+ %------les styles tcbox
+ \IfEq{\CODPITstyle}{Moderne}%style Moderne (défaut)
+ {%
+ \tcbset{stylepiton,colframe=Green,colback=ForestGreen!5,width=\CODPITlargeur,fontupper=\CODPITfonte,fontlower=\CODPITfonte,\CODPITalign}
+ \ifboolKV[envpiton]{Filigrane}%si filigrane
+ {\tcbset{watermark text={\faPython},watermark opacity=0.175,watermark zoom=0.50}}%
+ {}%
+ }
+ {}%
+ \IfEq{\CODPITstyle}{Classique}%style Classique
+ {%
+ \ifboolKV[envpiton]{Lignes}%si lignes=true
+ {\tcbset{thonnystylelineos,leftupper=0.4em}}%
+ {\tcbset{thonnystyle,leftupper=0.4em}}%
+ \tcbset{width=\CODPITlargeur,colframe=darkgray,fontupper=\CODPITfonte,fontlower=\CODPITfonte,\CODPITalign}
+ \ifboolKV[envpiton]{Filigrane}%si filigrane
+ {\tcbset{watermark text={\faPython},watermark opacity=0.175,watermark zoom=0.50}}%
+ {}%
+ \ifboolKV[envpiton]{BarreTitre}%
+ {%
+ \ifboolKV[envpiton]{Cadre}
+ {}
+ {\tcbset{boxrule=0pt,frame hidden}}
+ \tcbset{lefttitle=0.4em,title={\CODPITtitre},fonttitle=\bfseries\footnotesize\sffamily,colbacktitle=DarkGray!25!Black}
+ }%
+ {%
+ \tcbset{notitle}
+ \ifboolKV[envpiton]{Cadre}
+ {}
+ {\tcbset{boxrule=0pt,frame hidden}}
+ }
+ }
+ {}%
+ %on crée la boîte
+ \begin{tcolorbox}
}%
{%
\end{tcolorbox}%
}
\fi
+
+%======CONSOLE PYLUATEX (package à charger manuellement !!)
+\tcbset{consolepylua/.style={%base de la boîte
+ enhanced,colback=white,colframe=ForestGreen,sharp corners,boxrule=1pt,%
+ top=1.5mm,bottom=1.5mm,left=2mm,right=2mm,fontupper=\small,%
+ before skip=\baselineskip,after skip=\baselineskip,%
+ }
+}
+
+\tcbset{consolepyluatexlogo/.style={%avec logo python
+ consolepylua,%
+ overlay={%
+ \draw ([yshift=0.5pt]frame.south) node[ForestGreen!50!black,fill=white,font=\scriptsize\ttfamily] {\scalebox{0.8}[0.8]{\faPython} Fin de la Console Python \scalebox{0.8}[0.8]{\faPython}} ;
+ \draw ([yshift=-0.5pt]frame.north) node[ForestGreen!50!black,fill=white,font=\scriptsize\ttfamily] {\scalebox{0.8}[0.8]{\faPython} Début de la Console Python \scalebox{0.8}[0.8]{\faPython}} ;
+ }
+ }
+}
+
+\tcbset{consolepyluatex/.style={%sans logo python
+ consolepylua,%
+ overlay={%
+ \draw ([yshift=0.5pt]frame.south) node[ForestGreen!50!black,fill=white,font=\scriptsize\ttfamily] {Fin de la Console Python} ;
+ \draw ([yshift=-0.5pt]frame.north) node[ForestGreen!50!black,fill=white,font=\scriptsize\ttfamily] {Début de la Console Python} ;
+ }
+ }
+}
+
+\defKV[consolepyluatex]{%
+ Largeur=\def\ConsPyluaLarg{#1},%
+ Alignement=\def\ConsPyluaAlign{#1}
+}
+\setKVdefault[consolepyluatex]{%
+ Logo=true,%
+ Largeur=\linewidth,%
+ Alignement=flush left
+}
+
+\NewDocumentEnvironment{ConsolePiton}{ O{} D<>{} m }%
+%1=options piton
+%2=clés
+%3=options tcbox
+{
+ \restoreKV[consolepyluatex]% revenir au valeurs par défaut
+ \setKV[consolepyluatex]{#2}% lit les arguments optionnels
+ \PitonOptions{#1}
+ \PyLTVerbatimEnv
+ \ifboolKV[consolepyluatex]{Logo}
+ {\tcbset{consolepyluatexlogo,width=\ConsPyluaLarg,\ConsPyluaAlign,#3}}
+ {\tcbset{consolepyluatex,width=\ConsPyluaLarg,\ConsPyluaAlign,#3}}
+ \begin{tcolorbox}
+ \begin{pythonrepl}
+}
+{
+ \directlua{
+ tex.print("\\begin{Piton}")
+ tex.print(pyluatex.get_last_output())
+ tex.print("\\end{Piton}")
+ tex.print("")
+}
+ \end{pythonrepl}
+\end{tcolorbox}
+}
+
\endinput \ No newline at end of file