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

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.