summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/cd-cover/cd-cover.dtx
blob: 06470d14bcb6c4befd98631c117b5401c8b53486 (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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
%\iffalse % -*- mode: latex -*- 
% 
%
% $Id: cd-cover.dtx,v 1.6 2002/01/28 14:30:44 cholm Exp $
%
%<*driver>
{\makeatother 
  \gdef\CVSKeyword$#1 ${\expandafter\cCVSKeyword#1\endcCVSKeyword\relax}
\gdef\cCVSKeyword#1: #2\endcCVSKeyword{%
\expandafter\gdef\csname CVS#1\endcsname{#2}}
}
\CVSKeyword$Date: 2002/01/28 14:30:44 $
\CVSKeyword$Revision: 1.6 $
\CVSKeyword$Id: cd-cover.dtx,v 1.6 2002/01/28 14:30:44 cholm Exp $
\CVSKeyword$Author: cholm $
\def\docdate{\CVSDate}        % Format is YYYY/MM/DD
\def\fileversion{v1.4 Beta}   % Remember to update in class too
\def\filedate{\CVSDate}       % around ProvideClass
\documentclass{ltxdoc}
\usepackage{rotating}
\title{The \textsf{cd-cover} class\thanks{Previously a package}\\
  Version \fileversion\\[-1ex]
  {\small CVS Revision: \CVSRevision}}
\author{Christian Holm\thanks{E--mail: \texttt{cholm@nbi.dk}}}
\date{\docdate\\
  {\small CVS Date: \CVSDate}}
\AlsoImplementation
\CodelineIndex
\EnableCrossrefs
\RecordChanges
\parindent=0pt
\parskip=1ex
\begin{document}
\maketitle
\tableofcontents
\DocInput{cd-cover.dtx}
\PrintIndex
\end{document}
%</driver>
%\fi
% \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         \~}
%
% \section{Introduction}
%
% This is an $\beta$ release of the \textsf{cd-cover} class. This was
% previously a package, but since a class is actually more appropiate
% for the commands and macros herein, this new version switches to a
% class implementation.
%
% A number of improvements has been made in this release. The whole
% scheme of things has taken a drastic turn, providing many new
% advantages (see also section~\ref{sec:psscheme}).
%
% Bug reports, suggestions, praises, but not flames should be sent to
% \texttt{cholm@nbi.dk}.   Please submit changes in form of patches to
% the most recent \texttt{cd-cover.dtx} file\footnote{Avaliable from
% CTAN in \texttt{macros/latex/contrib/other/cd-cover}.}.  Patches are 
% easily generated with 
% \begin{quote}
%   {\ttfamily
%     diff -c \meta{original-file} \meta{new-file} >
%     \meta{patch-file}}
% \end{quote}
% on any reasonable system.  This makes merging changes into the class
% much eaiser, and the changes will more like be included in the
% normal distribution.
%
% \section{Usage}
%
% In this release four environments are provided:
% \begin{itemize}
% \item \textsf{bookletsheets} is for typesetting booklet pages for
%   normal CD covers (plastic cover).
% \item \textsf{backssheet} is for typesetting the back side for
%   normal CD covers.  
% \item \textsf{backssheet*} Special version of the above, that
%   rotates the back title the other way.  Useful for typesetting
%   double jewelcase covers, and for some nationalities (e.g., German)
%   that like the title to run opposite to that of English.
% \item \textsf{sleevesheet} is for typesetting paper sleeves for CDs,
%   for example if you lost the plastic one, or don't like the space 
%   they take up, or whatever.
% \item \textsf{singlesheet} is for typeseting covers for plastic
%   single CD covers.
% \end{itemize}
%
% \subsection{Syntax}
%
% The syntax of these environments is:
% \begin{quote}
%   |\begin{bookletsheets}|\meta{your text}|\end{bookletsheets}|\\
%   |\begin{backsheet}|\marg{title}\meta{your text}|\end{backsheet}|\\
%   |\begin{backsheet*}|\marg{title}\meta{your text}|\end{backsheet*}|\\
%   |\begin{sleevesheet}|\meta{your text}|\end{sleevesheet}|\\
%   |\begin{singlesheet}|\marg{title}\marg{slip text}\meta{your text}
%   |\end{singlesheet}|
% \end{quote}
% 
% Here \marg{title} is the title on the back of the covers, \marg{slip
% text} is the text that should go on the back slip of the single type
% cover.
%
% In figure~\ref{fig:exa:booklet} to~\ref{fig:exa:single} there
% are some examples of these environments. 
% 
% \begin{figure}[htbp]
%   \setlength{\unitlength}{.5mm}%
%   \begin{picture}(240,120)(0,-120)%
%     \put(0,0){\line(1,0){240}}%    
%     \put(0,0){\line(0,-1){120}}%   
%     \put(0,-120){\line(1,0){240}}% 
%     \put(240,0){\line(0,-1){120}}% 
%     \put(120,0){\line(0,1){5}}%    
%     \put(120,-120){\line(0,-1){5}}%
%     \multiput(120,-1)(0,-5){24}{\line(0, -1){3}} %
%     \put(110,2){\vector(1,0){10}}%  
%     \put(75,1){Fold here}%          
%     \put(125,-10){Hello World}
%     \put(5,-10){Hello World Again}
%   \end{picture}
%   \caption{Example of \textsf{bookletsheets} output}
%   \label{fig:exa:booklet}
% \end{figure}
%
% \begin{figure}[htbp]
%   \setlength{\unitlength}{.5mm}%
%   \begin{picture}(151,118)(0,-118)%
%     \put(0,0){\line(1,0){151}}%
%     \put(0,-118){\line(1,0){151}}%
%     \put(0,0){\line(0,-1){118}}%  
%     \put(151,0){\line(0,-1){118}}%
%     \put(7,0){\line(0,1){5}}%     
%     \put(7,-118){\line(0,-1){5}}% 
%     \multiput(7,-1)(0,-5){24}{\line(0, -1){3}}
%     \put(144,0){\line(0,1){5}}
%     \put(144,-118){\line(0,-1){5}}
%     \multiput(144,-1)(0,-5){24}{\line(0, -1){3}}
%     \put(17,2){\vector(-1,0){10}}%  
%     \put(17,1){Fold here}%          
%     \put(134,2){\vector(1,0){10}}%  
%     \put(99,1){Fold here}%         
%     \put(6,-118){\begin{rotate}{90}Hello World\end{rotate}}%
%     \put(145,0){\begin{rotate}{-90}Hello World\end{rotate}}%
%     \put(13,-10){Hello World Again}%
%   \end{picture}
%   \caption{Example of \textsf{backsheet} output}
%   \label{fig:exa:back}
% \end{figure}
%
% \begin{figure}[htbp]
%   \setlength{\unitlength}{.5mm}%
%   \begin{picture}(266,123)(0,-123)%
%     \put(0,0){\line(3,4){6}}%
%     \put(6,8){\line(1,0){121}}%
%     \put(133,0){\line(-3,4){6}}%
%     \multiput(130,-1)(0,-5){24}{\line(0, -1){3}} %
%     \put(50,1){Fold and clue}%
%     \put(0,-123){\line(3,-4){6}}%
%     \put(6,-131){\line(1,0){121}}%
%     \put(133,-123){\line(-3,-4){6}}%
%     \put(50,-127){Fold and clue}%
%     \put(0,0){\line(1,0){266}}%
%     \put(0,0){\line(0,-1){123}}%
%     \put(0,-123){\line(1,0){266}}%
%     \put(266,0){\line(0,-1){123}}%
%   \end{picture}
%   \caption{Example of \textsf{sleevesheet} output}
%   \label{fig:exa:sleeve}
% \end{figure}
%
% \begin{figure}[htbp]
%   \setlength{\unitlength}{.5mm}%
%   \begin{picture}(137,120)(0,-120)%
%     \put(0,0){\line(0,-1){116}}%
%     \put(0,0){\line(1,0){36}}%
%     \put(36,0){\line(0,1){2}}%
%     \put(15,0){\line(0,1){5}}%
%     \multiput(15,-1)(0,-5){24}{\line(0, -1){3}} %
%     \put(18,0){\line(0,1){5}}%
%     \multiput(18,-1)(0,-5){24}{\line(0, -1){3}} %
%     \put(36,2){\line(1,0){119}}%
%     \put(155,2){\line(0,-1){120}}%
%     \put(0,-116){\line(1,0){36}}%
%     \put(36,-116){\line(0,-1){2}}%
%     \put(15,-116){\line(0,-1){5}}%
%     \put(18,-116){\line(0,-1){5}}%
%     \put(36,-118){\line(1,0){119}}%
%     \put(5,4){\vector(1,0){10}}%
%     \put(28,4){\vector(-1,0){10}}%
%     \put(28,3){Fold here}%
%     \put(0,0){\begin{rotate}{-90}Hello World\end{rotate}}%
%     \put(15,0){\begin{rotate}{-90}Hello World Again\end{rotate}}%
%   \end{picture}
%   \caption{Example of \textsf{singlesheet} output}
%   \label{fig:exa:single}
% \end{figure}
% \subsection{User setup}
%
% For each of the four environments, two user configurable lengths are
% defined. One is |\CD|\meta{type}|TopMargin|, which determins the
% vertical space from the cover border to \meta{your text}. The other
% is |\CD|\meta{type}|Margin| which determins the horizontal space
% between the border and \\meta{your text}. The default values for
% these lengths are 5mm.
%
% Here is the complete list of the lengths
%
% \DeleteShortVerb{\|}
% \begin{tabular}{|ll|}
%   \hline
%   \MakeShortVerb{\|}%
%   |\CDbookletTopMargin|& |\CDbackTopMargin|  \\  
%   |\CDbookletMargin|   & |\CDbackMargin|     \\
%   |\CDsleeveTopMargin| & |\CDsingleTopMargin|\\
%   |\CDsleeveMargin|    & |\CDsingleMargin|   \\
%   \hline
% \end{tabular}
%
% For example, if you want to put a picture that fills out a
% complete page of the booklets, you can set |\CDbookletTopMargin| and
% |\CDbookletMargin| to |0pt|. For example 
% \begin{verbatim}
%   \documentclass{cd-cover} 
%   \usepackage{epsfig}
%   \begin{document}
%   \parindent=0pt
%   \parskip=0pt
%   \CDbookletTopMargin=0pt
%   \CDbookletMargin=0pt
%   \begin{bookletsheets}
%     \vspace{5mm}  % These are specific for the file rh61img.ps 
%     \hspace{5mm}
%     \begin{center}
%       {\LARGE Debian GNU/Linux 2.2r5 --- potato}
%     \end{center}
%     \epsfig{file=rh61img.ps,width=11.99cm}
%     \end{bookletsheets}
%   \end{document}                            
% \end{verbatim}
%
% Note that the graphics should not be 12cm exactly, but rahter
% slightly less, say 11.99cm like above. This is to make sure that it
% only takes up one page, so that \LaTeX{} will not start a new page. 
%
% \section{Credits} 
%
% Many people have come up with suggestions, bugs, improvements to the
% first package version of \textsf{cd-cover}, and I'd like to thank
% them, especially for thier patience in me, for not getting this out
% sooner. So thanks to 
% James A.\ Bednar,
% Steven Buehler,
% Patrik Carlsson,
% Jim Clark,
% Lionel Cons,
% Joerg Desch,
% Stefan A.\ Deutscher,
% Holger Dewes,
% Stephen Gildea,
% Anders Bruun Olsen,
% Rolf Niepraschk,
% Mark Peade,
% Dominik Roettsches,
% Carsten Sch\"afer,
% C.\ J.\ Walker, 
% and 
% Rainer Wiener. 
% I may have forgotten some, for which I apologize. 
%
% And of course thanks to Donald E.\ Knuth for \TeX, Leslie Lamport
% for \LaTeX, Robin Fairbairns for CTAN and being very patient with
% me. 
%
% \section{Copyright}
%
% \LaTeXe{} class \textsf{cd-cover} for typesetting a variaty of cd
% covers Copyright \copyright 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
% \begin{quote}
%   Free Software Foundation, Inc.\\
%   675 Mass Ave\\
%   Cambridge\\
%   MA 02139\\
%   USA
% \end{quote}
%
% \section{Implementation}
%
%\iffalse
%<*class>
%\fi
%
% \subsection{Initializing}
%
% \subsubsection*{Identification}
% 
% First we must, as any good package or class should, identify
% ourselves, and tell what format we need. In this case it is ofcourse
% \LaTeXe{}.
% 
%    \begin{macrocode}
\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.]
%    \end{macrocode}
%    
% \subsubsection*{Lengths or dimensions}
% 
% The next thing is to setup some lengths (dimensions) we need for
% various purposes. There is two temporary lengths |\temp@length| and
% |\temp@@length|, for use in variuos calculations; along width margin
% lengths, two for each type of environment, one for the odd pages
% |\booklet@odd@margins|, |\back@odd@margins|, |\sleeve@odd@margins|,
% and |\single@odd@margins|, and ofcourse the corrosponding for the
% even pages |\booklet@even@margins|, |\back@even@margins|,
% |\sleeve@even@margins|, and |\single@even@margins|. These margin
% lengths is used so that we may do two--sided printing where the
% various covers align. 
%    \begin{macrocode}
\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}
%    \end{macrocode}
%    
% \subsubsection*{Options}
% 
% \begin{macro}{\cd@cover@setup@margins}
% This command sets up a number of dimensions, so that when doing
% two--side printing, the covers will be align on each side of the
% paper, and can neatly be cut out to provide a double--sided booklet,
% sleeve or cover. This is not implemeted fully yet.  What is here is
% good for the booklet, but doesn't work for single other types of
% covers.  It's mainly the horizontal alignment that's the problem.
%    \begin{macrocode} 
\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}
%    \end{macrocode}
% \end{macro}
% We also provide a number of options, to specify the papersize.
% Notice, that since the \textsf{article} class will set the paper
% size, we use temporary local variables to  hold the information, and
% then in |\cd@cover@setup@margins| we set the right dimensions. 
%    \begin{macrocode}
\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}}
%    \end{macrocode}
% Notice, that some standard papersizes produces an error message, as
% they will be too small to hold the covers.
%    \begin{macrocode} 
\DeclareOption{a5paper}{\cd@cover@paper@error{a5paper}}
\DeclareOption{b5paper}{\cd@cover@paper@error{b5paper}}
%    \end{macrocode}
% Also, all papersizes are already in `landscape'
% version\footnote{compared to the normal defintions in
% \texttt{article.cls}.} so the \textsf{landscape} option is redundent
% with this class.
%    \begin{macrocode} 
\DeclareOption{landscape}{
  \ClassWarning{cd-cover}{Option `landscape' redundant to this % 
    class.}}
