summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/cd-cover/cd-cover.cls
blob: bab9522440941493e576e944ec76f88190253091 (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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
%%
%% This is file `cd-cover.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% cd-cover.dtx  (with options: `class')
%% LaTeX2e class `cd-cover' for typesetting a variaty of cd covers
%% Copyright (C) 1999 Christian Holm <cholm@nbi.dk>
%% 
%% This class is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 2 of the License, or
%% (at your option) any later version.
%% 
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%% GNU General Public License for more details.
%% 
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the
%%   Free Software Foundation, Inc.
%%   675 Mass Ave
%%   Cambridge
%%   MA 02139
%%   USA
%% 
%% For more information see `cd-cover.dtx'
%% 
\NeedsTeXFormat{LaTeX2e}
\def\fileversion{v1.4}
\def\filedate{2002/01/28}  % Format is YYYY/MM/DD
\ProvidesClass{cd-cover}[\filedate\space\fileversion
\space cd-cover class.]
\newlength{\temp@length}
\newlength{\temp@@length}
\newlength{\booklet@even@margins}
\newlength{\booklet@odd@margins}
\newlength{\back@even@margins}
\newlength{\back@odd@margins}
\newlength{\sleeve@even@margins}
\newlength{\sleeve@odd@margins}
\newlength{\single@even@margins}
\newlength{\single@odd@margins}
\def\cd@cover@setup@margins{
  % This is some old stuff, that I'm not sure is needed, but I leave it
  % \global\paperheight=\temp@length
  % \global\paperwidth=\temp@@length
  \advance\temp@length-\booklet@height
  \divide\temp@length2
  \advance\temp@length-1in
  \advance\temp@length-\headheight
  \global\topmargin=\temp@length
  \advance\temp@@length-\booklet@width
  \divide\temp@@length2
  \advance\temp@@length-1in
  \oddsidemargin=\temp@@length}
\AtBeginDocument{\cd@cover@setup@margins}
\DeclareOption{a4paper}{
  \global\temp@length=210mm
  \global\temp@@length=297mm}
\DeclareOption{letterpaper}{
  \global\temp@length=8.5in
  \global\temp@@length=11in}
\DeclareOption{legalpapar}{
  \setlength\temp@length{8.5in}
  \setlength\temp@@length{14in}}
\DeclareOption{executivepaper}{
  \setlength\temp@length{7.25in}
  \setlength\temp@@length{10.5in}}
\DeclareOption{a5paper}{\cd@cover@paper@error{a5paper}}
\DeclareOption{b5paper}{\cd@cover@paper@error{b5paper}}
\DeclareOption{landscape}{
  \ClassWarning{cd-cover}{Option `landscape' redundant to this %
    class.}}
\newif\ifcd@cover@foldlines\cd@cover@foldlinestrue
\DeclareOption{nofoldlines}{\cd@cover@foldlinesfalse}
\DeclareOption{foldlines}{\cd@cover@foldlinestrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ExecuteOptions{letterpaper}
\ProcessOptions\relax
\def\cd@cover@paper@error#1{
  \ClassError{cd-cover}{^^J%
    Paper format `#1' is too small for the covers}{^^J%
    You have given the option `#1' to this class.^^J%
    However, that paper size is too small to hold^^J%
    the covers.^^J%
    Please change the paper size option to another^^J%
    format that CAN hold the covers (e.g., `a4paper',^^J%
    `letterpaper', etc.)}}
\LoadClass{article}
\paperheight=\temp@length
\paperwidth=\temp@@length
\RequirePackage{rotating}
\newlength{\booklet@width}     \setlength{\booklet@width}{240mm}
\newlength{\booklet@height}    \setlength{\booklet@height}{120mm}
\newlength{\back@width}        \setlength{\back@width}{137mm}
\newlength{\back@height}       \setlength{\back@height}{118mm}
\newlength{\back@slip@width}   \setlength{\back@slip@width}{7mm}
\newlength{\sleeve@height}     \setlength{\sleeve@height}{128mm}
\newlength{\sleeve@width}      \setlength{\sleeve@width}{266mm}
\newlength{\single@height}     \setlength{\single@height}{120mm}
\newlength{\single@width}      \setlength{\single@width}{137mm}
\newlength{\single@slip@width} \setlength{\single@slip@width}{15mm}
\newlength{\single@back@width} \setlength{\single@back@width}{3mm}
\newlength{\CDbookletTopMargin} \setlength{\CDbookletTopMargin}{5mm}
\newlength{\CDbookletMargin}    \setlength{\CDbookletMargin}{5mm}
\newlength{\CDbackTopMargin}    \setlength{\CDbackTopMargin}{5mm}
\newlength{\CDbackMargin}       \setlength{\CDbackMargin}{5mm}
\newlength{\CDsleeveTopMargin}  \setlength{\CDsleeveTopMargin}{5mm}
\newlength{\CDsleeveMargin}     \setlength{\CDsleeveMargin}{5mm}
\newlength{\CDsingleTopMargin}  \setlength{\CDsingleTopMargin}{5mm}
\newlength{\CDsingleMargin}     \setlength{\CDsingleMargin}{5mm}
\pagestyle{empty}
\def\ps@bookletsheets{
  \let\@oddhead\booklet@border\let\@evenhead\@oddhead
  \let\@oddfoot\@empty\let\@evenfoot\@oddfoot}
\def\init@booklet{
  \temp@length=\booklet@height
  \advance\temp@length-2\CDbookletTopMargin
  \global\textheight=\temp@length
  \global\headsep=\CDbookletTopMargin
  \temp@length=\booklet@width
  \advance\temp@length-2\CDbookletMargin
  \global\textwidth=\temp@length
  \global\@colht=\textheight
  \global\columnsep=2\CDbookletMargin}
\newenvironment{bookletsheets}{
  \init@booklet\twocolumn\pagestyle{bookletsheets}}{
  \clearpage\pagestyle{empty}}
\def\booklet@border{%
  \kern-\CDbookletMargin%
  \setlength{\unitlength}{1mm}%
  \begin{picture}(100,1)%
    \put(0,0){\line(1,0){240}}%     Top most horizontal line
    \put(0,0){\line(0,-1){120}}%    Left most vertical line
    \put(0,-120){\line(1,0){240}}%  Bottom most horizontal line
    \put(240,0){\line(0,-1){120}}%  Right most vertical line
    \put(120,0){\line(0,1){5}}%     Top folding mark
    \put(120,-120){\line(0,-1){5}}% Bottom folding mark
    \ifcd@cover@foldlines
      \multiput(120,-1)(0,-5){24}{\line(0, -1){3}} % Fold line
    \fi
    \put(110,2){\vector(1,0){10}}%  Arrow
    \put(95,1){Fold here}%          Helping text
  \end{picture}\hfill}
\def\ps@backsheet{
  \let\@oddhead\back@border\let\@evenhead\@oddhead
  \let\@oddfoot\@empty\let\@evenfoot\@empty}
\def\init@back{
  \temp@length=\back@height
  \advance\temp@length-2\CDbackTopMargin
  \global\textheight=\temp@length
  \temp@length=\back@width
  \advance\temp@length-2\CDbackMargin
  \global\textwidth=\temp@length
  \global\headsep=\CDbackTopMargin}
\newsavebox{\back@title}
\newif\ifback@anglereverse\back@anglereversefalse
\newenvironment{backsheet}[1]{
  \back@anglereversefalse%
  \init@back%
  \savebox{\back@title}[\textheight]{%
    \parbox[t][6mm]{\textheight}{#1}}
  \onecolumn\pagestyle{backsheet}
  \clearpage}{\clearpage\pagestyle{empty}}
\newenvironment{backsheet*}[1]{
  \back@anglereversetrue%
  \init@back%
  \savebox{\back@title}[\textheight]{%
    \parbox[t][6mm]{\textheight}{#1}}
  \onecolumn\pagestyle{backsheet}
  \clearpage}{\clearpage\pagestyle{empty}}
\def\back@border{%
  \kern-\CDbackMargin%
  \kern-\back@slip@width%
  \setlength{\unitlength}{1mm}%
  \begin{picture}(0,0)%
    \put(0,0){\line(1,0){151}}%     Top most horizontal line
    \put(0,-118){\line(1,0){151}}%  Bottom most horizontal line
    \put(0,0){\line(0,-1){118}}%    Left most vertical line
    \put(151,0){\line(0,-1){118}}%  Right most vertical line
    \put(7,0){\line(0,1){5}}%       Left top folding mark
    \put(7,-118){\line(0,-1){5}}%   Left bottom folding mark
    \ifcd@cover@foldlines
      \multiput(7,-1)(0,-5){24}{\line(0, -1){3}} % Fold line
    \fi
    \put(144,0){\line(0,1){5}}%     Right top folding mark
    \put(144,-118){\line(0,-1){5}}% Right bottom folding mark
    \ifcd@cover@foldlines
      \multiput(144,-1)(0,-5){24}{\line(0, -1){3}} % Fold line
    \fi
    \put(17,2){\vector(-1,0){10}}%  Left help arrow
    \put(17,1){Fold here}%          Left help text
    \put(134,2){\vector(1,0){10}}%  Right help arrow
    \put(119,1){Fold here}%         Right help text
    \ifback@anglereverse%
      \put(1,0){\begin{rotate}{-90}\usebox{\back@title}\end{rotate}}%
      \put(150,-118){\begin{rotate}{90}\usebox{\back@title}\end{rotate}}%
    \else%
      \put(6,-118){\begin{rotate}{90}\usebox{\back@title}\end{rotate}}%
      \put(145,0){\begin{rotate}{-90}\usebox{\back@title}\end{rotate}}%
    \fi%
    %\put(3,-118){\begin{rotate}{90}\usebox{\back@title}\end{rotate}}%
    %\put(148,0){\begin{rotate}{-90}\usebox{\back@title}\end{rotate}}%
  \end{picture}\hfill}
\def\ps@sleevesheet{%
  \let\@oddhead\sleeve@border\let\@evenhead\@oddhead
  \let\@oddfoot\@empty\let\@evenfoot\@oddfoot}
\def\init@sleeve{
  \temp@length=\sleeve@height
  \advance\temp@length-2\CDsleeveTopMargin
  \global\textheight=\temp@length
  \global\@colht=\textheight
  \temp@length=\sleeve@width
  \advance\temp@length-2\CDsleeveMargin
  \global\textwidth=\temp@length
  \global\headsep=\CDsleeveTopMargin
  \global\columnsep=2\CDsleeveMargin}
\newenvironment{sleevesheet}{%
  \init@sleeve
  \twocolumn\pagestyle{sleevesheet}
  \global\let\@outputdblcol\sleeve@outputdblcol}{
  \clearpage\pagestyle{empty}
  \global\let\@outputdblcol\ltx@outputdblcol}
\def\sleeve@border{%
  \kern-\CDsleeveMargin%
  \setlength{\unitlength}{1mm}%
  \begin{picture}(100,1)%
    \put(0,0){\line(3,4){6}}%        Top flap
    \put(6,8){\line(1,0){121}}%
    \put(133,0){\line(-3,4){6}}%
    \ifcd@cover@foldlines
      \multiput(133,-1)(0,-5){25}{\line(0, -1){3}} % Fold line
    \fi
    \put(50,1){Fold and clue}%       Help text in top flap
    \put(0,-123){\line(3,-4){6}}%    Bottom flap
    \put(6,-131){\line(1,0){121}}%
    \put(133,-123){\line(-3,-4){6}}%
    \put(50,-131){Fold and clue}%    Help text in bottom flap
    \put(0,0){\line(1,0){266}}%      Top most horizontal line
    \put(0,0){\line(0,-1){123}}%     Left most vertical line
    \put(0,-123){\line(1,0){266}}%   Bottom most horizontal line
    \put(266,0){\line(0,-1){123}}%   Right most vertical line
  \end{picture}\hfill}
\def\ps@singlesheet{
  \let\@oddhead\odd@single@border
  \let\@evenhead\even@single@border
  \let\@oddfoot\@empty\let\@evenfoot\@oddfoot}
\newsavebox{\single@title}
\newsavebox{\single@slip}
\def\init@single{
  \temp@length=\single@height
  \advance\temp@length-2\CDsingleTopMargin
  \advance\temp@length-4mm
  \global\textheight=\temp@length
  \temp@length=\single@width
  \advance\temp@length-2\CDsingleMargin
  \global\textwidth=\temp@length
  \global\headsep=\CDsingleTopMargin}
\newenvironment{singlesheet}[2]{
  \init@single
  \savebox{\single@title}[\textwidth]{%
    \parbox[t][3mm]{\textwidth}{#1}}
  \savebox{\single@slip}[\textwidth]{%
    \parbox[t][\single@slip@width]{\textwidth}{#2}}
  \onecolumn\pagestyle{singlesheet}
  \clearpage}{\clearpage\pagestyle{empty}}
\def\odd@single@border{
  \kern-\CDsingleMargin%
  \kern-\single@slip@width%
  \kern-\single@back@width%
  \setlength{\unitlength}{1mm}%
  \begin{picture}(0,0)%
    \put(0,0){\line(0,-1){116}}%                  Left most vertical line
    \put(0,0){\line(1,0){36}}%                    First top horizontal line
    \put(36,0){\line(0,1){2}}%                    Jump
    \put(15,0){\line(0,1){5}}%                    Fold mark
    \ifcd@cover@foldlines
      \multiput(15,-1)(0,-5){24}{\line(0, -1){3}} % Fold line
    \fi
    \put(18,0){\line(0,1){5}}%                    Fold mark
    \ifcd@cover@foldlines
      \multiput(18,-1)(0,-5){24}{\line(0, -1){3}} % Fold line
    \fi
    \put(36,2){\line(1,0){119}}%                  Second top line
    \put(155,2){\line(0,-1){120}}%                Right most vertical line
    \put(0,-116){\line(1,0){36}}%                 First bottom line
    \put(36,-116){\line(0,-1){2}}%                Jump
    \put(15,-116){\line(0,-1){5}}%                Fold Mark
    \put(18,-116){\line(0,-1){5}}%                Fold Mark
    \put(36,-118){\line(1,0){119}}%               Second bottom line
    \put(5,4){\vector(1,0){10}}%                  Arrows
    \put(28,4){\vector(-1,0){10}}%                Arrows
    \put(28,3){Fold here}%                        Help text
    \put(0,0){\begin{rotate}{-90}\usebox{\single@title}\end{rotate}}%
    \put(15,0){\begin{rotate}{-90}\usebox{\single@slip}\end{rotate}}%
  \end{picture}\hfill}
\def\even@single@border{
  \kern-\CDsingleMargin%
  \setlength{\unitlength}{1mm}%
  \begin{picture}(0,0)%
    \put(0,2){\line(0,-1){120}}%    1st left vert line
    \put(119,0){\line(1,0){36}}%    2nd top horiz line
    \put(119,0){\line(0,1){2}}%     2nd top right vert line
    \put(137,0){\line(0,1){5}}%     1st top fold mark
    \put(140,0){\line(0,1){5}}%     2nd top fold mark
    \put(0,2){\line(1,0){119}}%     1st top horiz line
    \put(155,0){\line(0,-1){116}}%  1st right vert line
    \put(119,-116){\line(1,0){36}}% 2nd bototm horiz line
    \put(119,-116){\line(0,-1){2}}% 2nd bottom right vert line
    \put(137,-116){\line(0,-1){5}}% 1st bottom fold mark
    \put(140,-116){\line(0,-1){5}}% 2nd bottom fold mark
    \put(0,-118){\line(1,0){119}}%  1st bottom horiz line
    \put(127,4){\vector(1,0){10}}%  1st help arrow
    \put(150,4){\vector(-1,0){10}}% 2nd help arrow
    \put(112,3){Fold here}%         Help text
  \end{picture}\hfill}
\let\ltx@outputdblcol\@outputdblcol
\def\sleeve@outputdblcol{%
  \if@firstcolumn
    \global\@firstcolumnfalse
    \global\setbox\@leftcolumn\box\@outputbox
  \else
    \global\@firstcolumntrue
    \setbox\@outputbox\vbox{%
      \hb@xt@\textwidth{%
        \hb@xt@\columnwidth{%
          \box\@outputbox\hss}%  \@leftcolumn changed to \@outputbox
        \hfil\vrule\@width\columnseprule\hfil
        \hb@xt@\columnwidth{%
          \box\@leftcolumn\hss}}}% \@outputbox changed to \@leftcolumn
    \@combinedblfloats
    \@outputpage
    \begingroup
      \@dblfloatplacement
      \@startdblcolumn
      \@whilesw\if@fcolmade\fi
        {\@outputpage
          \@startdblcolumn}%
    \endgroup
  \fi
}
\def\cdcover@endmessage{cd-cover class: Remember that this document is
    type set in landscape^^J mode, and therefore dvips should be
    passed the `-t landscape' option.}
\@ifundefined{Gin@driver}{%
  \AtEndDocument{\typeout{\cdcover@endmessage}}}{%
  \filename@parse{\Gin@driver}%
  \def\reserved@a{dvips}%
  \ifx\filename@base\reserved@a\relax%
    \message{DVIPS driver found}
    \AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}%
    \AtBeginDvi{\special{papersize=\the\paperheight,\the\paperwidth}}%
  \else
    \def\reserved@a{pdftex}\relax%
    \ifx\filename@base\reserved@a
      \message{PDF driver found}
      \pdfpagewidth=\the\paperwidth\pdfpageheight=\the\paperheight%
    \else
      \def\reserved@a{vtex}\relax%
      \ifx\filename@base\reserved@a
        \message{VTeX driver found}
        \mediawidth=\the\paperwidth\mediaheight=\the\paperheight%
      \else
        \AtEndDocument{\typeout{\cdcover@endmessage}}
      \fi
    \fi
  \fi}
\endinput
%%
%% End of file `cd-cover.cls'.