Debian Codegraph @

texmf-dist/source/latex/productbox/productbox.dtx

raw
1 %\iffalse
2 %% Purpose:
3 %% productbox.dtx provides a style file for typesetting a
4 %% three-dimensional product box. This product box can be rendered
5 %% as it is standing on a surface and some light is shed onto it.
6 %% Alternatively it can be typeset as a wireframe to be cut out
7 %% and glued together. This will lead to a physical product box.
8 %%
9 %% Documentation:
10 %% The documentation can be generated from the original file
11 %% productbox.dtx with the doc style/package. LaTeX the file
12 %% productbox.dtx to get the full documentation in pdf format.
13 %%
14 %% Prerequisite:
15 %% This package needs TikZ to be present at least in version 2.0.
16 %%
17 %% Author: Gerd Neugebauer
18 %% Brechklinge 10
19 %% 69256 Mauer
20 %% Mail: [email protected]
21 %%
22 %% Copyright (C) 2010-2026 Gerd Neugebauer
23 %%
24 %% productbox.dtx is distributed in the hope that it will be useful,
25 %% but WITHOUT ANY WARRANTY. No author or distributor accepts
26 %% responsibility to anyone for the consequences of using it or for
27 %% whether it serves any particular purpose or works at all, unless
28 %% he says so in writing.
29 %%
30 %% Everyone is granted permission to copy, modify and redistribute
31 %% productbox.dtx, provided this copyright notice is preserved and
32 %% any modifications are indicated.
33 %%
34 %\fi
35 %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36 %
37 % \title{A \LaTeX\ Style for
38 % Typesetting a Three-Dimensional Product Box\thanks{This file
39 % documents \filename\ version \fileversion\
40 % (from revision \filerevision) as of \filedate.}}
41 % \author{Gerd Neugebauer\\\small
42 % Brechklinge 10\\\small
43 % 69256 Mauer (Germany)\\\small
44 % Email: \texttt{\href{mailto:[email protected]}{[email protected]}}}
45 % \date{{\footnotesize Documentation date: \filedate}}
46 % \hypersetup{pdftitle=A LaTeX Style for Typesetting a Three-Dimensional Product Box}
47 % \hypersetup{pdfauthor=Gerd Neugebauer}
48 % \hypersetup{pdfsubject=\filename\ version \fileversion\ as of \filedate}
49 % \maketitle
50 %
51 %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 % \changes{1.0}{2010/12/20}{First public release.}
53 % \changes{1.1}{2010/12/23}{Simplified user interface added.}
54 % \changes{1.2}{2026/05/17}{Contact updated.}
55 %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 %
57 % \DoNotIndex{\ ,\",\',\.,\[,\\,\],\^,\`,\~,\@,\@dottedtocline}
58 % \DoNotIndex{\@gobble,\@gobbletwo,\@ifnextchar,\@ifstar}
59 % \DoNotIndex{\@ifundefined,\@namedef,\@nameuse,\@tempdima,\@undefined}
60 % \DoNotIndex{\CurrentOption,\DeclareOption,\LARGE,\LaTeX,\Large}
61 % \DoNotIndex{\InputIfFileExists,\EnableCrossrefs,\DocInput}
62 % \DoNotIndex{\DeleteShortVerb,\CodelineIndex,\MacroFont}
63 % \DoNotIndex{\RecordChanges,\ProvidesPackage,\NeedsTeXFormat}
64 % \DoNotIndex{\LoadClass,\OptionNotUsed,\PassOptionsToClass}
65 % \DoNotIndex{\ProcessOptions,\ProvidesClass,\RequirePackage,\TeX}
66 % \DoNotIndex{\addcontentsline,\advance}
67 % \DoNotIndex{\begin,\begingroup,\bf,\bgroup,\egroup}
68 % \DoNotIndex{\bigskip,\box,\clearpage,\color,\csname}
69 % \DoNotIndex{\def,\definecolor,\dimen,\divide,\documentclass,\dp}
70 % \DoNotIndex{\else,\empty,\end,\endcsname,\endgroup,\endinput}
71 % \DoNotIndex{\expandafter,\fbox,\fi,\framebox}
72 % \DoNotIndex{\futurelet,\gdef,\global,\gobble,\hbox,\hfil}
73 % \DoNotIndex{\hfill,\hrule,\hskip,\hspace,\hss,\huge}
74 % \DoNotIndex{\ifdim,\ifx,\ignorespaces,\immediate,\index,\it}
75 % \DoNotIndex{\kern,\large,\let,\long,\lower}
76 % \DoNotIndex{\makebox,\makeindex,\markboth,\mbox,\medskip}
77 % \DoNotIndex{\newblock,\newcommand,\newcount,\newenvironment,\newfont}
78 % \DoNotIndex{\newif,\newpage,\nobreak,\noindent,\normalsize,\null}
79 % \DoNotIndex{\or,\pagestyle,\par,\paragraph,\parbox}
80 % \DoNotIndex{\parfillskip,\parindent,\parsep,\parskip,\partopsep}
81 % \DoNotIndex{\relax,\renewcommand,\renewenvironment,\rm,\rule}
82 % \DoNotIndex{\sbox,\sc,\setcounter,\settowidth,\sf,\sfcode,\sl}
83 % \DoNotIndex{\small,\space,\string,\symbol}
84 % \DoNotIndex{\the,\thepage,\thispagestyle}
85 % \DoNotIndex{\topmargin,\topsep,\tt,\typeout}
86 % \DoNotIndex{\unitlength,\usecounter,\varepsilon,\vbox}
87 % \DoNotIndex{\vfill,\vsize,\vskip,\vspace,\vss,\xdef}
88 % \DoNotIndex{\usetikzlibrary,\usepackage,\tikzfading,\setkeys}
89 % \DoNotIndex{\setbox,\scalebox}
90 % \DoNotIndex{\newbox,\ignorespacesafterend,\foreach,\filldraw}
91 % \DoNotIndex{\fill,\errmessage,\draw,\define@key,\copy,\clip}
92 %
93 %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 % \CheckSum{1026}
95 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96 %% \CharacterTable
97 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
98 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
99 %% Digits \0\1\2\3\4\5\6\7\8\9
100 %% Exclamation \! Double quote \" Hash (number) \#
101 %% Dollar \$ Percent \% Ampersand \&
102 %% Acute accent \' Left paren \( Right paren \)
103 %% Asterisk \* Plus \+ Comma \,
104 %% Minus \- Point \. Solidus \/
105 %% Colon \: Semicolon \; Less than \<
106 %% Equals \= Greater than \> Question mark \?
107 %% Commercial at \@ Left bracket \[ Backslash \\
108 %% Right bracket \] Circumflex \^ Underscore \_
109 %% Grave accent \` Left brace \{ Vertical bar \|
110 %% Right brace \} Tilde \~}
111 %%
112 %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113 %
114 % \newcommand\TikZ{Ti\textit{k}Z}
115 %
116 % \begin{abstract}
117 % The package \texttt{productbox} provides a style file for
118 % typesetting a three-dimensional product box. This product box
119 % can be rendered as it is standing on a surface and some light
120 % is shed onto it. Alternatively it can be typeset as a wireframe
121 % to be cut out and glued together. This will lead to a physical
122 % product box.
123 % \end{abstract}
124 %
125 % \begin{center}%
126 % \def\PB(#1,#2)#3{
127 % \draw[xshift=-.2mm,yshift=.2mm] (#1,#2) node[white,opacity=.9]{#3};
128 % \draw[xshift=.2mm,yshift=-.2mm] (#1,#2) node[black,opacity=.9]{#3};
129 % \draw (#1,#2) node[blue]{#3};
130 % }%
131 % \begin{ProductBox}[mirror=true,flare=true,scale=.6]
132 % \begin{Front}
133 % \shade [top color=yellow!20!red,bottom color=yellow!80!red]
134 % rectangle (88mm,100mm);
135 % \PB(44mm,85mm){\Huge\bf Product Box}
136 % \draw (77mm,90mm) node[circle,ball color=white,rotate=330]{\small\bf\fileversion};
137 % \draw (44mm,75mm) node{A \LaTeX\ package for just another kind of boxes};
138 %
139 % \foreach \x in {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16} {
140 % \count0=\x \multiply\count0 4
141 % \draw [red,line width=.2mm]
142 % (0mm,0 mm) .. controls (88mm,\the\count0 mm) and (\x mm,66mm) ..
143 % (88mm,\the\count0 mm);
144 % \draw [xshift=.4mm,white,line width=.2mm,opacity=.5]
145 % (0mm,0 mm) .. controls (88mm,\the\count0 mm) and (\x mm,66mm) ..
146 % (88mm,\the\count0 mm);
147 % }
148 %
149 % \clip (0mm,0mm) .. controls (88mm,64mm) and (16mm,66mm) ..
150 % (88mm,64mm) -- (88mm,100mm) -- (0mm,100mm) -- cycle;
151 % \draw (4mm,66mm) node [white!30!black,anchor=north west] {
152 % \begin{minipage}{160mm}\tt\tiny\raggedright
153 % |\usepackage{productbox}|\\
154 % | |\\
155 % | |\\
156 % |\begin{ProductBox}[scale=.8]|\\
157 % | \begin{Front}|\\
158 % | \shade [top color=yellow!20!red,bottom color=yellow!80!red]|\\
159 % | rectangle (88mm,100mm);|\\
160 % | \PB(44mm,85mm){\Huge\bf Product Box}|\\
161 % | \draw (77mm,90mm) node[circle,ball color=white]{\small\bf\fileversion};|\\
162 % | \draw (44mm,75mm) node{A \LaTeX\ package for just another kind of boxes};|\\
163 % ||\\
164 % | \foreach \x in {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16} {|\\
165 % | \count0=\x \multiply\count0 4|\\
166 % | \draw [red,line width=.2mm]|\\
167 % | (0mm,0 mm) .. controls (88mm,\the\count0 mm) and (\x mm,66mm) ..|\\
168 % | (88mm,\the\count0 mm);|\\
169 % | \draw [xshift=.4mm,white,line width=.2mm,opacity=.5]|\\
170 % | (0mm,0 mm) .. controls (88mm,\the\count0 mm) and (\x mm,66mm) ..|\\
171 % | (88mm,\the\count0 mm);|\\
172 % | }|\\
173 % | \clip (0mm,0mm) .. controls (88mm,64mm) and (16mm,66mm) ..|\\
174 % | (88mm,64mm) -- (88mm,100mm) -- (0mm,100mm) -- cycle;|\\
175 % | \end{Front}|\\
176 % | \begin{Top}|\\
177 % | \shade [outer color=yellow!20!red,inner color=yellow!80!red]|\\
178 % | rectangle (88mm,30mm);|\\
179 % | \PB(44mm,15mm){\huge\bf Product Box}|\\
180 % | \draw (77mm,20mm)|\\
181 % | node[circle,ball color=white,rotate=330]{\small\bf\fileversion};|\\
182 % | \end{Top}|\\
183 % \end{minipage}};
184 % \end{Front}
185 % \begin{Top}
186 % \shade [outer color=yellow!20!red,inner color=yellow!80!red]
187 % rectangle (88mm,30mm);
188 % \PB(44mm,15mm){\huge\bf Product Box}
189 % \draw (77mm,20mm)
190 % node[circle,ball color=white,rotate=330]{\small\bf\fileversion};
191 % \end{Top}
192 % \begin{Bottom}
193 % \shade [outer color=yellow!20!red,inner color=yellow!80!red]
194 % rectangle (88mm,30mm);
195 % \end{Bottom}
196 % \begin{Left}
197 % \fill [top color=yellow!20!red,bottom color=yellow!80!red]
198 % rectangle (30mm,100mm);
199 % \PB(15mm,90mm){
200 % \begin{minipage}{25mm}\centering
201 % \Large\bf Product Box
202 % \end{minipage}}
203 % \draw (15mm,25mm) node {
204 % \begin{minipage}{25mm}\sf\tiny\raggedright\parskip=.75ex
205 % Copyright (C) 2010 Gerd Neugebauer
206 %
207 % productbox.dtx is distributed in the hope that it will be useful,
208 % but WITHOUT ANY WARRANTY. No author or distributor accepts
209 % responsibility to anyone for the consequences of using it or for
210 % whether it serves any particular purpose or works at all, unless
211 % he says so in writing.
212 %
213 % Everyone is granted permission to copy, modify and redistribute
214 % productbox.dtx, provided this copyright notice is preserved and
215 % any modifications are indicated.
216 % \end{minipage}};
217 % \end{Left}
218 % \begin{Right}
219 % \fill [top color=yellow!20!red,bottom color=yellow!80!red]
220 % rectangle (30mm,100mm);
221 % \PB(15mm,90mm){
222 % \begin{minipage}{25mm}\centering
223 % \Large\bf Product Box
224 % \end{minipage}}
225 % \end{Right}
226 % \end{ProductBox}
227 % \end{center}
228 %
229 % \newpage
230 % \tableofcontents
231 % \newpage
232 %
233 % \section{Introduction}
234 %
235 % Humans are tied to the physical world. Even in the age of
236 % software it is desirable to have a physical representation for
237 % it. In the commercial world the software is sold in product boxes
238 % containing a CD or DVD and printed documentation.
239 %
240 % But even for open source software having a product box provides a
241 % means to associate a physical object with the more or less
242 % virtual entity ``software''.
243 %
244 % There are many programs around devoted to producing layouts for
245 % product boxes. Each graphics program can be used for this purpose
246 % as well. Nevertheless the integration of material from the \TeX\
247 % world is not that easy.
248 %
249 % The \LaTeX\ package |productbox| is an attempt to use the
250 % possibilities for \LaTeX\ and some packages to provide a means
251 % for typesetting the faces of a product box and assemble them into
252 % a three-dimensional image.
253 %
254 % Note that this ``image'' is in fact a \textsc{pdf} object. It can
255 % be scaled without loss of quality\footnote{unless some pixel
256 % images have been included}. It is also possible to extract
257 % the text from the product box by cut and paste in an appropriate
258 % \textsc{pdf} reader.
259 %
260 %
261 % \section{The User Interface}
262 %
263 % The \LaTeX\ style |productbox| is based on \TikZ{} at
264 % \cite{tikz-manual} least in version~2.0. It is best used with a
265 % \LaTeX\ variant which is able to produce \textsc{pdf}. If no
266 % proper tool chain is used then some of the effects should not be
267 % used.
268 %
269 % \DescribeEnv{ProductBox}
270 % The environment |ProductBox| provides the central means for
271 % producing a product box. The contents is used to define the
272 % appearance of the faces. Finally the selected type of output is
273 % produced.
274 %
275 % The content of the environment consists mainly of the definition
276 % of the six faces. Not all of them need to be defined. If one face
277 % is not defined then it appears as an empty rectangle of white
278 % color.
279 %
280 % Thus you usually want to define the faces. Two approaches are
281 % provided to define the content of the faces. The simplified
282 % interface does not really require any knowledge of the underlying
283 % \TikZ{} package. Just some knowledge of \LaTeX\ is sufficient.
284 % The extended interface opens the full power to the user. Both
285 % interface types can be freely intermixed. The tow kinds of
286 % interfaces are described in section~\ref{sec:simplified}
287 % and~\ref{sec:extended}.
288 %
289 % The environment |ProductBox| can be controlled with a number of
290 % optional parameters. Those parameters are described in
291 % section~\ref{sec:options}.
292 %
293 %
294 % \subsection{The Simplified User Interface}\label{sec:simplified}
295 %
296 % The simplified user interface is meant for someone not familiar
297 % with \TikZ. It encapsulates nearly anything and relies on just
298 % some basic \LaTeX\ experience. As a downside the functionality is
299 % restricted. Any fancy artwork on the box background can hardly be
300 % achieved.
301 %
302 % The following example shows a complete -- even rather useless --
303 % definition of a product box with the simplified user interface.
304 %
305 % \noindent
306 % {\advance\textwidth-\fboxsep \advance\textwidth-\fboxsep
307 % \advance\textwidth-\fboxrule \advance\textwidth-\fboxrule
308 % \setbox127\hbox\bgroup\begin{minipage}{\textwidth}\footnotesize
309 % |\begin{ProductBox}|\\
310 % | \begin{FrontFace}[bottom color=white!30!blue,top color=white]|\\
311 % | \Huge Product Box|\\
312 % | \end{FrontFace}|\\
313 % | \begin{BackFace}[top color=yellow!30!red,bottom color=white]|\\
314 % | \large Back Face|\\
315 % | \end{BackFace}|\\
316 % | \begin{TopFace}[outer color=white!30!red,inner color=white]|\\
317 % | \large Top Face|\\
318 % | \end{TopFace}|\\
319 % | \begin{BottomFace}[outer color=red,inner color=black]|\\
320 % | \large Bottom Face|\\
321 % | \end{BottomFace}|\\
322 % | \begin{LeftFace}[left color=green,right color=yellow]|\\
323 % | \large Left Face|\\
324 % | \end{LeftFace}|\\
325 % | \begin{RightFace}[left color=white,right color=black]|\\
326 % | \large Right Face|\\
327 % | \end{RightFace}|\\
328 % |\end{ProductBox}|
329 % \end{minipage}\egroup
330 % \fcolorbox{red!30!black}{yellow!30!white}{\box127}}
331 %
332 % \newcommand\simpleSample[1]{%
333 % \begin{ProductBox}[scale=.25,#1]
334 % \begin{FrontFace}[bottom color=white!30!blue,top color=white]
335 % \Huge Product Box
336 % \end{FrontFace}
337 % \begin{BackFace}[top color=yellow!30!red,bottom color=white]
338 % \large Back Face
339 % \end{BackFace}
340 % \begin{TopFace}[outer color=white!30!red,inner color=white]
341 % \large Top Face
342 % \end{TopFace}
343 % \begin{BottomFace}[outer color=red,inner color=black]
344 % \large Bottom Face
345 % \end{BottomFace}
346 % \begin{LeftFace}[left color=green,right color=yellow]
347 % \large Left Face
348 % \end{LeftFace}
349 % \begin{RightFace}[left color=white,right color=black]
350 % \large Right Face
351 % \end{RightFace}
352 % \end{ProductBox}%
353 % }
354 %
355 % This code renders as
356 %
357 % \begin{center}\simpleSample{}\end{center}
358 % \newcommand\SampleEnv[1]{\noindent\par
359 % \fcolorbox{red!30!black}{yellow!30!white}{\begin{minipage}[b]{.98\textwidth}\footnotesize\tt
360 % \textcolor{blue}{\char92begin}\char123#1\char125\\
361 % \hspace*{2em}...\\
362 % \textcolor{blue}{\char92end}\char123#1\char125
363 % \end{minipage}}\par}
364 %
365 % The content of the environment |ProductBox| is simply evaluated.
366 % It can contain any code you like. Useful for the production of a
367 % product box are some inner environments. They are called
368 % |FrontFace|, |BackFace|, |LeftFace|, |RightFace|, |TopFace|, and
369 % |BottomFace|. They are defined inside the main environment
370 % only. Those environments can be used to specify the contents of
371 % the respective faces of the box.
372 %
373 % Note that in the three-dimensional rendering will show at most
374 % three of the faces. It does not hurt to define all of them, even
375 % if they are not shown at all.
376 %
377 % \DescribeEnv{FrontFace}
378 % The environment |FrontFace| is used to define the content of
379 % the font face. The environment processes its contents inside a
380 % |minipage| of the default width 88\,mm reduced by the left and
381 % right separator width (|faceSep|).
382 %
383 % The minipage is centered vertically on the face.
384 % Usually anything extending the default height of 100\,mm is
385 % clipped.
386 %
387 % \SampleEnv{FrontFace}
388 %
389 % \DescribeEnv{BackFace}
390 % The environment |BackFace| is used to define the content of
391 % the back face. The environment processes its contents inside a
392 % |minipage| of the default width 88\,mm reduced by the left and
393 % right separator width (|faceSep|).
394 %
395 % The minipage is centered vertically on the face.
396 % Usually anything extending the default height of 100\,mm is
397 % clipped.
398 %
399 % \SampleEnv{BackFace}
400 %
401 % \DescribeEnv{LeftFace}
402 % The environment |LeftFace| is used to define the content of
403 % the left face. The environment processes its contents inside a
404 % |minipage| of the default width 100\,mm reduced by the left and
405 % right separator width (|faceSep|).
406 %
407 % The minipage is centered vertically on the face.
408 % Usually anything extending the default height of 30\,mm is
409 % clipped.
410 %
411 % \SampleEnv{LeftFace}
412 %
413 % \DescribeEnv{RightFace}
414 % The environment |RightFace| is used to define the content of
415 % the right face. The environment processes its contents inside a
416 % |minipage| of the default width 100\,mm reduced by the left and
417 % right separator width (|faceSep|).
418 %
419 % The minipage is centered vertically on the face.
420 % Usually anything extending the default height of 30\,mm is
421 % clipped.
422 %
423 % \SampleEnv{RightFace}
424 %
425 % \DescribeEnv{TopFace}
426 % The environment |TopFace| is used to define the content of
427 % the top face. The environment processes its contents inside a
428 % |minipage| of the default width 88\,mm reduced by the left and
429 % right separator width (|faceSep|).
430 %
431 % The minipage is centered vertically on the face.
432 % Usually anything extending the default height of 30\,mm is
433 % clipped.
434 %
435 % \SampleEnv{TopFace}
436 %
437 % \DescribeEnv{BottomFace}
438 % The environment |BottomFace| is used to define the content of
439 % the bottom face. The environment processes its contents inside a
440 % |minipage| of the default width 88\,mm reduced by the left and
441 % right separator width (|faceSep|).
442 %
443 % The minipage is centered vertically on the face.
444 % Usually anything extending the default height of 30\,mm is
445 % clipped.
446 %
447 % \SampleEnv{BottomFace}
448 %
449 % \newcommand\Sample[1]{
450 % \noindent
451 % \fcolorbox{red!30!black}{yellow!30!white}{\begin{minipage}[b]{.8\textwidth}\footnotesize\tt
452 % \textcolor{blue}{\char92begin}\char123ProductBox\char125 \\
453 % \hspace*{2em}\textcolor{blue}{\char92begin}\char123FrontFace\char125\\
454 % \hspace*{4em}\textcolor{red}{[#1]}\\
455 % \hspace*{4em}...\\
456 % \hspace*{2em}\textcolor{blue}{\char92end}\char123FrontFace\char125\\
457 % \hspace*{2em}...\\
458 % \textcolor{blue}{\char92end}\char123ProductBox\char125
459 % \end{minipage}}\hfill
460 % \begin{minipage}[b]{.18\textwidth}\hfill
461 % \begin{ProductBox}[front,scale=.2]
462 % \begin{FrontFace}[#1] \end{FrontFace}
463 % \end{ProductBox}
464 % \end{minipage}\medskip\par
465 % }%
466 % Any of the face defining environments described above can take an
467 % optional argument. This argument is used to specify the
468 % background. In the simplest case you just have one background
469 % color. This is specified with the keyword |color|.
470 %
471 % \Sample{color=yellow}
472 %
473 % Colors in \TikZ{} are either one of the named colors or a
474 % composition of those colors. The notation |red!60!blue| denotes
475 % the color by mixing 60\% red and 40\% blue.
476 %
477 % \Sample{color=red!60!blue}
478 %
479 % By mixing in black or white you can come to a lighter or darker
480 % color.
481 %
482 % \Sample{color=red!20!white}
483 %
484 % A fading from top to bottom can be specified with two
485 % colors named |top color| and |bottom color|.
486 %
487 % \Sample{top color=red!50!blue,bottom color=yellow}
488 %
489 % A fading from left to right can be specified with two
490 % colors named |left color| and |left color|.
491 %
492 % \Sample{left color=red!50!blue,right color=yellow}
493 %
494 % The parameter |middle color| can be used in horizontal or
495 % vertical fading to specifying the color in the middle. Note thta
496 % it has to be specified after the other colors!
497 %
498 % \Sample{top color=red,bottom color=yellow,middle color=blue}
499 %
500 % A circular fading can be specified with the color names
501 % |inner color| and |outer color|.
502 %
503 % \Sample{inner color=red,outer color=yellow}
504 %
505 %
506 % \subsection{The Extended User Interface}\label{sec:extended}
507 %
508 % The extended user interface allows you to use all features of
509 % \TikZ. For this purpose another set of face defining environments
510 % is provided which process their content in a |tikzpicture|
511 % environment.
512 %
513 % The following example shows a complete example of a product box
514 % with the extended user interface. This example is used below to
515 % demonstrate the effect of the differnt options.
516 %
517 % \noindent
518 % {\advance\textwidth-\fboxsep \advance\textwidth-\fboxsep
519 % \advance\textwidth-\fboxrule \advance\textwidth-\fboxrule
520 % \setbox127\hbox\bgroup\begin{minipage}{.98\textwidth}\footnotesize\raggedright
521 % |\begin{ProductBox}\sf|\\
522 % | \begin{Front}|\\
523 % | \fill [top color=white!30!blue,bottom color=white]|\\
524 % | rectangle (88mm,100mm);|\\
525 % | \fill [bottom color=white!40!blue,top color=white!90!blue]|\\
526 % | (0mm,0mm) -- (44mm,90mm) -- (88mm,0mm) -- cycle;|\\
527 % | \draw (44mm,40mm) node{\Huge Product Box};|\\
528 % | \end{Front}|\\
529 % | \begin{Back}|\\
530 % | \fill [top color=yellow!30!red,bottom color=white]|\\
531 % | rectangle (88mm,100mm);|\\
532 % | \fill [top color=white,bottom color=blue]|\\
533 % | (0mm,0mm) -- (88mm,100mm) -- (0mm,100mm) --cycle;|\\
534 % | \draw (44mm,50mm) node{\large Back};|\\
535 % | \end{Back}|\\
536 % | \begin{Top}|\\
537 % | \fill [outer color=white!30!red,inner color=white]|\\
538 % | rectangle (88mm,30mm);|\\
539 % | \draw[white,thick] (0mm,5mm) -- (88mm,25mm);|\\
540 % | \draw (44mm,15mm) node{\large Top};|\\
541 % | \end{Top}|\\
542 % | \begin{Bottom}|\\
543 % | \fill [outer color=red!30!white,inner color=black]|\\
544 % | rectangle (88mm,30mm);|\\
545 % | \draw[white] (44mm,15mm) node{\large Bottom};|\\
546 % | \end{Bottom}|\\
547 % | \begin{Left}|\\
548 % | \fill [left color=green,right color=yellow]|\\
549 % | rectangle (30mm,100mm);|\\
550 % | \draw (15mm,50mm) node{\large Left};|\\
551 % | \end{Left}|\\
552 % | \begin{Right}|\\
553 % | \fill [top color=green,bottom color=yellow]|\\
554 % | rectangle (30mm,100mm);|\\
555 % | \draw (15mm,50mm) node{\large Right};|\\
556 % | \end{Right}|\\
557 % |\end{ProductBox}|
558 % \end{minipage}\egroup
559 % \fcolorbox{red!30!black}{yellow!30!white}{\box127}}
560 % \newcommand\sample[1]{%
561 % \begin{ProductBox}[scale=.25,#1]\sf
562 % \begin{Front}
563 % \fill [top color=white!30!blue,bottom color=white]
564 % rectangle (88mm,100mm);
565 % \fill [bottom color=white!40!blue,top color=white!90!blue]
566 % (0mm,0mm) -- (44mm,90mm) -- (88mm,0mm) -- cycle;
567 % \draw (44mm,40mm) node{\Huge Product Box};
568 % \end{Front}
569 % \begin{Back}
570 % \fill [top color=blue,bottom color=white]
571 % rectangle (88mm,100mm);
572 % \fill [top color=white,bottom color=blue]
573 % (0mm,0mm) -- (88mm,100mm) -- (0mm,100mm) --cycle;
574 % \draw (44mm,50mm) node{\large Back};
575 % \end{Back}
576 % \begin{Top}
577 % \fill [outer color=white!30!red,inner color=white]
578 % rectangle (88mm,30mm);
579 % \draw[white,thick] (0mm,5mm) -- (88mm,25mm);
580 % \draw (44mm,15mm) node{\large Top};
581 % \end{Top}
582 % \begin{Bottom}
583 % \fill [outer color=red!30!white,inner color=black]
584 % rectangle (88mm,30mm);
585 % \draw[white] (44mm,15mm) node{\large Bottom};
586 % \end{Bottom}
587 % \begin{Left}
588 % \fill [left color=green,right color=yellow]
589 % rectangle (30mm,100mm);
590 % \draw (15mm,50mm) node{\large Left};
591 % \end{Left}
592 % \begin{Right}
593 % \fill [top color=green,bottom color=yellow]
594 % rectangle (30mm,100mm);
595 % \draw (15mm,50mm) node{\large Right};
596 % \end{Right}
597 % \end{ProductBox}%
598 % }
599 %
600 % The content of the environment is simply expanded. It may contain
601 % any code you like -- except an |ProductBox| environment. Useful
602 % for the production of a product box are some inner environments.
603 % They are called |Front|, |Back|, |Left|, |Right|, |Top|, and
604 % |Bottom|. They are defined inside the main
605 % environment only. Those environments can be used to specify the
606 % contents of the respective faces of the box.
607 %
608 % Note that in the three-dimensional rendering will show at most
609 % three of the faces. It does not hurt to define all of them, even
610 % if they are not shown at all.
611 %
612 % \DescribeEnv{Front}
613 % The environment |Front| is used to define the content of
614 % the font face. The environment processes its contents inside a
615 % |tikzpicture| of the default size 88\,mm$\times$100\,mm.
616 % Usually anything outside of this range is clipped.
617 %
618 % \SampleEnv{Front}
619 %
620 % \DescribeEnv{Back}
621 % The environment |Back| is used to define the content of
622 % the back face. The environment processes its contents inside a
623 % |tikzpicture| of the default size 88\,mm$\times$100\,mm.
624 % Usually anything outside of this range is clipped.
625 %
626 % \SampleEnv{Back}
627 %
628 % \DescribeEnv{Left}
629 % The environment |Left| is used to define the content of
630 % the left face, i.e. the face left to the front page. The
631 % environment processes its contents inside a |tikzpicture|
632 % of the default size 30\,mm$\times$100\,mm. Usually anything
633 % outside of this range is clipped.
634 %
635 % \SampleEnv{Left}
636 %
637 % \DescribeEnv{Right}
638 % The environment |Right| is used to define the content of
639 % the right face, i.e. the face right to the front page. The
640 % environment processes its contents inside a |tikzpicture|
641 % of the default size 30\,mm$\times$100\,mm. Usually anything
642 % outside of this range is clipped.
643 %
644 % \SampleEnv{Right}
645 %
646 % \DescribeEnv{Top}
647 % The environment |Top| is used to define the content of the
648 % top face. The environment processes its contents inside a
649 % |tikzpicture| of the default size 88\,mm$\times$30\,mm. Usually
650 % anything outside of this range is clipped.
651 %
652 % \SampleEnv{Top}
653 %
654 % \DescribeEnv{Bottom}
655 % The environment |Bottom| is used to define the content of the
656 % top face. The environment processes its contents inside a
657 % |tikzpicture| of the default size 88\,mm$\times$30\,mm. Usually
658 % anything outside of this range is clipped.
659 %
660 % \SampleEnv{Bottom}
661 %
662 %
663 % \subsection{Settings and Options of the Main Environment}\label{sec:options}
664 %
665 % The environment |ProductBox| can take some options to
666 % influence the appearance of the product box. Those options are
667 % comma separated.
668 %
669 % \def\CODE#1{
670 % \noindent
671 % \fcolorbox{red!30!black}{yellow!30!white}{\begin{minipage}[b]{.98\textwidth}\footnotesize\tt
672 % #1
673 % \end{minipage}\medskip\par
674 % }}%
675 % \CODE{\textcolor{blue}{\char92begin}\char123ProductBox\char125[shape=3d]}
676 %
677 % The settings are local to the main environment. If an option is not
678 % set then the fallback from the global settings are used.
679 %
680 % \DescribeMacro{\ProductBoxSet}
681 % The macro |\ProductBoxSet| modifies the global setting of the
682 % product box style. The arguments are the same as the optional
683 % arguments of the environment |ProductBox| -- but enclosed
684 % in braces instead of brackets.
685 %
686 % \CODE{\char92ProductBoxSet\char123shape=3d\char125 }
687 %
688 % The following options can be used to influence the result of the product
689 % box.
690 %
691 % \newcommand\SAMPLE[1]{
692 % \noindent
693 % \fcolorbox{red!30!black}{yellow!30!white}{\begin{minipage}[b]{.45\textwidth}\footnotesize\tt\raggedright
694 % \def\x{#1}%
695 % \def\e{}%
696 % \textcolor{blue}{\char92begin}\char123ProductBox\char125 \ifx\x\e\else\textcolor{red}{[#1]}\fi\\
697 % \hspace*{2em}\textcolor{blue}{\char92begin}\char123Front\char125\\
698 % \hspace*{4em}...\\
699 % \hspace*{2em}\textcolor{blue}{\char92end}\char123Front\char125\\
700 % \hspace*{2em}\textcolor{blue}{\char92begin}\char123Left\char125\\
701 % \hspace*{4em}...\\
702 % \hspace*{2em}\textcolor{blue}{\char92end}\char123Left\char125\\
703 % \hspace*{2em}...\\
704 % \textcolor{blue}{\char92end}\char123ProductBox\char125
705 % \end{minipage}}\hfill
706 % \begin{minipage}[b]{.53\textwidth}\hfill
707 % \sample{#1}
708 % \end{minipage}\medskip\par
709 % }%
710 %
711 % \DescribeMacro{style}
712 % The box style determines, how the box is drawn. Several rendering
713 % functions are provided to produce different effects. Any value is
714 % accepted. Unknown box styles will lead to an error message.
715 %
716 % \SAMPLE{style=3D}
717 %
718 % \DescribeMacro{3D}
719 % The box style |3D| is the default. It produces a
720 % three-dimensional view of the box. The option |3D| is an
721 % abbreviation for |style=3D|. It can also be written as |3d| or
722 % |threeD|.
723 %
724 % \SAMPLE{}
725 %
726 % \DescribeMacro{shadow}
727 % The option |shadow| controls the drawing of the drop shadow in the
728 % 3D rendering. It is a boolean value taking the values |true| and
729 % |false|. The default value is |true|.
730 %
731 % The option |shadow| is the abbreviation for |shadow=true|.
732 %
733 % \SAMPLE{shadow=false}
734 %
735 % \DescribeMacro{mirror}
736 % The option |mirror| controls the rendering of the mirror effect in
737 % the 3D rendering. It is a boolean value taking the values |true| and
738 % |false|. The default value is |false|.
739 %
740 % The option |mirror| is the abbreviation for |mirror=true|.
741 %
742 % \SAMPLE{mirror=true}
743 %
744 % \DescribeMacro{flare}
745 % The option |flare| controls the rendering of the flare effect in
746 % the 3D~rendering. The flare is a circular relection of the light
747 % source in the upper right corner of the front face. The option is
748 % a boolean value taking the values |true| and |false|. The default
749 % value is |false|.
750 %
751 % The option |flare| is the abbreviation for |flare=true|.
752 %
753 % \SAMPLE{flare=true}
754 %
755 % \DescribeMacro{flareDiameter}
756 % The option |flareDiameter| takes a dimension which defines the
757 % diameter of the flare effect in the 3D~rendering. The default
758 % value is 24\,mm.
759 %
760 % \SAMPLE{flare=true, flareDiameter=60mm}
761 %
762 % Internally the 3D rendering uses a |tikzpicture|. You can expand
763 % your own code either at the beginning or at the end of this
764 % environment. This can be achieved by overwriting a macro.
765 %
766 % \DescribeMacro{ProductBoxThreeDStartHook}
767 % The macro |ProductBoxThreeDStartHook| contains code to be
768 % expanded at the beginning of the 3D rendering. Initially it is
769 % defined as empty.
770 %
771 % \noindent
772 % \fcolorbox{red!30!black}{yellow!30!white}{\begin{minipage}[b]{.49\textwidth}\footnotesize\tt\raggedright
773 % \textcolor{blue}{\char92renewcommand}\char92ProductBoxThreeDStartHook\char123\\
774 % \hspace*{2em}\char92 filldraw[yscale=.4,\\
775 % \hspace*{6em} shift=\char123(30mm,4mm)\char125,\\
776 % \hspace*{6em} color=white,\\
777 % \hspace*{6em} inner color=white!70!blue,\\
778 % \hspace*{6em} outer color=white]\\
779 % \hspace*{4em} circle (120mm);\\
780 % \char125\\
781 % \textcolor{blue}{\char92begin}\char123ProductBox\char125\\
782 % \hspace*{2em}...\\
783 % \textcolor{blue}{\char92end}\char123ProductBox\char125
784 % \end{minipage}}\hfill\hspace*{-4pt}
785 % \begin{minipage}[b]{.5\textwidth}\hfill
786 % \renewcommand\ProductBoxThreeDStartHook{
787 % \filldraw[yscale=.4,
788 % shift={(30mm,4mm)},
789 % color=white,
790 % inner color=white!80!blue,
791 % outer color=white] circle (120mm);
792 % }
793 % \sample{}
794 % \end{minipage}\hspace*{-3pt}\medskip\par
795 %
796 % \DescribeMacro{ProductBoxThreeDEndHook}
797 % The macro |ProductBoxThreeDEndHook| contains code to be
798 % expanded at the end of the 3D rendering. Initially it is
799 % defined as empty.
800 %
801 % \DescribeMacro{fold}
802 % The option |fold| switches to the box style for rendering a
803 % complete wire frame with all faces in place. The option
804 % |fold| is an abbreviation for |style=fold|.
805 %
806 % \SAMPLE{fold}
807 %
808 % The top face is printed on the left and right top ear as well.
809 % This should avoid a break in the pattern when the box is
810 % partially opened. The same principle applis for the glue ear on
811 % the right side and the bottom.
812 %
813 % The bottom is formed in a way to maiximize stability without the
814 % need to glue. In addition numbers are printed on the parts of the
815 % bottom indicating the sequence in which the parts should be
816 % closed.
817 %
818 % \DescribeMacro{earSize}
819 % The option |earSize| takes a dimension which defines the
820 % width of the ears in the fold rendering. The ears around the top
821 % are this wide. The width of the glueing ear is half of this size.
822 % The default value is 12\,mm.
823 %
824 % \SAMPLE{fold,earSize=30mm}
825 %
826 % Note that the ear size must not exceed the width of the left
827 % face, the width of the front face, and the heiht of the box.
828 % Otherwise funny effects in the ears will happen.
829 %
830 % \DescribeMacro{foldLine}
831 % The option |foldLine| takes a specification for the line
832 % surrounding the fold drawing. Usally you want to simply use a
833 % color like ``gray'' or ``red''. The default is a kind of gray.
834 %
835 % \SAMPLE{fold,foldLine=red}
836 %
837 % \DescribeMacro{foldOpacity}
838 % The option |foldOpacity| takes a fraction for the opacity of the line
839 % surrounding the fold drawing. The default is |0.5|. If you want
840 % to let the fold lines disappear then use a value of 1.
841 %
842 % \SAMPLE{fold,foldOpacity=0}
843 %
844 % \DescribeMacro{front}
845 % The option |front| switches to the box style for rendering the
846 % front face only. The option |front| is an abbreviation for
847 % |style=front|.
848 %
849 % \SAMPLE{front}
850 %
851 % \DescribeMacro{back}
852 % The option |back| switches to the box style for rendering the
853 % back face only. The option |back| is an abbreviation for
854 % |style=back|.
855 %
856 % \SAMPLE{back}
857 %
858 % \DescribeMacro{left}
859 % The option |left| switches to the box style for rendering the
860 % left face only. The option |left| is an abbreviation for
861 % |style=left|.
862 %
863 % \SAMPLE{left}
864 %
865 % \DescribeMacro{right}
866 % The option |right| switches to the box style for rendering the
867 % right face only. The option |right| is an abbreviation for
868 % |style=right|.
869 %
870 % \SAMPLE{right}
871 %
872 % \DescribeMacro{top}
873 % The option |top| switches to the box style for rendering the
874 % top face only. The option |top| is an abbreviation for
875 % |style=top|.
876 %
877 % \SAMPLE{top}
878 %
879 % \DescribeMacro{bottom}
880 % The option |bottom| switches to the box style for rendering the
881 % face only. The option |bottom| is an abbreviation for
882 % |style=bottom|.
883 %
884 % \SAMPLE{bottom}
885 %
886 % \DescribeMacro{empty}
887 % The option |empty| switches to the box style for not rendering
888 % the box at all. The option |empty| is an abbreviation for
889 % |style=empty|.
890 %
891 % \SAMPLE{empty}
892 %
893 % \DescribeMacro{scale}
894 % The option |scale| controlls the scaling of the whole rendering.
895 % It is a number where 1. represents the original size.\footnote{The
896 % examples on the right side are normally rendered with a scale of 0.25.}
897 %
898 % \SAMPLE{scale=.1}
899 %
900 % \DescribeMacro{view}
901 % The option |view| takes a name of a view definition and activates
902 % the appropriate settings. A few views are predefined. The default
903 % value is |1|.
904 %
905 % \SAMPLE{view=1}
906 %
907 % \SAMPLE{view=2}
908 %
909 % \SAMPLE{view=3}
910 %
911 % \DescribeMacro{edgeColor}
912 % The option |edgeColor| takes a color specification for
913 % highlighting the inner edges in the 3D rendering.
914 %
915 % \DescribeMacro{faceSep}
916 % The option |faceSep| takes a dimension denoting the additional
917 % separating whitespace between the outer border and the minipage
918 % in the simplified interface.
919 %
920 % \DescribeMacro{width}
921 % The option |width| takes a dimension denoting the width of the
922 % box. The default value is 88\,mm.
923 %
924 % \DescribeMacro{height}
925 % The option |height| takes a dimension denoting the height of the
926 % box. The default value is 100\,mm.
927 %
928 % \DescribeMacro{depth}
929 % The option |depth| takes a dimension denoting the depth of the
930 % box. The default value is 30\,mm.
931 %
932 % \DescribeMacro{clean}
933 % The option |clean| controlls the cleaning of the stored faces
934 % upon entering the main environment. If it is turned off then the
935 % previously defined faces are still present and do not need to be
936 % defined again. It is a boolean value taking the values |true| and
937 % |false|. The default value is |true|.
938 %
939 % This option can be used to typeset the same product box with
940 % differnt parameters. For this purpose the main environment
941 % |ProductBox| is left empty and the option |clean=false| is added.
942 %
943 % \DescribeMacro{clip}
944 % The option |clip| controls the clipping of the faces to their
945 % defined size. If it is turned off then the faces can be oversized
946 % leading to strange effects. It is a boolean value taking the
947 % values |true| and |false|. The default value is |true|.
948 %
949 % \section{Tipps and Tricks}
950 %
951 % \subsection{Adjusting the Paper for the Fold Rendering}
952 %
953 % When you produce the fold rendering it is usually meant to be cut
954 % out and glued together. This means that the normal rules for the
955 % paper layout are not relevant. Instead you want to use the
956 % complete page for printing the product box.
957 % Below an example is shown how this goal can be achieved.
958 %
959 % \noindent
960 % {\advance\textwidth-\fboxsep \advance\textwidth-\fboxsep
961 % \advance\textwidth-\fboxrule \advance\textwidth-\fboxrule
962 % \setbox127\hbox\bgroup\begin{minipage}{.98\textwidth}\raggedright\footnotesize\tt
963 % |\documentclass{|\textcolor{red}{\tt report}|}|\\
964 % |\usepackage[|\textcolor{red}{a4paper}|,|\\
965 % | landscape,|\\
966 % | left=|\textcolor{red}{5mm}|,|\\
967 % | right=|\textcolor{red}{5mm}|,|\\
968 % | top=|\textcolor{red}{5mm}|,|\\
969 % | bottom=|\textcolor{red}{5mm}|]{geometry}|\\
970 % |\usepackage{productbox}|\\
971 % \textcolor{green}{\itshape\% load any required packages here}\\
972 % |\pagestyle{empty}|\\
973 % |\begin{document}|\\
974 % |\noindent|\\
975 % |\begin{ProductBox}[style=fold]|\\
976 % | |\textcolor{green}{\itshape\% include any definitions for the faces here}\\
977 % |\end{ProductBox}|\\
978 % |\end{document}|\\
979 % \end{minipage}\egroup
980 % \fcolorbox{red!30!black}{yellow!30!white}{\box127}}
981 %
982 % The class for typesetting this example is |report|. This can be
983 % changed to suit your needs. For instance if you are used to a
984 % document class with other macros and environments predefined you
985 % can just use it instead.
986 %
987 % The example above uses the package |geometry|
988 % \cite{geormetry-manual} to get rid of any predefined page layout.
989 % Some parameters (marked in red) can be adjusted. First of all is
990 % the paper definition. Here the value |a4paper| is used. If you
991 % want to print onto paper of a different size just use an
992 % appropriate short name like |letterpaper| or |a3paper|. See the
993 % documentation of the geometry package for a complete list of
994 % values.
995 %
996 % The values |left|, |right|, |top|, and |bottom| denote the
997 % margins left on the respective outer side of the paper. They are
998 % set to 5\,mm in this example to cope with the problem that some
999 % printers are not able to fill the complete page. They might need
1000 % a small non-printable area at the borders. You can experiment and
1001 % adjust those values to whatever suits your printer.
1002 %
1003 % \section{Known Problems}
1004 %
1005 % This section lists some issues which might lead to undesirable
1006 % results.
1007 %
1008 % \begin{description}
1009 % \item[Nested |ProductBox| environments.] The definition of the
1010 % environment uses some global storage. As a consequence the
1011 % environment |ProductBox| can not be used inside the definition of
1012 % a face. For instance if you want to show a product box on a side
1013 % of another product box can lead to this problem.
1014 %
1015 % In this case you can simply store the inner product box in a box
1016 % register (with |setbox|) and use this bos register instead of a
1017 % direct rendering. This will overcome the restriction.
1018 %
1019 % \item[Free selection of the point of view.] The 3D rendering is
1020 % rather limited in the possibilities of selecting the view.
1021 % Arbitrary rotation about any axis is not implemented (yet). This
1022 % is on the wish list for a future release already.
1023 % \end{description}
1024 %
1025 %
1026 % \bibliographystyle{alpha}
1027 % \bibliography{productbox}
1028 %
1029 % \StopEventually
1030 %
1031 % \newpage
1032 % \section{The Documentation Driver}
1033 %
1034 % The documentation driver changes \textsf{productbox.dtx} into a
1035 % self-extracting documentation. Thus it is possible to run
1036 % \LaTeX{} on \textsf{productbox.dtx} to produce the documentation.
1037 %
1038 % The documentation can be adapted in a file named productbox.dcf
1039 % (documentation configuration). This file can contain instructions
1040 % for |docstrip|. Especially useful might be the instruction
1041 %
1042 % |\OnlyDescription|
1043 %
1044 % which suppresses the generation of the implementation description.
1045 %
1046 % \begin{macrocode}
1047 %<*driver>
1048 \documentclass{ltxdoc}
1049 \usepackage{productbox}
1050 \usepackage[colorlinks,citecolor=blue]{hyperref}
1051 \usepackage{graphicx,color}
1052 \RecordChanges
1053 \EnableCrossrefs
1054 \CodelineIndex
1055 \definecolor{darkblue}{rgb}{.4,.4,1.}
1056 \renewcommand\MacroFont{\tt\footnotesize\color{darkblue}}
1057 \parindent=0pt
1058 \parskip=1ex plus .5ex minus .25ex
1059 \InputIfFileExists{productbox.dcf}{}{}
1060 \begin{document}
1061 \DocInput{productbox.dtx}
1062 \end{document}
1063 %</driver>
1064 % \end{macrocode}
1065 %
1066 % \section{The Implementation}
1067 %
1068 % The implementation contains the code of the style.
1069 %
1070 % \subsection{The Version Information}
1071 %
1072 % The following lines define the version information for the class
1073 % file. The information is partially taken from the version control
1074 % system (Subversion).
1075 %
1076 % \begin{macrocode}
1077 %<*style>
1078 \begingroup
1079 \def\ProductBox@VC$#1: #2 #3${#2}
1080 \def\ProductBox@VCdate$#1: #2-#3-#4 #5${#2/#3/#4}
1081 \xdef\fileversion{1.2}
1082 \xdef\filerevision{1.2}
1083 \xdef\filedate{2026-05-17}
1084 \xdef\filename{productbox.dtx}
1085 \endgroup
1086 %</style>
1087 % \end{macrocode}
1088 %
1089 %
1090 % \subsection{Getting Started}
1091 %
1092 % First we have to determine that the right kind of \LaTeX{} is
1093 % running and identify the style file.
1094 %
1095 % \begin{macrocode}
1096 %<*style>
1097 \NeedsTeXFormat{LaTeX2e}
1098 \ProvidesPackage{productbox}[\filedate Another type of boxes...]
1099 % \end{macrocode}
1100 %
1101 % A bunch of packages is loaded to form the base of the work herein.
1102 % \begin{macrocode}
1103 \RequirePackage{keyval}
1104 \RequirePackage{tikz}
1105 \usetikzlibrary{calc}
1106 \usetikzlibrary{fadings}
1107 % \end{macrocode}
1108 %
1109 % \subsection{Option Declarations}
1110 %
1111 % Define the parameters for the keyval package. They are used in
1112 % the main environemnt |Product Box| and in the declaration of
1113 % global options |\ProductBoxSet|.
1114 %
1115 % \subsubsection{General Parameters}
1116 % \begin{macrocode}
1117 \define@key{ProductBox}{scale}{%
1118 \def\ProductBox@scale{#1}}
1119 \define@key{ProductBox}{width}{%
1120 \def\ProductBox@x{#1}}
1121 \define@key{ProductBox}{height}{%
1122 \def\ProductBox@y{#1}}
1123 \define@key{ProductBox}{depth}{%
1124 \def\ProductBox@z{#1}}
1125 \define@key{ProductBox}{clean}[true]{%
1126 \csname ProductBox@clean#1\endcsname}
1127 % \end{macrocode}
1128 %
1129 % \subsubsection{Box Style Parameters}
1130 % \begin{macrocode}
1131 \define@key{ProductBox}{flat}[true]{%
1132 \def\ProductBox@style{flat}}
1133 \define@key{ProductBox}{fold}[true]{%
1134 \def\ProductBox@style{fold}}
1135 \define@key{ProductBox}{3d}[true]{%
1136 \def\ProductBox@style{threeD}}
1137 \define@key{ProductBox}{3D}[true]{%
1138 \def\ProductBox@style{threeD}}
1139 \define@key{ProductBox}{threeD}[true]{%
1140 \def\ProductBox@style{threeD}}
1141 \define@key{ProductBox}{top}[true]{%
1142 \def\ProductBox@style{top}}
1143 \define@key{ProductBox}{bottom}[true]{%
1144 \def\ProductBox@style{bottom}}
1145 \define@key{ProductBox}{front}[true]{%
1146 \def\ProductBox@style{front}}
1147 \define@key{ProductBox}{back}[true]{%
1148 \def\ProductBox@style{back}}
1149 \define@key{ProductBox}{left}[true]{%
1150 \def\ProductBox@style{left}}
1151 \define@key{ProductBox}{right}[true]{%
1152 \def\ProductBox@style{right}}
1153 \define@key{ProductBox}{empty}[true]{%
1154 \def\ProductBox@style{empty}}
1155 \define@key{ProductBox}{style}{%
1156 \def\ProductBox@style{#1}}
1157 % \end{macrocode}
1158 %
1159 % \subsubsection{Parameters for the 3D Rendering}
1160 % \begin{macrocode}
1161 \define@key{ProductBox}{shadow}[true]{%
1162 \csname ProductBox@shadow#1\endcsname}
1163 \define@key{ProductBox}{mirror}[true]{%
1164 \csname ProductBox@mirror#1\endcsname}
1165 \define@key{ProductBox}{flare}[true]{%
1166 \csname ProductBox@flare#1\endcsname}
1167 \define@key{ProductBox}{flareDiameter}{%
1168 \def\ProductBox@flareDiameter{#1}}
1169 \define@key{ProductBox}{edgeColor}{%
1170 \def\productBox@edgeColor{#1}}
1171 \define@key{ProductBox}{view}{%
1172 \@nameuse{ProductBox@View@#1}}
1173 % \end{macrocode}
1174 %
1175 % \subsubsection{Parameters for the Fold Rendering}
1176 % \begin{macrocode}
1177 \define@key{ProductBox}{earSize}{%
1178 \def\ProductBox@earSize{#1}}
1179 \define@key{ProductBox}{foldLine}{%
1180 \def\ProductBox@foldLine{#1}}
1181 \define@key{ProductBox}{foldOpacity}{%
1182 \def\ProductBox@foldOpacity{#1}}
1183 % \end{macrocode}
1184 %
1185 % \subsubsection{Parameters for the Simplified Interface}
1186 % \begin{macrocode}
1187 \define@key{ProductBox}{faceSep}{%
1188 \def\ProductBox@FaceSep{#1}}
1189 % \end{macrocode}
1190 %
1191 % \subsection{Storage for the Faces}
1192 %
1193 % \begin{macro}{\ProductBox@Front}
1194 % The box |\ProductBox@Front| contains the front material.
1195 % \begin{macrocode}
1196 \newbox\ProductBox@Front
1197 % \end{macrocode}
1198 % \end{macro}
1199 %
1200 % \begin{macro}{\ProductBox@Left}
1201 % The box |\ProductBox@Left| contains the left material.
1202 % \begin{macrocode}
1203 \newbox\ProductBox@Left
1204 % \end{macrocode}
1205 % \end{macro}
1206 %
1207 % \begin{macro}{\ProductBox@Top}
1208 % The box |\ProductBox@Top| contains the top material.
1209 % \begin{macrocode}
1210 \newbox\ProductBox@Top
1211 % \end{macrocode}
1212 % \end{macro}
1213 %
1214 % \begin{macro}{\ProductBox@Right}
1215 % The box |\ProductBox@Right| contains the right material.
1216 % \begin{macrocode}
1217 \newbox\ProductBox@Right
1218 % \end{macrocode}
1219 % \end{macro}
1220 %
1221 % \begin{macro}{\ProductBox@Bottom}
1222 % The box |\ProductBox@Bottom| contains the bottom material.
1223 % \begin{macrocode}
1224 \newbox\ProductBox@Bottom
1225 % \end{macrocode}
1226 % \end{macro}
1227 %
1228 % \begin{macro}{\ProductBox@Back}
1229 % The box |\ProductBox@Back| contains the back material.
1230 % \begin{macrocode}
1231 \newbox\ProductBox@Back
1232 % \end{macrocode}
1233 % \end{macro}
1234 %
1235 % \subsection{Settings}
1236 %
1237 % \begin{macro}{\ProductBoxSet}
1238 % The macro |\ProductBoxSet| defines the global parameters used by
1239 % the environment |ProductBox|. They can be overwritten either
1240 % within a group or in the optional parameter of the environment.
1241 % \begin{macrocode}
1242 \newcommand\ProductBoxSet[1]{\setkeys{ProductBox}{#1}}
1243 % \end{macrocode}
1244 % \end{macro}
1245 %
1246 % \subsection{The Main Environment}
1247 %
1248 % \begin{macro}{\ProductBox@style}
1249 % The default style is the 3D rendering.
1250 % \begin{macrocode}
1251 \newcommand\ProductBox@style{threeD}
1252 % \end{macrocode}
1253 % \end{macro}
1254 %
1255 % \begin{macro}{\ProductBox@x}
1256 % The width of the box.
1257 % \begin{macrocode}
1258 \newcommand\ProductBox@x{88mm}
1259 % \end{macrocode}
1260 % \end{macro}
1261 %
1262 % \begin{macro}{\ProductBox@y}
1263 % The height of the box.
1264 % \begin{macrocode}
1265 \newcommand\ProductBox@y{100mm}
1266 % \end{macrocode}
1267 % \end{macro}
1268 %
1269 % \begin{macro}{\ProductBox@z}
1270 % The depth of the box.
1271 % \begin{macrocode}
1272 \newcommand\ProductBox@z{30mm}
1273 % \end{macrocode}
1274 % \end{macro}
1275 %
1276 % \begin{macro}{ifProductBox@clean}
1277 % Indicator that the boxes for the faces should be cleaned.
1278 % \begin{macrocode}
1279 \newif\ifProductBox@clean
1280 % \end{macrocode}
1281 % \end{macro}
1282 %
1283 % \begin{macro}{ifProductBox@active}
1284 % Indicator that we are inside a |ProductBox| environment already.
1285 % \begin{macrocode}
1286 \newif\ifProductBox@active
1287 % \end{macrocode}
1288 % \end{macro}
1289 %
1290 % \begin{macro}{ifProductBox@clip}
1291 % The boolean |ProductBox@clip| determines whether or not the
1292 % additional clipping of the boxes should be enabled.
1293 % \begin{macrocode}
1294 \newif\ifProductBox@clip \ProductBox@cliptrue
1295 % \end{macrocode}
1296 % \end{macro}
1297 %
1298 % \begin{macro}{\ProductBox@FaceSep}
1299 % The horizontal separator of the minipage in the face definitions
1300 % in the simplified interface.
1301 % \begin{macrocode}
1302 \newcommand\ProductBox@FaceSep{1em}
1303 % \end{macrocode}
1304 % \end{macro}
1305 %
1306 % \begin{environment}{ProductBox}
1307 % This is the central environment provided by this style. In the begin code
1308 % only the local environments are initialized and the optional parameters
1309 % are evaluated with the help of the package |keyval|.
1310 % \begin{macrocode}
1311 \newenvironment{ProductBox}[1][]{%
1312 \setkeys{ProductBox}{#1}%
1313 % \end{macrocode}
1314 %
1315 % Next we clean the faces if this is required.
1316 % \changes{1.1}{2010/12/27}{Do not clean the faces upon request.}
1317 % \begin{macrocode}
1318 \ifProductBox@clean
1319 \global\setbox\ProductBox@Front\hbox{}%
1320 \global\setbox\ProductBox@Back\hbox{}%
1321 \global\setbox\ProductBox@Left\hbox{}%
1322 \global\setbox\ProductBox@Right\hbox{}%
1323 \global\setbox\ProductBox@Top\hbox{}%
1324 \global\setbox\ProductBox@Bottom\hbox{}%
1325 \fi
1326 % \end{macrocode}
1327 %
1328 % Next we define the local environments to make sure that they have
1329 % the proper definitions within this environment. Since the
1330 % environment provides an implicit group, the definitions are local
1331 % to this environment.
1332 %
1333 % To suppress any error messages about environments which are
1334 % already defined the start macros are reset to undefined.
1335 % \changes{1.1}{2010/12/23}{Simplified user interface added.}
1336 % \changes{1.1}{2010/12/25}{Suppress error messages.}
1337 % \changes{1.1}{2010/12/26}{Issue an error message for nested
1338 % ProductBox environments.}
1339 % \begin{macrocode}
1340 \ifProductBox@active
1341 \errmessage{Trying to use an environment ProductBox inside the
1342 environment ProductBox. This is not allowed.}%
1343 \else
1344 \ProductBox@activetrue
1345 \fi
1346 \let\Front\undefined \let\endFront\undefined
1347 \let\Back\undefined \let\endBack\undefined
1348 \let\Left\undefined \let\endLeft\undefined
1349 \let\Right\undefined \let\endRight\undefined
1350 \let\Top\undefined \let\endTop\undefined
1351 \let\Bottom\undefined \let\endBottom\undefined
1352 \let\FrontFace\undefined \let\endFrontFace\undefined
1353 \let\BackFace\undefined \let\endBackFace\undefined
1354 \let\LeftFace\undefined \let\endLeftFace\undefined
1355 \let\RightFace\undefined \let\endRightFace\undefined
1356 \let\TopFace\undefined \let\endTopFace\undefined
1357 \let\BottomFace\undefined \let\endBottomFace\undefined
1358 \newenvironment{Front}{\ProductBox@Start\ProductBox@Front
1359 (\ProductBox@x,\ProductBox@y)}{\ProductBox@End}%
1360 \newenvironment{Back}{\ProductBox@Start\ProductBox@Back
1361 (\ProductBox@x,\ProductBox@y)}{\ProductBox@End}%
1362 \newenvironment{Left}{\ProductBox@Start\ProductBox@Left
1363 (\ProductBox@z,\ProductBox@y)}{\ProductBox@End}%
1364 \newenvironment{Right}{\ProductBox@Start\ProductBox@Right
1365 (\ProductBox@z,\ProductBox@y)}{\ProductBox@End}%
1366 \newenvironment{Top}{\ProductBox@Start\ProductBox@Top
1367 (\ProductBox@x,\ProductBox@z)}{\ProductBox@End}%
1368 \newenvironment{Bottom}{\ProductBox@Start\ProductBox@Bottom(
1369 \ProductBox@x,\ProductBox@z)}{\ProductBox@End}%
1370 \newenvironment{FrontFace}[1][white]{\ProductBox@StartFace\ProductBox@Front
1371 {\ProductBox@x}{\ProductBox@y}{##1}}{\ProductBox@EndFace}%
1372 \newenvironment{BackFace}[1][white]{\ProductBox@StartFace\ProductBox@Back
1373 {\ProductBox@x}{\ProductBox@y}{##1}}{\ProductBox@EndFace}%
1374 \newenvironment{LeftFace}[1][white]{\ProductBox@StartFace\ProductBox@Left
1375 {\ProductBox@z}{\ProductBox@y}{##1}}{\ProductBox@EndFace}%
1376 \newenvironment{RightFace}[1][white]{\ProductBox@StartFace\ProductBox@Right
1377 {\ProductBox@z}{\ProductBox@y}{##1}}{\ProductBox@EndFace}%
1378 \newenvironment{TopFace}[1][white]{\ProductBox@StartFace\ProductBox@Top
1379 {\ProductBox@x}{\ProductBox@z}{##1}}{\ProductBox@EndFace}%
1380 \newenvironment{BottomFace}[1][white]{\ProductBox@StartFace\ProductBox@Bottom
1381 {\ProductBox@x}{\ProductBox@z}{##1}}{\ProductBox@EndFace}%
1382 \ignorespacesafterend
1383 }{%
1384 % \end{macrocode}
1385 % Check that the box style is defined or issue an appropriate error
1386 % message.
1387 % \begin{macrocode}
1388 \@ifundefined{ProductBox@style@\ProductBox@style}{%
1389 \errmessage{Box style '\ProductBox@style' for ProductBox is unknown}%
1390 }{%
1391 % \end{macrocode}
1392 % The main activity is performed in the end code. Since the
1393 % flexibility of the environment is one of its design goals, the
1394 % expansion of the macro |\ProductBox@style| is used to invoke the
1395 % macro stored in it. Optionally it is enclosed in a |\scalebox|
1396 % macro to perform the scaling. Thus the implementations of the box
1397 % styles do not need to care about scaling at all.
1398 % \begin{macrocode}
1399 \@ifundefined{ProductBox@scale}{%
1400 \@nameuse{ProductBox@style@\ProductBox@style}}{%
1401 \scalebox{\ProductBox@scale}%
1402 {\@nameuse{ProductBox@style@\ProductBox@style}}
1403 }}%
1404 \ProductBox@activefalse
1405 \ignorespacesafterend
1406 }
1407 % \end{macrocode}
1408 % \end{environment}
1409 %
1410 % \begin{macro}{\ProductBox@Start}
1411 % The macro |\ProductBox@Start| starts the environment storing a face.
1412 % \begin{macrocode}
1413 \def\ProductBox@Start#1(#2){%
1414 \global\setbox#1\hbox\bgroup\begin{tikzpicture}%
1415 \ifProductBox@clip \clip rectangle (#2); \fi
1416 }%
1417 % \end{macrocode}
1418 % \end{macro}
1419 %
1420 % \begin{macro}{\ProductBox@End}
1421 % The macro |\ProductBox@End| ends the environment storing a face.
1422 % \begin{macrocode}
1423 \newcommand\ProductBox@End{\end{tikzpicture}\egroup\ignorespacesafterend}
1424 % \end{macrocode}
1425 % \end{macro}
1426 %
1427 % \begin{macro}{\ProductBox@StartFace}
1428 % The macro |\ProductBox@StartFace| starts the environment storing
1429 % a face in a minipage.
1430 % \begin{macrocode}
1431 \newcommand\ProductBox@StartFace[4]{%
1432 \let\ProductBox@@box#1%
1433 \def\ProductBox@@w{#2}%
1434 \def\ProductBox@@h{#3}%
1435 \def\ProductBox@@args{[#4]}%
1436 \@tempdima=#2
1437 \advance\@tempdima-\ProductBox@FaceSep
1438 \advance\@tempdima-\ProductBox@FaceSep
1439 \setbox#1\hbox\bgroup\begin{minipage}{\the\@tempdima}%
1440 \ignorespaces
1441 }
1442 % \end{macrocode}
1443 % \end{macro}
1444 %
1445 % \begin{macro}{\ProductBox@EndFace}
1446 % This macro ends a face definition and stores the result in the
1447 % internal box |\ProductBox@@box|.
1448 % \begin{macrocode}
1449 \newcommand\ProductBox@EndFace{\end{minipage}\egroup
1450 \global\setbox\ProductBox@@box=\hbox{\begin{tikzpicture}
1451 \ifProductBox@clip \clip rectangle (\ProductBox@@w,\ProductBox@@h); \fi
1452 \expandafter\fill \ProductBox@@args rectangle(\ProductBox@@w,\ProductBox@@h);
1453 \draw (.5*\ProductBox@@w,.5*\ProductBox@@h)
1454 node[inner sep=0pt] {\box\ProductBox@@box};
1455 \end{tikzpicture}}\ignorespacesafterend}
1456 % \end{macrocode}
1457 % \end{macro}
1458 %
1459 % \subsection{Box Styles}
1460 %
1461 % \begin{macro}{\ProductBox@style@empty}
1462 % This macro defines the sytle \emph{empty} for a product box. It
1463 % simply does nothing.
1464 % \changes{1.1}{2010/12/26}{New box style ``empty''.}
1465 % \begin{macrocode}
1466 \newcommand\ProductBox@style@empty{}
1467 % \end{macrocode}
1468 % \end{macro}
1469 %
1470 % \begin{macro}{\ProductBox@style@flat}
1471 % This macro defines the sytle \emph{flat} for a product box.
1472 % \begin{macrocode}
1473 \newcommand\ProductBox@style@flat{%
1474 \par\noindent
1475 \hspace*{\ProductBox@z}\kern1mm \copy\ProductBox@Top\\[1ex]
1476 \copy\ProductBox@Left\kern1mm \copy\ProductBox@Front\kern1mm
1477 \copy\ProductBox@Right\kern1mm \copy\ProductBox@Back\\[1ex]
1478 \hspace*{\ProductBox@z}\kern1mm \copy\ProductBox@Bottom\par
1479 }
1480 % \end{macrocode}
1481 % \end{macro}
1482 %
1483 % \subsubsection{Box Style \texttt{front}}
1484 %
1485 % \begin{macro}{\ProductBox@style@front}
1486 % This macro defines the sytle \emph{front} for a product box. Only this
1487 % one face of the box is shown.
1488 % \begin{macrocode}
1489 \newcommand\ProductBox@style@front{%
1490 \copy\ProductBox@Front
1491 }
1492 % \end{macrocode}
1493 % \end{macro}
1494 %
1495 % \subsubsection{Box Style \texttt{back}}
1496 %
1497 % \begin{macro}{\ProductBox@style@back}
1498 % This macro defines the sytle \emph{back} for a product box. Only this
1499 % one face of the box is shown.
1500 % \begin{macrocode}
1501 \newcommand\ProductBox@style@back{%class
1502 \copy\ProductBox@Back
1503 }
1504 % \end{macrocode}
1505 % \end{macro}
1506 %
1507 % \subsubsection{Box Style \texttt{left}}
1508 %
1509 % \begin{macro}{\ProductBox@style@left}
1510 % This macro defines the sytle \emph{left} for a product box. Only this
1511 % one face of the box is shown.
1512 % \begin{macrocode}
1513 \newcommand\ProductBox@style@left{%
1514 \copy\ProductBox@Left
1515 }
1516 % \end{macrocode}
1517 % \end{macro}
1518 %
1519 % \subsubsection{Box Style \texttt{right}}
1520 %
1521 % \begin{macro}{\ProductBox@style@right}
1522 % This macro defines the sytle \emph{right} for a product box. Only this
1523 % one face of the box is shown.
1524 % \begin{macrocode}
1525 \newcommand\ProductBox@style@right{%
1526 \copy\ProductBox@Right
1527 }
1528 % \end{macrocode}
1529 % \end{macro}
1530 %
1531 % \subsubsection{Box Style \texttt{top}}
1532 %
1533 % \begin{macro}{\ProductBox@style@top}
1534 % This macro defines the sytle \emph{top} for a product box. Only this
1535 % one face of the box is shown.
1536 % \begin{macrocode}
1537 \newcommand\ProductBox@style@top{%
1538 \copy\ProductBox@Top
1539 }
1540 % \end{macrocode}
1541 % \end{macro}
1542 %
1543 % \subsubsection{Box Style \texttt{bottom}}
1544 %
1545 % \begin{macro}{\ProductBox@style@bottom}
1546 % This macro defines the sytle \emph{bottom} for a product box. Only this
1547 % one face of the box is shown.
1548 % \begin{macrocode}
1549 \newcommand\ProductBox@style@bottom{%
1550 \copy\ProductBox@Bottom
1551 }
1552 % \end{macrocode}
1553 % \end{macro}
1554 %
1555 % \subsubsection{Box Style \texttt{fold}}
1556 %
1557 % \begin{macro}{\ProductBox@earSize}
1558 % Parameter for the size of the ears.
1559 % \begin{macrocode}
1560 \newcommand\ProductBox@earSize{12mm}
1561 % \end{macrocode}
1562 % \end{macro}
1563 %
1564 % \begin{macro}{\ProductBox@foldLine}
1565 % The color of the additional lines in the fold rendering.
1566 % \begin{macrocode}
1567 \newcommand\ProductBox@foldLine{white!80!black}
1568 % \end{macrocode}
1569 % \end{macro}
1570 %
1571 % \begin{macro}{\ProductBox@foldOpacity}
1572 % The color of the additional lines in the fold rendering.
1573 % \begin{macrocode}
1574 \newcommand\ProductBox@foldOpacity{.5}
1575 % \end{macrocode}
1576 % \end{macro}
1577 %
1578 % \begin{macro}{\ProductBox@style@fold}
1579 % This macro defines the sytle \emph{fold} for a product box.
1580 % \begin{macrocode}
1581 \newcommand\ProductBox@style@fold{%
1582 \begin{tikzpicture}[sw/.style={anchor=south west,
1583 inner sep=0pt},
1584 se/.style={anchor=south east,
1585 inner sep=0pt},
1586 nw/.style={anchor=north west,
1587 inner sep=0pt},
1588 num/.style={circle,
1589 fill=white!90!black,
1590 fill opacity=.5,
1591 font=\tiny\bfseries\sffamily}]
1592 % \end{macrocode}
1593 % left face
1594 % \begin{macrocode}
1595 \begin{scope}
1596 \clip rectangle (\ProductBox@z,\ProductBox@y);
1597 \draw node[sw]{\copy\ProductBox@Left};
1598 \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1599 rectangle (\ProductBox@z,\ProductBox@y);
1600 \end{scope}
1601 % \end{macrocode}
1602 % front face
1603 % \begin{macrocode}
1604 \begin{scope}[xshift=\ProductBox@z]
1605 \clip rectangle (\ProductBox@x,\ProductBox@y);
1606 \draw node[sw]{\copy\ProductBox@Front};
1607 \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1608 rectangle (\ProductBox@x,\ProductBox@y);
1609 \end{scope}
1610 % \end{macrocode}
1611 % right face
1612 % \begin{macrocode}
1613 \begin{scope}[xshift=\ProductBox@z+\ProductBox@x]
1614 \clip rectangle (\ProductBox@z,\ProductBox@y);
1615 \draw node[sw]{\copy\ProductBox@Right};
1616 \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1617 rectangle (\ProductBox@z,\ProductBox@y);
1618 \end{scope}
1619 % \end{macrocode}
1620 % back face
1621 % \begin{macrocode}
1622 \begin{scope}[xshift=\ProductBox@x+2*\ProductBox@z]
1623 \clip rectangle (\ProductBox@x,\ProductBox@y);
1624 \draw node[sw]{\copy\ProductBox@Back};
1625 \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1626 rectangle (\ProductBox@x,\ProductBox@y);
1627 \end{scope}
1628 % \end{macrocode}
1629 % top face
1630 % \begin{macrocode}
1631 \begin{scope}[xshift=\ProductBox@z,yshift=\ProductBox@y]
1632 \clip rectangle (\ProductBox@x,\ProductBox@z);
1633 \draw node[sw]{\copy\ProductBox@Top};
1634 \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1635 rectangle (\ProductBox@x,\ProductBox@z);
1636 \end{scope}
1637 % \end{macrocode}
1638 % bottom ear 3 front
1639 % \begin{macrocode}
1640 \begin{scope}[xshift=\ProductBox@z]
1641 \clip
1642 (0mm,0mm) -- (.5*\ProductBox@z,-.5*\ProductBox@z) --
1643 (.5*\ProductBox@z,-\ProductBox@z) --
1644 (\[email protected]*\ProductBox@z,-\ProductBox@z) --
1645 (\[email protected]*\ProductBox@z,-.5*\ProductBox@z) --
1646 (\ProductBox@x,0mm) -- cycle;
1647 \draw (\ProductBox@x,-\ProductBox@z)
1648 node[se]{\copy\ProductBox@Bottom};
1649 \draw [thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1650 (0mm,0mm) -- (.5*\ProductBox@z,-.5*\ProductBox@z) --
1651 (.5*\ProductBox@z,-\ProductBox@z) --
1652 (\[email protected]*\ProductBox@z,-\ProductBox@z) --
1653 (\[email protected]*\ProductBox@z,-.5*\ProductBox@z) --
1654 (\ProductBox@x,0mm) -- cycle;
1655 \draw (.5*\ProductBox@x,-.75*\ProductBox@z) node[num]{3};
1656 \end{scope}
1657 % \end{macrocode}
1658 % bottom ear 1 back
1659 % \begin{macrocode}
1660 \begin{scope}[xshift=\ProductBox@x+2*\ProductBox@z]
1661 \clip
1662 (0mm,0mm) -- (0mm,-\ProductBox@z) --
1663 (.5*\ProductBox@z,-\ProductBox@z) --
1664 (.5*\ProductBox@z,-.5*\ProductBox@z) --
1665 (\[email protected]*\ProductBox@z,-.5*\ProductBox@z) --
1666 (\[email protected]*\ProductBox@z,-\ProductBox@z) --
1667 (\ProductBox@x,-\ProductBox@z) -- (\ProductBox@x,0mm) --
1668 cycle;
1669 \draw node[se,rotate=180]{\copy\ProductBox@Bottom};
1670 \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1671 (0mm,0mm) -- (0mm,-\ProductBox@z) --
1672 (.5*\ProductBox@z,-\ProductBox@z) --
1673 (.5*\ProductBox@z,-.5*\ProductBox@z) --
1674 (\[email protected]*\ProductBox@z,-.5*\ProductBox@z) --
1675 (\[email protected]*\ProductBox@z,-\ProductBox@z) --
1676 (\ProductBox@x,-\ProductBox@z) -- (\ProductBox@x,0mm) --
1677 cycle;
1678 \draw (.25*\ProductBox@z,-.75*\ProductBox@z) node[num]{1};
1679 \draw (\[email protected]*\ProductBox@z,-.75*\ProductBox@z)
1680 node[num]{1};
1681 \end{scope}
1682 % \end{macrocode}
1683 % bottom ear 2 right
1684 % \begin{macrocode}
1685 \begin{scope}[xshift=\ProductBox@z+\ProductBox@x]
1686 \clip
1687 (0mm,0mm) -- (\ProductBox@z,0mm) --
1688 (.5*\ProductBox@z,-.5*\ProductBox@z) --
1689 (.5*\ProductBox@z,-\ProductBox@z) -- (0mm,-\ProductBox@z) --
1690 cycle;
1691 \draw (\ProductBox@z,0mm)
1692 node[se,rotate=90]{\copy\ProductBox@Bottom};
1693 \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1694 (0mm,0mm) -- (\ProductBox@z,0mm) --
1695 (.5*\ProductBox@z,-.5*\ProductBox@z) --
1696 (.5*\ProductBox@z,-\ProductBox@z) -- (0mm,-\ProductBox@z) --
1697 cycle;
1698 \draw (.25*\ProductBox@z,-.75*\ProductBox@z) node[num]{2};
1699 \end{scope}
1700 % \end{macrocode}
1701 % bottom ear 2 left
1702 % \begin{macrocode}
1703 \begin{scope}
1704 \clip
1705 (0mm,0mm) -- (\ProductBox@z,0mm) --
1706 (\ProductBox@z,-\ProductBox@z) --
1707 (.5*\ProductBox@z,-\ProductBox@z) --
1708 (.5*\ProductBox@z,-.5*\ProductBox@z) -- cycle;
1709 \draw
1710 node[sw,rotate=270]{\copy\ProductBox@Bottom};
1711 \draw [thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1712 (0mm,0mm) -- (\ProductBox@z,0mm) --
1713 (\ProductBox@z,-\ProductBox@z) --
1714 (.5*\ProductBox@z,-\ProductBox@z) --
1715 (.5*\ProductBox@z,-.5*\ProductBox@z) -- cycle;
1716 \draw (.75*\ProductBox@z,-.75*\ProductBox@z) node[num]{2};
1717 \end{scope}
1718 % \end{macrocode}
1719 % glue ear
1720 % \begin{macrocode}
1721 \begin{scope}[xshift=2*\ProductBox@x+2*\ProductBox@z]
1722 \clip
1723 (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize/4) --
1724 (\ProductBox@earSize/2,\ProductBox@y-\ProductBox@earSize/4) --
1725 (0mm,\ProductBox@y) -- cycle;
1726 \draw node[sw]{\copy\ProductBox@Left};
1727 \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1728 (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize/4) --
1729 (\ProductBox@earSize/2,\ProductBox@y-\ProductBox@earSize/4) --
1730 (0mm,\ProductBox@y) -- cycle;
1731 \end{scope}
1732 % \end{macrocode}
1733 % top ear left
1734 % \begin{macrocode}
1735 \begin{scope}[yshift=\ProductBox@y]
1736 \clip
1737 (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) --
1738 (\ProductBox@z-\ProductBox@earSize/2,\ProductBox@earSize) --
1739 (\ProductBox@z,0mm) -- cycle;
1740 \draw node[nw,rotate=90]{\copy\ProductBox@Top};
1741 \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1742 (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) --
1743 (\ProductBox@z-\ProductBox@earSize/2,\ProductBox@earSize) --
1744 (\ProductBox@z,0mm) -- cycle;
1745 \end{scope}
1746 % \end{macrocode}
1747 % top ear right
1748 % \begin{macrocode}
1749 \begin{scope}[xshift=\ProductBox@x+\ProductBox@z,
1750 yshift=\ProductBox@y]
1751 \clip
1752 (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) --
1753 (\ProductBox@z-\ProductBox@earSize/2,\ProductBox@earSize) --
1754 (\ProductBox@z,0mm) -- cycle;
1755 \draw node[se,rotate=270]{\copy\ProductBox@Top};
1756 \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1757 (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) --
1758 (\ProductBox@z-\ProductBox@earSize/2,\ProductBox@earSize) --
1759 (\ProductBox@z,0mm) -- cycle;
1760 \end{scope}
1761 % \end{macrocode}
1762 % top ear back
1763 % \begin{macrocode}
1764 \begin{scope}[xshift=\ProductBox@z,
1765 yshift=\ProductBox@y+\ProductBox@z]
1766 \clip
1767 (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) --
1768 (\ProductBox@x-\ProductBox@earSize/2,\ProductBox@earSize) --
1769 (\ProductBox@x,0mm) -- cycle;
1770 \draw (0mm,\ProductBox@y)
1771 node[se,rotate=180]{\copy\ProductBox@Back};
1772 \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine]
1773 (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) --
1774 (\ProductBox@x-\ProductBox@earSize/2,\ProductBox@earSize) --
1775 (\ProductBox@x,0mm) -- cycle;
1776 \end{scope}
1777 \end{tikzpicture}}
1778 % \end{macrocode}
1779 % \end{macro}
1780 %
1781 % \subsubsection{Box Style \texttt{threeD}}
1782 %
1783 % \begin{macro}{\ProductBoxThreeDStartHook}
1784 % A hook to add some code at the beginning.
1785 % \begin{macrocode}
1786 \newcommand\ProductBoxThreeDStartHook{}
1787 % \end{macrocode}
1788 % \end{macro}
1789 %
1790 % \begin{macro}{\ProductBoxThreeDEndHook}
1791 % A hook to add some code at the end.
1792 % \begin{macrocode}
1793 \newcommand\ProductBoxThreeDEndHook{}
1794 % \end{macrocode}
1795 % \end{macro}
1796 %
1797 % \begin{macro}{\ifProductBox@shadow}
1798 % The boolean |ProductBox@shadow| determines whether or not the
1799 % shadow in the 3D rendering is shown.
1800 % \begin{macrocode}
1801 \newif\ifProductBox@shadow \ProductBox@shadowtrue
1802 % \end{macrocode}
1803 % \end{macro}
1804 %
1805 % \begin{macro}{\ifProductBox@mirror}
1806 % The boolean |ProductBox@mirror| determines whether or not the
1807 % mirror effect in the 3D rendering is shown.
1808 % \begin{macrocode}
1809 \newif\ifProductBox@mirror
1810 % \end{macrocode}
1811 % \end{macro}
1812 %
1813 % \begin{macro}{\ifProductBox@flare}
1814 % The boolean |ProductBox@flare| determines whether or not the
1815 % flare effect in the 3D rendering is shown.
1816 % \begin{macrocode}
1817 \newif\ifProductBox@flare
1818 % \end{macrocode}
1819 % \end{macro}
1820 %
1821 % \begin{macro}{\ProductBox@edgeColor}
1822 % The edge color in the 3D rendering.
1823 % \begin{macrocode}
1824 \newcommand\ProductBox@edgeColor{white}
1825 % \end{macrocode}
1826 % \end{macro}
1827 %
1828 % \begin{macro}{\ProductBox@flareDiameter}
1829 % The diameter of the flare.
1830 % \begin{macrocode}
1831 \newcommand\ProductBox@flareDiameter{24mm}
1832 % \end{macrocode}
1833 % \end{macro}
1834 %
1835 % The angle to rotate the box about the z axis.
1836 % \begin{macrocode}
1837 \newcommand\ProductBox@angleZ{8}
1838 % \end{macrocode}
1839 %
1840 % The angle to rotate the box about the x axis.
1841 % \begin{macrocode}
1842 \newcommand\ProductBox@angleX{10}
1843 % \end{macrocode}
1844 %
1845 % \begin{macro}{\ProductBox@style@threeD}
1846 % This macro defines the sytle \emph{threeD} for a product box. The
1847 % faces are placed such the illusion of a three-dimensional box
1848 % appears. In addition a shadow is shown if not disabled.
1849 % \changes{1.1}{2010/12/26}{Fix: The flare is also transformed and clipped.}
1850 % \begin{macrocode}
1851 \newcommand\ProductBox@style@threeD{
1852 \begin{tikzpicture}[sw/.style={anchor=south west,
1853 inner sep=0pt}]
1854 \ProductBoxThreeDStartHook
1855 \ifProductBox@mirror \ProductBox@threeD@mirror \fi
1856 \ifProductBox@shadow \ProductBox@threeD@shadow \fi
1857
1858 \begin{scope}
1859 \fill[white,
1860 yslant=\ProductBox@p@front@yslant,
1861 xscale=\ProductBox@p@front@xscale,
1862 yscale=\ProductBox@p@front@yscale,
1863 anchor=south west]
1864 rectangle (\ProductBox@x,\ProductBox@y);
1865 \draw
1866 node[sw,
1867 yslant=\ProductBox@p@front@yslant,
1868 xscale=\ProductBox@p@front@xscale,
1869 yscale=\ProductBox@p@front@yscale]
1870 {\copy\ProductBox@Front};
1871 \fill[black,
1872 fill opacity=.025,
1873 yslant=\ProductBox@p@front@yslant,
1874 xscale=\ProductBox@p@front@xscale,
1875 yscale=\ProductBox@p@front@yscale,
1876 anchor=south west]
1877 rectangle (\ProductBox@x,\ProductBox@y);
1878 \ifProductBox@flare
1879 \begin{scope}[
1880 yslant=\ProductBox@p@front@yslant,
1881 xscale=\ProductBox@p@front@xscale,
1882 yscale=\ProductBox@p@front@yscale]
1883 \clip rectangle(\ProductBox@x,\ProductBox@y);
1884 \ProductBox@threeD@flare
1885 \end{scope}
1886 \fi
1887 \end{scope}
1888 \begin{scope}[shift={(-\ProductBox@p@left@xscale*\ProductBox@z,
1889 \ProductBox@p@left@yslant
1890 *\ProductBox@p@left@xscale
1891 *\ProductBox@z)}]
1892 \fill[white,
1893 yslant=-\ProductBox@p@left@yslant,
1894 xscale=\ProductBox@p@left@xscale,
1895 yscale=\ProductBox@p@left@yscale,
1896 anchor=south west]
1897 rectangle (\ProductBox@z,\ProductBox@y);
1898 \draw
1899 node[sw,
1900 yslant=-\ProductBox@p@left@yslant,
1901 xscale=\ProductBox@p@left@xscale,
1902 yscale=\ProductBox@p@left@yscale]
1903 {\copy\ProductBox@Left};
1904 \fill[black,
1905 fill opacity=.25,
1906 yslant=-\ProductBox@p@left@yslant,
1907 xscale=\ProductBox@p@left@xscale,
1908 yscale=\ProductBox@p@left@yscale,
1909 anchor=south west]
1910 rectangle (\ProductBox@z,\ProductBox@y);
1911 \end{scope}
1912 \begin{scope}[yshift=\ProductBox@y]
1913 \fill [white,
1914 anchor=south west,
1915 xslant=-\ProductBox@p@top@xslant,
1916 xscale=\ProductBox@p@top@xscale,
1917 yslant=\ProductBox@p@top@yslant,
1918 yscale=\ProductBox@p@top@yscale]
1919 rectangle (\ProductBox@x,\ProductBox@z);
1920 \draw
1921 node[sw,
1922 xslant=-\ProductBox@p@top@xslant,
1923 xscale=\ProductBox@p@top@xscale,
1924 yslant=\ProductBox@p@top@yslant,
1925 yscale=\ProductBox@p@top@yscale]
1926 {\copy\ProductBox@Top};
1927 \fill [black,
1928 fill opacity=.0025,
1929 anchor=south west,
1930 xslant=-\ProductBox@p@top@xslant,
1931 xscale=\ProductBox@p@top@xscale,
1932 yslant=\ProductBox@p@top@yslant,
1933 yscale=\ProductBox@p@top@yscale]
1934 rectangle (\ProductBox@x,\ProductBox@z);
1935 \end{scope}
1936 \begin{scope}[shift={(-\ProductBox@p@left@xscale*\ProductBox@z,
1937 \ProductBox@p@left@yslant*\ProductBox@p@left@xscale*\ProductBox@z)}]
1938 \draw [\ProductBox@edgeColor,
1939 line width=.5mm,
1940 draw opacity=.25,
1941 yslant=-\ProductBox@p@left@yslant,
1942 xscale=\ProductBox@p@left@xscale]
1943 (\ProductBox@z,0mm) --
1944 (\ProductBox@z,\ProductBox@y) --
1945 (0mm,\ProductBox@y);
1946 \end{scope}
1947 \draw [\ProductBox@edgeColor,
1948 line width=.5mm,
1949 draw opacity=.25,
1950 yslant=\ProductBox@p@front@yslant,
1951 xscale=\ProductBox@p@front@xscale,
1952 anchor=south west]
1953 (0mm,\ProductBox@y) -- (\ProductBox@x,\ProductBox@y);
1954 \ProductBoxThreeDEndHook
1955 \end{tikzpicture}}
1956 % \end{macrocode}
1957 % \end{macro}
1958 %
1959 % Parameters and views.
1960 %
1961 % \begin{macrocode}
1962 \newcommand\ProductBox@setFrontParams[3]{%
1963 \def\ProductBox@p@front@yslant{#1}%
1964 \def\ProductBox@p@front@xscale{#2}%
1965 \def\ProductBox@p@front@yscale{#3}%
1966 }
1967 \newcommand\ProductBox@setLeftParams[3]{%
1968 \def\ProductBox@p@left@yslant{#1}%
1969 \def\ProductBox@p@left@xscale{#2}%
1970 \def\ProductBox@p@left@yscale{#3}%
1971 }
1972 \newcommand\ProductBox@setTopParams[4]{%
1973 \def\ProductBox@p@top@xslant{#1}%
1974 \def\ProductBox@p@top@yslant{#2}%
1975 \def\ProductBox@p@top@xscale{#3}%
1976 \def\ProductBox@p@top@yscale{#4}%
1977 }
1978 \newcommand\ProductBox@setMirrorParams[1]{%
1979 \def\ProductBox@p@mirror@yscale{#1}%
1980 }
1981 \@namedef{ProductBox@View@1}{%
1982 \ProductBox@setFrontParams{.25}{.9090909}{1}%
1983 \ProductBox@setLeftParams{.5}{.6666666}{1}%
1984 \ProductBox@setTopParams{2}{.2265}{1.363}{.3333333}%
1985 \ProductBox@setMirrorParams{.4}}
1986 \@namedef{ProductBox@View@2}{%
1987 \ProductBox@setFrontParams{.15}{.9090909}{1}%
1988 \ProductBox@setLeftParams{.6666666}{.5}{1}%
1989 \ProductBox@setTopParams{1.5}{.12}{1.11}{.333333}%
1990 \ProductBox@setMirrorParams{.4}}
1991 \@namedef{ProductBox@View@3}{%
1992 \ProductBox@setFrontParams{.05}{.95}{1}%
1993 \ProductBox@setLeftParams{.25}{.4}{1}%
1994 \ProductBox@setTopParams{4}{.04}{1.133333}{.1}%
1995 \ProductBox@setMirrorParams{.4}}
1996 \@nameuse{ProductBox@View@1}
1997 % \end{macrocode}
1998 %
1999 % \begin{macro}{\ProductBox@threeD@shadow}
2000 % This macro defines the code to produce the shadow effect for the 3D rendering.
2001 % \begin{macrocode}
2002 \newcommand\ProductBox@threeD@shadow{
2003 \begin{scope}
2004 \foreach \x in {.5,1,1.5,2,2.5,3,4,5,6,8,10} {
2005 \filldraw [black,
2006 line width=\x mm,
2007 rounded corners=2mm,
2008 opacity=.01,
2009 shift={(-1mm,1mm)}]
2010 (0mm,0mm) --
2011 (-\ProductBox@p@top@xslant
2012 *\ProductBox@p@left@xscale
2013 *\ProductBox@z,
2014 \ProductBox@p@top@yscale
2015 *\ProductBox@z) --
2016 (0mm,
2017 \ProductBox@p@top@yscale*\ProductBox@z +
2018 \ProductBox@p@top@xslant
2019 *\ProductBox@p@left@xscale
2020 *\ProductBox@p@top@yslant
2021 *\ProductBox@z) --
2022 cycle;
2023 }
2024 \end{scope}
2025 }
2026 % \end{macrocode}
2027 % \end{macro}
2028 %
2029 % The following fading is used for the mirror effect in the 3D rendering.
2030 % \begin{macrocode}
2031 \tikzfading[name=ProductBoxFade,
2032 top color=transparent!100,
2033 bottom color=transparent!50,
2034 middle color=transparent!100]
2035 % \end{macrocode}
2036 % \begin{macro}{\ProductBox@threeD@mirror}
2037 % This macro defines the code to produce the mirror effect.
2038 % \changes{1.1}{2010/12/27}{Code rewritten to make full use of tranparency.}
2039 % \begin{macrocode}
2040 \newcommand\ProductBox@threeD@mirror{%
2041 \fill
2042 node[anchor=south west,
2043 inner sep=0pt,
2044 yslant=\ProductBox@p@front@yslant,
2045 xscale=\ProductBox@p@front@xscale,
2046 yscale=-\ProductBox@p@mirror@yscale]
2047 {\begin{tikzpicture}
2048 \clip rectangle (\ProductBox@x,
2049 \ProductBox@y*\ProductBox@p@mirror@yscale);
2050 \fill node [scope fading=ProductBoxFade,
2051 yscale=\ProductBox@p@mirror@yscale,
2052 inner sep=0pt]{\copy\ProductBox@Front};
2053 \end{tikzpicture}};
2054 \fill[xshift=-\ProductBox@p@left@xscale*\ProductBox@z,
2055 yshift=\ProductBox@p@top@yscale*\ProductBox@z]
2056 node[anchor=south west,
2057 inner sep=0pt,
2058 yslant=-\ProductBox@p@left@yslant,
2059 xscale=\ProductBox@p@left@xscale,
2060 yscale=-\ProductBox@p@mirror@yscale]
2061 {\begin{tikzpicture}
2062 \clip rectangle (\ProductBox@z,
2063 \ProductBox@y*\ProductBox@p@mirror@yscale);
2064 \fill node [scope fading=ProductBoxFade,
2065 yscale=\ProductBox@p@mirror@yscale,
2066 inner sep=0pt]{\copy\ProductBox@Left};
2067
2068 \end{tikzpicture}};
2069 }
2070 % \end{macrocode}
2071 % \end{macro}
2072 %
2073 % \begin{macro}{\ProductBox@threeD@flare}
2074 % This macro defines the code to produce the flare effect. The
2075 % flare is achieved with overlaying a partially transparent and
2076 % fading circle of white color.
2077 % \begin{macrocode}
2078 \newcommand\ProductBox@threeD@flare{
2079 \fill [white,path fading=ProductBoxFlare]
2080 (.8*\ProductBox@x,.9*\ProductBox@y)
2081 circle(\ProductBox@flareDiameter);
2082 }
2083 % \end{macrocode}
2084 % \end{macro}
2085 %
2086 % The following fading is used for the flare effect in the 3D rendering.
2087 % \begin{macrocode}
2088 \tikzfading[name=ProductBoxFlare,
2089 inner color=transparent!60,
2090 outer color=transparent!100]
2091 % \end{macrocode}
2092 %
2093 % Finally we define some variant names.
2094 % \begin{macrocode}
2095 \@namedef{ProductBox@style@3D}{\ProductBox@style@threeD}
2096 \@namedef{ProductBox@style@3d}{\ProductBox@style@threeD}
2097 %</style>
2098 % \end{macrocode}
2099 % That's all.
2100 %
2101 % \newpage
2102 % \setcounter{IndexColumns}2
2103 % \PrintChanges
2104 % \newpage
2105 % \PrintIndex
2106 % \Finale
2107 \endinput
2108 %
2109 % Local Variables:
2110 % End: