-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcrop.dtx
2222 lines (2222 loc) · 64.9 KB
/
crop.dtx
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
% \iffalse
%% File: crop.dtx Copyright (C) 1998--2003 Melchior FRANZ
%
%<*preamble>
%
%
%
% on Unix/Linux just run "make" to get the style file and the documentation;
% else generate the driver crop.ins (if you don't already have it):
%
% $ latex crop.dtx
%
% Now generate the style file:
%
% $ tex crop.ins
%
% And finally to produce the documentation run LaTeX three times:
%
% $ latex crop.dtx
%
%
%
%
%
%
%$
%% ====================================================================
%% @LaTeX-package-file{
%% author = "Melchior FRANZ",
%% version = "1.9",
%% date = "20 May 2003",
%% filename = "crop.dtx",
%% address = "Melchior FRANZ
%% Rieder Hauptstrasse 52
%% A-5212 SCHNEEGATTERN
%% AUSTRIA",
%% URL = "https://github.com/drehscheibe/crop/",
%% email = "mfranz@aon.at",
%% codetable = "ISO/ASCII",
%% keywords = "cropmarks, frame, mirror, rotate, invert",
%% supported = "yes",
%% docstring = "This document describes the crop package, which
%% provides different forms of crop marks for
%% trimming paper stacks, for camera alignment and
%% for visualizing the page dimensions.
%% There are options for centering the page with
%% respect to some physical paper size, for
%% mounting pages on a physical sheet, for
%% reflecting and inverting the whole document or
%% printing it upside-down, and for suppressing
%% either text or graphics output.",
%% }
%% ====================================================================
%
% COPYRIGHT NOTICE:
% This package is free software that can be redistributed and/or modified
% under the terms of the LaTeX Project Public License as specified
% in the file macros/latex/base/lppl.txt on any CTAN archive server.
%
%</preamble>
%
%
%<*batchfile>
\begin{filecontents}{crop.ins}
\def\batchfile{crop.ins}
\input docstrip.tex
\askforoverwritefalse
\keepsilent
\generate{\file{crop.sty}{\from{crop.dtx}{package}}}
\endbatchfile
\end{filecontents}
%</batchfile>
%
%
%
%<*driver>
\def\fileversion{1.9}
\def\filedate{2003/05/20}
\documentclass{ltxdoc}
%
%
%
\ifx\makehyperref\CROPundefined
\newcommand*\texorpdfstring[2]{#1}
\else ^^A for "make hyper"
\usepackage{hyperref}
\hypersetup{
bookmarksopen,
colorlinks,
pdftitle={The crop package},
pdfauthor={Melchior FRANZ},
pdfkeywords={crop marks, mirror, invert, center, }
}
\usepackage[pdftex]{graphicx,color}
\fi
%
%
%
\newcommand*\option{\textsf}
\newcommand*\package{\texttt}
\newcommand*\program{\texttt}
\newcommand*\person{\textsc}
\newcommand*\itemfont{\sffamily}
\newcommand*\versal[1]{\textsc{\small#1}}
\newcommand*\CD{\versal{CD}}
\newcommand*\PS{\versal{PS}}
\newcommand*\DVI{\versal{DVI}}
\newcommand*\A{\versal{A4}}
\newcommand*\ISO{\versal{ISO-A4}}
\newcommand*\POSTSCRIPT{\textsc{PostScript}}
\newcommand*\CROP{\package{crop}}
% (the following two are for development versions ONLY! :-)
\newcommand*\FIXME{\marginpar{\Huge FIXME}\message{<FIXME>}\shop\stop}
\newcommand*\BS{\marginpar{\Huge BULLSHIT!}\show\stop}
%
%
\IfFileExists{crop.sty}
{\usepackage{crop}[2001/11/16]\let\CROPSTYfound\active}
{\GenericWarning{crop.dtx}
{Package file `crop.sty' not found (One picture will be missing.^^J
Generate `crop.sty' by (La)TeXing `crop.ins' and
process `crop.dtx' again.)^^J}}
%
%
\newenvironment{labeling}[1]
{\list{}{\settowidth{\labelwidth}{\textbf{#1}}
\leftmargin\labelwidth\advance\leftmargin\labelsep
\def\makelabel##1{\textbf{##1}\hfil}}}{\endlist}
%
%
\newenvironment{example}[1][.9\textwidth]
{\par\medskip\begin{tabular}{p{#1}l}}
{\end{tabular}\noindentafter\medbreak}
%
\makeatletter
\newcommand*\noindentafter{\@nobreaktrue\everypar{{\setbox\z@\lastbox}}}
\makeatother
%
% ^^A \RecordChanges
%
\begin{document}
\hfuzz.6pt
\setcounter{tocdepth}{2}
\DocInput{crop.dtx}
\end{document}
%</driver>
% \fi
%
%
%^^A \CheckSum{1063}
% \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 \~}
%
%
%
%
%
% \title{The \CROP\ package}
%
% \author{Melchior \textsc{FRANZ}}
% \date{May 20, 2003}
% \maketitle
%
%
% \changes{v1.0}{1998/05/20}{Initial version}%
%
% \changes{v1.1a}{1998/10/20}{`smash replaced; The crop marks
% were displaced, when the package was used together with the
% \texttt{amsmath} package (V1.2c), which redefines the \LaTeX\ smash
% command to have a different meaning. Although, this is definitely a
% bug in the \texttt{amsmath} design, we do no longer use
% `smash. This problem was kindly reported by \person{Pauli Viljamaa.}}%
%
% \changes{v1.2}{1998/12/07}{options `mirror' and `invert' added
% on suggestion by \person{Rolf Niepraschk.}}%
%
% \changes{v1.3}{1999/03/07}{center the logical paper `AtBeginDocument'
% instead of immediately; postamble changed slightly; `uppercase
% removed from info}
%
% \changes{v1.3a}{1999/05/15}{copyright complies with the LPPL; code unchanged}
%
% \changes{v1.4}{2000/02/02}{options `rotate' (suggested by \person{Rolf}) and
% `info/noinfo' (requested by \person{Anshuman Pandey}) added}
%
% \changes{v1.5}{2001/10/07}{*center options replaced by `center' and paper size
% options; options `dvips', `pdftex', `graphics', `nographics', `notext',
% `color', `horigin' and `vorigin' added; new info line with time stamp;
% some of the improvements were suggested by Cpt.~\person{Leszek Flis}}
%
% \changes{v1.6}{2001/11/16}{font option added; dvips/pdftex/vtex options
% changed; nographics enabled for pdftex; fixed a nasty bug that
% disallowed setting the physical paper size in the config file---thanks
% to \person{Stefan Becuwe} for reporting this.}
%
% \changes{v1.7}{2002/05/14}{odd/even/width/height options added; better
% geometry.sty compatibility; adopting `stockwidth/`stockheight}
%
% \changes{v1.8}{2003/05/10}{removed all the `changes entries except those
% in the preamble (crop is in CVS since v1.4, anyway); rewrote kernel;
% added color support; fixed a nasty bug; better driver detection}
%
% \changes{v1.9}{2003/05/20}{don't create command sequences by merely
% checking for them}
%
%
%
% \begin{abstract}
% This article describes the \CROP\ package^^A
%^^A
% \footnote{This file has version number \fileversion, last revised
% \filedate.\\I'd like to thank \person{Rolf Niepraschk} for his useful
% hints and suggestions, which influenced the package substantially.
% A big thank you also goes to \person{Walter Schmidt} for his extensive
% tests and his expertise on compatibility issues with different devices.}^^A
%^^A
% , which provides different forms of crop marks for trimming paper
% stacks, for camera alignment and for visualizing the page dimensions.
% There are options for centering the document page on the paper sheet,
% for mounting pages on a physical sheet, for reflecting and inverting
% the whole document or printing it upside-down, and for suppressing
% either text or graphics output.
%
% The package was originally developed for needs of the
% Austrian Red Cross\slash Federal Province of Vienna\slash
% Department of Radiation Protection.
% \end{abstract}
%
%
%
%
%
% {\setlength\parskip{0pt}\tableofcontents}
% \addtocontents{toc}{\protect\begin{multicols}{2}}
%
%
% \section{Introduction}
% It is convenient to print documents for smaller logical paper sizes
% on paper of the printer's standard physical paper size.
% On the one hand this keeps from changing paper stacks, on the other
% hand it allows printing close to the logical paper edge and even outside
% the logical page.
%
% For trimming a whole paper stack or lining up the single pages on
% printing plates for photographical duplication a set of corner marks
% is required.
%
%
%
%
%
% \section{How to use the package}
%
% \subsection{Conventional options}
% \label{sec:conventional}
%
% These options may only be used in the preamble and have to be stated
% as arguments to the |\usepackage| command (as in |\usepackage[mirror]{crop}|).
%
% \begin{labeling}{\indent\indent}
% \item[\itemfont a0, a1, a2, a3, a4, a5, a6,
% b0, b1, b2, b3, b4, b5, b6, letter, legal, executive]\hfill\break
% These options declare the printing paper dimensions. One of them should be
% specified if the \option{center} option or one of the options \option{dvips},
% \option{pdftex} and \option{vtex} is used. The size options do not
% define the logical document page size! See section~\ref{sec:custom-logical}
% for how to achieve this.
%
% \item[\itemfont width, height]---
% Instead of using one of the pre-defined paper formats as described
% above, you can also set the physical paper dimensions directly. You may omit
% the `|true|' specifier if you don't plan to scale the document.
% Example: |\usepackage[cam,width=10truecm,height=13truecm]{crop}|
%
% \item[\itemfont center]
% This option centers the logical document page on the physical printer paper
% and therefore requires that you declare the sheet size properly. Write,
% for example, |\usepackage[cam,a4,center]{crop}| to center a document of any size
% on \ISO\ sheets.
%
% \item[\itemfont landscape]---
% Use this option in addition to the \option{center} option if you want
% to center a document on \emph{landscape oriented} paper. It has nothing
% to do with \LaTeX's |landscape| document class option.
%
% \item[\itemfont dvips, pdftex, pdflatex, vtex, nodriver]---
% If you are working with \program{dvips}, \program{pdftex} or \program{vtex}
% you may want to pass the dimensions of the paper that you are planning to print on to
% the respective driver program. Especially viewer programs like \program{gs}
% or \program{gv} make use of this \emph{bounding box} information. Unfortunately,
% this can't be done in a generic way---there's no standard. These options select
% driver specific methods to set the paper size and to rotate and reflect a page.
%
% The \CROP\ package tries to find out by itself which driver to use.
% You find its choice mentioned in the log file. Additionally, you can
% \emph{suggest} (|[dvips]|) or \emph{enforce} (|[dvips!]|) one of the drivers. In the
% latter case you only have to add an exclamation point to the driver
% option. The difference is, that a suggestion may get overruled by the
% package. Assume you have asked for |[dvips]|, but run the document file
% through \program{pdflatex}. In this case \CROP\ will automatically use
% the \option{pdflatex} driver. You can also force \CROP\ not to use any
% of the drivers by requesting the \option{nodriver} option.
% \option{pdflatex} is a synonym for \option{pdftex}.
%
% \item[\itemfont mirror]
% This option reflects the whole document, provided that the selected output
% driver supports the \package{graphics} package's |\reflectbox| command.
% It doesn't have any effect on the \DVI\ file.
%
% \item[\itemfont rotate]
% Rotates the document by 180\(^\circ\) so that it appears upside-down.
% This may be useful to circumvent problems with printers, which do not print
% close enough to the lower paper edge due to their paper feed mechanism.
%
% \item[\itemfont invert]
% Lets the whole document be printed white onto black background,
% if the \package{color} package can be loaded and the document is output with a
% color aware device. All further color changing commands stated in the document
% are disabled. This option doesn't invert pictures, nor does it really swap
% text and paper color. Red text on green will still become white
% text on black. \option{invert} is stronger than \option{notext}.
%
% \item[\itemfont notext]---
% This option uses the \package{color} package to turn text to white
% color, after which all further color switching commands are disabled. This
% makes the text disappear from the printout, although it remains in the
% output file. See the description of the options \option{nographics} and
% \option{graphics} on page~\pageref{graphics} for an explanation.
% This option is ignored if option \option{invert} was also requested.
% \end{labeling}
%
%
%
%
%
%
%
% \subsection{Runtime options}
%
% These options may be used in the preamble like the `conventional' options
% (see section~\ref{sec:conventional}), but also as optional arguments to the
% |\crop| command everywhere in the document (as in |\crop[frame]|). Using
% this command without options implies |\crop[cam,noaxes]|.
%
% \begin{labeling}{\indent\indent}
% \item[\itemfont cam]
% This mode provides four different marks (see figure \ref{fig:marks}),
% one for each corner. They indicate the logical paper edges without
% touching them and can thus be printed on every page. These
% marks are mainly thought for camera alignment. The |\crop| command
% selects this mode if no other mode is requested.
%
% \item[\itemfont cross]
% This mode provides four 4~cm wide crosses (see figure
% \ref{fig:marks}), one at each corner, that touch the logical paper
% edge. That's why they should be printed on an extra page
% that will be used as a cover page while trimming the whole paper stack.
% (This is also the \emph{Red Cross} mode ;-)
%
% \item[\itemfont frame]
% This mode draws a frame around the logical page and is mainly thought
% for visualizing the document page dimensions.
%
% \item[\itemfont off]
% This `option' makes only sense in connection with the |\crop| command
% (i.\,e.~at runtime). It disables all markings and is selected by
% default if the package is input without requesting any of the marks.
%
% \item[\itemfont odd, even]---
% Use these options to let the crop marks be put on odd\slash even pages only.
% They automatically turn on \option{cam} marks if no other marks have been
% requested. Note that only the page number is considered. If you have
% two subsequent pages both with page number~1, and ask for the \option{odd}
% option, then both pages will have marks.
%
% \item[\itemfont axes, noaxes]---
% These options enable\slash disable the output of little marks that
% indicate the logical page's horizontal and vertical middle axis and
% may be selected in addition to one of the main modes. These marks
% might be needed for punching. Note that they are lost after
% trimming, since they lie outside the logical page.
% These marks are disabled by default.
%
% \item[\itemfont info, noinfo]---
% Print the page information consisting of filename, date, time, page number and page
% index on every sheet (see figure~\ref{fig:marks}). The page index starts
% with \#1 and is incremented with every page info line, hence being more
% reliable than page numbers, which are not unique and may be negative or
% contain letters. It can also be seen as a crop marks counter.
% Pages without crop marks aren't counted. This page information is enabled
% by default.
%
% \item[\itemfont font]
% The page info line uses |\normalfont| by default. If you are typesetting
% the document in non-latin glyphs or a decorative, but less legible font,
% you may want to request a specific font for that info. Just assign
% a font switching command like |\textsf| to the \option{font} option
% parameter, leaving the initial backslash away: |[font=textsf]|. This
% command may take one argument (like |\textsf{}|) or stand alone (like |\small|).
% You can, of course, define a more complex command first, and assign that
% one: |\newcommand*\infofont[1]{\textcolor{blue}{\textsf{\small#1}}}|
% |\crop[font=infofont]|
%
% \item[\itemfont color]
% You can set the color of crop marks, axes and info text with this
% option, if the \package{color} package could be loaded.
% The option takes only color names, as in |[color=red]|. See
% the \package{color} package documentation for how to define custom colors.
%
% \item[\itemfont mount1, mount2]---
% If more than one logical page is to be mounted on a physical sheet,
% you normally don't want marks to appear on the inner edges, where
% the pages touch each other.
% The \option{mount2} option prints only the outer marks.
% There's also a \option{mount1} option that is selected by default.
% These commands take a number as an optional argument serving
% as page offset. Type |mount2| or |mount2=0| for odd pages right
% and |mount2=1| for odd pages left. Since further modes are likely
% to be document, driver, and printer dependent, it is up to you to
% implement them yourself. (See a \option{mount4} suggestion on page
% \pageref{sec:mount4}.)
%
% \item[\itemfont horigin, vorigin]---
% The top and left margin are by default 1~inch wide. This can be changed
% using the dimensions |\oddsidemargin|, |\evensidemargin| and
% |\topmargin|. It's more convenient, though, to let the |geometry| package
% define all these and further parameters. The options \option{horigin} and \option{vorigin} only
% move the marks and don't change the page contents. \emph{Using these options is almost
% always a mistake, so use them only as a last resort!} Both options take a
% (mandatory) dimension. These dimensions describe the way from the reference point---the
% upper left corner of the text block---to the upper left corner of the page in
% a Cartesian coordinate system.
% As both |horigin| and |vorigin| are by default $-1$~inch, you would for
% example write |horigin=-.6in| to move the marks by 0.4~inch to the right.
%
% \item[\itemfont graphics, nographics]---
% \label{graphics}
% Color printouts are often more expensive than black-and-white ones, while
% their text quality is sometimes reduced. Therefore it may be desirable to create
% two versions of a document, one with only text and one with only
% graphics. Now you can feed the concerned pages to a color printer to
% print the \option{notext} version, and then to a mono laser printer with the
% \option{nographics} version. The \option{graphics} option turns graphics on again. You may
% want to mark up all colored pictures so that you can decide in the preamble,
% whether they shall be printed or not.
%
% \begin{example}[.86\textwidth]^^A
% |%\newcommand*\colorgraphic{} % print them;|\\
% |\newcommand*\colorgraphic{\crop[nographics]} % don't!|\\
% |...|\\
% |{\colorgraphic|\\
% |\includegraphics{...}|\\
% |\caption{...}|\\
% |}|
% \end{example}
% \end{labeling}
%
%
%
% {\makeatletter
% \ifx\CROPSTYfound\active
% \begin{figure}
% \begin{quote}
% \begin{center}
% \vspace{1.5cm}
% \leavevmode
% \hbox to9cm{\CROP@@ulc\hss\CROP@@info\hss\CROP@@urc}
% \vspace{.5cm}
% \caption{That's what you see on top of a 9~cm wide document page when
% \option{cam} mode is requested: the marks, jobname, date, time, page number and
% crop marks index.}
% \label{fig:marks}
% \end{center}
% \end{quote}
% \end{figure}
% \fi}
%
%
% \subsection{Loading}
%
% Since all marks lie outside the logical page, the horizontal and vertical
% offset should be set properly. Otherwise the marks are likely to be cut
% off by the \DVI\ driver or the printer.
% Provided that you have declared the size of your printing paper, you can
% use the |center| option to center every logical page on the respective sheet.
% There's, however, no harm in centering an \A~page on
% \A~paper, in which case both offsets are set to 0\,pt (unless, of course,
% you have set $\hbox{\verb"\mag"}\ne1000$).
%
% ^^A\begin{figure}
% \qquad\hbox{
% \begin{minipage}[t]{.45\textwidth}
%\begin{verbatim}
%\documentclass[a5paper]{article}
%\usepackage[cam,a4,center]{crop}
%\begin{document}
%...
%\end{document}
%\end{verbatim}
% \end{minipage}
%
% \begin{minipage}[t]{.45\textwidth}
%\begin{verbatim}
%\documentclass[a5paper]{article}
%\usepackage[a4,center]{crop}
%\begin{document}
%...
%\crop % or: \crop[cross], etc.
%...
%\end{document}
%\end{verbatim}
% \end{minipage}
% }\hspace*{-1cm}
% ^^A\caption{Loading the package. The marks can be activated in the preamble
% ^^A and anywhere in the document.}
% ^^A\label{fig:loading}
% ^^A\end{figure}
% \bigskip^^A\FIXME
%
% \noindent
% You get corner markings at every page shipped out after a \option{cam},
% \option{cross}, or \option{frame} mode request until you turn them off by
% typing \DescribeMacro{\crop}|\crop[off]|, or the actual grouping level
% ends.
% ^^ASee figure \ref{fig:loading}.
% Typing |\crop| without argument is equivalent to typing
% |\crop[cam,noaxes]|.
% Axis marks appear only together with one of the modes as listed above.
% If you only want one cover page for trimming, make sure that a page is
% actually output in the scope of |\crop|, for example:
%
% \begin{example}
% |\newpage|\\
% |{\crop[cross,axes]\mbox{}\newpage}|\\
% {}
% \end{example}
%
%
%
%
%
% \subsection{Color support}
%
% The \CROP\ package always tries to load the \package{color} package.
% You can change the color of the physical page as usual by using the
% |\pagecolor| command in the preamble. But after that, within the |document|
% environment, |\pagecolor| is redefined to only color the logical
% page. The color of crop marks, axes marks and page info can independently
% be set via the \option{color} option. The options \option{invert} and
% \option{notext} override any color settings.
%
%
%
%
%
%
% \subsection{Custom document page size}
% \label{sec:custom-logical}
%
% The \CROP\ package respects any page layout that you specify by means of
% \LaTeX\ dimensions. The following example uses the |geometry| package,
% which I strongly recommend. Let's assume you want to print a
% \CD~booklet ($4\,^{23}\!/_{32} \times 4\,^3\!/_4$~inch) on \ISO\ paper:
%
% \begin{example}
% |\documentclass{article}|\\
% |\usepackage[dvips=false,pdftex=false,vtex=false]{geometry}|
% \end{example}
%
% \indent
% \begin{example}
% |\geometry{|\\
% | paperwidth=4.71875in,|\\
% | paperheight=4.75in,|\\
% | margin=2em,|\\
% | bottom=1.5em,|\\
% | nohead|\\
% |}|
% \end{example}
%
% \indent
% \begin{example}
% |\usepackage[cam,a4,center,dvips]{crop}|\\
% \end{example}
%
% \indent
% \begin{example}
% |\begin{document}|\\
% |...|\\
% |\end{document}|
% \end{example}
%
% Note that the \CROP\ package should always be requested after setting
% up the `geometry'. See the \package{geometry} documentation for details.
% Always disable all of \package{geometry}'s driver options. While this isn't
% necessary in every case, it doesn't hurt and it makes your document more portable.
% You never know how the local |geometry.cfg| file on other workstations looks
% like!
%
%
%
%
%
% \subsection{Custom printing paper sheet size}
%
% If you want to use one of the \option{center}, \option{dvips}, \option{pdftex} or \option{vtex}
% options together with non-standard printing paper, you can set it
% via the \option{width} and \option{height} option, or simply add
% the respective paper definition to your |crop.cfg| file (see \ref{sec:config}).
% Let's for example define a new \option{weird} paper format, whereby the first dimension
% shall describe the paper width. Don't forget to request |true| dimensions,
% otherwise you will get really weird results with scaled documents.
%
% \begin{example}
% |\DeclareOption{weird}{\CROP@size{12truecm}{34truecm}}|
% \end{example}
%
% Now you can use your new printing paper format like the pre-defined ones.
%
% \begin{example}
% |\usepackage[frame,weird,center]{crop}|\\
% \end{example}
%
% If you don't need that format regularly or don't want to depend on a
% |crop.cfg| file, then you might prefer to declare the dimensions in the document:
%
% \begin{example}
% |\usepackage[frame,width=12truecm,height=34truecm,center]{crop}|\hspace*{-3cm}\\
% \end{example}
% \null
%
%
%
%
%
% \subsection{Defining your own marks}
% \label{sec:cropdef}
%
% If you need a \option{funny} mode, you can easily define it with
% only a couple of macros. The \DescribeMacro{\cropdef}|\cropdef| command
% defines the mode switch.
% It takes as arguments: the name of a macro providing the page info
% (optional; enclosed in brackets), four macro names to be assigned to
% the upper left, the upper right, the lower left, and the lower right
% corner, each representing a |picture| with zero width and height, or
% |\relax|, and finally the mode name. The optional brackets may also
% be empty, if no page info is wanted, or contain the info code instead of
% a macro name.
%
% \begin{example}
% |\newcommand*\funnymarkA{% % a little x|\\
% | \begin{picture}(0,0)|\\
% | \thinlines\unitlength1pt|\\
% | \put(-5,-5){\line(1,1){10}}|\\
% | \put(-5,5){\line(1,-1){10}}|\\
% | \end{picture}}|
% \end{example}
%
% \indent
% \begin{example}
% |\newcommand*\funnymarkB{% % a bullet|\\
% | \begin{picture}(0,0)|\\
% | \unitlength1pt|\\
% | \put(0,0){\circle*{5}}|\\
% | \end{picture}}|\\
% \end{example}
%
% \indent
% \begin{example}[.91\textwidth]
% |\newcommand*\funnyinfo{funny page info}|\\
% |\cropdef[\funnyinfo]\relax\funnymarkA\relax\funnymarkB{funny}|
% \end{example}
%
%
% Now you can select your new mode by typing |\crop[funny]|.
%
% Each of the axis marks is a |picture| that you can easily replace
% by some custom definition. There's no setup command like |\cropdef|, though.
% The kernel provides two `hooks' that can be used to add local
% extensions. These are macros that default to |\relax|. The first, |\CROP@user@a|,
% is executed at every page, no matter if marks are shown or not, while the
% second, |\CROP@user@b| is only executed at pages that contain crop marks.
% Local definitions and modifications are ideally put into a local configuration
% file:
%
%
% \subsection{The configuration file}
% \label{sec:config}
%
% If you want to change the predefined settings or add new features,
% then create a file named `|crop.cfg|' and put it in a directory, where \TeX\
% can find it. This configuration file will then be loaded
% at the end of the |crop.sty| file, so you can redefine
% any settings or commands therein, select package options and even
% introduce new ones. But if you intend to give
% your documents to others, don't forget to give them the
% required configuration files, too! That's how such a file
% could look like:
%
% \begin{example}
% |% define a new printing paper size|\\
% |\DeclareOption{special}{\CROP@size{22truecm}{37truecm}}|
% \end{example}
%
% \indent
% \begin{example}
% |% make the internal time string (used in the page|\\
% |% information) accessible in the whole document|\\
% |\let\Time\CROP@time|
% \end{example}
%
% \indent
% \begin{example}
% |% let's use a different font for the predefined page|\\
% |% information (we could also have written|\\
% |% \newcommand*\CROP@font[1]{\textsf{#1}})|\\
% |\crop[font=textsf]|\\
% |\endinput|\\
% {}
% \end{example}
%
%
%
% \section{How the package works}
%
% \subsection{The kernel mechanism}
%
% \TeX\ outputs a page via the |\shipout| command. The \CROP\ package
% redefines |\shipout| to insert the requested marks before it outputs
% the page contents. It is carefully designed to coexist peacefully with
% other packages, which use the same method (like the \package{everyshi} package
% by \person{Martin Schr\"oder,} from whom I have in fact borrowed some ideas).
%
% In addition to the crop marks every page gets an info line containing the
% jobname, the current date and time, the page number and an index number
% printed on top. This line can be turned off (\option{noinfo}) and on (\option{info})
% anywhere in the document.
%
%
%
%
% \subsection{Dependencies}
%
% \subsubsection{\package{latex.ltx}}
%
% The package works with all \LaTeXe\ standard classes (tested with
% \LaTeXe\ 1997/12/01 and sporadically with later versions), it does
% not work with plain \TeX.
%
% The \CROP\ package uses (and relies on) the internal \LaTeX\ tokens
% |\hb@xt@|, |\filename@parse|, |\@classoptionslist|,
% |\@ifundefined|, |\@height|, |\@depth|, |\filename@base|
% |\@width|, |\z@|, |\@ne|, |\z@skip|, |\p@|,
% |\c@page|, |\@namedef|, |\@nameuse|, |\strip@pt|, |\two@digits|,
% |\count@|, |\dimen@|, |\@for|, |\@empty|, |\@gobble| and |\@undefined|,
% % all of which are expected to keep their current meaning in future
% \LaTeXe\ releases. The \CROP\ package will, however, be supported
% at least for some years, so you needn't worry about it.
%
%
% \subsubsection{\package{color.sty}}
%
% \CROP's color handling depends on the \package{color} package.
% The following internal macros are used directly:
% |\@declaredcolor|, |\current@color|, |\set@color|, |\set@page@color|
% (Tested with |color.sty|, version~1.0i as of 1999/02/16.)
%
%
%
% \subsubsection{\package{graphics.sty}}
%
% \CROP's driver detection, as well as the options \option{rotate}
% \option{mirror}, and \option{nographics} depend on the
% \package{graphics} package. The following internal macros are used directly:
% |\Gin@PS@raw|, |\Ginclude@graphics|, |\Gin@driver|
% (Tested with |graphics.sty|, version~1.0l as of 1999/02/16.)
%
%
%
% \StopEventually{\addtocontents{toc}{\protect\end{multicols}}}
%
%
%
%
%
%
%
%
%^^A max 72 columns
%^^A--------------------------------------------------------------------
%
%
%
%
% \section{The implementation}
%
% \subsection{Preamble}
%
% \begin{macro}{\stockwidth}
% \begin{macro}{\stockheight}
% \begin{macro}{\CROP@index}
% \begin{macro}{\CROP@font}
% Make sure that |\stockwidth| and |\stockheight| are |\dimen|
% registers that hold the physical paper size. They are initially set
% to the paper size, but will be changed by the size options.
% These registers are also used\slash provided by the \package{memoir}
% class and the \package{hyperref} package.
% The |\CROP@font| macro is by default empty and can be changed
% through the \option{font} option.
%
% \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{crop}[2003/05/20 v1.9 crop marks (mf)]
\expandafter\ifx\csname stockwidth\endcsname\relax
\newdimen\stockwidth
\stockwidth\paperwidth
\fi
\expandafter\ifx\csname stockheight\endcsname\relax
\newdimen\stockheight
\stockheight\paperheight
\fi
\newcount\CROP@index
\CROP@index\z@
\newcommand*\CROP@font{}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%
%
%^^A--------------------------------------------------------------------
%
%
%
%
% \begin{macro}{\CROP@stockcolor}
% \begin{macro}{\CROP@pagecolor}
% \begin{macro}{\CROP@needscolor}
% Try to load the \package{color} package. It is needed for the
% \option{invert} and the \option{notext} option and, of course,
% for the modified |\pagecolor| command. Changing the meaning of
% |\current@color| looks dangerous, but it is only done if the
% \package{color} package couldn't be loaded, anyway.
%
% \begin{macrocode}
\let\CROP@stockcolor\@empty
\let\CROP@pagecolor\@empty
\IfFileExists{color.sty}{%
\RequirePackage{color}%
\let\CROP@needscolor\@empty
}{%
\newcommand*\CROP@needscolor{%
\PackageError{crop}{%
The `invert' and `notext' options require the\MessageBreak
`color' package, which doesn't seem to be installed%
}{%
Install the `color' package or don't use the `invert'
\MessageBreak or `notext' option.
}%
\let\CROP@needscolor\relax
}%
\let\current@color\relax
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%
%
%^^A--------------------------------------------------------------------
%
%
%
%
% \subsection{The device drivers}
%
% \begin{macro}{\CROP@detdriver}
% \begin{macro}{\CROP@Ginclude@graphics}
% \begin{macro}{\CROP@ps}
% The options \option{graphics} and \option{nographics} depend on the
% \package{graphics} package, which, if configured appropriately, also
% tells us which output device is preferred on the system. Show a
% warning, if the package couldn't be loaded, because we have to use a
% less portable \PS\ `driver' then.
%
% \begin{macrocode}
\let\CROP@detdriver\@empty
\IfFileExists{graphics.sty}{%
\RequirePackage{graphics}%
\let\CROP@Ginclude@graphics\Ginclude@graphics
\ifx\Gin@driver\@empty\else
\filename@parse{\Gin@driver}%
\edef\CROP@detdriver{\filename@base}%
\fi
\let\CROP@ps\Gin@PS@raw
}{%
\PackageWarning{crop}{I couldn't find the `graphics' package, so
I'll use\MessageBreak my internal PostScript interface%
}%
\newcommand*\CROP@ps[1]{\special{ps: ##1}}%
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%
%
%^^A--------------------------------------------------------------------
%
%
%
%
% \begin{macro}{\CROP@reqdriver}
% Define options that suggest \dots
%
% \begin{macrocode}
\let\CROP@reqdriver\@empty
\DeclareOption{vtex}{\def\CROP@reqdriver{vtex}}
\DeclareOption{pdftex}{\def\CROP@reqdriver{pdftex}}
\DeclareOption{pdflatex}{\def\CROP@reqdriver{pdftex}}
\DeclareOption{dvips}{\def\CROP@reqdriver{dvips}}
% \end{macrocode}
% \end{macro}
%
%
%
%
%^^A--------------------------------------------------------------------
%
%
%
%
% \begin{macro}{\CROP@driver}
% \dots\ or enforce a graphics driver. Note the exclamation points!
%
% \begin{macrocode}
\let\CROP@driver\@empty
\DeclareOption{vtex!}{\def\CROP@driver{vtex}}
\DeclareOption{pdftex!}{\def\CROP@driver{pdftex}}
\DeclareOption{pdflatex!}{\def\CROP@driver{pdftex}}
\DeclareOption{dvips!}{\def\CROP@driver{dvips}}
\DeclareOption{nodriver}{\def\CROP@driver{none}}
\DeclareOption{!}{\def\CROP@driver{none}}
% \end{macrocode}
% \end{macro}
%
%
%
%
%^^A--------------------------------------------------------------------
%
%
%
%
% \begin{macro}{\CROP@evaldriver}
% If |\CROP@driver| wasn't already set, decide |\AtBeginDocument| which
% graphics driver to use. A detected driver takes precedence over a
% `suggested' one. Show a warning if the user's choice is ignored.
%
% \begin{macrocode}
\newcommand*\CROP@evaldriver{%
\ifx\CROP@driver\@empty
\PackageInfo{crop}{requested driver: `\CROP@reqdriver'}%
\ifx\pdfoutput\@undefined\else
\ifx\pdfoutput\relax\else
\ifcase\pdfoutput\else
\def\CROP@detdriver{pdftex}%
\fi
\fi
\fi
\ifx\VTeXversion\@undefined\else
\ifx\VTeXversion\relax\else
\def\CROP@detdriver{vtex}%
\fi
\fi
\PackageInfo{crop}{detected driver: `\CROP@detdriver'}%
\ifx\CROP@reqdriver\@empty\else
\ifx\CROP@reqdriver\@empty\else
\ifx\CROP@reqdriver\CROP@detdriver\else