Debian Codegraph @

texmf-dist/source/generic/pst-fr3d/pst-fr3d.dtx

raw
1 % \iffalse meta-comment, etc.
2 %%
3 %% Package `pst-fr3d.dtx'
4 %%
5 %% Denis Girou (CNRS/IDRIS - France) <[email protected]>
6 %%
7 %% February 25, 2002
8 %%
9 %% This program can be redistributed and/or modified under the terms
10 %% of the LaTeX Project Public License Distributed from CTAN archives
11 %% in directory macros/latex/base/lppl.txt.
12 %%
13 %% DESCRIPTION:
14 %% `pst-fr3d' is a PSTricks package to draw three dimensional grids
15 %% with various customizations.
16 %%
17 % \fi
18 %
19 % \DoNotIndex{\\,\^,\@}
20 % \DoNotIndex{\@ifnextchar,\@nameuse,\@nil,\@undefined}
21 % \DoNotIndex{\advance}
22 % \DoNotIndex{\begin}
23 % \DoNotIndex{\catcode,\CodelineIndex,\csname}
24 % \DoNotIndex{\def,\define@key,\definecolor,\divide,\DocInput}
25 % \DoNotIndex{\documentclass,\dp}
26 % \DoNotIndex{\edef,\else,\EnableCrossrefs,\end,\endcsname,\endinput}
27 % \DoNotIndex{\endpspicture}
28 % \DoNotIndex{\fi,\filedate,\fileversion}
29 % \DoNotIndex{\GetFileInfo}
30 % \DoNotIndex{\hbadness,\hbox,\hfuzz,\ht}
31 % \DoNotIndex{\ifdim,\ifx,\input}
32 % \DoNotIndex{\let}
33 % \DoNotIndex{\message}
34 % \DoNotIndex{\newhsbcolor,\newif}
35 % \DoNotIndex{\OnlyDescription}
36 % \DoNotIndex{\p@,\ProvidesPackage,\psframebox,\psframesep}
37 % \DoNotIndex{\psline,\pslinewidth,\pspolygon,\psset,\PstAtCode,\pst@boxg}
38 % \DoNotIndex{\pst@dima,\pst@dimb,\pst@dimc,\pst@dimd,\pst@dimh}
39 % \DoNotIndex{\pst@dimtonum,\pst@expandafter,\pst@getnumiii,\pst@hbox}
40 % \DoNotIndex{\pst@tempa,\pst@tempb,\pst@tempc,\pst@tempg,\pst@temph}
41 % \DoNotIndex{\pst@tempi,\PSTricksLoaded}
42 % \DoNotIndex{\RecordChanges,\relax}
43 % \DoNotIndex{\setbox,\setkeys,\space}
44 % \DoNotIndex{\the,\tw@}
45 % \DoNotIndex{\usepackage}
46 % \DoNotIndex{\wd}
47 % \DoNotIndex{\z@}
48 %
49 % \setcounter{IndexColumns}{2}
50 %
51 % \newcommand{\PstFrameBoxThreeDPackage}{`\textsf{pst-fr3d}'}
52 % \newcommand{\PstFrameBoxThreeDMacro}{\cs{PstFrameBoxThreeD}}
53 % \newcommand{\ColorPackage}{`\textsf{color}'}
54 % \newcommand{\PstColPackage}{`\textsf{pstricks}'}
55 %
56 % ^^A From ltugboat.cls
57 %
58 % ^^A Typeset the name of an environment
59 % \providecommand\env[1]{\textsf{#1}}
60 % \providecommand\clsname[1]{\textsf{#1}}
61 % \providecommand\pkgname[1]{\textsf{#1}}
62 % \providecommand\optname[1]{\textsf{#1}}
63 % \providecommand\progname[1]{\textsf{#1}}
64 %
65 % ^^A A list of options for a package/class
66 % \newenvironment{optlist}{\begin{description}%
67 % \renewcommand\makelabel[1]{%
68 % \descriptionlabel{\mdseries\optname{##1}}}%
69 % \itemsep0.25\itemsep}%
70 % {\end{description}}
71 %
72 % ^^A Utility macros
73 %
74 %
75 % ^^A Example macros - adapted from the `fvrb-ex' package
76 % ^^A ---------------------------------------------------
77 %
78 % ^^A Take care that we use here the four /?_W characters as escape
79 % ^^A characters, so we can't use these characters in the examples!
80 %
81 % \makeatletter
82 %
83 % ^^A To highlight some verbatim sequences (comments, macro names, etc.)
84 % \def\HLEmphasize#1{\textit{#1}}
85 % \newcommand{\BS}{\texttt{\symbol{`\\}}}
86 % \def\HLMacro#1{\BS{}def\HLMacro@i#1\@nil}
87 % \def\HLMacro@i#1def#2\@nil{\HLReverse{#2}}
88 % \def\HLReverse#1{{\setlength{\fboxsep}{1pt}\HLReverse@i{#1}}}
89 % \def\HLReverse@i#1{\colorbox{black}{\textcolor{white}{\textbf{#1}}}}
90 %
91 % \def\Example{\FV@Environment{}{Example}}
92 % \def\endExample{%
93 % \end{VerbatimOut}
94 % \Below@Example{\input{\jobname.tmp}}
95 % \endgroup}
96 %
97 % \def\CenterExample{\FV@Environment{}{Example}}
98 % \def\endCenterExample{%
99 % \end{VerbatimOut}
100 % \begin{center}
101 % \Below@Example{\input{\jobname.tmp}}
102 % \end{center}
103 % \endgroup}
104 %
105 % \def\SideBySideExample{\FV@Environment{}{Example}}
106 % \def\endSideBySideExample{%
107 % \end{VerbatimOut}
108 % \SideBySide@Example{\input{\jobname.tmp}}
109 % \endgroup}
110 %
111 % \def\FVB@Example{%
112 % \begingroup
113 % \FV@UseKeyValues
114 % \parindent=0pt
115 % \multiply\topsep by 2
116 % \VerbatimEnvironment
117 % \begin{VerbatimOut}[gobble=4,codes={\catcode`\W=12}]{\jobname.tmp}}
118 %
119 % \def\Below@Example#1{%
120 % \VerbatimInput[gobble=0,commentchar=W,commandchars=/?_,frame=single,
121 % numbers=left,numbersep=3pt]{\jobname.tmp}
122 % \catcode`\%=14\relax
123 % \catcode`\W=9\relax
124 % ^^A We suppress the effect of the highlighting macros
125 % \catcode`/=0\relax
126 % \catcode`?=1\relax
127 % \catcode`_=2\relax
128 % \def\HLEmphasize##1{##1}%
129 % \def\HLMacro##1{##1}%
130 % \def\HLReverse##1{##1}%
131 % #1
132 % \par}
133 %
134 % \def\SideBySide@Example#1{%
135 % \vskip 1mm
136 % \@tempdimb=\FV@XRightMargin
137 % \advance\@tempdimb -5mm
138 % \begin{minipage}[c]{\@tempdimb}
139 % \fvset{xrightmargin=0pt}
140 % \catcode`\%=14\relax
141 % \catcode`\W=9\relax
142 % ^^A We suppress the effect of the highlighting macros
143 % \catcode`/=0\relax
144 % \catcode`?=1\relax
145 % \catcode`_=2\relax
146 % \def\HLEmphasize##1{##1}%
147 % \def\HLMacro##1{##1}%
148 % \def\HLReverse##1{##1}%
149 % #1
150 % \end{minipage}%
151 % \@tempdimb=\textwidth
152 % \advance\@tempdimb -\FV@XRightMargin
153 % \advance\@tempdimb 5mm
154 % \begin{minipage}[c]{\@tempdimb}
155 % \VerbatimInput[gobble=0,commentchar=W,commandchars=/?_,
156 % frame=single,numbers=left,numbersep=3pt,
157 % xleftmargin=5mm,xrightmargin=0pt]{\jobname.tmp}
158 % \end{minipage}
159 % \vskip 1mm}
160 %
161 % \makeatother
162 %
163 % ^^A End of example macros from `fvrb-ex'
164 %
165 % ^^A For the possible index and changes log
166 % \setlength{\columnseprule}{0.6pt}
167 %
168 % ^^A Beginning of the documentation itself
169 %
170 % \title{The \PstFrameBoxThreeDPackage{} package\\
171 % A PSTricks package\\
172 % for three dimensional framed boxes}
173 % \author{Denis \textsc{Girou}\thanks{CNRS/IDRIS ---
174 % Centre National de la Recherche Scientifique /
175 % Institut du D\'eveloppement et des Ressources en Informatique
176 % Scientifique --- Orsay --- France ---
177 % \mbox{\texttt{<[email protected]>}}.}}
178 % \date{Version 1.0\\February 25, 2002\\
179 % {\small Documentation revised February 25, 2002}}
180 %
181 % \maketitle
182 %
183 % \begin{abstract}
184 % This package allow to draw three dimensional framed boxes using the
185 % macro \PstFrameBoxThreeDMacro. This is specially useful to draw 3d-like
186 % buttons.
187 % \end{abstract}
188 %
189 % \tableofcontents
190 %
191 % \section{Introduction}
192 %
193 % \PstFrameBoxThreeDPackage{} offer a unique main macro with few parameters to
194 % interact on it. This is just a small extension of the \cs{psframebox} macro.
195 %
196 % All the relevant PSTricks parameters can be use with it, but the
197 % \texttt{linestyle}, \texttt{linecolor}, \texttt{doubleline} and
198 % \texttt{doublecolor} ones must not be used, as they would be overridden.
199 % Nevertheless, some usual parameters are not relevant for this kind of boxes
200 % and would produce ``strange'' results (for instance \texttt{border},
201 % \texttt{linearc} and \texttt{shadow}).
202 %
203 % As usual, \LaTeX{} users are supposed to have loaded the \PstColPackage{}
204 % package before this one, to ensure the compatibility with the standard
205 % \ColorPackage{} \LaTeX{} package.
206 %
207 % The syntax of the macro is the same than the one for the other macros for
208 % framed boxes, so simply:
209 %
210 % \vspace{1mm}
211 % \noindent%
212 % \fbox{\PstFrameBoxThreeDMacro\texttt{[optional\_parameters]\{\emph{stuff}\}}}
213 %
214 % \vspace{1mm}
215 % We can put all the valid material inside such 3d boxes, including other
216 % framed boxes.
217 %
218 % Note also that, obviously, this documentation is very color oriented, and
219 % is done to be read on a screen or a colored paper.
220 %
221 % \section{Usage}
222 %
223 % \subsection{Default behavior}
224 %
225 % The default behavior is the following:
226 %
227 % \begin{CenterExample}
228 % \PstFrameBoxThreeD{Button}\hfill
229 % \PstFrameBoxThreeD{\shortstack{Yes!\\Yes!\\Yes!}}\hfill
230 % \PstFrameBoxThreeD{\Huge$\frac{1}{\sqrt{3}}$}%
231 % \end{CenterExample}
232 %
233 % Of course, we can use all the relevant generic PSTricks parameters for the
234 % framed boxes (but not those relative to \emph{double} lines), specially
235 % those applying to boxes:
236 %
237 % \begin{CenterExample}
238 % \PstFrameBoxThreeD[doublesep=0.1]{Button}\hfill
239 % \PstFrameBoxThreeD[doublesep=0.2]{Button}\hfill
240 % \PstFrameBoxThreeD[doublesep=0.5]{Button}%
241 % \end{CenterExample}
242 %
243 % Specially look at the behavior of the \texttt{framesep},
244 % \texttt{doublesep} and \texttt{linewidth} parameters:
245 %
246 % \begin{CenterExample}
247 % \PstFrameBoxThreeD[framesep=0.3]{Button}\hfill
248 % \PstFrameBoxThreeD[doublesep=0.3]{Button}\hfill
249 % \PstFrameBoxThreeD[linewidth=0.3]{Button}\hfill
250 % \PstFrameBoxThreeD[doublesep=0.3,linewidth=0.3]{Button}\hfill
251 % \PstFrameBoxThreeD[framearc=0.5]{Button}%
252 % \end{CenterExample}
253 %
254 % \subsection{Parameters}
255 %
256 % To change the way the boxes are drawn, we can also use \textbf{four}
257 % specific parameters:
258 %
259 % \begin{optlist}
260 % \item [FrameBoxThreeDColorHSB (real real real)]: to define the colors
261 % used, in the HSB (\emph{hue}, \emph{saturation}, \emph{brightness}) model.
262 % This is a sequence of three real values, separated by spaces. This will
263 % define the color of the interior of the frame. And for the borders we will
264 % use it too, changing it brightness in light and dark.
265 %
266 % Note also that if the \emph{brightness} value is negative, no color
267 % will fill the interior of the box (this is useful if the general background
268 % is not white).
269 % (\emph{Default:~0~0~0.5} --- it must be three numbers between 0~and~1, but
270 % as explained the last one can be negative, which has a special meaning).
271 % \end{optlist}
272 %
273 % \begin{CenterExample}
274 % \psset{doublesep=0.1}
275 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.1 0.3 0.5_]{%
276 % Button}\hfill
277 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.6 0.3 0.5_]{%
278 % Button}\hfill
279 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.4 0.1 0.5_]{%
280 % \Huge$\frac{1}{\sqrt{3}}$}\hfill
281 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.9 0.5 0.5_]{%
282 % \psovalbox[fillstyle=solid,fillcolor=yellow]{Button}}\hfill
283 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.4 0.7 0.2_]{%
284 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.4 0.7 0.5_]{%
285 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.4 0.7 0.8_]{%
286 % Button}}}%
287 % \end{CenterExample}
288 %
289 % \begin{CenterExample}
290 % \psset{doublesep=0.2}
291 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0 0 0.3_]{Button}\hfill
292 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0 0 0.7_]{Button}\hfill
293 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0 0 -1_]{Button}\hfill
294 % \definecolor{MyGray}{gray}{0.85}
295 % \psframe*[linecolor=MyGray](-0.3,-0.65)(2.1,0.9)
296 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0 0 -1_]{Button}%
297 % \end{CenterExample}
298 %
299 % \begin{SideBySideExample}[xrightmargin=3cm]
300 % \PstFrameBoxThreeD%
301 % [linewidth=0.2,
302 % /HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.3 0.2 0.5_]{%
303 % \Huge\textcolor{white}{\textbf{21}}}
304 % \end{SideBySideExample}
305 %
306 % \begin{optlist}
307 % \item [FrameBoxThreeDOn (boolean)]: to simulate an ON / OFF button, by
308 % exchange of the dark and light colors of the borders (this will give the
309 % same result that to use a negative value for the
310 % \texttt{FrameBoxThreeDBrightnessDistance} parameter)
311 % (\emph{Default:~true}).
312 % \end{optlist}
313 %
314 % \begin{CenterExample}
315 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.1 0.9 0.5_]{%
316 % Button}\hfill
317 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.1 0.9 0.5_,
318 % /HLEmphasize?FrameBoxThreeDOn_=/HLReverse?false_]{Button}\hfill
319 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.1 0.9 0.5_,
320 % /HLEmphasize?FrameBoxThreeDOn_=/HLReverse?false_,linewidth=0.2]{Button}%
321 % \end{CenterExample}
322 %
323 % \begin{CenterExample}
324 % \PstFrameBoxThreeD[linewidth=0.5,/HLEmphasize?FrameBoxThreeDOn_=/HLReverse?false_,
325 % /HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.8 0.5 0.5_]{%
326 % \Large\textcolor{yellow}{\textbf{This is your last chance...}}}
327 % \end{CenterExample}
328 %
329 % \begin{optlist}
330 % \item [FrameBoxThreeDOpposite (boolean)]: to use the same color for the
331 % left and right borders, and the same other for the bottom and top ones, or
332 % rather for left and top and right and bottom.
333 % (\emph{Default:~false}).
334 % \end{optlist}
335 %
336 % \begin{CenterExample}
337 % \psset{linewidth=0.2}
338 % \newcommand{\Button}{\textcolor{white}{\textbf{Button}}}
339 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.7 0.8 0.8_]{%
340 % \Button}\hfill
341 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.7 0.8 0.8_,
342 % /HLEmphasize?FrameBoxThreeDOn_=/HLReverse?false_]{\Button}\hfill
343 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.7 0.8 0.8_,
344 % /HLEmphasize?FrameBoxThreeDOpposite_=/HLReverse?true_]{\Button}\hfill
345 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.7 0.8 0.8_,
346 % /HLEmphasize?FrameBoxThreeDOn_=/HLReverse?false_,
347 % /HLEmphasize?FrameBoxThreeDOpposite_=/HLReverse?true_]{\Button}%
348 % \end{CenterExample}
349 %
350 % \begin{optlist}
351 % \item [FrameBoxThreeDBrightnessDistance (real)]: the distance brightness
352 % of the color used to fill the interior of the box. If this is a negative
353 % number, we will got the same effect that the one of setting
354 % \texttt{FrameBoxThreeDOn} to false. And if it value is 0, the borders will
355 % have obviously the same color that the interior.
356 % (\emph{Default:~0.15} --- it must be a number between -0.5~and~0.5, but the
357 % \emph{brightness} plus and minus it must stay between 0~and~1).
358 % \end{optlist}
359 %
360 % \begin{CenterExample}
361 % \psset{doublesep=0.2}
362 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.6 0.3 0.5_]{%
363 % Button}\hfill % /HLEmphasize?Default = 0.15_
364 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.6 0.3 0.5_,
365 % /HLEmphasize?FrameBoxThreeDBrightnessDistance_=/HLReverse?0.3_]{%
366 % Button}\hfill
367 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.6 0.3 0.5_,
368 % /HLEmphasize?FrameBoxThreeDBrightnessDistance_=/HLReverse?0.5_]{%
369 % Button}\hfill
370 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.6 0.3 0.7_,
371 % /HLEmphasize?FrameBoxThreeDBrightnessDistance_=/HLReverse?0.3_]{%
372 % Button}\hfill
373 % \PstFrameBoxThreeD[/HLEmphasize?FrameBoxThreeDColorHSB_=/HLReverse?0.6 0.3 0.5_,
374 % /HLEmphasize?FrameBoxThreeDBrightnessDistance_=/HLReverse?-0.2_]{%
375 % Button}%
376 % \end{CenterExample}
377 %
378 % \section{Examples}
379 %
380 % We give here more advanced examples.
381 %
382 % \begin{CenterExample}
383 % \psset{doublesep=0.12}
384 % \multido{\nButtonA=0.1+0.4}{3}{%
385 % \multido{\nButtonB=0+0.05}{11}{%
386 % \PstFrameBoxThreeD%
387 % [FrameBoxThreeDColorHSB=\nButtonA\space 0.5 0.5,
388 % FrameBoxThreeDBrightnessDistance=\nButtonB]{OK}}\\}
389 % \end{CenterExample}
390 %
391 % \begin{CenterExample}
392 % \psset{doublesep=0.05}
393 % \multido{\nButtonA=0+0.1}{11}{%
394 % \multido{\nButtonB=0+0.05}{21}{%
395 % \PstFrameBoxThreeD[FrameBoxThreeDColorHSB=%
396 % \nButtonB\space \nButtonA\space 0.8]{\$}}\\}
397 % \end{CenterExample}
398 %
399 % \begin{CenterExample}
400 % \psset{gradmidpoint=1,gradangle=90}
401 % \psdblframebox[framesep=0.3,fillstyle=gradient,
402 % gradbegin=yellow,gradend=LemonChiffon]{%
403 % \shortstack[l]{%
404 % \makebox[8cm]{\LARGE\textbf{Introduction}\dotfill}\\
405 % {\Large by Catherine \textsc{Parker}}\hfill
406 % \raisebox{5.5mm}{%
407 % \PstFrameBoxThreeD[linewidth=0.15,
408 % FrameBoxThreeDColorHSB=0.3 0.2 0.5]{%
409 % \LARGE\textcolor{white}{3}}}}}
410 % \end{CenterExample}
411 %
412 % \begin{CenterExample}
413 % \psshadowbox[framesep=0.3,fillstyle=gradient,
414 % gradbegin=Orange,gradend=yellow]{%
415 % \setlength{\tabcolsep}{0mm}%
416 % \begin{tabular}{ll}
417 % \makebox[10cm]{%
418 % \LARGE\textbf{Description of the problem\dotfill}} &
419 % \raisebox{-5mm}{%
420 % \PstFrameBoxThreeD[linewidth=0.15,
421 % FrameBoxThreeDColorHSB=0.9 0.5 0.5]{%
422 % \LARGE\textcolor{white}{\textbf{25}}}}\\[-3mm]
423 % \textcolor{red}{\large by Helen \textsc{Mitchell}
424 % and Ann \textsc{Cartridge}}
425 % \end{tabular}}
426 % \end{CenterExample}
427 %
428 % \begin{CenterExample}
429 % \newcommand{\MyNode}[2]{%
430 % \TR{\PstFrameBoxThreeD[linewidth=0.1,FrameBoxThreeDOn=#2,
431 % FrameBoxThreeDColorHSB=0.2 0.4 0.5,
432 % FrameBoxThreeDBrightnessDistance=0.2]{#1}}}
433 % \renewcommand{\psedge}[2]{\ncangle{#2}{#1}}
434 %
435 % \psset{angleB=-90,angleA=90,levelsep=2,treesep=3}
436 % \pstree{\MyNode{Richard}{true}}
437 % {\pstree{\MyNode{Paul}{true}}
438 % {\pstree{\MyNode{Jack}{true}}
439 % {\MyNode{Michel}{false}}
440 % \MyNode{Adam}{false}}
441 % \MyNode{Herbert}{false}}
442 % \end{CenterExample}
443 %
444 % \begin{CenterExample}
445 % \newcommand{\EntryA}[1]{%
446 % \PstFrameBoxThreeD[FrameBoxThreeDColorHSB=0.4 0.6 0.5]{%
447 % \makebox[2.2cm]{#1}}}
448 % \newcommand{\EntryB}[1]{%
449 % \PstFrameBoxThreeD[FrameBoxThreeDColorHSB=0.16 1 0.8]{%
450 % \makebox[0.5cm]{#1}}}
451 % \newcommand{\EntryC}[1]{%
452 % \PstFrameBoxThreeD[FrameBoxThreeDColorHSB=0.7 0.2 0.8]{%
453 % \makebox[1.4cm]{#1}}}
454 % \newcommand{\EntryD}[1]{%
455 % \PstFrameBoxThreeD[FrameBoxThreeDColorHSB=0.9 0.5 0.5]{%
456 % \makebox[1.4cm]{#1}}}
457 %
458 % \begin{table}[htbp]
459 % \centering
460 % \large\bfseries
461 % \setlength{\tabcolsep}{5mm}%
462 % \setlength{\belowcaptionskip}{3mm}%
463 % \caption{Results of the year}
464 % \PstFrameBoxThreeD[framesep=0.4,doublesep=0.5,
465 % FrameBoxThreeDColorHSB=0.3 0.2 0.4]{%
466 % \psset{framesep=0.3,doublesep=0.2}%
467 % \begin{tabular}{lrr}
468 % \\
469 % \EntryA{1st Quarter}&\EntryB{723}& \\[1.5cm]
470 % \EntryA{2nd Quarter}&\EntryB{819}&\EntryC{+13 \%} \\[1.5cm]
471 % \EntryA{3rd Quarter}&\EntryB{687}&\EntryD{--16.1 \%}\\[1.5cm]
472 % \EntryA{4th Quarter}&\EntryB{894}&\EntryC{+30.1 \%} \\[1cm]
473 % \end{tabular}}
474 % \end{table}
475 % \end{CenterExample}
476 %
477 %
478 % \StopEventually{}
479 %
480 % ^^A .................... End of the documentation part ....................
481 %
482 % \section{Driver file}
483 %
484 % The next bit of code contains the documentation driver file for \TeX{},
485 % i.e., the file that will produce the documentation you are currently
486 % reading. It will be extracted from this file by the \texttt{docstrip}
487 % program.
488 %
489 % \begin{macrocode}
490 %<*driver>
491 \documentclass{ltxdoc}
492 \GetFileInfo{pst-fr3d.dtx}
493 \usepackage{fancyvrb}
494 \usepackage{multido}
495 \usepackage{pstricks}
496 \usepackage{pst-fr3d}
497 \usepackage{pst-grad}
498 \usepackage{pst-tree}
499 \EnableCrossrefs
500 \CodelineIndex
501 \RecordChanges
502 \OnlyDescription % Comment it for implementation details
503 \hbadness=7000 % Over and under full box warnings
504 \hfuzz=3pt
505 \definecolor{LemonChiffon}{rgb}{1.,0.98,0.8}
506 \definecolor{Orange} {rgb}{1.,0.65,0.}
507 \definecolor{Pink} {rgb}{1.,0.75,0.8}
508 \begin{document}
509 \DocInput{pst-fr3d.dtx}
510 \end{document}
511 %</driver>
512 % \end{macrocode}
513 %
514 % \section{\PstFrameBoxThreeDPackage{} \LaTeX{} wrapper}
515 %
516 % \begin{macrocode}
517 %<*latex-wrapper>
518 \ProvidesPackage{pst-fr3d}[2002/02/25 package wrapper for PSTricks pst-fr3d.tex]
519 \input pst-fr3d.tex
520 %</latex-wrapper>
521 % \end{macrocode}
522 %
523 % \section{\PstFrameBoxThreeDPackage{} code}
524 %
525 % \begin{macrocode}
526 %<*pst-fr3d>
527 % \end{macrocode}
528 %
529 % \subsection{Preambule}
530 %
531 % Who we are.
532 %
533 % \begin{macrocode}
534 \csname PstFrameBoxThreeDLoaded\endcsname
535 \let\PstFrameBoxThreeDLoaded\endinput
536 % \end{macrocode}
537 %
538 % Require the PSTricks package.
539 %
540 % \begin{macrocode}
541 \ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi
542 % \end{macrocode}
543 %
544 % David \textsc{Carlisle} interface to the `\textsf{keyval}' package.
545 %
546 % \begin{macrocode}
547 \ifx\PSTXKeyLoaded\endinput\else\input pst-xkey \fi
548 % \end{macrocode}
549 %
550 % Catcodes changes.
551 %
552 % \begin{macrocode}
553 \edef\PstAtCode{\the\catcode`\@}
554 \catcode`\@=11\relax
555 \pst@addfams{pst-fr3d}
556 \def\fileversion{1.01}
557 \def\filedate{2004/11/14}
558 \message{`Pst-FrameBox3d' v\fileversion, \filedate\space (Denis Girou)}
559 % \end{macrocode}
560 %
561 % \subsection{Definition of the parameters}
562 %
563 % \texttt{FrameBoxThreeDOn} to draw the 3d framed box with an ON / OFF
564 % effect.
565 %
566 % \begin{macrocode}
567 \newif\ifPstFrameBoxThreeD@On
568 \define@key[psset]{pst-fr3d}{FrameBoxThreeDOn}[true]{\@nameuse{PstFrameBoxThreeD@On#1}}
569 % \end{macrocode}
570 %
571 % \texttt{FrameBoxThreeDOpposite} to use the same colors for the opposite
572 % sides or the contiguous ones.
573 %
574 % \begin{macrocode}
575 \newif\ifPstFrameBoxThreeD@Opposite
576 \define@key[psset]{pst-fr3d}{FrameBoxThreeDOpposite}[true]{%
577 \@nameuse{PstFrameBoxThreeD@Opposite#1}}
578 % \end{macrocode}
579 %
580 % \texttt{FrameBoxThreeDColorHSB} to define the colors used, in the HSB
581 % (\emph{hue}, \emph{saturation}, \emph{brightness}) model. This is a sequence
582 % of three real values, separated by spaces. This will define the color of the
583 % interior of the frame. And for the borders we will use it too, changing it
584 % brightness in light and dark.
585 %
586 % \begin{macrocode}
587 \define@key[psset]{pst-fr3d}{FrameBoxThreeDColorHSB}{%
588 \PstFrameBoxThreeD@ColorHSB@i#1\@nil}
589 \def\PstFrameBoxThreeD@ColorHSB@i#1\@nil{%
590 \pst@expandafter\pst@getnumiii{#1} {} {} {} {}\@nil
591 \edef\PstFrameBoxThreeD@Hue{\pst@tempg}%
592 \edef\PstFrameBoxThreeD@Saturation{\pst@temph}%
593 \edef\PstFrameBoxThreeD@Brightness{\pst@tempi}}
594 % \end{macrocode}
595 %
596 % \texttt{FrameBoxThreeDBrightnessDistance} to define the brightness
597 % distance between the brightness used for the material of the box
598 % (\texttt{BrightnessC}) and the two brightnesss used for the borders
599 % (\texttt{BrightnessA} and \texttt{BrightnessB}): \texttt{BrightnessA} =
600 % \texttt{BrightnessC} + \texttt{FrameBoxThreeDBrightnessDistance} and
601 % \texttt{BrightnessB} = \texttt{BrightnessC} --
602 % \texttt{FrameBoxThreeDBrightnessDistance}. It can be a negative number. And
603 % if the brightness is negative, we will use a value of 0.5 to compute the two
604 % other colors.
605 %
606 % \begin{macrocode}
607 \define@key[psset]{pst-fr3d}{FrameBoxThreeDBrightnessDistance}{%
608 \edef\PstFrameBoxThreeD@BrightnessDistance{#1}}
609 % \end{macrocode}
610 %
611 % Next, we set the default values for all these new parameters.
612 %
613 % \begin{macrocode}
614 \psset{%
615 FrameBoxThreeDOn=true,FrameBoxThreeDOpposite=false,
616 FrameBoxThreeDColorHSB=0 0 0.5,FrameBoxThreeDBrightnessDistance=0.15}%
617 % \end{macrocode}
618 %
619 % \subsection{Main macro}
620 %
621 % The general \cs{PstFrameBoxThreeD} macro to draw three dimensional boxed
622 % frames.
623 %
624 % \begin{macro}{\PstFrameBoxThreeD}
625 % \begin{macrocode}
626 \def\PstFrameBoxThreeD{%
627 \@ifnextchar[{\PstFrameBoxThreeD@i}{\PstFrameBoxThreeD@i[]}}
628 % \end{macrocode}
629 % \end{macro}
630 %
631 % \begin{macro}{\PstFrameBoxThreeD@i}
632 % \begin{macrocode}
633 \def\PstFrameBoxThreeD@i[#1]#2{{%
634 % \end{macrocode}
635 %
636 % We force ``dimmen=middle''.
637 %
638 % \begin{macrocode}
639 \psset{dimen=middle}%
640 % \end{macrocode}
641 %
642 % Then we set the local changes of parameters.
643 %
644 % \begin{macrocode}
645 \psset{#1}%
646 % \end{macrocode}
647 %
648 %
649 % If the brightness is negative, the interior of the frame will not be
650 % filled with color, and a value of 0.5 will be used to compute the two colors
651 % of the borders.
652 %
653 % \begin{macrocode}
654 \ifdim\PstFrameBoxThreeD@Brightness\p@<\z@%
655 \def\PstFrameBoxThreeD@FillStyle{none}%
656 \def\pst@tempa{0.5}%
657 \else
658 \def\PstFrameBoxThreeD@FillStyle{solid}%
659 \def\pst@tempa{\PstFrameBoxThreeD@Brightness}%
660 \fi
661 % \end{macrocode}
662 %
663 % Computation of the colors of the borders.
664 %
665 % \begin{macrocode}
666 \pst@dimh=\pst@tempa\p@
667 \advance\pst@dimh\PstFrameBoxThreeD@BrightnessDistance\p@
668 \pst@dimtonum{\pst@dimh}{\pst@tempb}%
669 \advance\pst@dimh-\PstFrameBoxThreeD@BrightnessDistance\p@
670 \advance\pst@dimh-\PstFrameBoxThreeD@BrightnessDistance\p@
671 \pst@dimtonum{\pst@dimh}{\pst@tempc}%
672 % \end{macrocode}
673 %
674 % If the \ColorPackage{} \LaTeX{} package was not loaded (using the
675 % \PstColPackage{} compatibility package which is hightly recommanded for
676 % \LaTeX{} users), we will use the PSTricks color model.
677 %
678 % \begin{macrocode}
679 \ifx\definecolor\@undefined
680 \newhsbcolor{PstFrameBoxThreeD@ColorC}{%
681 \PstFrameBoxThreeD@Hue \PstFrameBoxThreeD@Saturation \pst@tempa}%
682 \ifPstFrameBoxThreeD@On
683 \newhsbcolor{PstFrameBoxThreeD@ColorA}{%
684 \PstFrameBoxThreeD@Hue \PstFrameBoxThreeD@Saturation \pst@tempc}%
685 \newhsbcolor{PstFrameBoxThreeD@ColorB}{%
686 \PstFrameBoxThreeD@Hue \PstFrameBoxThreeD@Saturation \pst@tempb}%
687 \else
688 \newhsbcolor{PstFrameBoxThreeD@ColorA}{%
689 \PstFrameBoxThreeD@Hue \PstFrameBoxThreeD@Saturation \pst@tempb}%
690 \newhsbcolor{PstFrameBoxThreeD@ColorB}{%
691 \PstFrameBoxThreeD@Hue \PstFrameBoxThreeD@Saturation \pst@tempc}%
692 \fi
693 % \end{macrocode}
694 %
695 % If the \ColorPackage{} \LaTeX{} package was loaded, we will use it as
696 % color model.
697 %
698 % \begin{macrocode}
699 \else
700 \definecolor{PstFrameBoxThreeD@ColorC}{hsb}{%
701 \PstFrameBoxThreeD@Hue,\PstFrameBoxThreeD@Saturation,\pst@tempa}%
702 \ifPstFrameBoxThreeD@On
703 \definecolor{PstFrameBoxThreeD@ColorA}{hsb}{%
704 \PstFrameBoxThreeD@Hue,\PstFrameBoxThreeD@Saturation,\pst@tempc}%
705 \definecolor{PstFrameBoxThreeD@ColorB}{hsb}{%
706 \PstFrameBoxThreeD@Hue,\PstFrameBoxThreeD@Saturation,\pst@tempb}%
707 \else
708 \definecolor{PstFrameBoxThreeD@ColorA}{hsb}{%
709 \PstFrameBoxThreeD@Hue,\PstFrameBoxThreeD@Saturation,\pst@tempb}%
710 \definecolor{PstFrameBoxThreeD@ColorB}{hsb}{%
711 \PstFrameBoxThreeD@Hue,\PstFrameBoxThreeD@Saturation,\pst@tempc}%
712 \fi
713 \fi
714 % \end{macrocode}
715 %
716 % Now, we can \emph{really} draw the box and the borders.
717 %
718 % No lines here.
719 %
720 % \begin{macrocode}
721 \psset{linestyle=none}%
722 % \end{macrocode}
723 %
724 % We draw the material in a standard \cs{psframebox} macro, defining
725 % \texttt{doubleline} to \texttt{true}, to compute correctly the bounding box
726 % of the box with it borders.
727 %
728 % \begin{macrocode}
729 \psframebox[fillstyle=\PstFrameBoxThreeD@FillStyle,
730 fillcolor=PstFrameBoxThreeD@ColorC,doubleline=true]{#2}%
731 % \end{macrocode}
732 %
733 % We save the material to frame in an internal box, without the size of it
734 % borders.
735 %
736 % \begin{macrocode}
737 \setbox\pst@boxg=\hbox{\psframebox{#2}}%
738 % \end{macrocode}
739 %
740 % Then we save in another internal box the same thing, this time with the
741 % size of it borders.
742 %
743 % \begin{macrocode}
744 \setbox\pst@hbox=\hbox{\psframebox[doubleline=true]{#2}}%
745 % \end{macrocode}
746 %
747 % We compute the four internal coordinates for the borders.
748 %
749 % \begin{macrocode}
750 \pst@dima=\wd\pst@hbox
751 \advance\pst@dima-\wd\pst@boxg
752 \divide\pst@dima\tw@
753 % \end{macrocode}
754 %
755 % \begin{macrocode}
756 \pst@dimb=\pst@dima
757 % \end{macrocode}
758 %
759 % \begin{macrocode}
760 \advance\pst@dima\wd\pst@boxg
761 % \end{macrocode}
762 %
763 % Now, we can draw the borders, of course in a \texttt{solid} mode.
764 %
765 % \begin{macrocode}
766 \psset{fillstyle=solid}%
767 % \end{macrocode}
768 %
769 % We draw first the left then the top borders.
770 %
771 % \begin{macrocode}
772 \pspolygon[fillcolor=PstFrameBoxThreeD@ColorA]
773 (-\wd\pst@hbox,-\dp\pst@hbox)(-\pst@dima,-\dp\pst@boxg)
774 (-\pst@dima,\ht\pst@boxg)(-\wd\pst@hbox,\ht\pst@hbox)
775 \pspolygon[fillcolor=PstFrameBoxThreeD@ColorB]
776 (-\wd\pst@hbox,\ht\pst@hbox)(-\pst@dima,\ht\pst@boxg)
777 (-\pst@dimb,\ht\pst@boxg)(0,\ht\pst@hbox)
778 % \end{macrocode}
779 %
780 % We must compute the colors of the two other borders.
781 %
782 % \begin{macrocode}
783 \ifPstFrameBoxThreeD@Opposite
784 \def\pst@tempa{PstFrameBoxThreeD@ColorA}%
785 \def\pst@tempb{PstFrameBoxThreeD@ColorB}%
786 \else
787 \def\pst@tempa{PstFrameBoxThreeD@ColorB}%
788 \def\pst@tempb{PstFrameBoxThreeD@ColorA}%
789 \fi
790 % \end{macrocode}
791 %
792 % Now, we draw the right then the bottom borders.
793 %
794 % \begin{macrocode}
795 \pspolygon[fillcolor=\pst@tempa]
796 (0,-\dp\pst@hbox)(-\pst@dimb,-\dp\pst@boxg)
797 (-\pst@dimb,\ht\pst@boxg)(0,\ht\pst@hbox)
798 \pspolygon[fillcolor=\pst@tempb]
799 (-\wd\pst@hbox,-\dp\pst@hbox)(-\pst@dima,-\dp\pst@boxg)
800 (-\pst@dimb,-\dp\pst@boxg)(0,-\dp\pst@hbox)
801 % \end{macrocode}
802 %
803 % And, to finish, a dark oblique line in the middle of the light border and
804 % a light oblique line in the middle of the dark border, if the identical
805 % colors are contiguous.
806 %
807 % \begin{macrocode}
808 \ifPstFrameBoxThreeD@Opposite
809 \else
810 \psset{linestyle=solid,linewidth=0.2pt,arrows=cc-cc}%
811 \psline[linecolor=PstFrameBoxThreeD@ColorA]
812 (-\pst@dimb,\ht\pst@boxg)(0,\ht\pst@hbox)
813 \psline[linecolor=PstFrameBoxThreeD@ColorB]
814 (-\wd\pst@hbox,-\dp\pst@hbox)(-\pst@dima,-\dp\pst@boxg)
815 \fi}}
816 % \end{macrocode}
817 % \end{macro}
818 %
819 % \subsection{Closing}
820 %
821 % Catcodes restoration.
822 %
823 % \begin{macrocode}
824 \catcode`\@=\PstAtCode\relax
825 % \end{macrocode}
826 %
827 % \begin{macrocode}
828 %</pst-fr3d>
829 % \end{macrocode}
830 %
831 % \Finale
832 % \PrintIndex
833 % \PrintChanges
834 %
835 \endinput
836 %%
837 %% End of file `pst-fr3d.dtx'