%    \end{macrocode}
% Add an option to avoid foldlines 
%    \begin{macrocode} 
\newif\ifcd@cover@foldlines\cd@cover@foldlinestrue
\DeclareOption{nofoldlines}{\cd@cover@foldlinesfalse}
\DeclareOption{foldlines}{\cd@cover@foldlinestrue}
%    \end{macrocode}
% All other options are passed on to the standard \textsf{article}
% class, as expected. `letterpaper' is then the default paper size,
% and we finally execute the options.
%    \begin{macrocode} 
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ExecuteOptions{letterpaper}
\ProcessOptions\relax
%    \end{macrocode}
% \begin{macro}{\cd@cover@paper@error}
% This is just an error message, so that the user doesn't try to use a
% paper size that is too small to hold some of the covers.
%    \begin{macrocode} 
\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.)}}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection*{Class and package loading}
%
% First we load the standard \LaTeXe{} class \textsf{article} with
% what ever options was passed from above. This provides the user with
% the standard envrionments and sectioning commands, and is therefore
% desired. The \textsf{article} class is chosen, since the sectioning
% commands of this class is appropiate for cd--covers. The package
% \textsf{rotating} is then loaded. This package facilitates rotation
% of text, using |\special| commands. This means, that this class may
% be sensible to the users \textsf{PostScript} driver. Also, as I
% myself suspected, and as others have confirmed, this package is
% flawed, meaning, that this class isn't as stable as it should
% be. However, the \textsf{rotating} package is the best avaliable for
% the job, and hence used here\footnote{I'm sorry I don't have the
% time, or expertice, to write a new package, but that's life for
% you.}.  
%
% After loading the class, we set the paper height and width.
%    \begin{macrocode} 
\LoadClass{article}
\paperheight=\temp@length
\paperwidth=\temp@@length
\RequirePackage{rotating}
%    \end{macrocode}
%
% \subsubsection*{Setting up fixed lengths}
% 
% Next on the agenda is to define and setup some fixed lengths. These
% are the dimensions of the various cover styles. The really isn't
% much to say about these. I obtained these numbers by simple
% meassuring some of my own (pre--printed) covers, with, as you can
% see, a metric meter stick.
%    \begin{macrocode}
\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}
%    \end{macrocode}
%
% \subsubsection*{Setting up user lengths}
% 
% The user also has some control of the page dimensions of the various
% cover types. These are provided via the below lengths. What the do
% should be obvious from the names\footnote{Otherwise, refer to the
% documentation part of this document.}. We also set the default
% values of these lengths here.
%    \begin{macrocode}
\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}
%    \end{macrocode}
%
% Finally we set the default page style to \textsf{empty}.
%    \begin{macrocode}
\pagestyle{empty}
%    \end{macrocode}
%
% \subsection{The various cover types}\label{sec:psscheme}
%
% The changing form one type of cover to the other is implemented
% using `page styles'. So each type of cover has it's own page
% style. This has several advantages.
%
% To those of you familiar with the first two (or was it three --- I
% can't remember) versions, this is where you really will note the
% difference. In version v1.0 from 1998/10/04, the interface was
% driven via commands. This limited a number of things, most noticably
% the text length. You had to manually break each page up, which
% ofcourse is very non--\TeX{}--like. Secondly it limited the use of
% `floats' such as \textsf{tables} and \textsf{figures}.
%
% Well, in the \emph{new} scheme, this is all changed. Since the
% pagestyle doesn't effect the way pages are broken by \TeX, one no
% longer has to break up the pages manually! You can put as much text
% as you like into the pages, \LaTeX{} will just produce more pages as
% the text growes in length. Though page styles has \emph{some} effect
% on the \LaTeXe{} output routine and hence on floats, it is very
% minimal, and floats can be use extensively under this scheme.
%
% Another advantage of the new scheme, is the use of user
% \emph{configurable dimensions}. If all the boundary dimensions are
% set to zero, you can effectually fill out the whole cover with
% text. Though this doesn't seem usefull, consider the the case where
% you want to fill out your cover with some marvelous picture you have
% created in \textsf{Gimp}, \textsf{PhotoShop}, or just downloaded
% form the internet!
%
% \subsubsection{The booklet type}
%
% Let me just say a few words on page styles. Every page style defines
% the commands |\@oddhead|, |\@evenhead|, |\@oddfoot|, and
% |\@evenfoot| to be some command containg some text\footnote{In
% \TeX{} terms this means \emph{horizontal mode stuff}.}. There
% \emph{must} be some text present, or othetwise \TeX{} will respond
% with a \texttt{Underfull \string\hbox ... while output is active},
% wich is quite enyoing. For this reason all the \emph{border} macros 
% contains a |\hfill| as the very last thing. Also, \LaTeX{} assumes,
% that the four macros above are no wider then |\textwidth| and no
% taller then |\headheight| or |\footskip|, whatever appropiate.
%
% For the page styles at hand, I decided to |\let| the above two
% |\@...head| commands to the  \emph{border} commands below, and the
% two |\@...foot| to |\@empty|. Now these \emph{border} commands are
% apparently \emph{much} taller then |\headheight|, but if one takes a
% closer look, they actually aren't.
%
% The first part of every one of them is one ore more
% |\kern|s. |\kern|s in \TeX{} mind\footnote{Or mouth or stomach, I
% don't remember wich one it is, as Donald E.\ Knuth calls it in the
% \TeX{}book.} doesn't take up space in anyway, so these commands are
% \emph{invisble} in that sense. The next thing is a \textsf{picture}
% environment, and this is defined in \LaTeXe{} so that it does't take
% up any space in the previous sense. Finishing of the macros is a
% |\hfill|, wich is there for reasons explained above. So the only
% command that is `space visible' in the \emph{border} commands, is
% the |\hfill|! Now if that isn't neat, I don't know what is. That
% said, I won't comment anymore on the page style definitons and move
% straight on to the rest of the macros and commands.
% \begin{macro}{\ps@bookletsheet}
%    \begin{macrocode}
\def\ps@bookletsheets{  
  \let\@oddhead\booklet@border\let\@evenhead\@oddhead
  \let\@oddfoot\@empty\let\@evenfoot\@oddfoot}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\init@booklet}
