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 | |
parent | 23c5f33b784af6cc6c4ee2f5482ef5f21c774006 (diff) |
CTAN sync 202309200301
Diffstat (limited to 'macros')
13 files changed, 567 insertions, 183 deletions
diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf Binary files differindex 75451e0be5..5649966fbb 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex index e81ed1e676..ac31a71bf0 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex @@ -5,8 +5,8 @@ % arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') \documentclass[a4paper,french,11pt]{article} -\def\PLversion{2.7.4} -\def\PLdate{3 septembre 2023} +\def\PLversion{2.7.5} +\def\PLdate{19 septembre 2023} \usepackage{amsfonts} \usepackage{ProfLycee} \useproflyclib{piton,minted,pythontex,ecritures} @@ -144,12 +144,12 @@ keywordstyle={\color{violet}},% classoffset=2,% alsoletter={-},% - morekeywords={\ResolutionApprochee,\SolutionTVI,\CalculTermeRecurrence,\ToileRecurrence,\SolutionSeuil,\IntegraleApprochee,\GrilleTikz,\AxesTikz,\AxexTikz,\AxeyTikz,\FenetreTikz,\FenetreSimpleTikz,\DeclareFonctionTikz,\CourbeTikz,\OrigineTikz,\SplineTikz,\TangenteTikz,\MiniSchemaSignes,\MiniSchemaSignesTkzTab,\IntegraleApprocheeTikz,\CartoucheCapytale,\PaveTikz,\TetraedreTikz,\CercleTrigo,\AffPoint,\AffVecteur,\TrouveEqCartPlan,\TrouveEqParamDroite,\TrouveEqCartDroite,\TrouveNorme,\TrouveDistancePtPlan,\EquationReduite,\CalculsRegLin,\PointsRegLin,\NuagePointsTikz,\PointMoyenTikz,\BoiteMoustaches,\BoiteMoustachesAxe,\Histogramme,\CalcBinomP,\CalcBinomC,\BinomP,\BinomC,\CalcPoissP,\CalcPoissC,\PoissonP,\PoissonC,\CalcGeomP,\CalcGeomC,\GeomP,\GeomC,\CalcHypergeomP,\CalcHypergeomP,\HypergeomP,\HypergeomC,\CalcNormC,\NormaleC,\CalcExpoC,\ExpoC,\ArbreProbasTikz,\LoiNormaleGraphe,\LoiExpoGraphe,\NbAlea,\VarNbAlea,\TirageAleatoireEntiers,\Arrangement,\Combinaison,\ConversionDecBin,\ConversionBinHex,\ConversionVersDec,\ConversionBaseDix,\ConversionDepuisBaseDix,\PresentationPGCD,\EquationDiophantienne,\ConversionFraction,\SimplificationRacine,\EcritureEnsemble,\EcritureTrinome,\MesurePrincipale,\LigneTrigo,\SudoMaths,\FonctionRepartTikz,\IntervalleFF,\IntervalleFO,\IntervalleOF,\IntervalleOO,\RepereOij,\RepereOuv,\RepereOijk,\ReperePlan,\RepereEspace,\jfalg,\jfexp,\LoiNormale,\LoiBinomiale,\LoiPoisson,\LoiExpo,\LoiUnif,\Courbe,\Suite,\CoordPtPl,\CoordPtEsp,\CoordVecPl,\CoordVecEsp,\MatDeux,\Vecteur,\Esper,\Varianc,\EcType,\dx,\Integrale,\Modulo,\Arrondi + morekeywords={\ResolutionApprochee,\SolutionTVI,\CalculTermeRecurrence,\ToileRecurrence,\SolutionSeuil,\IntegraleApprochee,\GrilleTikz,\AxesTikz,\AxexTikz,\AxeyTikz,\FenetreTikz,\FenetreSimpleTikz,\DeclareFonctionTikz,\CourbeTikz,\OrigineTikz,\SplineTikz,\TangenteTikz,\MiniSchemaSignes,\MiniSchemaSignesTkzTab,\IntegraleApprocheeTikz,\CartoucheCapytale,\PaveTikz,\TetraedreTikz,\CercleTrigo,\AffPoint,\AffVecteur,\TrouveEqCartPlan,\TrouveEqParamDroite,\TrouveEqCartDroite,\TrouveNorme,\TrouveDistancePtPlan,\EquationReduite,\CalculsRegLin,\PointsRegLin,\NuagePointsTikz,\PointMoyenTikz,\BoiteMoustaches,\BoiteMoustachesAxe,\Histogramme,\CalcBinomP,\CalcBinomC,\BinomP,\BinomC,\CalcPoissP,\CalcPoissC,\PoissonP,\PoissonC,\CalcGeomP,\CalcGeomC,\GeomP,\GeomC,\CalcHypergeomP,\CalcHypergeomP,\HypergeomP,\HypergeomC,\CalcNormC,\NormaleC,\CalcExpoC,\ExpoC,\ArbreProbasTikz,\LoiNormaleGraphe,\LoiExpoGraphe,\NbAlea,\VarNbAlea,\TirageAleatoireEntiers,\Arrangement,\Combinaison,\ConversionDecBin,\ConversionBinHex,\ConversionVersDec,\ConversionBaseDix,\ConversionDepuisBaseDix,\PresentationPGCD,\EquationDiophantienne,\ConversionFraction,\SimplificationRacine,\EcritureEnsemble,\EcritureTrinome,\MesurePrincipale,\LigneTrigo,\SudoMaths,\FonctionRepartTikz,\IntervalleFF,\IntervalleFO,\IntervalleOF,\IntervalleOO,\RepereOij,\RepereOuv,\RepereOijk,\ReperePlan,\RepereEspace,\jfalg,\jfexp,\LoiNormale,\LoiBinomiale,\LoiPoisson,\LoiExpo,\LoiUnif,\Courbe,\Suite,\CoordPtPl,\CoordPtEsp,\CoordVecPl,\CoordVecEsp,\MatDeux,\Vecteur,\Esper,\Varianc,\EcType,\dx,\Integrale,\Modulo,\Arrondi,\CodePythonLstFichier,\CodePythonLstFichierAlt,\colorlet },% keywordstyle={\color{CouleurVertForet}},% classoffset=3,% alsoletter={-},% - morekeywords={minimum-decimal-digits,scale,nonamssymb,build,Precision,Intervalle,Variable,NomFct,NomSol,va,vb,Stretch,Balayage,Calculatrice,Majuscule,No,UNo,NomSuite,Simple,Exact,Conclusion,Sens,ResultatBrut,Methode,NbSubDiv,AffFormule,Expr,Signe,Variables,Affp,Affs,Epaisseur,Police,ElargirOx,ElargirOy,Labelx,Labely,AffLabel,PosLabelx,PosLabely,EchelleFleche,TypeFleche,PosGrad,HautGrad,AffGrad,AffOrigine,Annee,Trigo,Dfrac,Style,Coeffs,AffPoints,TaillePoints,xl,xr,Code,Racines,Largeur,Hauteur,Cadre,Fct,Nom,PosLabel,DecalLabel,TailleLabel,AffTermes,RemplirbOpacite,CouleurRemplissage,Lignes,Gobble,Alignement,Filigrane,BarreTitre,CouleurNombres,Centre,EspacementVertical,Label,Titre,Profondeur,Angle,Fuite,Sommets,Math,Aff,Plein,Cube,Alpha,Beta,Rayon,Marge,TailleValeurs,TailleAngles,CouleurFond,Decal,MoinsPi,AffAngles,AffTraits,AffValeurs,Equationcos,Equationsin,sin,cos,AffTraitsEq,CouleurSol,OptionCoeffs,SimplifCoeffs,Facteur,OptionCoeffs,Reel,Oppose,Rgras,SimplifCoeffs,VectDirecteur,NomCoeffa,NomCoeffb,NomCoeffr,NomCoeffrd,NomXmin,NomXmax,Ox,Oy,xg,yg,AffNom,Elevation,Moyenne,AffMoyenne,Pointilles,Valeurs,Elargir,Min,Max,DebutOx,FinOx,ListeCouleurs,ElargirX,ElargirY,LabelX,LabelY,GradX,GradY,AffEffectifs,PosEffectifs,Opacite,AffBornes,GrilleV,PoliceAxes,PoliceEffectifs,EpaisseurTraits,Unite,EspaceNiveau,EspaceFeuille,Type,PoliceProbas,InclineProbas,Fleche,StyleTrait,EpaisseurTrait,CouleurAire,CouleurCourbe,AfficheM,AfficheCadre,ValMin,ValMax,NbVal,Sep,Tri,Repetition,Notation,NotationAncien,Formule,AffBase,Details,BaseDep,Zeros,DecalH,DecalV,Noeud,Rect,CouleurRes,DecalRect,Rectangle,CouleurResultat,AfficheConclusion,AfficheDelimiteurs,Lettre,Inconnues,Entier,Cadres,PresPGCD,Mathpunct,Option,Alea,Anegatif,Crochets,Brut,Etapes,Epaisseurg,CouleurCase,CouleurTexte,NbSubCol,NbLig,NbCol,Legendes,PoliceLeg,ListeLegV,ListeLegH,DecalLegende,Couleur,Uno,Grille,ExtraGrilleY,PosLegende,Pointilles,Extremite,Frac},% + morekeywords={minimum-decimal-digits,scale,nonamssymb,build,Precision,Intervalle,Variable,NomFct,NomSol,va,vb,Stretch,Balayage,Calculatrice,Majuscule,No,UNo,NomSuite,Simple,Exact,Conclusion,Sens,ResultatBrut,Methode,NbSubDiv,AffFormule,Expr,Signe,Variables,Affp,Affs,Epaisseur,Police,ElargirOx,ElargirOy,Labelx,Labely,AffLabel,PosLabelx,PosLabely,EchelleFleche,TypeFleche,PosGrad,HautGrad,AffGrad,AffOrigine,Annee,Trigo,Dfrac,Style,Coeffs,AffPoints,TaillePoints,xl,xr,Code,Racines,Largeur,Hauteur,Cadre,Fct,Nom,PosLabel,DecalLabel,TailleLabel,AffTermes,RemplirbOpacite,CouleurRemplissage,Lignes,Gobble,Alignement,Filigrane,BarreTitre,CouleurNombres,Centre,EspacementVertical,Label,Titre,Profondeur,Angle,Fuite,Sommets,Math,Aff,Plein,Cube,Alpha,Beta,Rayon,Marge,TailleValeurs,TailleAngles,CouleurFond,Decal,MoinsPi,AffAngles,AffTraits,AffValeurs,Equationcos,Equationsin,sin,cos,AffTraitsEq,CouleurSol,OptionCoeffs,SimplifCoeffs,Facteur,OptionCoeffs,Reel,Oppose,Rgras,SimplifCoeffs,VectDirecteur,NomCoeffa,NomCoeffb,NomCoeffr,NomCoeffrd,NomXmin,NomXmax,Ox,Oy,xg,yg,AffNom,Elevation,Moyenne,AffMoyenne,Pointilles,Valeurs,Elargir,Min,Max,DebutOx,FinOx,ListeCouleurs,ElargirX,ElargirY,LabelX,LabelY,GradX,GradY,AffEffectifs,PosEffectifs,Opacite,AffBornes,GrilleV,PoliceAxes,PoliceEffectifs,EpaisseurTraits,Unite,EspaceNiveau,EspaceFeuille,Type,PoliceProbas,InclineProbas,Fleche,StyleTrait,EpaisseurTrait,CouleurAire,CouleurCourbe,AfficheM,AfficheCadre,ValMin,ValMax,NbVal,Sep,Tri,Repetition,Notation,NotationAncien,Formule,AffBase,Details,BaseDep,Zeros,DecalH,DecalV,Noeud,Rect,CouleurRes,DecalRect,Rectangle,CouleurResultat,AfficheConclusion,AfficheDelimiteurs,Lettre,Inconnues,Entier,Cadres,PresPGCD,Mathpunct,Option,Alea,Anegatif,Crochets,Brut,Etapes,Epaisseurg,CouleurCase,CouleurTexte,NbSubCol,NbLig,NbCol,Legendes,PoliceLeg,ListeLegV,ListeLegH,DecalLegende,Couleur,Uno,Grille,ExtraGrilleY,PosLegende,Pointilles,Extremite,Frac,PremLigne},% keywordstyle={\color{orange!75!black}} } } @@ -694,22 +694,22 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent \begin{PresCodeTexPL}{listing only} %présentation de code Python -\begin{CodePythonLst}(*)[largeur]{commandes tcbox}...\end{CodePythonLst} -\begin{CodePythonLstAlt}(*)[largeur]{commandes tcbox}...\end{CodePythonLstAlt} +\begin{CodePythonLst}(*)[clés]{commandes tcbox}...\end{CodePythonLst} +\begin{CodePythonLstAlt}(*)[clés]{commandes tcbox}...\end{CodePythonLstAlt} %:=librairie piton -\begin{CodePiton}[options piton]{commandes tcbox}...\end{CodePiton} -\begin{PitonConsole}<Clés>{commandes tcbox}...\end{PitonConsole} +\begin{CodePiton}[options piton]{commandes tcbox}<1ère ligne>...\end{CodePiton} +\begin{PitonConsole}<clés>{commandes tcbox}...\end{PitonConsole} %:=librairie pythontex -\begin{CodePythontex}[options]{}...\end{CodePythontex} -\begin{CodePythontexAlt}[options]{}...\end{CodePythontexAlt} +\begin{CodePythontex}[clés]{commandes tcbox}...\end{CodePythontex} +\begin{CodePythontexAlt}[clés]{commandes tcbox}...\end{CodePythontexAlt} \begin{ConsolePythontex}[options]{}...\end{ConsolePythontex} %:=librairie minted -\begin{CodePythonMinted}(*)[largeur]{commandes tcbox}...\end{CodePythonMinted} -\begin{CodePythonMintedAlt}(*)[largeur]{commandes tcbox}...\end{CodePythonMintedAlt} +\begin{CodePythonMinted}(*)[clés]{commandes tcbox}...\end{CodePythonMinted} +\begin{CodePythonMintedAlt}(*)[largeur][clés]{commandes tcbox}...\end{CodePythonMintedAlt} %présentation de pseudocode -\begin{PseudoCode}(*)[largeur]{commandes tcbox}...\end{PseudoCode} -\begin{PseudoCodeAlt}(*)[largeur]{commandes tcbox}...\end{PseudoCodeAlt} +\begin{PseudoCode}(*)[clés]{commandes tcbox}...\end{PseudoCode} +\begin{PseudoCodeAlt}(*)[largeur][clés]{commandes tcbox}...\end{PseudoCodeAlt} \end{PresCodeTexPL} \begin{PresCodeTexPL}{listing only} @@ -2791,6 +2791,36 @@ Les commandes graphiques de \ctex{Proflycee} peuvent être utilisées pour confi \part{Présentation de codes} +\section{Précautions}\label{codenumlignes} + +\begin{tipblock} +L'idée est de proposer des environnements pour présenter du code : + +\begin{itemize} + \item \textsf{Python} ; + \item \textsf{PseudoCode}. +\end{itemize} + +Dans la mesure du possible (mis à part pour certains points avec l'utilisation des packages \ctex{piton} et \ctex{pythontex}), les environnements seront composés : + +\begin{itemize} + \item dans une boîte \ctex{tcolorbox} ; + \item de deux styles :\ctex{CodeXXXX} ou \ctex{CodeXXXXAlt} ; + \item de clés pour paramétrer la \Cle{Largeur} et le début de la numérotation \Cle{PremLigne} ; + \item d'une version étoilée pour ne pas numérotée les lignes ; + \item d'options éventuelles à donner en langage \ctex{tcolorbox}. +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\begin{warningblock} +Avec la mise à jour \cmaj{2.7.5} et la possibilité de modifier la numérotation des lignes, certains environnements ont vu leur fonctionnement légèrement modifié, donc il est conseillé d'être prudent avec les nouvelles spécificités. + +\smallskip + +Il est prévu, à plus ou moyen terme, d'uniformiser le fonctionnement de tous les environnements, mais cela demande de reprendre une bonne partie du code. +\end{warningblock} + \section{Code Python \og simple \fg{} via le package listings}\label{pythonsimple} \subsection{Introduction} @@ -2820,13 +2850,13 @@ L'environnement \ctex{CodePythonLst} permet de présenter du code \textsf{Python \end{tipblock} \begin{PresCodeTexPL}{listing only} -\begin{CodePythonLst}(*)[largeur]{commandes tcbox} +\begin{CodePythonLst}(*)[clés]{commandes tcbox} ... \end{CodePythonLst} \end{PresCodeTexPL} \begin{PresCodeTexPL}{listing only} -\begin{CodePythonLstAlt}(*)[largeur]{commandes tcbox} +\begin{CodePythonLstAlt}(*)[clés]{commandes tcbox} ... \end{CodePythonLstAlt} \end{PresCodeTexPL} @@ -2836,14 +2866,14 @@ Plusieurs \Cle{arguments} sont disponibles : \begin{itemize} \item la version \textit{étoilée} qui permet de ne pas afficher les numéros de lignes ; - \item le premier argument (\textit{optionnel}), concerne la \Cle{largeur} de la \ctex{tcbox} ;\hfill{}défaut \Cle{\textbackslash linewidth} + \item le premier argument (\textit{optionnel}), comprend la clé \Cle{Largeur} de la \ctex{tcbox} (\Cle{\textbackslash linewidth} par défaut) et la clé \Cle{PremLigne} (\Cle{1} par défaut) ; \item le second argument (\textit{obligatoire}), concerne des \Cle{options} de la \ctex{tcbox} en \textit{langage tcolorbox}, comme l'alignement. \end{itemize} \vspace*{-\baselineskip}\leavevmode \end{cautionblock} \begin{warningblock} -Les environnements \ctex{DeclareTCBListing} créés par \ctex{tcolorbox} et \ctex{listings} ne sont pas compatibles avec les options \Cle{gobble} (pour supprimer les tabulations d'environnement), donc il faut bien penser à \og aligner \fg{} le code à gauche, pour éviter des tabulations non esthétiques ! +Les environnements créés par \ctex{tcolorbox} et \ctex{listings} ne sont pas compatibles avec les options \Cle{gobble} (pour supprimer les tabulations d'environnement), donc il faut bien penser à \og aligner \fg{} le code à gauche, pour éviter des tabulations non esthétiques ! \end{warningblock} \subsection{Insertion via un fichier \og externe \fg} @@ -2855,7 +2885,7 @@ Dans ce cas, il n'est pas nécessaire d'aligner le code \og à gauche \fg, en ut \smallskip -Si cette méthode est utilisée, il ne faut oublier de charger le package \ctex{scontents}. +Si cette méthode est utilisée, il ne faut oublier de charger le package \ctex{scontents}, et être attentif à la syntaxe. \end{tipblock} \begin{PresCodeTexPL}{listing only} @@ -2867,7 +2897,7 @@ Si cette méthode est utilisée, il ne faut oublier de charger le package \ctex{ \subsection{Exemples} \begin{PresCodeTexPL}{listing only} -\begin{CodePythonLst}{} %les {}, même vides, sont nécessaires (bug avec # sinon !) +\begin{CodePythonLst}{} %les {}, même vides, peuvent être nécessaires (bug avec # sinon !) #environnement par défaut nb = int(input("Saisir un entier positif")) if (nb %7 == 0) : @@ -2893,8 +2923,26 @@ def f(x) : \end{PresCodeSortiePL} \begin{PresCodeTexPL}{listing only} -\begin{CodePythonLstAlt}*[0.75\linewidth]{flush right} -#largeur de 50%, sans numéro, et aligné à droite +\begin{CodePythonLst}[PremLigne=10]{} +nb = int(input("Saisir un entier positif")) +if (nb %7 == 0) : + print(f"{nb} est bien divisible par 7") +#endif +\end{CodePythonLst} +\end{PresCodeTexPL} + +\begin{PresCodeSortiePL}{text only} +\begin{CodePythonLst}[PremLigne=10]{} +nb = int(input("Saisir un entier positif")) +if (nb %7 == 0) : + print(f"{nb} est bien divisible par 7") +#endif +\end{CodePythonLst} +\end{PresCodeSortiePL} + +\begin{PresCodeTexPL}{listing only} +\begin{CodePythonLstAlt}*[Largeur=0.75\linewidth]{flush right} +#largeur de 75%, sans numéro, et aligné à droite nb = int(input("Saisir un entier Python positif")) if (nb %7 == 0) : print(f"{nb} est bien divisible par 7") @@ -2906,7 +2954,7 @@ def f(x) : \end{PresCodeTexPL} \begin{PresCodeSortiePL}{text only} -\begin{CodePythonLstAlt}*[0.75\linewidth]{flush right} +\begin{CodePythonLstAlt}*[Largeur=0.75\linewidth]{flush right} #largeur de 50%, sans numéro, et aligné à droite nb = int(input("Saisir un entier Python positif")) if (nb %7 == 0) : @@ -3012,6 +3060,8 @@ Depuis la version \ctex{0.95} de \ctex{piton}, \Cle{left-margin=auto} est dispon Depuis la version \ctex{0.99} de \ctex{piton}, \Cle{break-lines} est disponible et activée dans \ctex{ProfLycee}. Depuis la version \ctex{1.0} de \ctex{piton}, \Cle{tabs-auto-gobble} est disponible et activée dans \ctex{ProfLycee}. + +Depuis la version \ctex{2.2a} de \ctex{piton}, des options pour \Cle{line-numbers} sont disponibles. \end{noteblock} \begin{warningblock} @@ -3029,7 +3079,7 @@ Ce package n'est chargé que si la compilation détectée est en \hologo{LuaLaTe \subsection{Présentation de code Python} \begin{PresCodeTexPL}{listing only} -\begin{CodePiton}[options]{options tcbox} +\begin{CodePiton}[options]{options tcbox}<option line-numbers> ... \end{CodePiton} \end{PresCodeTexPL} @@ -3063,7 +3113,7 @@ Pour éviter des problèmes avec le code interprété par \textsf{piton}, les \c \end{noteblock} \begin{PresCodeTexPL}{listing only} -\begin{CodePiton}{} +\begin{CodePiton}{} %pour éviter un bug avec le caractère # #environnement piton avec numéros de ligne, pleine largeur, style moderne def arctan(x,n=10): if x < 0: @@ -3087,8 +3137,8 @@ def arctan(x,n=10): \end{CodePiton} \begin{PresCodeTexPL}{listing only} -\begin{CodePiton}[Style=Classique,Filigrane]{} -#environnement piton avec numéros, style classique, filigrane +\begin{CodePiton}[Style=Classique,Filigrane]{}<start=10> +#environnement piton avec numéros (début=10), style classique, filigrane def arctan(x,n=10): if x < 0: return -arctan(-x) #> (appel récursif) @@ -3099,7 +3149,7 @@ def arctan(x,n=10): \end{CodePiton} \end{PresCodeTexPL} -\begin{CodePiton}[Style=Classique,Filigrane]{} +\begin{CodePiton}[Style=Classique,Filigrane]{}<start=10> #environnement piton avec numéros, style classique, filigrane def arctan(x,n=10): if x < 0: @@ -3223,13 +3273,13 @@ L'environnement \ctex{CodePythontex} est donc lié à \ctex{pythontex} (chargé \end{tipblock} \begin{PresCodeTexPL}{listing only} -\begin{CodePythontex}[options]{} %les {} vides sont nécessaires +\begin{CodePythontex}[clés]{} %les {} vides sont nécessaires ... \end{CodePythontex} \end{PresCodeTexPL} \begin{PresCodeTexPL}{listing only} -\begin{CodePythontexAlt}[options]{} %les {} vides sont nécessaires +\begin{CodePythontexAlt}[clés]{} %les {} vides sont nécessaires ... \end{CodePythontexAlt} \end{PresCodeTexPL} @@ -3239,7 +3289,7 @@ Comme précédemment, des \Cle{Clés} qui permettent de \textit{légèrement} mo \begin{itemize} \item \Cle{Largeur} : largeur de la \textit{tcbox} ;\hfill{}défaut \Cle{\textbackslash linewidth} - \item \Cle{Centre} : booléen pour centrer ou non la \textit{tcbox} ;\hfill{}défaut \Cle{false} + \item \Cle{PremLigne} : numéro initial des lignes ; \hfill{}défaut \Cle{1} \item \Cle{TaillePolice} : taille des caractères ;\hfill{}défaut \Cle{\textbackslash footnotesize} \item \Cle{EspacementVertical} : option (\textit{stretch}) pour l'espacement entre les lignes ;\hfill{}défaut \Cle{1} \item \Cle{Lignes} : booléen pour afficher ou non les numéros de ligne.\hfill{}défaut \Cle{true} @@ -3294,13 +3344,13 @@ Le package \ctex{minted} nécessite quand même une compilation avec l'option \c \end{warningblock} \begin{PresCodeTexPL}{listing only} -\begin{CodePythonMinted}(*)[largeur]{options} +\begin{CodePythonMinted}(*)[clés]{options tcbox} ... \end{CodePythonMinted} \end{PresCodeTexPL} \begin{PresCodeTexPL}{listing only} -\begin{CodePythonMintedAlt}(*)[largeur]{options} +\begin{CodePythonMintedAlt}(*)[clés]{options tcbox} ... \end{CodePythonMintedAlt} \end{PresCodeTexPL} @@ -3310,14 +3360,14 @@ Plusieurs \Cle{arguments} sont disponibles : \begin{itemize} \item la version \textit{étoilée} qui permet de ne pas afficher les numéros de lignes ; - \item le 1\up{er} argument \textit{optionnel} concerne la \Cle{largeur} de la \ctex{tcbox} ;\hfill{}défaut \Cle{12cm} + \item le 1\up{er} argument (\textit{optionnel}), comprend la clé \Cle{Largeur} de la \ctex{tcbox} (\Cle{\textbackslash linewidth} par défaut) et la clé \Cle{PremLigne} (\Cle{1} par défaut) ; \item le 2\up{nd} argument \textit{obligatoire} concerne les \Cle{options} de la \ctex{tcbox} en \textit{langage tcbox}.\hfill{}défaut \Cle{vide} \end{itemize} \vspace*{-\baselineskip}\leavevmode \end{cautionblock} \begin{PresCodeTexPL}{listing only} -\begin{CodePythonMinted}[13cm]{center} +\begin{CodePythonMinted}[Largeur=13cm,PremLigne=10]{center} #environnement Python(minted) centré avec numéros, de largeur 13cm def f(x) : return x**2 @@ -3325,7 +3375,7 @@ Plusieurs \Cle{arguments} sont disponibles : \end{PresCodeTexPL} \begin{PresCodeSortiePL}{text only} -\begin{CodePythonMinted}[13cm]{center} +\begin{CodePythonMinted}[Largeur=13cm,PremLigne=10]{center} #environnement Python(minted) centré avec numéros def f(x) : return x**2 @@ -3333,7 +3383,7 @@ Plusieurs \Cle{arguments} sont disponibles : \end{PresCodeSortiePL} \begin{PresCodeTexPL}{listing only} -\begin{CodePythonMintedAlt}*[0.8\linewidth]{} +\begin{CodePythonMintedAlt}*[Largeur=0.8\linewidth]{} #environnement Python(minted), style alt, sans numéro, de largeur 0.8\linewidth def f(x) : return x**2 @@ -3341,7 +3391,7 @@ Plusieurs \Cle{arguments} sont disponibles : \end{PresCodeTexPL} \begin{PresCodeSortiePL}{text only} -\begin{CodePythonMintedAlt}*[0.8\linewidth]{} +\begin{CodePythonMintedAlt}*[Largeur=0.8\linewidth]{} #environnement Python(minted), style alt, sans numéro, 0.8\linewidth def f(x) : return x**2 @@ -3357,7 +3407,7 @@ C'est l'environnement \ctex{ConsolePythontex} qui permet de le faire. \end{tipblock} \begin{PresCodeTexPL}{listing only} -\begin{ConsolePythontex}[options]{} %les {} vides sont nécessaires +\begin{ConsolePythontex}[clés]{} %les {} vides sont nécessaires ... \end{ConsolePythontex} \end{PresCodeTexPL} @@ -3446,14 +3496,14 @@ De plus, le package \ctex{listings} avec \ctex{tcolorbox} ne permet pas de gére \end{warningblock} \begin{PresCodeTexPL}{listing only} -\begin{PseudoCode}(*)[largeur]{options tcbox} +\begin{PseudoCode}(*)[clés]{options tcbox} %attention à l'indentation, gobble ne fonctionne pas... ... \end{PseudoCode} \end{PresCodeTexPL} \begin{PresCodeTexPL}{listing only} -\begin{PseudoCodeAlt}(*)[largeur]{options tcbox} +\begin{PseudoCodeAlt}(*)[clés]{options tcbox} %attention à l'indentation, gobble ne fonctionne pas... ... \end{PseudoCodeAlt} @@ -3464,7 +3514,8 @@ Plusieurs \Cle{arguments} (optionnels) sont disponibles : \begin{itemize} \item la version \textit{étoilée} qui permet de ne pas afficher les numéros de lignes ; - \item le premier argument optionnel concerne la \Cle{largeur} de la \ctex{tcbox} ;\hfill{}défaut \Cle{12cm} + \item le 1\up{er} argument (\textit{optionnel}), comprend la clé \Cle{Largeur} de la \ctex{tcbox} (\Cle{\textbackslash linewidth} par défaut) et la clé \Cle{PremLigne} (\Cle{1} par défaut) ; + \item \cmaj{2.7.5} une clé booléenne \Cle{Couleur} est également disponible pour mettre en évidence trois niveaux (elles peuvent être redéfinies) de mots clés en pseudo-code (\Cle{false} par défaut) ; \item \cmaj{2.5.8} l'argument obligatoire entre \ctex{\{...\}} concerne les \Cle{options} de la \ctex{tcbox}. \end{itemize} \vspace*{-\baselineskip}\leavevmode @@ -3492,7 +3543,7 @@ FinPour \end{PresCodeSortiePL} \begin{PresCodeTexPL}{listing only} -\begin{PseudoCodeAlt}[15cm]{center} %centré, de largeur 15cm +\begin{PseudoCodeAlt}[Largeur=15cm,PremLigne=7,Couleur]{center} %centré, de largeur 15cm List = [...] # à déclarer au préalable n = longueur(List) Pour i allant de 0 à n-1 Faire @@ -3502,7 +3553,7 @@ FinPour \end{PresCodeTexPL} \begin{PresCodeSortiePL}{text only} -\begin{PseudoCodeAlt}[15cm]{center} +\begin{PseudoCodeAlt}[Largeur=15cm,PremLigne=7,Couleur]{center} List = [...] # à déclarer au préalable n = longueur(List) Pour i allant de 0 à n-1 Faire @@ -3516,9 +3567,16 @@ FinPour \begin{warningblock} À l'instar de packages existants, la \textit{philosophie} ici est de laisser l'utilisateur gérer \textit{son} langage pseudo-code. -J'ai fait le choix de ne pas définir des \textsf{mots clés} à mettre en valeur car cela reviendrait à \textit{imposer} des choix ! Donc ici, pas de coloration syntaxique ou de mise en évidence de mots clés, uniquement un formatage basique ! +J'ai fait le choix de ne pas forcément définir des \textsf{mots clés} à mettre en valeur car cela reviendrait à \textit{imposer} des choix ! Donc ici, pas de coloration syntaxique (uniquement via la clé \Cle{Couleur}) ou de mise en évidence de mots clés, uniquement un formatage basique ! \end{warningblock} +\begin{PresCodeTexPL}{listing only} +%couleurs par défaut des mots clés, modifiables si besoin +\colorlet{MotsClesPseudoCodeA}{blue!75} +\colorlet{MotsClesPseudoCodeB}{green!50!black} +\colorlet{MotsClesPseudoCodeChaine}{red!75} +\end{PresCodeTexPL} + \begin{noteblock} Le style \ctex{listings} utilisé par la commande a l'option \Cle{mathescape} activée, et accessible grâce aux délimiteurs \Cle{(*...*)}. @@ -3526,7 +3584,7 @@ Cela permet d'insérer du code \LaTeX{} dans l'environnement \ctex{PseudoCode} ( \end{noteblock} \begin{PresCodeTexPL}{listing only} -\begin{PseudoCode}*[12cm]{} +\begin{PseudoCode}*[Largeur=12cm]{} % pour éviter un bug avec # #Utilisation du mode mathescape Afficher (*\og*) .........(*\fg*) m = (*$\tfrac{\texttt{1}}{\texttt{2}}$*) @@ -3534,7 +3592,7 @@ m = (*$\tfrac{\texttt{1}}{\texttt{2}}$*) \end{PresCodeTexPL} \begin{PresCodeSortiePL}{text only} -\begin{PseudoCode}*[12cm]{} +\begin{PseudoCode}*[Largeur=12cm]{} #Utilisation du mode mathescape Afficher (*\og*) .........(*\fg*) m = (*$\tfrac{\texttt{1}}{\texttt{2}}$*) @@ -7679,7 +7737,9 @@ La grille, créée en \TikZ, est portée par le rectangle de \og coins \fg{} $(0 \part{Historique} -{\small \bverb|v 2.7.4|~:~~~~Ajout de macros pour des écritures mathématiques classiques (\pageref{ecrituresmath})} +{\small \bverb|v 2.7.5|~:~~~~Possibilités de numéroter les lignes des codes à une autre valeur que 1 (page \pageref{codenumlignes}) + +{\small \bverb|v 2.7.4|~:~~~~Ajout de macros pour des écritures mathématiques classiques (page \pageref{ecrituresmath})} {\small \bverb|v 2.7.3|~:~~~~Correction de la couleur de bordures vertes pour les codes python} @@ -7687,7 +7747,7 @@ La grille, créée en \TikZ, est portée par le rectangle de \og coins \fg{} $(0 {\small \bverb|v 2.7.1|~:~~~~Chargement de \textsf{tcolorbox} par librairies (au lieu de \textsf{[most]}) -{\small \bverb|v 2.7.0|~:~~~~Ajout de la clé \Cle{Frac} pour les axes verticaux (\pageref{reperagetikz}) +{\small \bverb|v 2.7.0|~:~~~~Ajout de la clé \Cle{Frac} pour les axes verticaux (page \pageref{reperagetikz}) {\small \bverb| |~:~~~~Fonction de répartition discrète (\pageref{fctrepart}) diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pyluatex.pdf b/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pyluatex.pdf Binary files differindex 8f81483488..1b1f5ea0c9 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pyluatex.pdf +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pyluatex.pdf diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pythontex.pdf b/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pythontex.pdf Binary files differindex cd5fa5bbd0..9f881fc610 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pythontex.pdf +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pythontex.pdf diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pythontex.tex b/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pythontex.tex index 8ba49e362a..e418300cae 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pythontex.tex +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-exemples-pythontex.tex @@ -5,7 +5,7 @@ % arara: lualatex: {shell: no, synctex: yes, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') \documentclass[french,a4paper,10pt]{article} -\def\PLver{2.7.3} +\def\PLver{2.7.5} \usepackage[margin=1.5cm]{geometry} \usepackage{ProfLycee} \useproflyclib{pythontex} @@ -58,7 +58,7 @@ def valeur_absolue(x): {\small \begin{codehigh} %Sortie avec Style=Classique, Largeur=10cm, centré -\begin{CodePythontexAlt}[Largeur=10cm,Centre]{} +\begin{CodePythontexAlt}[Largeur=10cm,Centre,PremLigne=10]{} def valeur_absolue(x): "Renvoie la valeur absolue de x" #le petit test qui va bien @@ -69,7 +69,7 @@ def valeur_absolue(x): \end{CodePythontexAlt} \end{codehigh}} -\begin{CodePythontexAlt}[Largeur=10cm,Centre]{} +\begin{CodePythontexAlt}[Largeur=10cm,Centre,PremLigne=10]{} def valeur_absolue(x): "Renvoie la valeur absolue de x" #le petit test qui va bien 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]} }% {% diff --git a/macros/latex/contrib/setspaceenhanced/README.md b/macros/latex/contrib/setspaceenhanced/README.md index 601ae4b8ca..ec433ed204 100644 --- a/macros/latex/contrib/setspaceenhanced/README.md +++ b/macros/latex/contrib/setspaceenhanced/README.md @@ -2,7 +2,7 @@ Copyright © 2008–2023 Markus Kohm -Release: 2023-08-04 v1.0 +Release: 2023-09-19 v1.01 License: LPPL 1.3c @@ -41,15 +41,15 @@ replacements for the original packages they were intended to improve. Package features and improvements by patching package [`setspace`](https://ctan.org/pkg/setspace). -# Unpacking and Installation for Users +# Installation for Users -If you are a user, you should wait until all the packages has been added to +If you are a user, you should wait until all the package has been added to your preferred TeX distribution. Then you can use the package manager of your -TeX distribution to install all the packages. +TeX distribution to install the packages. # Unpacking for Distributors -Distributors should download the [distribution from +Distributors should download [the distribution from CTAN](https://www.ctan.org/pkg/setspaceenhanced). This consists in: * `setspaceenhanced.dtx` @@ -86,16 +86,16 @@ using git clone https://github.com/komascript/third-party-enhancements.git -You can -than either unpack and install all the third-party enhancements using: +You can than either unpack and install all the third-party enhancements using: l3build install --full -from within the main directory of the cloned respository (omit option `--full` -if you don't want the manual) or `setspaceenhanced` only doing the same from -within the `setspaceenhanced` sub-directory. +from within the main directory of the cloned respository. For installation of +`setspaceenhanced` only run the same command from within the +`setspaceenhanced` subdirectory. For installation without the manual omit +option `--full`, but this is not recommended for developers. -# How to get the Manuals +# How to get the Manual After installation you should get the user manual using: @@ -103,17 +103,17 @@ After installation you should get the user manual using: See the manual of your TeX distribution for more information. -Developers or distributors can also build the manuals from the source using: +Developers or distributors can also build the manual from the source using: l3build doc # How to Contribute To become a contributor, e.g., do heavy testing. If you find an issue, please -report it using the [issue +report it using [the issue tracker](https://github.com/komascript/third-party-enhancements/issues). You can also become a developer and, e.g., make new test files to the -packages. See the [`l3build`](https://ctan.prg/pkg/l3build) manual for more +packages. See the [`l3build`](https://ctan.org/pkg/l3build) manual for more information about tests. If you've created a new test and think that it would be useful. Please either do a pull request or [add a new issue](https://github.com/komascript/third-party-enhancements/issues/new/choose) @@ -126,12 +126,12 @@ corresponding enhancement package from this project into her or his package. # How to Report Issues If you think you have found a bug (or another kind of issue) using -`setspaceenhanced` you should use the [issue +`setspaceenhanced` you should use [the issue tracker](https://github.com/komascript/third-party-enhancements/issues). Please first search for similar issues already reported and maybe also already fixed and closed. Maybe the replies to such a similar report would help you too. -If your issue is new, you should report it also using the [issue +If your issue is new, you should report it also using [the issue tracker](https://github.com/komascript/third-party-enhancements/issues). Please be kind, not only when writing the report but also when reading replies and commenting or answering. And please always add a minimal working example and @@ -152,3 +152,12 @@ fop, so I'm certainly up for a quick thank you by email. On komascript.de you can find an [explanation of my wishes](https://komascript.de/wunschliste) if you want to give more. If you don't understand German, just click to links at that page. + +# Changes + +v1.01 2023-09-19: + +- option `fontsize` has been renamed to `keepfontsize` because of + incompatibility with KOMA-Script → [issue + #1](https://github.com/komascript/third-party-enhancements/issues/1) + diff --git a/macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx index 97cfc589c5..4045fd798b 100644 --- a/macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx +++ b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx @@ -32,7 +32,7 @@ %</dtx> %<*dtx|package> %<package>\ProvidesExplPackage{setspaceenhanced} - {2023-08-04}{1.0} + {2023-09-19}{1.01} {% %<*dtx> sources and unpack driver of @@ -155,6 +155,7 @@ %\fi % % \changes{v0.1}{2023/06/01}{new \KOMAScript{} spin-off} +% \changes{v1.0}{2023/08/04}{release} % % \GetFileInfo{setspaceenhanced.dtx} % \title{Improving ``\pkg{setspace}''} @@ -362,8 +363,9 @@ group. calculation of the factor depending on the font size and the baseline skip set for the font size. It is recommended to use the option always without value! -\item[fontsize=\meta{boolean}]% - \DescribeOption{fontsize}% +\item[keepfontsize=\meta{boolean}]% + \DescribeOption{keepfontsize}% + \marginpar{\raggedleft\footnotesize (changed 2023-09-19)}% \DescribeCommand{\setstretch}% \hfill initial=\optvalue{false}, default=\optvalue{true}\\ As explained in \autoref{sec:whywithoutkomascript}, \pkg{setspace}'s @@ -373,8 +375,8 @@ group. using \cs{@setsize} than after using |\fontsize{…}{…}\selectfont|. With the last the font size will be reset to the previous usage of one of the other or the document font size. For a lot of users this is somehow - unexpected. With option \opt{fontsize} or \opt{fontsize=true} this is - changed and using \cs{setstretch} does not reactivate the last used + unexpected. With option \opt{keepfontsize} or \opt{keepfontsize=true} this + is changed and using \cs{setstretch} does not reactivate the last used \cs{Huge}, \cs{huge}, \cs{LARGE}, \cs{Large}, \cs{large}, \cs{normalsize}, \cs{small}, \cs{footnotesize}, \cs{scriptsize}, \cs{tiny}. \item[onehalfspacing=\meta{real}]% @@ -482,7 +484,7 @@ this result in: But \begin{verbatim} \documentclass[12pt]{article} - \usepackage[fontsize]{setspaceenhanced} + \usepackage[keepfontsize]{setspaceenhanced} \begin{document} \fontsize{5pt}{7pt}\selectfont\onehalfspacing This is font size \csname f@size\endcsname pt with @@ -497,7 +499,9 @@ results in: factor is 1.071428571428571. This results in a baseline skip of 7.49998pt. \end{quote} In my opinion this is more the expected result. See the previous -\autoref{sec:howtouse} for more information about options like \opt{fontsize}. +\autoref{sec:howtouse} for more information about options like +\opt{keepfontsize}. + % \iffalse %</doc> % \fi @@ -640,8 +644,8 @@ In my opinion this is more the expected result. See the previous % \end{command} % % \begin{command}{\setstretch} -% If \opt{fontsize=false}, we use the original functionality of -% \pkg{setspace}. But with \opt{fontsize=true} we use \cs{linespread}: +% If \opt{keepfontsize=false}, we use the original functionality of +% \pkg{setspace}. But with \opt{keepfontsize=true} we use \cs{linespread}: % \begin{macrocode} \renewcommand*{\setstretch}[1]{ \bool_if:NTF \@@_fontsize_bool @@ -657,6 +661,10 @@ In my opinion this is more the expected result. See the previous % \end{command} % % Almost the end of the package we define all options: +% \changes{v1.01}{2023/09/19}{option \opt{fontsize} renamed to +% \opt{keepfontsize} because of incompatibility (issue +% \href{https://github.com/komascript/third-party-enhancements/issues/1} +% {\#1})} % \begin{macrocode} \DeclareKeys{% singlespacing .code = \@@_set_spacing:nn {#1} {single}, @@ -668,9 +676,9 @@ In my opinion this is more the expected result. See the previous byselectfont .bool_set:N = \@@_byselectfont_bool, byselectfont .default:n = true, byselectfont .initial:n = false, - fontsize .bool_set:N = \@@_fontsize_bool, - fontsize .default:n = true, - fontsize .initial:n = false, + keepfontsize .bool_set:N = \@@_fontsize_bool, + keepfontsize .default:n = true, + keepfontsize .initial:n = false, } % \end{macrocode} % And process them: diff --git a/macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdf b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdf Binary files differindex ac6c07e0a2..ba55cd2db0 100644 --- a/macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdf +++ b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdf |