diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/zigaretten/zigarettenschachtelhuellenzeichnung.sty |
Initial commit
Diffstat (limited to 'graphics/zigaretten/zigarettenschachtelhuellenzeichnung.sty')
-rw-r--r-- | graphics/zigaretten/zigarettenschachtelhuellenzeichnung.sty | 245 |
1 files changed, 245 insertions, 0 deletions
diff --git a/graphics/zigaretten/zigarettenschachtelhuellenzeichnung.sty b/graphics/zigaretten/zigarettenschachtelhuellenzeichnung.sty new file mode 100644 index 0000000000..b5e0da4caf --- /dev/null +++ b/graphics/zigaretten/zigarettenschachtelhuellenzeichnung.sty @@ -0,0 +1,245 @@ +%% +%% This is file `zigarettenschachtelhuellenzeichnung.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% zigarettenschachtelhuellenzeichnung.dtx (with options: `package') +%% This is a generated file +%% +%% Copyright (C) 2005 by Regis Lachaume +%% +%% Released in the public domain. +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{zigarettenschachtelhuellenzeichnung} + [2005/04/29 Zigarettenschachtelhuellenzeichnung mit LaTeX - Drawing of cigarette pack covers with LaTeX] +\RequirePackage{calc} +\RequirePackage{pgf} +\RequirePackage{ifthen} +\newlength\width +\newlength\depth +\newlength\frontheight +\newlength\backheight +\newlength\flapsize +\newlength\framewidth +\newlength\framesep +\newlength\frontwarningheight +\newlength\frontwarningsidemargin +\newlength\frontwarningbottommargin +\newlength\backwarningheight +\newlength\backwarningsidemargin +\newlength\backwarningbottommargin +\newlength\ingrendientsheight +\newlength\ingrendientssidemargin +\newlength\ingrendientsbottommargin +\newlength\sidemargin +\newlength\verticalmargin +\def\@listofpacks{} +\newcommand\definepack[2]{ + \ifthenelse{\equal{\@listofpacks}{}}{\def\@comma{}}{\def{\@comma{,}}} + \edef\@listofpacks{\@listofpacks\@comma#1}% + \expandafter\def\csname #1\endcsname{#2}% +} +\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 +} +\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} +} +\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 +\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}}% + }% +} +\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} +\endinput +%% +%% End of file `zigarettenschachtelhuellenzeichnung.sty'. |