Utilisation de mdframed pour couper les boites
[bclogo.git] / dev / latex / bclogoMdframedTikz.tex
1 % This is a part of bclogo.sty v2.27
2 %% This file is loaded by bclogo when tikz is used
3 %% It is a modification of md-frame-1.mdf file, from mdframed package
4 %% This file may be distributed under the terms of the LaTeX Project
5 %% Public License, as described in lppl.txt in the base LaTeX distribution.
6 %% Either version 1.0 or, at your option, any later version.
7 %
8 \def\bc@tikzBlur{%ombre avec un semblant d'effet blur...
9 [preaction={fill=\bcval@couleurOmbre,line width=5,line join=round,opacity=0.1,draw=\bcval@couleurOmbre,%
10 transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
11 preaction={fill=\bcval@couleurOmbre,line width=4,line join=round,opacity=0.15,draw=\bcval@couleurOmbre,%
12 transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
13 preaction={fill=\bcval@couleurOmbre,line width=3,line join=round,opacity=0.2,draw=\bcval@couleurOmbre,%
14 transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
15 preaction={fill=\bcval@couleurOmbre,line width=2,line join=round,opacity=0.3,draw=\bcval@couleurOmbre,%
16 transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
17 preaction={fill=\bcval@couleurOmbre,line width=1,line join=round,opacity=0.4,draw=\bcval@couleurOmbre,%
18 transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
19 preaction={fill=\bcval@couleurOmbre,line width=0.5,line join=round,opacity=0.4,draw=\bcval@couleurOmbre,%
20 transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}}]%
21 }%
22 \def\bc@tikzOmbre{%ombre sans blur
23 [preaction={opacity=0.6,fill=\bcval@couleurOmbre,transform canvas={xshift=\bcval@epOmbre cm,yshift=-\bcval@epOmbre cm}}]%
24 }%
25 %
26 \def\md@tikz@settings{%
27 \ifdimequal{\mdf@middlelinewidth@length}{\z@}%
28 {\ifdimequal{\mdf@innerlinewidth@length}{\z@}%
29 {\ifdimequal{\mdf@outerlinewidth@length}{\z@}%
30 {\let\mdf@middlelinecolor\mdf@backgroundcolor}%
31 {\let\mdf@middlelinecolor\mdf@outerlinecolor}%
32 }%
33 {\let\mdf@middlelinecolor\mdf@innerlinecolor}%
34 }{}%
35 \ifdimequal{\mdf@innerlinewidth@length}{\z@}%
36 {\ifdimequal{\mdf@outerlinewidth@length}{\z@}%
37 {\ifdimequal{\mdf@middlelinewidth@length}{\z@}%
38 {}%
39 {\let\mdf@middlelinecolor\mdf@linecolor}%
40 }%
41 {}%
42 }{}%
43 \tikzset{mdftext/.style={inner sep=0pt,outer sep=0pt}}%
44 \tikzset{mdfcorners/.style={rounded corners=\mdf@roundcorner@length}}%
45 \tikzset{mdfbackground/.style={fill=\mdf@backgroundcolor}}%
46 \ifdimgreater{\mdf@outerlinewidth@length}{\z@}%
47 {\tikzset{mdfborderA/.style={%
48 draw=\mdf@outerlinecolor,%
49 line width=2\mdf@outerlinewidth@length+\mdf@middlelinewidth@length%
50 }%
51 }%
52 }%
53 {\tikzset{mdfborderA/.style={}}}%
54 \ifdimgreater{\mdf@innerlinewidth@length}{\z@}%
55 {\tikzset{mdfborderI/.style={%
56 draw=\mdf@innerlinecolor,%
57 line width=2\mdf@innerlinewidth@length+\mdf@middlelinewidth@length%
58 }%
59 }%
60 }%
61 {\tikzset{mdfborderI/.style={}}}%
62 \tikzset{mdfmiddle/.style={draw=\mdf@middlelinecolor,line width=\mdf@middlelinewidth@length}}%
63 }%
64 \def\md@putbox@single{%boite qui tient sur la page
65 \leftline{\null\hspace*{\mdf@leftmargin@length}%%
66 \md@tikz@settings%
67 \setlength\mdfboxwidth{\wd\@tempboxa}%
68 \setlength\mdfboxheight{\ht\@tempboxa+\dp\@tempboxa}%
69 \setlength{\bc@invboxh}{\mdfboxheight}%
70 \begin{tikzpicture}%
71 \coordinate(O)at(0,0);%
72 \pgfmathsetlengthmacro\x{\mdfboxwidth+\mdf@innerrightmargin@length%
73 +\mdf@innerleftmargin@length+%
74 2\mdf@innerlinewidth@length+\mdf@middlelinewidth@length}%
75 \pgfmathsetlengthmacro\xp{\mdf@innerleftmargin@length+%
76 1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
77 \pgfmathsetlengthmacro\y{\mdfboxheight+\mdf@innertopmargin@length%
78 +\mdf@innerbottommargin@length%
79 +2*\mdf@innerlinewidth@length+\mdf@middlelinewidth@length}%
80 \pgfmathsetlengthmacro\yp{\mdf@innerbottommargin@length%
81 +1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
82 \pgfmathsetlengthmacro\dep{\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
83 \coordinate(P)at(\x,\y);%
84 \begin{scope}%
85 \ifKV@bclogo@ombre%
86 \ifKV@bclogo@blur%
87 \path[mdfcorners]\bc@tikzBlur(-\dep,-\dep)--(\x+\dep,-\dep)--(\x+\dep,\y+\dep)--(-\dep,\y+\dep)--cycle;%
88 \else%
89 \path[mdfcorners]\bc@tikzOmbre(-\dep,-\dep)--(\x+\dep,-\dep)--(\x+\dep,\y+\dep)--(-\dep,\y+\dep)--cycle;%
90 \fi\fi%
91 \clip[preaction=mdfborderA]%
92 [postaction={mdfbackground,mdfborderI}]%
93 [mdfcorners](O)--(O|-P)--(P)--(P|-O)--cycle;%
94 \end{scope}%
95 \path[mdfmiddle,mdfcorners,draw=\ifKV@bclogo@noborder none\else\bcval@couleurBord\fi](O)--(O|-P)--(P)--(P|-O)--cycle;
96 \node[mdftext,anchor=north west]at%
97 (\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,%
98 \y-0.75*\bcval@framesep-\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length){\box\bc@envbox};
99 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,\yp){\bc@barre};
100 \node[mdftext,anchor=south west]at(\xp,\yp){\box\@tempboxa};
101 %\draw[fill] (0,0) circle (.1cm);
102 %\draw[fill,yellow] (\x,\y) circle (.1cm);
103 %\draw[fill,orange] (\xp,\yp) circle (.05cm);
104 \end{tikzpicture}%
105 }%
106 }%
107 %
108 \def\md@putbox@first{%tête d'une boite coupée
109 \leftline{\null\hspace*{\mdf@leftmargin@length}%%
110 \md@tikz@settings%
111 \setlength\mdfboxwidth{\wd\tw@}%
112 \setlength\mdfboxheight{\ht\tw@+\dp\tw@}%
113 \setlength{\bc@invboxh}{\mdfboxheight}%
114 \ifdimequal{\pagegoal}{\maxdimen}{\enlargethispage{\baselineskip}}{}%
115 \begin{tikzpicture}%
116 \coordinate(O) at (0,0);%
117 \pgfmathsetlengthmacro\x{\mdfboxwidth+\mdf@innerrightmargin@length%
118 +\mdf@innerleftmargin@length+%
119 2*\mdf@innerlinewidth@length+1*\mdf@middlelinewidth@length}
120 \pgfmathsetlengthmacro\xp{\mdf@innerleftmargin@length+%
121 1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}
122 \pgfmathsetlengthmacro\y{-\mdfboxheight-\mdf@innertopmargin@length%
123 -1*\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length+0.0cm}
124 \pgfmathsetlengthmacro\yp{-\mdf@innertopmargin@length%
125 -1*\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length%
126 -0.5\mdfboxheight}
127 \pgfmathsetlengthmacro\dep{\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
128 \coordinate(P)at(\x,\y);%
129 \clip(-\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length,%
130 \mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length)%
131 rectangle(\x+\mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length+\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi,%
132 \y-\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi);
133 \begin{scope}%
134 \ifKV@bclogo@ombre%
135 \ifKV@bclogo@blur%
136 \path[mdfcorners]\bc@tikzBlur(-\dep,\y)--(-\dep,\dep)--(\x+\dep,\dep)--(\x+\dep,\y);%
137 \else%
138 \path[mdfcorners]\bc@tikzOmbre(-\dep,\y)--(-\dep,\dep)--(\x+\dep,\dep)--(\x+\dep,\y);%
139 \fi\fi%
140 \clip[preaction=mdfborderA]%
141 [postaction={mdfbackground,mdfborderI}]%
142 [mdfcorners](O|-P)--(O)--(P|-O)--(P);%
143 \end{scope}%
144 \path[mdfmiddle,mdfcorners,mdfbackground,draw=\ifKV@bclogo@noborder none\else \bcval@couleurBord\fi](O|-P)--(O)--(P|-O)--(P);
145 \node[mdftext,anchor=north west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,%
146 -0.75*\bcval@framesep-\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length){\box\bc@envbox};%
147 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,\y){\bc@barre};%
148 \node[mdftext,anchor=west,inner sep=0pt,outer sep=0pt]at(\xp,\yp){\box\tw@};%
149 %\draw[fill] (0,0) circle (.1cm);
150 %\draw[fill,yellow] (\x,\y) circle (.1cm);
151 %\draw[fill,orange] (\xp,\yp) circle (.05cm);
152 \end{tikzpicture}%
153 }%
154 }%
155 %
156 \def\md@putbox@middle{%milieu d'une boite coupée (occupe une page entière)
157 \leftline{\null\hspace*{\mdf@leftmargin@length}%%
158 \md@tikz@settings%
159 \setlength\mdfboxwidth{\wd\tw@}%
160 \setlength\mdfboxheight{\ht\tw@+\dp\tw@}%
161 \setlength{\bc@invboxh}{\mdfboxheight}%
162 \setlength{\mdf@ymargin@length}{0.4\baselineskip}%
163 \begin{tikzpicture}%
164 \coordinate(O)at(0,0);%
165 \pgfmathsetlengthmacro\x{\mdfboxwidth+\mdf@innerrightmargin@length%
166 +\mdf@innerleftmargin@length+%
167 2*\mdf@innerlinewidth@length+1*\mdf@middlelinewidth@length}%
168 \pgfmathsetlengthmacro\xp{\mdf@innerleftmargin@length+%
169 1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
170 \pgfmathsetlengthmacro\y{\mdfboxheight}%
171 \pgfmathsetlengthmacro\yp{0cm}%
172 \pgfmathsetlengthmacro\dep{\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
173 \coordinate(P)at(\x,\y);%
174 \clip(-\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length,-\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi)%
175 rectangle(\x+\mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length+\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi,\y);
176 \begin{scope}%
177 \path[mdfborderA](O)--(O|-P)(P)--(P|-O);%
178 \ifKV@bclogo@ombre%
179 \ifKV@bclogo@blur%
180 \path\bc@tikzBlur(-\dep,0)--(\x+\dep,0)--(\x+\dep,\y)--(0,\y)--cycle;%
181 \else%
182 \path\bc@tikzOmbre(-\dep,0)--(\x+\dep,0)--(\x+\dep,\y)--(0,\y)--cycle;%
183 \fi\fi%
184 \clip%
185 [postaction=mdfbackground](O)--(O|-P)--(P)--(P|-O);%
186 \path[mdfborderI](O)--(O|-P)(P)--(P|-O);%
187 \end{scope}%
188 \path[mdfmiddle,draw=\ifKV@bclogo@noborder none\else \bcval@couleurBord\fi](O)--(O|-P)(P)--(P|-O);%
189 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,0){\bc@barre};%
190 \node[mdftext,anchor=south west]at(\xp,\yp){\box\tw@};%
191 \end{tikzpicture}%
192 }%
193 }%
194 %
195 \def\md@putbox@second{%dernière partie d'une boite coupée
196 \leftline{\null\hspace*{\mdf@leftmargin@length}%%
197 \md@tikz@settings%
198 \setlength\mdfboxwidth{\wd\@tempboxa}%
199 \setlength\mdfboxheight{\ht\@tempboxa+\dp\@tempboxa}%
200 \setlength{\bc@invboxh}{\mdfboxheight}%
201 \begin{tikzpicture}%
202 \coordinate(O)at(0,0);%
203 \pgfmathsetlengthmacro\x{\mdfboxwidth+\mdf@innerrightmargin@length%
204 +\mdf@innerleftmargin@length+%
205 2*\mdf@innerlinewidth@length+1*\mdf@middlelinewidth@length}%
206 \pgfmathsetlengthmacro\xp{\mdf@innerleftmargin@length+%
207 1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
208 \pgfmathsetlengthmacro\y{\mdfboxheight%
209 +\mdf@innerbottommargin@length%
210 +1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}
211 \pgfmathsetlengthmacro\yp{\mdf@innerbottommargin@length%
212 +1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
213 \pgfmathsetlengthmacro\dep{\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
214 \coordinate(P)at(\x,\y);%
215 \clip(-\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length,%
216 -\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length-\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi)%
217 rectangle(\x+\mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length+\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi,\y);
218 \begin{scope}%
219 \ifKV@bclogo@ombre%
220 \ifKV@bclogo@blur%
221 \path[mdfcorners]\bc@tikzBlur(-\dep,\y)--(-\dep,-\dep)--(\x+\dep,-\dep)--(\x+\dep,\y);%
222 \else%
223 \path[mdfcorners]\bc@tikzOmbre(-\dep,\y)--(-\dep,-\dep)--(\x+\dep,-\dep)--(\x+\dep,\y);%
224 \fi\fi%
225 \clip[preaction=mdfborderA]%
226 [postaction={mdfbackground,mdfborderI}]%
227 [mdfcorners](P-|O)--(O)--(O-|P)--(P);%
228 \end{scope}%
229 \path[mdfmiddle,mdfcorners,draw=\ifKV@bclogo@noborder none\else \bcval@couleurBord\fi](P-|O)--(O)--(O-|P)--(P);%
230 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,\yp){\bc@barre};%
231 \node[mdftext,anchor=south west] at (\xp,\yp){\box\@tempboxa};%
232 \end{tikzpicture}%
233 }%
234 }%

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.