% \iffalse meta-comment % % Copyright (C) 2005 by RĂ©gis Lachaume. % % Released in the public domain. % % \fi % % \iffalse %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{zigarettenschachtelhuellenzeichnung} % [2005/04/29 Zigarettenschachtelhuellenzeichnung mit LaTeX - Drawing of cigarette pack covers with LaTeX] %<*driver> \documentclass{ltxdoc} \EnableCrossrefs \CodelineIndex \RecordChanges \begin{document} \DocInput{zigarettenschachtelhuellenzeichnung.dtx} \end{document} % % \fi % % % % \GetFileInfo{zigarettenschachtelhuellenzeichnung.dtx} % \CheckSum{0} % \OnlyDescription % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % % % \title{Zigarettenschachtelhuellenzeichnung\\Drawing of cigarette pack covers.} % % \author{R\'egis Lachaume\\ % Max-Planck-Institut f\"ur Radioastronomie\\ % Auf dem H\"ugel 69\\ % D-53121 Bonn\\ % \texttt{lachaume@mpifr-bonn.mpg.de}} % % % \date{Printed \today} % % \maketitle % % \section{To start with} % % This package is meant to design cigarette pack covers that hide the % death warnings and the advertising present on most packs. It imitates % the original look of packs in the European Union by allowing the % placement of fancy warnings (e.g. Caution: inflammable device). % % An example file example.tex is included in the distribution. % % The package is loaded with |\usepackage{zigarettenschachtelhuellenzeichnung}| % between the |\documentclass{...}| and the |\begin{document}|. % % A cigarette pack is then obtained with % \begin{verbatim} % \begin{zigarettenschachtelhuelle}[] % \frontwarning{Text of the warning on the front side} % \fronttext{Text on the front side, above the warning frame} % \ingredients{Text in the left side frame} % \background{} % \backwarning{Text of the warning on the back side} % \backtext{Text on the back side, above the warning frame} % \end{zigarettenschachtelhuelle} % \end{verbatim} % % The default pack is |=normalpack|. It corresponds to a standard % hard pack. It is possible to define new pack styles by specifying all % dimensions: % % \begin{verbatim} % \definepack{}{ % \width= % \depth= % \frontheight= % \backheight= % \frontwarningheight= % \backwarningheight= % \ingrendientsheight= % \framewidth= % \framesep= % \flapsize= % \frontwarningbottommargin= % \backwarningsidemargin= % \ingrendientsbottommargin= % \ingrendientssidemargin= % \frontwarningsidemargin= % \backwarningbottommargin= % \sidemargin= % \verticalmargin= % } % \end{verbatim} % % \section{Description of commands} % % TBW. % % \section{\LaTeX source} % % \begin{macrocode} % Needed packages: calc for dimension calculus, pgf for portable graphics % and ifthen to use latex-style booleans. \RequirePackage{calc} \RequirePackage{pgf} \RequirePackage{ifthen} % width of the pack \newlength\width % depth of the pack \newlength\depth % height of the cover on the front side of the pack \newlength\frontheight % height of the cover on the back side of the pack \newlength\backheight % flap width \newlength\flapsize % width of the black frame of warnings \newlength\framewidth % separation between warning text and the black frame \newlength\framesep % height, side-margin and bottom margin of the front warning frame \newlength\frontwarningheight \newlength\frontwarningsidemargin \newlength\frontwarningbottommargin % idem for the back warning frame \newlength\backwarningheight \newlength\backwarningsidemargin \newlength\backwarningbottommargin % idem for the side frame used as a ingredients listing \newlength\ingrendientsheight \newlength\ingrendientssidemargin \newlength\ingrendientsbottommargin % side-margin and top margin for displaying text or images on the cover \newlength\sidemargin \newlength\verticalmargin % define a packstyle \definepack{packname}{\width=... \depth=...} % can be used later with \begin{zigarettenschachtelhuelle}[packname] \def\@listofpacks{} \newcommand\definepack[2]{ \ifthenelse{\equal{\@listofpacks}{}}{\def\@comma{}}{\def{\@comma{,}}} \edef\@listofpacks{\@listofpacks\@comma#1}% \expandafter\def\csname #1\endcsname{#2}% } % the default pack style is normalpack (20 hard pack) \definepack{normalpack}{ \newcommand\warningfont{\sffamily\bfseries} \renewcommand\textfont{\sffamily} \ingrendientssidemargin=2mm \ingrendientsbottommargin=5mm \ingrendientsheight=22mm \frontwarningbottommargin=1mm \frontwarningsidemargin=1mm \backwarningheight=38mm \backwarningsidemargin=1mm \backwarningbottommargin=1mm \depth=24mm \width=56mm \frontheight=62mm \backheight=76mm \flapsize=10mm \framewidth=3mm \framesep=2.5mm \sidemargin=3mm \frontwarningheight=28mm \verticalmargin=3mm } % pack cover is created by an environment % \begin{zigarettenschachtelhuelle}[packstyle] % % % \end{zigarettenschachtelhuelle} \newenvironment{zigarettenschachtelhuelle}[1][normalpack]{% % \frontwarning[fontsize]{text}: set the front warning (and its font size) \newcommand\frontwarning[2][20pt]{% \setlength\@frontwarningfs{##1} \setlength\@frontwarningls{1.14\@frontwarningfs} \def\@frontwarningtext{##2}% }\frontwarning{}% % \fronttext[fontsize]{text}: set the front text (and its font size) \newcommand\fronttext[2][10pt]{% \setlength\@fronttextfs{##1} \setlength\@fronttextls{1.14\@fronttextfs} \def\@fronttext{##2}% }\fronttext{}% % \backwarning[fontsize]{text}: set the back warning (and its font size) \newcommand\backwarning[2][15pt]{% \setlength{\@backwarningfs}{##1} \setlength\@backwarningls{1.14\@backwarningfs} \def\@backwarningtext{##2}% }\backwarning{}% % \backtext[fontsize]{text}: set the back text (and its font size) \newcommand\backtext[2][10pt]{% \setlength\@backtextfs{##1} \setlength\@backtextls{1.14\@backtextfs} \def\@backtext{##2}% }\backtext{}% % \ingredients[fontsize]{text}: set the ingredient list (and its font size) \newcommand\ingredients[2][5pt]{% \setlength{\@ingrendientsfs}{##1} \setlength\@ingrendientsls{1.14\@ingrendientsfs} \def\@ingredientstext{##2}% }\ingredients{}% % \background{pgfcolor}: set the background color \newcommand\background[1]{\def\@background{##1}}\background{white}% % look for the pack style in the list of defined ones and % set the corresponding dimensions \setboolean{@validpack}{false} \@for\@packstyle:=\@listofpacks\do{% \typeout{\@packstyle - #1} \ifthenelse{\equal{#1}{\@packstyle}}{% \typeout{ -> OK!} \csname\@packstyle\endcsname \setboolean{@validpack}{true} }{}% } \ifthenelse{\boolean{@validpack}}{}{% \@latexerr{Not a valid pack type: #1}% } }{% % coordinates of template vertices. (see template below) % N________N % /| |\ % / | | \ % P________O/r | | \L__ % | | i | | l | f\K % | back | g | front | e | l | % | | h | | f | a | % | | t | | t | p J % A--------B---C--------H---I--/ % | bottom | % D--------G % | flap | % \E------F/ \parindent=0pt \setlength\@xA{0cm}\setlength\@yA{0cm} \setlength\@xB{\width}\setlength\@yB{0cm} \setlength\@xC{\width+\depth}\setlength\@yC{0cm} \setlength\@xD{\width+\depth}\setlength\@yD{-\depth} \setlength\@xE{\width+\depth+0.5\flapsize}\setlength\@yE{-\depth-\flapsize} \setlength\@xF{2\width+\depth-0.5\flapsize}\setlength\@yF{-\depth-\flapsize} \setlength\@xG{2\width+\depth}\setlength\@yG{-\depth} \setlength\@xH{2\width+\depth}\setlength\@yH{0cm} \setlength\@xI{2\width+2\depth}\setlength\@yI{0cm} \setlength\@xJ{2\width+2\depth+\flapsize}\setlength\@yJ{0.5\flapsize} \setlength\@xK{2\width+2\depth+\flapsize}\setlength\@yK{\backheight-0.5\flapsize} \setlength\@xL{2\width+2\depth}\setlength\@yL{\backheight} \setlength\@xM{2\width+\depth}\setlength\@yM{\frontheight} \setlength\@xN{\width+\depth}\setlength\@yN{\frontheight} \setlength\@xO{\width}\setlength\@yO{\backheight} \setlength\@xP{0cm}\setlength\@yP{\backheight} % drawing \begin{pgfpicture}{0cm}{\@yE}{\@xK}{\@yO} % draw template outline \begin{pgfscope} \color{\@background} \pgfmoveto{\pgfpoint\@xA\@yA}\pgflineto{\pgfpoint\@xB\@yB} \pgflineto{\pgfpoint\@xD\@yC}\pgflineto{\pgfpoint\@xD\@yD} \pgflineto{\pgfpoint\@xE\@yE}\pgflineto{\pgfpoint\@xF\@yF} \pgflineto{\pgfpoint\@xG\@yG}\pgflineto{\pgfpoint\@xH\@yH} \pgflineto{\pgfpoint\@xI\@yI}\pgflineto{\pgfpoint\@xJ\@yJ} \pgflineto{\pgfpoint\@xK\@yK}\pgflineto{\pgfpoint\@xL\@yL} \pgflineto{\pgfpoint\@xM\@yM}\pgflineto{\pgfpoint\@xN\@yN} \pgflineto{\pgfpoint\@xO\@yO}\pgflineto{\pgfpoint\@xP\@yP} \pgffillstroke \end{pgfscope} % draw folding lines \color{black} \pgfline{\pgfpoint\@xB\@yB}{\pgfpoint\@xO\@yO} \pgfline{\pgfpoint\@xC\@yC}{\pgfpoint\@xN\@yN} \pgfline{\pgfpoint\@xH\@yH}{\pgfpoint\@xM\@yM} \pgfline{\pgfpoint\@xI\@yI}{\pgfpoint\@xL\@yL} \pgfline{\pgfpoint\@xC\@yC}{\pgfpoint\@xH\@yH} \pgfline{\pgfpoint\@xD\@yD}{\pgfpoint\@xG\@yG} % position warning frames \begin{pgfscope} \fontsize{\@frontwarningfs}{\@frontwarningls} \@smashbox\@xC\@yC\frontwarningsidemargin\frontwarningbottommargin\width\frontwarningheight\@frontwarningtext \fontsize{\@ingrendientsfs}{\@ingrendientsls} \@smashbox\@xB\@yB\ingrendientssidemargin\ingrendientsbottommargin\depth\ingrendientsheight\@ingredientstext \fontsize{\@backwarningfs}{\@backwarningls} \@smashbox\@xA\@yA\backwarningsidemargin\backwarningbottommargin\width\backwarningheight\@backwarningtext \end{pgfscope} % position additional text \fontsize{\@fronttextfs}{\@fronttextls} \@smashtext\@xN\@yN\sidemargin\verticalmargin\width\@fronttext \fontsize{\@backtextfs}{\@backtextls} \@smashtext\@xP\@yP\sidemargin\verticalmargin\width\@backtext \end{pgfpicture} } % internal use \newlength\@tmplen \newlength\@fronttextls \newlength\@backtextls \newlength\@fronttextfs \newlength\@backtextfs \newlength\@frontwarningfs \newlength\@backwarningfs \newlength\@ingrendientsfs \newlength\@frontwarningls \newlength\@backwarningls \newlength\@ingrendientsls \newlength\@xA\newlength\@yA \newlength\@xB\newlength\@yB \newlength\@xC\newlength\@yC \newlength\@xD\newlength\@yD \newlength\@xE\newlength\@yE \newlength\@xF\newlength\@yF \newlength\@xG\newlength\@yG \newlength\@xH\newlength\@yH \newlength\@xI\newlength\@yI \newlength\@xJ\newlength\@yJ \newlength\@xK\newlength\@yK \newlength\@xL\newlength\@yL \newlength\@xM\newlength\@yM \newlength\@xN\newlength\@yN \newlength\@xO\newlength\@yO \newlength\@xP\newlength\@yP \newlength\@xbl\newlength\@ybl \newlength\@xtl\newlength\@ytl \newlength\@xwd\newlength\@yht \newlength\@wd\newlength\@ht % smash a text around top-left corner (#1, #2) with margin (#3, #4) % and dimensions #5x#6. Text is #7 \def\@smashtext#1#2#3#4#5#6{ \@tmplen=#3 \setlength\@xbl{#1+#3}\setlength\@ybl{#2-#4} \setlength\@xwd{#5-2\@tmplen} \pgfputat{\pgfpoint{\@xbl}{\@ybl}}{% \pgfbox[top,left]{\parbox[t]{\@xwd}{\vglue 0pt\textfont #6}}% }% } % smash a frame box around bottom-left corner (#1,#2) with offset (#3,#4) % and width #5. The text is #6. \def\@smashbox#1#2#3#4#5#6#7{% % black frame \color{black} \@tmplen=#3 \setlength\@xbl{#1+#3}\setlength\@ybl{#2+#4} \setlength\@xwd{#5-2\@tmplen}\setlength\@yht{#6} \pgfrect[fill]{\pgfpoint\@xbl\@ybl}{\pgfpoint\@xwd\@yht} % white bg in frame \color{white} \setlength\@xbl{\@xbl+\framewidth}\setlength\@ybl{\@ybl+\framewidth}% \setlength\@xwd{\@xwd-2\framewidth}\setlength\@yht{\@yht-2\framewidth}% \pgfrect[fill]{\pgfpoint\@xbl\@ybl}{\pgfpoint\@xwd\@yht}% % text \color{black} \setlength\@xbl{\@xbl+\framesep}\setlength\@ybl{\@ybl+\framesep}% \setlength\@xwd{\@xwd-2\framesep}% \pgfputat{\pgfpoint{\@xbl}{\@ybl}}{% \pgfbox[left,bottom]{\parbox[b]{\@xwd}{\centering\warningfont #7\vglue 0pt}}% }% } % \newboolean{@validpack} % \end{macrocode} % %\Finale \endinput