diff options
author | Norbert Preining <norbert@preining.info> | 2023-09-20 03:01:03 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-09-20 03:01:03 +0000 |
commit | ab5949fa3536e691f573eb3d885927c97281eb9c (patch) | |
tree | 8e2c70f778a43eae4ba103d71f6477f9ae2cdd60 /macros/latex/contrib/proflycee/tex | |
parent | 23c5f33b784af6cc6c4ee2f5482ef5f21c774006 (diff) |
CTAN sync 202309200301
Diffstat (limited to 'macros/latex/contrib/proflycee/tex')
5 files changed, 410 insertions, 103 deletions
diff --git a/macros/latex/contrib/proflycee/tex/ProfLycee.sty b/macros/latex/contrib/proflycee/tex/ProfLycee.sty index f3bd0c6e22..17d7d7125b 100644 --- a/macros/latex/contrib/proflycee/tex/ProfLycee.sty +++ b/macros/latex/contrib/proflycee/tex/ProfLycee.sty @@ -3,7 +3,8 @@ % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ProfLycee}[2023/09/03 2.7.4 Aide pour l'utilisation de LaTeX en lycee] +\ProvidesPackage{ProfLycee}[2023/09/19 2.7.5 Aide pour l'utilisation de LaTeX en lycee] +% 2.7.5 Ajout d'options pour les environnements de code (piton + listings) % 2.7.4 Ajout de commandes pour des écritures mathématiques (avec librairie ?) % 2.7.3 Correction de la couleur de bordures vertes pour les codes python % 2.7.2 Modification du chargement de xcolor pour éviter les clash errors (couleurs adaptées du coup), passage en option (test) diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex index 83d471a520..40dfdae779 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex @@ -8,6 +8,7 @@ % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. +%2.7.5 Ajout de clés pour PythonLst + Couleurs optionnelles pour PseudoCode %2.7.3 Correction de la couleur des bordures %2.5.8 Styles alternatifs + Modification marges @@ -100,10 +101,55 @@ } } -\NewTCBListing{CodePythonLst}{ s O{\linewidth} m }{% * off pour numéros de lignes + {largeur} + <options tcbox> - \IfBooleanTF{#1}{stylepythonlstnolineos}{stylepythonlstlineos}, - width=#2,#3 -} +%test v3 avec simplekv +\defKV[CodePythonLst]{% + Largeur=\def\CodePythonLstLarg{#1},% + PremLigne=\def\CodePythonLstFirstLine{#1} +} + +\setKVdefault[CodePythonLst]{% + Largeur=\linewidth,% + PremLigne=1 +} + +\NewDocumentEnvironment{CodePythonLst}{ s O{} m }%nouvelle version avec clés listings +{% + \useKVdefault[CodePythonLst]% + \setKV[CodePythonLst]{#2}% on paramètres les nouvelles clés et on les simplifie + \IfBooleanTF{#1}% + {% + \tcblisting{stylepythonlst,listing options={style=PLpython,xleftmargin=0pt,numbers=none},width=\CodePythonLstLarg,#3} + }% + {% + \tcblisting{stylepythonlst,listing options={style=PLpython,xleftmargin=16pt,numbers=left,firstnumber=\CodePythonLstFirstLine},width=\CodePythonLstLarg,#3} + }% +}% +{% + \endtcblisting% +} + +%\NewTCBListing{CodePythonLst}{ s O{\linewidth} m !D<>{1} }{% * off pour numéros de lignes + {largeur} + <options tcbox> +% enhanced,boxrule=1.25pt,% +% left=0.6em, +% sharp corners=downhill,arc=12pt, +% before skip=0.5\baselineskip,after skip=0.5\baselineskip,% +% top=\baselineskip,bottom=1mm,right=5mm, +% attach boxed title to top right={yshift=-\tcboxedtitleheight}, +% boxed title style={ +% size=small,colback=CouleurVertForet!25,boxrule=1.25pt, +% colframe=CouleurVertForet,boxsep=1.25pt, +% sharp corners=downhill, +% arc=12pt, +% top=2pt,bottom=1pt,left=6pt,right=6pt +% }, +% colframe=CouleurVertForet,colback=CouleurVertForet!5,% +% fonttitle=\color{CouleurVertForet}\itshape\ttfamily\footnotesize, +% title={\scriptsize\faPython}\:Code Python\vphantom{p}, +% watermark text={\faPython},watermark opacity=0.175,watermark zoom=0.50, +% listing only,listing engine=listings, +% \IfBooleanTF{#1}{stylepythonlstnolineos}{stylepythonlstlineos}, +% width=#2,#3 +%} \NewTCBInputListing{\CodePythonLstFichier}{ s O{\linewidth} m m }{ \IfBooleanTF{#1}{stylepythonlstnolineos}{stylepythonlstlineos}, @@ -143,8 +189,28 @@ } } -\NewTCBListing{CodePythonLstAlt}{ s O{\linewidth} m }{% * off pour numéros de lignes + {options keys} + <options tcbox> - \IfBooleanTF{#1}{StylPythonBno}{StylPythonByes},width=#2,#3 +\NewDocumentEnvironment{CodePythonLstAlt}{ s O{} m }%nouvelle version avec clés listings +{% + \useKVdefault[CodePythonLst]% + \setKV[CodePythonLst]{#2}% on paramètres les nouvelles clés et on les simplifie + \IfBooleanTF{#1}% + {% + \tcblisting{StylPythonB, + listing options={style=PLpython,xleftmargin=0pt,numbers=none},width=\CodePythonLstLarg,#3} + }% + {% + \tcblisting{StylPythonB, + listing options={style=PLpython,xleftmargin=16pt,numbers=left,firstnumber=\CodePythonLstFirstLine},% + underlay={% + \begin{tcbclipinterior} + \draw[draw=none,fill=lightgray!25] (interior.south west) rectangle ([xshift=1.3em]interior.north west) ; + \end{tcbclipinterior}% + }, + width=\CodePythonLstLarg,#3} + }% +}% +{% + \endtcblisting% } \NewTCBInputListing{\CodePythonLstFichierAlt}{ s O{\linewidth} m m }{ @@ -153,14 +219,35 @@ listing file={#4} } +% \NewDocumentEnvironment{CodePythonLstFichierAlt}{ s O{\linewidth} m m }%nouvelle version avec option listings +% {% + % \IfBooleanTF{#1}% + % {% + % \tcblisting{StylPythonB,listing options={style=PLpython,xleftmargin=0pt,numbers=none},width=#2,#3,listing file={#4}} + % }% + % {% + % \tcblisting{StylPythonB, + % listing options={style=PLpython,xleftmargin=16pt,numbers=left},% + % underlay={% + % \begin{tcbclipinterior} + % \draw[draw=none,fill=lightgray!25] (interior.south west) rectangle ([xshift=1.3em]interior.north west) ; + % \end{tcbclipinterior}% + % }, + % width=#2,#3,listing file={#4}} + % }% +% }% +% {% + % \endtcblisting% +% } + %%------PSEUDOCODE %language pseudocode listings \lstdefinestyle{pseudocodePL}{% language = langnat, basicstyle = \footnotesize\ttfamily, numberstyle = \scriptsize\ttfamily\color{gray}, - keywordstyle = \bfseries, - stringstyle = \color{red!75}, + %keywordstyle = \bfseries, + %stringstyle = \color{red!75}, keepspaces = true, tabsize = 4, numbersep = 10pt, @@ -175,8 +262,8 @@ language = langnat, basicstyle = \footnotesize\ttfamily, numberstyle = \scriptsize\ttfamily\color{gray}, - keywordstyle = \bfseries, - stringstyle = \color{red!75}, + %keywordstyle = \bfseries, + %stringstyle = \color{red!75}, keepspaces = true, tabsize = 4, numbersep = 10pt, @@ -186,6 +273,17 @@ escapeinside = {(*}{*)} } +\defKV[CodePseudoCodeLst]{% + Largeur=\def\CodePseudoCodeLstLarg{#1},% + PremLigne=\def\CodePseudoCodeLstFirstLine{#1} +} + +\setKVdefault[CodePseudoCodeLst]{% + Largeur=\linewidth,% + PremLigne=1,% + Couleur=false +} + %style tcbox pseudocode avec bannière hautdroite \tcbset{stylepseudocodePL/.style={% enhanced,boxrule=1.25pt,sharp corners=downhill,arc=12pt, @@ -210,38 +308,108 @@ \newcommand\algomathttPL[1]{\mathtt{#1}} \fi -\DeclareTCBListing{PseudoCode}{ s O{12cm} m }{% é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=0pt,belowskip=0pt, - 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}% - } -} +\colorlet{MotsClesPseudoCodeA}{blue!75} +\colorlet{MotsClesPseudoCodeB}{green!50!black} +\colorlet{MotsClesPseudoCodeChaine}{red!75} + +\NewDocumentEnvironment{PseudoCode}{ s O{} m }%nouvelle version avec clés listings +{% + \useKVdefault[CodePseudoCodeLst]% + \setKV[CodePseudoCodeLst]{#2}% on paramètres les nouvelles clés et on les simplifie + %en fonction de la couleur ?? + \ifboolKV[CodePseudoCodeLst]{Couleur}% + {% + \tcblisting{width=\CodePseudoCodeLstLarg,#3, + stylepseudocodePL, + listing only,listing engine=listings, + listing options={ + style=\IfBooleanTF{#1}{pseudocodenoPL}{pseudocodePL},%version étoilée sans numéro de lignes + aboveskip=0pt,belowskip=0pt, + columns=fullflexible,firstnumber=\CodePseudoCodeLstFirstLine,% + stringstyle=\color{MotsClesPseudoCodeChaine}, + classoffset=0,% + keywords={Pour,Fonction,Début,allant,Fin,Si,alors,Sinon,SinonSi,FinSi,FinPour,FinTantQue,TantQue},% + keywordstyle=\color{MotsClesPseudoCodeA},% + classoffset=1,% + morekeywords={Afficher,Retourner,Saisir},% + keywordstyle=\color{MotsClesPseudoCodeB},% + 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}% + }} + }% + {% + \tcblisting{width=\CodePseudoCodeLstLarg,#3, + stylepseudocodePL, + listing only,listing engine=listings, + listing options={ + style=\IfBooleanTF{#1}{pseudocodenoPL}{pseudocodePL},%version étoilée sans numéro de lignes + aboveskip=0pt,belowskip=0pt, + columns=fullflexible,firstnumber=\CodePseudoCodeLstFirstLine,% + 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}% + }} + }% +}% +{% + \endtcblisting% +} + +% \DeclareTCBListing{PseudoCode}{ s O{12cm} m D<>{} }{% étoilée sans numéro, [taille] puis {option tcbox} puis <options listings>... + % 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=0pt,belowskip=0pt, + % columns=fullflexible,#4,% + % 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}% + % } +% } %style tcbox pseudocode v2 \lstdefinestyle{pseudocodePLalt}{% language = langnat, basicstyle = \footnotesize\ttfamily, numberstyle = \scriptsize\ttfamily\color{gray}, - keywordstyle = \bfseries, - stringstyle = \color{red!75}, + %keywordstyle = \bfseries, + %stringstyle = \color{red!75}, keepspaces = true, tabsize = 4, xleftmargin = 1.5em, @@ -255,8 +423,8 @@ language = langnat, basicstyle = \footnotesize\ttfamily, numberstyle = \scriptsize\ttfamily\color{gray}, - keywordstyle = \bfseries, - stringstyle = \color{red!75}, + %keywordstyle = \bfseries, + %stringstyle = \color{red!75}, keepspaces = true, tabsize = 4, numbers = none, @@ -288,31 +456,99 @@ } } -\DeclareTCBListing{PseudoCodeAlt}{ s O{12cm} m }{% étoilée sans numéro, <taille> puis option... - width=#2,#3, - stylepseudocodePLalt, - listing only,listing engine=listings, - \IfBooleanTF{#1}{}{stylepseudocodePLaltlines}, - listing options={ - style=\IfBooleanTF{#1}{pseudocodenoPLalt}{pseudocodePLalt},%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}% - } -} +\NewDocumentEnvironment{PseudoCodeAlt}{ s O{} m }%nouvelle version avec clés listings +{% + \useKVdefault[CodePseudoCodeLst]% + \setKV[CodePseudoCodeLst]{#2}% on paramètres les nouvelles clés et on les simplifie + %différence ssuivant [Couleur] + \ifboolKV[CodePseudoCodeLst]{Couleur}% + {% + \tcblisting{width=\CodePseudoCodeLstLarg,#3, + stylepseudocodePLalt, + listing only,listing engine=listings, + \IfBooleanTF{#1}{}{stylepseudocodePLaltlines}, + listing options={ + style=\IfBooleanTF{#1}{pseudocodenoPLalt}{pseudocodePLalt},%version étoilée sans numéro de lignes + aboveskip=2pt,belowskip=2pt, + columns=fullflexible,firstnumber=\CodePseudoCodeLstFirstLine, + stringstyle=\color{MotsClesPseudoCodeChaine}, + classoffset=0,% + keywords={Pour,Fonction,Début,allant,Fin,Si,alors,Sinon,SinonSi,FinSi,FinPour,FinTantQue,TantQue},% + keywordstyle=\color{MotsClesPseudoCodeA},% + classoffset=1,% + morekeywords={Afficher,Retourner,Saisir},% + keywordstyle=\color{MotsClesPseudoCodeB},% + 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}% + }} + }% + {% + \tcblisting{width=\CodePseudoCodeLstLarg,#3, + stylepseudocodePLalt, + listing only,listing engine=listings, + \IfBooleanTF{#1}{}{stylepseudocodePLaltlines}, + listing options={ + style=\IfBooleanTF{#1}{pseudocodenoPLalt}{pseudocodePLalt},%version étoilée sans numéro de lignes + aboveskip=2pt,belowskip=2pt, + columns=fullflexible,firstnumber=\CodePseudoCodeLstFirstLine, + 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}% + }} + }% +}% +{% + \endtcblisting% +} + +% \DeclareTCBListing{PseudoCodeAlt}{ s O{12cm} m D<>{} }{% étoilée sans numéro, [taille] puis {option tcbox} puis <options listings>... + % width=#2,#3, + % stylepseudocodePLalt, + % listing only,listing engine=listings, + % \IfBooleanTF{#1}{}{stylepseudocodePLaltlines}, + % listing options={ + % style=\IfBooleanTF{#1}{pseudocodenoPLalt}{pseudocodePLalt},%version étoilée sans numéro de lignes + % aboveskip=2pt,belowskip=2pt, + % columns=fullflexible,#4, + % 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}% + % } +% } %%------PRESENTATIONDECODES CLASSIQUES \NewTCBListing{PresentationCode}{ O{CouleurVertForet} m }{% diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-minted.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-minted.tex index b3c8d288f0..49407898c4 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-minted.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-minted.tex @@ -8,11 +8,23 @@ % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. +% 2.7.5 Argument optionnel pour les numéros de lignes + changement déclaration environnements %2.7.3 Correction de la couleur des bordures %2.5.8 Style alternatif + Modification marges %%------PYTHONMINTED +%clés +\defKV[CodePythonMinted]{% + Largeur=\def\CodePythonMintedLarg{#1},% + PremLigne=\def\CodePythonMintedPremLigne{#1} +} + +\setKVdefault[CodePythonMinted]{% + Largeur=\linewidth,% + PremLigne=1 +} + %v1 \tcbset{pytmintedno/.style={% listing engine=minted,minted style=colorful, @@ -28,28 +40,72 @@ } } -\DeclareTCBListing{CodePythonMinted}{ s O{12cm} m }{% étoilée sans numéro, taille puis options... - \IfBooleanTF{#1}{pytmintedno}{pytminted}, - enhanced,width=#2,#3, - colframe=CouleurVertForet,colback=CouleurVertForet!5,% - boxrule=1.25pt, - sharp corners=downhill,arc=12pt, - before skip=0.5\baselineskip,after skip=0.5\baselineskip,% - left=0.6em,top=\baselineskip,bottom=2mm,right=5mm,% - attach boxed title to top right={yshift=-\tcboxedtitleheight}, - boxed title style={ - size=small,colback=CouleurVertForet!25,boxrule=1.25pt, - colframe=CouleurVertForet,boxsep=1.25pt, - sharp corners=downhill, - arc=12pt, - top=2pt,bottom=1pt,left=6pt,right=6pt - }, - fonttitle=\color{CouleurVertForet}\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{darkgray}\arabic{FancyVerbLine}} +\NewDocumentEnvironment{CodePythonMinted}{ s O{} m }%nouvelle version avec option minted +{% + \useKVdefault[CodePythonMinted]% + \setKV[CodePythonMinted]{#2}% + \IfBooleanTF{#1}% + {% + \tcblisting{listing engine=minted,minted style=colorful,minted language=python,listing only,minted options={tabsize=4,fontsize=\footnotesize,autogobble},enhanced,width=\CodePythonMintedLarg,#3,colframe=CouleurVertForet,colback=CouleurVertForet!5,boxrule=1.25pt,sharp corners=downhill,arc=12pt,before skip=0.5\baselineskip,after skip=0.5\baselineskip,% + left=0.6em,top=\baselineskip,bottom=2mm,right=5mm,% + attach boxed title to top right={yshift=-\tcboxedtitleheight}, + boxed title style={ + size=small,colback=CouleurVertForet!25,boxrule=1.25pt, + colframe=CouleurVertForet,boxsep=1.25pt, + sharp corners=downhill, + arc=12pt, + top=2pt,bottom=1pt,left=6pt,right=6pt + }, + fonttitle=\color{CouleurVertForet}\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{darkgray}\arabic{FancyVerbLine}} + } + }% + {% + \tcblisting{listing engine=minted,minted style=colorful,minted language=python,listing only,minted options={tabsize=4,fontsize=\footnotesize,autogobble,xleftmargin=16pt,linenos,numbersep=10pt,firstnumber=\CodePythonMintedPremLigne},,enhanced,width=\CodePythonMintedLarg,#3,colframe=CouleurVertForet,colback=CouleurVertForet!5,boxrule=1.25pt,sharp corners=downhill,arc=12pt,before skip=0.5\baselineskip,after skip=0.5\baselineskip,% + left=0.6em,top=\baselineskip,bottom=2mm,right=5mm,% + attach boxed title to top right={yshift=-\tcboxedtitleheight}, + boxed title style={ + size=small,colback=CouleurVertForet!25,boxrule=1.25pt, + colframe=CouleurVertForet,boxsep=1.25pt, + sharp corners=downhill, + arc=12pt, + top=2pt,bottom=1pt,left=6pt,right=6pt + }, + fonttitle=\color{CouleurVertForet}\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{darkgray}\arabic{FancyVerbLine}} + } + }% +}% +{% + \endtcblisting% } +% \DeclareTCBListing{CodePythonMinted}{ s O{12cm} m }{% étoilée sans numéro, taille puis options... + % \IfBooleanTF{#1}{pytmintedno}{pytminted}, + % enhanced,width=#2,#3, + % colframe=CouleurVertForet,colback=CouleurVertForet!5,% + % boxrule=1.25pt, + % sharp corners=downhill,arc=12pt, + % before skip=0.5\baselineskip,after skip=0.5\baselineskip,% + % left=0.6em,top=\baselineskip,bottom=2mm,right=5mm,% + % attach boxed title to top right={yshift=-\tcboxedtitleheight}, + % boxed title style={ + % size=small,colback=CouleurVertForet!25,boxrule=1.25pt, + % colframe=CouleurVertForet,boxsep=1.25pt, + % sharp corners=downhill, + % arc=12pt, + % top=2pt,bottom=1pt,left=6pt,right=6pt + % }, + % fonttitle=\color{CouleurVertForet}\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{darkgray}\arabic{FancyVerbLine}} +% } + %v2 \tcbset{pytmintedaltno/.style={% listing engine=minted,minted style=colorful, @@ -70,19 +126,29 @@ } } -\DeclareTCBListing{CodePythonMintedAlt}{ s O{12cm} m }{% étoilée sans numéro, taille puis options... - \IfBooleanTF{#1}{pytmintedaltno}{pytmintedalt}, - width=#2,#3, - enhanced,boxrule=0.75pt,colframe=darkgray!50!black,% - sharp corners,top=0mm,bottom=0mm,left=0.2em,right=5mm,% - before skip=0.5\baselineskip,after skip=0.5\baselineskip,% - colback=white, - fontupper=\footnotesize,fontlower=\footnotesize,% - watermark text={\faPython},watermark opacity=0.25,watermark zoom=0.50,% - title={{\scriptsize\faCode} Code Python}, - lefttitle=0.4em, - fonttitle=\bfseries\footnotesize\sffamily,colbacktitle=darkgray!50!black,% - before upper=\renewcommand{\theFancyVerbLine}{\scriptsize\ttfamily\color{darkgray}\arabic{FancyVerbLine}} +\NewDocumentEnvironment{CodePythonMintedAlt}{ s O{} m }%nouvelle version avec option minted +{% + \useKVdefault[CodePythonMinted]% + \setKV[CodePythonMinted]{#2}% + \IfBooleanTF{#1}% + {% + \tcblisting{listing engine=minted,minted style=colorful,minted language=python,listing only,minted options={tabsize=4,fontsize=\footnotesize,autogobble},width=\CodePythonMintedLarg,#3,enhanced,boxrule=0.75pt,colframe=darkgray!50!black,sharp corners,top=0mm,bottom=0mm,left=0.2em,right=5mm,before skip=0.5\baselineskip,after skip=0.5\baselineskip,colback=white,fontupper=\footnotesize,fontlower=\footnotesize,watermark text={\faPython},watermark opacity=0.25,watermark zoom=0.50,title={{\scriptsize\faCode} Code Python},lefttitle=0.4em,fonttitle=\bfseries\footnotesize\sffamily,colbacktitle=darkgray!50!black,before upper=\renewcommand{\theFancyVerbLine}{\scriptsize\ttfamily\color{darkgray}\arabic{FancyVerbLine}}} + }% + {% + \tcblisting{listing engine=minted,minted style=colorful, + minted language=python,listing only, + minted options={tabsize=4,fontsize=\footnotesize,autogobble,xleftmargin=16pt,linenos,numbersep=10pt,firstnumber=\CodePythonMintedPremLigne}, + underlay={% + \begin{tcbclipinterior} + \draw[draw=none,fill=lightgray!25] (interior.south west) rectangle ([xshift=1.3em]interior.north west) ; + \end{tcbclipinterior}% + }, + width=\CodePythonMintedLarg,#3,enhanced,boxrule=0.75pt,colframe=darkgray!50!black,sharp corners,top=0mm,bottom=0mm,left=0.2em,right=5mm,before skip=0.5\baselineskip,after skip=0.5\baselineskip,colback=white,fontupper=\footnotesize,fontlower=\footnotesize,watermark text={\faPython},watermark opacity=0.25,watermark zoom=0.50,title={{\scriptsize\faCode} Code Python},lefttitle=0.4em,fonttitle=\bfseries\footnotesize\sffamily,colbacktitle=darkgray!50!black,before upper=\renewcommand{\theFancyVerbLine}{\scriptsize\ttfamily\color{darkgray}\arabic{FancyVerbLine}} + } + }% +}% +{% + \endtcblisting% } \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex index 3433e2b2ad..5d9ddeb1e8 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex @@ -8,6 +8,7 @@ % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. +%2.7.5 Ajout d'un argument optionnel pour commencer les codes python à un numéro de ligne différent de 1 %2.7.3 Correction de la couleur des bordures %2.6.9 Amalioration de la gestion des style := intégration directe dans la tcbox ! %2.5.9 Ajout d'une clé pour la couleur des nombres @@ -85,7 +86,7 @@ %==Création de la boîte (essai v2 ?) \ifluatex \RequirePackage{piton} -\NewPitonEnvironment{CodePiton}{ O{} m }% +\NewPitonEnvironment{CodePiton}{ O{} m D<>{} }% {% \tcbset{reset} \useKVdefault[envpiton]% @@ -93,7 +94,7 @@ %------les styles piton \SetPitonStyle{ Number = \color{\CODPITcolnb} }% \ifboolKV[envpiton]{Lignes}%si lignes=true - {\PitonOptions{left-margin=0.75em,all-line-numbers}}%left-margin=auto, + {\PitonOptions{left-margin=0.75em,all-line-numbers,line-numbers={#3}}}%left-margin=auto, {}% \ifboolKV[envpiton]{Gobble}%si gobble=true {\PitonOptions{tabs-auto-gobble}}% @@ -135,10 +136,10 @@ } {}% %on crée la boîte - \begin{tcolorbox}[stylebase,filigrane,cadre,titre] + \tcolorbox[stylebase,filigrane,cadre,titre] }% {% - \end{tcolorbox}% + \endtcolorbox% } \fi diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-pythontex.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-pythontex.tex index 6c367f6c55..ea2dbf6066 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-pythontex.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-pythontex.tex @@ -8,6 +8,7 @@ % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. +%2.7.5 Argument optionnel pour commencer la numérotation à une autre ligne que 1 %2.7.3 Correction de la couleur des bordures %2.5.8 Style alternatif + Modification marges + Modification arguments @@ -51,6 +52,7 @@ %=========CODEPYTHONTEX=========== OK!! \defKV[envpythonverb]{% Largeur=\def\CODPYlargeur{#1},% + PremLigne=\def\CODPYpremligne{#1},% TaillePolice=\def\CODPYfonte{#1},% EspacementVertical=\def\CODPYstretch{#1} % Centre=\testboolKV{#1} @@ -60,6 +62,7 @@ \setKVdefault[envpythonverb]{% Largeur=\linewidth,% + PremLigne=1,% % Centre=false,% Lignes=true,% TaillePolice=\footnotesize,% @@ -117,7 +120,7 @@ {\begin{tcpythontexcode}[\CODPYlargeur]{#2}} {\begin{tcpythontexcodeno}[\CODPYlargeur]{#2}} \ifboolKV[envpythonverb]{Lignes}%si lignes=true - {\begin{pyverbatim}[][fontsize=\CODPYfonte,numbers=left,numbersep=0.75em,commandchars=\\\{\},mathescape,baselinestretch=\CODPYstretch]} + {\begin{pyverbatim}[][fontsize=\CODPYfonte,numbers=left,firstnumber=\CODPYpremligne,numbersep=0.75em,commandchars=\\\{\},mathescape,baselinestretch=\CODPYstretch]} {\begin{pyverbatim}[][numbers=none,numbersep=0pt,fontsize=\CODPYfonte,commandchars=\\\{\},mathescape,baselinestretch=\CODPYstretch]} }% {% @@ -175,7 +178,7 @@ {\begin{tcpythontexcodealt}[\CODPYlargeur]{#2}} {\begin{tcpythontexcodenoalt}[\CODPYlargeur]{#2}} \ifboolKV[envpythonverb]{Lignes}%si lignes=true - {\begin{pyverbatim}[][fontsize=\CODPYfonte,numbers=left,numbersep=0.75em,commandchars=\\\{\},mathescape,baselinestretch=\CODPYstretch]} + {\begin{pyverbatim}[][fontsize=\CODPYfonte,numbers=left,firstnumber=\CODPYpremligne,numbersep=0.75em,commandchars=\\\{\},mathescape,baselinestretch=\CODPYstretch]} {\begin{pyverbatim}[][numbers=none,numbersep=0pt,fontsize=\CODPYfonte,commandchars=\\\{\},mathescape,baselinestretch=\CODPYstretch]} }% {% |