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

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.