diff options
author | Karl Berry <karl@freefriends.org> | 2024-03-30 19:54:20 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-03-30 19:54:20 +0000 |
commit | ceb60a889a9349b5f17a956471d750f5a7653619 (patch) | |
tree | aa73640f2a02857e37f307f69ea02a4291500910 /Master/texmf-dist/tex/latex/customenvs | |
parent | 2f4e2f4e61e34ab99691754741300f42368a16c5 (diff) |
customenvs (30mar24)
git-svn-id: svn://tug.org/texlive/trunk@70815 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/customenvs')
-rw-r--r-- | Master/texmf-dist/tex/latex/customenvs/customenvs.sty | 252 |
1 files changed, 251 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/latex/customenvs/customenvs.sty b/Master/texmf-dist/tex/latex/customenvs/customenvs.sty index 34b3c30803b..08083eb1034 100644 --- a/Master/texmf-dist/tex/latex/customenvs/customenvs.sty +++ b/Master/texmf-dist/tex/latex/customenvs/customenvs.sty @@ -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/03/17 0.1.2 Custom classic environments] +\ProvidesPackage{customenvs}[2024/03/30 0.1.3 Custom classic environments] %====HISTORIQUE +% v 0.1.3 Environnement/Commande pour présentation d'un exercice % v 0.1.2 Crayon de compétences % v 0.1.1 Ajout de tableaux de compétences % v 0.1.0 Version initiale @@ -50,6 +51,7 @@ \RequirePackage{simplekv} \RequirePackage{xstring} \RequirePackage{listofitems} +\RequirePackage{calc} \RequirePackage{tikz} \usetikzlibrary{decorations.pathmorphing,positioning,shapes.misc,calc} @@ -663,6 +665,254 @@ \end{tikzpicture}% } +%====EXERCICE PERSO + +\newcounter{numeroexo} +\setcounter{numeroexo}{0} +\newlength{\eptraitexo} +\setlength{\eptraitexo}{1.1pt} +\newlength{\eptraitexospace} +\setlength{\eptraitexospace}{1.5\eptraitexo} +\newlength{\tmp@image@hauteur@totale} +\newlength{\tmp@image@profondeur} + +\colorlet{macouleurexo}{blue!50!black} + +\newcommand\tmpstyleexo{\bfseries\LARGE\sffamily}% +\newcommand\tmplabelexo{Exercice~}% + +\defKV[globalstyleexo]{% + Libelle=\renewcommand\tmplabelexo{#1},% + Couleur=\colorlet{macouleurexo}{#1},% + Police=\renewcommand\tmpstyleexo{#1},% + EpTrait=\setlength{\eptraitexo}{#1} +} + +\setKVdefault[globalstyleexo]{% + Libelle={Exercice~},% + Couleur={blue!50!black},% + Police={\bfseries\LARGE\sffamily},% + EpTrait={1.1pt} +} + +\NewDocumentCommand\StyleEnvtExo{ O{} }{% + \restoreKV[globalstyleexo]% + \setKV[globalstyleexo]{#1}% +} +\NewDocumentCommand\StyleEnvtExoDefaut{ }{% + \restoreKV[globalstyleexo]% +} + +\defKV[EnvtExercice]{% + Type=\def\EnvtExoType{#1},% + ComplementTitre=\def\EnvtExoCpltTitre{#1},% + CodeDebut=\def\EnvtExoCodeAvant{#1},% + %Couleur=\def\EnvtExoCouleur{#1},% + EchelleImage=\def\EnvtExoScaleImg{#1},% + Decoration=\def\EnvtExoDeco{#1},% + Trait=\def\EnvtExoTrait{#1} +} +\setKVdefault[EnvtExercice]{ + Type=Classique,% + ComplementTitre={},% + CodeDebut={},% + %Couleur=macouleurexo,% + EchelleImage=1.15,% + Compteur=true,% + Decoration={},% + Trait=plein +} + +\NewDocumentEnvironment{EnvtExo}{ !O{} }% +{% + \useKVdefault[EnvtExercice]% + \setKV[EnvtExercice]{#1}% + \addtocounter{numeroexo}{1}% + \ifboolKV[EnvtExercice]{Compteur}{}{\addtocounter{numeroexo}{-1}}% + \def\hrulefill{\leavevmode\leaders\hrule height \eptraitexo\hfill\kern\z@}%épaisseur + \noindent\begingroup\color{macouleurexo}% + \IfStrEq{\EnvtExoType}{Classique}%OK exo°____vide + {% + %label avec numéro et complément + \tmpstyleexo\tmplabelexo\ifboolKV[EnvtExercice]{Compteur}{\thenumeroexo}{}\EnvtExoCpltTitre% + %trait éventuel + \IfStrEqCase{\EnvtExoTrait}{% + {plein}{\,\hrulefill}% + {pointilles}{\,\dotfill}% + {dashilles}{\,\hdashrule{\fill}{\eptraitexo}{\eptraitexospace}}% + {non}{\hfill}% + }% + %décoration éventuelle + \IfSubStr{\EnvtExoDeco}{Icone}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoIcon]% + \,\scalebox{0.85}[0.85]{\EnvtExoIcon}% + }{}% + \IfSubStr{\EnvtExoDeco}{Ceinture}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoCouleur]% + \,\CeintureCouleur{\EnvtExoCouleur}% + }{}% + \IfSubStr{\EnvtExoDeco}{Chrono}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoChrono]% + \,\pictochrono[ColTime=macouleurexo!50]{\EnvtExoChrono}% + }{}% + \IfSubStr{\EnvtExoDeco}{Points}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoPts]% + \IfStrEq{\EnvtExoPts}{1}{\def\pts{point}}{\def\pts{points}}% + \,(\EnvtExoPts\ \pts)% + }{}% + \IfSubStr{\EnvtExoDeco}{Image}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoImg]% + \settototalheight{\tmp@image@hauteur@totale}{\hbox{\tmpstyleexo qB}}% + \,$\vcenter{\hbox{\includegraphics[height=\EnvtExoScaleImg\tmp@image@hauteur@totale]{\EnvtExoImg}}}$% + }{}% + }{}% + \IfSubStr{\EnvtExoType}{Perso}%OK perso____déco + {% + \StrBehind{\EnvtExoType}{/}[\EnvtExoLabel]% + %label avec numéro et complément + \tmpstyleexo\EnvtExoLabel\ifboolKV[EnvtExercice]{Compteur}{\thenumeroexo}{}\EnvtExoCpltTitre% + %trait éventuel + \IfStrEqCase{\EnvtExoTrait}{% + {plein}{\,\hrulefill}% + {pointilles}{\,\dotfill}% + {dashilles}{\,\hdashrule{\fill}{\eptraitexo}{\eptraitexospace}}% + {non}{\hfill}% + }% + %décoration éventuelle + \IfSubStr{\EnvtExoDeco}{Icone}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoIcon]% + \,\scalebox{0.85}[0.85]{\EnvtExoIcon}% + }{}% + \IfSubStr{\EnvtExoDeco}{Ceinture}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoCouleur]% + \,\CeintureCouleur{\EnvtExoCouleur}% + }{}% + \IfSubStr{\EnvtExoDeco}{Chrono}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoChrono]% + \,\pictochrono[ColTime=macouleurexo!50]{\EnvtExoChrono}% + }{}% + \IfSubStr{\EnvtExoDeco}{Points}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoPts]% + \IfStrEq{\EnvtExoPts}{1}{\def\pts{point}}{\def\pts{points}}% + \,(\EnvtExoPts\ \pts)% + }{}% + \IfSubStr{\EnvtExoDeco}{Image}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoImg]% + \settototalheight{\tmp@image@hauteur@totale}{\hbox{\tmpstyleexo qB}}% + \,$\vcenter{\hbox{\includegraphics[height=\EnvtExoScaleImg\tmp@image@hauteur@totale]{\EnvtExoImg}}}$% + }{}% + }{}% + \endgroup% + \def\hrulefill{\leavevmode\leaders\hrule height 0.4pt\hfill\kern\z@}% + \par% + \EnvtExoCodeAvant% +}% +{}% + +\NewDocumentCommand\TitreExo{ !O{} }{% + \useKVdefault[EnvtExercice]% + \setKV[EnvtExercice]{#1}% + \addtocounter{numeroexo}{1}% + \ifboolKV[EnvtExercice]{Compteur}{}{\addtocounter{numeroexo}{-1}}% + \def\hrulefill{\leavevmode\leaders\hrule height \eptraitexo\hfill\kern\z@}%épaisseur + \noindent\begingroup\color{macouleurexo}% + \IfStrEq{\EnvtExoType}{Classique}%OK exo°____vide + {% + %label avec numéro et complément + \tmpstyleexo\tmplabelexo\ifboolKV[EnvtExercice]{Compteur}{\thenumeroexo}{}\EnvtExoCpltTitre% + %trait éventuel + \IfStrEqCase{\EnvtExoTrait}{% + {plein}{\,\hrulefill}% + {pointilles}{\,\dotfill}% + {dashilles}{\,\hdashrule{\fill}{\eptraitexo}{\eptraitexospace}}% + {non}{\hfill}% + }% + %décoration éventuelle + \IfSubStr{\EnvtExoDeco}{Icone}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoIcon]% + \,\scalebox{0.85}[0.85]{\EnvtExoIcon}% + }{}% + \IfSubStr{\EnvtExoDeco}{Ceinture}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoCouleur]% + \,\CeintureCouleur{\EnvtExoCouleur}% + }{}% + \IfSubStr{\EnvtExoDeco}{Chrono}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoChrono]% + \,\pictochrono[ColTime=macouleurexo!50]{\EnvtExoChrono}% + }{}% + \IfSubStr{\EnvtExoDeco}{Points}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoPts]% + \IfStrEq{\EnvtExoPts}{1}{\def\pts{point}}{\def\pts{points}}% + \,(\EnvtExoPts\ \pts)% + }{}% + \IfSubStr{\EnvtExoDeco}{Image}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoImg]% + \settototalheight{\tmp@image@hauteur@totale}{\hbox{\tmpstyleexo qB}}% + \,$\vcenter{\hbox{\includegraphics[height=\EnvtExoScaleImg\tmp@image@hauteur@totale]{\EnvtExoImg}}}$% + }{}% + }{}% + \IfSubStr{\EnvtExoType}{Perso}%OK perso____déco + {% + \StrBehind{\EnvtExoType}{/}[\EnvtExoLabel]% + %label avec numéro et complément + \tmpstyleexo\EnvtExoLabel\ifboolKV[EnvtExercice]{Compteur}{\thenumeroexo}{}\EnvtExoCpltTitre% + %trait éventuel + \IfStrEqCase{\EnvtExoTrait}{% + {plein}{\,\hrulefill}% + {pointilles}{\,\dotfill}% + {dashilles}{\,\hdashrule{\fill}{\eptraitexo}{\eptraitexospace}}% + {non}{\hfill}% + }% + %décoration éventuelle + \IfSubStr{\EnvtExoDeco}{Icone}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoIcon]% + \,\scalebox{0.85}[0.85]{\EnvtExoIcon}% + }{}% + \IfSubStr{\EnvtExoDeco}{Ceinture}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoCouleur]% + \,\CeintureCouleur{\EnvtExoCouleur}% + }{}% + \IfSubStr{\EnvtExoDeco}{Chrono}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoChrono]% + \,\pictochrono[ColTime=macouleurexo!50]{\EnvtExoChrono}% + }{}% + \IfSubStr{\EnvtExoDeco}{Points}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoPts]% + \IfStrEq{\EnvtExoPts}{1}{\def\pts{point}}{\def\pts{points}}% + \,(\EnvtExoPts\ \pts)% + }{}% + \IfSubStr{\EnvtExoDeco}{Image}% + {% + \StrBehind{\EnvtExoDeco}{/}[\EnvtExoImg]% + \settototalheight{\tmp@image@hauteur@totale}{\hbox{\tmpstyleexo qB}}% + \,$\vcenter{\hbox{\includegraphics[height=\EnvtExoScaleImg\tmp@image@hauteur@totale]{\EnvtExoImg}}}$% + }{}% + }{}% + \endgroup% + \def\hrulefill{\leavevmode\leaders\hrule height 0.4pt\hfill\kern\z@}% + \par% + \EnvtExoCodeAvant% +} + %%----COMMANDES EN %====QCMs |