1 \NeedsTeXFormat{LaTeX2e}%
2 \def\PackageName{bclogo}%
3 \def\fileversion{v3.0}%
4 \def\filedate{2011/10/01}%
5 \ProvidesPackage{bclogo}[\filedate\space\fileversion]%
8 \RequirePackage{xkeyval,ifthen}%
9 \RequirePackage{graphicx}%
10 \RequirePackage{mdframed}%
11 \ifdef{\ifmdf@nobreak}{\relax}{\define@key{mdf}{nobreak}[]{}}%
12 %l'option nobreak de mdframed vient qu'avec la version 0.9
14 %% Les options globales du package sont au nombre de 2: tikz ou pstricks
17 \define@key{bclogo.sty}{tikz}[]{\bclogotikztrue}%
18 \define@key{bclogo.sty}{pstricks}[]{\bclogotikzfalse}%
19 \define@key{bclogo.sty}{blur}[]{\bclogoblurtrue}%
22 \newlength{\bc@invboxh}\newlength{\bc@invboxd}%
23 \newlength{\bc@titleLength}%
24 \newlength{\logowidth}%
25 \newlength{\bc@mdfboxwidth}%
26 \newlength{\bc@mdfboxheight}%
27 %\newlength{\bc@mdf@ymargin@length}
29 \setlength{\logowidth}{17pt}%
33 \RequirePackage{tikz}%
34 \usetikzlibrary{shadows}% pour l'ombre
35 \usetikzlibrary{decorations.pathmorphing}% pour la barre ondulee
36 \def\bc@mdf@style{1}%pour la version 0.6
37 \input{bclogoMdframedTikz}%redefinition des macros d'affichage
39 \RequirePackage{pstricks}%
40 \RequirePackage{pst-grad}%
41 \RequirePackage{pst-coil}% pour la barre ondulee
43 \RequirePackage{pst-blur}%
44 \let\pagecolorOLD\pagecolor% modification pour sauvegarde de la couleur du fond
45 \def\pagecolor#1{\gdef\psx@blurbg{#1}\pagecolorOLD{#1}}%suppose l'utilisation: \pagecolor{couleur}
47 \def\bc@mdf@style{3}%%pour la version 0.6
48 \input{bclogoMdframedPst}%redefinition des macros d'affichage
50 \edef\Gin@extensions{.mps,\Gin@extensions}%
51 \RequirePackage{ifpdf}%
52 \ifpdf\relax\else\DeclareGraphicsRule{mps}{eps}{*}{}\fi%
55 % ==============================================================================
57 \newcommand\bcfleur{\includegraphics[width=\logowidth]{bc-fleur}}%
58 % une note (Thomas Labarussias)
59 \newcommand\bcnote{\includegraphics[width=\logowidth]{bc-note}}%
60 % panneau chantier (Jean-Michel Sarlat)
61 \newcommand\bcpanchant{\includegraphics[width=\logowidth]{bc-aux-301}}%
63 %\newcommand\bcours{\begingroup\input{bc-ours.tex}\endgroup}
64 \newcommand\bcours{\includegraphics[width=\logowidth]{bc-ours}}%
66 %\newcommand\bcetoile{\begingroup\input{bc-etoile.tex}\endgroup}
67 \newcommand\bcetoile{\includegraphics[width=\logowidth]{bc-etoile}}%
69 %\newcommand\bcattention{\begingroup\input{bc-attention.tex}\endgroup}
70 \newcommand\bcattention{\includegraphics[width=\logowidth]{bc-attention}}%
72 \newcommand\bctakecare{\includegraphics[width=\logowidth]{bc-takecare}}%
74 \newcommand\bclampe{\includegraphics[width=\logowidth]{bc-lampe}}%
76 \newcommand\bccoeur{\includegraphics[width=\logowidth]{bc-coeur}}%
77 % ornement (tire du site http://openclipart.org )
78 \newcommand\bcorne{\includegraphics[width=\logowidth]{bc-orne}}%
80 \newcommand\bcdanger{\includegraphics[width=\logowidth]{bc-danger}}%
81 % smiley bonne humeur (Francois)
82 \newcommand\bcsmbh{\includegraphics[width=\logowidth]{bc-smiley-bonnehumeur}}%
83 % smiley bonne humeur (Francois)
84 \newcommand\bcsmmh{\includegraphics[width=\logowidth]{bc-smiley-mauvaisehumeur}}%
86 \newcommand\bctrefle{\includegraphics[width=\logowidth]{bc-trefle}}%
88 \newcommand\bcbook{\includegraphics[width=\logowidth]{bc-book}}%
89 % point d'interrogation
90 \newcommand\bcquestion{\includegraphics[width=\logowidth]{bc-inter}}%
91 % crayon anne-sophie philippe
92 \newcommand\bccrayon{\includegraphics[width=\logowidth]{bc-crayon}}%
93 % info (thomas labarrussias)
94 \newcommand\bcinfo{\includegraphics[width=\logowidth]{bc-info}}%
96 \newcommand\bcplume{\includegraphics[width=\logowidth]{bc-plume}}%
98 \newcommand\bcspadesuit{{\centering \huge $\spadesuit$}}%
99 % logos Alphonse Capriani
100 \newcommand\bcbombe{\includegraphics[width=\logowidth]{bc-bombe}}%
101 \newcommand\bccube{\includegraphics[width=\logowidth]{bc-cube}}%
102 \newcommand\bcdallemagne{\includegraphics[width=\logowidth]{bc-dallemagne}}%
103 \newcommand\bcdautriche{\includegraphics[width=\logowidth]{bc-dautriche}}%
104 \newcommand\bcdbelgique{\includegraphics[width=\logowidth]{bc-dbelgique}}%
105 \newcommand\bcdbulgarie{\includegraphics[width=\logowidth]{bc-dbulgarie}}%
106 \newcommand\bcdfrance{\includegraphics[width=\logowidth]{bc-dfrance}}%
107 \newcommand\bcditalie{\includegraphics[width=\logowidth]{bc-ditalie}}%
108 \newcommand\bcdluxembourg{\includegraphics[width=\logowidth]{bc-dluxembourg}}%
109 \newcommand\bcdpaysbas{\includegraphics[width=\logowidth]{bc-dpaysbas}}%
110 \newcommand\bcdodecaedre{\includegraphics[width=\logowidth]{bc-dodecaedre}}%
111 \newcommand\bceclaircie{\includegraphics[width=\logowidth]{bc-eclaircie}}%
112 \newcommand\bcicosaedre{\includegraphics[width=\logowidth]{bc-icosaedre}}%
113 \newcommand\bcinterdit{\includegraphics[width=\logowidth]{bc-interdit}}%
114 \newcommand\bcneige{\includegraphics[width=\logowidth]{bc-neige}}%
115 \newcommand\bcoctaedre{\includegraphics[width=\logowidth]{bc-octaedre}}%
116 \newcommand\bcpluie{\includegraphics[width=\logowidth]{bc-pluie}}%
117 \newcommand\bcpoisson{\includegraphics[width=\logowidth]{bc-poisson}}%
118 \newcommand\bcsoleil{\includegraphics[width=\logowidth]{bc-soleil}}%
119 \newcommand\bcstop{\includegraphics[width=\logowidth]{bc-stop}}%
120 \newcommand\bctetraedre{\includegraphics[width=\logowidth]{bc-tetraedre}}%
121 \newcommand\bccalendrier{\includegraphics[width=\logowidth]{bc-calendrier}}%
122 \newcommand\bchorloge{\includegraphics[width=\logowidth]{bc-horloge}}%
123 \newcommand\bcyin{\includegraphics[width=\logowidth]{bc-yin}}%
124 \newcommand\bcrosevents{\includegraphics[width=\logowidth]{bc-rosevents}}%
126 % Vincent Pantaloni route glissante
127 \newcommand\bcdz{\includegraphics[width=\logowidth]{bc-dz}}%
129 \newcommand\bcvelo{\includegraphics[width=\logowidth]{bc-velo}}%
130 \newcommand\bcoeil{\includegraphics[width=\logowidth]{bc-oeil}}%
131 \newcommand\bcpeaceandlove{\includegraphics[width=\logowidth]{bc-peaceandlove}}%
132 \newcommand\bcnucleaire{\includegraphics[width=\logowidth]{bc-nucleaire}}%
133 \newcommand\bcfemme{\includegraphics[width=\logowidth]{bc-femme}}%
134 \newcommand\bchomme{\includegraphics[width=\logowidth]{bc-homme}}%
135 \newcommand\bcloupe{\includegraphics[width=\logowidth]{bc-loupe}}%
136 \newcommand\bcrecyclage{\includegraphics[width=\logowidth]{bc-recyclage}}%
137 \newcommand\bcvaletcoeur{\includegraphics[width=\logowidth]{bc-valetcoeur}}%
138 \newcommand\bccle{\includegraphics[width=\logowidth]{bc-cle}}%
139 \newcommand\bcclefa{\includegraphics[width=\logowidth]{bc-clefa}}%
140 \newcommand\bcclesol{\includegraphics[width=\logowidth]{bc-clesol}}%
141 \newcommand\bcfeujaune{\includegraphics[width=\logowidth]{bc-feujaune}}%
142 \newcommand\bcfeurouge{\includegraphics[width=\logowidth]{bc-feurouge}}%
143 \newcommand\bcfeutricolore{\includegraphics[width=\logowidth]{bc-feutricolore}}%
144 \newcommand\bcfeuvert{\includegraphics[width=\logowidth]{bc-feuvert}}%
145 \newcommand\bcoutil{\includegraphics[width=\logowidth]{bc-outil}}%
146 \newcommand\bctrombone{\includegraphics[width=\logowidth]{bc-trombone}}%
148 % =========================== La fonction listable =============================
150 \newcommand{\titrebclogo}{Liste des \texttt{bclogo}}%
151 \newcommand\bccaption[1]{\addcontentsline{bcl}{bclogo}{#1}}%
152 \newcommand\listofbclogo{\section*{\titrebclogo}\@starttoc{bcl}}%
153 \newcommand\l@bclogo[2]{\par\noindent #1,~\textit{page~#2}}%
154 \newcounter{bclogocompteur} % idee de Francois Petiard
156 % ======================================= les keys =============================
158 \newlength{\bcval@epBarre}% on definit une longueur : l'epaisseur de la barre en point
159 \newlength{\bcval@framesep}% on definit une longueur : l'epaisseur de la marge en point
160 \newlength{\bcval@tailleOndu}% on definit une longueur : taille d'une ondulation
161 \newlength{\bcval@borderWidth}% on definit une longueur : epaisseur du bord
162 \newlength{\bcval@margeG}% on definit une longueur : marge gauche avant la boîte
163 \newlength{\bcval@margeD}% on definit une longueur : marge droite après la boîte
164 \define@key{bclogo}{logo}[\bcfleur]{\def\bcval@logo{#1}}%
165 \define@key{bclogo}{couleur}[white]{\def\bcval@couleur{#1}}%
166 \define@key{bclogo}{arrondi}[0]{\def\bcval@arrondi{#1}}%
167 \define@key{bclogo}{epOmbre}[0.125]{\def\bcval@epOmbre{#1}}%
168 \define@key{bclogo}{arrondi}[0]{\def\bcval@arrondi{#1}}%
169 \define@key{bclogo}{couleurOmbre}[black]{\def\bcval@couleurOmbre{#1}}%
170 \define@key{bclogo}{couleurBarre}[black]{\def\bcval@couleurBarre{#1}}%
171 \define@key{bclogo}{couleurBord}[black]{\def\bcval@couleurBord{#1}}% modification Philippe Fortemps
172 \define@key{bclogo}{couleurTexte}[black]{\def\bcval@couleurTexte{#1}}%
173 \define@key{bclogo}{imageBarre}[]{\def\bcval@imageBarre{#1}}%
174 \define@key{bclogo}{motifBarre}[*]{\def\bcval@motifBarre{#1}}%
175 \define@key{bclogo}{marge}[4]{\setlength{\bcval@framesep}{#1 pt}}%
176 \define@key{bclogo}{margeG}[0]{\setlength{\bcval@margeG}{#1 cm}}%
177 \define@key{bclogo}{margeD}[0]{\setlength{\bcval@margeD}{#1 cm}}%
178 \define@key{bclogo}{sousTitre}[]{\def\bcval@sousTitre{#1}}%
179 \define@key{bclogo}{epBarre}[1.5]{\setlength{\bcval@epBarre}{#1 pt}}%
180 \define@key{bclogo}{epBord}[0.8]{\setlength{\bcval@borderWidth}{#1 pt}%
181 \ifdimgreater{\bcval@borderWidth}{\z@}{\KV@bclogo@noborderfalse}{\KV@bclogo@nobordertrue}%
183 \define@key{bclogo}{tailleOndu}[2.5]{\setlength{\bcval@tailleOndu}{#1 pt}}%
184 \define@boolkey{bclogo}{cadreTitre}[true]{}%
185 \define@boolkey{bclogo}{noborder}[true]{\ifKV@bclogo@noborder\setlength{\bcval@borderWidth}{\z@}\fi}%
186 \define@boolkey{bclogo}{ombre}[true]{}%
187 \define@boolkey{bclogo}{avecBarre}[true]{}%
188 \define@boolkey{bclogo}{nobreak}[true]{}%
189 \define@boolkey{bclogo}{blur}[true]{\ifKV@bclogo@blur\KV@bclogo@ombretrue\fi}%
190 \define@choicekey{bclogo}{barre}{none,line,snake,motif,zigzag,imageExt,imageClip, wave}[line]{%
191 \ifthenelse{\equal{#1}{none}}{\KV@bclogo@avecBarrefalse\gdef\bc@barre{}}%
192 {\gdef\bc@barre{\ifKV@bclogo@avecBarre\@nameuse{bc@barre#1}\fi}}%
195 % selection par defaut
196 \presetkeys{bclogo}{logo,barre,couleur,arrondi,couleurOmbre,couleurTexte,couleurBarre,epOmbre,epBarre,epBord,tailleOndu,ombre=false,cadreTitre=false,%
197 avecBarre=true,noborder=false,marge,sousTitre, couleurBord,blur=false, nobreak=false}{}%
199 %les differentes commandes de barre verticale a gauche
201 \newcommand{\bc@barreline}{%
202 \begin{minipage}{\logowidth}\centering%
205 \draw[line width=\bcval@epBarre,line cap=butt,color=\bcval@couleurBarre](0,\bc@invboxh)--(0,0);\end{tikzpicture}%
208 \begin{pspicture}(0,0)(0,\bc@invboxh)%
209 \psline[linewidth=\bcval@epBarre,linecolor=\bcval@couleurBarre](0,\bc@invboxh)(0,0)%
214 \newcommand{\bc@barremotif}{%
215 \begin{minipage}{\logowidth}\color{\bcval@couleurBarre}\centering%
216 \vbox to \bc@invboxh{\cleaders\vbox{\vss \bcval@motifBarre \vss}\vfill}%
219 \newcommand{\bc@barrewave}{%
220 \begin{minipage}{\logowidth}\color{\bcval@couleurBarre}\centering%
221 \vbox to \bc@invboxh{\cleaders\vbox{\vss $\leftwave\right.$ \vss}\vfill}%
224 \newcommand{\bc@barresnake}{%
225 \begin{minipage}{\logowidth}\centering%
227 \begin{tikzpicture}[decoration={snake,segment length=2.66\bcval@tailleOndu, amplitude=\bcval@tailleOndu}]%
228 \draw[decorate,line width=1pt, color=\bcval@couleurBarre](0,\bc@invboxh)--(0,0);\end{tikzpicture}%
231 \begin{pspicture}(0,0)(0,\bc@invboxh)%
232 \pszigzag[coilarm=0pt,coilwidth=2\bcval@tailleOndu,linewidth=1pt,linearc=1pt,coilheight=1.33,linecolor=\bcval@couleurBarre](0,\bc@invboxh)(0,0)%
237 \newcommand{\bc@barrezigzag}{%
238 \begin{minipage}{\logowidth}\centering%
240 \begin{tikzpicture}[decoration={zigzag,segment length=2.66\bcval@tailleOndu, amplitude=\bcval@tailleOndu}]%
241 \draw[decorate,line width=1pt,color=\bcval@couleurBarre](0,\bc@invboxh)--(0,0);\end{tikzpicture}%
244 \begin{pspicture}(0,0)(0,\bc@invboxh)%
245 \pszigzag[coilarm=0pt,coilwidth=2\bcval@tailleOndu,linewidth=1pt,linearc=0pt,coilheight=1.33,linecolor=\bcval@couleurBarre](0,\bc@invboxh)(0,0)%
250 \newcommand{\bc@barreimageExt}{% l'image est deformee
251 \begin{minipage}{\logowidth}\centering%
252 \includegraphics[width=\logowidth,height=\bc@invboxh]{\bcval@imageBarre}%
255 \newcommand{\bc@barreimageClip}{%
256 \begin{minipage}{\logowidth}\centering%
257 \includegraphics[viewport=0 0 \logowidth~ \bc@invboxh,%
258 clip=true]{\bcval@imageBarre}%
261 %======================= Quelques definitions===================================
263 \newsavebox{\bc@envbox}%
265 \newcommand*\bclogotitre{}%
266 \newcommand\bcStyleSousTitre[1]{\normalsize \textit{#1}}%
267 \newcommand\styleSousTitre[1]{\bcStyleSousTitre{#1}}% pour la compatibilit
268 \newcommand\bcStyleTitre[1]{\large \textbf{#1}}%
269 %======================= L'environnement =======================================
271 \newenvironment*{bclogo}[2][]{%
272 \setkeys{bclogo}{#1}%options
273 \renewcommand*\bclogotitre{#2}%
274 % deux types de titres
275 \ifKV@bclogo@cadreTitre% si cadreTitre = true
278 \ifbclogotikz% cadreTitre tikz
280 \node[rectangle, thick, top color=red!60!green!40, bottom color=white,draw]{\large #2};%
282 \else% cadreTitre pstricks
283 \psframebox[fillstyle=gradient,gradmidpoint=0.2, gradangle=0,gradbegin=red!60!green!40, gradend=white]{\large #2}%
287 \else%sinon cadreTitre = false
288 \def\bc@structitre{\bcStyleTitre{#2} \bcStyleSousTitre{\bcval@sousTitre}}%
291 \setlength{\bc@titleLength}{%
292 \dimexpr\linewidth-\bcval@margeD-\bcval@margeG-1.5\bcval@framesep-\ifKV@bclogo@noborder\z@\else2\bcval@borderWidth\fi-%
293 \logowidth-\ifKV@bclogo@ombre\bcval@epOmbre cm\else\z@\fi\relax}%
295 \begin{lrbox}{\bc@envbox}% boite titre
296 \begin{tabular}{@{}c@{}p{\bc@titleLength}@{}}%
297 \begin{minipage}{\logowidth}%
298 \refstepcounter{bclogocompteur}\bccaption{\bclogotitre}\bcval@logo%
301 \ifKV@bclogo@cadreTitre%
302 \begin{minipage}{\bc@titleLength}%
305 \else\bc@structitre\fi%
309 \smallskip% ressort %% Pourquoi ? %%%parce que ça se comprime et ça s'étire!
310 \def\bcval@nobreak{\ifKV@bclogo@nobreak true\else false\fi}% gestion nobreak
312 innerleftmargin={\dimexpr\ifKV@bclogo@avecBarre\logowidth\else\z@\fi+\bcval@framesep\relax},%
313 innertopmargin={\dimexpr\ht\bc@envbox+\dp\bc@envbox+\bcval@framesep\relax},%hauteur titre+framesep
314 innerrightmargin=\bcval@framesep,%
315 innerbottommargin=\bcval@framesep,%
316 rightmargin=\dimexpr\bcval@margeD+\ifKV@bclogo@ombre\bcval@epOmbre cm\else\z@\fi,%
317 leftmargin=\bcval@margeG,%
318 backgroundcolor=\bcval@couleur,%
319 fontcolor=\bcval@couleurTexte,%
320 linewidth=\bcval@borderWidth,%
321 roundcorner={\bcval@arrondi cm},%
322 nobreak=\bcval@nobreak%%l'option nobreak de mdframed vient avec la version 0.9
327 \ifKV@bclogo@ombre\vspace*{\bcval@epOmbre cm}\else\smallskip\fi%
330 \setkeys{bclogo}{barre=none}%% en cas d'utlisation de l'environnement mdframed