% We need to do some manipulation of the dimensions |\textheight|,
% |\textwidth|, |\headsep| and since the booklet pages are set in
% double column mode, also on |\columnsep| and |\@colht|.
%    \begin{macrocode}
\def\init@booklet{
%    \end{macrocode}
% What we do is to set the text height limit to the proper value for
% the booklet --- as defined in |\booklet@height| --- then correct for
% the space wanted above and below the text --- as defined in
% |\CDbookletTopMargin|. This ofcourse only sets the \emph{lower}
% margin, and has absolutly nothing to do with the upper margin. To do
% that we fix the value of |\headsep| to |\CDbookletTopMargin|.
%    \begin{macrocode}
  \temp@length=\booklet@height
  \advance\temp@length-2\CDbookletTopMargin
  \global\textheight=\temp@length
  \global\headsep=\CDbookletTopMargin
%    \end{macrocode}
% The next thing is to set the text width. This limit is again set to
% it's appropiate value for this type of cover --- defined in
% |\booklet@width| --- and then corrected for for the wanted margin
% width --- taken from |\CDbookletMargin|.
%    \begin{macrocode}
  \temp@length=\booklet@width
  \advance\temp@length-2\CDbookletMargin
  \global\textwidth=\temp@length
%    \end{macrocode}
% A little extra care is needed since we type set in two column
% mode. We In the case, that the first page  contains this sort of
% cover, we \emph{have to} set |\@colht| equal to |\textheight|
% manually. 
%
% The reason is a bit complicated, and I will not go into
% much detail about it. The point is, that \LaTeX{} uses |\@colht| as
% the limit for the height of the columns. Now, when constructing the
% first column, |\@colht| still has the old value of |\textheight|, as
% set in the begining of the document, and this is properly not what
% we want. \emph{After} making the first column, it sets |\@colht| to
% the present value of |\textheight|, which is what we want, but then
% it is too late. The \emph{only} way to get around this
% problem\footnote{Or is ts a bug in \LaTeXe.}, is to manually set
% |\@colht|. One should not be conserned on that this dimension is
% hand--set on subsequent pages.
%
% The second thing to do, is to set |\columnsep| to whatever value the
% margins should have --- as defined in |\CDbookletMargin|.
%    \begin{macrocode}
  \global\@colht=\textheight
  \global\columnsep=2\CDbookletMargin}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{bookletsheets}
