summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/papercdcase/papercdcase.dtx
blob: 1aa07e96b4931730daf7262e67d87cde10b37c46 (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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% $Id: papercdcase.dtx 11 2006-08-07 11:54:04Z tdussa $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\SVNMisc$#1: #2 #3${#2}
\def\SVNDate$#1: #2-#3-#4 #5${#2/#3/#4}
\def\filename{papercdcase.dtx}
\xdef\fileversion{\SVNMisc$Revision: 11 $}
\xdef\filedate{\SVNDate$Date: 2006-08-07 13:54:04 +0200 (Mon, 07 Aug 2006) $}
\let\docversion=\fileversion
\let\docdate=\filedate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\iffalse
\typeout{%
%% Purpose:
        Package: papercdcase \filedate\space\fileversion\space
        for typesetting paper CD cases.
}% 
%%
%% Documentation:
%%      The documentation  can be generated   from the original  file
%%      papercdcase.dtx with the doc  style/package.   LaTeX the file 
%%	papercdcase.dtx to get the full documentation in dvi format.
%%
%%
%% Author: Tobias Dussa
%%         Im Schlossfeld 4
%%         77855 Achern
%% Mail:   tdussa@sdhs.de
%%
%% Copyright (C) 2006 Tobias Dussa
%%
%%  papercdcase.dtx is distributed in  hopes  that  it will be useful,
%%  but  WITHOUT  ANY WARRANTY.    No  author or  distributor  accepts
%%  responsibility to  anyone for the  consequences of using it or for
%%  whether  it serves any particular purpose  or works at all, unless
%%  he says so in writing.
%% 
%%  Everyone  is granted permission  to copy,  modify and redistribute
%%  papercdcase.dtx,  provided this copyright notice  is preserved and
%%  any modifications are indicated.
%% 
%%
%%  This style is still under development and  may be replaced with a
%%  new version which provides an enhanced functionality.
%%
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\setcounter{IndexColumns}2
\begin{document}
  \DocInput{papercdcase.dtx}
  \newpage
  \PrintChanges
\end{document}
%</driver>
%\fi
%
% \title{A \LaTeX\ Package for Typesetting\\ Paper CD
%        Cases\thanks{This file documents \filename\ version 
%        \fileversion\ as of \filedate.}} 
% \author{Tobias Dussa\\
%	  Im Schlo\ss{}feld 4\\
%	  77855 Achern (Germany)\\
%	  e-mail: \verb~tdussa@sdhs.de~}
%
% \date{{\footnotesize Documentation date: \docdate}}
%
% \maketitle
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \DoNotIndex{\ ,\",\',\.,\[,\\,\],\^,\`,\~,\@,\@dottedtocline}
% \DoNotIndex{\@empty,\@nameuse,\advance,\begin,\begingroup}
% \DoNotIndex{\catcode,\def,\else,\end,\endgroup,\fi,\filedate}
% \DoNotIndex{\footnotesize,\framebox,\gdef,\hfill,\if,\ifx,\let,\makebox}
% \DoNotIndex{\mbox,\newcommand,\newcount,\newdimen,\newenvironment}
% \DoNotIndex{\newif,\noindent,\normalsize,\null,\par,\put}
% \DoNotIndex{\relax,\rm,\rule,\scriptsize,\sf,\textsf,\textwidth}
% \DoNotIndex{\the,\unitlength,\uppercase,\xdef,\ProvidesPackage}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%    \changes{1.0}{2006/06/06}{First release.}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    \CheckSum{649}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  \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         \~}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    \MakeShortVerb{|}
%
%    \begin{abstract}
%      papercdcase.dtx provides a package to typeset paper CD cases.
%      The paper CD cases are origami-style CD cases which, when
%      properly folded, provided a simple, inexpensive, and readily
%      reproducable CD protection.  This package creates the proper
%      folding lines on one hand, but on the other hand also provides
%      a means of putting material like CD titles, CD track lists, and
%      so on into the proper places so that it will come out just
%      right when printed and folded.
%
%      The package is based with friendly permission on the work of
%      Thomas Hull (\verb!http://web.merrimack.edu/~thull!) as well
%      as the project of the folks at \verb!http://www.papercdcase.com!.
%
%      Any comments, corrections and so on are greatly appreciated.
%    \end{abstract}
%
%    \tableofcontents
%    \newpage
%
%    \section{About Paper CD Cases}
%
%    Paper CD cases are a very convenient way to protect your CDs.
%    While they are not as sturdy as plastic cases, they are
%    inexpensive, simple, easily reproducable, yet astonishingly
%    sturdy.
%
%    The idea is based on origami, the Japanese art of paper folding,
%    and has been developed by Thomas Hull
%    (\verb!http://web.merrimack.edu/~thull!) and further elaborated
%    on by the folks at \verb!http://www.papercdcase.com!.  Many
%    thanks to them all for their kind permission to use their work in
%    this package.
%
%    Obviously, the way a paper CD case needs to be folded is somewhat
%    dependent on the actual physical size of the sheet of paper it is
%    printed on.  In general, there are two standard paper sizes that
%    lend themselves for this purpose: A4 and letter.
%
%    The problem is that for a paper CD case, the difference in paper
%    height between a sheet of A4 paper ($296.9\,\hbox{mm}$) and a
%    sheet of letter paper ($11''$) is actually significant.  While it
%    is possible to use the folding scheme designed for letter paper
%    on an A4 sheet of paper, this does have some drawbacks: It is
%    necessary to fold over a thin strip of paper just
%    $17.5\,\hbox{mm}$ or about $\frac{11}{16}''$ wide, which turn out
%    to be a bit difficult to fold.  Furthermore, paper CD cases based
%    on this folding scheme are a bit less sturdy than
%    they could be.\\
%    On the other hand, a folding scheme that makes optimal use of an
%    entire A4 sheet of paper cannot be used on letter paper, because
%    letter paper is too short.
%
%    For these reasons, two folding schemes are provided: A universal
%    scheme that fits both on letter and on A4 paper, if somewhat
%    imperfectly on the latter, and a specialized folding scheme that
%    perfectly fits on A4 paper.
%
%    The general paper CD cases that are produced are carefully sized
%    so that they fit on a (hypothetical) piece of paper
%    $210\,\hbox{mm}$ wide (A4 width) and $11''$ tall (letter height).
%    In other words, the smaller edges of both paper sizes have been
%    used to target the size of the paper case.  This means that on
%    either paper, there will be some excess space along one of the
%    axes.
%
%    \section{What the Package Provides}
%
%    In creating paper CD cases, there are three things of interest:
%    \begin{enumerate}
%    \item the folding scheme (the paper case itself, if you will),
%    \item textual information that may or may not be desired on the
%      finished case, and
%    \item the placement of both of the above elements on the physical
%      piece of paper.
%    \end{enumerate}
%
%    This package provides means to generate the proper folding scheme
%    as well as provisions for some useful text boxes that are placed
%    correctly within the folding layout so that their contents appear
%    in the proper places when the paper case is folded.
%
%    This package does \emph{not} provide an automatism to place the
%    folding scheme and the text boxes on the physical page.  While
%    the text boxes \emph{are} placed properly by the package, this
%    placement is merely relative to the folding scheme.  It is up to
%    the user to decide on what paper she wants to actually print the
%    paper case.  This means in particular that the user is
%    responsible for centering the paper case on the sheet if this is
%    desired, and that things like page numbers and so on must be
%    dealt with by the user.
%
%    However, this offers some flexibility that is worth the minor
%    overhead nuisance of centering a box on a page.
%
%    \subsection{The Folding Scheme}\label{sec:scheme}
%
%    \DescribeMacro{\papercdcase}%
%    Typesetting the folding scheme itself is fairly straightforward:
%    Simply issue the proper command:
%    \begin{verbatim}
%    \papercdcase
%    \end{verbatim}
%    This command will produce the folding scheme, consisting of
%    \begin{itemize}
%    \item solid lines,
%    \item dashed lines, and
%    \item numbers.
%    \end{itemize}
%    The numbers define the \emph{sequence} in which the folding steps
%    should be carried out, while the types of lines specify
%    \emph{how} the paper should be folded.  More details on the
%    folding procedure can be found in section~\ref{sec:folding}.
%
%    \DescribeMacro{\papercdcase[]}
%    The folding scheme is conveniently sized so that the finished
%    paper case will hold a standard $120\,\hbox{mm}$ CD.  However,
%    there are also smaller $80\,\hbox{mm}$ so-called Maxi CDs.  In
%    order to create a folding scheme that is scaled so that the
%    folded case will hold a small, $80\,\hbox{mm}$ CD, just add a
%    parameter to the command above, specifying that you would like a
%    folding scheme for an $80\,\hbox{mm}$ CD case by use of the
%    optional size parameter:
%    \begin{verbatim}
%    \papercdcase[80]
%    \end{verbatim}
%    In fact, you can scale the folding scheme to any size you want,
%    measured in whole millimeters, by replacing the \texttt{80} in
%    the call above by the desired design size in millimeters.
%
%    \DescribeMacro{\papercdcase*}
%    As mentioned in the introduction, there are two kinds of folding
%    schemes: One that is designed to fit both A4 and letter sheets of
%    paper, and one that is designed to fit A4 paper perfectly.  The
%    commands above all produce the general version.  If you are using
%    A4 paper are would like to use the A4-optimized folding scheme,
%    use the starred version of the command instead:
%    \begin{verbatim}
%    \papercdcase*
%    \papercdcase*[80]
%    \end{verbatim}
%
%    \subsection{The Text Boxes}\label{sec:boxes}
%
%    This package offers four boxes that are put into predefined
%    places:
%    \begin{itemize}
%    \item A spine matter box,
%    \item a latch matter box,
%    \item a back matter box, and
%    \item a pouch matter box.
%    \end{itemize}
%
%    The spine matter box is centered horizontally and vertically on
%    the spine of the CD case.  Typically, this box holds the CD title
%    and the artist for an audio CD.
%
%    The latch matter box is printed in the top left-hand corner of
%    the CD case latch.  Again, this box typically contains the CD
%    title.
%
%    The back matter box is printed in the top left-hand corner of the
%    back of the CD case.  A typical use for this box is the track
%    list of an audio CD.
%
%    Finally, the pouch matter box is printed in the top left-hand
%    corner of the CD case pouch, just below the latch.  This box is
%    typically unused, but may be useful for some additional
%    information.
%
%    \DescribeMacro{\setcdlatchmatter}
%    \DescribeMacro{\setcdpouchmatter}
%    \DescribeMacro{\setcdbackmatter}
%    \DescribeMacro{\setcdspinematter}
%    In order to fill the boxes, use these commands:
%    \begin{itemize}
%    \item |\setcdlatchmatter|
%    \item |\setcdpouchmatter|
%    \item |\setcdbackmatter|
%    \item |\setcdspinematter|
%    \end{itemize}
%
%    As an example, a typical use of the above commands might look
%    like this:
%    \begin{verbatim}
%    \setcdlatchmatter{\textbf{\LARGE Jean Michel Jarre\\[0.25\baselineskip]
%                                     In Concert: Houston--Lyon}}
%
%    \setcdpouchmatter{Live recordings from the legendary concerts in
%      Houston and Lyon 1986}
%
%    \setcdbackmatter{\textbf{\LARGE Jean Michel Jarre\\[0.25\baselineskip]
%                                    In Concert: Houston--Lyon}
%      \begin{enumerate}
%      \item Oxygene V
%      \item Ethnicolor
%      \item Magnetic Fields I
%      \item Souvenir (Of China)
%      \item Equinoxe V
%      \item Rendez-Vous III (Laser Harp)
%      \item Rendez-Vous II
%      \item Ron's Piece
%      \item Rendez-Vous IV
%      \end{enumerate}}
%
%    \setcdspinematter{\textbf{\Large Jean Michel Jarre/In Concert:
%                                     Houston--Lyon}}
%    \end{verbatim}
%
%    Be aware that the text boxes must be filled with the above
%    commands \emph{before} the folding scheme is typeset with the
%    \verb~\papercdcase~ command.
%
%    \subsection{The Placement on Physical Paper}\label{sec:placement}
%
%    As mentioned before, there is no automatic procedure provided by
%    the package that automatically places the folding scheme and the
%    boxes on a physical sheet of paper.  This is a conscious design
%    decision with the aim to maintain a maximum of flexibility.
%
%    Actually positioning the folding scheme on paper is very easy,
%    though.  If you are using either A4 or letter paper, which is
%    probably the case is more than 99\,\% of all cases, there are
%    three things to worry about:
%    \begin{itemize}
%    \item All margins should be set to zero size,
%    \item headlines and footlines should be empty, and
%    \item the folding scheme should be centered horizontally.
%      Vertical alignment is not as important, because the universal
%      folding scheme fills up an entire letter-sized page, while the
%      A4 folding scheme fills up an entire A4 page.  Thus, no
%      vertical adjustments need to be done in these cases.\\
%      If the general folding scheme is used on A4 paper, then
%      obviously, the page is not entirely filled.  However, even in
%      this case, I recommend \emph{not} to do any vertical
%      adjustments, but rather to leave the top of the folding scheme
%      aligned with the page edge.  This saves one folding
%      operation.  (One might put a \verb~\vspace*{\fill}~ or so at
%      the beginning of the page, of course, so the bottom of the
%      folding scheme is flush with the paper edge instead of the top,
%      but this does not really make a difference in practice.)
%    \end{itemize}
%    All of the above points are addressed in this little document,
%    for instance.  This example serves well if letter-sized paper is
%    used.
%    \begin{verbatim}
%    \documentclass{article}
%    \usepackage[margin=0pt]{geometry}
%    \usepackage{papercdcase}
%    \pagestyle{empty}
%    \begin{document}
%    \setcdlatchmatter{Latch}
%    \setcdspinematter{Spine}
%    \setcdpouchmatter{Pouch}
%    \setcdbackmatter{Back}
%    \centering\papercdcase
%    \end{document}
%    \end{verbatim}
%    For A4 paper, the above code also works, but it is necessary to
%    tell \LaTeX{} to use A4 paper, of course.  This may be done by
%    changing \verb~\usepackage[margin=0pt]{geometry}~ to
%    \verb~\usepackage[a4paper, margin=0pt]{geometry}~, for example.
%    Also, it might be desirable to use \verb~\papercdcase*~ instead
%    of \verb~\papercdcase~.
%
%    \section{Folding the Paper CD Case}\label{sec:folding}
%
%    Folding the printed paper CD case is quite simple, but requires a
%    bit of practice.  In principle, all necessary information is
%    provided on the printout.
%
%    In general, the numbers next to the lines specify the sequence in
%    which the folding should take place.  If a number is next to a
%    \emph{solid} line, fold \emph{along} the line so that the crease
%    runs along and over the line.  If a number is next to a
%    \emph{dashed} line, however, turn the sheet so that the number is
%    the right way up, then fold the sheet so that the paper edge
%    closest to you ends up aligned with the dashed line.  Think of
%    the dashed line as a folding ``target''.
%
%    Be aware that the first few folds might be unnecessary.  This is
%    the case whenever a folding line is aligned with a paper edge
%    already.  This will happen every time the folding scheme fills
%    out the entire sheet, in other words, whenever the universal
%    folding scheme is printed on letter paper or the A4 folding
%    scheme is printed on A4 paper.  However, even if the universal
%    folding scheme is printed on A4 paper, one edge of the scheme may
%    well already be aligned with the corresponding paper edge.  This
%    is no problem, but it means that neither the folding line(s) nor
%    the corresponding sequence number(s) will be there, so you might
%    have to start the folding sequence with step number~2 or~3
%    or even start with step number~1 and skip step number~2!\\
%    Generally, start with the lowest number found on the printout and
%    work your way up the numbers that are present.
%
%    The tricky folds are steps number~8 and~9 as well as numbers~10
%    and~11.  You will need to fold little triangular ears towards you
%    so the pouch is formed and stabilized.  I am afraid that accurately
%    describing exactly how the folding works in an appropriate amount
%    of words is beyond me, so please refer to
%    \verb!http://web.merrimack.edu/~thull! and/or
%    \verb!http://www.papercdcase.com! for more detailed, excellent
%    instruction on how to fold a paper CD case.  In particular, a PDF
%    with graphical instructions can be found at
%    \verb!http://kahuna.merrimack.edu/~thull/CDcase/cd.pdf!.
%
%
%    \section{Example Files}
%
%    I have included some example files with this package that hopefully
%    give an insight into how this package may be used.  In particular,
%    I included a minimal example showing just the very basics in this
%    documentation, a little interactive example that lets you create CD
%    cases on the fly, and a more elaborate example which is pretty much
%    what I am using right now for my own purposes.  Maybe some of the
%    included files will provide clues on how to use this package.
%
%    \StopEventually{}
%    \newpage
%
%
%    \section{The Implementation}
%
%    The folding scheme is basically implemented with the \LaTeX{}
%    picture environment. This gives us enough flexibility and
%    provides an high enough abraction such that we do not have to
%    fiddle around with to many low level details.
%
%    Additional functionality is required for rotating the label
%    boxes; thus, the \verb~graphicx~ package is included.
%    
%    \subsection{Basic Definitions and Parameters}
%    
%    First we identify this package and make sure we are talking
%    \LaTeX2e{}.  Furthermore, we load the \verb~graphicx~ and
%    \verb~calc~ packages and make the \verb~@~ character available
%    for internal command definitions.
%    
%    \begin{macrocode}
\ProvidesPackage{papercdcase}[\filedate v.\fileversion{} Paper CD Case Style (TD)]
\NeedsTeXFormat{LaTeX2e}

\RequirePackage{graphicx}
\RequirePackage{calc}

\makeatletter

%    \end{macrocode}
%
%    \subsection{User Interface Functions}
%
%    The actual text boxes that are typeset on the latch, on the
%    spine, on the back and on the pouch of the CD case are kept in
%    internal macros.
%    \begin{macrocode}
\newcommand{\@PCDC@Latch@Matter}{}
\newcommand{\@PCDC@Pouch@Matter}{}
\newcommand{\@PCDC@Back@Matter}{}
\newcommand{\@PCDC@Spine@Matter}{}

%    \end{macrocode}
%
%    Four functions which basically put their argument into the
%    appropriate internal box definition.
%    \begin{macro}{\setcdlatchmatter}
%    Interface function for the latch matter:
%    \begin{macrocode}
\newcommand{\setcdlatchmatter}[1]{\renewcommand{\@PCDC@Latch@Matter}{#1}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\setcdpouchmatter}
%    Interface function for the pouch matter:
%    \begin{macrocode}
\newcommand{\setcdpouchmatter}[1]{\renewcommand{\@PCDC@Pouch@Matter}{#1}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\setcdpouchmatter}
%    Interface function for the back matter:
%    \begin{macrocode}
\newcommand{\setcdbackmatter}[1]{\renewcommand{\@PCDC@Back@Matter}{#1}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\setcdpouchmatter}
%    Interface function for the spine matter:
%    \begin{macrocode}
\newcommand{\setcdspinematter}[1]{\renewcommand{\@PCDC@Spine@Matter}{#1}}

%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\papercdcase}
%    The macro |\papercdcase| is the main command provided by the
%    package.  The macro typesets the actual folding scheme, complete
%    with all specified text boxes.  It is defined so that if its
%    starred version |\papercdcase*| is invoked, the folding scheme is
%    adjusted for A4 paper; otherwise, letter paper is designed for.
%    (The adjustments of the folding scheme are done by resetting the
%    relevant counters, |@PCDC@Design@Height| and |@PCDC@Pouch@Height|.)
%    \begin{macrocode}
% Main user macro; actually typesets the paper CD case.
\DeclareRobustCommand{\papercdcase}{%
\@ifstar%
{\setcounter{@PCDC@Design@Height}{297}\setcounter{@PCDC@Pouch@Height}{75}\@PCDC@Typeset@Scheme}%
{\setcounter{@PCDC@Design@Height}{279}\setcounter{@PCDC@Pouch@Height}{64}\@PCDC@Typeset@Scheme}}

%    \end{macrocode}
%    \end{macro}
%
%    \subsection{Counters}
%
%    Throughout the package, counters are used to compute the correct
%    locations of the various folding marks, boxes and so on.  Some of
%    these counters control the exact layout of the folding scheme,
%    while all the others depend on the values of the control
%    counters.  Consequently, all counters can be defined right away,
%    but most of the counters cannot sensibly be set at this point.
%
%    For readability and conciseness of the code, several
%    abbreviations are used with the counter names:
%    \begin{itemize}
%    \item The letters \verb~A~ through \verb~M~ are used to designate
%      the fold numbers 1 through 13.
%    \item \verb~Btm~ is used for \verb~Bottom~.
%    \item \verb~Lft~ and \verb~Rgt~ are used for \verb~Left~ and
%      \verb~Right~, respectively.
%    \item \verb~Upr~ and \verb~Lwr~ are used for \verb~Upper~ and
%      \verb~Lower~, respectively.
%    \end{itemize}
%    These abbreviations make the code easier to read, IMHO, because
%    they allow many sequences of commands to be aligned horizontally,
%    making structures much easier to recognize.
%
%    \subsubsection{Control Counters}
%
%    There are eight counters that control the design of the folding
%    scheme.  These eight counters are defined first.
%    \begin{macrocode}
%% Control counters.
%% Overall height of the folding scheme.
\newcounter{@PCDC@Design@Height}
%% Height of the CD pouch.
\newcounter{@PCDC@Pouch@Height}
%% Height (and width) of the folded paper CD case.
\newcounter{@PCDC@Back@Height}
%% Height of the CD case spine.
\newcounter{@PCDC@Spine@Height}
%% Margin between the text boxes and the edge of the CD case.
\newcounter{@PCDC@Text@Margin}
%% Length of regular fold marks.
\newcounter{@PCDC@Fold@Length}
%% Length of short fold marks.
\newcounter{@PCDC@Fold@Short@Length}
%% Space between fold marks and their labels.
\newcounter{@PCDC@Label@Sep}

%    \end{macrocode}
%
%    We also set these counters to some sensible values right away.
%    \begin{macrocode}
\setcounter{@PCDC@Design@Height}{279}
\setcounter{@PCDC@Pouch@Height}{64}
\setcounter{@PCDC@Back@Height}{125}
\setcounter{@PCDC@Spine@Height}{8}
\setcounter{@PCDC@Text@Margin}{5}
\setcounter{@PCDC@Fold@Length}{25}
\setcounter{@PCDC@Fold@Short@Length}{20}
\setcounter{@PCDC@Label@Sep}{1}

%    \end{macrocode}
%
%    \subsubsection{General Coordinate Counters}
%
%    Some of the other counters are used to hold coordinates that are
%    shared by many fold marks so that is seems worth while to keep
%    them in their own counters.
%    \begin{macrocode}
%% Common counters.
\newcounter{@PCDC@Design@width}
\newcounter{@PCDC@Top@Lft@Fold}
\newcounter{@PCDC@Top@Rgt@Fold}
\newcounter{@PCDC@Bot@Lft@Fold}
\newcounter{@PCDC@Bot@Rgt@Fold}
\newcounter{@PCDC@Lwr@Top@Fold}
\newcounter{@PCDC@Upr@Top@Fold}
\newcounter{@PCDC@Bot@Fold}
\newcounter{@PCDC@Text@width}
\newcounter{@PCDC@Fold@Dash@Number}

%    \end{macrocode}
%
%    \subsubsection{Folding Mark Coordinate Counters}
%
%    In this section, we define the counters for the actual
%    coordinates of the folding marks.
%    \begin{macrocode}
%% Counters with the actual coordinates of the folding marks.
\newcounter{@PCDC@Fold@A@Lft@X}
\newcounter{@PCDC@Fold@A@Lft@Y}
\newcounter{@PCDC@Fold@A@Rgt@X}
\newcounter{@PCDC@Fold@A@Rgt@Y}
\newcounter{@PCDC@Fold@B@Lft@X}
\newcounter{@PCDC@Fold@B@Lft@Y}
\newcounter{@PCDC@Fold@B@Rgt@X}
\newcounter{@PCDC@Fold@B@Rgt@Y}
\newcounter{@PCDC@Fold@C@Top@X}
\newcounter{@PCDC@Fold@C@Top@Y}
\newcounter{@PCDC@Fold@C@Bot@X}
\newcounter{@PCDC@Fold@C@Bot@Y}
\newcounter{@PCDC@Fold@D@Top@X}
\newcounter{@PCDC@Fold@D@Top@Y}
\newcounter{@PCDC@Fold@D@Bot@X}
\newcounter{@PCDC@Fold@D@Bot@Y}
\newcounter{@PCDC@Fold@E@Lft@X}
\newcounter{@PCDC@Fold@E@Lft@Y}
\newcounter{@PCDC@Fold@E@Rgt@X}
\newcounter{@PCDC@Fold@E@Rgt@Y}
\newcounter{@PCDC@Fold@F@Lft@X}
\newcounter{@PCDC@Fold@F@Lft@Y}
\newcounter{@PCDC@Fold@F@Rgt@X}
\newcounter{@PCDC@Fold@F@Rgt@Y}
\newcounter{@PCDC@Fold@G@Lft@X}
\newcounter{@PCDC@Fold@G@Lft@Y}
\newcounter{@PCDC@Fold@G@Rgt@X}
\newcounter{@PCDC@Fold@G@Rgt@Y}
\newcounter{@PCDC@Fold@H@X}
\newcounter{@PCDC@Fold@H@Y}
\newcounter{@PCDC@Fold@I@X}
\newcounter{@PCDC@Fold@I@Y}
\newcounter{@PCDC@Fold@J@X}
\newcounter{@PCDC@Fold@J@Y}
\newcounter{@PCDC@Fold@K@X}
\newcounter{@PCDC@Fold@K@Y}
\newcounter{@PCDC@Fold@L@X}
\newcounter{@PCDC@Fold@L@Y}
\newcounter{@PCDC@Fold@M@X}
\newcounter{@PCDC@Fold@M@Y}

%    \end{macrocode}
%
%    \subsubsection{Folding Mark Label Coordinate Counters}
%
%    We now define the counters for the actual coordinates of the
%    folding mark labels.
%    \begin{macrocode}
%% Counters with the actual coordinates of the text boxes.
\newcounter{@PCDC@Fold@A@Lft@Label@X}
\newcounter{@PCDC@Fold@A@Lft@Label@Y}
\newcounter{@PCDC@Fold@A@Rgt@Label@X}
\newcounter{@PCDC@Fold@A@Rgt@Label@Y}
\newcounter{@PCDC@Fold@B@Lft@Label@X}
\newcounter{@PCDC@Fold@B@Lft@Label@Y}
\newcounter{@PCDC@Fold@B@Rgt@Label@X}
\newcounter{@PCDC@Fold@B@Rgt@Label@Y}
\newcounter{@PCDC@Fold@C@Top@Label@X}
\newcounter{@PCDC@Fold@C@Top@Label@Y}
\newcounter{@PCDC@Fold@C@Bot@Label@X}
\newcounter{@PCDC@Fold@C@Bot@Label@Y}
\newcounter{@PCDC@Fold@D@Top@Label@X}
\newcounter{@PCDC@Fold@D@Top@Label@Y}
\newcounter{@PCDC@Fold@D@Bot@Label@X}
\newcounter{@PCDC@Fold@D@Bot@Label@Y}
\newcounter{@PCDC@Fold@E@Lft@Label@X}
\newcounter{@PCDC@Fold@E@Lft@Label@Y}
\newcounter{@PCDC@Fold@E@Rgt@Label@X}
\newcounter{@PCDC@Fold@E@Rgt@Label@Y}
\newcounter{@PCDC@Fold@F@Lft@Label@X}
\newcounter{@PCDC@Fold@F@Lft@Label@Y}
\newcounter{@PCDC@Fold@F@Rgt@Label@X}
\newcounter{@PCDC@Fold@F@Rgt@Label@Y}
\newcounter{@PCDC@Fold@G@Lft@Label@X}
\newcounter{@PCDC@Fold@G@Lft@Label@Y}
\newcounter{@PCDC@Fold@G@Rgt@Label@X}
\newcounter{@PCDC@Fold@G@Rgt@Label@Y}
\newcounter{@PCDC@Fold@H@Label@X}
\newcounter{@PCDC@Fold@H@Label@Y}
\newcounter{@PCDC@Fold@I@Label@X}
\newcounter{@PCDC@Fold@I@Label@Y}
\newcounter{@PCDC@Fold@J@Label@X}
\newcounter{@PCDC@Fold@J@Label@Y}
\newcounter{@PCDC@Fold@K@Label@X}
\newcounter{@PCDC@Fold@K@Label@Y}
\newcounter{@PCDC@Fold@L@Label@X}
\newcounter{@PCDC@Fold@L@Label@Y}
\newcounter{@PCDC@Fold@M@Label@X}
\newcounter{@PCDC@Fold@M@Label@Y}

%    \end{macrocode}
%
%    \subsubsection{Text Box Coordinate Counters}
%
%    As the last counters to be defined, here come the coordinate
%    counters for the text boxes provided to the user.
%    \begin{macrocode}
%% Counters with the actual coordinates of the text boxes.
\newcounter{@PCDC@Pouch@Matter@X}
\newcounter{@PCDC@Pouch@Matter@Y}
\newcounter{@PCDC@Back@Matter@X}
\newcounter{@PCDC@Back@Matter@Y}
\newcounter{@PCDC@Spine@Matter@X}
\newcounter{@PCDC@Spine@Matter@Y}
\newcounter{@PCDC@Latch@Matter@X}
\newcounter{@PCDC@Latch@Matter@Y}

%    \end{macrocode}
%
%    \subsection{Folding Scheme Implementation}
%
%    We now turn to the implementation of the actual folding scheme
%    typesetting macro.  The macro takes an optional parameter that
%    allows for scaling.  The parameter is supposed to contain the
%    diameter in millimeters of the CD that the CD case is to be
%    printed for.  Therefore, the default value is set to 120, which
%    is the diameter in millimeters of a normal CD.  Another common CD
%    size is 80 millimeters, which is a maxi CD.
%
%    The macro can broadly be broken into three parts:
%    \begin{enumerate}
%    \item The entire scheme is scaled according to the optional CD
%      size parameter.
%    \item The actual coordinates are computed and stored in the
%      proper counters.
%    \item The folding scheme is typeset and output is generated.
%    \end{enumerate}
%    \begin{macrocode}
%% The actual output function.
\newcommand{\@PCDC@Typeset@Scheme}[1][120]{%
%% Scale the output.
\setlength{\unitlength}{1mm}
\multiply\unitlength by #1
\divide\unitlength by 120
%%
%% Compute the actual coordinates.
%% Common coordinates.
\setcounter{@PCDC@Design@width}{\value{@PCDC@Back@Height}+2*\value{@PCDC@Fold@Length}}
\setcounter{@PCDC@Top@Lft@Fold}{\value{@PCDC@Fold@Length}+1}
\setcounter{@PCDC@Top@Rgt@Fold}{\value{@PCDC@Fold@Length}+\value{@PCDC@Back@Height}}
\setcounter{@PCDC@Bot@Lft@Fold}{\value{@PCDC@Fold@Length}+1}
\setcounter{@PCDC@Bot@Rgt@Fold}{\value{@PCDC@Fold@Length}+\value{@PCDC@Back@Height}}
\setcounter{@PCDC@Lwr@Top@Fold}{2*\value{@PCDC@Pouch@Height}+2*\value{@PCDC@Back@Height}-\value{@PCDC@Design@Height}}
\setcounter{@PCDC@Upr@Top@Fold}{\value{@PCDC@Lwr@Top@Fold}+2*\value{@PCDC@Spine@Height}}
\setcounter{@PCDC@Bot@Fold}{2*\value{@PCDC@Pouch@Height}}
\setcounter{@PCDC@Text@width}{\value{@PCDC@Back@Height}-2*\value{@PCDC@Text@Margin}}
\setcounter{@PCDC@Fold@Dash@Number}{\value{@PCDC@Fold@Length}/2}
%%
%% Fold mark coordinates.
\setcounter{@PCDC@Fold@A@Lft@X}{\value{@PCDC@Top@Lft@Fold}}
\setcounter{@PCDC@Fold@A@Lft@Y}{\value{@PCDC@Design@Height}}
\setcounter{@PCDC@Fold@A@Rgt@X}{\value{@PCDC@Top@Rgt@Fold}}
\setcounter{@PCDC@Fold@A@Rgt@Y}{\value{@PCDC@Design@Height}}
\setcounter{@PCDC@Fold@B@Lft@X}{\value{@PCDC@Bot@Lft@Fold}}
\setcounter{@PCDC@Fold@B@Lft@Y}{0}
\setcounter{@PCDC@Fold@B@Rgt@X}{\value{@PCDC@Bot@Rgt@Fold}}
\setcounter{@PCDC@Fold@B@Rgt@Y}{0}
\setcounter{@PCDC@Fold@C@Top@X}{\value{@PCDC@Top@Rgt@Fold}}
\setcounter{@PCDC@Fold@C@Top@Y}{\value{@PCDC@Design@Height}}
\setcounter{@PCDC@Fold@C@Bot@X}{\value{@PCDC@Bot@Rgt@Fold}}
\setcounter{@PCDC@Fold@C@Bot@Y}{0}
\setcounter{@PCDC@Fold@D@Top@X}{\value{@PCDC@Top@Lft@Fold}}
\setcounter{@PCDC@Fold@D@Top@Y}{\value{@PCDC@Design@Height}}
\setcounter{@PCDC@Fold@D@Bot@X}{\value{@PCDC@Bot@Lft@Fold}}
\setcounter{@PCDC@Fold@D@Bot@Y}{0}
\setcounter{@PCDC@Fold@E@Lft@X}{\value{@PCDC@Bot@Lft@Fold}}
\setcounter{@PCDC@Fold@E@Lft@Y}{\value{@PCDC@Bot@Fold}}
\setcounter{@PCDC@Fold@E@Rgt@X}{\value{@PCDC@Bot@Rgt@Fold}}
\setcounter{@PCDC@Fold@E@Rgt@Y}{\value{@PCDC@Bot@Fold}}
\setcounter{@PCDC@Fold@F@Lft@X}{\value{@PCDC@Bot@Lft@Fold}}
\setcounter{@PCDC@Fold@F@Lft@Y}{\value{@PCDC@Lwr@Top@Fold}}
\setcounter{@PCDC@Fold@F@Rgt@X}{\value{@PCDC@Bot@Rgt@Fold}}
\setcounter{@PCDC@Fold@F@Rgt@Y}{\value{@PCDC@Lwr@Top@Fold}}
\setcounter{@PCDC@Fold@G@Lft@X}{\value{@PCDC@Bot@Lft@Fold}}
\setcounter{@PCDC@Fold@G@Lft@Y}{\value{@PCDC@Upr@Top@Fold}}
\setcounter{@PCDC@Fold@G@Rgt@X}{\value{@PCDC@Bot@Rgt@Fold}}
\setcounter{@PCDC@Fold@G@Rgt@Y}{\value{@PCDC@Upr@Top@Fold}}
\setcounter{@PCDC@Fold@H@X}{\value{@PCDC@Bot@Rgt@Fold}}
\setcounter{@PCDC@Fold@H@Y}{\value{@PCDC@Pouch@Height}}
\setcounter{@PCDC@Fold@I@X}{\value{@PCDC@Bot@Rgt@Fold}}
\setcounter{@PCDC@Fold@I@Y}{\value{@PCDC@Pouch@Height}}
\setcounter{@PCDC@Fold@J@X}{\value{@PCDC@Bot@Lft@Fold}}
\setcounter{@PCDC@Fold@J@Y}{\value{@PCDC@Pouch@Height}}
\setcounter{@PCDC@Fold@K@X}{\value{@PCDC@Bot@Lft@Fold}}
\setcounter{@PCDC@Fold@K@Y}{\value{@PCDC@Pouch@Height}}
\setcounter{@PCDC@Fold@L@X}{\value{@PCDC@Top@Rgt@Fold}}
\setcounter{@PCDC@Fold@L@Y}{\value{@PCDC@Design@Height}-\value{@PCDC@Fold@Short@Length}}
\setcounter{@PCDC@Fold@M@X}{\value{@PCDC@Top@Lft@Fold}}
\setcounter{@PCDC@Fold@M@Y}{\value{@PCDC@Design@Height}-\value{@PCDC@Fold@Short@Length}}
%%
%% Fold mark label coordinates.
\setcounter{@PCDC@Fold@A@Lft@Label@X}{\value{@PCDC@Fold@A@Lft@X}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@A@Lft@Label@Y}{\value{@PCDC@Fold@A@Lft@Y}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@A@Rgt@Label@X}{\value{@PCDC@Fold@A@Rgt@X}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@A@Rgt@Label@Y}{\value{@PCDC@Fold@A@Rgt@Y}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@B@Lft@Label@X}{\value{@PCDC@Fold@B@Lft@X}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@B@Lft@Label@Y}{\value{@PCDC@Fold@B@Lft@Y}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@B@Rgt@Label@X}{\value{@PCDC@Fold@B@Rgt@X}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@B@Rgt@Label@Y}{\value{@PCDC@Fold@B@Rgt@Y}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@C@Top@Label@X}{\value{@PCDC@Fold@C@Top@X}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@C@Top@Label@Y}{\value{@PCDC@Fold@C@Top@Y}-\value{@PCDC@Fold@Length}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@C@Bot@Label@X}{\value{@PCDC@Fold@C@Bot@X}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@C@Bot@Label@Y}{\value{@PCDC@Fold@C@Bot@Y}+\value{@PCDC@Fold@Length}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@D@Top@Label@X}{\value{@PCDC@Fold@D@Top@X}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@D@Top@Label@Y}{\value{@PCDC@Fold@D@Top@Y}-\value{@PCDC@Fold@Length}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@D@Bot@Label@X}{\value{@PCDC@Fold@D@Bot@X}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@D@Bot@Label@Y}{\value{@PCDC@Fold@D@Bot@Y}+\value{@PCDC@Fold@Length}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@E@Lft@Label@X}{\value{@PCDC@Fold@E@Lft@X}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@E@Lft@Label@Y}{\value{@PCDC@Fold@E@Lft@Y}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@E@Rgt@Label@X}{\value{@PCDC@Fold@E@Rgt@X}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@E@Rgt@Label@Y}{\value{@PCDC@Fold@E@Rgt@Y}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@F@Lft@Label@X}{\value{@PCDC@Fold@F@Lft@X}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@F@Lft@Label@Y}{\value{@PCDC@Fold@F@Lft@Y}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@F@Rgt@Label@X}{\value{@PCDC@Fold@F@Rgt@X}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@F@Rgt@Label@Y}{\value{@PCDC@Fold@F@Rgt@Y}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@G@Lft@Label@X}{\value{@PCDC@Fold@G@Lft@X}-\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@G@Lft@Label@Y}{\value{@PCDC@Fold@G@Lft@Y}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@G@Rgt@Label@X}{\value{@PCDC@Fold@G@Rgt@X}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@G@Rgt@Label@Y}{\value{@PCDC@Fold@G@Rgt@Y}+\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@H@Label@X}{\value{@PCDC@Fold@H@X}+5*\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@H@Label@Y}{\value{@PCDC@Fold@H@Y}+4*\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@I@Label@X}{\value{@PCDC@Fold@I@X}+5*\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@I@Label@Y}{\value{@PCDC@Fold@I@Y}-6*\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@J@Label@X}{\value{@PCDC@Fold@J@X}-5*\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@J@Label@Y}{\value{@PCDC@Fold@J@Y}+4*\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@K@Label@X}{\value{@PCDC@Fold@K@X}-5*\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@K@Label@Y}{\value{@PCDC@Fold@K@Y}-6*\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@L@Label@X}{\value{@PCDC@Fold@L@X}+5*\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@L@Label@Y}{\value{@PCDC@Fold@L@Y}+4*\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@M@Label@X}{\value{@PCDC@Fold@M@X}-5*\value{@PCDC@Label@Sep}}
\setcounter{@PCDC@Fold@M@Label@Y}{\value{@PCDC@Fold@M@Y}+4*\value{@PCDC@Label@Sep}}
%%
%% Text box coordinates.
\setcounter{@PCDC@Pouch@Matter@X}{\value{@PCDC@Fold@Length}+\value{@PCDC@Text@Margin}}
\setcounter{@PCDC@Pouch@Matter@Y}{\value{@PCDC@Text@Margin}}
\setcounter{@PCDC@Back@Matter@X}{\value{@PCDC@Fold@Length}+\value{@PCDC@Text@Margin}}
\setcounter{@PCDC@Back@Matter@Y}{\value{@PCDC@Pouch@Height}+\value{@PCDC@Back@Height}-\value{@PCDC@Text@Margin}}
\setcounter{@PCDC@Spine@Matter@X}{\value{@PCDC@Fold@Length}+\value{@PCDC@Back@Height}/2}
\setcounter{@PCDC@Spine@Matter@Y}{\value{@PCDC@Back@Matter@Y}+\value{@PCDC@Spine@Height}/2+\value{@PCDC@Text@Margin}}
\setcounter{@PCDC@Latch@Matter@X}{\value{@PCDC@Fold@Length}+\value{@PCDC@Text@Margin}}
\setcounter{@PCDC@Latch@Matter@Y}{\value{@PCDC@Spine@Matter@Y}+\value{@PCDC@Spine@Height}/2+\value{@PCDC@Text@Margin}}
%%
%% Typeset the folding scheme
\begin{picture}(\value{@PCDC@Design@width}, \value{@PCDC@Design@Height})
%% Fold mark 1, left
\put(\value{@PCDC@Fold@A@Lft@X}, \value{@PCDC@Fold@A@Lft@Y}){\line(-1, 0){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@A@Lft@Label@X}, \value{@PCDC@Fold@A@Lft@Label@Y}){\makebox(0, 0)[br]{\rotatebox{180}{1}}}
%%
%% Fold mark 1, right
\put(\value{@PCDC@Fold@A@Rgt@X}, \value{@PCDC@Fold@A@Rgt@Y}){\line(1, 0){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@A@Rgt@Label@X}, \value{@PCDC@Fold@A@Rgt@Label@Y}){\makebox(0, 0)[bl]{\rotatebox{180}{1}}}
%%
%% Fold mark 2, left
\put(\value{@PCDC@Fold@B@Lft@X}, \value{@PCDC@Fold@B@Lft@Y}){\line(-1, 0){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@B@Lft@Label@X}, \value{@PCDC@Fold@B@Lft@Label@Y}){\makebox(0, 0)[tr]{2}}
%%
%% Fold mark 2, right
\put(\value{@PCDC@Fold@B@Rgt@X}, \value{@PCDC@Fold@B@Rgt@Y}){\line(1, 0){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@B@Rgt@Label@X}, \value{@PCDC@Fold@B@Rgt@Label@Y}){\makebox(0, 0)[tl]{2}}
%%
%% Fold mark 3, top
\put(\value{@PCDC@Fold@C@Top@X}, \value{@PCDC@Fold@C@Top@Y}){\line(0, -1){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@C@Top@Label@X}, \value{@PCDC@Fold@C@Top@Label@Y}){\makebox(0, 0)[bl]{\rotatebox{90}{3}}}
%%
%% Fold mark 3, bottom
\put(\value{@PCDC@Fold@C@Bot@X}, \value{@PCDC@Fold@C@Bot@Y}){\line(0, 1){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@C@Bot@Label@X}, \value{@PCDC@Fold@C@Bot@Label@Y}){\makebox(0, 0)[tl]{\rotatebox{90}{3}}}
%%
%% Fold mark 4, top
\put(\value{@PCDC@Fold@D@Top@X}, \value{@PCDC@Fold@D@Top@Y}){\line(0, -1){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@D@Top@Label@X}, \value{@PCDC@Fold@D@Top@Label@Y}){\makebox(0, 0)[br]{\rotatebox{270}{4}}}
%%
%% Fold mark 4, bottom
\put(\value{@PCDC@Fold@D@Bot@X}, \value{@PCDC@Fold@D@Bot@Y}){\line(0, 1){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@D@Bot@Label@X}, \value{@PCDC@Fold@D@Bot@Label@Y}){\makebox(0, 0)[tr]{\rotatebox{270}{4}}}
%%
%% Fold mark 5, left
\multiput(\value{@PCDC@Fold@E@Lft@X}, \value{@PCDC@Fold@E@Lft@Y})(-2, 0){\value{@PCDC@Fold@Dash@Number}}{\line(-1, 0){1}}
\put(\value{@PCDC@Fold@E@Lft@Label@X}, \value{@PCDC@Fold@E@Lft@Label@Y}){\makebox(0, 0)[tr]{5 (bottom)}}
%%
%% Fold mark 5, right
\multiput(\value{@PCDC@Fold@E@Rgt@X}, \value{@PCDC@Fold@E@Rgt@Y})(2, 0){\value{@PCDC@Fold@Dash@Number}}{\line(1, 0){1}}
\put(\value{@PCDC@Fold@E@Rgt@Label@X}, \value{@PCDC@Fold@E@Rgt@Label@Y}){\makebox(0, 0)[tl]{5 (bottom)}}
%%
%% Fold mark 6, left
\multiput(\value{@PCDC@Fold@F@Lft@X}, \value{@PCDC@Fold@F@Lft@Y})(-2, 0){\value{@PCDC@Fold@Dash@Number}}{\line(-1, 0){1}}
\put(\value{@PCDC@Fold@F@Lft@Label@X}, \value{@PCDC@Fold@F@Lft@Label@Y}){\makebox(0, 0)[br]{\rotatebox{180}{6 (top)}}}
%%
%% Fold mark 6, right
\multiput(\value{@PCDC@Fold@F@Rgt@X}, \value{@PCDC@Fold@F@Rgt@Y})(2, 0){\value{@PCDC@Fold@Dash@Number}}{\line(1, 0){1}}
\put(\value{@PCDC@Fold@F@Rgt@Label@X}, \value{@PCDC@Fold@F@Rgt@Label@Y}){\makebox(0, 0)[bl]{\rotatebox{180}{6 (top)}}}
%%
%% Fold mark 7, left
\multiput(\value{@PCDC@Fold@G@Lft@X}, \value{@PCDC@Fold@G@Lft@Y})(-2, 0){\value{@PCDC@Fold@Dash@Number}}{\line(-1, 0){1}}
\put(\value{@PCDC@Fold@G@Lft@Label@X}, \value{@PCDC@Fold@G@Lft@Label@Y}){\makebox(0, 0)[br]{\rotatebox{180}{7 (top)}}}
%%
%% Fold mark 7, right
\multiput(\value{@PCDC@Fold@G@Rgt@X}, \value{@PCDC@Fold@G@Rgt@Y})(2, 0){\value{@PCDC@Fold@Dash@Number}}{\line(1, 0){1}}
\put(\value{@PCDC@Fold@G@Rgt@Label@X}, \value{@PCDC@Fold@G@Rgt@Label@Y}){\makebox(0, 0)[bl]{\rotatebox{180}{7 (top)}}}
%%
%% Fold mark 8
\put(\value{@PCDC@Fold@H@X}, \value{@PCDC@Fold@H@Y}){\line(1, 1){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@H@Label@X}, \value{@PCDC@Fold@H@Label@Y}){\makebox(0, 0)[tl]{\rotatebox{ 45}{8}}}
%%
%% Fold mark 9
\put(\value{@PCDC@Fold@I@X}, \value{@PCDC@Fold@I@Y}){\line(1, -1){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@I@Label@X}, \value{@PCDC@Fold@I@Label@Y}){\makebox(0, 0)[tr]{\rotatebox{315}{9}}}
%%
%% Fold mark 10
\put(\value{@PCDC@Fold@J@X}, \value{@PCDC@Fold@J@Y}){\line(-1, 1){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@J@Label@X}, \value{@PCDC@Fold@J@Label@Y}){\makebox(0, 0)[tr]{\rotatebox{315}{10}}}
%%
%% Fold mark 11
\put(\value{@PCDC@Fold@K@X}, \value{@PCDC@Fold@K@Y}){\line(-1, -1){\value{@PCDC@Fold@Length}}}
\put(\value{@PCDC@Fold@K@Label@X}, \value{@PCDC@Fold@K@Label@Y}){\makebox(0, 0)[tl]{\rotatebox{ 45}{11}}}
%%
%% Fold mark 12
\put(\value{@PCDC@Fold@L@X}, \value{@PCDC@Fold@L@Y}){\line(1, 1){\value{@PCDC@Fold@Short@Length}}}
\put(\value{@PCDC@Fold@L@Label@X}, \value{@PCDC@Fold@L@Label@Y}){\makebox(0, 0)[tl]{\rotatebox{ 45}{12}}}
%%
%% Fold mark 13
\put(\value{@PCDC@Fold@M@X}, \value{@PCDC@Fold@M@Y}){\line(-1, 1){\value{@PCDC@Fold@Short@Length}}}
\put(\value{@PCDC@Fold@M@Label@X}, \value{@PCDC@Fold@M@Label@Y}){\makebox(0, 0)[tr]{\rotatebox{315}{13}}}
%%
%% Latch matter
\put(\value{@PCDC@Latch@Matter@X}, \value{@PCDC@Latch@Matter@Y}){\makebox(0, 0)[bl]{\rotatebox{180}{\parbox{\value{@PCDC@Text@width}\unitlength}{\@PCDC@Latch@Matter}}}}
%%
%% Spine matter
\put(\value{@PCDC@Spine@Matter@X}, \value{@PCDC@Spine@Matter@Y}){\makebox(0, 0)[cc]{\@PCDC@Spine@Matter}}
%%
%% Back matter
\put(\value{@PCDC@Back@Matter@X}, \value{@PCDC@Back@Matter@Y}){\makebox(0, 0)[tl]{\parbox{\value{@PCDC@Text@width}\unitlength}{\@PCDC@Back@Matter}}}
%%
%% Pouch matter
\put(\value{@PCDC@Pouch@Matter@X}, \value{@PCDC@Pouch@Matter@Y}){\makebox(0, 0)[bl]{\rotatebox{180}{\parbox{\value{@PCDC@Text@width}\unitlength}{\@PCDC@Pouch@Matter}}}}
\end{picture}}

%    \end{macrocode}
%
%    \subsection{Clean Up}
%
%    And finally, we do some housekeeping.
%    \begin{macrocode}
\makeatother
%    \end{macrocode}
%
%    That's all.
%
%    \PrintChanges
%    \newpage
%    \PrintIndex
%
%    \Finale
%
\endinput
%
% Local Variables: 
% mode: latex
% TeX-master: t
% End: