summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bclogo/bclogo.sty
blob: 34df91222ed37ab21eac2b1ca44c716c59fa1c60 (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
\NeedsTeXFormat{LaTeX2e}
\def\PackageName{bclogo}
\def\fileversion{v2.1}
\def\filedate{2009/04/01}
\ProvidesPackage{bclogo}
   [\filedate\space\fileversion]
\RequirePackage{xkeyval}

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

\newif\iftikz\tikzfalse%
\define@key{bclogo.sty}{pstricks}[]{\tikzfalse}%
\define@key{bclogo.sty}{tikz}[]{\tikztrue}%
\ProcessOptionsX%



\iftikz%
\RequirePackage{tikz}%
\usetikzlibrary{shadows}%
\else%
\RequirePackage{pstricks}%
\RequirePackage{pst-grad}%
\RequirePackage{graphicx}%
\fi%
% les symboles
% ==============================================================================
\iftikz%
% la fleur
\newcommand\bcfleur{\includegraphics[width=17pt]{fleur}}
% une note (Thomas Laburussias)
\newcommand\bcnote{\includegraphics[width=17pt]{note}}
% panneau chantier (Jean-Michel Sarlat)
\newcommand\bcpanchant{\includegraphics[width=17pt]{aux-301}}
% ours
\newcommand\bcours{\includegraphics[width=17pt]{ours}}
% etoile
\newcommand\bcetoile{\includegraphics[width=17pt]{etoile}}
% attention
\newcommand\bcattention{\includegraphics[width=17pt]{attention}}
% attention P.Fradin
\newcommand\bctakecare{\begingroup\input{takecare.pgf}\endgroup}
% lampe P.Fradin
\newcommand\bclampe{\begingroup\input{lampe.pgf}\endgroup}
% coeur
\newcommand\bccoeur{\includegraphics[width=17pt]{coeur}}
% ornement (tire du site http://openclipart.org )
\newcommand\bcorne{\includegraphics[width=17pt]{orne}}
% danger (Francois)
\newcommand\bcdanger{\includegraphics[width=17pt]{danger}}
% smiley bonne humeur (Francois)
\newcommand\bcsmbh{\includegraphics[width=17pt]{smiley_bonnehumeur}}
% smiley bonne humeur (Francois)
\newcommand\bcsmmh{\includegraphics[width=17pt]{smiley_mauvaisehumeur}}
% le trefle
\newcommand\bctrefle{\includegraphics[width=17pt]{trefle}}
% livre P.Fradin
\newcommand\bcbook{\begingroup\input{book.pgf}\endgroup}

\else%pstricks
% la fleur
\newcommand\bcfleur{\begingroup\input{fleur.tex}\endgroup}
% une note (Thomas Laburussias)
\newcommand\bcnote{\begingroup\input{note.tex}\endgroup}
% panneau chantier (Jean-Michel Sarlat)
\newcommand\bcpanchant{\includegraphics[width=17pt]{aux-301.eps}}
% ours
\newcommand\bcours{\begingroup\input{ours.tex}\endgroup}
% etoile
\newcommand\bcetoile{\begingroup\input{etoile.tex}\endgroup}
% attention
\newcommand\bcattention{\begingroup\input{attention.tex}\endgroup}
% attention P.Fradin
\newcommand\bctakecare{\begingroup\input{takecare.pst}\endgroup}
% lampe P.Fradin
\newcommand\bclampe{\begingroup\input{lampe.pst}\endgroup}
% coeur
\newcommand\bccoeur{\begingroup\input{coeur.tex}\endgroup}
% ornement (tire du site http://openclipart.org )
\newcommand\bcorne{\begingroup\input{orne.tex}\endgroup}
% danger (Francois)
\newcommand\bcdanger{\begingroup\input{danger.tex}\endgroup}
% smiley bonne humeur (Francois)
\newcommand\bcsmbh{\begingroup\input{smiley_bonnehumeur.tex}\endgroup}
% smiley bonne humeur (Francois)
\newcommand\bcsmmh{\begingroup\input{smiley_mauvaisehumeur.tex}\endgroup}
% le trefle
\newcommand\bctrefle{\begingroup\input{trefle.tex}\endgroup}
% livre P.Fradin
\newcommand\bcbook{\begingroup\input{book.pst}\endgroup}
\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}}
% ======================================= les keys =============================

\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@boolkey{bclogo}{cadretitre}[true]{}
\define@boolkey{bclogo}{ombre}[true]{}

% selection par defaut
\presetkeys{bclogo}{logo, couleur, arrondi, couleurOmbre, epOmbre, ombre=false, cadretitre=false}{}%

%===============================================================================

\newsavebox{\envbox}
%%% precaution JCC
\newcommand*\bclogotitre{}
\newlength{\pgfframesep}
\setlength{\pgfframesep}{\iftikz3pt\else\psframesep\fi}

\newenvironment*{bclogo}[2][]{%
  \setkeys{bclogo}{#1} %on recupere les options
  \par\noindent % attention au retrait d'alinea
  %%% Ajout de JCC : il faut definir les commandes qui seront
  %%% utilisees dans la deuxieme partie de l'environnement
  %%% commande 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
    \raisebox{-0.0ex}{%
      \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
  \newcommand{\structitre}{\large \textbf{#2}}%
  \fi%
  \begin{lrbox}{\envbox}
    \ifKV@bclogo@ombre % si l'ombre, on reduit pour que ca loge sur la
                       % largeur de la page (-\val@epOmbre)
    \begin{tabular}{@{}c@{}p{\dimexpr\linewidth-2\pgfframesep-4pt-17pt-\val@epOmbre cm}@{}}
    \else
    \begin{tabular}{@{}c@{}p{\dimexpr\linewidth-2\pgfframesep-4pt-17pt}@{}}
    \fi
      \begin{minipage}{20pt}{\val@logo}\end{minipage}&
      \begin{minipage}{\dimexpr\linewidth-2\pgfframesep-4pt-17pt}{\structitre}\end{minipage}\\%[0ex]
      \vrule width 0.05cm&%
}
{%
      \bccaption{\bclogotitre}
    \end{tabular}%
  \end{lrbox}%
  % Affiche le texte dans un cadre en couleur.
  \iftikz% texte 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]{\usebox{\envbox}};
    \else %cadre sans ombre
    \node[fill=\val@couleur,thick, shape=rectangle, inner sep=\pgfframesep,rounded corners=\arr cm, draw]{\usebox{\envbox}};
    \fi
  \end{tikzpicture}
  \par%
  \else% texte pstricks
  \noindent
  \ifKV@bclogo@ombre%cadre ombre
  \rput[tl](-0.21,0){\psframebox[fillstyle=solid, shadow=true, shadowsize=\val@epOmbre cm,%
    shadowcolor=\val@couleurOmbre, fillcolor=\val@couleur,framearc=\arr]{\usebox{\envbox}}}%
  \else%cadre sans ombre
  \rput[tl](-0.21,0){\psframebox[fillstyle=solid, fillcolor=\val@couleur,framearc=\arr]{\usebox{\envbox}}}%
  \fi%
  \par\vspace*{\dimexpr\ht\envbox+\dp\envbox+2\psframesep+2\pslinewidth}
  \fi%fin
  \ifKV@bclogo@ombre\vspace*{\val@epOmbre cm}\fi
}%