-
Notifications
You must be signed in to change notification settings - Fork 9
/
crop.sty
349 lines (349 loc) · 12.6 KB
/
crop.sty
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
%%
%% This is file `crop.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% crop.dtx (with options: `package')
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the source file.
%%
%% Any modified versions of this file must be renamed
%% with new filenames distinct from crop.sty.
%%
%% For distribution of the original source see the terms
%% for copying and modification in the file crop.dtx.
%%
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% File: crop.dtx Copyright (C) 1998, 1999, 2000, 2001 Melchior FRANZ
%% $Id: crop.dtx,v 1.21 2001/11/16 21:12:14 m Exp $
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{crop}[2001/11/16 v1.6 cropmarks (mf)]
\newdimen\CROP@width \CROP@width\z@
\newdimen\CROP@height \CROP@height\z@
\newcount\CROP@index \CROP@index\z@
\newcommand*\CROP@includegraphics{%
\PackageError{crop}%
{Package file `graphics.sty' not found.}{The options
`nographics' and `graphics' require the graphics package.}}
\newcommand*\CROP@driver{}
\IfFileExists{graphics.sty}{%
\RequirePackage{graphics}%
\let\CROP@includegraphics\includegraphics
\ifx\Gin@driver\@empty\else
\filename@parse{\Gin@driver}%
\edef\CROP@driver{\filename@base}%
\fi
}{}
\newcommand*\CROP@font{}
\newcommand*\CROP@size[2]{\CROP@width#1 \CROP@height#2 }
\DeclareOption{landscape}{%
\def\CROP@size#1#2{\CROP@height#1 \CROP@width#2 }}
\DeclareOption{a0}{\CROP@size{841truemm}{1189truemm}}
\DeclareOption{a1}{\CROP@size{595truemm}{841truemm}}
\DeclareOption{a2}{\CROP@size{420truemm}{595truemm}}
\DeclareOption{a3}{\CROP@size{297truemm}{420truemm}}
\DeclareOption{a4}{\CROP@size{210truemm}{297truemm}}
\DeclareOption{a5}{\CROP@size{149truemm}{210truemm}}
\DeclareOption{a6}{\CROP@size{105truemm}{149truemm}}
\DeclareOption{b0}{\CROP@size{1000truemm}{1414truemm}}
\DeclareOption{b1}{\CROP@size{707truemm}{1000truemm}}
\DeclareOption{b2}{\CROP@size{500truemm}{707truemm}}
\DeclareOption{b3}{\CROP@size{353truemm}{500truemm}}
\DeclareOption{b4}{\CROP@size{250truemm}{353truemm}}
\DeclareOption{b5}{\CROP@size{176truemm}{250truemm}}
\DeclareOption{b6}{\CROP@size{125truemm}{176truemm}}
\DeclareOption{letter}{\CROP@size{8.5truein}{11truein}}
\DeclareOption{legal}{\CROP@size{8.5truein}{14truein}}
\DeclareOption{executive}{\CROP@size{7.25truein}{10.5truein}}
\DeclareOption{center}{\AtEndOfPackage{\CROP@center}}
\newcommand*\CROP@center{%
\ifdim\CROP@width=\z@
\PackageError{crop}{no printing paper size selected}{%
you have to select a paper size before you can use %
the `center' option
}%
\else
\voffset\CROP@height
\advance\voffset-\paperheight\voffset.5\voffset
\hoffset\CROP@width
\advance\hoffset-\paperwidth\hoffset.5\hoffset
\fi
}
\DeclareOption*{\CROP@execopt\CurrentOption}
\newcommand*\crop[1][cam,noaxes]{%
\@for\CROP@@:=#1\do{\CROP@execopt\CROP@@}}
\newcommand*\CROP@execopt[1]{%
\def\CROP@##1=##2=##3\@nil{\def\CROP@{##1}\def\CROP@@{##2}}%
\expandafter\CROP@#1==\@nil%
\@ifundefined{CROP@opt@\CROP@}%
{\PackageError{crop}{Requested option `#1' not provided}%
{Note that the `*center' options are obsolete. You have to
request\MessageBreak e.g. [a4,center] instead of [a4center].}}%
{\@nameuse{CROP@opt@\CROP@}}}
\newcommand*\cropdef[6][\CROP@@info]{%
\@namedef{CROP@opt@#6}{%
\CROP@on
\def\CROP@info{#1}%
\let\CROP@ulc#2
\let\CROP@urc#3
\let\CROP@llc#4
\let\CROP@lrc#5}}
\newcommand*\CROP@@vaxis{%
\hfil
\setbox\z@\hbox{\vtop{\hrule\@height12\p@\@depth-2\p@\@width.4\p@
\vskip\paperheight\vskip4\p@
\hrule\@height\z@\@depth10\p@\@width.4\p@}}%
\ht\z@\z@ \dp\z@\z@ \box\z@
\hfil}
\newcommand*\CROP@@haxis{%
\vfil
\hb@xt@\paperwidth{%
\llap{\vrule\@height.2\p@\@depth.2\p@\@width10\p@\hskip2\p@}%
\hfil
\rlap{\hskip2\p@\vrule\@height.2\p@\@depth.2\p@\@width10\p@}}%
\vfil}
\newcommand*\CROP@time{}
{\count@\time \divide\time60 \count\@ne\time
\multiply\time60 \advance\count@-\time
\xdef\CROP@time{\the\count\@ne:\two@digits{\count@}}}
\newcommand*\CROP@@info{{\global\advance\CROP@index\@ne
\def\x{\discretionary{}{}{\hbox{\kern.5em---\kern.5em}}}%
\hskip10\p@\advance\paperwidth-20\p@
\raise8\p@\vbox to\z@{\centering\hsize\paperwidth\vss
\normalfont\let\protect\relax\CROP@font{%
``\jobname''\x\the\year/\the\month/\the\day\x\CROP@time\x
page\kern.5em\thepage\x\#\the\CROP@index\strut}}}}
\newcommand*\CROP@opt@font{\let\CROP@font\CROP@@}
\newcommand*\CROP@@ulc{%
\begin{picture}(0,0)\unitlength\p@\thinlines
\put(-30,0){\circle{10}}
\put(-30,-5){\line(0,1){10}}
\put(-35,0){\line(1,0){30}}
\put(0,30){\circle{10}}
\put(-5,30){\line(1,0){10}}
\put(0,35){\line(0,-1){30}}
\end{picture}}
\newcommand*\CROP@@urc{%
\begin{picture}(0,0)\unitlength\p@\thinlines
\put(30,0){\circle{10}}
\put(30,-5){\line(0,1){10}}
\put(35,0){\line(-1,0){30}}
\put(0,30){\circle{10}}
\put(-5,30){\line(1,0){10}}
\put(0,35){\line(0,-1){30}}
\end{picture}}
\newcommand*\CROP@@llc{%
\begin{picture}(0,0)\unitlength\p@\thinlines
\put(-30,0){\circle{10}}
\put(-30,-5){\line(0,1){10}}
\put(-35,0){\line(1,0){30}}
\put(0,-30){\circle{10}}
\put(-5,-30){\line(1,0){10}}
\put(0,-35){\line(0,1){30}}
\end{picture}}
\newcommand*\CROP@@lrc{%
\begin{picture}(0,0)\unitlength\p@\thinlines
\put(30,0){\circle{10}}
\put(30,-5){\line(0,1){10}}
\put(35,0){\line(-1,0){30}}
\put(0,-30){\circle{10}}
\put(-5,-30){\line(1,0){10}}
\put(0,-35){\line(0,1){30}}
\end{picture}}
\cropdef\CROP@@ulc\CROP@@urc\CROP@@llc\CROP@@lrc{cam}
\newcommand*\CROP@@cross{%
\begin{picture}(0,0)\unitlength1in\thinlines
\put(-1,0){\line(1,0){2}}
\put(0,-1){\line(0,1){2}}
\end{picture}}
\cropdef\CROP@@cross\CROP@@cross\CROP@@cross\CROP@@cross{cross}
\newcommand*\CROP@@frame{%
\begin{picture}(0,0)\unitlength\p@\thinlines
\put(0,0){\line(1,0){\strip@pt\paperwidth}}
\put(0,0){\line(0,-1){\strip@pt\paperheight}}
\put(\strip@pt\paperwidth,0){\line(0,-1){\strip@pt\paperheight}}
\put(0,-\strip@pt\paperheight){\line(1,0){\strip@pt\paperwidth}}
\end{picture}}
\cropdef\CROP@@frame\relax\relax\relax{frame}
\let\CROP@shipout\shipout
\renewcommand*\shipout{\afterassignment\CROP@ship\setbox\@cclv=}
\newcommand*\CROP@ship{%
\ifvoid\@cclv\expandafter\aftergroup\fi\CROP@@ship}
\newcommand*\CROP@shiplist{\CROP@@@ship\box\@cclv}
\newcommand*\CROP@@ship{\CROP@shipout\vbox{\CROP@shiplist}}
\newcommand*\CROP@shipadd[1]{\begingroup
\toks@\expandafter{\expandafter#1\expandafter{\CROP@shiplist}}%
\xdef\CROP@shiplist{\the\toks@}%
\endgroup}
\newcommand*\CROP@kernel{\color@setgroup
\vbox to\z@{\vskip\CROP@vorigin
\hb@xt@\z@{\hskip\CROP@horigin
\CROP@every
\vbox to\paperheight{%
\hb@xt@\paperwidth{%
\setbox\z@\hbox{\normalfont\CROP@@@info}%
\ht\z@\z@ \dp\z@\z@ \wd\z@\z@ \box\z@
\CROP@ulc\CROP@uedge\CROP@urc}%
\CROP@ledge
\hb@xt@\paperwidth{%
\CROP@llc\hfil\CROP@lrc}}%
\hss}%
\vss}\color@endgroup}
\newcommand*\CROP@opt@horigin{\let\CROP@horigin\CROP@@}
\newcommand*\CROP@opt@vorigin{\let\CROP@vorigin\CROP@@}
\newcommand*\CROP@@@ship{}
\newcommand*\CROP@on{\let\CROP@@@ship\CROP@kernel}
\newcommand*\CROP@opt@off{\let\CROP@@@ship\relax}
\newcommand*\CROP@@@info{}
\newcommand*\CROP@opt@info{\def\CROP@@@info{\CROP@info}}
\newcommand*\CROP@opt@noinfo{\let\CROP@@@info\relax}
\newcommand*\CROP@opt@axes{%
\let\CROP@uedge\CROP@@vaxis
\let\CROP@ledge\CROP@@haxis}
\newcommand*\CROP@opt@noaxes{%
\let\CROP@uedge\hfil
\let\CROP@ledge\vfil}
\expandafter\newcommand\expandafter*\csname CROP@opt@mount1\endcsname
{\let\CROP@every\relax}
\newcount\CROP@offset
\expandafter\newcommand\expandafter*\csname CROP@opt@mount2\endcsname
{\CROP@offset=\ifx\CROP@@\empty\z@\else\CROP@@\fi
\def\CROP@every{\count@\c@page
\advance\count@\CROP@offset
\ifodd\count@
\let\CROP@ulc\relax\let\CROP@llc\relax
\else
\let\CROP@urc\relax\let\CROP@lrc\relax\let\CROP@info\relax
\fi}}
\DeclareOption{mirror}{%
\AtBeginDocument{\CROP@shipadd\CROP@reflect\CROP@setps}}
\newcommand*\CROP@reflect[1]{%
\vbox to\z@{\vskip\CROP@vorigin\hb@xt@\z@{\hskip\CROP@horigin
\CROP@ps{gsave currentpoint}\kern\paperwidth
\CROP@ps{currentpoint}\hss}\vss}%
\CROP@ps{translate -1 1 scale neg exch neg exch translate}%
\vbox{#1}%
\CROP@ps{grestore}}
\DeclareOption{rotate}{%
\AtBeginDocument{\CROP@shipadd\CROP@rotate\CROP@setps}}
\newcommand*\CROP@rotate[1]{%
\hb@xt@\z@{\hskip\CROP@horigin\vbox to\z@{\vskip\CROP@vorigin
\CROP@ps{gsave currentpoint}\kern\paperheight
\hb@xt@\z@{\kern\paperwidth\CROP@ps{currentpoint}\hss}\vss}\hss}%
\CROP@ps{translate 180 rotate neg exch neg exch translate}%
\vbox{#1}%
\CROP@ps{grestore}}
\newcommand*\CROP@setps{%
\ifx\Gin@PS@raw\@undefined
\PackageWarning{crop}{internal PostScript interface used}%
\newcommand*\CROP@ps[1]{\special{ps: ##1}}%
\else
\PackageInfo{crop}{graphics/color PostScript interface used}{}%
\let\CROP@ps\Gin@PS@raw
\fi
\let\CROP@setps\relax}
\DeclareOption{invert}{%
\AtEndOfPackage{\RequirePackage{color}}%
\AtBeginDocument{\CROP@invert{black}}}
\newcommand*\CROP@invert[1]{%
\ifx\color\@undefined
\PackageWarning{crop}%
{The `color' package could not be loaded, so I'm\MessageBreak
ignoring the `invert' and `notext' option}%
\else
\pagecolor{#1}\color{white}%
\newcommand\CROP@color[2][]{}%
\DeclareRobustCommand\color{\CROP@color}%
\DeclareRobustCommand\pagecolor{\CROP@color}%
\DeclareRobustCommand\textcolor{\CROP@color}%
\let\normalcolor\relax
\fi
\let\CROP@invert\relax}
\DeclareOption{notext}{%
\AtEndOfPackage{\RequirePackage{color}}%
\AtBeginDocument{\CROP@invert{white}}}
\newcommand*\CROP@incgrph{}
\newcommand*\CROP@opt@nographics{%
\def\includegraphics##1##{\bgroup
\let\special\@gobble
\CROP@incgrph{##1}
}%
\def\CROP@incgrph##1##2{%
\CROP@includegraphics##1{##2}\egroup
}%
}
\newcommand*\CROP@opt@graphics{%
\let\includegraphics\CROP@includegraphics}
\newcommand*\CROP@compat{\PackageWarning{crop}{center options like
`a4center' are obsolete and only\MessageBreak provided for
compatibility reasons. They will be removed\MessageBreak in future
releases. Use the new options `a4'\MessageBreak and
`center' separately instead.}}
\DeclareOption{landscapecenter}{%
\CROP@compat\ExecuteOptions{landscape,center}}
\DeclareOption{a4center}{%
\CROP@compat\ExecuteOptions{a4,center}}
\DeclareOption{a5center}{%
\CROP@compat\ExecuteOptions{a5,center}}
\DeclareOption{b5center}{%
\CROP@compat\ExecuteOptions{b5,center}}
\DeclareOption{lettercenter}{%
\CROP@compat\ExecuteOptions{letter,center}}
\DeclareOption{legalcenter}{%
\CROP@compat\ExecuteOptions{legal,center}}
\DeclareOption{executivecenter}{%
\CROP@compat\ExecuteOptions{executive,center}}
\DeclareOption{vtex}{\renewcommand*\CROP@driver{vtex}}
\DeclareOption{pdftex}{\renewcommand*\CROP@driver{pdftex}}
\DeclareOption{pdflatex}{\renewcommand*\CROP@driver{pdftex}}
\DeclareOption{dvips}{\renewcommand*\CROP@driver{dvips}}
\newcommand*\CROP@init@dvips{%
\PackageInfo{crop}{using dvips graphics driver}%
\ifdim\CROP@width=\z@\else
\special{papersize=\the\CROP@width,\the\CROP@height}%
\fi
}
\newcommand*\CROP@init@pdftex{%
\PackageInfo{crop}{using pdf(la)tex graphics driver}%
\ifx\@undefined\pdfpagewidth
\PackageWarning{crop}{implicit or explicit pdf(la)tex option
ignored:^^JThis isn't pdftex!}%
\else
\ifdim\CROP@width=\z@\else
\pdfpagewidth\CROP@width
\pdfpageheight\CROP@height
\fi
\renewcommand*\CROP@opt@nographics{%
\renewcommand\includegraphics[2][]{%
\phantom{\CROP@includegraphics[####1]{####2}}
}%
}%
\fi
}
\newcommand*\CROP@init@vtex{%
\PackageInfo{crop}{using vtex graphics driver}%
\ifdim\CROP@width=\z@\else
\ifx\@undefined\mediawidth
\PackageWarning{crop}{implicit or explicit vtex option
ignored:^^JThis isn't vtex!}%
\else
\mediawidth\CROP@width \mediaheight\CROP@height
\fi
\fi
}
\newcommand*\CROP@horigin{-1truein}
\newcommand*\CROP@vorigin{-1truein}
\crop[off,noaxes,info,mount1]
\InputIfFileExists{crop.cfg}%
{\PackageInfo{crop}{Local config file crop.cfg used}}{}
\ProcessOptions
\AtEndOfPackage{\@nameuse{CROP@init@\CROP@driver}}
\endinput
%%
%% End of file `crop.sty'.