\NeedsTeXFormat{LaTeX2e}%
\def\PackageName{bclogo}%
\def\fileversion{v3.15}%
\def\filedate{2024/01/23}%
\ProvidesPackage{bclogo}[\filedate\space\fileversion]%
%
% Extensions a charger
\RequirePackage{xkeyval,ifthen}%
\RequirePackage{graphicx}%
%% Les options globales du package sont au nombre de 2: tikz ou pstricks
\newif\ifbclogotikz%
\define@key{bclogo.sty}{tikz}[]{\bclogotikztrue}%
\define@key{bclogo.sty}{pstricks}[]{\bclogotikzfalse}%
%
% quelques dimensions
\newlength{\bc@invboxh}\newlength{\bc@invboxd}%
\newlength{\bc@titleLength}%
\newlength{\logowidth}%
%
\setlength{\logowidth}{17pt}%
\ProcessOptionsX%
%
\ifbclogotikz%
        \RequirePackage{tikz}%
	\RequirePackage[framemethod=tikz]{mdframed}%mdframed2
        \usetikzlibrary{shadows}% pour l'ombre
        \usetikzlibrary{decorations.pathmorphing}% pour la barre ondulee
\else%
        \RequirePackage{pstricks}%
        \RequirePackage{pst-grad}%
        \RequirePackage{pst-coil}% pour la barre ondulee
	\RequirePackage[framemethod=pstricks]{mdframed}%mdframed2
        \RequirePackage{pst-blur}%
        \let\pagecolorOLD\pagecolor% modification pour sauvegarde de la couleur du fond
        \def\pagecolor#1{\gdef\psx@blurbg{#1}\pagecolorOLD{#1}}%suppose l'utilisation: \pagecolor{couleur}
