% Author..........: C. Pierquet % licence.........: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{customenvs-tikzpictos}[2025/05/18 0.1.0 Small pictograms, made with tikz] %====HISTORY % v 0.1.0 Initial version subpackage of customenvs %====PACKAGES \RequirePackage{xintexpr} \RequirePackage{simplekv} \RequirePackage{xstring} \RequirePackage{listofitems} \RequirePackage{ifthen} \RequirePackage{calc} \RequirePackage{tikz} \usetikzlibrary{shapes.geometric,bbox} %====pictostars \newlength{\pictotmphauteuretoiles} \newlength{\pictotmpprofondeuretoiles} \newlength{\pictotmpoffsetetoiles} \setlength{\pictotmpoffsetetoiles}{0.25pt} \defKV[pictostars]{% colors=\def\tkzLevelStarsColors{#1},% offset=\setlength{\pictotmpoffsetetoiles}{#1},% height=\def\pictotmpheightetetoiles{#1} } \setKVdefault[pictostars]{% colors={black/lightgray},% offset={0.01em},% height=dauto } \NewDocumentCommand{\pictostars}{O{}D<>{}m}{%(OK) modif avec hauteur %#1=clés %#2=options tikz %#3=données nb/nblev \restoreKV[pictostars]% \setKV[pictostars]{#1}% %lecture des données \IfSubStr{#3}{/}% {% \StrCut{#3}{/}{\pictotmpnbetoiles}{\tkzLevelStarsMaxLevel}%param complet }% {% \IfStrEq{#3}{}% {\def\pictotmpnbetoiles{0}\def\tkzLevelStarsMaxLevel{3}}%si vide 0/3 {\def\pictotmpnbetoiles{#3}\def\tkzLevelStarsMaxLevel{3}}%sinon #3/3 }% %couleurs \IfSubStr{\tkzLevelStarsColors}{/}% {% \StrCut{\tkzLevelStarsColors}{/}{\tkzLevelStarsColor}{\tkzLevelStarsColorBg}% }% {% \def\tkzLevelStarsColor{\tkzLevelStarsColors}\def\tkzLevelStarsColorBg{\tkzLevelStarsColors}% }% %lengths \IfSubStr{\pictotmpheightetetoiles}{auto}% {% \IfStrEq{\pictotmpheightetetoiles}{auto}% {% \settototalheight{\pictotmphauteuretoiles}{\hbox{HLM}}% \setlength{\pictotmphauteuretoiles}{0.975\pictotmphauteuretoiles}% %classic tikzpicture \begin{tikzpicture}[bezier bounding box,fill=\tkzLevelStarsColorBg,draw=\tkzLevelStarsColor,rounded corners={0.05\pictotmphauteuretoiles},line width={0.05\pictotmphauteuretoiles},#2] }{}% \IfStrEq{\pictotmpheightetetoiles}{dauto}% {% \settototalheight{\pictotmphauteuretoiles}{\hbox{azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN}}% \setlength{\pictotmphauteuretoiles}{0.975\pictotmphauteuretoiles}% \settodepth{\pictotmpprofondeuretoiles}{\hbox{azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN}}% %raised tikzpicture \begin{tikzpicture}[bezier bounding box,baseline={-\pictotmpprofondeuretoiles},fill=\tkzLevelStarsColorBg,draw=\tkzLevelStarsColor,rounded corners={0.05\pictotmphauteuretoiles},line width={0.05\pictotmphauteuretoiles},#2] }{}% }% {% \setlength\pictotmphauteuretoiles{\pictotmpheightetetoiles}% %classic tikzpicture \begin{tikzpicture}[bezier bounding box,fill=\tkzLevelStarsColorBg,draw=\tkzLevelStarsColor,rounded corners={0.05\pictotmphauteuretoiles},line width={0.05\pictotmphauteuretoiles},#2] }% \foreach \X in {1,...,\tkzLevelStarsMaxLevel}{% \xdef\tmpxfill{\xintfloateval{min(1,max(1+(\pictotmpnbetoiles)-\X,0))}}% \path ({\X*(\pictotmphauteuretoiles+\pictotmpoffsetetoiles)},0) node[star,draw,star point height={0.25\pictotmphauteuretoiles},minimum size={\pictotmphauteuretoiles},inner sep=0pt,path picture={\fill (path picture bounding box.south west) rectangle ([xshift=\tmpxfill*0.9515*\pictotmphauteuretoiles]path picture bounding box.north west);}]{}; } \end{tikzpicture}% } %====PICTO SPEEDO \newlength{\pictotmphauteurgradniv} \defKV[pictoskillswheel]{% colors=\def\miniskillswheelcol{#1},% height=\def\miniskillswheelheight{#1} } \setKVdefault[pictoskillswheel]{% colors=black,% height=dauto } \NewDocumentCommand\pictospeedometer{O{}D<>{}m}{%(OK) à voir avec hauteur auto... %#1 = clés %#2 = options tikz %#2 = données nb/nblev \restoreKV[pictoskillswheel]% \setKV[pictoskillswheel]{#1}% %height \IfSubStr{\miniskillswheelheight}{auto}% {% \IfStrEq{\miniskillswheelheight}{auto}% {% \settototalheight{\pictotmphauteurgradniv}{\hbox{AZERTYUIOPHL}}% \setlength{\pictotmphauteurgradniv}{0.95\pictotmphauteurgradniv}% }{}% \IfStrEq{\miniskillswheelheight}{dauto}% {% \settototalheight{\pictotmphauteurgradniv}{\hbox{azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN}}% \setlength{\pictotmphauteurgradniv}{0.95\pictotmphauteurgradniv}% }{}% }% {% \setlength\pictotmphauteurgradniv{\miniskillswheelheight}% }% %data \IfStrEq{#3}{}%lecture des données {\def\miniskillswheelmark{}\def\pictospeednb{6}}% {% \IfSubStr{#3}{/}% {\StrCut{#3}{/}{\miniskillswheelmark}{\pictospeednb}}% {\def\miniskillswheelmark{#3}\def\pictospeednb{6}}% }% \IfEq{\miniskillswheelmark}{}% {}% {% \xintifboolexpr{\miniskillswheelmark >= 0 'and' \miniskillswheelmark <= \pictospeednb}% {% \xdef\miniskilswheelposcurs{\xintfloateval{180-180*(\miniskillswheelmark)/(\pictospeednb)}}% }% {% \xdef\miniskilswheelposcurs{\xintfloateval{0.5*(\pictospeednb)}}% }% }% \IfSubStr{\miniskillswheelcol}{/}% {% \StrCut{\miniskillswheelcol}{/}{\miniskillswheelcolp}{\miniskillswheelcols}% }% {% \xdef\miniskillswheelcolp{\miniskillswheelcol}\xdef\miniskillswheelcols{\miniskillswheelcol}% }% \IfSubStr{\miniskillswheelheight}{auto}% {% \IfStrEq{\miniskillswheelheight}{auto}% {% %classic tikzpicture \begin{tikzpicture}[bezier bounding box,line width={0.066\pictotmphauteurgradniv},#2,transform shape] }{}% \IfStrEq{\miniskillswheelheight}{dauto}% {% %raised tikzpicture \begin{tikzpicture}[bezier bounding box,baseline={-0.01\pictotmphauteurgradniv},line width={0.066\pictotmphauteurgradniv},#2,transform shape] }{}% }% {% %classic tikzpicture \begin{tikzpicture}[bezier bounding box,line width={0.066\pictotmphauteurgradniv},#2,transform shape] }% \draw[\miniskillswheelcolp] (-15:{0.7588\pictotmphauteurgradniv}) arc(-15:195:{0.7588\pictotmphauteurgradniv}) --cycle ; \foreach \i in {0,...,\pictospeednb}{% \draw[\miniskillswheelcolp,line cap=round] ({180-180*(\i)/\pictospeednb}:{0.55\pictotmphauteurgradniv})--({180-180*(\i)/\pictospeednb}:{0.65\pictotmphauteurgradniv}) ; } \IfEq{\miniskillswheelmark}{}% {}% {% \draw[\miniskillswheelcols] (0,0) circle[radius=0.1\pictotmphauteurgradniv] ; \draw[\miniskillswheelcols,line cap=round] ({\miniskilswheelposcurs}:{0.1\pictotmphauteurgradniv}) -- ({\miniskilswheelposcurs}:{0.6125\pictotmphauteurgradniv}) ; }% \end{tikzpicture}% } %====PICTO BULLSEYE \defKV[tkzArrowBullsEye]{% height=\def\heightarrowbullseye{#1},% maincolor=\def\colorarrowbullseye{#1},% listcolors=\def\colorslistarrowbullseye{#1} } \setKVdefault[tkzArrowBullsEye]{% height=dauto,% maincolor={},% color=false,% colors=false,% listcolors={yellow,red,blue!50!cyan} } \newcommand\inttkzArrowBullsEye{ \draw (54:2.25) arc (54:396:2.25) (0,0) circle[radius=0.6] (0,0) circle[radius=1.36] ; \draw[line cap=round,line join=round] (0,0)--(45:1.7) -- (55:2.5) -- (52:3.5) -- (45:3.1) -- (38:3.5) -- (35:2.5) -- (45:1.7) -- cycle; } \newcommand\intcolortkzArrowBullsEye{ \filldraw[black,fill=\colbullseyeC] (0,0) circle[radius=2.25] ;% \filldraw[black,fill=\colbullseyeB] (0,0) circle[radius=1.36] ; \filldraw[black,fill=\colbullseyeA] (0,0) circle[radius=0.6] ; \draw[black,fill=white,line cap=round,line join=round] (0,0)--(45:1.7) -- (55:2.5) -- (52:3.5) -- (45:3.1) -- (38:3.5) -- (35:2.5) -- (45:1.7) -- cycle; } \def\calcheightofchars{H} \def\calctotheightofchars{qH} \def\calcdepthofchars{qH} \newlength\totheightarrowbullseye \newlength\depthbullseye \NewDocumentCommand\pictobullseye{O{}D<>{}}{%(OK) %#1 = keys %#2 = tikz options \restoreKV[tkzArrowBullsEye]% \setKV[tkzArrowBullsEye]{#1}% \ifboolKV[tkzArrowBullsEye]{colors}% {\setKV[tkzArrowBullsEye]{color=true}}% {}% \ifboolKV[tkzArrowBullsEye]{color}% {% \setsepchar{,}\readlist\lstcolorslistarrowbullseye{\colorslistarrowbullseye}% \itemtomacro\lstcolorslistarrowbullseye[1]\colbullseyeA% \itemtomacro\lstcolorslistarrowbullseye[2]\colbullseyeB% \itemtomacro\lstcolorslistarrowbullseye[3]\colbullseyeC% }% {}% %scale \IfSubStr{\heightarrowbullseye}{auto}% {% \IfStrEq{\heightarrowbullseye}{dauto}% {%dauto with depth \settototalheight\totheightarrowbullseye{\hbox{\calctotheightofchars}}% \settodepth\depthbullseye{\hbox{\calcdepthofchars}}% }% {%auto without depth \settototalheight\totheightarrowbullseye{\hbox{\calcheightofchars}}% }% }% {% \setlength\totheightarrowbullseye{\heightarrowbullseye}% }% %scale + style \pgfmathsetmacro{\tikzarrowbullseyescale}{\totheightarrowbullseye/53mm}% \tikzset{tkzarrowbullseye/.style={scale=\tikzarrowbullseyescale,line width=\fpeval{2.75*\tikzarrowbullseyescale}mm,bezier bounding box}}% %arrow \IfSubStr{\heightarrowbullseye}{auto}% {% \IfStrEq{\heightarrowbullseye}{dauto}% {%raised tikzpicture \raisebox{-\depthbullseye}{% \begin{tikzpicture}[\colorarrowbullseye,tkzarrowbullseye,#2] \ifboolKV[tkzArrowBullsEye]{color}{\intcolortkzArrowBullsEye}{\inttkzArrowBullsEye} \end{tikzpicture}% }% }% {%classic tikzpicture \begin{tikzpicture}[\colorarrowbullseye,tkzarrowbullseye,#2] \ifboolKV[tkzArrowBullsEye]{color}{\intcolortkzArrowBullsEye}{\inttkzArrowBullsEye} \end{tikzpicture}% }% }% {% %classic tikzpicture \begin{tikzpicture}[\colorarrowbullseye,tkzarrowbullseye,#2] \ifboolKV[tkzArrowBullsEye]{color}{\intcolortkzArrowBullsEye}{\inttkzArrowBullsEye} \end{tikzpicture}% }% } %alias \NewCommandCopy\tkzBullsEyeArrow\pictobullseye %====PICTO BATTERY \newlength\unittkzbattery \newlength\tmpheightofcharstkzbattery \newlength\tmpdepthofcharstkzbattery \newlength\tmpraisevofkzbattery \NewDocumentCommand\inttkzbattery{O{}O{}m}{% %#1=maincolor %#2=fillcolor %#3=level \xdef\heightbatterylevel{\fpeval{(0.9)/(\pictobatterynblevels)-\pictobatterystretch}}% \xdef\offsetbatterylevel{\fpeval{(1-(\pictobatterynblevels)*(\heightbatterylevel))/(\pictobatterynblevels+1)}}% \draw[#1,line width=0.125\unittkzbattery,rounded corners=0.033\unittkzbattery,postaction={fill=white}] (-0.33,0) rectangle++ (0.66,1) ; \fill[#1,line width=0.05\unittkzbattery,rounded corners=0.01\unittkzbattery] ([yshift=0.0625\unittkzbattery]-0.15,1) rectangle++ (0.3,0.1) ; \ifnum#3=0\relax% \else% \foreach \i in {1,...,#3}{% \xintifboolexpr{#3 >= \i}% {% \fill[#2,line width=0.125\unittkzbattery,rounded corners=0.033\unittkzbattery] ({-0.33+\offsetbatterylevel},{(\i-1)*\heightbatterylevel+(\i)*\offsetbatterylevel}) rectangle++ ({0.66-2*\offsetbatterylevel},{\heightbatterylevel}) ; }{}% }% \fi% } \defKV[pictobattery]{% maincolor=\def\pictobatterycolor{#1},% barcolor=\def\pictobatteryfillcolor{#1},% height=\def\pictobatteryheight{#1},% scale=\def\pictobatteryscale{#1},% innermargin=\def\pictobatterystretch{#1} } \setKVdefault[pictobattery]{% maincolor={},% barcolor=lightgray,% height=dauto,% flip=false,% scale=1,% innermargin=0.03,% shaded=false } \NewDocumentCommand\pictobattery{O{}D<>{}m}{%(OK) %#1=clés %#2=options tikz %#3=données nb/niv \restoreKV[pictobattery]% \setKV[pictobattery]{#1}% \IfStrEq{#3}{}{\xdef\tmpargggg{0}}{\xdef\tmpargggg{#3}}% \IfSubStr{\tmpargggg}{/}% {% \StrCut{\tmpargggg}{/}{\tmpbattlevel}{\pictobatterynblevels}% }% {% \xdef\tmpbattlevel{\tmpargggg}% \xdef\pictobatterynblevels{3}% }% \IfStrEqCase{\pictobatteryheight}{% {dauto}{\settototalheight\tmpheightofcharstkzbattery{qH}\settodepth\tmpdepthofcharstkzbattery{qH}}% {auto}{\settototalheight\tmpheightofcharstkzbattery{H}\settodepth\tmpdepthofcharstkzbattery{H}}% }[% \setlength\tmpheightofcharstkzbattery{\pictobatteryheight}% ]% \ifboolKV[pictobattery]{shaded}% {% \xdef\levelshededbattery{\fpeval{(\tmpbattlevel)/(\pictobatterynblevels)*100}}% \xdef\pictobatteryfillcolor{\pictobatteryfillcolor!\levelshededbattery}% }% {% \IfStrEq{\pictobatteryfillcolor}{auto}% {% \IfStrEq{\pictobatterynblevels}{2}% {% \xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}% \xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{orange}}{}% \xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{green!75!black}}{}% }{}% \IfStrEq{\pictobatterynblevels}{3}% {% \xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}% \xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}% \xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{orange}}{}% \xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{green!75!black}}{}% }{}% \IfStrEq{\pictobatterynblevels}{4}% {% \xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}% \xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}% \xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{orange}}{}% \xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{yellow}}{}% \xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{green!75!black}}{}% }{}% \IfStrEq{\pictobatterynblevels}{5}% {% \xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}% \xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}% \xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{orange}}{}% \xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{yellow}}{}% \xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{lime}}{}% \xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{green!75!black}}{}% }{}% \IfStrEq{\pictobatterynblevels}{6}% {% \xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}% \xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}% \xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{orange}}{}% \xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{yellow}}{}% \xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{lime}}{}% \xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{lime!50!green}}{}% \xintifboolexpr{\tmpbattlevel == 6}{\xdef\pictobatteryfillcolor{green!75!black}}{}% }{}% \IfStrEq{\pictobatterynblevels}{7}% {% \xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}% \xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}% \xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{red!50!orange}}{}% \xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{orange}}{}% \xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{yellow}}{}% \xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{lime}}{}% \xintifboolexpr{\tmpbattlevel == 6}{\xdef\pictobatteryfillcolor{lime!50!green}}{}% \xintifboolexpr{\tmpbattlevel == 7}{\xdef\pictobatteryfillcolor{green!75!black}}{}% }{}% \IfStrEq{\pictobatterynblevels}{8}% {% \xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}% \xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}% \xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{red!50!orange}}{}% \xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{orange}}{}% \xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{orange!50!yellow}}{}% \xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{yellow}}{}% \xintifboolexpr{\tmpbattlevel == 6}{\xdef\pictobatteryfillcolor{lime}}{}% \xintifboolexpr{\tmpbattlevel == 7}{\xdef\pictobatteryfillcolor{lime!50!green}}{}% \xintifboolexpr{\tmpbattlevel == 8}{\xdef\pictobatteryfillcolor{green!75!black}}{}% }{}% \IfStrEq{\pictobatterynblevels}{9}% {% \xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}% \xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}% \xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{red!50!orange}}{}% \xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{orange}}{}% \xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{orange!50!yellow}}{}% \xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{yellow}}{}% \xintifboolexpr{\tmpbattlevel == 6}{\xdef\pictobatteryfillcolor{yellow!50!lime}}{}% \xintifboolexpr{\tmpbattlevel == 7}{\xdef\pictobatteryfillcolor{lime}}{}% \xintifboolexpr{\tmpbattlevel == 8}{\xdef\pictobatteryfillcolor{lime!50!green}}{}% \xintifboolexpr{\tmpbattlevel == 9}{\xdef\pictobatteryfillcolor{green!75!black}}{}% }{}% \IfStrEq{\pictobatterynblevels}{10}% {% \xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}% \xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}% \xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{red!50!orange}}{}% \xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{orange}}{}% \xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{orange!50!yellow}}{}% \xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{yellow}}{}% \xintifboolexpr{\tmpbattlevel == 6}{\xdef\pictobatteryfillcolor{yellow!50!lime}}{}% \xintifboolexpr{\tmpbattlevel == 7}{\xdef\pictobatteryfillcolor{lime}}{}% \xintifboolexpr{\tmpbattlevel == 8}{\xdef\pictobatteryfillcolor{lime!50!green}}{}% \xintifboolexpr{\tmpbattlevel == 9}{\xdef\pictobatteryfillcolor{green!85!black}}{}% \xintifboolexpr{\tmpbattlevel == 10}{\xdef\pictobatteryfillcolor{green!50!black}}{}% }{}% }% {}% }% \ifboolKV[pictobattery]{flip}% {%1,2738 \xdef\tmpscaaaale{\fpeval{1.2738*\pictobatteryscale}}% \setlength\unittkzbattery{\tmpscaaaale\tmpheightofcharstkzbattery}% \IfStrEq{\pictobatteryheight}{dauto}% {%raided tikzpicture \xdef\tmpoffffset{\fpeval{(1-\pictobatteryscale)/2}}% \setlength\tmpraisevofkzbattery{\dimexpr\tmpoffffset\tmpheightofcharstkzbattery-\tmpdepthofcharstkzbattery\relax}% \raisebox{\tmpraisevofkzbattery}{% \begin{tikzpicture}[x=\unittkzbattery,y=\unittkzbattery,rotate=-90,#2]\inttkzbattery[\pictobatterycolor][\pictobatteryfillcolor]{\tmpbattlevel}\end{tikzpicture}% }% }% {%classic tikzpicture \begin{tikzpicture}[x=\unittkzbattery,y=\unittkzbattery,rotate=-90,#2]\inttkzbattery[\pictobatterycolor][\pictobatteryfillcolor]{\tmpbattlevel}\end{tikzpicture}% }% }% {%0.8163 \xdef\tmpscaaaale{\fpeval{0.8163*\pictobatteryscale}}% \setlength\unittkzbattery{\tmpscaaaale\tmpheightofcharstkzbattery}% \IfStrEq{\pictobatteryheight}{dauto}% {%raided tikzpicture \xdef\tmpoffffset{\fpeval{(1-\pictobatteryscale)/2}}% \setlength\tmpraisevofkzbattery{\dimexpr\tmpoffffset\tmpheightofcharstkzbattery-\tmpdepthofcharstkzbattery\relax}% \raisebox{\tmpraisevofkzbattery}{% \begin{tikzpicture}[x=\unittkzbattery,y=\unittkzbattery,#2]\inttkzbattery[\pictobatterycolor][\pictobatteryfillcolor]{\tmpbattlevel}\end{tikzpicture}% }% }% {%classic tikzpicture \begin{tikzpicture}[x=\unittkzbattery,y=\unittkzbattery,#2]\inttkzbattery[\pictobatterycolor][\pictobatteryfillcolor]{\tmpbattlevel}\end{tikzpicture}% }% }% } %====pictowifi/network \newlength\pictowifitotheight \newlength\pictowifidepth \defKV[pictowifi]{% height=\def\pictowifiheight{#1},% colors=\def\pictowificolors{#1},% style=\def\pictowifistyle{#1} } \setKVdefault[pictowifi]{% height=dauto,% colors={black/lightgray},% style=full } \NewDocumentCommand\intpictonetwork{}{% %\begin{tikzpicture}[x=\pictowifitotheight,y=\pictowifitotheight,line join=round,line cap=round,rounded corners=0.05\pictowifitotheight] \xintifboolexpr{ \tmpwifilevel == 0 }% {% \foreach \i in {1,...,\tmpwifinblevel}{% \xdef\j{\fpeval{(\i-1)*0.225}}% \fill[\pictowificolorbg] ({\j\pictowifitotheight},0) rectangle++ ({0.2\pictowifitotheight},{\i/\tmpwifinblevel}) ; }% }{}% \xintifboolexpr{ \tmpwifilevel == \tmpwifinblevel }% {% \foreach \i in {1,...,\tmpwifinblevel}{% \xdef\j{\fpeval{(\i-1)*0.225}}% \fill[\pictowificolorframe] ({\j\pictowifitotheight},0) rectangle++ ({0.2\pictowifitotheight},{\i/\tmpwifinblevel}) ; }% }{}% \xintifboolexpr{\tmpwifilevel >= 1 'and' \tmpwifilevel < \tmpwifinblevel}% {% \foreach \i in {1,...,\tmpwifilevel}{% \xdef\j{\fpeval{(\i-1)*0.225}}% \fill[\pictowificolorframe] ({\j\pictowifitotheight},0) rectangle++ ({0.2\pictowifitotheight},{\i/\tmpwifinblevel}) ; }% \foreach \i in {\inteval{\tmpwifilevel+1},...,\tmpwifinblevel}{% \xdef\j{\fpeval{(\i-1)*0.225}}% \fill[\pictowificolorbg] ({\j\pictowifitotheight},0) rectangle++ ({0.2\pictowifitotheight},{\i/\tmpwifinblevel}) ; }% }{}% %\end{tikzpicture}% } \NewDocumentCommand\intpictowififull{}{% \fill[\pictowificolorbg] (0,0)--(45:{\tmpwifilevel/\tmpwifinblevel}) arc(45:135:{\tmpwifilevel/\tmpwifinblevel})--cycle ; \draw[\pictowificolorframe] (0,0)--(45:1) arc(45:135:1)--cycle ; } \NewDocumentCommand\intpictowifibar{}{% %rien \xintifboolexpr{ \tmpwifilevel == 0 }% {% \filldraw[\pictowificolorbg] (0,0)--(45:{1/\tmpwifinblevel}) arc(45:135:{1/\tmpwifinblevel})--cycle ; \foreach \i in {2,...,\tmpwifinblevel}{% \draw[\pictowificolorbg] (45:{\i/\tmpwifinblevel}) arc(45:135:{\i/\tmpwifinblevel}) ; }% }% {}% %seulement la première \xintifboolexpr{ \tmpwifilevel == 1 }% {% \filldraw[\pictowificolorframe] (0,0)--(45:{1/\tmpwifinblevel}) arc(45:135:{1/\tmpwifinblevel})--cycle ; \foreach \i in {2,...,\tmpwifinblevel}{% \draw[\pictowificolorbg] (45:{\i/\tmpwifinblevel}) arc(45:135:{\i/\tmpwifinblevel}) ; }% }% {}% %toutes les barres \xintifboolexpr{\tmpwifilevel == \tmpwifinblevel}% {% \filldraw[\pictowificolorframe] (0,0)--(45:{1/\tmpwifinblevel}) arc(45:135:{1/\tmpwifinblevel})--cycle ; \foreach \i in {2,...,\tmpwifilevel}{% \draw[\pictowificolorframe] (45:{\i/\tmpwifinblevel}) arc(45:135:{\i/\tmpwifinblevel}) ; }% }% {}% %les autres cas \xintifboolexpr{\tmpwifilevel > 1 'and' \tmpwifilevel < \tmpwifinblevel}% {% \filldraw[\pictowificolorframe] (0,0)--(45:{1/\tmpwifinblevel}) arc(45:135:{1/\tmpwifinblevel})--cycle ; \foreach \i in {2,...,\tmpwifilevel}{% \draw[\pictowificolorframe] (45:{\i/\tmpwifinblevel}) arc(45:135:{\i/\tmpwifinblevel}) ; }% \foreach \i in {\inteval{\tmpwifilevel+1},...,\tmpwifinblevel}{% \draw[\pictowificolorbg] (45:{\i/\tmpwifinblevel}) arc(45:135:{\i/\tmpwifinblevel}) ; }% }% {}% } \NewDocumentCommand\pictowifi{O{}D<>{}m}{%(OK) %#1=clés %#2=options tikz %#3=données nb/niv \restoreKV[pictowifi]% \setKV[pictowifi]{#1}% \StrCut{\pictowificolors}{/}{\pictowificolorframe}{\pictowificolorbg}% \IfSubStr{#3}{/}% {% \StrCut{#3}{/}{\tmpwifilevel}{\tmpwifinblevel}% }% {% \IfStrEq{#3}{}% {% \def\tmpwifilevel{0}\def\tmpwifinblevel{4}% }% {% \def\tmpwifilevel{#3}\def\tmpwifinblevel{4}% }% }% \IfSubStr{\pictowifiheight}{auto}% {% \IfStrEq{\pictowifiheight}{dauto}% {% \settototalheight\pictowifitotheight{\hbox{qH}}% \setlength\pictowifitotheight{0.95\pictowifitotheight}% \settodepth\pictowifidepth{\hbox{qH}}% }{}% \IfStrEq{\pictowifiheight}{auto}% {% \settototalheight\pictowifitotheight{\hbox{H}}% \setlength\pictowifitotheight{0.95\pictowifitotheight}% \settodepth\pictowifidepth{\hbox{H}}% }{}% }% {% \setlength\pictowifitotheight{\pictowifiheight}% }% \IfStrEq{\pictowifiheight}{dauto}% {% %raised tikzpicture \raisebox{-\pictowifidepth}{% \begin{tikzpicture}[x=\pictowifitotheight,y=\pictowifitotheight,line width=0.05\pictowifitotheight,line join=round,line cap=round,#2] \IfStrEq{\pictowifistyle}{full}{\intpictowififull}{}% \IfStrEq{\pictowifistyle}{bar}{\intpictowifibar}{}% \end{tikzpicture}% }% }% {% %classic tikzpicture \begin{tikzpicture}[x=\pictowifitotheight,y=\pictowifitotheight,line width=0.05\pictowifitotheight,line join=round,line cap=round,#2] \IfStrEq{\pictowifistyle}{full}{\intpictowififull}{}% \IfStrEq{\pictowifistyle}{bar}{\intpictowifibar}{}% \end{tikzpicture}% }% } \NewDocumentCommand\pictonetwork{O{}D<>{}m}{%(OK) %#1=clés %#2=options tikz %#3=données nb/niv \restoreKV[pictowifi]% \setKV[pictowifi]{#1}% \StrCut{\pictowificolors}{/}{\pictowificolorframe}{\pictowificolorbg}% \IfSubStr{#3}{/}% {% \StrCut{#3}{/}{\tmpwifilevel}{\tmpwifinblevel}% }% {% \IfStrEq{#3}{}% {% \def\tmpwifilevel{0}\def\tmpwifinblevel{4}% }% {% \def\tmpwifilevel{#3}\def\tmpwifinblevel{4}% }% }% \IfSubStr{\pictowifiheight}{auto}% {% \IfStrEq{\pictowifiheight}{dauto}% {% \settototalheight\pictowifitotheight{\hbox{qH}}% \settodepth\pictowifidepth{\hbox{qH}}% }{}% \IfStrEq{\pictowifiheight}{auto}% {% \settototalheight\pictowifitotheight{\hbox{H}}% \settodepth\pictowifidepth{\hbox{H}}% }{}% }% {% \setlength\pictowifitotheight{\pictowifiheight}% }% \IfStrEq{\pictowifiheight}{dauto}% {% %raised tikzpicture \raisebox{-\pictowifidepth}{% \begin{tikzpicture}[x=\pictowifitotheight,y=\pictowifitotheight,line join=round,line cap=round,rounded corners=0.05\pictowifitotheight,#2] \intpictonetwork% \end{tikzpicture}% }% }% {% %classic tikzpicture \begin{tikzpicture}[x=\pictowifitotheight,y=\pictowifitotheight,line join=round,line cap=round,rounded corners=0.05\pictowifitotheight,#2] \intpictonetwork% \end{tikzpicture}% }% } %====PICTO SKILLS \def\samplecapletters{AZERTYUIOSDFHKLMWXCVBN} \def\sampledptletters{qypqg} \definecolor{skillgreen}{RGB}{118, 201, 39} \definecolor{skillorange}{RGB}{255, 153, 0} \definecolor{skillred}{RGB}{255, 0, 0} \newlength{\pictoskillheight} \newlength{\pictoskilldepth} \defKV[pictoskill]{% colors=\def\pictoskillcol{#1},% height=\def\pictoskillh{#1},% hoffset=\def\pictoskilloffset{#1},% voffset=\def\pictoskillvoffset{#1},% opacity=\def\pictoskillopacity{#1} } \setKVdefault[pictoskill]{% colors=gray/lightgray,% height=dauto,% hoffset=0.175,% voffset=0.6,% opacity=0.5 } \NewDocumentCommand\pictoskills{O{}D<>{}m}{%(OK) \restoreKV[pictoskill]% \setKV[pictoskill]{#1}% %levels + opacity \IfStrEq{#3}{}%lecture des données {\def\pictoskilllevel{1}\def\pictoskilllevelmax{3}}% {% \IfSubStr{#3}{/}% {\StrCut{#3}{/}{\pictoskilllevel}{\pictoskilllevelmax}}% {\def\pictoskilllevel{#3}\def\pictoskilllevelmax{3}}% }% \xdef\pictoskillopacity{\xintfloateval{100*\pictoskillopacity}}% \IfSubStr{\pictoskillcol}{/}% {% \StrCut{\pictoskillcol}{/}{\pictoskillcolA}{\pictoskillcolB}% }% {% \def\pictoskillcolB{\pictoskillcol!\pictoskillopacity!white}\def\pictoskillcolA{\pictoskillcol}% }% %height \IfStrEqCase{\pictoskillh}{% {auto}% {% \settototalheight{\pictoskillheight}{\hbox{\samplecapletters}}% \settodepth{\pictoskilldepth}{\hbox{\samplecapletters}}% %classic tikzpicture \begin{tikzpicture}[x=1.125\pictoskillheight,y=0.975\pictoskillheight,#2] }% {dauto}% {% \settototalheight{\pictoskillheight}{\hbox{\sampledptletters\samplecapletters}}% \settodepth{\pictoskilldepth}{\hbox{\sampledptletters}}% %raised tikzpicture \begin{tikzpicture}[x=1.125\pictoskillheight,y=0.975\pictoskillheight,baseline=0.975\pictoskilldepth,#2] }% }[% \setlength\pictoskillheight{\pictoskillh}% \setlength\pictoskilldepth{0pt}% %classic tikzpicture \begin{tikzpicture}[x=1.125\pictoskillheight,y=0.975\pictoskillheight,#2] ]% %===test offset \xdef\pictoskilllarg{\fpeval{(1-\pictoskilloffset)/\pictoskilllevelmax}}% \xdef\pictoskilloffsetindiv{\fpeval{(\pictoskilloffset)/(\pictoskilllevelmax+1)}}% %===fintest offset \clip (0,0)--++(0,\pictoskillvoffset)--(1,1)--(1,0)--cycle; \foreach \i in {1,...,\pictoskilllevelmax}{% \xintifboolexpr{\i <= \pictoskilllevel}% {% \fill[\pictoskillcolA] ({(\i*\pictoskilloffsetindiv+(\i-1)*\pictoskilllarg},0) rectangle++ ({\pictoskilllarg},1) ; }% {% \fill[\pictoskillcolB] ({(\i*\pictoskilloffsetindiv+(\i-1)*\pictoskilllarg},0) rectangle++ ({\pictoskilllarg},1) ; }% }% \end{tikzpicture}% } %aliases \NewCommandCopy\pictoskill\pictoskills \NewDocumentCommand\pictoskillsgreen{ O{} }{\pictoskills[#1,colors=skillgreen]{1}} \NewDocumentCommand\pictoskillsorange{ O{} }{\pictoskills[#1,colors=skillorange]{2}} \NewDocumentCommand\pictoskillsred{ O{} }{\pictoskills[#1,colors=skillred]{3}} %====PICTO PILL \newlength\pictopillheight \newlength\pictopilldepth \defKV[pictopill]{% colors=\def\pictopillcolors{#1},% offset=\def\pictopilloffset{#1},% height=\def\pictopilltypeheight{#1},% scale=\def\pictopillscale{#1} } \setKVdefault[pictopill]{% colors={black/lightgray},% offset=0.1,% height=dauto,% scale=0.9 } \NewDocumentCommand\pictopillint{}{% %left part \xintifboolexpr{\pictotmpnbpills >= 1}% {% \draw[\pictopillcolorframe,fill=\pictopillcolorbg] (-\pictopilloffset\pictopillheight,0.4625\pictopillheight) --++ (-0.6\pictopillheight,0) to[out=180,in=90]++ (-0.4625\pictopillheight,-0.4625\pictopillheight) to[out=-90,in=180]++ (0.4625\pictopillheight,-0.4625\pictopillheight) --++ (0.6\pictopillheight,0) -- cycle; }% {% \draw[\pictopillcolorframe] (-\pictopilloffset\pictopillheight,0.4625\pictopillheight) --++ (-0.6\pictopillheight,0) to[out=180,in=90]++ (-0.4625\pictopillheight,-0.4625\pictopillheight) to[out=-90,in=180]++ (0.4625\pictopillheight,-0.4625\pictopillheight) --++ (0.6\pictopillheight,0) -- cycle; }% %middle(s) part \foreach \i in {2,...,\inteval{\pictotmpnbtotpills-1}}{% \xdef\j{\inteval{\i-2}}% \xdef\k{\fpeval{(\i-1)*\pictopilloffset}}% \xintifboolexpr{\pictotmpnbpills >= \i}% {% \draw[\pictopillcolorframe,fill=\pictopillcolorbg] ({\j\pictopillheight+\k\pictopillheight},-0.4625\pictopillheight) rectangle++ (0.925\pictopillheight,0.925\pictopillheight) ; }% {% \draw[\pictopillcolorframe] ({\j\pictopillheight+\k\pictopillheight},-0.4625\pictopillheight) rectangle++ (0.925\pictopillheight,0.925\pictopillheight) ; }% }% %right part \xdef\tmpargAAA{\inteval{\pictotmpnbtotpills-2}}% \xdef\tmpargBBB{\fpeval{(\pictotmpnbtotpills-1)*\pictopilloffset}}% \xintifboolexpr{\pictotmpnbpills == \pictotmpnbtotpills}% {% \draw[\pictopillcolorframe,fill=\pictopillcolorbg] ({\tmpargAAA\pictopillheight+\tmpargBBB\pictopillheight},0.4625\pictopillheight) --++ (0.6\pictopillheight,0) to[out=0,in=90]++ (0.4625\pictopillheight,-0.4625\pictopillheight) to[out=-90,in=0]++ (-0.4625\pictopillheight,-0.4625\pictopillheight) --++ (-0.6\pictopillheight,0) -- cycle; }% {% \draw[\pictopillcolorframe] ({\tmpargAAA\pictopillheight+\tmpargBBB\pictopillheight},0.4625\pictopillheight) --++ (0.6\pictopillheight,0) to[out=0,in=90]++ (0.4625\pictopillheight,-0.4625\pictopillheight) to[out=-90,in=0]++ (-0.4625\pictopillheight,-0.4625\pictopillheight) --++ (-0.6\pictopillheight,0) -- cycle; }% } \NewDocumentCommand{\pictopill}{O{}D<>{}m}{%(OK) modif avec hauteur %#1=clés %#2=options tikz %#3=données nb/nblev \restoreKV[pictopill]% \setKV[pictopill]{#1}% %lecture des données \IfSubStr{#3}{/}% {% \StrCut{#3}{/}{\pictotmpnbpills}{\pictotmpnbtotpills}%param complet }% {% \IfStrEq{#3}{}% {\def\pictotmpnbpills{0}\def\pictotmpnbtotpills{3}}%si vide 0/3 {\def\pictotmpnbpills{#3}\def\pictotmpnbtotpills{3}}%sinon #3/3 }% %couleurs \IfSubStr{\pictopillcolors}{/}% {% \StrCut{\pictopillcolors}{/}{\pictopillcolorframe}{\pictopillcolorbg}% }% {% \def\pictopillcolorframe{\pictopillcolors}\def\pictopillcolorbg{\pictopillcolors}% }% %lengths \IfSubStr{\pictopilltypeheight}{auto}% {% \IfStrEq{\pictopilltypeheight}{auto}% {% \settototalheight{\pictopillheight}{\hbox{HLM}}% }{}% \IfStrEq{\pictopilltypeheight}{dauto}% {% \settototalheight{\pictopillheight}{\hbox{azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN}}% \settodepth{\pictopilldepth}{\hbox{azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN}}% }{}% }% {% \setlength\pictopillheight{\pictopilltypeheight}% }% \IfStrEq{\pictopilltypeheight}{dauto}% {% \begin{tikzpicture}[scale=\pictopillscale,line width=\fpeval{0.075*\pictopillscale}\pictopillheight,baseline=-1.25\pictopilldepth,#2] \pictopillint \end{tikzpicture}% }% {% \begin{tikzpicture}[scale=\pictopillscale,line width=\fpeval{0.075*\pictopillscale}\pictopillheight,#2] \pictopillint \end{tikzpicture}% }% } %====GENERIC MACRO ? \NewDocumentCommand\tkzpicto{O{}D<>{}m}{% \IfSubStr{#3}{wifi}{% \StrBehind{#3}{=}[\tmpargggggwifi]% \pictowifi[#1]<#2>{\tmpargggggwifi}% }{}% \IfSubStr{#3}{network}{% \StrBehind{#3}{=}[\tmpargggggnetwork]% \pictonetwork[#1]<#2>{\tmpargggggnetwork}% }{}% \IfSubStr{#3}{stars}{% \StrBehind{#3}{=}[\tmpargggggstars]% \pictostars[#1]<#2>{\tmpargggggstars}% }{}% \IfSubStr{#3}{speedo}{% \StrBehind{#3}{=}[\tmpargggggspeedo]% \pictospeedometer[#1]<#2>{\tmpargggggspeedo}% }{}% \IfStrEq{#3}{bullseye}{{\pictobullseye[#1]<#2>}}{}% \IfSubStr{#3}{battery}{% \StrBehind{#3}{=}[\tmpargggggbattery]% \pictobattery[#1]<#2>{\tmpargggggbattery}% }{}% \IfSubStr{#3}{skills}{% \StrBehind{#3}{=}[\tmpargggggskills]% \pictoskills[#1]<#2>{\tmpargggggskills}% }{}% \IfSubStr{#3}{pill}{% \StrBehind{#3}{=}[\tmpargggggpill]% \pictopill[#1]<#2>{\tmpargggggpill}% }{}% } \endinput