summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bclogo/bclogo.sty
blob: 174e321333bfed279272c0e078d9c8ebf71f1b07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
\NeedsTeXFormat{LaTeX2e}
\def\PackageName{bclogo}
\def\fileversion{v2.22}
\def\filedate{2009/15/01}
\ProvidesPackage{bclogo}
   [\filedate\space\fileversion]
\RequirePackage{xkeyval,ifthen}

%% Les options globales du package sont au nombre de 2: tikz ou pstricks

\newif\iftikz%
\define@key{bclogo.sty}{tikz}[]{\tikztrue}%
\define@key{bclogo.sty}{pstricks}[]{\tikzfalse}%
\newlength{\logowidth}\setlength{\logowidth}{17pt}%
\ProcessOptionsX%

\iftikz%
\RequirePackage{tikz}%
\usetikzlibrary{shadows}% pour l'ombre
\usetikzlibrary{decorations.pathmorphing} % pour la barre ondulee
\else%
\RequirePackage{graphicx}%
\RequirePackage{pstricks}%
\RequirePackage{pst-grad}%
\RequirePackage{pst-coil}% pour la barre ondulee
\fi%
% les symboles
% ==============================================================================

% si l'option tikz est chargee
\iftikz%
% la fleur
\newcommand\bcfleur{\includegraphics[width=\logowidth]{bc-fleur}}
% une note (Thomas Labarussias)
\newcommand\bcnote{\includegraphics[width=\logowidth]{bc-note}}
% panneau chantier (Jean-Michel Sarlat)
\newcommand\bcpanchant{\includegraphics[width=\logowidth]{bc-aux-301}}
% ours
\newcommand\bcours{\includegraphics[width=\logowidth]{bc-ours}}
% etoile
\newcommand\bcetoile{\includegraphics[width=\logowidth]{bc-etoile}}
% attention
\newcommand\bcattention{\includegraphics[width=\logowidth]{bc-attention}}
% attention P.Fradin
\newcommand\bctakecare{\begingroup\input{bc-takecare.pgf}\endgroup}
% lampe P.Fradin
\newcommand\bclampe{\begingroup\input{bc-lampe.pgf}\endgroup}
% coeur
\newcommand\bccoeur{\includegraphics[width=\logowidth]{bc-coeur}}
% ornement (tire du site http://openclipart.org )
\newcommand\bcorne{\includegraphics[width=\logowidth]{bc-orne}}
% danger (Francois)
\newcommand\bcdanger{\includegraphics[width=\logowidth]{bc-danger}}
% smiley bonne humeur (Francois)
\newcommand\bcsmbh{\includegraphics[width=\logowidth]{bc-smiley_bonnehumeur}}
% smiley bonne humeur (Francois)
\newcommand\bcsmmh{\includegraphics[width=\logowidth]{bc-smiley_mauvaisehumeur}}
% le trefle
\newcommand\bctrefle{\includegraphics[width=\logowidth]{bc-trefle}}
% le livre
\newcommand\bcbook{\begingroup\input{bc-book.pgf}\endgroup}
% point d'interrogation
\newcommand\bcquestion{\includegraphics[width=\logowidth]{bc-inter}}
% crayon anne-sophie philippe
\newcommand\bccrayon{\includegraphics[width=\logowidth]{bc-crayon}}
% le pic LaTeX
\newcommand\bcspadesuit{\centering \huge $\spadesuit$}


% si l'option pstricks (par defaut)
\else
% la fleur
\newcommand\bcfleur{\begingroup\input{bc-fleur.tex}\endgroup}
% une note (Thomas Labarussias)
\newcommand\bcnote{\begingroup\input{bc-note.tex}\endgroup}
% panneau chantier (Jean-Michel Sarlat)
\newcommand\bcpanchant{\includegraphics[width=\logowidth]{bc-aux-301.eps}}
% ours
\newcommand\bcours{\begingroup\input{bc-ours.tex}\endgroup}
% etoile
\newcommand\bcetoile{\begingroup\input{bc-etoile.tex}\endgroup}
% attention
\newcommand\bcattention{\begingroup\input{bc-attention.tex}\endgroup}
% attention P.Fradin
\newcommand\bctakecare{\begingroup\input{bc-takecare.pst}\endgroup}
% lampe P.Fradin
\newcommand\bclampe{\begingroup\input{bc-lampe.pst}\endgroup}
% coeur
\newcommand\bccoeur{\begingroup\input{bc-coeur.tex}\endgroup}
% ornement (tire du site http://openclipart.org )
\newcommand\bcorne{\begingroup\input{bc-orne.tex}\endgroup}
% danger (Francois)
\newcommand\bcdanger{\begingroup\input{bc-danger.tex}\endgroup}
% smiley bonne humeur (Francois)
\newcommand\bcsmbh{\begingroup\input{bc-smiley_bonnehumeur.tex}\endgroup}
% smiley bonne humeur (Francois)
\newcommand\bcsmmh{\begingroup\input{bc-smiley_mauvaisehumeur.tex}\endgroup}
% le trefle
\newcommand\bctrefle{\begingroup\input{bc-trefle.tex}\endgroup}
% le livre
\newcommand\bcbook{\begingroup\input{bc-book.pst}\endgroup}
% point d'interrogation
\newcommand\bcquestion{\begingroup\input{bc-inter.tex}\endgroup}
% crayon anne-sophie philippe
\newcommand\bccrayon{\begingroup\input{bc-crayon.tex}\endgroup}
% le pic LaTeX
\newcommand\bcspadesuit{\centering \huge $\spadesuit$}

\fi


% =========================== La fonction listable =============================

\newcommand{\titrebclogo}{Liste des \texttt{bclogo}}
\newcommand\bccaption[1]{\addcontentsline{bcl}{bclogo}{#1}}
\newcommand\listofbclogo{\section*{\titrebclogo}\@starttoc{bcl}}
\newcommand\l@bclogo[2]{\par\noindent #1,~\textit{page~#2}}
\newcounter{bclogocompteur} % idee de Francois Petiard

% ======================================= les keys =============================

\newlength{\val@epBarre} % on definit une longueur : l'epaisseur de la barre
\newlength{\val@tailleOndu} % on definit une longueur : taille d'une ondulation
\define@key{bclogo}{logo}[\bcfleur]{\def\val@logo{#1}}
\define@key{bclogo}{couleur}[white]{\def\val@couleur{#1}}
\define@key{bclogo}{arrondi}[0]{\def\val@arrondi{#1}}
\define@key{bclogo}{epOmbre}[0.125]{\def\val@epOmbre{#1}}
\define@key{bclogo}{arrondi}[0]{\def\val@arrondi{#1}}
\define@key{bclogo}{couleurOmbre}[black]{\def\val@couleurOmbre{#1}}
\define@key{bclogo}{couleurBarre}[black]{\def\val@couleurBarre{#1}}
\define@key{bclogo}{imageBarre}[]{\def\val@imageBarre{#1}}
\define@key{bclogo}{motifBarre}[*]{\def\val@motifBarre{#1}}
\define@key{bclogo}{epBarre}[1.5]{\setlength{\val@epBarre}{#1 pt}}
\define@key{bclogo}{tailleOndu}[2.5]{\setlength{\val@tailleOndu}{#1 pt}}
\define@boolkey{bclogo}{cadreTitre}[true]{}
\define@boolkey{bclogo}{noborder}[true]{}
\define@boolkey{bclogo}{ombre}[true]{}
\define@boolkey{bclogo}{avecBarre}[true]{} 
\define@choicekey{bclogo}{barre}{none,line,snake,motif,zigzag,imageExt,imageClip}[line]{%
\ifthenelse{\equal{#1}{none}}{\KV@bclogo@avecBarrefalse}%
{\def\bc@barre{\@nameuse{bc@barre#1}}}%
}%



% selection par defaut
\presetkeys{bclogo}{logo,barre,couleur,arrondi,couleurOmbre,couleurBarre,epOmbre,epBarre,tailleOndu,ombre=false,cadreTitre=false, avecBarre = true,noborder=false}{}%

% les differente commande de barre vertical a gauche

\newcommand{\bc@barreline}{\color{\val@couleurBarre}\vrule width \val@epBarre}%

\newcommand{\bc@barremotif}{%
\begin{minipage}{\logowidth}\color{\val@couleurBarre}\centering%
\vbox to \invboxh{\cleaders\vbox{\vss \val@motifBarre \vss}\vfill}% 
\end{minipage}}


\newcommand{\bc@barresnake}{%
\begin{minipage}{\logowidth}\centering
\iftikz
\begin{tikzpicture}[decoration={snake,segment length=2.66\val@tailleOndu, amplitude=\val@tailleOndu}]
\draw[decorate,line width=1pt, color=\val@couleurBarre](0,\invboxh)--(0,0);\end{tikzpicture}%
\else
\psset{unit=1pt}
\begin{pspicture}(0,0)(0,\invboxh)
\pszigzag[coilarm=0pt,coilwidth=2\val@tailleOndu,linewidth=1pt, linearc=1pt,coilheight=1.33,linecolor=\val@couleurBarre](0,\invboxh)(0,0)
\end{pspicture}%
\fi
\end{minipage}}%

\newcommand{\bc@barrezigzag}{%
\begin{minipage}{\logowidth}\centering
\iftikz
\begin{tikzpicture}[decoration={zigzag,segment length=2.66\val@tailleOndu, amplitude=\val@tailleOndu}]
\draw[decorate,line width=1pt,color=\val@couleurBarre](0,\invboxh)--(0,0);\end{tikzpicture}%
\else
\psset{unit=1pt}
\begin{pspicture}(0,0)(0,\invboxh)
\pszigzag[coilarm=0pt,coilwidth=2\val@tailleOndu,linewidth=1pt,coilheight=1.33,linecolor=\val@couleurBarre](0,\invboxh)(0,0)
\end{pspicture}%
\fi
\end{minipage}}%

\newcommand{\bc@barreimageExt}{% l'image est deformee
\begin{minipage}{\logowidth}\centering
\includegraphics[width=\logowidth,height=\invboxh]{\val@imageBarre}
\end{minipage}
}%

\newcommand{\bc@barreimageClip}{%
\begin{minipage}{\logowidth}\centering
\includegraphics[viewport=0 0 \logowidth~ \invboxh,%
clip=true]{\val@imageBarre}%
\end{minipage}
}%


%======================= Quelques definitions===================================
% boite globale
\newsavebox{\envbox}
% boite interieure la ligne 2 du tableau barre + texte
\newsavebox{\invbox}
% pour la hauteur de la boite
\newlength{\invboxh}\newlength{\invboxd}
%%% precaution JCC
\newcommand*\bclogotitre{}
\newlength{\pgfframesep}
\setlength{\pgfframesep}{\iftikz3pt\else\psframesep\fi}

%======================= L'environnement =======================================

\newenvironment*{bclogo}[2][]{%
  \setkeys{bclogo}{#1}%on recupere les options
  \par\noindent% attention au retrait d'alinea
  % on definit les commandes qui seront utilisees dans la seconde
  % parti de l'environnement
  % la commande pour le titre
  \renewcommand*\bclogotitre{#2}
  % La commande pour les coins arrondis
  \newcommand{\arr}{\val@arrondi}
  % deux types de titres
  \ifKV@bclogo@cadreTitre% si cadreTitre = true
  \newcommand{\structitre}{%
    \iftikz% cadreTitre tizk
    \hfil
    \begin{tikzpicture}\node[rectangle, thick, top color=red!60!green!40, bottom color=white,draw]{\large #2};
    \end{tikzpicture}%
    \hfil%
    \else% cadreTitre pstricks
    \hfil
    \psframebox[fillstyle=gradient,gradmidpoint=0.2, gradangle=0,gradbegin=red!60!green!40, gradend=white]{\large  #2}%
    \hfil%
    \fi%
  }
  \else %sinon cadreTitre = false
  \newcommand{\structitre}{\large \textbf{#2}}%
  \fi%
  \begin{lrbox}{\invbox}%
\begin{minipage}{\dimexpr\linewidth-2\pgfframesep-4pt-\logowidth-\ifKV@bclogo@ombre\val@epOmbre cm\else0pt\fi\relax}%
}%
{%
\end{minipage}%
\end{lrbox}%

% calcul de la hauteur totale de la boite intéreure
\settoheight{\invboxh}{\usebox{\invbox}}%
\settodepth{\invboxd}{\usebox{\invbox}}%
\addtolength{\invboxh}{\invboxd}%

  % on commence la boite interieur ou est le texte et la barre vertical
  \begin{lrbox}{\envbox}%
   \begin{tabular}{@{}c@{}p{\dimexpr\linewidth-2
\pgfframesep-4pt-\logowidth-\ifKV@bclogo@ombre\val@epOmbre cm\else0pt
\fi}@{}}
   \begin{minipage}{\logowidth}{\refstepcounter{bclogocompteur}\bccaption{\bclogotitre}\val@logo}\end{minipage}&%
   \ifKV@bclogo@cadreTitre%
   \begin{minipage}{\dimexpr\linewidth-2
       \pgfframesep-4pt-\logowidth-\ifKV@bclogo@ombre\val@epOmbre cm\else0pt
       \fi}{\structitre}\end{minipage}%
   \else\structitre\fi\\%
   \ifKV@bclogo@avecBarre% si il y a une barre verticale
   \bc@barre&\usebox{\invbox}%
   \else% sinon
   \multicolumn{2}{c}{\usebox{\invbox}}%
   \fi%
   \end{tabular}%
  \end{lrbox}%

% Affiche l'ensemble dans un cadre en couleur.
  \iftikz% tikz
  \par\noindent
  \begin{tikzpicture}%
    \ifKV@bclogo@ombre%cadre ombre
    \node[fill=\val@couleur,thick, shape=rectangle, inner sep=\pgfframesep, rounded corners=\arr cm,%
    general shadow={fill=\val@couleurOmbre},shadow xshift=\val@epOmbre cm, shadow yshift=-\val@epOmbre cm, draw=\ifKV@bclogo@noborder none\else black\fi]{\usebox{\envbox}};
    \else%cadre sans ombre
    \node[fill=\val@couleur,thick, shape=rectangle, inner sep=\pgfframesep,rounded corners=\arr cm, draw=\ifKV@bclogo@noborder none\else black\fi]{\usebox{\envbox}};
    \fi
  \end{tikzpicture}
  \par%
  \else%  pstricks
  \noindent
  \ifKV@bclogo@ombre%cadre ombre
  \psframebox[cornersize=absolute,linearc=\dimexpr\arr cm * 2,fillstyle=solid, shadow=true, shadowsize=\val@epOmbre cm,%
    shadowcolor=\val@couleurOmbre, fillcolor=\val@couleur,linestyle=\ifKV@bclogo@noborder none\else solid\fi]{\usebox{\envbox}}
  \else%cadre sans ombre
  \psframebox[cornersize=absolute,linearc=\dimexpr\arr cm * 2  ,fillstyle=solid, fillcolor=\val@couleur,linestyle=\ifKV@bclogo@noborder none\else solid\fi]{\usebox{\envbox}}
  \fi%
  \par\vspace*{0.2cm}
  \fi%fin
  \ifKV@bclogo@ombre\vspace*{\val@epOmbre cm}\fi
}%