% Now for the environment it self. We start off with initializing the
% dimensions as outlined above, and then we start the two column
% mode and set the page style to \textsf{bookletsheets}. To finish of
% the the environment, we make sure that the last page has a border by
% calling |\clearpage|, and revert to the default page style. 
%    \begin{macrocode}
\newenvironment{bookletsheets}{
  \init@booklet\twocolumn\pagestyle{bookletsheets}}{
  \clearpage\pagestyle{empty}}
%    \end{macrocode}
% \end{environment}
% 
% \begin{macro}{\booklet@border}
% First we want to back up the margin width (|\CDbookletMargin|), so
% that the border will be properly spaced from the text. Secondly we
% want to draw the border.
%
% This border isn't very complex. It's just a retangular with to small
% lines indicating a folding line. For the users convinience, we put
% an arrow an some text next to the folding line.
%
% As explained above this command is `space invisible', execpt for the
% final |\hfill|, which is exactly what we want. 
%     \begin{macrocode}
\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}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{The back type}
% 
% One could argue, that the page style scheme outlined on page
% \pageref{sec:psscheme} really isn't that advantages in this case,
% and that a \textsf{minipage}--like solution would be better, since
% the text in this environment shouldn't be more then \emph{one} page,
% since there is only room for one back sheet on a normal
% cd-cover. While this is true, I decided, that it should be up to the
% user to restain him/her--self from putting tom much text into these
% kinds of pages.
% 
% \begin{macro}{\ps@backsheet}
% Page style for the backpage.
%    \begin{macrocode}
\def\ps@backsheet{
  \let\@oddhead\back@border\let\@evenhead\@oddhead
  \let\@oddfoot\@empty\let\@evenfoot\@empty}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\init@back}
% This macro is similar to |\init@booklet| comment above, so I will
% suffice to say the instead of |\CDbooklet...| above read
% |\CDback...|, and the two--column notes are irrelevant.
%    \begin{macrocode}
\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}
%    \end{macrocode}
% \end{macro}
%    
% \begin{macro}{\back@title}
% This is a save box for the title on the back of the cover. See more
% below. 
%    \begin{macrocode}
\newsavebox{\back@title}
%    \end{macrocode}
% \end{macro}
% 
% \begin{environment}{backsheet}
% \begin{environment}{backsheet*}
% This environment should take one argument, the title on the back of
% the cover. This will be type set two times; one on each end of the
% cover, rotated as to give the proper reading when your CD is put on
% the shelf. The argument is put into a |\parbox|, so that we may
% control the size of the text, and then put into a save box for later
% use (in |\back@border|).
%
% The star'ed version \textsf{backsheet*} turns the back title
% opposite to the non--star'ed version.  This is useful if one want's
% to typeset covers for double jewel cases.  Also, in some countries,
% like Germany, they like having the text run the opposite direction,
% so for those users, that environment may be more appropiate. 
%
% \begin{macro}{\ifback@anglereverse}
% To help distingish between the two ways of rotation the back title,
% we have the macro |\ifback@anglereverse|, which is set to |\relax| if
% we're using the regular non--star'ed version. 
%    \begin{macrocode}
\newif\ifback@anglereverse\back@anglereversefalse
%    \end{macrocode}
% \end{macro}
%
% As in \textsf{bookletsheets} environment, we call the initializing
% macro, make sure we are in one--cloumn mode, and set the page
% style. When finishing of the environment, we clear the page, to
% insure the last page style, and revert to the default page style.
%    \begin{macrocode}
\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}}
%    \end{macrocode}
% \end{environment}
% \end{environment}
%
% \begin{macro}{\back@border}
% First we back up, just as in |\booklet@border|, but we also have to
% back up the length (height) of the slips, unlike above. Then the
% border is drawn with folding marks, and some help text and arrows.
%    \begin{macrocode}
\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
%    \end{macrocode}
% We finshes off with drawing the rotated titles. Please notice, that
% the left one, is the one closest to the opening of the CD
% cover. This should explain the somewhat strange rotating values.
%
% Also, notice that we can rotate one or the other way, as explained
% above, conditionally on |\ifback@anglereverse{1}|. 
%    \begin{macrocode}
    \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}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{The sleeve type}
%
% This type showes how you can juggle around with \LaTeX{} and get it
% to do almost everything you want\footnote{I don't want to sound
% pretentious, but I was surprised how easily it all turned out to
% be.}. By altering a bit in the way |\LaTeXe| output two--column
% pages, I could get it to swap the columns, so that the last entered
% would come out first, and vice versa. This is exactly what we want
% for this page style, which is obvious when you see the finished
% output. 
% 
% \begin{macro}{\ps@sleevesheet}
%    \begin{macrocode}
\def\ps@sleevesheet{%
  \let\@oddhead\sleeve@border\let\@evenhead\@oddhead
  \let\@oddfoot\@empty\let\@evenfoot\@oddfoot}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\init@sleeve}
% What I said about |\init@booklet| goes here with the exchange of
% |\CDsleeve...| for |\CDbooklet...|.
%    \begin{macrocode}
\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}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{sleevesheet}
% Again we initialize, make sure we are in two column mode, and set
% the page style. The only thing to notice here, is we |\let|
% |\@outputdblcol| to |\sleeve@outputdblcol|, and when the environment
% ends, change back to the usual definition saved in
% |\ltx@outputdblcol|. It is important that the last change comes
% \emph{after} the |\clearpage|, since otherwise, the last page will
% be output with the wrong output routine. Notice, that it doesn't
% make sense to make two--side prinint for this kind of cover, so the
% scheme works on \emph{any} page. Ofcourse, you should make the
% following page blank, by putting |\vfill\clearpage| after the
% environment. 
%    \begin{macrocode}
\newenvironment{sleevesheet}{%
  \init@sleeve
  \twocolumn\pagestyle{sleevesheet}
  \global\let\@outputdblcol\sleeve@outputdblcol}{
  \clearpage\pagestyle{empty}
  \global\let\@outputdblcol\ltx@outputdblcol}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\sleeve@border}
% Two flaps is outlined for clueing.
%    \begin{macrocode}
\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}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{The single type}
% 
% \begin{macro}{\ps@singlesheet}
% To facilitate two side printing, we have to have two kinds of
% borders, since the border outline is asymmetric along a vertical
% line, hence |\@oddhead| and |\@evenhead| has different values.
%    \begin{macrocode}
\def\ps@singlesheet{
  \let\@oddhead\odd@single@border
  \let\@evenhead\even@single@border
  \let\@oddfoot\@empty\let\@evenfoot\@oddfoot}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\single@title}
% \begin{macro}{\single@slip}
% These two save boxes are used below.
%    \begin{macrocode}
\newsavebox{\single@title}
\newsavebox{\single@slip}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\init@single}
% Again exchnage |\CDsingle...| with |\CDback...| in the description
% of |\init@back|, and there you have it.
%    \begin{macrocode}
\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}
%    \end{macrocode}
% \end{macro}
%    
% \begin{environment}{singlesheet}
% As in the \textsf{backsheet} environment, we save the arguments in
% |\parbox|'es to control the size, and put all that into save boxes,
% wich are used in |\odd@single@border|. Everything else is as above.
%    \begin{macrocode}
\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}}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\odd@single@border}
% We define two border for the reasons stated above. The differ in
% that they are mirror reflections of each other, and the back title
% and slip text isn't put on even sides.
%    \begin{macrocode}
\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}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\even@single@border}
%    \begin{macrocode}
\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}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Modified output routines}\label{sec:modout}
%    
% Here are some modifications to the \LaTeXe{} output routine to
% \emph{invert} the page orders in some of the environments, such as 
% \textsf{sleeve}. First we save the old definition in
% |\ltx@outputdblcol|. 
%    \begin{macrocode}
\let\ltx@outputdblcol\@outputdblcol
%    \end{macrocode}
%
% \begin{macro}{\sleeve@outputdblcol}   
% Then we go on to define |\sleeve@outputdblcol|, changing the order
% of column output.
%    
% The first part os the same as in \texttt{ltoutput.dtx}, so no need
% to comment on that here.
%    \begin{macrocode}
\def\sleeve@outputdblcol{%
  \if@firstcolumn
    \global\@firstcolumnfalse
    \global\setbox\@leftcolumn\box\@outputbox
  \else
    \global\@firstcolumntrue
%    \end{macrocode}
% Now for the building of the actual output box, we \emph{interchange}
% the order of |\@leftcolumn| and |\@outputbox| in the body definition
% of |\@outputbox|, tricky isn't it!
%    \begin{macrocode}
    \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
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{The final stuff}
% 
% If we can figure out the graphics driver automatically, then we emit
% a |\special| or equivilant command to the output file.  If we can
% not find the driver, we warn the user that the printing should be
% done in landscape mode. 
%    \begin{macrocode}
\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} 
%    \end{macrocode}
%    
%\iffalse
%</class>
%\fi