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