%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%^^A $Id: productbox.dtx 8333 2010-12-29 19:58:06Z gene $ %%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\iffalse %% Purpose: %% productbox.dtx provides a style file for typesetting a %% three-dimensional product box. This product box can be rendered %% as it is standing on a surface and some light is shed onto it. %% Alternatively it can be typeset as a wireframe to be cut out %% and glued together. This will lead to a physical product box. %% %% Documentation: %% The documentation can be generated from the original file %% productbox.dtx with the doc style/package. LaTeX the file %% productbox.dtx to get the full documentation in pdf format. %% %% Prerequisite: %% This package needs TikZ to be present at least in version 2.0. %% %% Author: Gerd Neugebauer %% Im Lerchelsb\"ohl 5 %% 64521 Gro\ss-Gerau %% Mail: gene@gerd-neugebauer.de %% %% Copyright (C) 2010 Gerd Neugebauer %% %% productbox.dtx is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY. No author or distributor accepts %% responsibility to anyone for the consequences of using it or for %% whether it serves any particular purpose or works at all, unless %% he says so in writing. %% %% Everyone is granted permission to copy, modify and redistribute %% productbox.dtx, provided this copyright notice is preserved and %% any modifications are indicated. %% %\fi %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \title{A \LaTeX\ Style for % Typesetting a Three-Dimensional Product Box\thanks{This file % documents \filename\ version \fileversion\ % (from revision \filerevision) as of \filedate.}} % \author{Gerd Neugebauer\\\small % Im Lerchelsb\"ohl 5\\\small % 64521 Gro\ss-Gerau (Germany)\\\small % Email: \texttt{\href{mailto:gene@gerd-neugebauer.de}{gene@gerd-neugebauer.de}}} % \date{{\footnotesize Documentation date: \filedate}} % \hypersetup{pdftitle=A LaTeX Style for Typesetting a Three-Dimensional Product Box} % \hypersetup{pdfauthor=Gerd Neugebauer} % \hypersetup{pdfsubject=\filename\ version \fileversion\ as of \filedate} % \maketitle % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \changes{1.0}{2010/12/20}{First public release.} % \changes{1.1}{2010/12/23}{Simplified user interface added.} %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \DoNotIndex{\ ,\",\',\.,\[,\\,\],\^,\`,\~,\@,\@dottedtocline} % \DoNotIndex{\@gobble,\@gobbletwo,\@ifnextchar,\@ifstar} % \DoNotIndex{\@ifundefined,\@namedef,\@nameuse,\@tempdima,\@undefined} % \DoNotIndex{\CurrentOption,\DeclareOption,\LARGE,\LaTeX,\Large} % \DoNotIndex{\InputIfFileExists,\EnableCrossrefs,\DocInput} % \DoNotIndex{\DeleteShortVerb,\CodelineIndex,\MacroFont} % \DoNotIndex{\RecordChanges,\ProvidesPackage,\NeedsTeXFormat} % \DoNotIndex{\LoadClass,\OptionNotUsed,\PassOptionsToClass} % \DoNotIndex{\ProcessOptions,\ProvidesClass,\RequirePackage,\TeX} % \DoNotIndex{\addcontentsline,\advance} % \DoNotIndex{\begin,\begingroup,\bf,\bgroup,\egroup} % \DoNotIndex{\bigskip,\box,\clearpage,\color,\csname} % \DoNotIndex{\def,\definecolor,\dimen,\divide,\documentclass,\dp} % \DoNotIndex{\else,\empty,\end,\endcsname,\endgroup,\endinput} % \DoNotIndex{\expandafter,\fbox,\fi,\framebox} % \DoNotIndex{\futurelet,\gdef,\global,\gobble,\hbox,\hfil} % \DoNotIndex{\hfill,\hrule,\hskip,\hspace,\hss,\huge} % \DoNotIndex{\ifdim,\ifx,\ignorespaces,\immediate,\index,\it} % \DoNotIndex{\kern,\large,\let,\long,\lower} % \DoNotIndex{\makebox,\makeindex,\markboth,\mbox,\medskip} % \DoNotIndex{\newblock,\newcommand,\newcount,\newenvironment,\newfont} % \DoNotIndex{\newif,\newpage,\nobreak,\noindent,\normalsize,\null} % \DoNotIndex{\or,\pagestyle,\par,\paragraph,\parbox} % \DoNotIndex{\parfillskip,\parindent,\parsep,\parskip,\partopsep} % \DoNotIndex{\relax,\renewcommand,\renewenvironment,\rm,\rule} % \DoNotIndex{\sbox,\sc,\setcounter,\settowidth,\sf,\sfcode,\sl} % \DoNotIndex{\small,\space,\string,\symbol} % \DoNotIndex{\the,\thepage,\thispagestyle} % \DoNotIndex{\topmargin,\topsep,\tt,\typeout} % \DoNotIndex{\unitlength,\usecounter,\varepsilon,\vbox} % \DoNotIndex{\vfill,\vsize,\vskip,\vspace,\vss,\xdef} % \DoNotIndex{\usetikzlibrary,\usepackage,\tikzfading,\setkeys} % \DoNotIndex{\setbox,\scalebox} % \DoNotIndex{\newbox,\ignorespacesafterend,\foreach,\filldraw} % \DoNotIndex{\fill,\errmessage,\draw,\define@key,\copy,\clip} % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \CheckSum{1028} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% \CharacterTable %% {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 %% 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 %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} %% %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \newcommand\TikZ{Ti\textit{k}Z} % % \begin{abstract} % The package \texttt{productbox} provides a style file for % typesetting a three-dimensional product box. This product box % can be rendered as it is standing on a surface and some light % is shed onto it. Alternatively it can be typeset as a wireframe % to be cut out and glued together. This will lead to a physical % product box. % \end{abstract} % % \begin{center}% % \def\PB(#1,#2)#3{ % \draw[xshift=-.2mm,yshift=.2mm] (#1,#2) node[white,opacity=.9]{#3}; % \draw[xshift=.2mm,yshift=-.2mm] (#1,#2) node[black,opacity=.9]{#3}; % \draw (#1,#2) node[blue]{#3}; % }% % \begin{ProductBox}[mirror=true,flare=true,scale=.6] % \begin{Front} % \shade [top color=yellow!20!red,bottom color=yellow!80!red] % rectangle (88mm,100mm); % \PB(44mm,85mm){\Huge\bf Product Box} % \draw (77mm,90mm) node[circle,ball color=white,rotate=330]{\small\bf\fileversion}; % \draw (44mm,75mm) node{A \LaTeX\ package for just another kind of boxes}; % % \foreach \x in {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16} { % \count0=\x \multiply\count0 4 % \draw [red,line width=.2mm] % (0mm,0 mm) .. controls (88mm,\the\count0 mm) and (\x mm,66mm) .. % (88mm,\the\count0 mm); % \draw [xshift=.4mm,white,line width=.2mm,opacity=.5] % (0mm,0 mm) .. controls (88mm,\the\count0 mm) and (\x mm,66mm) .. % (88mm,\the\count0 mm); % } % % \clip (0mm,0mm) .. controls (88mm,64mm) and (16mm,66mm) .. % (88mm,64mm) -- (88mm,100mm) -- (0mm,100mm) -- cycle; % \draw (4mm,66mm) node [white!30!black,anchor=north west] { % \begin{minipage}{160mm}\tt\tiny\raggedright % |\usepackage{productbox}|\\ % | |\\ % | |\\ % |\begin{ProductBox}[scale=.8]|\\ % | \begin{Front}|\\ % | \shade [top color=yellow!20!red,bottom color=yellow!80!red]|\\ % | rectangle (88mm,100mm);|\\ % | \PB(44mm,85mm){\Huge\bf Product Box}|\\ % | \draw (77mm,90mm) node[circle,ball color=white]{\small\bf\fileversion};|\\ % | \draw (44mm,75mm) node{A \LaTeX\ package for just another kind of boxes};|\\ % ||\\ % | \foreach \x in {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16} {|\\ % | \count0=\x \multiply\count0 4|\\ % | \draw [red,line width=.2mm]|\\ % | (0mm,0 mm) .. controls (88mm,\the\count0 mm) and (\x mm,66mm) ..|\\ % | (88mm,\the\count0 mm);|\\ % | \draw [xshift=.4mm,white,line width=.2mm,opacity=.5]|\\ % | (0mm,0 mm) .. controls (88mm,\the\count0 mm) and (\x mm,66mm) ..|\\ % | (88mm,\the\count0 mm);|\\ % | }|\\ % | \clip (0mm,0mm) .. controls (88mm,64mm) and (16mm,66mm) ..|\\ % | (88mm,64mm) -- (88mm,100mm) -- (0mm,100mm) -- cycle;|\\ % | \end{Front}|\\ % | \begin{Top}|\\ % | \shade [outer color=yellow!20!red,inner color=yellow!80!red]|\\ % | rectangle (88mm,30mm);|\\ % | \PB(44mm,15mm){\huge\bf Product Box}|\\ % | \draw (77mm,20mm)|\\ % | node[circle,ball color=white,rotate=330]{\small\bf\fileversion};|\\ % | \end{Top}|\\ % \end{minipage}}; % \end{Front} % \begin{Top} % \shade [outer color=yellow!20!red,inner color=yellow!80!red] % rectangle (88mm,30mm); % \PB(44mm,15mm){\huge\bf Product Box} % \draw (77mm,20mm) % node[circle,ball color=white,rotate=330]{\small\bf\fileversion}; % \end{Top} % \begin{Bottom} % \shade [outer color=yellow!20!red,inner color=yellow!80!red] % rectangle (88mm,30mm); % \end{Bottom} % \begin{Left} % \fill [top color=yellow!20!red,bottom color=yellow!80!red] % rectangle (30mm,100mm); % \PB(15mm,90mm){ % \begin{minipage}{25mm}\centering % \Large\bf Product Box % \end{minipage}} % \draw (15mm,25mm) node { % \begin{minipage}{25mm}\sf\tiny\raggedright\parskip=.75ex % Copyright (C) 2010 Gerd Neugebauer % % productbox.dtx is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY. No author or distributor accepts % responsibility to anyone for the consequences of using it or for % whether it serves any particular purpose or works at all, unless % he says so in writing. % % Everyone is granted permission to copy, modify and redistribute % productbox.dtx, provided this copyright notice is preserved and % any modifications are indicated. % \end{minipage}}; % \end{Left} % \begin{Right} % \fill [top color=yellow!20!red,bottom color=yellow!80!red] % rectangle (30mm,100mm); % \PB(15mm,90mm){ % \begin{minipage}{25mm}\centering % \Large\bf Product Box % \end{minipage}} % \end{Right} % \end{ProductBox} % \end{center} % % \newpage % \tableofcontents % \newpage % % \section{Introduction} % % Humans are tied to the physical world. Even in the age of % software it is desirable to have a physical representation for % it. In the commercial world the software is sold in product boxes % containing a CD or DVD and printed documentation. % % But even for open source software having a product box provides a % means to associate a physical object with the more or less % virtual entity ``software''. % % There are many programs around devoted to producing layouts for % product boxes. Each graphics program can be used for this purpose % as well. Nevertheless the integration of material from the \TeX\ % world is not that easy. % % The \LaTeX\ package |productbox| is an attempt to use the % possibilities for \LaTeX\ and some packages to provide a means % for typesetting the faces of a product box and assemble them into % a three-dimensional image. % % Note that this ``image'' is in fact a \textsc{pdf} object. It can % be scaled without loss of quality\footnote{unless some pixel % images have been included}. It is also possible to extract % the text from the product box by cut and paste in an appropriate % \textsc{pdf} reader. % % % \section{The User Interface} % % The \LaTeX\ style |productbox| is based on \TikZ{} at % \cite{tikz-manual} least in version~2.0. It is best used with a % \LaTeX\ variant which is able to produce \textsc{pdf}. If no % proper tool chain is used then some of the effects should not be % used. % % \DescribeEnv{ProductBox} % The environment |ProductBox| provides the central means for % producing a product box. The contents is used to define the % appearance of the faces. Finally the selected type of output is % produced. % % The content of the environment consists mainly of the definition % of the six faces. Not all of them need to be defined. If one face % is not defined then it appears as an empty rectangle of white % color. % % Thus you usually want to define the faces. Two approaches are % provided to define the content of the faces. The simplified % interface does not really require any knowledge of the underlying % \TikZ{} package. Just some knowledge of \LaTeX\ is sufficient. % The extended interface opens the full power to the user. Both % interface types can be freely intermixed. The tow kinds of % interfaces are described in section~\ref{sec:simplified} % and~\ref{sec:extended}. % % The environment |ProductBox| can be controlled with a number of % optional parameters. Those parameters are described in % section~\ref{sec:options}. % % % \subsection{The Simplified User Interface}\label{sec:simplified} % % The simplified user interface is meant for someone not familiar % with \TikZ. It encapsulates nearly anything and relies on just % some basic \LaTeX\ experience. As a downside the functionality is % restricted. Any fancy artwork on the box background can hardly be % achieved. % % The following example shows a complete -- even rather useless -- % definition of a product box with the simplified user interface. % % \noindent % {\advance\textwidth-\fboxsep \advance\textwidth-\fboxsep % \advance\textwidth-\fboxrule \advance\textwidth-\fboxrule % \setbox127\hbox\bgroup\begin{minipage}{\textwidth}\footnotesize % |\begin{ProductBox}|\\ % | \begin{FrontFace}[bottom color=white!30!blue,top color=white]|\\ % | \Huge Product Box|\\ % | \end{FrontFace}|\\ % | \begin{BackFace}[top color=yellow!30!red,bottom color=white]|\\ % | \large Back Face|\\ % | \end{BackFace}|\\ % | \begin{TopFace}[outer color=white!30!red,inner color=white]|\\ % | \large Top Face|\\ % | \end{TopFace}|\\ % | \begin{BottomFace}[outer color=red,inner color=black]|\\ % | \large Bottom Face|\\ % | \end{BottomFace}|\\ % | \begin{LeftFace}[left color=green,right color=yellow]|\\ % | \large Left Face|\\ % | \end{LeftFace}|\\ % | \begin{RightFace}[left color=white,right color=black]|\\ % | \large Right Face|\\ % | \end{RightFace}|\\ % |\end{ProductBox}| % \end{minipage}\egroup % \fcolorbox{red!30!black}{yellow!30!white}{\box127}} % % \newcommand\simpleSample[1]{% % \begin{ProductBox}[scale=.25,#1] % \begin{FrontFace}[bottom color=white!30!blue,top color=white] % \Huge Product Box % \end{FrontFace} % \begin{BackFace}[top color=yellow!30!red,bottom color=white] % \large Back Face % \end{BackFace} % \begin{TopFace}[outer color=white!30!red,inner color=white] % \large Top Face % \end{TopFace} % \begin{BottomFace}[outer color=red,inner color=black] % \large Bottom Face % \end{BottomFace} % \begin{LeftFace}[left color=green,right color=yellow] % \large Left Face % \end{LeftFace} % \begin{RightFace}[left color=white,right color=black] % \large Right Face % \end{RightFace} % \end{ProductBox}% % } % % This code renders as % % \begin{center}\simpleSample{}\end{center} % \newcommand\SampleEnv[1]{\noindent\par % \fcolorbox{red!30!black}{yellow!30!white}{\begin{minipage}[b]{.98\textwidth}\footnotesize\tt % \textcolor{blue}{\char92begin}\char123#1\char125\\ % \hspace*{2em}...\\ % \textcolor{blue}{\char92end}\char123#1\char125 % \end{minipage}}\par} % % The content of the environment |ProductBox| is simply evaluated. % It can contain any code you like. Useful for the production of a % product box are some inner environments. They are called % |FrontFace|, |BackFace|, |LeftFace|, |RightFace|, |TopFace|, and % |BottomFace|. They are defined inside the main environment % only. Those environments can be used to specify the contents of % the respective faces of the box. % % Note that in the three-dimensional rendering will show at most % three of the faces. It does not hurt to define all of them, even % if they are not shown at all. % % \DescribeEnv{FrontFace} % The environment |FrontFace| is used to define the content of % the font face. The environment processes its contents inside a % |minipage| of the default width 88\,mm reduced by the left and % right separator width (|faceSep|). % % The minipage is centered vertically on the face. % Usually anything extending the default height of 100\,mm is % clipped. % % \SampleEnv{FrontFace} % % \DescribeEnv{BackFace} % The environment |BackFace| is used to define the content of % the back face. The environment processes its contents inside a % |minipage| of the default width 88\,mm reduced by the left and % right separator width (|faceSep|). % % The minipage is centered vertically on the face. % Usually anything extending the default height of 100\,mm is % clipped. % % \SampleEnv{BackFace} % % \DescribeEnv{LeftFace} % The environment |LeftFace| is used to define the content of % the left face. The environment processes its contents inside a % |minipage| of the default width 100\,mm reduced by the left and % right separator width (|faceSep|). % % The minipage is centered vertically on the face. % Usually anything extending the default height of 30\,mm is % clipped. % % \SampleEnv{LeftFace} % % \DescribeEnv{RightFace} % The environment |RightFace| is used to define the content of % the right face. The environment processes its contents inside a % |minipage| of the default width 100\,mm reduced by the left and % right separator width (|faceSep|). % % The minipage is centered vertically on the face. % Usually anything extending the default height of 30\,mm is % clipped. % % \SampleEnv{RightFace} % % \DescribeEnv{TopFace} % The environment |TopFace| is used to define the content of % the top face. The environment processes its contents inside a % |minipage| of the default width 88\,mm reduced by the left and % right separator width (|faceSep|). % % The minipage is centered vertically on the face. % Usually anything extending the default height of 30\,mm is % clipped. % % \SampleEnv{TopFace} % % \DescribeEnv{BottomFace} % The environment |BottomFace| is used to define the content of % the bottom face. The environment processes its contents inside a % |minipage| of the default width 88\,mm reduced by the left and % right separator width (|faceSep|). % % The minipage is centered vertically on the face. % Usually anything extending the default height of 30\,mm is % clipped. % % \SampleEnv{BottomFace} % % \newcommand\Sample[1]{ % \noindent % \fcolorbox{red!30!black}{yellow!30!white}{\begin{minipage}[b]{.8\textwidth}\footnotesize\tt % \textcolor{blue}{\char92begin}\char123ProductBox\char125 \\ % \hspace*{2em}\textcolor{blue}{\char92begin}\char123FrontFace\char125\\ % \hspace*{4em}\textcolor{red}{[#1]}\\ % \hspace*{4em}...\\ % \hspace*{2em}\textcolor{blue}{\char92end}\char123FrontFace\char125\\ % \hspace*{2em}...\\ % \textcolor{blue}{\char92end}\char123ProductBox\char125 % \end{minipage}}\hfill % \begin{minipage}[b]{.18\textwidth}\hfill % \begin{ProductBox}[front,scale=.2] % \begin{FrontFace}[#1] \end{FrontFace} % \end{ProductBox} % \end{minipage}\medskip\par % }% % Any of the face defining environments described above can take an % optional argument. This argument is used to specify the % background. In the simplest case you just have one background % color. This is specified with the keyword |color|. % % \Sample{color=yellow} % % Colors in \TikZ{} are either one of the named colors or a % composition of those colors. The notation |red!60!blue| denotes % the color by mixing 60\% red and 40\% blue. % % \Sample{color=red!60!blue} % % By mixing in black or white you can come to a lighter or darker % color. % % \Sample{color=red!20!white} % % A fading from top to bottom can be specified with two % colors named |top color| and |bottom color|. % % \Sample{top color=red!50!blue,bottom color=yellow} % % A fading from left to right can be specified with two % colors named |left color| and |left color|. % % \Sample{left color=red!50!blue,right color=yellow} % % The parameter |middle color| can be used in horizontal or % vertical fading to specifying the color in the middle. Note thta % it has to be specified after the other colors! % % \Sample{top color=red,bottom color=yellow,middle color=blue} % % A circular fading can be specified with the color names % |inner color| and |outer color|. % % \Sample{inner color=red,outer color=yellow} % % % \subsection{The Extended User Interface}\label{sec:extended} % % The extended user interface allows you to use all features of % \TikZ. For this purpose another set of face defining environments % is provided which process their content in a |tikzpicture| % environment. % % The following example shows a complete example of a product box % with the extended user interface. This example is used below to % demonstrate the effect of the differnt options. % % \noindent % {\advance\textwidth-\fboxsep \advance\textwidth-\fboxsep % \advance\textwidth-\fboxrule \advance\textwidth-\fboxrule % \setbox127\hbox\bgroup\begin{minipage}{.98\textwidth}\footnotesize\raggedright % |\begin{ProductBox}\sf|\\ % | \begin{Front}|\\ % | \fill [top color=white!30!blue,bottom color=white]|\\ % | rectangle (88mm,100mm);|\\ % | \fill [bottom color=white!40!blue,top color=white!90!blue]|\\ % | (0mm,0mm) -- (44mm,90mm) -- (88mm,0mm) -- cycle;|\\ % | \draw (44mm,40mm) node{\Huge Product Box};|\\ % | \end{Front}|\\ % | \begin{Back}|\\ % | \fill [top color=yellow!30!red,bottom color=white]|\\ % | rectangle (88mm,100mm);|\\ % | \fill [top color=white,bottom color=blue]|\\ % | (0mm,0mm) -- (88mm,100mm) -- (0mm,100mm) --cycle;|\\ % | \draw (44mm,50mm) node{\large Back};|\\ % | \end{Back}|\\ % | \begin{Top}|\\ % | \fill [outer color=white!30!red,inner color=white]|\\ % | rectangle (88mm,30mm);|\\ % | \draw[white,thick] (0mm,5mm) -- (88mm,25mm);|\\ % | \draw (44mm,15mm) node{\large Top};|\\ % | \end{Top}|\\ % | \begin{Bottom}|\\ % | \fill [outer color=red!30!white,inner color=black]|\\ % | rectangle (88mm,30mm);|\\ % | \draw[white] (44mm,15mm) node{\large Bottom};|\\ % | \end{Bottom}|\\ % | \begin{Left}|\\ % | \fill [left color=green,right color=yellow]|\\ % | rectangle (30mm,100mm);|\\ % | \draw (15mm,50mm) node{\large Left};|\\ % | \end{Left}|\\ % | \begin{Right}|\\ % | \fill [top color=green,bottom color=yellow]|\\ % | rectangle (30mm,100mm);|\\ % | \draw (15mm,50mm) node{\large Right};|\\ % | \end{Right}|\\ % |\end{ProductBox}| % \end{minipage}\egroup % \fcolorbox{red!30!black}{yellow!30!white}{\box127}} % \newcommand\sample[1]{% % \begin{ProductBox}[scale=.25,#1]\sf % \begin{Front} % \fill [top color=white!30!blue,bottom color=white] % rectangle (88mm,100mm); % \fill [bottom color=white!40!blue,top color=white!90!blue] % (0mm,0mm) -- (44mm,90mm) -- (88mm,0mm) -- cycle; % \draw (44mm,40mm) node{\Huge Product Box}; % \end{Front} % \begin{Back} % \fill [top color=blue,bottom color=white] % rectangle (88mm,100mm); % \fill [top color=white,bottom color=blue] % (0mm,0mm) -- (88mm,100mm) -- (0mm,100mm) --cycle; % \draw (44mm,50mm) node{\large Back}; % \end{Back} % \begin{Top} % \fill [outer color=white!30!red,inner color=white] % rectangle (88mm,30mm); % \draw[white,thick] (0mm,5mm) -- (88mm,25mm); % \draw (44mm,15mm) node{\large Top}; % \end{Top} % \begin{Bottom} % \fill [outer color=red!30!white,inner color=black] % rectangle (88mm,30mm); % \draw[white] (44mm,15mm) node{\large Bottom}; % \end{Bottom} % \begin{Left} % \fill [left color=green,right color=yellow] % rectangle (30mm,100mm); % \draw (15mm,50mm) node{\large Left}; % \end{Left} % \begin{Right} % \fill [top color=green,bottom color=yellow] % rectangle (30mm,100mm); % \draw (15mm,50mm) node{\large Right}; % \end{Right} % \end{ProductBox}% % } % % The content of the environment is simply expanded. It may contain % any code you like -- except an |ProductBox| environment. Useful % for the production of a product box are some inner environments. % They are called |Front|, |Back|, |Left|, |Right|, |Top|, and % |Bottom|. They are defined inside the main % environment only. Those environments can be used to specify the % contents of the respective faces of the box. % % Note that in the three-dimensional rendering will show at most % three of the faces. It does not hurt to define all of them, even % if they are not shown at all. % % \DescribeEnv{Front} % The environment |Front| is used to define the content of % the font face. The environment processes its contents inside a % |tikzpicture| of the default size 88\,mm$\times$100\,mm. % Usually anything outside of this range is clipped. % % \SampleEnv{Front} % % \DescribeEnv{Back} % The environment |Back| is used to define the content of % the back face. The environment processes its contents inside a % |tikzpicture| of the default size 88\,mm$\times$100\,mm. % Usually anything outside of this range is clipped. % % \SampleEnv{Back} % % \DescribeEnv{Left} % The environment |Left| is used to define the content of % the left face, i.e. the face left to the front page. The % environment processes its contents inside a |tikzpicture| % of the default size 30\,mm$\times$100\,mm. Usually anything % outside of this range is clipped. % % \SampleEnv{Left} % % \DescribeEnv{Right} % The environment |Right| is used to define the content of % the right face, i.e. the face right to the front page. The % environment processes its contents inside a |tikzpicture| % of the default size 30\,mm$\times$100\,mm. Usually anything % outside of this range is clipped. % % \SampleEnv{Right} % % \DescribeEnv{Top} % The environment |Top| is used to define the content of the % top face. The environment processes its contents inside a % |tikzpicture| of the default size 88\,mm$\times$30\,mm. Usually % anything outside of this range is clipped. % % \SampleEnv{Top} % % \DescribeEnv{Bottom} % The environment |Bottom| is used to define the content of the % top face. The environment processes its contents inside a % |tikzpicture| of the default size 88\,mm$\times$30\,mm. Usually % anything outside of this range is clipped. % % \SampleEnv{Bottom} % % % \subsection{Settings and Options of the Main Environment}\label{sec:options} % % The environment |ProductBox| can take some options to % influence the appearance of the product box. Those options are % comma separated. % % \def\CODE#1{ % \noindent % \fcolorbox{red!30!black}{yellow!30!white}{\begin{minipage}[b]{.98\textwidth}\footnotesize\tt % #1 % \end{minipage}\medskip\par % }}% % \CODE{\textcolor{blue}{\char92begin}\char123ProductBox\char125[shape=3d]} % % The settings are local to the main environment. If an option is not % set then the fallback from the global settings are used. % % \DescribeMacro{\ProductBoxSet} % The macro |\ProductBoxSet| modifies the global setting of the % product box style. The arguments are the same as the optional % arguments of the environment |ProductBox| -- but enclosed % in braces instead of brackets. % % \CODE{\char92ProductBoxSet\char123shape=3d\char125 } % % The following options can be used to influence the result of the product % box. % % \newcommand\SAMPLE[1]{ % \noindent % \fcolorbox{red!30!black}{yellow!30!white}{\begin{minipage}[b]{.45\textwidth}\footnotesize\tt\raggedright % \def\x{#1}% % \def\e{}% % \textcolor{blue}{\char92begin}\char123ProductBox\char125 \ifx\x\e\else\textcolor{red}{[#1]}\fi\\ % \hspace*{2em}\textcolor{blue}{\char92begin}\char123Front\char125\\ % \hspace*{4em}...\\ % \hspace*{2em}\textcolor{blue}{\char92end}\char123Front\char125\\ % \hspace*{2em}\textcolor{blue}{\char92begin}\char123Left\char125\\ % \hspace*{4em}...\\ % \hspace*{2em}\textcolor{blue}{\char92end}\char123Left\char125\\ % \hspace*{2em}...\\ % \textcolor{blue}{\char92end}\char123ProductBox\char125 % \end{minipage}}\hfill % \begin{minipage}[b]{.53\textwidth}\hfill % \sample{#1} % \end{minipage}\medskip\par % }% % % \DescribeMacro{style} % The box style determines, how the box is drawn. Several rendering % functions are provided to produce different effects. Any value is % accepted. Unknown box styles will lead to an error message. % % \SAMPLE{style=3D} % % \DescribeMacro{3D} % The box style |3D| is the default. It produces a % three-dimensional view of the box. The option |3D| is an % abbreviation for |style=3D|. It can also be written as |3d| or % |threeD|. % % \SAMPLE{} % % \DescribeMacro{shadow} % The option |shadow| controls the drawing of the drop shadow in the % 3D rendering. It is a boolean value taking the values |true| and % |false|. The default value is |true|. % % The option |shadow| is the abbreviation for |shadow=true|. % % \SAMPLE{shadow=false} % % \DescribeMacro{mirror} % The option |mirror| controls the rendering of the mirror effect in % the 3D rendering. It is a boolean value taking the values |true| and % |false|. The default value is |false|. % % The option |mirror| is the abbreviation for |mirror=true|. % % \SAMPLE{mirror=true} % % \DescribeMacro{flare} % The option |flare| controls the rendering of the flare effect in % the 3D~rendering. The flare is a circular relection of the light % source in the upper right corner of the front face. The option is % a boolean value taking the values |true| and |false|. The default % value is |false|. % % The option |flare| is the abbreviation for |flare=true|. % % \SAMPLE{flare=true} % % \DescribeMacro{flareDiameter} % The option |flareDiameter| takes a dimension which defines the % diameter of the flare effect in the 3D~rendering. The default % value is 24\,mm. % % \SAMPLE{flare=true, flareDiameter=60mm} % % Internally the 3D rendering uses a |tikzpicture|. You can expand % your own code either at the beginning or at the end of this % environment. This can be achieved by overwriting a macro. % % \DescribeMacro{ProductBoxThreeDStartHook} % The macro |ProductBoxThreeDStartHook| contains code to be % expanded at the beginning of the 3D rendering. Initially it is % defined as empty. % % \noindent % \fcolorbox{red!30!black}{yellow!30!white}{\begin{minipage}[b]{.49\textwidth}\footnotesize\tt\raggedright % \textcolor{blue}{\char92renewcommand}\char92ProductBoxThreeDStartHook\char123\\ % \hspace*{2em}\char92 filldraw[yscale=.4,\\ % \hspace*{6em} shift=\char123(30mm,4mm)\char125,\\ % \hspace*{6em} color=white,\\ % \hspace*{6em} inner color=white!70!blue,\\ % \hspace*{6em} outer color=white]\\ % \hspace*{4em} circle (120mm);\\ % \char125\\ % \textcolor{blue}{\char92begin}\char123ProductBox\char125\\ % \hspace*{2em}...\\ % \textcolor{blue}{\char92end}\char123ProductBox\char125 % \end{minipage}}\hfill\hspace*{-4pt} % \begin{minipage}[b]{.5\textwidth}\hfill % \renewcommand\ProductBoxThreeDStartHook{ % \filldraw[yscale=.4, % shift={(30mm,4mm)}, % color=white, % inner color=white!80!blue, % outer color=white] circle (120mm); % } % \sample{} % \end{minipage}\hspace*{-3pt}\medskip\par % % \DescribeMacro{ProductBoxThreeDEndHook} % The macro |ProductBoxThreeDEndHook| contains code to be % expanded at the end of the 3D rendering. Initially it is % defined as empty. % % \DescribeMacro{fold} % The option |fold| switches to the box style for rendering a % complete wire frame with all faces in place. The option % |fold| is an abbreviation for |style=fold|. % % \SAMPLE{fold} % % The top face is printed on the left and right top ear as well. % This should avoid a break in the pattern when the box is % partially opened. The same principle applis for the glue ear on % the right side and the bottom. % % The bottom is formed in a way to maiximize stability without the % need to glue. In addition numbers are printed on the parts of the % bottom indicating the sequence in which the parts should be % closed. % % \DescribeMacro{earSize} % The option |earSize| takes a dimension which defines the % width of the ears in the fold rendering. The ears around the top % are this wide. The width of the glueing ear is half of this size. % The default value is 12\,mm. % % \SAMPLE{fold,earSize=30mm} % % Note that the ear size must not exceed the width of the left % face, the width of the front face, and the heiht of the box. % Otherwise funny effects in the ears will happen. % % \DescribeMacro{foldLine} % The option |foldLine| takes a specification for the line % surrounding the fold drawing. Usally you want to simply use a % color like ``gray'' or ``red''. The default is a kind of gray. % % \SAMPLE{fold,foldLine=red} % % \DescribeMacro{foldOpacity} % The option |foldOpacity| takes a fraction for the opacity of the line % surrounding the fold drawing. The default is |0.5|. If you want % to let the fold lines disappear then use a value of 1. % % \SAMPLE{fold,foldOpacity=0} % % \DescribeMacro{front} % The option |front| switches to the box style for rendering the % front face only. The option |front| is an abbreviation for % |style=front|. % % \SAMPLE{front} % % \DescribeMacro{back} % The option |back| switches to the box style for rendering the % back face only. The option |back| is an abbreviation for % |style=back|. % % \SAMPLE{back} % % \DescribeMacro{left} % The option |left| switches to the box style for rendering the % left face only. The option |left| is an abbreviation for % |style=left|. % % \SAMPLE{left} % % \DescribeMacro{right} % The option |right| switches to the box style for rendering the % right face only. The option |right| is an abbreviation for % |style=right|. % % \SAMPLE{right} % % \DescribeMacro{top} % The option |top| switches to the box style for rendering the % top face only. The option |top| is an abbreviation for % |style=top|. % % \SAMPLE{top} % % \DescribeMacro{bottom} % The option |bottom| switches to the box style for rendering the % face only. The option |bottom| is an abbreviation for % |style=bottom|. % % \SAMPLE{bottom} % % \DescribeMacro{empty} % The option |empty| switches to the box style for not rendering % the box at all. The option |empty| is an abbreviation for % |style=empty|. % % \SAMPLE{empty} % % \DescribeMacro{scale} % The option |scale| controlls the scaling of the whole rendering. % It is a number where 1. represents the original size.\footnote{The % examples on the right side are normally rendered with a scale of 0.25.} % % \SAMPLE{scale=.1} % % \DescribeMacro{view} % The option |view| takes a name of a view definition and activates % the appropriate settings. A few views are predefined. The default % value is |1|. % % \SAMPLE{view=1} % % \SAMPLE{view=2} % % \SAMPLE{view=3} % % \DescribeMacro{edgeColor} % The option |edgeColor| takes a color specification for % highlighting the inner edges in the 3D rendering. % % \DescribeMacro{faceSep} % The option |faceSep| takes a dimension denoting the additional % separating whitespace between the outer border and the minipage % in the simplified interface. % % \DescribeMacro{width} % The option |width| takes a dimension denoting the width of the % box. The default value is 88\,mm. % % \DescribeMacro{height} % The option |height| takes a dimension denoting the height of the % box. The default value is 100\,mm. % % \DescribeMacro{depth} % The option |depth| takes a dimension denoting the depth of the % box. The default value is 30\,mm. % % \DescribeMacro{clean} % The option |clean| controlls the cleaning of the stored faces % upon entering the main environment. If it is turned off then the % previously defined faces are still present and do not need to be % defined again. It is a boolean value taking the values |true| and % |false|. The default value is |true|. % % This option can be used to typeset the same product box with % differnt parameters. For this purpose the main environment % |ProductBox| is left empty and the option |clean=false| is added. % % \DescribeMacro{clip} % The option |clip| controls the clipping of the faces to their % defined size. If it is turned off then the faces can be oversized % leading to strange effects. It is a boolean value taking the % values |true| and |false|. The default value is |true|. % % \section{Tipps and Tricks} % % \subsection{Adjusting the Paper for the Fold Rendering} % % When you produce the fold rendering it is usually meant to be cut % out and glued together. This means that the normal rules for the % paper layout are not relevant. Instead you want to use the % complete page for printing the product box. % Below an example is shown how this goal can be achieved. % % \noindent % {\advance\textwidth-\fboxsep \advance\textwidth-\fboxsep % \advance\textwidth-\fboxrule \advance\textwidth-\fboxrule % \setbox127\hbox\bgroup\begin{minipage}{.98\textwidth}\raggedright\footnotesize\tt % |\documentclass{|\textcolor{red}{\tt report}|}|\\ % |\usepackage[|\textcolor{red}{a4paper}|,|\\ % | landscape,|\\ % | left=|\textcolor{red}{5mm}|,|\\ % | right=|\textcolor{red}{5mm}|,|\\ % | top=|\textcolor{red}{5mm}|,|\\ % | bottom=|\textcolor{red}{5mm}|]{geometry}|\\ % |\usepackage{productbox}|\\ % \textcolor{green}{\itshape\% load any required packages here}\\ % |\pagestyle{empty}|\\ % |\begin{document}|\\ % |\noindent|\\ % |\begin{ProductBox}[style=fold]|\\ % | |\textcolor{green}{\itshape\% include any definitions for the faces here}\\ % |\end{ProductBox}|\\ % |\end{document}|\\ % \end{minipage}\egroup % \fcolorbox{red!30!black}{yellow!30!white}{\box127}} % % The class for typesetting this example is |report|. This can be % changed to suit your needs. For instance if you are used to a % document class with other macros and environments predefined you % can just use it instead. % % The example above uses the package |geometry| % \cite{geormetry-manual} to get rid of any predefined page layout. % Some parameters (marked in red) can be adjusted. First of all is % the paper definition. Here the value |a4paper| is used. If you % want to print onto paper of a different size just use an % appropriate short name like |letterpaper| or |a3paper|. See the % documentation of the geometry package for a complete list of % values. % % The values |left|, |right|, |top|, and |bottom| denote the % margins left on the respective outer side of the paper. They are % set to 5\,mm in this example to cope with the problem that some % printers are not able to fill the complete page. They might need % a small non-printable area at the borders. You can experiment and % adjust those values to whatever suits your printer. % % \section{Known Problems} % % This section lists some issues which might lead to undesirable % results. % % \begin{description} % \item[Nested |ProductBox| environments.] The definition of the % environment uses some global storage. As a consequence the % environment |ProductBox| can not be used inside the definition of % a face. For instance if you want to show a product box on a side % of another product box can lead to this problem. % % In this case you can simply store the inner product box in a box % register (with |setbox|) and use this bos register instead of a % direct rendering. This will overcome the restriction. % % \item[Free selection of the point of view.] The 3D rendering is % rather limited in the possibilities of selecting the view. % Arbitrary rotation about any axis is not implemented (yet). This % is on the which list for a future release already. % \end{description} % % % \bibliographystyle{alpha} % \bibliography{productbox} % % \StopEventually % % \newpage % \section{The Documentation Driver} % % The documentation driver changes \textsf{productbox.dtx} into a % self-extracting documentation. Thus it is possible to run % \LaTeX{} on \textsf{productbox.dtx} to produce the documentation. % % The documentation can be adapted in a file named productbox.dcf % (documentation configuration). This file can contain instructions % for |docstrip|. Especially useful might be the instruction % % |\OnlyDescription| % % which suppresses the generation of the implementation description. % % \begin{macrocode} %<*driver> \documentclass{ltxdoc} \usepackage{productbox} \usepackage[colorlinks,citecolor=blue]{hyperref} \usepackage{graphicx,color} \RecordChanges \EnableCrossrefs \CodelineIndex \definecolor{darkblue}{rgb}{.4,.4,1.} \renewcommand\MacroFont{\tt\footnotesize\color{darkblue}} \parindent=0pt \parskip=1ex plus .5ex minus .25ex \InputIfFileExists{productbox.dcf}{}{} \begin{document} \DocInput{productbox.dtx} \end{document} % % \end{macrocode} % % \section{The Implementation} % % The implementation contains the code of the style. % % \subsection{The Version Information} % % The following lines define the version information for the class % file. The information is partially taken from the version control % system (Subversion). % % \begin{macrocode} %<*style> \begingroup \def\ProductBox@VC$#1: #2 #3${#2} \def\ProductBox@VCdate$#1: #2-#3-#4 #5${#2/#3/#4} \xdef\fileversion{1.1} \xdef\filerevision{\ProductBox@VC$Revision: 8333 $} \xdef\filedate{\ProductBox@VCdate $Date: 2010-12-29 20:58:06 +0100 (Mi, 29 Dez 2010) $} \xdef\filename{productbox.dtx} \endgroup % % \end{macrocode} % % % \subsection{Getting Started} % % First we have to determine that the right kind of \LaTeX{} is % running and identify the style file. % % \begin{macrocode} %<*style> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{productbox}[\filedate Another type of boxes...] % \end{macrocode} % % A bunch of packages is loaded to form the base of the work herein. % \begin{macrocode} \RequirePackage{keyval} \RequirePackage{tikz} \usetikzlibrary{calc} \usetikzlibrary{fadings} % \end{macrocode} % % \subsection{Option Declarations} % % Define the parameters for the keyval package. They are used in % the main environemnt |Product Box| and in the declaration of % global options |\ProductBoxSet|. % % \subsubsection{General Parameters} % \begin{macrocode} \define@key{ProductBox}{scale}{% \def\ProductBox@scale{#1}} \define@key{ProductBox}{width}{% \def\ProductBox@x{#1}} \define@key{ProductBox}{height}{% \def\ProductBox@y{#1}} \define@key{ProductBox}{depth}{% \def\ProductBox@z{#1}} \define@key{ProductBox}{clean}[true]{% \csname ProductBox@clean#1\endcsname} % \end{macrocode} % % \subsubsection{Box Style Parameters} % \begin{macrocode} \define@key{ProductBox}{flat}[true]{% \def\ProductBox@style{flat}} \define@key{ProductBox}{fold}[true]{% \def\ProductBox@style{fold}} \define@key{ProductBox}{3d}[true]{% \def\ProductBox@style{threeD}} \define@key{ProductBox}{3D}[true]{% \def\ProductBox@style{threeD}} \define@key{ProductBox}{threeD}[true]{% \def\ProductBox@style{threeD}} \define@key{ProductBox}{top}[true]{% \def\ProductBox@style{top}} \define@key{ProductBox}{bottom}[true]{% \def\ProductBox@style{bottom}} \define@key{ProductBox}{front}[true]{% \def\ProductBox@style{front}} \define@key{ProductBox}{back}[true]{% \def\ProductBox@style{back}} \define@key{ProductBox}{left}[true]{% \def\ProductBox@style{left}} \define@key{ProductBox}{right}[true]{% \def\ProductBox@style{right}} \define@key{ProductBox}{empty}[true]{% \def\ProductBox@style{empty}} \define@key{ProductBox}{style}{% \def\ProductBox@style{#1}} % \end{macrocode} % % \subsubsection{Parameters for the 3D Rendering} % \begin{macrocode} \define@key{ProductBox}{shadow}[true]{% \csname ProductBox@shadow#1\endcsname} \define@key{ProductBox}{mirror}[true]{% \csname ProductBox@mirror#1\endcsname} \define@key{ProductBox}{flare}[true]{% \csname ProductBox@flare#1\endcsname} \define@key{ProductBox}{flareDiameter}{% \def\ProductBox@flareDiameter{#1}} \define@key{ProductBox}{edgeColor}{% \def\productBox@edgeColor{#1}} \define@key{ProductBox}{view}{% \@nameuse{ProductBox@View@#1}} % \end{macrocode} % % \subsubsection{Parameters for the Fold Rendering} % \begin{macrocode} \define@key{ProductBox}{earSize}{% \def\ProductBox@earSize{#1}} \define@key{ProductBox}{foldLine}{% \def\ProductBox@foldLine{#1}} \define@key{ProductBox}{foldOpacity}{% \def\ProductBox@foldOpacity{#1}} % \end{macrocode} % % \subsubsection{Parameters for the Simplified Interface} % \begin{macrocode} \define@key{ProductBox}{faceSep}{% \def\ProductBox@FaceSep{#1}} % \end{macrocode} % % \subsection{Storage for the Faces} % % \begin{macro}{\ProductBox@Front} % The box |\ProductBox@Front| contains the front material. % \begin{macrocode} \newbox\ProductBox@Front % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@Left} % The box |\ProductBox@Left| contains the left material. % \begin{macrocode} \newbox\ProductBox@Left % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@Top} % The box |\ProductBox@Top| contains the top material. % \begin{macrocode} \newbox\ProductBox@Top % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@Right} % The box |\ProductBox@Right| contains the right material. % \begin{macrocode} \newbox\ProductBox@Right % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@Bottom} % The box |\ProductBox@Bottom| contains the bottom material. % \begin{macrocode} \newbox\ProductBox@Bottom % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@Back} % The box |\ProductBox@Back| contains the back material. % \begin{macrocode} \newbox\ProductBox@Back % \end{macrocode} % \end{macro} % % \subsection{Settings} % % \begin{macro}{\ProductBoxSet} % The macro |\ProductBoxSet| defines the global parameters used by % the environment |ProductBox|. They can be overwritten either % within a group or in the optional parameter of the environment. % \begin{macrocode} \newcommand\ProductBoxSet[1]{\setkeys{ProductBox}{#1}} % \end{macrocode} % \end{macro} % % \subsection{The Main Environment} % % \begin{macro}{\ProductBox@style} % The default style is the 3D rendering. % \begin{macrocode} \newcommand\ProductBox@style{threeD} % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@x} % The width of the box. % \begin{macrocode} \newcommand\ProductBox@x{88mm} % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@y} % The height of the box. % \begin{macrocode} \newcommand\ProductBox@y{100mm} % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@z} % The depth of the box. % \begin{macrocode} \newcommand\ProductBox@z{30mm} % \end{macrocode} % \end{macro} % % \begin{macro}{ifProductBox@clean} % Indicator that the boxes for the faces should be cleaned. % \begin{macrocode} \newif\ifProductBox@clean % \end{macrocode} % \end{macro} % % \begin{macro}{ifProductBox@active} % Indicator that we are inside a |ProductBox| environment already. % \begin{macrocode} \newif\ifProductBox@active % \end{macrocode} % \end{macro} % % \begin{macro}{ifProductBox@clip} % The boolean |ProductBox@clip| determines whether or not the % additional clipping of the boxes should be enabled. % \begin{macrocode} \newif\ifProductBox@clip \ProductBox@cliptrue % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@FaceSep} % The horizontal separator of the minipage in the face definitions % in the simplified interface. % \begin{macrocode} \newcommand\ProductBox@FaceSep{1em} % \end{macrocode} % \end{macro} % % \begin{environment}{ProductBox} % This is the central environment provided by this style. In the begin code % only the local environments are initialized and the optional parameters % are evaluated with the help of the package |keyval|. % \begin{macrocode} \newenvironment{ProductBox}[1][]{% \setkeys{ProductBox}{#1}% % \end{macrocode} % % Next we clean the faces if this is required. % \changes{1.1}{2010/12/27}{Do not clean the faces upon request.} % \begin{macrocode} \ifProductBox@clean \global\setbox\ProductBox@Front\hbox{}% \global\setbox\ProductBox@Back\hbox{}% \global\setbox\ProductBox@Left\hbox{}% \global\setbox\ProductBox@Right\hbox{}% \global\setbox\ProductBox@Top\hbox{}% \global\setbox\ProductBox@Bottom\hbox{}% \fi % \end{macrocode} % % Next we define the local environments to make sure that they have % the proper definitions within this environment. Since the % environment provides an implicit group, the definitions are local % to this environment. % % To suppress any error messages about environments which are % already defined the start macros are reset to undefined. % \changes{1.1}{2010/12/23}{Simplified user interface added.} % \changes{1.1}{2010/12/25}{Suppress error messages.} % \changes{1.1}{2010/12/26}{Issue an error message for nested % ProductBox environments.} % \begin{macrocode} \ifProductBox@active \errmessage{Trying to use an environment ProductBox inside the environment ProductBox. This is not allowed.}% \else \ProductBox@activetrue \fi \let\Front\undefined \let\endFront\undefined \let\Back\undefined \let\endBack\undefined \let\Left\undefined \let\endLeft\undefined \let\Right\undefined \let\endRight\undefined \let\Top\undefined \let\endTop\undefined \let\Bottom\undefined \let\endBottom\undefined \let\FrontFace\undefined \let\endFrontFace\undefined \let\BackFace\undefined \let\endBackFace\undefined \let\LeftFace\undefined \let\endLeftFace\undefined \let\RightFace\undefined \let\endRightFace\undefined \let\TopFace\undefined \let\endTopFace\undefined \let\BottomFace\undefined \let\endBottomFace\undefined \newenvironment{Front}{\ProductBox@Start\ProductBox@Front (\ProductBox@x,\ProductBox@y)}{\ProductBox@End}% \newenvironment{Back}{\ProductBox@Start\ProductBox@Back (\ProductBox@x,\ProductBox@y)}{\ProductBox@End}% \newenvironment{Left}{\ProductBox@Start\ProductBox@Left (\ProductBox@z,\ProductBox@y)}{\ProductBox@End}% \newenvironment{Right}{\ProductBox@Start\ProductBox@Right (\ProductBox@z,\ProductBox@y)}{\ProductBox@End}% \newenvironment{Top}{\ProductBox@Start\ProductBox@Top (\ProductBox@x,\ProductBox@z)}{\ProductBox@End}% \newenvironment{Bottom}{\ProductBox@Start\ProductBox@Bottom( \ProductBox@x,\ProductBox@z)}{\ProductBox@End}% \newenvironment{FrontFace}[1][white]{\ProductBox@StartFace\ProductBox@Front {\ProductBox@x}{\ProductBox@y}{##1}}{\ProductBox@EndFace}% \newenvironment{BackFace}[1][white]{\ProductBox@StartFace\ProductBox@Back {\ProductBox@x}{\ProductBox@y}{##1}}{\ProductBox@EndFace}% \newenvironment{LeftFace}[1][white]{\ProductBox@StartFace\ProductBox@Left {\ProductBox@z}{\ProductBox@y}{##1}}{\ProductBox@EndFace}% \newenvironment{RightFace}[1][white]{\ProductBox@StartFace\ProductBox@Right {\ProductBox@z}{\ProductBox@y}{##1}}{\ProductBox@EndFace}% \newenvironment{TopFace}[1][white]{\ProductBox@StartFace\ProductBox@Top {\ProductBox@x}{\ProductBox@z}{##1}}{\ProductBox@EndFace}% \newenvironment{BottomFace}[1][white]{\ProductBox@StartFace\ProductBox@Bottom {\ProductBox@x}{\ProductBox@z}{##1}}{\ProductBox@EndFace}% \ignorespacesafterend }{% % \end{macrocode} % Check that the box style is defined or issue an appropriate error % message. % \begin{macrocode} \@ifundefined{ProductBox@style@\ProductBox@style}{% \errmessage{Box style '\ProductBox@style' for ProductBox is unknown}% }{% % \end{macrocode} % The main activity is performed in the end code. Since the % flexibility of the environment is one of its design goals, the % expansion of the macro |\ProductBox@style| is used to invoke the % macro stored in it. Optionally it is enclosed in a |\scalebox| % macro to perform the scaling. Thus the implementations of the box % styles do not need to care about scaling at all. % \begin{macrocode} \@ifundefined{ProductBox@scale}{% \@nameuse{ProductBox@style@\ProductBox@style}}{% \scalebox{\ProductBox@scale}% {\@nameuse{ProductBox@style@\ProductBox@style}} }}% \ProductBox@activefalse \ignorespacesafterend } % \end{macrocode} % \end{environment} % % \begin{macro}{\ProductBox@Start} % The macro |\ProductBox@Start| starts the environment storing a face. % \begin{macrocode} \def\ProductBox@Start#1(#2){% \global\setbox#1\hbox\bgroup\begin{tikzpicture}% \ifProductBox@clip \clip rectangle (#2); \fi }% % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@End} % The macro |\ProductBox@End| ends the environment storing a face. % \begin{macrocode} \newcommand\ProductBox@End{\end{tikzpicture}\egroup\ignorespacesafterend} % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@StartFace} % The macro |\ProductBox@StartFace| starts the environment storing % a face in a minipage. % \begin{macrocode} \newcommand\ProductBox@StartFace[4]{% \let\ProductBox@@box#1% \def\ProductBox@@w{#2}% \def\ProductBox@@h{#3}% \def\ProductBox@@args{[#4]}% \@tempdima=#2 \advance\@tempdima-\ProductBox@FaceSep \advance\@tempdima-\ProductBox@FaceSep \setbox#1\hbox\bgroup\begin{minipage}{\the\@tempdima}% \ignorespaces } % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@EndFace} % This macro ends a face definition and stores the result in the % internal box |\ProductBox@@box|. % \begin{macrocode} \newcommand\ProductBox@EndFace{\end{minipage}\egroup \global\setbox\ProductBox@@box=\hbox{\begin{tikzpicture} \ifProductBox@clip \clip rectangle (\ProductBox@@w,\ProductBox@@h); \fi \expandafter\fill \ProductBox@@args rectangle(\ProductBox@@w,\ProductBox@@h); \draw (.5*\ProductBox@@w,.5*\ProductBox@@h) node[inner sep=0pt] {\box\ProductBox@@box}; \end{tikzpicture}}\ignorespacesafterend} % \end{macrocode} % \end{macro} % % \subsection{Box Styles} % % \begin{macro}{\ProductBox@style@empty} % This macro defines the sytle \emph{empty} for a product box. It % simply does nothing. % \changes{1.1}{2010/12/26}{New box style ``empty''.} % \begin{macrocode} \newcommand\ProductBox@style@empty{} % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@style@flat} % This macro defines the sytle \emph{flat} for a product box. % \begin{macrocode} \newcommand\ProductBox@style@flat{% \par\noindent \hspace*{\ProductBox@z}\kern1mm \copy\ProductBox@Top\\[1ex] \copy\ProductBox@Left\kern1mm \copy\ProductBox@Front\kern1mm \copy\ProductBox@Right\kern1mm \copy\ProductBox@Back\\[1ex] \hspace*{\ProductBox@z}\kern1mm \copy\ProductBox@Bottom\par } % \end{macrocode} % \end{macro} % % \subsubsection{Box Style \texttt{front}} % % \begin{macro}{\ProductBox@style@front} % This macro defines the sytle \emph{front} for a product box. Only this % one face of the box is shown. % \begin{macrocode} \newcommand\ProductBox@style@front{% \copy\ProductBox@Front } % \end{macrocode} % \end{macro} % % \subsubsection{Box Style \texttt{back}} % % \begin{macro}{\ProductBox@style@back} % This macro defines the sytle \emph{back} for a product box. Only this % one face of the box is shown. % \begin{macrocode} \newcommand\ProductBox@style@back{%class \copy\ProductBox@Back } % \end{macrocode} % \end{macro} % % \subsubsection{Box Style \texttt{left}} % % \begin{macro}{\ProductBox@style@left} % This macro defines the sytle \emph{left} for a product box. Only this % one face of the box is shown. % \begin{macrocode} \newcommand\ProductBox@style@left{% \copy\ProductBox@Left } % \end{macrocode} % \end{macro} % % \subsubsection{Box Style \texttt{right}} % % \begin{macro}{\ProductBox@style@right} % This macro defines the sytle \emph{right} for a product box. Only this % one face of the box is shown. % \begin{macrocode} \newcommand\ProductBox@style@right{% \copy\ProductBox@Right } % \end{macrocode} % \end{macro} % % \subsubsection{Box Style \texttt{top}} % % \begin{macro}{\ProductBox@style@top} % This macro defines the sytle \emph{top} for a product box. Only this % one face of the box is shown. % \begin{macrocode} \newcommand\ProductBox@style@top{% \copy\ProductBox@Top } % \end{macrocode} % \end{macro} % % \subsubsection{Box Style \texttt{bottom}} % % \begin{macro}{\ProductBox@style@bottom} % This macro defines the sytle \emph{bottom} for a product box. Only this % one face of the box is shown. % \begin{macrocode} \newcommand\ProductBox@style@bottom{% \copy\ProductBox@Bottom } % \end{macrocode} % \end{macro} % % \subsubsection{Box Style \texttt{fold}} % % \begin{macro}{\ProductBox@earSize} % Parameter for the size of the ears. % \begin{macrocode} \newcommand\ProductBox@earSize{12mm} % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@foldLine} % The color of the additional lines in the fold rendering. % \begin{macrocode} \newcommand\ProductBox@foldLine{white!80!black} % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@foldOpacity} % The color of the additional lines in the fold rendering. % \begin{macrocode} \newcommand\ProductBox@foldOpacity{.5} % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@style@fold} % This macro defines the sytle \emph{fold} for a product box. % \begin{macrocode} \newcommand\ProductBox@style@fold{% \begin{tikzpicture}[sw/.style={anchor=south west, inner sep=0pt}, se/.style={anchor=south east, inner sep=0pt}, nw/.style={anchor=north west, inner sep=0pt}, num/.style={circle, fill=white!90!black, fill opacity=.5, font=\tiny\bfseries\sffamily}] % \end{macrocode} % left face % \begin{macrocode} \begin{scope} \clip rectangle (\ProductBox@z,\ProductBox@y); \draw node[sw]{\copy\ProductBox@Left}; \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] rectangle (\ProductBox@z,\ProductBox@y); \end{scope} % \end{macrocode} % front face % \begin{macrocode} \begin{scope}[xshift=\ProductBox@z] \clip rectangle (\ProductBox@x,\ProductBox@y); \draw node[sw]{\copy\ProductBox@Front}; \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] rectangle (\ProductBox@x,\ProductBox@y); \end{scope} % \end{macrocode} % right face % \begin{macrocode} \begin{scope}[xshift=\ProductBox@z+\ProductBox@x] \clip rectangle (\ProductBox@z,\ProductBox@y); \draw node[sw]{\copy\ProductBox@Right}; \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] rectangle (\ProductBox@z,\ProductBox@y); \end{scope} % \end{macrocode} % back face % \begin{macrocode} \begin{scope}[xshift=\ProductBox@x+2*\ProductBox@z] \clip rectangle (\ProductBox@x,\ProductBox@y); \draw node[sw]{\copy\ProductBox@Back}; \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] rectangle (\ProductBox@x,\ProductBox@y); \end{scope} % \end{macrocode} % top face % \begin{macrocode} \begin{scope}[xshift=\ProductBox@z,yshift=\ProductBox@y] \clip rectangle (\ProductBox@x,\ProductBox@z); \draw node[sw]{\copy\ProductBox@Top}; \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] rectangle (\ProductBox@x,\ProductBox@z); \end{scope} % \end{macrocode} % bottom ear 3 front % \begin{macrocode} \begin{scope}[xshift=\ProductBox@z] \clip (0mm,0mm) -- (.5*\ProductBox@z,-.5*\ProductBox@z) -- (.5*\ProductBox@z,-\ProductBox@z) -- (\ProductBox@x-.5*\ProductBox@z,-\ProductBox@z) -- (\ProductBox@x-.5*\ProductBox@z,-.5*\ProductBox@z) -- (\ProductBox@x,0mm) -- cycle; \draw (\ProductBox@x,-\ProductBox@z) node[se]{\copy\ProductBox@Bottom}; \draw [thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] (0mm,0mm) -- (.5*\ProductBox@z,-.5*\ProductBox@z) -- (.5*\ProductBox@z,-\ProductBox@z) -- (\ProductBox@x-.5*\ProductBox@z,-\ProductBox@z) -- (\ProductBox@x-.5*\ProductBox@z,-.5*\ProductBox@z) -- (\ProductBox@x,0mm) -- cycle; \draw (.5*\ProductBox@x,-.75*\ProductBox@z) node[num]{3}; \end{scope} % \end{macrocode} % bottom ear 1 back % \begin{macrocode} \begin{scope}[xshift=\ProductBox@x+2*\ProductBox@z] \clip (0mm,0mm) -- (0mm,-\ProductBox@z) -- (.5*\ProductBox@z,-\ProductBox@z) -- (.5*\ProductBox@z,-.5*\ProductBox@z) -- (\ProductBox@x-.5*\ProductBox@z,-.5*\ProductBox@z) -- (\ProductBox@x-.5*\ProductBox@z,-\ProductBox@z) -- (\ProductBox@x,-\ProductBox@z) -- (\ProductBox@x,0mm) -- cycle; \draw node[se,rotate=180]{\copy\ProductBox@Bottom}; \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] (0mm,0mm) -- (0mm,-\ProductBox@z) -- (.5*\ProductBox@z,-\ProductBox@z) -- (.5*\ProductBox@z,-.5*\ProductBox@z) -- (\ProductBox@x-.5*\ProductBox@z,-.5*\ProductBox@z) -- (\ProductBox@x-.5*\ProductBox@z,-\ProductBox@z) -- (\ProductBox@x,-\ProductBox@z) -- (\ProductBox@x,0mm) -- cycle; \draw (.25*\ProductBox@z,-.75*\ProductBox@z) node[num]{1}; \draw (\ProductBox@x-.25*\ProductBox@z,-.75*\ProductBox@z) node[num]{1}; \end{scope} % \end{macrocode} % bottom ear 2 right % \begin{macrocode} \begin{scope}[xshift=\ProductBox@z+\ProductBox@x] \clip (0mm,0mm) -- (\ProductBox@z,0mm) -- (.5*\ProductBox@z,-.5*\ProductBox@z) -- (.5*\ProductBox@z,-\ProductBox@z) -- (0mm,-\ProductBox@z) -- cycle; \draw (\ProductBox@z,0mm) node[se,rotate=90]{\copy\ProductBox@Bottom}; \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] (0mm,0mm) -- (\ProductBox@z,0mm) -- (.5*\ProductBox@z,-.5*\ProductBox@z) -- (.5*\ProductBox@z,-\ProductBox@z) -- (0mm,-\ProductBox@z) -- cycle; \draw (.25*\ProductBox@z,-.75*\ProductBox@z) node[num]{2}; \end{scope} % \end{macrocode} % bottom ear 2 left % \begin{macrocode} \begin{scope} \clip (0mm,0mm) -- (\ProductBox@z,0mm) -- (\ProductBox@z,-\ProductBox@z) -- (.5*\ProductBox@z,-\ProductBox@z) -- (.5*\ProductBox@z,-.5*\ProductBox@z) -- cycle; \draw node[sw,rotate=270]{\copy\ProductBox@Bottom}; \draw [thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] (0mm,0mm) -- (\ProductBox@z,0mm) -- (\ProductBox@z,-\ProductBox@z) -- (.5*\ProductBox@z,-\ProductBox@z) -- (.5*\ProductBox@z,-.5*\ProductBox@z) -- cycle; \draw (.75*\ProductBox@z,-.75*\ProductBox@z) node[num]{2}; \end{scope} % \end{macrocode} % glue ear % \begin{macrocode} \begin{scope}[xshift=2*\ProductBox@x+2*\ProductBox@z] \clip (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize/4) -- (\ProductBox@earSize/2,\ProductBox@y-\ProductBox@earSize/4) -- (0mm,\ProductBox@y) -- cycle; \draw node[sw]{\copy\ProductBox@Left}; \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize/4) -- (\ProductBox@earSize/2,\ProductBox@y-\ProductBox@earSize/4) -- (0mm,\ProductBox@y) -- cycle; \end{scope} % \end{macrocode} % top ear left % \begin{macrocode} \begin{scope}[yshift=\ProductBox@y] \clip (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@z-\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@z,0mm) -- cycle; \draw node[nw,rotate=90]{\copy\ProductBox@Top}; \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@z-\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@z,0mm) -- cycle; \end{scope} % \end{macrocode} % top ear right % \begin{macrocode} \begin{scope}[xshift=\ProductBox@x+\ProductBox@z, yshift=\ProductBox@y] \clip (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@z-\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@z,0mm) -- cycle; \draw node[se,rotate=270]{\copy\ProductBox@Top}; \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@z-\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@z,0mm) -- cycle; \end{scope} % \end{macrocode} % top ear back % \begin{macrocode} \begin{scope}[xshift=\ProductBox@z, yshift=\ProductBox@y+\ProductBox@z] \clip (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@x-\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@x,0mm) -- cycle; \draw (0mm,\ProductBox@y) node[se,rotate=180]{\copy\ProductBox@Back}; \draw[thin,opacity=\ProductBox@foldOpacity,\ProductBox@foldLine] (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@x-\ProductBox@earSize/2,\ProductBox@earSize) -- (\ProductBox@x,0mm) -- cycle; \end{scope} \end{tikzpicture}} % \end{macrocode} % \end{macro} % % \subsubsection{Box Style \texttt{threeD}} % % \begin{macro}{\ProductBoxThreeDStartHook} % A hook to add some code at the beginning. % \begin{macrocode} \newcommand\ProductBoxThreeDStartHook{} % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBoxThreeDEndHook} % A hook to add some code at the end. % \begin{macrocode} \newcommand\ProductBoxThreeDEndHook{} % \end{macrocode} % \end{macro} % % \begin{macro}{\ifProductBox@shadow} % The boolean |ProductBox@shadow| determines whether or not the % shadow in the 3D rendering is shown. % \begin{macrocode} \newif\ifProductBox@shadow \ProductBox@shadowtrue % \end{macrocode} % \end{macro} % % \begin{macro}{\ifProductBox@mirror} % The boolean |ProductBox@mirror| determines whether or not the % mirror effect in the 3D rendering is shown. % \begin{macrocode} \newif\ifProductBox@mirror % \end{macrocode} % \end{macro} % % \begin{macro}{\ifProductBox@flare} % The boolean |ProductBox@flare| determines whether or not the % flare effect in the 3D rendering is shown. % \begin{macrocode} \newif\ifProductBox@flare % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@edgeColor} % The edge color in the 3D rendering. % \begin{macrocode} \newcommand\ProductBox@edgeColor{white} % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@flareDiameter} % The diameter of the flare. % \begin{macrocode} \newcommand\ProductBox@flareDiameter{24mm} % \end{macrocode} % \end{macro} % % The angle to rotate the box about the z axis. % \begin{macrocode} \newcommand\ProductBox@angleZ{8} % \end{macrocode} % % The angle to rotate the box about the x axis. % \begin{macrocode} \newcommand\ProductBox@angleX{10} % \end{macrocode} % % \begin{macro}{\ProductBox@style@threeD} % This macro defines the sytle \emph{threeD} for a product box. The % faces are placed such the illusion of a three-dimensional box % appears. In addition a shadow is shown if not disabled. % \changes{1.1}{2010/12/26}{Fix: The flare is also transformed and clipped.} % \begin{macrocode} \newcommand\ProductBox@style@threeD{ \begin{tikzpicture}[sw/.style={anchor=south west, inner sep=0pt}] \ProductBoxThreeDStartHook \ifProductBox@mirror \ProductBox@threeD@mirror \fi \ifProductBox@shadow \ProductBox@threeD@shadow \fi \begin{scope} \fill[white, yslant=\ProductBox@p@front@yslant, xscale=\ProductBox@p@front@xscale, yscale=\ProductBox@p@front@yscale, anchor=south west] rectangle (\ProductBox@x,\ProductBox@y); \draw node[sw, yslant=\ProductBox@p@front@yslant, xscale=\ProductBox@p@front@xscale, yscale=\ProductBox@p@front@yscale] {\copy\ProductBox@Front}; \fill[black, fill opacity=.025, yslant=\ProductBox@p@front@yslant, xscale=\ProductBox@p@front@xscale, yscale=\ProductBox@p@front@yscale, anchor=south west] rectangle (\ProductBox@x,\ProductBox@y); \ifProductBox@flare \begin{scope}[ yslant=\ProductBox@p@front@yslant, xscale=\ProductBox@p@front@xscale, yscale=\ProductBox@p@front@yscale] \clip rectangle(\ProductBox@x,\ProductBox@y); \ProductBox@threeD@flare \end{scope} \fi \end{scope} \begin{scope}[shift={(-\ProductBox@p@left@xscale*\ProductBox@z, \ProductBox@p@left@yslant *\ProductBox@p@left@xscale *\ProductBox@z)}] \fill[white, yslant=-\ProductBox@p@left@yslant, xscale=\ProductBox@p@left@xscale, yscale=\ProductBox@p@left@yscale, anchor=south west] rectangle (\ProductBox@z,\ProductBox@y); \draw node[sw, yslant=-\ProductBox@p@left@yslant, xscale=\ProductBox@p@left@xscale, yscale=\ProductBox@p@left@yscale] {\copy\ProductBox@Left}; \fill[black, fill opacity=.25, yslant=-\ProductBox@p@left@yslant, xscale=\ProductBox@p@left@xscale, yscale=\ProductBox@p@left@yscale, anchor=south west] rectangle (\ProductBox@z,\ProductBox@y); \end{scope} \begin{scope}[yshift=\ProductBox@y] \fill [white, anchor=south west, xslant=-\ProductBox@p@top@xslant, xscale=\ProductBox@p@top@xscale, yslant=\ProductBox@p@top@yslant, yscale=\ProductBox@p@top@yscale] rectangle (\ProductBox@x,\ProductBox@z); \draw node[sw, xslant=-\ProductBox@p@top@xslant, xscale=\ProductBox@p@top@xscale, yslant=\ProductBox@p@top@yslant, yscale=\ProductBox@p@top@yscale] {\copy\ProductBox@Top}; \fill [black, fill opacity=.0025, anchor=south west, xslant=-\ProductBox@p@top@xslant, xscale=\ProductBox@p@top@xscale, yslant=\ProductBox@p@top@yslant, yscale=\ProductBox@p@top@yscale] rectangle (\ProductBox@x,\ProductBox@z); \end{scope} \begin{scope}[shift={(-\ProductBox@p@left@xscale*\ProductBox@z, \ProductBox@p@left@yslant*\ProductBox@p@left@xscale*\ProductBox@z)}] \draw [\ProductBox@edgeColor, line width=.5mm, draw opacity=.25, yslant=-\ProductBox@p@left@yslant, xscale=\ProductBox@p@left@xscale] (\ProductBox@z,0mm) -- (\ProductBox@z,\ProductBox@y) -- (0mm,\ProductBox@y); \end{scope} \draw [\ProductBox@edgeColor, line width=.5mm, draw opacity=.25, yslant=\ProductBox@p@front@yslant, xscale=\ProductBox@p@front@xscale, anchor=south west] (0mm,\ProductBox@y) -- (\ProductBox@x,\ProductBox@y); \ProductBoxThreeDEndHook \end{tikzpicture}} % \end{macrocode} % \end{macro} % % Parameters and views. % % \begin{macrocode} \newcommand\ProductBox@setFrontParams[3]{% \def\ProductBox@p@front@yslant{#1}% \def\ProductBox@p@front@xscale{#2}% \def\ProductBox@p@front@yscale{#3}% } \newcommand\ProductBox@setLeftParams[3]{% \def\ProductBox@p@left@yslant{#1}% \def\ProductBox@p@left@xscale{#2}% \def\ProductBox@p@left@yscale{#3}% } \newcommand\ProductBox@setTopParams[4]{% \def\ProductBox@p@top@xslant{#1}% \def\ProductBox@p@top@yslant{#2}% \def\ProductBox@p@top@xscale{#3}% \def\ProductBox@p@top@yscale{#4}% } \newcommand\ProductBox@setMirrorParams[1]{% \def\ProductBox@p@mirror@yscale{#1}% } \@namedef{ProductBox@View@1}{% \ProductBox@setFrontParams{.25}{.9090909}{1}% \ProductBox@setLeftParams{.5}{.6666666}{1}% \ProductBox@setTopParams{2}{.2265}{1.363}{.3333333}% \ProductBox@setMirrorParams{.4}} \@namedef{ProductBox@View@2}{% \ProductBox@setFrontParams{.15}{.9090909}{1}% \ProductBox@setLeftParams{.6666666}{.5}{1}% \ProductBox@setTopParams{1.5}{.12}{1.11}{.333333}% \ProductBox@setMirrorParams{.4}} \@namedef{ProductBox@View@3}{% \ProductBox@setFrontParams{.05}{.95}{1}% \ProductBox@setLeftParams{.25}{.4}{1}% \ProductBox@setTopParams{4}{.04}{1.133333}{.1}% \ProductBox@setMirrorParams{.4}} \@nameuse{ProductBox@View@1} % \end{macrocode} % % \begin{macro}{\ProductBox@threeD@shadow} % This macro defines the code to produce the shadow effect for the 3D rendering. % \begin{macrocode} \newcommand\ProductBox@threeD@shadow{ \begin{scope} \foreach \x in {.5,1,1.5,2,2.5,3,4,5,6,8,10} { \filldraw [black, line width=\x mm, rounded corners=2mm, opacity=.01, shift={(-1mm,1mm)}] (0mm,0mm) -- (-\ProductBox@p@top@xslant *\ProductBox@p@left@xscale *\ProductBox@z, \ProductBox@p@top@yscale *\ProductBox@z) -- (0mm, \ProductBox@p@top@yscale*\ProductBox@z + \ProductBox@p@top@xslant *\ProductBox@p@left@xscale *\ProductBox@p@top@yslant *\ProductBox@z) -- cycle; } \end{scope} } % \end{macrocode} % \end{macro} % % The following fading is used for the mirror effect in the 3D rendering. % \begin{macrocode} \tikzfading[name=ProductBoxFade, top color=transparent!100, bottom color=transparent!50, middle color=transparent!100] % \end{macrocode} % \begin{macro}{\ProductBox@threeD@mirror} % This macro defines the code to produce the mirror effect. % \changes{1.1}{2010/12/27}{Code rewritten to make full use of tranparency.} % \begin{macrocode} \newcommand\ProductBox@threeD@mirror{% \fill node[anchor=south west, inner sep=0pt, yslant=\ProductBox@p@front@yslant, xscale=\ProductBox@p@front@xscale, yscale=-\ProductBox@p@mirror@yscale] {\begin{tikzpicture} \clip rectangle (\ProductBox@x, \ProductBox@y*\ProductBox@p@mirror@yscale); \fill node [scope fading=ProductBoxFade, yscale=\ProductBox@p@mirror@yscale, inner sep=0pt]{\copy\ProductBox@Front}; \end{tikzpicture}}; \fill[xshift=-\ProductBox@p@left@xscale*\ProductBox@z, yshift=\ProductBox@p@top@yscale*\ProductBox@z] node[anchor=south west, inner sep=0pt, yslant=-\ProductBox@p@left@yslant, xscale=\ProductBox@p@left@xscale, yscale=-\ProductBox@p@mirror@yscale] {\begin{tikzpicture} \clip rectangle (\ProductBox@z, \ProductBox@y*\ProductBox@p@mirror@yscale); \fill node [scope fading=ProductBoxFade, yscale=\ProductBox@p@mirror@yscale, inner sep=0pt]{\copy\ProductBox@Left}; \end{tikzpicture}}; } % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@threeD@flare} % This macro defines the code to produce the flare effect. The % flare is achieved with overlaying a partially transparent and % fading circle of white color. % \begin{macrocode} \newcommand\ProductBox@threeD@flare{ \fill [white,path fading=ProductBoxFlare] (.8*\ProductBox@x,.9*\ProductBox@y) circle(\ProductBox@flareDiameter); } % \end{macrocode} % \end{macro} % % The following fading is used for the flare effect in the 3D rendering. % \begin{macrocode} \tikzfading[name=ProductBoxFlare, inner color=transparent!60, outer color=transparent!100] % \end{macrocode} % % Finally we define some variant names. % \begin{macrocode} \@namedef{ProductBox@style@3D}{\ProductBox@style@threeD} \@namedef{ProductBox@style@3d}{\ProductBox@style@threeD} % % \end{macrocode} % That's all. % % \newpage % \setcounter{IndexColumns}2 % \PrintChanges % \newpage % \PrintIndex % \Finale \endinput % % Local Variables: % End: