définition des lengths mdfbox, préfixage des length, ajout de l'option nobreak, modif...
[bclogo.git] / dev / latex / bclogoMdframedTikz.tex
1 % This is a part of bclogo.sty v3.0
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\bc@mdfboxwidth{\wd\@tempboxa}%
68 \setlength\bc@mdfboxheight{\ht\@tempboxa+\dp\@tempboxa}%
69 \setlength{\bc@invboxh}{\bc@mdfboxheight}%
70 \begin{tikzpicture}%
71 \coordinate(O)at(0,0);%
72 \pgfmathsetlengthmacro\x{\bc@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{\bc@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%
91 \fi%
92 \clip[preaction=mdfborderA]%
93 [postaction={mdfbackground,mdfborderI}]%
94 [mdfcorners](O)--(O|-P)--(P)--(P|-O)--cycle;%
95 \end{scope}%
96 \path[mdfmiddle,mdfcorners,draw=\ifKV@bclogo@noborder none\else\bcval@couleurBord\fi](O)--(O|-P)--(P)--(P|-O)--cycle;
97 \node[mdftext,anchor=north west]at%
98 (\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,%
99 \y-0.75*\bcval@framesep-\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length){\box\bc@envbox};
100 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,\yp){\bc@barre};
101 \node[mdftext,anchor=south west]at(\xp,\yp){\box\@tempboxa};
102 %\draw[fill] (0,0) circle (.1cm);
103 %\draw[fill,yellow] (\x,\y) circle (.1cm);
104 %\draw[fill,orange] (\xp,\yp) circle (.05cm);
105 \end{tikzpicture}%
106 }%
107 }%
108 %
109 \def\md@putbox@first{%tête d'une boite coupée
110 \leftline{\null\hspace*{\mdf@leftmargin@length}%%
111 \md@tikz@settings%
112 \setlength\bc@mdfboxwidth{\wd\tw@}%
113 \setlength\bc@mdfboxheight{\ht\tw@+\dp\tw@}%
114 \setlength{\bc@invboxh}{\bc@mdfboxheight}%
115 \ifdimequal{\pagegoal}{\maxdimen}{\enlargethispage{\baselineskip}}{}%
116 \begin{tikzpicture}%
117 \coordinate(O) at (0,0);%
118 \pgfmathsetlengthmacro\x{\bc@mdfboxwidth+\mdf@innerrightmargin@length%
119 +\mdf@innerleftmargin@length+%
120 2*\mdf@innerlinewidth@length+1*\mdf@middlelinewidth@length}
121 \pgfmathsetlengthmacro\xp{\mdf@innerleftmargin@length+%
122 1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}
123 \pgfmathsetlengthmacro\y{-\bc@mdfboxheight-\mdf@innertopmargin@length%
124 -1*\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length+0.0cm}
125 \pgfmathsetlengthmacro\yp{-\mdf@innertopmargin@length%
126 -1*\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length%
127 -0.5\bc@mdfboxheight}
128 \pgfmathsetlengthmacro\dep{\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
129 \coordinate(P)at(\x,\y);%
130 \clip(-\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length,%
131 \mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length)%
132 rectangle(\x+\mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length+\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi,%
133 \y-\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi);
134 \begin{scope}%
135 \ifKV@bclogo@ombre%
136 \ifKV@bclogo@blur%
137 \path[mdfcorners]\bc@tikzBlur(-\dep,\y)--(-\dep,\dep)--(\x+\dep,\dep)--(\x+\dep,\y);%
138 \else%
139 \path[mdfcorners]\bc@tikzOmbre(-\dep,\y)--(-\dep,\dep)--(\x+\dep,\dep)--(\x+\dep,\y);%
140 \fi\fi%
141 \clip[preaction=mdfborderA]%
142 [postaction={mdfbackground,mdfborderI}]%
143 [mdfcorners](O|-P)--(O)--(P|-O)--(P);%
144 \end{scope}%
145 \path[mdfmiddle,mdfcorners,mdfbackground,draw=\ifKV@bclogo@noborder none\else \bcval@couleurBord\fi](O|-P)--(O)--(P|-O)--(P);
146 \node[mdftext,anchor=north west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,%
147 -0.75*\bcval@framesep-\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length){\box\bc@envbox};%
148 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,\y){\bc@barre};%
149 \node[mdftext,anchor=west,inner sep=0pt,outer sep=0pt]at(\xp,\yp){\box\tw@};%
150 %\draw[fill] (0,0) circle (.1cm);
151 %\draw[fill,yellow] (\x,\y) circle (.1cm);
152 %\draw[fill,orange] (\xp,\yp) circle (.05cm);
153 \end{tikzpicture}%
154 }%
155 }%
156 %
157 \def\md@putbox@middle{%milieu d'une boite coupée (occupe une page entière)
158 \leftline{\null\hspace*{\mdf@leftmargin@length}%%
159 \md@tikz@settings%
160 \setlength\bc@mdfboxwidth{\wd\tw@}%
161 \setlength\bc@mdfboxheight{\ht\tw@+\dp\tw@}%
162 \setlength{\bc@invboxh}{\bc@mdfboxheight}%
163 %\setlength{\bc@mdf@ymargin@length}{0.4\baselineskip}%
164 \begin{tikzpicture}%
165 \coordinate(O)at(0,0);%
166 \pgfmathsetlengthmacro\x{\bc@mdfboxwidth+\mdf@innerrightmargin@length%
167 +\mdf@innerleftmargin@length+%
168 2*\mdf@innerlinewidth@length+1*\mdf@middlelinewidth@length}%
169 \pgfmathsetlengthmacro\xp{\mdf@innerleftmargin@length+%
170 1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
171 \pgfmathsetlengthmacro\y{\bc@mdfboxheight}%
172 \pgfmathsetlengthmacro\yp{0cm}%
173 \pgfmathsetlengthmacro\dep{\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
174 \coordinate(P)at(\x,\y);%
175 \clip(-\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length,-\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi)%
176 rectangle(\x+\mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length+\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi,\y);
177 \begin{scope}%
178 \path[mdfborderA](O)--(O|-P)(P)--(P|-O);%
179 \ifKV@bclogo@ombre%
180 \ifKV@bclogo@blur%
181 \path\bc@tikzBlur(-\dep,0)--(\x+\dep,0)--(\x+\dep,\y)--(0,\y)--cycle;%
182 \else%
183 \path\bc@tikzOmbre(-\dep,0)--(\x+\dep,0)--(\x+\dep,\y)--(0,\y)--cycle;%
184 \fi\fi%
185 \clip%
186 [postaction=mdfbackground](O)--(O|-P)--(P)--(P|-O);%
187 \path[mdfborderI](O)--(O|-P)(P)--(P|-O);%
188 \end{scope}%
189 \path[mdfmiddle,draw=\ifKV@bclogo@noborder none\else \bcval@couleurBord\fi](O)--(O|-P)(P)--(P|-O);%
190 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,0){\bc@barre};%
191 \node[mdftext,anchor=south west]at(\xp,\yp){\box\tw@};%
192 \end{tikzpicture}%
193 }%
194 }%
195 %
196 \def\md@putbox@second{%dernière partie d'une boite coupée
197 \leftline{\null\hspace*{\mdf@leftmargin@length}%%
198 \md@tikz@settings%
199 \setlength\bc@mdfboxwidth{\wd\@tempboxa}%
200 \setlength\bc@mdfboxheight{\ht\@tempboxa+\dp\@tempboxa}%
201 \setlength{\bc@invboxh}{\bc@mdfboxheight}%
202 \begin{tikzpicture}%
203 \coordinate(O)at(0,0);%
204 \pgfmathsetlengthmacro\x{\bc@mdfboxwidth+\mdf@innerrightmargin@length%
205 +\mdf@innerleftmargin@length+%
206 2*\mdf@innerlinewidth@length+1*\mdf@middlelinewidth@length}%
207 \pgfmathsetlengthmacro\xp{\mdf@innerleftmargin@length+%
208 1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
209 \pgfmathsetlengthmacro\y{\bc@mdfboxheight%
210 +\mdf@innerbottommargin@length%
211 +1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}
212 \pgfmathsetlengthmacro\yp{\mdf@innerbottommargin@length%
213 +1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
214 \pgfmathsetlengthmacro\dep{\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
215 \coordinate(P)at(\x,\y);%
216 \clip(-\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length,%
217 -\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length-\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi)%
218 rectangle(\x+\mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length+\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi,\y);
219 \begin{scope}%
220 \ifKV@bclogo@ombre%
221 \ifKV@bclogo@blur%
222 \path[mdfcorners]\bc@tikzBlur(-\dep,\y)--(-\dep,-\dep)--(\x+\dep,-\dep)--(\x+\dep,\y);%
223 \else%
224 \path[mdfcorners]\bc@tikzOmbre(-\dep,\y)--(-\dep,-\dep)--(\x+\dep,-\dep)--(\x+\dep,\y);%
225 \fi\fi%
226 \clip[preaction=mdfborderA]%
227 [postaction={mdfbackground,mdfborderI}]%
228 [mdfcorners](P-|O)--(O)--(O-|P)--(P);%
229 \end{scope}%
230 \path[mdfmiddle,mdfcorners,draw=\ifKV@bclogo@noborder none\else \bcval@couleurBord\fi](P-|O)--(O)--(O-|P)--(P);%
231 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,\yp){\bc@barre};%
232 \node[mdftext,anchor=south west] at (\xp,\yp){\box\@tempboxa};%
233 \end{tikzpicture}%
234 }%
235 }%

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.