%%%
% Billet
%%%
\def\filedateBillet{2026/02/15}%
\def\fileversionBillet{0.1}%
\message{-- \filedateBillet\space v\fileversionBillet}%

\setKVdefault[PfCBillet]{Echelle=0.025,Ecart=10pt,EcartBillet=-10pt,EcartVH=-2.2875cm,Vertical,Impression}%

\makeatletter
\NewDocumentCommand\Billet{om}{%
  \useKVdefault[PfCBillet]%
  \setKV[PfCBillet]{#1}%
  \edef\PfC@ListeBilletAv{#2}%
  \setsepchar{,}\ignoreemptyitems%
  \readlist*\PfC@ListeBillet{\PfC@ListeBilletAv}%
  \reademptyitems%
  \edef\PfC@scale{\useKV[PfCBillet]{Echelle}}%
  \ifboolKV[PfCBillet]{Impression}{%
    \ifboolKV[PfCBillet]{Vertical}{%
      \xintFor* ##1 in{\xintSeq{1}{\PfC@ListeBilletlen}}\do{%
        \StrCount{\PfC@ListeBillet[##1]}{*}[\PfC@RecupStar]%
        \ifnum\PfC@RecupStar=0\relax%
          \itemtomacro\PfC@ListeBillet[##1]\PfCsuffixebillet%
          \includegraphics[scale=\PfC@scale]{PfCBillet\PfCsuffixebillet.pdf}%
        \else%
          \StrBefore{\PfC@ListeBillet[##1]}{*}[\PfC@Facteur]%
          \StrBehind{\PfC@ListeBillet[##1]}{*}[\PfC@Image]%
          \begin{tikzpicture}
            \foreach \PfCi in {1,...,\PfC@Facteur}{%
              \draw (0,{-1*(\PfCi-1)*\useKV[PfCBillet]{EcartBillet}}) node[inner sep=0pt]{\includegraphics[scale=\PfC@scale]{PfCBillet\PfC@Image.pdf}};%
            }%
          \end{tikzpicture}%
        \fi%
        \xintifForLast{}{\hspace*{\useKV[PfCBillet]{Ecart}}}%
      }%
    }{%
      \begin{tikzpicture}
        \xintFor* ##1 in{\xintSeq{1}{\PfC@ListeBilletlen}}\do{%
          \StrCount{\PfC@ListeBillet[##1]}{*}[\PfC@RecupStar]%
          \ifnum\PfC@RecupStar=0\relax%
            \itemtomacro\PfC@ListeBillet[##1]\PfC@Image%
            \draw (0,{-1*(##1-1)*\useKV[PfCBillet]{EcartVH}}) node[inner sep=0pt]{\includegraphics[scale=\PfC@scale]{PfCBillet\PfC@Image.pdf}};%
          \else%
            \StrBefore{\PfC@ListeBillet[##1]}{*}[\PfC@Facteur]%
            \StrBehind{\PfC@ListeBillet[##1]}{*}[\PfC@Image]%
            \foreach \PfCi in {1,...,\PfC@Facteur}{%
              \draw ({-1*(\PfCi-1)*\useKV[PfCBillet]{EcartBillet}},{-1*(##1-1)*\useKV[PfCBillet]{EcartVH}}) node[inner sep=0pt]{\includegraphics[scale=\PfC@scale]{PfCBillet\PfC@Image.pdf}};%
            }%
          \fi%
        }%
      \end{tikzpicture}%
    }%
  }{%Couleur
    \ifboolKV[PfCBillet]{Vertical}{%
      \xintFor* ##1 in{\xintSeq{1}{\PfC@ListeBilletlen}}\do{%
        \StrCount{\PfC@ListeBillet[##1]}{*}[\PfC@RecupStar]%
        \ifnum\PfC@RecupStar=0\relax%
          \itemtomacro\PfC@ListeBillet[##1]\PfCsuffixebillet%
          \includegraphics[scale=\PfC@scale]{PfCBilletCoul\PfCsuffixebillet.pdf}%
        \else%
          \StrBefore{\PfC@ListeBillet[##1]}{*}[\PfC@Facteur]%
          \StrBehind{\PfC@ListeBillet[##1]}{*}[\PfC@Image]%
          \begin{tikzpicture}
            \foreach \PfCi in {1,...,\PfC@Facteur}{%
              \draw (0,{-1*(\PfCi-1)*\useKV[PfCBillet]{EcartBillet}}) node[inner sep=0pt]{\includegraphics[scale=\PfC@scale]{PfCBilletCoul\PfC@Image.pdf}};%
            }%
          \end{tikzpicture}%
        \fi%
        \xintifForLast{}{\hspace*{\useKV[PfCBillet]{Ecart}}}%
      }%
    }{%
      \begin{tikzpicture}
        \xintFor* ##1 in{\xintSeq{1}{\PfC@ListeBilletlen}}\do{%
          \StrCount{\PfC@ListeBillet[##1]}{*}[\PfC@RecupStar]%
          \ifnum\PfC@RecupStar=0\relax%
            \itemtomacro\PfC@ListeBillet[##1]\PfC@Image%
            \draw (0,{-1*(##1-1)*\useKV[PfCBillet]{EcartVH}}) node[inner sep=0pt]{\includegraphics[scale=\PfC@scale]{PfCBilletCoul\PfC@Image.pdf}};%
          \else%
            \StrBefore{\PfC@ListeBillet[##1]}{*}[\PfC@Facteur]%
            \StrBehind{\PfC@ListeBillet[##1]}{*}[\PfC@Image]%
            \foreach \PfCi in {1,...,\PfC@Facteur}{%
              \draw ({-1*(\PfCi-1)*\useKV[PfCBillet]{EcartBillet}},{-1*(##1-1)*\useKV[PfCBillet]{EcartVH}}) node[inner sep=0pt]{\includegraphics[scale=\PfC@scale]{PfCBilletCoul\PfC@Image.pdf}};%
            }%
          \fi%
        }%
      \end{tikzpicture}%
    }%
  }%
}%
\makeatother