\fi%
\edef\Gin@extensions{.mps,\Gin@extensions}%
\RequirePackage{ifpdf}%
\RequirePackage{etoolbox} % pour robustifier les commandes
\ifpdf\relax\else\DeclareGraphicsRule{mps}{eps}{*}{}\fi%
%
% les symboles
% ==============================================================================
% la fleur
\newcommand\bcfleur{\includegraphics[width=\logowidth]{bc-fleur}}%
% on robustifie
\robustify\bcfleur
% une note (Thomas Labarussias)
\newcommand\bcnote{\includegraphics[width=\logowidth]{bc-note}}%
\robustify\bcnote
% panneau chantier (Jean-Michel Sarlat)
\newcommand\bcpanchant{\includegraphics[width=\logowidth]{bc-aux-301}}%
\robustify\bcpanchant
% ours
\newcommand\bcours{\includegraphics[width=\logowidth]{bc-ours}}%
\robustify\bcours
% etoile
\newcommand\bcetoile{\includegraphics[width=\logowidth]{bc-etoile}}%
\robustify\bcetoile
% attention
\newcommand\bcattention{\includegraphics[width=\logowidth]{bc-attention}}%
\robustify\bcattention
% attention P.Fradin
\newcommand\bctakecare{\includegraphics[width=\logowidth]{bc-takecare}}%
\robustify\bctakecare
% lampe P.Fradin
\newcommand\bclampe{\includegraphics[width=\logowidth]{bc-lampe}}%
\robustify\bclampe
% coeur
\newcommand\bccoeur{\includegraphics[width=\logowidth]{bc-coeur}}%
\robustify\bccoeur
% ornement (tire du site http://openclipart.org )
\newcommand\bcorne{\includegraphics[width=\logowidth]{bc-orne}}%
\robustify\bcorne
% danger (Francois)
\newcommand\bcdanger{\includegraphics[width=\logowidth]{bc-danger}}%
\robustify\bcdanger
% smiley bonne humeur (Francois)
\newcommand\bcsmbh{\includegraphics[width=\logowidth]{bc-smiley-bonnehumeur}}%
\robustify\bcsmbh
% smiley bonne humeur (Francois)
\newcommand\bcsmmh{\includegraphics[width=\logowidth]{bc-smiley-mauvaisehumeur}}%
\robustify\bcsmmh
% le trefle
\newcommand\bctrefle{\includegraphics[width=\logowidth]{bc-trefle}}%
\robustify\bctrefle
% le livre
\newcommand\bcbook{\includegraphics[width=\logowidth]{bc-book}}%
\robustify\bcbook
% point d'interrogation
\newcommand\bcquestion{\includegraphics[width=\logowidth]{bc-inter}}%
\robustify\bcquestion
% crayon anne-sophie philippe
\newcommand\bccrayon{\includegraphics[width=\logowidth]{bc-crayon}}%
\robustify\bccrayon
% info (thomas labarrussias)
\newcommand\bcinfo{\includegraphics[width=\logowidth]{bc-info}}%
\robustify\bcinfo
% plume
\newcommand\bcplume{\includegraphics[width=\logowidth]{bc-plume}}%
\robustify\bcplume
% le pic LaTeX
\newcommand\bcspadesuit{{\centering \huge $\spadesuit$}}%
\robustify\bcspadesuit
% logos Alphonse Capriani
\newcommand\bcbombe{\includegraphics[width=\logowidth]{bc-bombe}}%
\robustify\bcbombe
\newcommand\bccube{\includegraphics[width=\logowidth]{bc-cube}}%
\robustify\bccube
\newcommand\bcdallemagne{\includegraphics[width=\logowidth]{bc-dallemagne}}%
\robustify\bcdallemagne
\newcommand\bcdautriche{\includegraphics[width=\logowidth]{bc-dautriche}}%
\robustify\bcdautriche
\newcommand\bcdbelgique{\includegraphics[width=\logowidth]{bc-dbelgique}}%
\robustify\bcdbelgique
\newcommand\bcdbulgarie{\includegraphics[width=\logowidth]{bc-dbulgarie}}%
\robustify\bcdbulgarie
\newcommand\bcdfrance{\includegraphics[width=\logowidth]{bc-dfrance}}%
\robustify\bcdfrance
\newcommand\bcditalie{\includegraphics[width=\logowidth]{bc-ditalie}}%
\robustify\bcditalie
\newcommand\bcdluxembourg{\includegraphics[width=\logowidth]{bc-dluxembourg}}%
\robustify\bcdluxembourg
\newcommand\bcdpaysbas{\includegraphics[width=\logowidth]{bc-dpaysbas}}%
\robustify\bcdpaysbas
\newcommand\bcdodecaedre{\includegraphics[width=\logowidth]{bc-dodecaedre}}%
\robustify\bcdodecaedre
\newcommand\bceclaircie{\includegraphics[width=\logowidth]{bc-eclaircie}}%
\robustify\bceclaircie
\newcommand\bcicosaedre{\includegraphics[width=\logowidth]{bc-icosaedre}}%
\robustify\bcicosaedre
\newcommand\bcinterdit{\includegraphics[width=\logowidth]{bc-interdit}}%
\robustify\bcinterdit
\newcommand\bcneige{\includegraphics[width=\logowidth]{bc-neige}}%
\robustify\bcneige
\newcommand\bcoctaedre{\includegraphics[width=\logowidth]{bc-octaedre}}%
\robustify\bcoctaedre
\newcommand\bcpluie{\includegraphics[width=\logowidth]{bc-pluie}}%
\robustify\bcpluie
\newcommand\bcpoisson{\includegraphics[width=\logowidth]{bc-poisson}}%
\robustify\bcpoisson
\newcommand\bcsoleil{\includegraphics[width=\logowidth]{bc-soleil}}%
\robustify\bcsoleil
\newcommand\bcstop{\includegraphics[width=\logowidth]{bc-stop}}%
\robustify\bcstop
\newcommand\bctetraedre{\includegraphics[width=\logowidth]{bc-tetraedre}}%
\robustify\bctetraedre
\newcommand\bccalendrier{\includegraphics[width=\logowidth]{bc-calendrier}}%
\robustify\bccalendrier
\newcommand\bchorloge{\includegraphics[width=\logowidth]{bc-horloge}}%
\robustify\bchorloge
\newcommand\bcyin{\includegraphics[width=\logowidth]{bc-yin}}%
\robustify\bcyin
\newcommand\bcrosevents{\includegraphics[width=\logowidth]{bc-rosevents}}%
\robustify\bcrosevents
% fin alphonse
% Vincent Pantaloni route glissante
\newcommand\bcdz{\includegraphics[width=\logowidth]{bc-dz}}%
\robustify\bcdz
% Francois Petiard
\newcommand\bcvelo{\includegraphics[width=\logowidth]{bc-velo}}%
\robustify\bcvelo
\newcommand\bcoeil{\includegraphics[width=\logowidth]{bc-oeil}}%
\robustify\bcoeil
\newcommand\bcpeaceandlove{\includegraphics[width=\logowidth]{bc-peaceandlove}}%
\robustify\bcpeaceandlove
\newcommand\bcnucleaire{\includegraphics[width=\logowidth]{bc-nucleaire}}%
\robustify\bcnucleaire
\newcommand\bcfemme{\includegraphics[width=\logowidth]{bc-femme}}%
\robustify\bcfemme
\newcommand\bchomme{\includegraphics[width=\logowidth]{bc-homme}}%
\robustify\bchomme
\newcommand\bcloupe{\includegraphics[width=\logowidth]{bc-loupe}}%
\robustify\bcloupe
\newcommand\bcrecyclage{\includegraphics[width=\logowidth]{bc-recyclage}}%
\robustify\bcrecyclage
\newcommand\bcvaletcoeur{\includegraphics[width=\logowidth]{bc-valetcoeur}}%
\robustify\bcvaletcoeur
\newcommand\bccle{\includegraphics[width=\logowidth]{bc-cle}}%
\robustify\bccle
\newcommand\bcclefa{\includegraphics[width=\logowidth]{bc-clefa}}%
\robustify\bcclefa
\newcommand\bcclesol{\includegraphics[width=\logowidth]{bc-clesol}}%
\robustify\bcclesol
\newcommand\bcfeujaune{\includegraphics[width=\logowidth]{bc-feujaune}}%
\robustify\bcfeujaune
\newcommand\bcfeurouge{\includegraphics[width=\logowidth]{bc-feurouge}}%
\robustify\bcfeurouge
\newcommand\bcfeutricolore{\includegraphics[width=\logowidth]{bc-feutricolore}}%
\robustify\bcfeutricolore
\newcommand\bcfeuvert{\includegraphics[width=\logowidth]{bc-feuvert}}%
\robustify\bcfeuvert
\newcommand\bcoutil{\includegraphics[width=\logowidth]{bc-outil}}%
\robustify\bcoutil
\newcommand\bctrombone{\includegraphics[width=\logowidth]{bc-trombone}}%
\robustify\bctrombone
% fin Francois
% =========================== La fonction listable =============================
%
\newcommand{\titrebclogo}{Liste des \texttt{bclogo}}%
\newcommand\bccaption[1]{\addcontentsline{bcl}{bclogo}{#1}}%
\newcommand\listofbclogo{\section*{\titrebclogo}\@starttoc{bcl}}%
\newcommand\l@bclogo[2]{\par\noindent #1,~\textit{page~#2}}%
\newcounter{bclogocompteur} % idee de Francois Petiard
%
% ======================================= les keys =============================
%
\newlength{\bcval@epBarre}% on definit une longueur : l'epaisseur de la barre en point
\newlength{\bcval@framesep}% on definit une longueur : l'epaisseur de la marge en point
\newlength{\bcval@tailleOndu}% on definit une longueur : taille d'une ondulation
\newlength{\bcval@borderWidth}% on definit une longueur : epaisseur du bord
\newlength{\bcval@margeG}% on definit une longueur : marge gauche avant la boite
\newlength{\bcval@margeD}% on definit une longueur : marge droite apres la boite
\define@key{bclogo}{logo}[\bcfleur]{\def\bcval@logo{#1}}%
\define@key{bclogo}{couleur}[white]{\def\bcval@couleur{#1}}%
\define@key{bclogo}{arrondi}[0]{\def\bcval@arrondi{#1}}%
\define@key{bclogo}{epOmbre}[0.2]{\def\bcval@epOmbre{#1}}%
\define@key{bclogo}{arrondi}[0]{\def\bcval@arrondi{#1}}%
\define@key{bclogo}{couleurOmbre}[black!30]{\def\bcval@couleurOmbre{#1}}%
\define@key{bclogo}{couleurBarre}[black]{\def\bcval@couleurBarre{#1}}%
\define@key{bclogo}{couleurBord}[black]{\def\bcval@couleurBord{#1}}% modification Philippe Fortemps
\define@key{bclogo}{couleurTexte}[black]{\def\bcval@couleurTexte{#1}}%
\define@key{bclogo}{imageBarre}[]{\def\bcval@imageBarre{#1}}%
\define@key{bclogo}{motifBarre}[*]{\def\bcval@motifBarre{#1}}%
\define@key{bclogo}{marge}[4]{\setlength{\bcval@framesep}{#1 pt}}%
\define@key{bclogo}{margeG}[0]{\setlength{\bcval@margeG}{#1 cm}}%
\define@key{bclogo}{margeD}[0]{\setlength{\bcval@margeD}{#1 cm}}%
\define@key{bclogo}{sousTitre}[]{\def\bcval@sousTitre{#1}}%
\define@key{bclogo}{epBarre}[1.5]{\setlength{\bcval@epBarre}{#1 pt}}%
\define@key{bclogo}{epBord}[0.8]{\setlength{\bcval@borderWidth}{#1 pt}%
        \ifdimgreater{\bcval@borderWidth}{\z@}{\KV@bclogo@noborderfalse}{\KV@bclogo@nobordertrue}%
        }%
\define@key{bclogo}{tailleOndu}[2.5]{\setlength{\bcval@tailleOndu}{#1 pt}}%
\define@boolkey{bclogo}{cadreTitre}[true]{}%
\define@boolkey{bclogo}{noborder}[true]{\ifKV@bclogo@noborder\setlength{\bcval@borderWidth}{\z@}\fi}%
\define@boolkey{bclogo}{ombre}[true]{}%
\define@boolkey{bclogo}{avecBarre}[true]{}%
\define@boolkey{bclogo}{nobreak}[true]{}%
\define@boolkey{bclogo}{blur}[true]{\ifKV@bclogo@blur\KV@bclogo@ombretrue\fi}%
\define@choicekey{bclogo}{barre}{none,line,snake,motif,zigzag,imageExt,imageClip,wave}[line]{%
\ifthenelse{\equal{#1}{none}}{\KV@bclogo@avecBarrefalse\gdef\bc@barre{}}%
{\gdef\bc@barre{\ifKV@bclogo@avecBarre\@nameuse{bc@barre#1}\fi}}%
}%
%
% selection par defaut
\presetkeys{bclogo}{logo,barre,couleur,arrondi,couleurOmbre,couleurTexte,couleurBarre,epOmbre,epBarre,epBord,tailleOndu,ombre=false,cadreTitre=false,%
avecBarre=true,noborder=false,marge,sousTitre,couleurBord,blur=false,nobreak=false}{}%
%
%les differentes commandes de barre verticale a gauche
%
\newcommand*{\bc@barreline}{%
\begin{minipage}{\logowidth}\centering%
\ifbclogotikz%
\begin{tikzpicture}%
\draw[line width=\bcval@epBarre,line cap=butt,color=\bcval@couleurBarre](0,\bc@invboxh)--(0,0);\end{tikzpicture}%
\else%
\psset{unit=1pt}%
\begin{pspicture}(0,0)(0,\bc@invboxh)%
\psline[linewidth=\bcval@epBarre,linecolor=\bcval@couleurBarre](0,\bc@invboxh)(0,0)%
\end{pspicture}%
\fi%
\end{minipage}%
}%
%
%
\newcommand*{\bc@barresnake}{%
\begin{minipage}{\logowidth}\centering%
\ifbclogotikz%
\begin{tikzpicture}[decoration={snake,segment length=2.66\bcval@tailleOndu, amplitude=\bcval@tailleOndu}]%
\draw[decorate,line width=1pt, color=\bcval@couleurBarre](0,\bc@invboxh)--(0,0);\end{tikzpicture}%
\else%
\psset{unit=1pt}%
\begin{pspicture}(0,0)(0,\bc@invboxh)%
\pszigzag[coilarm=0pt,coilwidth=2\bcval@tailleOndu,linewidth=1pt,linearc=1pt,coilheight=1.33,linecolor=\bcval@couleurBarre](0,\bc@invboxh)(0,0)%
\end{pspicture}%
\fi%
\end{minipage}%
}%
%
\newcommand*{\bc@barrezigzag}{%
\begin{minipage}{\logowidth}\centering%
\ifbclogotikz%
\begin{tikzpicture}[decoration={zigzag,segment length=2.66\bcval@tailleOndu, amplitude=\bcval@tailleOndu}]%
\draw[decorate,line width=1pt,color=\bcval@couleurBarre](0,\bc@invboxh)--(0,0);\end{tikzpicture}%
\else%
\psset{unit=1pt}%
\begin{pspicture}(0,0)(0,\bc@invboxh)%
\pszigzag[coilarm=0pt,coilwidth=2\bcval@tailleOndu,linewidth=1pt,linearc=0pt,coilheight=1.33,linecolor=\bcval@couleurBarre](0,\bc@invboxh)(0,0)%
\end{pspicture}%
\fi%
\end{minipage}%
}%
%
\newcommand*{\bc@barreimageExt}{% l'image est deformee
\begin{minipage}{\logowidth}\centering%
\includegraphics[width=\logowidth,height=\bc@invboxh]{\bcval@imageBarre}%
\end{minipage}%
}
%
\newcommand*{\bc@barreimageClip}{%
\begin{minipage}{\logowidth}\centering%
\includegraphics[viewport=0 0 \logowidth~ \bc@invboxh,clip=true]{\bcval@imageBarre}%
\end{minipage}%
}%
%
\newcommand*{\bc@barremotif}{%
\begin{minipage}{\logowidth}\centering%
\color{\bcval@couleurBarre}%
\vbox to \bc@invboxh{\cleaders\vbox{\vss\bcval@motifBarre\vss}\vfill}%
\end{minipage}%
}%
%
\newcommand*{\bc@barrewave}{%
\begin{minipage}{\logowidth}\centering%
\color{\bcval@couleurBarre}%
\vbox to \bc@invboxh{\cleaders\vbox{\vss$\leftwave\right.$\vss}\vfill}%
\end{minipage}%
}%
%
%======================= Quelques definitions===================================
% boite titre
\newsavebox{\bc@envbox}%
%%% precaution JCC
\newcommand*\bclogotitre{}%
\newcommand\bcStyleSousTitre[1]{\normalsize \textit{#1}}%
\newcommand\styleSousTitre[1]{\bcStyleSousTitre{#1}}% pour la compatibilit
\newcommand\bcStyleTitre[1]{\large \textbf{#1}}%
%======================= L'environnement =======================================
%
\ifbclogotikz%definition du style bclogo pour mdframed
\mdfdefinestyle{bc@style}{%
apptotikzsetting={\ifKV@bclogo@blur\tikzset{mdfshadow/.style={%% semblant de blur...
preaction={fill=\bcval@couleurOmbre,line width=5,line join=round,opacity=0.1,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
preaction={fill=\bcval@couleurOmbre,line width=4,line join=round,opacity=0.15,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
preaction={fill=\bcval@couleurOmbre,line width=3,line join=round,opacity=0.2,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
preaction={fill=\bcval@couleurOmbre,line width=2,line join=round,opacity=0.3,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
preaction={fill=\bcval@couleurOmbre,line width=1,line join=round,opacity=0.4,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
preaction={fill=\bcval@couleurOmbre,line width=0.5,line join=round,opacity=0.4,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}}%
                               }}\fi%
},%
singleextra={%
\setlength{\bc@invboxh}{\dimexpr\mdfboundingboxheight-2\mdf@innerlinewidth@length-2\mdf@outerlinewidth@length-%
2\mdf@middlelinewidth@length-\mdf@innertopmargin@length-\mdf@innerbottommargin@length\relax}%
\node[mdfbox,anchor=north west,xshift=\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,%
     yshift=-0.75*\bcval@framesep-\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length]at%
     (P-|O){\box\bc@envbox};%
\node[mdfbox,anchor=south,xshift=\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep+0.5*\logowidth,%
      yshift=\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+\bcval@framesep]at(O){\bc@barre};%
},%
firstextra={%
\setlength{\bc@invboxh}{\dimexpr\mdfboundingboxheight-\mdf@innerlinewidth@length-\mdf@outerlinewidth@length-%
\mdf@middlelinewidth@length-\mdf@innertopmargin@length-\mdf@splitbottomskip@length\relax}%
\node[mdfbox,anchor=north west,xshift=\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,%
     yshift=-0.75*\bcval@framesep-\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length]at%
     (P-|O){\box\bc@envbox};%
\node[mdfbox,anchor=south,xshift=\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep+0.5*\logowidth,%
      yshift=\mdf@splitbottomskip@length]at(O){\bc@barre};%
},%
middleextra={%
\setlength{\bc@invboxh}{\dimexpr\mdfboundingboxheight-\mdf@splitbottomskip@length-\mdf@splittopskip@length\relax},%
\node[mdfbox,anchor=south,xshift=\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep+0.5*\logowidth,%
      yshift=\mdf@splitbottomskip@length]at(O){\bc@barre};%
},%
secondextra={%
\setlength{\bc@invboxh}{\dimexpr\mdfboundingboxheight-\mdf@innerlinewidth@length-\mdf@outerlinewidth@length-%
\mdf@middlelinewidth@length-\mdf@splittopskip@length-\mdf@innerbottommargin@length\relax}%
\node[mdfbox,anchor=south,xshift=\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep+0.5*\logowidth,%
      yshift=\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.75*\bcval@framesep]at(O){\bc@barre};%
}%
}%
\else%pstricks
\mdfdefinestyle{bc@style}{%
singleextra={%
\setlength{\bc@invboxh}{\dimexpr\mdfboundingboxheight-2\mdf@innerlinewidth@length-2\mdf@outerlinewidth@length-%
2\mdf@middlelinewidth@length-\mdf@innertopmargin@length-\mdf@innerbottommargin@length\relax}%
\rput[tl](\dimexpr\mdf@innerlinewidth@length+\mdf@outerlinewidth@length+\mdf@middlelinewidth@length+0.5\bcval@framesep\relax,%
           \dimexpr\mdfboundingboxheight-0.75\bcval@framesep-\mdf@middlelinewidth@length-%
                   \mdf@innerlinewidth@length-\mdf@outerlinewidth@length\relax){\box\bc@envbox}%
\rput[b](\dimexpr\mdf@middlelinewidth@length+\mdf@outerlinewidth@length+0.5\bcval@framesep+0.5\logowidth+\mdf@innerlinewidth@length\relax,%
         \dimexpr\mdf@innerbottommargin@length+\mdf@middlelinewidth@length+\mdf@outerlinewidth@length+\mdf@innerlinewidth@length\relax){\bc@barre}%
},%
firstextra={%
\setlength{\bc@invboxh}{\dimexpr\mdfboundingboxheight-\mdf@innerlinewidth@length-\mdf@outerlinewidth@length-%
\mdf@middlelinewidth@length-\mdf@innertopmargin@length-\mdf@splitbottomskip@length\relax}%
\rput[tl](\dimexpr\mdf@innerlinewidth@length+\mdf@outerlinewidth@length+\mdf@middlelinewidth@length+0.5\bcval@framesep\relax,%
           \dimexpr\mdfboundingboxheight-0.75\bcval@framesep-\mdf@middlelinewidth@length-%
                   \mdf@innerlinewidth@length-\mdf@outerlinewidth@length\relax){\box\bc@envbox}%
\rput[b](\dimexpr\mdf@middlelinewidth@length+\mdf@outerlinewidth@length+0.5\bcval@framesep+0.5\logowidth+\mdf@innerlinewidth@length\relax,%
         \mdf@splitbottomskip@length){\bc@barre}%
},%
middleextra={%
\setlength{\bc@invboxh}{\dimexpr\mdfboundingboxheight-\mdf@splitbottomskip@length-\mdf@splittopskip@length\relax}%
\rput[b](\dimexpr\mdf@middlelinewidth@length+\mdf@outerlinewidth@length+0.5\bcval@framesep+0.5\logowidth+\mdf@innerlinewidth@length\relax,%
         \mdf@splitbottomskip@length){\bc@barre}%
},%
secondextra={%
\setlength{\bc@invboxh}{\dimexpr\mdfboundingboxheight-\mdf@innerlinewidth@length-\mdf@outerlinewidth@length-%
\mdf@middlelinewidth@length-\mdf@splittopskip@length-\mdf@innerbottommargin@length\relax}%
\rput[b](\dimexpr\mdf@middlelinewidth@length+\mdf@outerlinewidth@length+0.5\bcval@framesep+0.5\logowidth+\mdf@innerlinewidth@length\relax,%
         \dimexpr\mdf@innerbottommargin@length+\mdf@middlelinewidth@length+\mdf@outerlinewidth@length+\mdf@innerlinewidth@length\relax){\bc@barre}%
}%
}%
\fi%
%
\newenvironment*{bclogo}[2][]{%
        \setkeys{bclogo}{#1}%options
        \renewcommand*\bclogotitre{#2}%
        % deux types de titres
        \ifKV@bclogo@cadreTitre% si cadreTitre = true
        \def\bc@structitre{%
                \hfil%
                \ifbclogotikz% cadreTitre tikz
                \begin{tikzpicture}%
                        \node[rectangle, thick, top color=red!60!green!40, bottom color=white,draw]{\large #2};%
                \end{tikzpicture}%
                \else% cadreTitre pstricks
                \psframebox[fillstyle=gradient,gradmidpoint=0.2, gradangle=0,gradbegin=red!60!green!40, gradend=white]{\large  #2}%
                \fi%
                \hfil%
        }%
        \else%sinon cadreTitre = false
                \def\bc@structitre{\bcStyleTitre{#2} \bcStyleSousTitre{\bcval@sousTitre}}%
        \fi%
        %boite logo+titre
        \setlength{\bc@titleLength}{%
        \dimexpr\linewidth-\bcval@margeD-\bcval@margeG-1.5\bcval@framesep-\ifKV@bclogo@noborder\z@\else2\bcval@borderWidth\fi-%
        \logowidth-\ifKV@bclogo@ombre\bcval@epOmbre cm\else\z@\fi\relax}%
        %
        \begin{lrbox}{\bc@envbox}% boite titre
                \begin{tabular}{@{}c@{}p{\bc@titleLength}@{}}%
                        \begin{minipage}{\logowidth}%
                                \refstepcounter{bclogocompteur}\bccaption{\bclogotitre}\bcval@logo%
                        \end{minipage}%
                        &%
                        \ifKV@bclogo@cadreTitre%
                        \begin{minipage}{\bc@titleLength}%
                        \bc@structitre%
                        \end{minipage}%
                        \else\bc@structitre\fi%
                \end{tabular}%
        \end{lrbox}%
        % affichage
        \smallskip% ressort 
        \def\bcval@nobreak{\ifKV@bclogo@nobreak true\else false\fi}% gestion nobreak
        \def\bcval@shadow{\ifKV@bclogo@ombre true\else false\fi}% gestion ombre
        %
        %
        \ifbclogotikz%
        \mdframed[%
        style=bc@style,%
        innerleftmargin={\dimexpr\ifKV@bclogo@avecBarre\logowidth\else\z@\fi+\bcval@framesep\relax},%
        innertopmargin={\dimexpr\ht\bc@envbox+\dp\bc@envbox+\bcval@framesep\relax},%hauteur titre+framesep
        innerrightmargin=\bcval@framesep,%
        innerbottommargin=\bcval@framesep,%
        rightmargin={\dimexpr\bcval@margeD+\ifKV@bclogo@ombre\bcval@epOmbre cm\else\z@\fi\relax},%
        leftmargin=\bcval@margeG,%
        backgroundcolor=\bcval@couleur,%
        fontcolor=\bcval@couleurTexte,%
        middlelinewidth=\bcval@borderWidth,%
        linecolor=\bcval@couleurBord,%
        roundcorner={\bcval@arrondi cm},%
        nobreak=\bcval@nobreak,%l'option nobreak de mdframed vient avec la version 0.9
        shadow=\bcval@shadow,%
        shadowsize=\bcval@epOmbre cm,%
        shadowcolor=\bcval@couleurOmbre,%
        ]%
        \else% pstricks
                \ifKV@bclogo@blur% option blur
                \mdframed[%
                style=bc@style,%
                innerleftmargin={\dimexpr\ifKV@bclogo@avecBarre\logowidth\else\z@\fi+\bcval@framesep\relax},%
                innertopmargin={\dimexpr\ht\bc@envbox+\dp\bc@envbox+\bcval@framesep\relax},%hauteur titre+framesep
                innerrightmargin=\bcval@framesep,%
                innerbottommargin=\bcval@framesep,%
                rightmargin={\dimexpr\bcval@margeD+\ifKV@bclogo@ombre\bcval@epOmbre cm\else\z@\fi\relax},%
                leftmargin=\bcval@margeG,%
                backgroundcolor=\bcval@couleur,%
                fontcolor=\bcval@couleurTexte,%
                middlelinewidth=\bcval@borderWidth,%
                linecolor=\bcval@couleurBord,%
                roundcorner={\bcval@arrondi cm},%
                nobreak=\bcval@nobreak,%l'option nobreak de mdframed vient avec la version 0.9
                shadow=\bcval@shadow,%
                shadowsize=\bcval@epOmbre cm,%
                shadowcolor=\bcval@couleurOmbre,%
                pstrickssetting={%
                        blur=true%
                },%
                ]%
                \else% sans blur
                \mdframed[%
                style=bc@style,%
                innerleftmargin={\dimexpr\ifKV@bclogo@avecBarre\logowidth\else\z@\fi+\bcval@framesep\relax},%
                innertopmargin={\dimexpr\ht\bc@envbox+\dp\bc@envbox+\bcval@framesep\relax},%hauteur titre+framesep
                innerrightmargin=\bcval@framesep,%
                innerbottommargin=\bcval@framesep,%
                rightmargin={\dimexpr\bcval@margeD+\ifKV@bclogo@ombre\bcval@epOmbre cm\else\z@\fi\relax},%
                leftmargin=\bcval@margeG,%
                backgroundcolor=\bcval@couleur,%
                fontcolor=\bcval@couleurTexte,%
                middlelinewidth=\bcval@borderWidth,%
                linecolor=\bcval@couleurBord,%
                roundcorner={\bcval@arrondi cm},%
                nobreak=\bcval@nobreak,%l'option nobreak de mdframed vient avec la version 0.9
                shadow=\bcval@shadow,%
                shadowsize=\bcval@epOmbre cm,%
                shadowcolor=\bcval@couleurOmbre,%
                ]%
                \fi% fin test blur
        \fi% fin test tikz ou pstricks
}%
{%
\endmdframed\par%
\smallskip%
\goodbreak%
}%
\endinput%
%%%%%%%%%%%%%%%% fin %%%%%%%%%%%%%%%%
