texlive[71792] Master/texmf-dist: customenvs (13jul24)
commits+karl at tug.org
commits+karl at tug.org
Sat Jul 13 22:28:38 CEST 2024
Revision: 71792
https://tug.org/svn/texlive?view=revision&revision=71792
Author: karl
Date: 2024-07-13 22:28:38 +0200 (Sat, 13 Jul 2024)
Log Message:
-----------
customenvs (13jul24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-en.pdf
trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-en.tex
trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-fr.pdf
trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-fr.tex
trunk/Master/texmf-dist/tex/latex/customenvs/customenvs.sty
Modified: trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-en.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-en.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-en.tex 2024-07-13 20:28:27 UTC (rev 71791)
+++ trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-en.tex 2024-07-13 20:28:38 UTC (rev 71792)
@@ -34,8 +34,8 @@
\usepackage[margin=1.5cm]{geometry}
\setlength{\parindent}{0pt}
-\def\TPversion{0.1.7}
-\def\TPdate{03/06/2024}
+\def\TPversion{0.1.8}
+\def\TPdate{13/07/2024}
\usepackage{tcolorbox}
\sethlcolor{lightgray!25}
\NewDocumentCommand\MontreCode{ m }{%
@@ -111,6 +111,7 @@
\section{History}
+\verb|v0.1.8|~:~~~~Score banner
\verb|v0.1.7|~:~~~~Small patch for \textsf{Vignette} macro (see \texttt{[fr]} documentation)
\verb|v0.1.6|~:~~~~Small patchs for \textsf{displayskip} + \textsf{pas-tableur} (see \texttt{[fr]} documentation)
@@ -430,6 +431,60 @@
\pagebreak
+\pagebreak
+
+\section{Score banner}
+
+\subsection{Global use}
+
+The idea is to insert a score banner, with customizations.
+
+\begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
+ScoreBanner[keys]{number}
+\end{codehigh}
+
+\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
+%default output
+\ScoreBanner{}
+\end{demohigh}
+
+\subsection{The macro}
+
+Available \MontreCode{keys} are :
+
+\begin{itemize}
+ \item \MontreCode{Height} : height of the banner (without the legend) ; \MontreCode{1} by default
+ \item \MontreCode{Ratio} : ratio of boxes ; \MontreCode{0.6} by default
+ \item \MontreCode{Symbols} : labels ; \MontreCode{A,B,C,D,E} by default
+ \item \MontreCode{Legend} : legend (uppercase) ; \MontreCode{score} by default ;
+ \item \MontreCode{Font} : global font ; \MontreCode{\textbackslash bfseries\textbackslash sffamily} by default
+ \item \MontreCode{ShowLegend} : boolean for the legend ; \MontreCode{false} by default ;
+ \item \MontreCode{Colors} : colors for boxes ;
+
+ \hfill\MontreCode{colorNS1,colorNS2,colorNS3,colorNS4,colorNS5} by default ;
+ \item \MontreCode{ScaleSymbols} : scale H/V of labels ; \MontreCode{1.25,1.65} by default ;
+ \item \MontreCode{Colbg} : background color for select box ; \MontreCode{white} by default.
+\end{itemize}
+
+\smallskip
+
+If the list of colors doesn't fill all the boxes, \MontreCode{lightgray} color is used.
+
+\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
+\ScoreBanner[Legend=Geometry,Height=2]{4}
+\end{demohigh}
+
+\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25,style/demo=yellow!25]
+%bg of lower part is yellow!25
+\def\lstcouleurs{colorNS1,colorNS2,colorNS3,colorNS4,colorNS5,purple}
+\ScoreBanner%
+ [ScaleSymbols={1.33,2},Height=3.25,ShowLegend=false,Ratio=0.75,
+ Symbols={1,2,3,4,5,6},Colors=\lstcouleurs,
+ Colbg=yellow!25]{1}
+\end{demohigh}
+
+\pagebreak
+
\section{SMS conversation}
\subsection{Global use}
Modified: trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-fr.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-fr.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-fr.tex 2024-07-13 20:28:27 UTC (rev 71791)
+++ trunk/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-fr.tex 2024-07-13 20:28:38 UTC (rev 71792)
@@ -39,8 +39,8 @@
\usepackage[margin=1.5cm]{geometry}
\setlength{\parindent}{0pt}
-\def\TPversion{0.1.7}
-\def\TPdate{03 juin 2024}
+\def\TPversion{0.1.8}
+\def\TPdate{13 juillet 2024}
\usepackage{tcolorbox}
\tcbuselibrary{listingsutf8}
\newtcblisting{DemoCode}[1]{%
@@ -66,10 +66,10 @@
keywordstyle={\color{violet}},%
classoffset=2,%
alsoletter={-},%
- morekeywords={\ReponsesQCM,MultiCols,\CreerListeItems,\ListeChoixItems,\TableauCompetences,\CrayonDeCompetences,\StyleEnvtExo,\StyleEnvtExoDefaut,\TitreExo,\ipsum,EnvSMS,\SMSrec,\SMSenv,BoiteSimple,\SujetTitreExo,\CircledNumber,\AffVignette,\BoiteArrondie,\ChangerDisplaySkip,\celcouleur,\celfusion,\lignetxt,\colonnetxt,\celnumbreak,\celtxt},%
+ morekeywords={\ReponsesQCM,MultiCols,\CreerListeItems,\ListeChoixItems,\TableauCompetences,\CrayonDeCompetences,\StyleEnvtExo,\StyleEnvtExoDefaut,\TitreExo,\ipsum,EnvSMS,\SMSrec,\SMSenv,BoiteSimple,\SujetTitreExo,\CircledNumber,\AffVignette,\BoiteArrondie,\ChangerDisplaySkip,\celcouleur,\celfusion,\lignetxt,\colonnetxt,\celnumbreak,\celtxt,\BandeauScore},%
keywordstyle={\color{green!50!black}},%
classoffset=3,%
- morekeywords={Largeur,Filets,EspacesCL,NbCols,Labels,PoliceLabels,EspaceLabels,Swap,Type,CoeffEspVert,EpTrait,Alea,LargeurNivs,Niveaux,NoticeNiveaux,Titre,PolTitre,PolNotice,PolComp,LigneSep,CouleurNotice,CouleurNiveaux,CouleurFond,Note,Notice,PoliceCateg,PoliceBloc,Couleurs,LargeurBloc,Echelle,NoirBlanc,Libelle,EpTrait,Police,Type,ComplementTitre,Titre,CodeDebut,Couleur,EchelleImage,Decoration,Trait,Avatar,AffAvatar,NoirBlanc,CouleurE,CouleurR,CouleurFond,Hauteur,Largeur,PoliceTxt,CouleurTitre,AlignH,bg,txt,bthick,bcol,raise,Type,EspH,Fond,Texte,Style,Dense,Avant,AvantS,Apres,ApresS,Global,align,width},%
+ morekeywords={Largeur,Filets,EspacesCL,NbCols,Labels,PoliceLabels,EspaceLabels,Swap,Type,CoeffEspVert,EpTrait,Alea,LargeurNivs,Niveaux,NoticeNiveaux,Titre,PolTitre,PolNotice,PolComp,LigneSep,CouleurNotice,CouleurNiveaux,CouleurFond,Note,Notice,PoliceCateg,PoliceBloc,Couleurs,LargeurBloc,Echelle,NoirBlanc,Libelle,EpTrait,Police,Type,ComplementTitre,Titre,CodeDebut,Couleur,EchelleImage,Decoration,Trait,Avatar,AffAvatar,NoirBlanc,CouleurE,CouleurR,CouleurFond,Hauteur,Largeur,PoliceTxt,CouleurTitre,AlignH,bg,txt,bthick,bcol,raise,Type,EspH,Fond,Texte,Style,Dense,Avant,AvantS,Apres,ApresS,Global,align,width,Legende,CouleurFond,Hauteur,Ratio,AffLegende,Couleurs,EchelleSymboles,Symboles},%
keywordstyle={\color{orange}}
},%
#1
@@ -799,6 +799,64 @@
\pagebreak
+\section{Bandeau de score}
+
+\subsection{Principe et fonctionnement}
+
+L'idée est de proposer une commande pour insérer un bandeau de score, type \textit{nutriscore}.
+
+\smallskip
+
+La majorité des éléments sont personnalisables.
+
+\begin{DemoCode}{listing only}
+\BandeauScore[clés]{numéro}
+\end{DemoCode}
+
+\begin{DemoCode}{}
+%sortie par défaut
+\BandeauScore{}
+\end{DemoCode}
+
+\subsection{La commande}
+
+Les \MontreCode{clés} disponibles, à donner entre \MontreCode{[...]}, sont :
+
+\begin{itemize}
+ \item \MontreCode{Hauteur} : hauteur du bandeau (sans la légende) ; \MontreCode{1} par défaut
+ \item \MontreCode{Ratio} : rapport V/H des cases ; \MontreCode{0.6} par défaut
+ \item \MontreCode{Symboles} : contenu des cases ; \MontreCode{A,B,C,D,E} par défaut
+ \item \MontreCode{Legende} : texte de la légende (qui sera en majuscule) ; \MontreCode{score} par défaut ;
+ \item \MontreCode{Police} : Police globale ; \MontreCode{\textbackslash bfseries\textbackslash sffamily} par défaut
+ \item \MontreCode{AffLegende} : booléen pour afficher la légende ; \MontreCode{false} par défaut ;
+ \item \MontreCode{Couleurs} : couleurs des cases ;
+
+ \hfill\MontreCode{couleurNS1,couleurNS2,couleurNS3,couleurNS4,couleurNS5} par défaut ;
+ \item \MontreCode{EchelleSymboles} : échelle(s) H/V des symboles ; \MontreCode{1.25,1.65} par défaut ;
+ \item \MontreCode{CouleurFond} : couleur du fond (pour la case choisie) ; \MontreCode{white} par défaut.
+\end{itemize}
+
+L'argument obligatoire correspond quant à lui au numéro de la case à mettre en valeur (\MontreCode{vide} par défaut).
+
+\smallskip
+
+Si la liste des couleurs ne permet pas de remplir toutes les cases, la couleur \MontreCode{lightgray} est utilisée.
+
+\begin{DemoCode}{}
+\BandeauScore[Legende=Géométrie,Hauteur=2]{4}
+\end{DemoCode}
+
+\begin{DemoCode}{colbacklower=yellow!25}
+%le fond de la boîte a été défini sur yellow!25
+\def\lstcouleurs{couleurNS1,couleurNS2,couleurNS3,couleurNS4,couleurNS5,purple}
+\BandeauScore%
+ [EchelleSymboles={1.33,2},Hauteur=2,AffLegende=false,
+ Symboles={1,2,3,4,5,6},Couleurs=\lstcouleurs,
+ CouleurFond=yellow!25]{1}
+\end{DemoCode}
+
+\pagebreak
+
\section{Fenêtre type conversation instantanée}
\subsection{Principe et fonctionnement}
Modified: trunk/Master/texmf-dist/tex/latex/customenvs/customenvs.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/customenvs/customenvs.sty 2024-07-13 20:28:27 UTC (rev 71791)
+++ trunk/Master/texmf-dist/tex/latex/customenvs/customenvs.sty 2024-07-13 20:28:38 UTC (rev 71792)
@@ -3,9 +3,10 @@
% source pencil...: CC-BY-SA 4.0 https://tex.stackexchange.com/questions/504092/replicating-a-fancy-bordered-text-style-in-latex/504145#504145
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{customenvs}[2024/06/03 0.1.7 Custom classic environments]
+\ProvidesPackage{customenvs}[2024/07/13 0.1.8 Custom classic environments]
%====HISTORIQUE
+% v 0.1.8 Nutriscore
% v 0.1.7 Style perso pour les vignettes
% v 0.1.6 DisplaySkip patch + Patchs pas-tableur
% v 0.1.5 Boxes for exam title + circled numbers + Vignettes + Small simple boxes creation
@@ -1095,7 +1096,94 @@
title={\@ifpackageloaded{babel}{\NoAutoSpacing#2}{#2}\IfBooleanTF{#1}{}{$\cdot$\scalebox{0.6}[0.6]{\faCheckCircle[regular]\!\faCheckCircle[regular]}~}},left=1mm,right=1mm,boxsep=0mm]{#3}%
}
+%====Nutriscore
+\definecolor{couleurNS1}{RGB}{45,126,67}
+\definecolor{couleurNS2}{RGB}{151,186,56}
+\definecolor{couleurNS3}{RGB}{240,202,13}
+\definecolor{couleurNS4}{RGB}{213,123,26}
+\definecolor{couleurNS5}{RGB}{197,52,25}
+\tikzset{noeudNS/.style={pos=0.5,xscale=\echellexNS*\hauteurNS,yscale=\echelleyNS*\hauteurNS}}
+\defKV[NUTRISCORE]{%
+ Hauteur=\pgfmathsetmacro{\hauteurNS}{#1},%
+ Ratio=\pgfmathsetmacro{\ratiolargeurbandeNS}{#1},%
+ Symboles=\def\lettresNS{#1},%
+ Legende=\def\legendeNS{#1},%
+ Police=\def\fonteNS{#1},%
+ Couleurs=\def\couleursNS{#1},%
+ EchelleSymboles=\def\echellesymbNS{#1},%
+ CouleurFond=\def\coulbgNS{#1}
+}
+\setKVdefault[NUTRISCORE]{%
+ Hauteur=1,%
+ Ratio={0.6},%
+ Symboles={A,B,C,D,E},%
+ Legende={score},%
+ Police=\sffamily\bfseries,%
+ AffLegende=true,%
+ Couleurs={couleurNS1,couleurNS2,couleurNS3,couleurNS4,couleurNS5},%
+ EchelleSymboles={1.25,1.65},%
+ CouleurFond=white
+}
+
+\NewDocumentCommand\BandeauScore{ O{} D<>{} m }{%
+ \restoreKV[NUTRISCORE]%
+ \setKV[NUTRISCORE]{#1}%
+ \IfEq{#3}{}%
+ {%
+ \xdef\numcasNS{0}%
+ }%
+ {%
+ \xdef\numcasNS{#3}%
+ }%
+ \readlist\letterListNS{\lettresNS}%
+ \xdef\nbcasesNS{\letterListNSlen}%
+ \readlist\colorListNS{\couleursNS}%
+ \xdef\nbcouleursNS{\colorListNSlen}%
+ \pgfmathsetmacro{\largeurcaseNS}{\hauteurNS*\ratiolargeurbandeNS}%
+ \pgfmathsetmacro{\largeurbandeNS}{\largeurcaseNS*\nbcasesNS}%
+ \pgfmathsetmacro{\margeNS}{0.225*\largeurcaseNS/2.4}%
+ \IfSubStr{\echellesymbNS}{,}%
+ {%
+ \StrCut{\echellesymbNS}{,}{\echellexNS}{\echelleyNS}%
+ }%
+ {%
+ \xdef\echellexNS{\echellesymbNS}\xdef\echelleyNS{\echellesymbNS}%
+ }%
+ \begin{tikzpicture}[font=\fonteNS,#2]
+ %---test
+ \filldraw[white,rounded corners=\fpeval{5*\largeurcaseNS*\ratiolargeurbandeNS}mm,line width=\fpeval{1.5*\largeurcaseNS*\ratiolargeurbandeNS}mm,opacity=0] ({-\margeNS},{-\margeNS}) rectangle++ (\nbcasesNS*\largeurcaseNS+2*\margeNS,\hauteurNS+2*\margeNS) ;
+ %---testfin
+ \begin{scope}
+ \clip[rounded corners=\fpeval{5*\largeurcaseNS*\ratiolargeurbandeNS}mm] (0,0) rectangle (\largeurbandeNS,\hauteurNS);
+ \foreach \tmpiii in {1,...,\letterListNSlen}{%
+ \ifnum\tmpiii=\numcasNS
+ \else
+ \ifnum\tmpiii>\nbcouleursNS
+ \fill[draw=none,lightgray] ({(\tmpiii-1)*\largeurcaseNS},0) rectangle ++(\largeurcaseNS,\hauteurNS) node[noeudNS,white,opacity=0.66]{\letterListNS[\tmpiii]};
+ \else
+ \fill[draw=none,{\colorListNS[\tmpiii]}] ({(\tmpiii-1)*\largeurcaseNS},0) rectangle ++(\largeurcaseNS,\hauteurNS) node[noeudNS,white,opacity=0.66]{\letterListNS[\tmpiii]};
+ \fi
+ \fi
+ }%
+ \end{scope}
+ \xintifboolexpr{\numcasNS >=1 'and' \numcasNS <= \nbcasesNS }%
+ {%
+ \begin{scope}
+ %\clip (-\margeNS,-\margeNS) rectangle++ (\largeurbandeNS+2*\margeNS,\hauteurNS+2*\margeNS);
+ \draw[draw=\coulbgNS,rounded corners=\fpeval{7.25*\largeurcaseNS*\ratiolargeurbandeNS}mm,line width=\fpeval{1.5*\largeurcaseNS*\ratiolargeurbandeNS}mm,fill={\colorListNS[#3]}] ({(\numcasNS-1)*\largeurcaseNS-\margeNS},{-\margeNS}) rectangle++ (\largeurcaseNS+2*\margeNS,\hauteurNS+2*\margeNS) node[noeudNS,white]{\letterListNS[\numcasNS]};
+ \end{scope}
+ }%
+ {%
+ }%
+ %légende
+ \ifboolKV[NUTRISCORE]{AffLegende}%
+ {%
+ \node[above right=1pt,gray,scale=\fpeval{0.5*\hauteurNS},inner sep=1pt] at ({0.125*\margeNS},1.02*\hauteurNS) {\vphantom{QÉ}\MakeUppercase{\legendeNS}};
+ }{}%
+ \end{tikzpicture}%
+}
+
%%----COMMANDES EN
%====QCMs
@@ -1932,4 +2020,91 @@
\fi
+%====BannerScore
+\definecolor{colorNS1}{RGB}{45,126,67}
+\definecolor{colorNS2}{RGB}{151,186,56}
+\definecolor{colorNS3}{RGB}{240,202,13}
+\definecolor{colorNS4}{RGB}{213,123,26}
+\definecolor{colorNS5}{RGB}{197,52,25}
+\tikzset{nodeNS/.style={pos=0.5,xscale=\echellexNS*\hauteurNS,yscale=\echelleyNS*\hauteurNS}}
+
+\defKV[NUTRISCOREEN]{%
+ Height=\pgfmathsetmacro{\hauteurNS}{#1},%
+ Ratio=\pgfmathsetmacro{\ratiolargeurbandeNS}{#1},%
+ Symbols=\def\lettresNS{#1},%
+ Legend=\def\legendeNS{#1},%
+ Font=\def\fonteNS{#1},%
+ Colors=\def\couleursNS{#1},%
+ ScaleSymbols=\def\echellesymbNS{#1},%
+ Colbg=\def\coulbgNS{#1}
+}
+\setKVdefault[NUTRISCOREEN]{%
+ Height=1,%
+ Ratio={0.6},%
+ Symbols={A,B,C,D,E},%
+ Legend={score},%
+ Font=\sffamily\bfseries,%
+ ShowLegend=true,%
+ Colors={colorNS1,colorNS2,colorNS3,colorNS4,colorNS5},%
+ ScaleSymbols={1.25,1.65},%
+ Colbg=white
+}
+
+\NewDocumentCommand\ScoreBanner{ O{} D<>{} m }{%
+ \restoreKV[NUTRISCOREEN]%
+ \setKV[NUTRISCOREEN]{#1}%
+ \IfEq{#3}{}%
+ {%
+ \xdef\numcasNS{0}%
+ }%
+ {%
+ \xdef\numcasNS{#3}%
+ }%
+ \readlist\letterListNS{\lettresNS}%
+ \xdef\nbcasesNS{\letterListNSlen}%
+ \readlist\colorListNS{\couleursNS}%
+ \xdef\nbcouleursNS{\colorListNSlen}%
+ \pgfmathsetmacro{\largeurcaseNS}{\hauteurNS*\ratiolargeurbandeNS}%
+ \pgfmathsetmacro{\largeurbandeNS}{\largeurcaseNS*\nbcasesNS}%
+ \pgfmathsetmacro{\margeNS}{0.225*\largeurcaseNS/2.4}%
+ \IfSubStr{\echellesymbNS}{,}%
+ {%
+ \StrCut{\echellesymbNS}{,}{\echellexNS}{\echelleyNS}%
+ }%
+ {%
+ \xdef\echellexNS{\echellesymbNS}\xdef\echelleyNS{\echellesymbNS}%
+ }%
+ \begin{tikzpicture}[font=\fonteNS,#2]
+ %---test
+ \filldraw[white,rounded corners=\fpeval{5*\largeurcaseNS*\ratiolargeurbandeNS}mm,line width=\fpeval{1.5*\largeurcaseNS*\ratiolargeurbandeNS}mm,opacity=0] ({-\margeNS},{-\margeNS}) rectangle++ (\nbcasesNS*\largeurcaseNS+2*\margeNS,\hauteurNS+2*\margeNS) ;
+ %---testfin
+ \begin{scope}
+ \clip[rounded corners=\fpeval{5*\largeurcaseNS*\ratiolargeurbandeNS}mm] (0,0) rectangle (\largeurbandeNS,\hauteurNS);
+ \foreach \iii in {1,...,\letterListNSlen}{%
+ \ifnum\iii=\numcasNS
+ \else
+ \ifnum\iii>\nbcouleursNS
+ \fill[draw=none,lightgray] ({(\iii-1)*\largeurcaseNS},0) rectangle ++(\largeurcaseNS,\hauteurNS) node[noeudNS,white,opacity=0.66]{\letterListNS[\iii]};
+ \else
+ \fill[draw=none,{\colorListNS[\iii]}] ({(\iii-1)*\largeurcaseNS},0) rectangle ++(\largeurcaseNS,\hauteurNS) node[noeudNS,white,opacity=0.66]{\letterListNS[\iii]};
+ \fi
+ \fi
+ }%
+ \end{scope}
+ \xintifboolexpr{\numcasNS >=1 'and' \numcasNS <= \nbcasesNS }%
+ {%
+ \begin{scope}
+ %\clip (-\margeNS,-\margeNS) rectangle++ (\largeurbandeNS+2*\margeNS,\hauteurNS+2*\margeNS);
+ \draw[draw=\coulbgNS,rounded corners=\fpeval{7.25*\largeurcaseNS*\ratiolargeurbandeNS}mm,line width=\fpeval{1.5*\largeurcaseNS*\ratiolargeurbandeNS}mm,fill={\colorListNS[#3]}] ({(\numcasNS-1)*\largeurcaseNS-\margeNS},{-\margeNS}) rectangle++ (\largeurcaseNS+2*\margeNS,\hauteurNS+2*\margeNS) node[noeudNS,white]{\letterListNS[#3]};
+ \end{scope}
+ }%
+ {}%
+ %légende
+ \ifboolKV[NUTRISCOREEN]{ShowLegend}%
+ {%
+ \node[above right=1pt,gray,scale=\fpeval{0.5*\hauteurNS},inner sep=1pt] at ({0.125*\margeNS},1.02*\hauteurNS) {\MakeUppercase{\legendeNS}};
+ }{}%
+ \end{tikzpicture}%
+}
+
\endinput
\ No newline at end of file
More information about the tex-live-commits
mailing list.