bclogo.sty: correction virgule mal placee
[bclogo.git] / dev / latex / bclogo.sty
index 95a0e7d..4dcf5cf 100644 (file)
@@ -1,39 +1,42 @@
 \NeedsTeXFormat{LaTeX2e}%
 \def\PackageName{bclogo}%
-\def\fileversion{v2.27}%
-\def\filedate{2011/10/01}%
-\ProvidesPackage{bclogo}%
-   [\filedate\space\fileversion]%
+\def\fileversion{v3.0}%
+\def\filedate{2012/07/21}%
+\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%
 \newif\ifbclogoblur%
 \define@key{bclogo.sty}{tikz}[]{\bclogotikztrue}%
 \define@key{bclogo.sty}{pstricks}[]{\bclogotikzfalse}%
 \define@key{bclogo.sty}{blur}[]{\bclogoblurtrue}%
-\newlength{\logowidth}\setlength{\logowidth}{17pt}%
+%
+% quelques dimensions
+\newlength{\bc@invboxh}\newlength{\bc@invboxd}%
+\newlength{\bc@titleLength}%
+\newlength{\logowidth}%
+%
+\setlength{\logowidth}{17pt}%
 \ProcessOptionsX%
 %
-\RequirePackage{graphicx}%
 \ifbclogotikz%
         \RequirePackage{tikz}%
+       \RequirePackage[framemethod=tikz]{mdframed}%mdframed2
         \usetikzlibrary{shadows}% pour l'ombre
-        \usetikzlibrary{decorations.pathmorphing} % pour la barre ondulee
-        \RequirePackage{mdframed}%
-        \def\mdf@style{1}%
-        \input{bclogoMdframedTikz}%
+        \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
         \ifbclogoblur%
                 \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%
-        \RequirePackage{mdframed}%
-        \def\mdf@style{3}%
-        \input{bclogoMdframedPst}%
 \fi%
 \edef\Gin@extensions{.mps,\Gin@extensions}%
 \RequirePackage{ifpdf}%
 % panneau chantier (Jean-Michel Sarlat)
 \newcommand\bcpanchant{\includegraphics[width=\logowidth]{bc-aux-301}}%
 % ours
-%\newcommand\bcours{\begingroup\input{bc-ours.tex}\endgroup}
 \newcommand\bcours{\includegraphics[width=\logowidth]{bc-ours}}%
 % etoile
-%\newcommand\bcetoile{\begingroup\input{bc-etoile.tex}\endgroup}
 \newcommand\bcetoile{\includegraphics[width=\logowidth]{bc-etoile}}%
 % attention
-%\newcommand\bcattention{\begingroup\input{bc-attention.tex}\endgroup}
 \newcommand\bcattention{\includegraphics[width=\logowidth]{bc-attention}}%
 % attention P.Fradin
 \newcommand\bctakecare{\includegraphics[width=\logowidth]{bc-takecare}}%
 \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.125]{\def\bcval@epOmbre{#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]{\def\bcval@couleurOmbre{#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@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}%
+\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}{}%
+avecBarre=true,noborder=false,marge,sousTitre,couleurBord,blur=false,nobreak=false}{}%
 %
 %les differentes commandes de barre verticale a gauche
 %
-\newcommand{\bc@barreline}{%
+\newcommand*{\bc@barreline}{%
 \begin{minipage}{\logowidth}\centering%
 \ifbclogotikz%
 \begin{tikzpicture}%
@@ -196,19 +197,11 @@ avecBarre=true,noborder=false,marge,sousTitre, couleurBord,blur=false}{}%
 \psline[linewidth=\bcval@epBarre,linecolor=\bcval@couleurBarre](0,\bc@invboxh)(0,0)%
 \end{pspicture}%
 \fi%
-\end{minipage}}%
-%
-\newcommand{\bc@barremotif}{%
-\begin{minipage}{\logowidth}\color{\bcval@couleurBarre}\centering%
-\vbox to \bc@invboxh{\cleaders\vbox{\vss \bcval@motifBarre \vss}\vfill}%
-\end{minipage}}%
+\end{minipage}%
+}%
 %
-\newcommand{\bc@barrewave}{%
-\begin{minipage}{\logowidth}\color{\bcval@couleurBarre}\centering%
-\vbox to \bc@invboxh{\cleaders\vbox{\vss $\leftwave\right.$ \vss}\vfill}%
-\end{minipage}}%
 %
-\newcommand{\bc@barresnake}{%
+\newcommand*{\bc@barresnake}{%
 \begin{minipage}{\logowidth}\centering%
 \ifbclogotikz%
 \begin{tikzpicture}[decoration={snake,segment length=2.66\bcval@tailleOndu, amplitude=\bcval@tailleOndu}]%
@@ -219,9 +212,10 @@ avecBarre=true,noborder=false,marge,sousTitre, couleurBord,blur=false}{}%
 \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}}%
