From 23e10ea724490edf980413190b4a9ae00442ef40 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 30 Dec 2010 23:41:51 +0000 Subject: productbox 1.1 (30dec10) git-svn-id: svn://tug.org/texlive/trunk@20886 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/productbox/productbox.dtx | 2112 +++++++++++++------- .../source/latex/productbox/productbox.ins | 46 + 2 files changed, 1447 insertions(+), 711 deletions(-) create mode 100644 Master/texmf-dist/source/latex/productbox/productbox.ins (limited to 'Master/texmf-dist/source/latex/productbox') diff --git a/Master/texmf-dist/source/latex/productbox/productbox.dtx b/Master/texmf-dist/source/latex/productbox/productbox.dtx index 78add9542f5..b5320bbbe36 100644 --- a/Master/texmf-dist/source/latex/productbox/productbox.dtx +++ b/Master/texmf-dist/source/latex/productbox/productbox.dtx @@ -1,22 +1,21 @@ -%%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%^^A $Id: productbox.dtx 8332 2010-12-20 22:22:36Z gene $ +%^^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-diemnsional product box. This product box can be rendered +%% 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.tex to get the full documentation in pdf format. +%% productbox.dtx with the doc style/package. LaTeX the file +%% productbox.dtx to get the full documentation in pdf format. %% %% Prerequisite: -%% This package needs PGF and TikZ to be present at least in -%% version 2.0. +%% This package needs TikZ to be present at least in version 2.0. %% %% Author: Gerd Neugebauer %% Im Lerchelsb\"ohl 5 @@ -30,85 +29,72 @@ %% 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\ as of \filedate.}} +% 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{gene@gerd-neugebauer.de}} -% -% \date{{\footnotesize Documentation date: \docdate}} -% +% 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,\@highpenalty,\@ifnextchar,\@ifstar} -% \DoNotIndex{\@ifundefined,\@namedef,\@nameuse,\@pnumwidth,\@startsection} -% \DoNotIndex{\@starttoc,\@tempdima,\@thefnmark,\@undefined} -% \DoNotIndex{\@ixpt,\@vpt,\@vipt,\@viipt,\@viiipt} -% \DoNotIndex{\@xpt,\@xipt,\@xiipt,\@xivpt,\@xvii,\@xxpt,\@xxvpt} -% \DoNotIndex{\AA,\AE} -% \DoNotIndex{\CurrentOption,\DeclareOption,\H,\L,\LARGE,\LaTeX,\Large} -% \DoNotIndex{\LoadClass,\O,\OE,\OptionNotUsed,\PassOptionsToClass} +% \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{\aa,\addcontentsline,\addpenalty,\advance,\addvspace,\ae} -% \DoNotIndex{\ast,\arabic} -% \DoNotIndex{\b,\baselineskip,\begin,\begingroup,\bf,\bgroup,\egroup} -% \DoNotIndex{\bigskip,\box,\bullet} -% \DoNotIndex{\c,\cal,\catcode,\chardef,\circ,\clearpage,\closein,\closeout} -% \DoNotIndex{\clubpenalty,\csname} -% \DoNotIndex{\d,\def,\dimen,\diamond,\divide,\documentclass,\dp} -% \DoNotIndex{\else,\em,\empty,\end,\endcsname,\endgroup,\endinput,\endlist} -% \DoNotIndex{\expandafter,\fbox,\fi,\footskip,\framebox,\frenchspacing} -% \DoNotIndex{\futurelet,\gdef,\global,\gobble} -% \DoNotIndex{\hangafter,\hangindent,\hbox,\headheight,\headsep,\hfil} -% \DoNotIndex{\hfill,\hrule,\hskip,\hspace,\hss,\ht,\huge,\ifcat,\ifeof} -% \DoNotIndex{\ifdim,\ifx,\ignorespaces,\immediate,\index,\input,\it} -% \DoNotIndex{\itemindent,\itemsep,\jobname,\kern,\l,\labelsep,\labelwidth} -% \DoNotIndex{\large,\leavevmode,\leftmark,\leftskip,\let,\list} -% \DoNotIndex{\llap,\long,\lower} -% \DoNotIndex{\m@th,\makebox,\magstep,\makeindex,\markboth,\mbox,\medskip} +% \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,\newread,\newwrite} -% \DoNotIndex{\nobreak,\noindent,\normalsize,\null,\o,\oe} -% \DoNotIndex{\openin,\openout,\or,\pagestyle,\par,\paragraph,\parbox} +% \DoNotIndex{\newif,\newpage,\nobreak,\noindent,\normalsize,\null} +% \DoNotIndex{\or,\pagestyle,\par,\paragraph,\parbox} % \DoNotIndex{\parfillskip,\parindent,\parsep,\parskip,\partopsep} -% \DoNotIndex{\penalty,\quad} -% \DoNotIndex{\raggedbottom,\raise,\relax,\renewcommand,\renewenvironment} -% \DoNotIndex{\rightskip,\rm,\rule} +% \DoNotIndex{\relax,\renewcommand,\renewenvironment,\rm,\rule} % \DoNotIndex{\sbox,\sc,\setcounter,\settowidth,\sf,\sfcode,\sl} -% \DoNotIndex{\sloppy,\small,\space,\ss,\string,\symbol} -% \DoNotIndex{\t,\tenex,\textstyle,\the,\thepage,\thispagestyle} +% \DoNotIndex{\small,\space,\string,\symbol} +% \DoNotIndex{\the,\thepage,\thispagestyle} % \DoNotIndex{\topmargin,\topsep,\tt,\typeout} -% \DoNotIndex{\u,\unitlength,\usecounter,\v,\varepsilon,\vbox} -% \DoNotIndex{\vfill,\vsize,\vskip,\vspace,\vss} -% \DoNotIndex{\wd,\widowpenalty,\write,\xdef,\z@} +% \DoNotIndex{\unitlength,\usecounter,\varepsilon,\vbox} +% \DoNotIndex{\vfill,\vsize,\vskip,\vspace,\vss,\xdef} % \DoNotIndex{\usetikzlibrary,\usepackage,\tikzfading,\setkeys} -% \DoNotIndex{\setbox,\scalebox,\pgftransformyslant,\pgftransformyshift} -% \DoNotIndex{\pgftransformyscale,\pgftransformxslant,\pgftransformxshift} -% \DoNotIndex{\pgftransformxscale,\pgfsetcornersarced,\pgfpoint} +% \DoNotIndex{\setbox,\scalebox} % \DoNotIndex{\newbox,\ignorespacesafterend,\foreach,\filldraw} % \DoNotIndex{\fill,\errmessage,\draw,\define@key,\copy,\clip} -% \DoNotIndex{\RecordChanges,\ProvidesPackage,\NeedsTeXFormat} -% \DoNotIndex{\InputIfFileExists,\EnableCrossrefs,\DocInput} -% \DoNotIndex{\DeleteShortVerb,\CodelineIndex} % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \CheckSum{791} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \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 @@ -127,12 +113,15 @@ %% %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % +% \newcommand\TikZ{Ti\textit{k}Z} +% % \begin{abstract} -% \textsf{productbox.dtx} provides a style file for typesetting a -% three-diemnsional 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. +% 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}% @@ -141,249 +130,541 @@ % \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,fill=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,fill=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}|\\ -% | \end{Top}|\\ -% | \begin{Left}|\\ -% | \fill [top color=yellow!20!red,bottom color=yellow!80!red]|\\ -% | rectangle (30mm,100mm);| -% \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} -% \end{Top} -% \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} -% \end{ProductBox} +% \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} % -% This style is based on Ti\emph{k}Z and \textsc{pgf} at least in -% version 2.0. It is best used with a \LaTeX\ variant which is able -% to produce PDF. If no proper tool chain is used then some of the -% effects should not be used. -% +% 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 envrionment |ProductBox| provides the central means for +% 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. +% 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. % -% {\footnotesize\tt +% \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}|\\ -% | \shade [bottom color=white!30!blue,top color=white]|\\ -% | (0mm,0mm) rectangle (88mm,100mm);|\\ -% | \draw (44mm,50mm) node{{\Huge Product Box}};|\\ +% | \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}|\\ -% | \shade [top color=yellow!30!red,bottom color=white]|\\ -% | (0mm,0mm) rectangle (88mm,100mm);|\\ -% | \draw (44mm,50mm) node{{\large 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}|\\ -% | \shade [outer color=white!30!red,inner color=white]|\\ -% | (0mm,0mm) rectangle (88mm,30mm);|\\ -% | \draw (44mm,15mm) node{{\large 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,inner color=black]|\\ -% | (0mm,0mm) rectangle (88mm,30mm);|\\ -% | \draw (44mm,15mm) node{{\large 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]|\\ -% | (0mm,0mm) rectangle (30mm,100mm);|\\ -% | \draw (15mm,50mm) node{{\large Left}};|\\ +% | rectangle (30mm,100mm);|\\ +% | \draw (15mm,50mm) node{\large Left};|\\ % | \end{Left}|\\ % | \begin{Right}|\\ -% | \fill [left color=white,right color=black]|\\ -% | (0mm,0mm) rectangle (30mm,100mm);|\\ -% | \draw (15mm,50mm) node{{\large Right}};|\\ +% | \fill [top color=green,bottom color=yellow]|\\ +% | rectangle (30mm,100mm);|\\ +% | \draw (15mm,50mm) node{\large Right};|\\ % | \end{Right}|\\ % |\end{ProductBox}| -% } -% -% \def\sample[#1]{% -% \begin{ProductBox}[scale=.25,#1] +% \end{minipage}\egroup +% \fcolorbox{red!30!black}{yellow!30!white}{\box127}} +% \newcommand\sample[1]{% +% \begin{ProductBox}[scale=.25,#1]\sf % \begin{Front} -% \shade [bottom color=white!30!blue,top color=white] (0mm,0mm) rectangle (88mm,100mm); -% \draw (44mm,50mm) node{{\Huge Product Box}}; +% \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} -% \shade [top color=yellow!30!red,bottom color=white] (0mm,0mm) rectangle (88mm,100mm); -% \draw (44mm,50mm) node{{\large 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} -% \shade [outer color=white!30!red,inner color=white] (0mm,0mm) rectangle (88mm,30mm); -% \draw (44mm,15mm) node{{\large 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,inner color=black] (0mm,0mm) rectangle (88mm,30mm); -% \draw (44mm,15mm) node{{\large 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] (0mm,0mm) rectangle (30mm,100mm); -% \draw (15mm,50mm) node{{\large Left}}; +% \fill [left color=green,right color=yellow] +% rectangle (30mm,100mm); +% \draw (15mm,50mm) node{\large Left}; % \end{Left} % \begin{Right} -% \fill [left color=white,right color=black] (0mm,0mm) rectangle (30mm,100mm); -% \draw (15mm,50mm) node{{\large Right}}; +% \fill [top color=green,bottom color=yellow] +% rectangle (30mm,100mm); +% \draw (15mm,50mm) node{\large Right}; % \end{Right} % \end{ProductBox}% % } % -% \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} -% -% \subsection{Content of the Environment} -% -% The content of the environment 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 \texttt{Front}, -% \texttt{Back}, \texttt{Left}, \texttt{Right}, \texttt{Top}, and -% \texttt{Bottom}. They are defined inside the main +% 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 -% contenzs of the respective faces of the box. +% contents of the respective faces of the box. % % Note that in the three-dimensional rendering will show at most -% three of the faces. It doies not hurt to define all of them, even +% 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 \texttt{Front} is used to define the content of -% the font face. The environment prosesses its contents inside a -% \texttt{tikzpikture} of the default size 88mm$\times$100mm. +% 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 \texttt{Back} is used to define the content of -% the back face. The environment prosesses its contents inside a -% \texttt{tikzpikture} of the default size 88mm$\times$100mm. +% 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 \texttt{Left} is used to define the content of +% The environment |Left| is used to define the content of % the left face, i.e. the face left to the front page. The -% environment prosesses its contents inside a \texttt{tikzpikture} -% of the default size 30mm$\times$100mm. Usually anything outside -% of this range is clipped. +% 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 \texttt{Right} is used to define the content of +% The environment |Right| is used to define the content of % the right face, i.e. the face right to the front page. The -% environment prosesses its contents inside a \texttt{tikzpikture} -% of the default size 30mm$\times$100mm. Usually anything outside of this -% range is clipped. +% 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 \texttt{Top} is used to define the content of the -% top face. The environment prosesses its contents inside a -% \texttt{tikzpikture} of the default size 88mm$\times$30mm. Usually +% 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 \texttt{Bottom} is used to define the content of the -% top face. The environment prosesses its contents inside a -% \texttt{tikzpikture} of the default size 88mm$\times$30mm. Usually +% 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 Environment} +% \subsection{Settings and Options of the Main Environment}\label{sec:options} % -% The environment \texttt{ProductBox} can take some options to +% The environment |ProductBox| can take some options to % influence the appearance of the product box. Those options are % comma separated. % @@ -395,13 +676,13 @@ % }}% % \CODE{\textcolor{blue}{\char92begin}\char123ProductBox\char125[shape=3d]} % -% The settings are local to the environment. If an option is not +% 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| modify the global setting of the -% product box style. The arguments are the same like the optional -% arguments of the environment \texttt{ProductBox} -- but enclosed +% 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 } @@ -409,9 +690,9 @@ % The following options can be used to influence the result of the product % box. % -% \def\SAMPLE[#1]{ +% \newcommand\SAMPLE[1]{ % \noindent -% \fcolorbox{red!30!black}{yellow!30!white}{\begin{minipage}[b]{.44\textwidth}\footnotesize\tt +% \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\\ @@ -424,139 +705,328 @@ % \hspace*{2em}...\\ % \textcolor{blue}{\char92end}\char123ProductBox\char125 % \end{minipage}}\hfill -% \begin{minipage}[b]{.54\textwidth}\hfill -% \sample[#1] +% \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. Nevertheless unknown box styles will lead to an error message. +% accepted. Unknown box styles will lead to an error message. % -% \SAMPLE[style=3D] +% \SAMPLE{style=3D} % % \DescribeMacro{3D} -% The box style \texttt{3D} is the default. It produces a -% three-dimensional box rendering with a drop shadow. The option -% \texttt{3D} is an abbreviation for \texttt{style=3D}. It can also be -% written as \texttt{3d} or \texttt{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[] +% \SAMPLE{} % % \DescribeMacro{shadow} -% The option \texttt{shadow} controls the drawing of the drop shadow in the +% 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|. +% |false|. The default value is |true|. % -% The option \texttt{shadow} is the abbreviation for |shadow=true|. +% The option |shadow| is the abbreviation for |shadow=true|. % -% \SAMPLE[shadow=false] +% \SAMPLE{shadow=false} % % \DescribeMacro{mirror} -% The option \texttt{mirror} controls the rendering of the mirror effect in +% 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|. +% |false|. The default value is |false|. % -% The option \texttt{mirror} is the abbreviation for |mirror=true|. +% The option |mirror| is the abbreviation for |mirror=true|. % -% \SAMPLE[mirror=true] +% \SAMPLE{mirror=true} % % \DescribeMacro{flare} -% The option \texttt{flare} controls the rendering of the flare effect in -% the 3D rendering. It is a boolean value taking the values |true| and -% |false|. The default value is |false|. +% 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|. % -% The option \texttt{flare} is the abbreviation for |flare=true|. +% \SAMPLE{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 \texttt{fold} switches to the box style for rendering a +% The option |fold| switches to the box style for rendering a % complete wire frame with all faces in place. The option -% \texttt{fold} is an abbreviation for \texttt{style=fold}. +% |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. % -% \SAMPLE[fold] +% \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 \texttt{front} switches to the box style for rendering the -% front face only. The option \texttt{front} is an abbreviation for -% \texttt{style=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] +% \SAMPLE{front} % % \DescribeMacro{back} -% The option \texttt{back} switches to the box style for rendering the -% back face only. The option \texttt{back} is an abbreviation for -% \texttt{style=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] +% \SAMPLE{back} % % \DescribeMacro{left} -% The option \texttt{left} switches to the box style for rendering the -% back face only. The option \texttt{left} is an abbreviation for -% \texttt{style=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] +% \SAMPLE{left} % % \DescribeMacro{right} -% The option \texttt{right} switches to the box style for rendering the -% back face only. The option \texttt{right} is an abbreviation for -% \texttt{style=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] +% \SAMPLE{right} % % \DescribeMacro{top} -% The option \texttt{top} switches to the box style for rendering the -% back face only. The option \texttt{top} is an abbreviation for -% \texttt{style=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] +% \SAMPLE{top} % % \DescribeMacro{bottom} -% The option \texttt{bottom} switches to the box style for rendering the -% back face only. The option \texttt{bottom} is an abbreviation for -% \texttt{style=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} % -% \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 \texttt{scale} controlls the scaling of the whole rendering. +% 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] +% \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=1} +% +% \SAMPLE{view=2} +% +% \SAMPLE{view=3} % -% \SAMPLE[view=2] +% \DescribeMacro{edgeColor} +% The option |edgeColor| takes a color specification for +% highlighting the inner edges in the 3D rendering. % -% \SAMPLE[view=3] +% \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 88mm. +% 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 100mm. +% 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 30mm. +% 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 \texttt{clip} controls the clipping of the faces to their +% 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 % @@ -569,24 +1039,26 @@ % % 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 +% for |docstrip|. Especially useful might be the instruction % % |\OnlyDescription| % -% which supresses the generation of the implementation description. +% which suppresses the generation of the implementation description. % % \begin{macrocode} %<*driver> \documentclass{ltxdoc} -\InputIfFileExists{productbox.dcf}{}{} \usepackage{productbox} -\usepackage{moreverb} +\usepackage[colorlinks,citecolor=blue]{hyperref} +\usepackage{graphicx,color} \RecordChanges \EnableCrossrefs \CodelineIndex -\setcounter{IndexColumns}2 +\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} @@ -600,240 +1072,339 @@ % \subsection{The Version Information} % % The following lines define the version information for the class -% file. +% file. The information is partially taken from the version control +% system (Subversion). % % \begin{macrocode} -%<*class> +%<*style> \begingroup \def\ProductBox@VC$#1: #2 #3${#2} \def\ProductBox@VCdate$#1: #2-#3-#4 #5${#2/#3/#4} - \xdef\fileversion{1.0} - \xdef\filerevision{\ProductBox@VC$Revision: 8332 $} - \xdef\filedate{\ProductBox@VCdate$Date: 2010-12-20 23:22:36 +0100 (Mo, 20 Dez 2010) $} + \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 -\let\docversion=\fileversion -\let\docdate=\filedate -% +% % \end{macrocode} % % % \subsection{Getting Started} % % First we have to determine that the right kind of \LaTeX{} is -% running and identify style file. -% +% running and identify the style file. +% % \begin{macrocode} -%<*class> +%<*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. +% A bunch of packages is loaded to form the base of the work herein. % \begin{macrocode} \RequirePackage{keyval} -\RequirePackage{pgf} \RequirePackage{tikz} \usetikzlibrary{calc} \usetikzlibrary{fadings} % \end{macrocode} % -% \subsection{Parameters} +% \subsection{Option Declarations} % -% The parameters are stored to be used later. Here the built-in defaults -% are defined. +% Define the parameters for the keyval package. They are used in +% the main environemnt |Product Box| and in the declaration of +% global options |\ProductBoxSet|. % -% The boolean \texttt{ProductBox@shadow} determines whether or not the -% shadow in the 3d rendering is shown. +% \subsubsection{General Parameters} % \begin{macrocode} -\newif\ifProductBox@shadow\ProductBox@shadowtrue +\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} % -% The boolean \texttt{ProductBox@mirror} determines whether or not the -% mirror effect in the 3d rendering is shown. +% \subsubsection{Box Style Parameters} % \begin{macrocode} -\newif\ifProductBox@mirror +\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} % -% The boolean \texttt{ProductBox@flare} determines whether or not the -% flare effect in the 3d rendering is shown. +% \subsubsection{Parameters for the 3D Rendering} % \begin{macrocode} -\newif\ifProductBox@flare +\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} % -% The boolean \texttt{ProductBox@clip} determines whether or not the -% additional clipping of the boxes should be enabled. +% \subsubsection{Parameters for the Fold Rendering} % \begin{macrocode} -\newif\ifProductBox@clip\ProductBox@cliptrue +\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} % -% The edge color in the 3D rendering. +% \subsubsection{Parameters for the Simplified Interface} % \begin{macrocode} -\newcommand\ProductBox@edgeColor{white} +\define@key{ProductBox}{faceSep}{% + \def\ProductBox@FaceSep{#1}} % \end{macrocode} % -% The background color for the mirror effect. -% \begin{macrocode} -\newcommand\ProductBox@bgColor{white} -% \end{macrocode} +% \subsection{Storage for the Faces} % -% The default style is the 3D rendering. +% \begin{macro}{\ProductBox@Front} +% The box |\ProductBox@Front| contains the front material. % \begin{macrocode} -\newcommand\ProductBox@style{threeD} +\newbox\ProductBox@Front % \end{macrocode} +% \end{macro} % -% A hook to add some code at the beginning. +% \begin{macro}{\ProductBox@Left} +% The box |\ProductBox@Left| contains the left material. % \begin{macrocode} -\newcommand\ProductBox@startOptions{} +\newbox\ProductBox@Left % \end{macrocode} +% \end{macro} % -% A hook to add some code at the end. +% \begin{macro}{\ProductBox@Top} +% The box |\ProductBox@Top| contains the top material. % \begin{macrocode} -\newcommand\ProductBox@endOptions{} +\newbox\ProductBox@Top % \end{macrocode} +% \end{macro} % -% The color of the additional lines in the fol rendering. +% \begin{macro}{\ProductBox@Right} +% The box |\ProductBox@Right| contains the right material. % \begin{macrocode} -\newcommand\ProductBox@foldLine{white!80!black} +\newbox\ProductBox@Right % \end{macrocode} +% \end{macro} % -% The diameter of the flare. +% \begin{macro}{\ProductBox@Bottom} +% The box |\ProductBox@Bottom| contains the bottom material. % \begin{macrocode} -\newcommand\ProductBox@flareDiameter{24mm} +\newbox\ProductBox@Bottom % \end{macrocode} +% \end{macro} % -% The width of the box. +% \begin{macro}{\ProductBox@Back} +% The box |\ProductBox@Back| contains the back material. % \begin{macrocode} -\newcommand\ProductBox@x{88mm} +\newbox\ProductBox@Back % \end{macrocode} +% \end{macro} % -% The height of the box. -% \begin{macrocode} -\newcommand\ProductBox@y{100mm} -% \end{macrocode} +% \subsection{Settings} % -% The depth of the box. +% \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\ProductBox@z{30mm} -% \end{macrocode} -% -% Define the parameters for the keyval package. -% \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}{style}{\def\ProductBox@style{#1}} -\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}{edgeColor}{\def\productBox@edgeColor{#1}} -\define@key{ProductBox}{backgroundColor}{\def\ProductBox@bgColor{#1}} -\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}{flareDiameter}{% - \def\ProductBox@flareDiameter{#1}} -\define@key{ProductBox}{view}{\@nameuse{ProductBox@View@#1}} +\newcommand\ProductBoxSet[1]{\setkeys{ProductBox}{#1}} % \end{macrocode} +% \end{macro} % -% \subsection{Internal Storage} +% \subsection{The Main Environment} % -% The box |\ProductBox@Front| contains the front material. +% \begin{macro}{\ProductBox@style} +% The default style is the 3D rendering. % \begin{macrocode} -\newbox\ProductBox@Front +\newcommand\ProductBox@style{threeD} % \end{macrocode} +% \end{macro} % -% The box |\ProductBox@Left| contains the left material. +% \begin{macro}{\ProductBox@x} +% The width of the box. % \begin{macrocode} -\newbox\ProductBox@Left +\newcommand\ProductBox@x{88mm} % \end{macrocode} +% \end{macro} % -% The box |\ProductBox@Top| contains the top material. +% \begin{macro}{\ProductBox@y} +% The height of the box. % \begin{macrocode} -\newbox\ProductBox@Top +\newcommand\ProductBox@y{100mm} % \end{macrocode} +% \end{macro} % -% The box |\ProductBox@Right| contains the right material. +% \begin{macro}{\ProductBox@z} +% The depth of the box. % \begin{macrocode} -\newbox\ProductBox@Right +\newcommand\ProductBox@z{30mm} % \end{macrocode} +% \end{macro} % -% The box |\ProductBox@Bottom| contains the bottom material. +% \begin{macro}{ifProductBox@clean} +% Indicator that the boxes for the faces should be cleaned. % \begin{macrocode} -\newbox\ProductBox@Bottom +\newif\ifProductBox@clean % \end{macrocode} +% \end{macro} % -% The box |\ProductBox@Back| contains the back material. +% \begin{macro}{ifProductBox@active} +% Indicator that we are inside a |ProductBox| environment already. % \begin{macrocode} -\newbox\ProductBox@Back +\newif\ifProductBox@active % \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{macro}{ifProductBox@clip} +% The boolean |ProductBox@clip| determines whether or not the +% additional clipping of the boxes should be enabled. % \begin{macrocode} -\newcommand\ProductBoxSet[1]{\setkeys{ProductBox}{#1}} +\newif\ifProductBox@clip \ProductBox@cliptrue % \end{macrocode} % \end{macro} % -% \subsection{The Main Environment} +% \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. +% are evaluated with the help of the package |keyval|. % \begin{macrocode} \newenvironment{ProductBox}[1][]{% \setkeys{ProductBox}{#1}% - % - \def\Left{\ProductBox@Start\ProductBox@Left - (\ProductBox@z,\ProductBox@y)}% - \let\endLeft\ProductBox@end - \def\Front{\ProductBox@Start\ProductBox@Front - (\ProductBox@x,\ProductBox@y)}% - \let\endFront\ProductBox@end - \def\Top{\ProductBox@Start\ProductBox@Top - (\ProductBox@x,\ProductBox@z)}% - \let\endTop\ProductBox@end - \def\Bottom{\ProductBox@Start\ProductBox@Bottom( - \ProductBox@x,\ProductBox@z)}% - \let\endBottom\ProductBox@end - \def\Back{\ProductBox@Start\ProductBox@Back - (\ProductBox@x,\ProductBox@y)}% - \let\endBack\ProductBox@end - \def\Right{\ProductBox@Start\ProductBox@Right - (\ProductBox@z,\ProductBox@y)}% - \let\endRight\ProductBox@end +% \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} -% 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 -% |\ProductBo@style| is used to invoke the macro storen in it. +% Check that the box style is defined or issue an appropriate error +% message. % \begin{macrocode} \@ifundefined{ProductBox@style@\ProductBox@style}{% - \errmessage{Style '\ProductBox@style' for ProductBox is unknown}% + \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} @@ -844,21 +1415,61 @@ % \begin{macrocode} \def\ProductBox@Start#1(#2){% \global\setbox#1\hbox\bgroup\begin{tikzpicture}% - \ifProductBox@clip \clip (0,0) rectangle (#2); \fi - \ignorespaces + \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{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} -\def\ProductBox@end{\end{tikzpicture}\egroup \ignorespacesafterend} +\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} @@ -890,7 +1501,7 @@ % 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{% +\newcommand\ProductBox@style@back{%class \copy\ProductBox@Back } % \end{macrocode} @@ -946,180 +1557,179 @@ % % \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} + \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} -% front +% left face % \begin{macrocode} - \begin{scope}[xshift=\ProductBox@z] - \clip (0mm,0mm) rectangle (\ProductBox@x,\ProductBox@y); - \draw - node[anchor=south west, - inner sep=0pt]{\copy\ProductBox@Front}; - \draw[\ProductBox@foldLine] - (0mm,0mm) rectangle (\ProductBox@x,\ProductBox@y); + \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} -% back +% front face % \begin{macrocode} - \begin{scope}[xshift=\ProductBox@x, - xshift=\ProductBox@z, - xshift=\ProductBox@z] - \clip (0mm,0mm) rectangle (\ProductBox@x,\ProductBox@y); - \draw - node[anchor=south west, - inner sep=0pt]{\copy\ProductBox@Back}; - \draw[\ProductBox@foldLine] - (0mm,0mm) rectangle (\ProductBox@x,\ProductBox@y); + \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} -% top +% right face % \begin{macrocode} - \begin{scope}[xshift=\ProductBox@z,yshift=\ProductBox@y] - \clip (0mm,0mm) rectangle (\ProductBox@x,\ProductBox@z); - \draw - node[anchor=south west, - inner sep=0pt]{\copy\ProductBox@Top}; - \draw[\ProductBox@foldLine] - (0mm,0mm) rectangle (\ProductBox@x,\ProductBox@z); + \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} -% left +% back face % \begin{macrocode} - \begin{scope} - \clip (0mm,0mm) rectangle (\ProductBox@z,\ProductBox@y); - \draw - node[anchor=south west, - inner sep=0pt]{\copy\ProductBox@Left}; - \draw[\ProductBox@foldLine] - (0mm,0mm) rectangle (\ProductBox@z,\ProductBox@y); + \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} -% right +% top face % \begin{macrocode} - \begin{scope}[xshift=\ProductBox@z,xshift=\ProductBox@x] - \clip (0mm,0mm) rectangle (\ProductBox@z,\ProductBox@y); - \draw - node[anchor=south west, - inner sep=0pt]{\copy\ProductBox@Right}; - \draw[\ProductBox@foldLine] - (0mm,0mm) rectangle (\ProductBox@z,\ProductBox@y); + \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,yshift=-\ProductBox@z] - \clip (0mm,\ProductBox@z) -- - ($.5*(\ProductBox@z,\ProductBox@z)$) -- - ($.5*(\ProductBox@z,0mm)$) -- - ($(\ProductBox@x,0mm)-.5*(\ProductBox@z,0mm)$) -- - ($(\ProductBox@x,0mm)+.5*(-\ProductBox@z,\ProductBox@z)$) -- - (\ProductBox@x,\ProductBox@z) -- cycle; - \draw (\ProductBox@x,0mm) - node[anchor=south east, - inner sep=0pt]{\copy\ProductBox@Bottom}; - \draw [\ProductBox@foldLine] - (0mm,\ProductBox@z) -- - ($.5*(\ProductBox@z,\ProductBox@z)$) -- - ($.5*(\ProductBox@z,0mm)$) -- - ($(\ProductBox@x,0mm)-.5*(\ProductBox@z,0mm)$) -- - ($(\ProductBox@x,0mm)+.5*(-\ProductBox@z,\ProductBox@z)$) -- - (\ProductBox@x,\ProductBox@z) -- cycle; - \draw ($.5*(\ProductBox@x,\ProductBox@z)-.25*(0mm,\ProductBox@z)$) - node[circle,fill=white!90!black]{\small\sf1}; + \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, - xshift=\ProductBox@z, - xshift=\ProductBox@z, - yshift=-\ProductBox@z] - \clip (0mm,0mm) -- - ($.5*(\ProductBox@z,0mm)$) -- - ($.5*(\ProductBox@z,\ProductBox@z)$) -- - ($(\ProductBox@x,0mm)-.5*(\ProductBox@z,-\ProductBox@z)$) -- - ($(\ProductBox@x,0mm)-.5*(\ProductBox@z,0mm)$) -- - (\ProductBox@x,0mm) -- (\ProductBox@x,\ProductBox@z) -- - (0mm,\ProductBox@z) -- cycle; - \draw (0mm,\ProductBox@z) - node[rotate=180,anchor=south east, - inner sep=0pt]{\copy\ProductBox@Bottom}; - \draw[\ProductBox@foldLine] - (0mm,0mm) -- - ($.5*(\ProductBox@z,0mm)$) -- - ($.5*(\ProductBox@z,\ProductBox@z)$) -- - ($(\ProductBox@x,0mm)-.5*(\ProductBox@z,-\ProductBox@z)$) -- - ($(\ProductBox@x,0mm)-.5*(\ProductBox@z,0mm)$) -- - (\ProductBox@x,0mm) -- (\ProductBox@x,\ProductBox@z) -- - (0mm,\ProductBox@z) -- cycle; - \draw ($.25*(\ProductBox@z,\ProductBox@z)$) - node[circle,fill=white!90!black]{\small\sf1}; - \draw ($(\ProductBox@x,0mm)+.25*(-\ProductBox@z,\ProductBox@z)$) - node[circle,fill=white!90!black]{\small\sf1}; + \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,yshift=-\ProductBox@z] + \begin{scope}[xshift=\ProductBox@z+\ProductBox@x] \clip - (\ProductBox@x,\ProductBox@z) -- - ($(\ProductBox@x,\ProductBox@z)+(\ProductBox@z,0mm)$) -- - ($(\ProductBox@x,0mm) + .5*(\ProductBox@z,\ProductBox@z)$) -- - ($(\ProductBox@x,0mm) + .5*(\ProductBox@z,0mm)$) -- - (\ProductBox@x,0mm) -- cycle; - \begin{scope}[xshift=1mm,yshift=1mm] - \draw[xshift=\ProductBox@z,yshift=\ProductBox@z] - (\ProductBox@x,0mm) - node[rotate=90,anchor=south east]{\copy\ProductBox@Bottom}; - \end{scope} - \draw[\ProductBox@foldLine] - (\ProductBox@x,\ProductBox@z) -- - ($(\ProductBox@x,\ProductBox@z)+(\ProductBox@z,0mm)$) -- - ($(\ProductBox@x,0mm) + .5*(\ProductBox@z,\ProductBox@z)$) -- - ($(\ProductBox@x,0mm) + .5*(\ProductBox@z,0mm)$) -- - (\ProductBox@x,0mm) -- cycle; - \draw[xshift=\ProductBox@x] - ($.25*(\ProductBox@z,\ProductBox@z)$) - node[circle,fill=white!90!black]{\small\sf2}; + (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}[yshift=-\ProductBox@z] + \begin{scope} \clip - (0mm,\ProductBox@z) -- (\ProductBox@z,\ProductBox@z) -- - (\ProductBox@z,0mm) -- ($.5*(\ProductBox@z,0mm)$) -- - ($.5*(\ProductBox@z,\ProductBox@z)$) -- cycle; - \draw (0mm,\ProductBox@z) - node[rotate=270,anchor=south west, - inner sep=0pt]{\copy\ProductBox@Bottom}; - \draw [\ProductBox@foldLine] - (0mm,\ProductBox@z) -- (\ProductBox@z,\ProductBox@z) -- - (\ProductBox@z,0mm) -- ($.5*(\ProductBox@z,0mm)$) -- - ($.5*(\ProductBox@z,\ProductBox@z)$) -- cycle; - \draw ($(\ProductBox@z,0mm)+.25*(-\ProductBox@z,\ProductBox@z)$) - node[circle,fill=white!90!black]{\small\sf2}; + (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=\ProductBox@x, - xshift=\ProductBox@x, - xshift=\ProductBox@z, - xshift=\ProductBox@z,\ProductBox@foldLine] + \begin{scope}[xshift=2*\ProductBox@x+2*\ProductBox@z] \clip - (0mm,0mm) -- (6mm,3mm) -- - ($(6mm,\ProductBox@y)-(0mm,3mm)$) -- + (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize/4) -- + (\ProductBox@earSize/2,\ProductBox@y-\ProductBox@earSize/4) -- (0mm,\ProductBox@y) -- cycle; - \draw node[anchor=south west, - inner sep=0pt]{\copy\ProductBox@Left}; - \draw[\ProductBox@foldLine] - (0mm,0mm) -- (6mm,3mm) -- - ($(6mm,\ProductBox@y)-(0mm,3mm)$) -- + \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} @@ -1127,50 +1737,44 @@ % \begin{macrocode} \begin{scope}[yshift=\ProductBox@y] \clip - (0mm,0mm) -- (6mm,12mm) -- - ($(\ProductBox@z,12mm)-(6mm,0mm)$) - -- (\ProductBox@z,0mm) -- cycle; - \draw - node[rotate=90,anchor=north west, - inner sep=0pt]{\copy\ProductBox@Top}; - \draw[\ProductBox@foldLine] - (0mm,0mm) -- (6mm,12mm) -- - ($(\ProductBox@z,12mm)-(6mm,0mm)$) - -- (\ProductBox@z,0mm) -- cycle; + (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, - xshift=\ProductBox@z, + \begin{scope}[xshift=\ProductBox@x+\ProductBox@z, yshift=\ProductBox@y] \clip - (0mm,0mm) -- (6mm,12mm) -- - ($(\ProductBox@z,12mm)-(6mm,0mm)$) - -- (\ProductBox@z,0mm) -- cycle; - \draw - node[rotate=270,anchor=south east, - inner sep=0pt]{\copy\ProductBox@Top}; - \draw[\ProductBox@foldLine] - (0mm,0mm) -- (6mm,12mm) -- ($(\ProductBox@z,12mm)-(6mm,0mm)$) - -- (\ProductBox@z,0mm) -- cycle; + (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, - yshift=\ProductBox@z] + yshift=\ProductBox@y+\ProductBox@z] \clip - (0mm,0mm) -- (6mm,12mm) -- - ($(\ProductBox@x,12mm)-(6mm,0mm)$) -- - (\ProductBox@x,0mm) -- cycle; + (0mm,0mm) -- (\ProductBox@earSize/2,\ProductBox@earSize) -- + (\ProductBox@x-\ProductBox@earSize/2,\ProductBox@earSize) -- + (\ProductBox@x,0mm) -- cycle; \draw (0mm,\ProductBox@y) - node[rotate=180,anchor=south east, - inner sep=0pt]{\copy\ProductBox@Back}; - \draw[\ProductBox@foldLine] - (0mm,0mm) -- (6mm,12mm) -- - ($(\ProductBox@x,12mm)-(6mm,0mm)$) -- + 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}} @@ -1179,13 +1783,78 @@ % % \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. +% 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}\ProductBox@startOptions + \begin{tikzpicture}[sw/.style={anchor=south west, + inner sep=0pt}] + \ProductBoxThreeDStartHook \ifProductBox@mirror \ProductBox@threeD@mirror \fi \ifProductBox@shadow \ProductBox@threeD@shadow \fi @@ -1193,69 +1862,82 @@ \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[yslant=\ProductBox@p@front@yslant, + node[sw, + yslant=\ProductBox@p@front@yslant, xscale=\ProductBox@p@front@xscale, - anchor=south west, - inner sep=0pt] {\copy\ProductBox@Front}; + 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 \ProductBox@threeD@flare \fi + \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@yslant + \begin{scope}[shift={(-\ProductBox@p@left@xscale*\ProductBox@z, + \ProductBox@p@left@yslant *\ProductBox@p@left@xscale - *(0mm,\ProductBox@z) - -\ProductBox@p@left@xscale - *(\ProductBox@z,0mm)$)}] + *\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[yslant=-\ProductBox@p@left@yslant, + node[sw, + yslant=-\ProductBox@p@left@yslant, xscale=\ProductBox@p@left@xscale, - anchor=south west, - inner sep=0pt] {\copy\ProductBox@Left}; + yscale=\ProductBox@p@left@yscale] + {\copy\ProductBox@Left}; \fill[black, fill opacity=.25, yslant=-\ProductBox@p@left@yslant, xscale=\ProductBox@p@left@xscale, - anchor=south west] rectangle (\ProductBox@z,\ProductBox@y); + 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, - yslant=\ProductBox@p@top@yslant, xscale=\ProductBox@p@top@xscale, - yscale=\ProductBox@p@top@yscale, - anchor=south west] rectangle (\ProductBox@x,\ProductBox@z); - \draw - node[xslant=-\ProductBox@p@top@xslant, 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, - yscale=\ProductBox@p@top@yscale, - anchor=south west, - inner sep=0pt] {\copy\ProductBox@Top}; + 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, - yslant=\ProductBox@p@top@yslant, xscale=\ProductBox@p@top@xscale, - yscale=\ProductBox@p@top@yscale, - anchor=south west] rectangle (\ProductBox@x,\ProductBox@z); + yslant=\ProductBox@p@top@yslant, + yscale=\ProductBox@p@top@yscale] + rectangle (\ProductBox@x,\ProductBox@z); \end{scope} - \begin{scope}[shift={($\ProductBox@p@left@yslant - *\ProductBox@p@left@xscale - *(0mm,\ProductBox@z) - -\ProductBox@p@left@xscale - *(\ProductBox@z,0mm)$)}] + \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, @@ -1263,7 +1945,7 @@ xscale=\ProductBox@p@left@xscale] (\ProductBox@z,0mm) -- (\ProductBox@z,\ProductBox@y) -- - (0mm,\ProductBox@y); + (0mm,\ProductBox@y); \end{scope} \draw [\ProductBox@edgeColor, line width=.5mm, @@ -1271,45 +1953,49 @@ yslant=\ProductBox@p@front@yslant, xscale=\ProductBox@p@front@xscale, anchor=south west] - (0mm,\ProductBox@y) -- - (\ProductBox@x,\ProductBox@y); - \ProductBox@endOptions + (0mm,\ProductBox@y) -- (\ProductBox@x,\ProductBox@y); + \ProductBoxThreeDEndHook \end{tikzpicture}} % \end{macrocode} % \end{macro} % -% Parameters +% Parameters and views. % % \begin{macrocode} -\newcommand\ProductBox@Set@params[9]{% - \def\ProductBox@p@front@yslant{#1} - \def\ProductBox@p@front@xscale{#2} - \def\ProductBox@p@left@yslant{#3} - \def\ProductBox@p@left@xscale{#4} - \def\ProductBox@p@top@xslant{#5} - \def\ProductBox@p@top@yslant{#6} - \def\ProductBox@p@top@xscale{#7} - \def\ProductBox@p@top@yscale{#8} - \def\ProductBox@p@mirror@yscale{#9} +\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}% } -\@namedef{ProductBox@View@1}{ - \ProductBox@Set@params - {.25}{.9090909}% - {.5}{.6666666}% - {2}{.1666666}{1.36363636}{.3333333}% - {.2}} -\@namedef{ProductBox@View@2}{ - \ProductBox@Set@params - {.15}{.9090909}% - {.6666666}{.5}% - {1.5}{.12}{1.11}{.333333}% - {.2}} -\@namedef{ProductBox@View@3}{ - \ProductBox@Set@params - {.05}{.95}% - {.25}{.4}% - {4}{.04}{1.133333}{.1}% - {.2}} +\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} % @@ -1318,10 +2004,10 @@ % \begin{macrocode} \newcommand\ProductBox@threeD@shadow{ \begin{scope} - \pgfsetcornersarced{\pgfpoint{2mm}{2mm}} \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) -- @@ -1329,13 +2015,13 @@ *\ProductBox@p@left@xscale *\ProductBox@z, \ProductBox@p@top@yscale - *\ProductBox@z) -- + *\ProductBox@z) -- (0mm, \ProductBox@p@top@yscale*\ProductBox@z + \ProductBox@p@top@xslant *\ProductBox@p@left@xscale *\ProductBox@p@top@yslant - *\ProductBox@z) -- + *\ProductBox@z) -- cycle; } \end{scope} @@ -1346,78 +2032,82 @@ % The following fading is used for the mirror effect in the 3D rendering. % \begin{macrocode} \tikzfading[name=ProductBoxFade, - top color=transparent!0, - bottom color=transparent!60] -% \end{macrocode} -% -% 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] + 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{% - \begin{pgflowlevelscope}{ - \pgftransformyslant{\ProductBox@p@front@yslant} - \pgftransformyscale{-\ProductBox@p@mirror@yscale} - \pgftransformxscale{\ProductBox@p@front@xscale}} - \begin{scope} - \clip rectangle (\ProductBox@x,50mm); - \fill - node[anchor=south west, - inner sep=0pt]{\copy\ProductBox@Front}; - \end{scope} - \fill [white,path fading=ProductBoxFade] - rectangle (\ProductBox@x,50.5mm); - \end{pgflowlevelscope} + \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}; - \begin{pgflowlevelscope}{ - \pgftransformxshift{-\ProductBox@p@left@xscale*\ProductBox@z} - \pgftransformyshift{\ProductBox@p@top@yscale*\ProductBox@z} - \pgftransformyslant{-\ProductBox@p@left@yslant} - \pgftransformxscale{\ProductBox@p@left@xscale} - \pgftransformyscale{-\ProductBox@p@mirror@yscale}} - \begin{scope} - \clip rectangle (\ProductBox@z,50mm); - \fill - node[anchor=south west, - inner sep=0pt]{\copy\ProductBox@Left}; - \fill[opacity=.25] rectangle (\ProductBox@z,\ProductBox@y); - \end{scope} - \fill [white,path fading=ProductBoxFade] - rectangle (\ProductBox@z,50.5mm); - \end{pgflowlevelscope} + \end{tikzpicture}}; } % \end{macrocode} % \end{macro} % % \begin{macro}{\ProductBox@threeD@flare} -% This macro defines the code to produce the flare effect. +% 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); + 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: +% Local Variables: +% End: diff --git a/Master/texmf-dist/source/latex/productbox/productbox.ins b/Master/texmf-dist/source/latex/productbox/productbox.ins new file mode 100644 index 00000000000..f27c57bf31e --- /dev/null +++ b/Master/texmf-dist/source/latex/productbox/productbox.ins @@ -0,0 +1,46 @@ +%%------------------------------------------------------------------ +%% Driver file to extract the productbox style file. +%% +%% Copyright (C) 2010 Gerd Neugebauer +%% +%% productbox.ins 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.ins, provided this copyright notice is preserved and +%% any modifications are indicated. +%% +%%------------------------------------------------------------------ +%% +%% Run this file through TeX or LaTeX to extract the files. +%% You need the docstrip package as distributed with LaTeX2e. +%% It is also available as seperate package from any CTAN site +%% (http://www.ctan.org). +%%------------------------------------------------------------------ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% $Id: productbox.ins 8333 2010-12-29 19:58:06Z gene $ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\input docstrip.tex \keepsilent \askonceonly + +\generate{\file{productbox.sty}{\from{productbox.dtx}{style}} + } + +\Msg{****************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* files into a directory searched by (La)TeX:} +\Msg{*} +\Msg{* \space\space productbox.sty} +\Msg{*} +\Msg{* To produce the documentation run productbox.dtx through LaTeX,} +\Msg{* BibTeX, makeindex (for index and glossary), and LaTeX twice } +\Msg{* again.} +\Msg{*} +\Msg{* Happy TeXing} +\Msg{****************************************************************} + +\endbatchfile +\endinput -- cgit v1.2.3