summaryrefslogtreecommitdiff
path: root/graphics/zigaretten/zigarettenschachtelhuellenzeichnung.sty
blob: b5e0da4cafa01338171d875b07bcc5c8b0b319ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
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'.