+\end{minipage}%
+}%
 %
-\newcommand{\bc@barrezigzag}{%
+\newcommand*{\bc@barrezigzag}{%
 \begin{minipage}{\logowidth}\centering%
 \ifbclogotikz%
 \begin{tikzpicture}[decoration={zigzag,segment length=2.66\bcval@tailleOndu, amplitude=\bcval@tailleOndu}]%
@@ -232,39 +226,135 @@ avecBarre=true,noborder=false,marge,sousTitre, couleurBord,blur=false}{}%
 \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}}%
+\end{minipage}%
+}%
 %
-\newcommand{\bc@barreimageExt}{% l'image est deformee
+\newcommand*{\bc@barreimageExt}{% l'image est deformee
 \begin{minipage}{\logowidth}\centering%
 \includegraphics[width=\logowidth,height=\bc@invboxh]{\bcval@imageBarre}%
-\end{minipage}}%
+\end{minipage}%
+}
 %
-\newcommand{\bc@barreimageClip}{%
+\newcommand*{\bc@barreimageClip}{%
 \begin{minipage}{\logowidth}\centering%
-\includegraphics[viewport=0 0 \logowidth~ \bc@invboxh,%
-clip=true]{\bcval@imageBarre}%
-\end{minipage}}%
+\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}%
-% pour la hauteur de la boite
-\newlength{\bc@invboxh}\newlength{\bc@invboxd}%
-\newlength{\bc@titleLength}%
 %%% precaution JCC
 \newcommand*\bclogotitre{}%
-\newcommand\styleSousTitre[1]{\normalsize \textit{#1}}%
+\newcommand\bcStyleSousTitre[1]{\normalsize \textit{#1}}%
+\newcommand\styleSousTitre[1]{\bcStyleSousTitre{#1}}% pour la compatibilit
 \newcommand\bcStyleTitre[1]{\large \textbf{#1}}%
 %======================= L'environnement =======================================
 %
+\ifbclogotikz%définition 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}{%
+pstrickssetting={blur=\ifbclogoblur true\else false\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}%
+\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\structitre{%
+       \def\bc@structitre{%
             \hfil%
-            \ifbclogotikz% cadreTitre tizk
+            \ifbclogotikz% cadreTitre tikz
             \begin{tikzpicture}%
                 \node[rectangle, thick, top color=red!60!green!40, bottom color=white,draw]{\large #2};%
             \end{tikzpicture}%
@@ -274,7 +364,7 @@ clip=true]{\bcval@imageBarre}%
             \hfil%
         }%
   \else%sinon cadreTitre = false
-      \def\structitre{\bcStyleTitre{#2} \styleSousTitre{\bcval@sousTitre}}%
+      \def\bc@structitre{\bcStyleTitre{#2} \bcStyleSousTitre{\bcval@sousTitre}}%
   \fi%
 %boite logo+titre
 \setlength{\bc@titleLength}{%
@@ -289,28 +379,39 @@ clip=true]{\bcval@imageBarre}%
      &%
        \ifKV@bclogo@cadreTitre%
          \begin{minipage}{\bc@titleLength}%
-                \structitre%
+                \bc@structitre%
          \end{minipage}%
-       \else\structitre\fi%
+       \else\bc@structitre\fi%
    \end{tabular}%
   \end{lrbox}%
 % affichage
-\smallskip% ressort
+\smallskip% ressort %% Pourquoi ? %%%parce que ça se comprime et ça s'étire!
+\def\bcval@nobreak{\ifKV@bclogo@nobreak true\else false\fi}% gestion nobreak
+\def\bcval@shadow{\ifKV@bclogo@ombre true\else false\fi}% gestion ombre
+%
 \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,%
+ rightmargin={\dimexpr\bcval@margeD+\ifKV@bclogo@ombre\bcval@epOmbre cm\else\z@\fi\relax},%
  leftmargin=\bcval@margeG,%
  backgroundcolor=\bcval@couleur,%
  fontcolor=\bcval@couleurTexte,%
- linewidth=\bcval@borderWidth,%
- roundcorner={\bcval@arrondi cm}]%
+ 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%
+]%
 }%
 {%
 \endmdframed\par%
-\ifKV@bclogo@ombre\vspace*{\bcval@epOmbre cm}\else\smallskip\fi%
+\smallskip%
 \goodbreak%
 }%
-
+\endinput%
+%%%%%%%%%%%%%%%% fin %%%%%%%%%%%%%%%%

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.