Debian Codegraph @

texmf-dist/source/latex/crop/crop.dtx

raw
1 % \iffalse
2 %% File: crop.dtx Copyright (C) 1998--2017 Melchior FRANZ
3 %
4 %<*preamble>
5 %
6 %
7 %
8 % on Unix/Linux just run "make" to get the style file and the documentation;
9 % else generate the driver crop.ins (if you don't already have it):
10 %
11 % $ latex crop.dtx
12 %
13 % Now generate the style file:
14 %
15 % $ tex crop.ins
16 %
17 % And finally to produce the documentation run LaTeX three times:
18 %
19 % $ latex crop.dtx
20 %
21 %
22 %
23 %
24 %
25 %
26 %$
27 %% ====================================================================
28 %% @LaTeX-package-file{
29 %% author = "Melchior FRANZ",
30 %% version = "1.10.2",
31 %% date = "05 Jun 2020",
32 %% filename = "crop.dtx",
33 %% address = "Melchior FRANZ
34 %% Rieder Hauptstrasse 52
35 %% A-5212 SCHNEEGATTERN
36 %% AUSTRIA",
37 %% URL = "https://github.com/rrthomas/crop/",
38 %% email = "[email protected]",
39 %% codetable = "ISO/ASCII",
40 %% keywords = "cropmarks, frame, mirror, rotate, invert",
41 %% supported = "yes",
42 %% docstring = "This document describes the crop package, which
43 %% provides different forms of crop marks for
44 %% trimming paper stacks, for camera alignment and
45 %% for visualizing the page dimensions.
46 %% There are options for centering the page with
47 %% respect to some physical paper size, for
48 %% mounting pages on a physical sheet, for
49 %% reflecting and inverting the whole document or
50 %% printing it upside-down, and for suppressing
51 %% either text or graphics output.",
52 %% }
53 %% ====================================================================
54 %
55 % COPYRIGHT NOTICE:
56 % This package is free software that can be redistributed and/or modified
57 % under the terms of the LaTeX Project Public License as specified
58 % in the file macros/latex/base/lppl.txt on any CTAN archive server.
59 %
60 %</preamble>
61 %
62 %
63 %<*batchfile>
64 \begin{filecontents}{crop.ins}
65 \def\batchfile{crop.ins}
66 \input docstrip.tex
67 \askforoverwritefalse
68 \keepsilent
69 \generate{\file{crop.sty}{\from{crop.dtx}{package}}}
70 \endbatchfile
71 \end{filecontents}
72 %</batchfile>
73 %
74 %
75 %
76 %<*driver>
77 \def\fileversion{1.10.2}
78 \def\filedate{2020/06/05}
79 \documentclass{ltxdoc}
80 \usepackage{hyperref}
81 \hypersetup{
82 bookmarksopen,
83 colorlinks,
84 pdftitle={The crop package},
85 pdfauthor={Melchior FRANZ},
86 pdfkeywords={crop marks, mirror, invert, center}
87 }
88 \usepackage[pdftex]{graphicx,color}
89 %
90 %
91 %
92 \newcommand*\option{\textsf}
93 \newcommand*\package{\texttt}
94 \newcommand*\program{\texttt}
95 \newcommand*\person{\textsc}
96 \newcommand*\itemfont{\sffamily}
97 \newcommand*\versal[1]{\textsc{\small#1}}
98 \newcommand*\CD{\versal{CD}}
99 \newcommand*\PS{\versal{PS}}
100 \newcommand*\DVI{\versal{DVI}}
101 \newcommand*\A{\versal{A4}}
102 \newcommand*\ISO{\versal{ISO-A4}}
103 \newcommand*\POSTSCRIPT{\textsc{PostScript}}
104 \newcommand*\CROP{\package{crop}}
105 % (the following two are for development versions ONLY! :-)
106 \newcommand*\FIXME{\marginpar{\Huge FIXME}\message{<FIXME>}\shop\stop}
107 \newcommand*\BS{\marginpar{\Huge BULLSHIT!}\show\stop}
108 %
109 %
110 \IfFileExists{crop.sty}
111 {\usepackage{crop}[2001/11/16]\let\CROPSTYfound\active}
112 {\GenericWarning{crop.dtx}
113 {Package file `crop.sty' not found (One picture will be missing.^^J
114 Generate `crop.sty' by (La)TeXing `crop.ins' and
115 process `crop.dtx' again.)^^J}}
116 %
117 %
118 \newenvironment{labeling}[1]
119 {\list{}{\settowidth{\labelwidth}{\textbf{#1}}
120 \leftmargin\labelwidth\advance\leftmargin\labelsep
121 \def\makelabel##1{\textbf{##1}\hfil}}}{\endlist}
122 %
123 %
124 \newenvironment{example}[1][.9\textwidth]
125 {\par\medskip\begin{tabular}{p{#1}l}}
126 {\end{tabular}\noindentafter\medbreak}
127 %
128 \makeatletter
129 \newcommand*\noindentafter{\@nobreaktrue\everypar{{\setbox\z@\lastbox}}}
130 \makeatother
131 %
132 % ^^A \RecordChanges
133 %
134 \begin{document}
135 \hfuzz.6pt
136 \setcounter{tocdepth}{2}
137 \DocInput{crop.dtx}
138 \end{document}
139 %</driver>
140 % \fi
141 %
142 %
143 % \CheckSum{1098}
144 % \CharacterTable
145 % {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
146 % 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
147 % Digits \0\1\2\3\4\5\6\7\8\9
148 % Exclamation \! Double quote \" Hash (number) \#
149 % Dollar \$ Percent \% Ampersand \&
150 % Acute accent \' Left paren \( Right paren \)
151 % Asterisk \* Plus \+ Comma \,
152 % Minus \- Point \. Solidus \/
153 % Colon \: Semicolon \; Less than \<
154 % Equals \= Greater than \> Question mark \?
155 % Commercial at \@ Left bracket \[ Backslash \\
156 % Right bracket \] Circumflex \^ Underscore \_
157 % Grave accent \` Left brace \{ Vertical bar \|
158 % Right brace \} Tilde \~}
159 %
160 %
161 %
162 %
163 %
164 % \title{The \CROP\ package}
165 %
166 % \author{Melchior \textsc{FRANZ}}
167 % \date{Nov 19, 2017}
168 % \maketitle
169 %
170 %
171 % \changes{v1.0}{1998/05/20}{Initial version}%
172 %
173 % \changes{v1.1a}{1998/10/20}{`smash replaced; The crop marks
174 % were displaced, when the package was used together with the
175 % \texttt{amsmath} package (V1.2c), which redefines the \LaTeX\ smash
176 % command to have a different meaning. Although, this is definitely a
177 % bug in the \texttt{amsmath} design, we do no longer use
178 % `smash. This problem was kindly reported by \person{Pauli Viljamaa.}}%
179 %
180 % \changes{v1.2}{1998/12/07}{options `mirror' and `invert' added
181 % on suggestion by \person{Rolf Niepraschk.}}%
182 %
183 % \changes{v1.3}{1999/03/07}{center the logical paper `AtBeginDocument'
184 % instead of immediately; postamble changed slightly; `uppercase
185 % removed from info}
186 %
187 % \changes{v1.3a}{1999/05/15}{copyright complies with the LPPL; code unchanged}
188 %
189 % \changes{v1.4}{2000/02/02}{options `rotate' (suggested by \person{Rolf}) and
190 % `info/noinfo' (requested by \person{Anshuman Pandey}) added}
191 %
192 % \changes{v1.5}{2001/10/07}{*center options replaced by `center' and paper size
193 % options; options `dvips', `pdftex', `graphics', `nographics', `notext',
194 % `color', `horigin' and `vorigin' added; new info line with time stamp;
195 % some of the improvements were suggested by Cpt.~\person{Leszek Flis}}
196 %
197 % \changes{v1.6}{2001/11/16}{font option added; dvips/pdftex/vtex options
198 % changed; nographics enabled for pdftex; fixed a nasty bug that
199 % disallowed setting the physical paper size in the config file---thanks
200 % to \person{Stefan Becuwe} for reporting this.}
201 %
202 % \changes{v1.7}{2002/05/14}{odd/even/width/height options added; better
203 % geometry.sty compatibility; adopting `stockwidth/`stockheight}
204 %
205 % \changes{v1.8}{2003/05/10}{removed all the `changes entries except those
206 % in the preamble (crop is in CVS since v1.4, anyway); rewrote kernel;
207 % added color support; fixed a nasty bug; better driver detection}
208 %
209 % \changes{v1.9}{2003/05/20}{don't create command sequences by merely
210 % checking for them}
211 %
212 % \changes{v1.10}{2017/11/19}{fix dimensions of a1, a2, a5 and a6 paper; add
213 % support for LuaTeX.}
214 %
215 %
216 % \begin{abstract}
217 % This article describes the \CROP\ package^^A
218 %^^A
219 % \footnote{This file has version number \fileversion, last revised
220 % \filedate.\\I'd like to thank \person{Rolf Niepraschk} for his useful
221 % hints and suggestions, which influenced the package substantially.
222 % A big thank you also goes to \person{Walter Schmidt} for his extensive
223 % tests and his expertise on compatibility issues with different devices.}^^A
224 %^^A
225 % , which provides different forms of crop marks for trimming paper
226 % stacks, for camera alignment and for visualizing the page dimensions.
227 % There are options for centering the document page on the paper sheet,
228 % for mounting pages on a physical sheet, for reflecting and inverting
229 % the whole document or printing it upside-down, and for suppressing
230 % either text or graphics output.
231 %
232 % The package was originally developed for needs of the
233 % Austrian Red Cross\slash Federal Province of Vienna\slash
234 % Department of Radiation Protection.
235 % \end{abstract}
236 %
237 %
238 %
239 %
240 %
241 % {\setlength\parskip{0pt}\tableofcontents}
242 % \addtocontents{toc}{\protect\begin{multicols}{2}}
243 %
244 %
245 % \section{Introduction}
246 % It is convenient to print documents for smaller logical paper sizes
247 % on paper of the printer's standard physical paper size.
248 % On the one hand this keeps from changing paper stacks, on the other
249 % hand it allows printing close to the logical paper edge and even outside
250 % the logical page.
251 %
252 % For trimming a whole paper stack or lining up the single pages on
253 % printing plates for photographical duplication a set of corner marks
254 % is required.
255 %
256 %
257 %
258 %
259 %
260 % \section{How to use the package}
261 %
262 % \subsection{Conventional options}
263 % \label{sec:conventional}
264 %
265 % These options may only be used in the preamble and have to be stated
266 % as arguments to the |\usepackage| command (as in |\usepackage[mirror]{crop}|).
267 %
268 % \begin{labeling}{\indent\indent}
269 % \item[\itemfont a0, a1, a2, a3, a4, a5, a6,
270 % b0, b1, b2, b3, b4, b5, b6, letter, legal, executive]\hfill\break
271 % These options declare the printing paper dimensions. One of them should be
272 % specified if the \option{center} option or one of the options \option{dvips},
273 % \option{pdftex}, \option{luatex} and \option{vtex} is used. The size options
274 % do not define the logical document page size! See
275 % section~\ref{sec:custom-logical} for how to achieve this.
276 %
277 % \item[\itemfont width, height]---
278 % Instead of using one of the pre-defined paper formats as described
279 % above, you can also set the physical paper dimensions directly. You may omit
280 % the `|true|' specifier if you don't plan to scale the document.
281 % Example: |\usepackage[cam,width=10truecm,height=13truecm]{crop}|
282 %
283 % \item[\itemfont center]
284 % This option centers the logical document page on the physical printer paper
285 % and therefore requires that you declare the sheet size properly. Write,
286 % for example, |\usepackage[cam,a4,center]{crop}| to center a document of any size
287 % on \ISO\ sheets.
288 %
289 % \item[\itemfont landscape]---
290 % Use this option in addition to the \option{center} option if you want
291 % to center a document on \emph{landscape oriented} paper. It has nothing
292 % to do with \LaTeX's |landscape| document class option.
293 %
294 % \item[\itemfont dvips, pdftex, pdflatex, luatex, lualatex, vtex, nodriver]---
295 % If you are working with \program{dvips}, \program{pdftex},
296 % \program{luatex} or \program{vtex}
297 % you may want to pass the dimensions of the paper that you are planning to print on to
298 % the respective driver program. Especially viewer programs like \program{evince}
299 % or \program{xpdf} make use of this \emph{bounding box} information. Unfortunately,
300 % this can't be done in a generic way---there's no standard. These options select
301 % driver specific methods to set the paper size and to rotate and reflect a page.
302 %
303 % The \CROP\ package tries to find out by itself which driver to use.
304 % You find its choice mentioned in the log file. Additionally, you can
305 % \emph{suggest} (|[dvips]|) or \emph{enforce} (|[dvips!]|) one of the drivers. In the
306 % latter case you only have to add an exclamation point to the driver
307 % option. The difference is, that a suggestion may get overruled by the
308 % package. Assume you have asked for |[dvips]|, but run the document file
309 % through \program{pdflatex}. In this case \CROP\ will automatically use
310 % the \option{pdflatex} driver. You can also force \CROP\ not to use any
311 % of the drivers by requesting the \option{nodriver} option.
312 % \option{pdflatex} is a synonym for \option{pdftex}, and \option{lualatex}
313 % is a synonym for \option{luatex}.
314 %
315 % \item[\itemfont mirror]
316 % This option reflects the whole document, provided that the selected output
317 % driver supports the \package{graphics} package's |\reflectbox| command.
318 % It doesn't have any effect on the \DVI\ file.
319 %
320 % \item[\itemfont rotate]
321 % Rotates the document by 180\(^\circ\) so that it appears upside-down.
322 % This may be useful to circumvent problems with printers, which do not print
323 % close enough to the lower paper edge due to their paper feed mechanism.
324 %
325 % \item[\itemfont invert]
326 % Lets the whole document be printed white onto black background,
327 % if the \package{color} package can be loaded and the document is output with a
328 % color aware device. All further color changing commands stated in the document
329 % are disabled. This option doesn't invert pictures, nor does it really swap
330 % text and paper color. Red text on green will still become white
331 % text on black. \option{invert} is stronger than \option{notext}.
332 %
333 % \item[\itemfont notext]---
334 % This option uses the \package{color} package to turn text to white
335 % color, after which all further color switching commands are disabled. This
336 % makes the text disappear from the printout, although it remains in the
337 % output file. See the description of the options \option{nographics} and
338 % \option{graphics} on page~\pageref{graphics} for an explanation.
339 % This option is ignored if option \option{invert} was also requested.
340 % \end{labeling}
341 %
342 %
343 %
344 %
345 %
346 %
347 %
348 % \subsection{Runtime options}
349 %
350 % These options may be used in the preamble like the `conventional' options
351 % (see section~\ref{sec:conventional}), but also as optional arguments to the
352 % |\crop| command everywhere in the document (as in |\crop[frame]|). Using
353 % this command without options implies |\crop[cam,noaxes]|.
354 %
355 % \begin{labeling}{\indent\indent}
356 % \item[\itemfont cam]
357 % This mode provides four different marks (see figure \ref{fig:marks}),
358 % one for each corner. They indicate the logical paper edges without
359 % touching them and can thus be printed on every page. These
360 % marks are mainly thought for camera alignment. The |\crop| command
361 % selects this mode if no other mode is requested.
362 %
363 % \item[\itemfont cross]
364 % This mode provides four 4~cm wide crosses (see figure
365 % \ref{fig:marks}), one at each corner, that touch the logical paper
366 % edge. That's why they should be printed on an extra page
367 % that will be used as a cover page while trimming the whole paper stack.
368 % (This is also the \emph{Red Cross} mode ;-)
369 %
370 % \item[\itemfont frame]
371 % This mode draws a frame around the logical page and is mainly thought
372 % for visualizing the document page dimensions.
373 %
374 % \item[\itemfont off]
375 % This `option' makes only sense in connection with the |\crop| command
376 % (i.\,e.~at runtime). It disables all markings and is selected by
377 % default if the package is input without requesting any of the marks.
378 %
379 % \item[\itemfont odd, even]---
380 % Use these options to let the crop marks be put on odd\slash even pages only.
381 % They automatically turn on \option{cam} marks if no other marks have been
382 % requested. Note that only the page number is considered. If you have
383 % two subsequent pages both with page number~1, and ask for the \option{odd}
384 % option, then both pages will have marks.
385 %
386 % \item[\itemfont axes, noaxes]---
387 % These options enable\slash disable the output of little marks that
388 % indicate the logical page's horizontal and vertical middle axis and
389 % may be selected in addition to one of the main modes. These marks
390 % might be needed for punching. Note that they are lost after
391 % trimming, since they lie outside the logical page.
392 % These marks are disabled by default.
393 %
394 % \item[\itemfont info, noinfo]---
395 % Print the page information consisting of filename, date, time, page number and page
396 % index on every sheet (see figure~\ref{fig:marks}). The page index starts
397 % with \#1 and is incremented with every page info line, hence being more
398 % reliable than page numbers, which are not unique and may be negative or
399 % contain letters. It can also be seen as a crop marks counter.
400 % Pages without crop marks aren't counted. This page information is enabled
401 % by default.
402 %
403 % \item[\itemfont font]
404 % The page info line uses |\normalfont| by default. If you are typesetting
405 % the document in non-latin glyphs or a decorative, but less legible font,
406 % you may want to request a specific font for that info. Just assign
407 % a font switching command like |\textsf| to the \option{font} option
408 % parameter, leaving the initial backslash away: |[font=textsf]|. This
409 % command may take one argument (like |\textsf{}|) or stand alone (like |\small|).
410 % You can, of course, define a more complex command first, and assign that
411 % one: |\newcommand*\infofont[1]{\textcolor{blue}{\textsf{\small#1}}}|
412 % |\crop[font=infofont]|
413 %
414 % \item[\itemfont color]
415 % You can set the color of crop marks, axes and info text with this
416 % option, if the \package{color} package could be loaded.
417 % The option takes only color names, as in |[color=red]|. See
418 % the \package{color} package documentation for how to define custom colors.
419 %
420 % \item[\itemfont mount1, mount2]---
421 % If more than one logical page is to be mounted on a physical sheet,
422 % you normally don't want marks to appear on the inner edges, where
423 % the pages touch each other.
424 % The \option{mount2} option prints only the outer marks.
425 % There's also a \option{mount1} option that is selected by default.
426 % These commands take a number as an optional argument serving
427 % as page offset. Type |mount2| or |mount2=0| for odd pages right
428 % and |mount2=1| for odd pages left. Since further modes are likely
429 % to be document, driver, and printer dependent, it is up to you to
430 % implement them yourself. (See a \option{mount4} suggestion on page
431 % \pageref{sec:mount4}.)
432 %
433 % \item[\itemfont horigin, vorigin]---
434 % The top and left margin are by default 1~inch wide. This can be changed
435 % using the dimensions |\oddsidemargin|, |\evensidemargin| and
436 % |\topmargin|. It's more convenient, though, to let the |geometry| package
437 % define all these and further parameters. The options \option{horigin} and \option{vorigin} only
438 % move the marks and don't change the page contents. \emph{Using these options is almost
439 % always a mistake, so use them only as a last resort!} Both options take a
440 % (mandatory) dimension. These dimensions describe the way from the reference point---the
441 % upper left corner of the text block---to the upper left corner of the page in
442 % a Cartesian coordinate system.
443 % As both |horigin| and |vorigin| are by default $-1$~inch, you would for
444 % example write |horigin=-.6in| to move the marks by 0.4~inch to the right.
445 %
446 % \item[\itemfont graphics, nographics]---
447 % \label{graphics}
448 % Color printouts are often more expensive than black-and-white ones, while
449 % their text quality is sometimes reduced. Therefore it may be desirable to create
450 % two versions of a document, one with only text and one with only
451 % graphics. Now you can feed the concerned pages to a color printer to
452 % print the \option{notext} version, and then to a mono laser printer with the
453 % \option{nographics} version. The \option{graphics} option turns graphics on again. You may
454 % want to mark up all colored pictures so that you can decide in the preamble,
455 % whether they shall be printed or not.
456 %
457 % \begin{example}[.86\textwidth]^^A
458 % |%\newcommand*\colorgraphic{} % print them;|\\
459 % |\newcommand*\colorgraphic{\crop[nographics]} % don't!|\\
460 % |...|\\
461 % |{\colorgraphic|\\
462 % |\includegraphics{...}|\\
463 % |\caption{...}|\\
464 % |}|
465 % \end{example}
466 % \end{labeling}
467 %
468 %
469 %
470 % {\makeatletter
471 % \ifx\CROPSTYfound\active
472 % \begin{figure}
473 % \begin{quote}
474 % \begin{center}
475 % \vspace{1.5cm}
476 % \leavevmode
477 % \hbox to9cm{\CROP@@ulc\hss\CROP@@info\hss\CROP@@urc}
478 % \vspace{.5cm}
479 % \caption{That's what you see on top of a 9~cm wide document page when
480 % \option{cam} mode is requested: the marks, jobname, date, time, page number and
481 % crop marks index.}
482 % \label{fig:marks}
483 % \end{center}
484 % \end{quote}
485 % \end{figure}
486 % \fi}
487 %
488 %
489 % \subsection{Loading}
490 %
491 % Since all marks lie outside the logical page, the horizontal and vertical
492 % offset should be set properly. Otherwise the marks are likely to be cut
493 % off by the \DVI\ driver or the printer.
494 % Provided that you have declared the size of your printing paper, you can
495 % use the |center| option to center every logical page on the respective sheet.
496 % There's, however, no harm in centering an \A~page on
497 % \A~paper, in which case both offsets are set to 0\,pt (unless, of course,
498 % you have set $\hbox{\verb"\mag"}\ne1000$).
499 %
500 % ^^A\begin{figure}
501 % \qquad\hbox{
502 % \begin{minipage}[t]{.45\textwidth}
503 %\begin{verbatim}
504 %\documentclass[a5paper]{article}
505 %\usepackage[cam,a4,center]{crop}
506 %\begin{document}
507 %...
508 %\end{document}
509 %\end{verbatim}
510 % \end{minipage}
511 %
512 % \begin{minipage}[t]{.45\textwidth}
513 %\begin{verbatim}
514 %\documentclass[a5paper]{article}
515 %\usepackage[a4,center]{crop}
516 %\begin{document}
517 %...
518 %\crop % or: \crop[cross], etc.
519 %...
520 %\end{document}
521 %\end{verbatim}
522 % \end{minipage}
523 % }\hspace*{-1cm}
524 % ^^A\caption{Loading the package. The marks can be activated in the preamble
525 % ^^A and anywhere in the document.}
526 % ^^A\label{fig:loading}
527 % ^^A\end{figure}
528 % \bigskip^^A\FIXME
529 %
530 % \noindent
531 % You get corner markings at every page shipped out after a \option{cam},
532 % \option{cross}, or \option{frame} mode request until you turn them off by
533 % typing \DescribeMacro{\crop}|\crop[off]|, or the actual grouping level
534 % ends.
535 % ^^ASee figure \ref{fig:loading}.
536 % Typing |\crop| without argument is equivalent to typing
537 % |\crop[cam,noaxes]|.
538 % Axis marks appear only together with one of the modes as listed above.
539 % If you only want one cover page for trimming, make sure that a page is
540 % actually output in the scope of |\crop|, for example:
541 %
542 % \begin{example}
543 % |\newpage|\\
544 % |{\crop[cross,axes]\mbox{}\newpage}|\\
545 % {}
546 % \end{example}
547 %
548 %
549 %
550 %
551 %
552 % \subsection{Color support}
553 %
554 % The \CROP\ package always tries to load the \package{color} package.
555 % You can change the color of the physical page as usual by using the
556 % |\pagecolor| command in the preamble. But after that, within the |document|
557 % environment, |\pagecolor| is redefined to only color the logical
558 % page. The color of crop marks, axes marks and page info can independently
559 % be set via the \option{color} option. The options \option{invert} and
560 % \option{notext} override any color settings.
561 %
562 %
563 %
564 %
565 %
566 %
567 % \subsection{Custom document page size}
568 % \label{sec:custom-logical}
569 %
570 % The \CROP\ package respects any page layout that you specify by means of
571 % \LaTeX\ dimensions. The following example uses the |geometry| package,
572 % which I strongly recommend. Let's assume you want to print a
573 % \CD~booklet ($4\,^{23}\!/_{32} \times 4\,^3\!/_4$~inch) on \ISO\ paper:
574 %
575 % \begin{example}
576 % |\documentclass{article}|\\
577 % |\usepackage[dvips=false,pdftex=false,vtex=false]{geometry}|
578 % \end{example}
579 %
580 % \indent
581 % \begin{example}
582 % |\geometry{|\\
583 % | paperwidth=4.71875in,|\\
584 % | paperheight=4.75in,|\\
585 % | margin=2em,|\\
586 % | bottom=1.5em,|\\
587 % | nohead|\\
588 % |}|
589 % \end{example}
590 %
591 % \indent
592 % \begin{example}
593 % |\usepackage[cam,a4,center,dvips]{crop}|\\
594 % \end{example}
595 %
596 % \indent
597 % \begin{example}
598 % |\begin{document}|\\
599 % |...|\\
600 % |\end{document}|
601 % \end{example}
602 %
603 % Note that the \CROP\ package should always be requested after setting
604 % up the `geometry'. See the \package{geometry} documentation for details.
605 % Always disable all of \package{geometry}'s driver options. While this isn't
606 % necessary in every case, it doesn't hurt and it makes your document more portable.
607 % You never know how the local |geometry.cfg| file on other workstations looks
608 % like!
609 %
610 %
611 %
612 %
613 %
614 % \subsection{Custom printing paper sheet size}
615 %
616 % If you want to use one of the \option{center}, \option{dvips}, \option{pdftex},
617 % \option{pdflatex}, \option{luatex}, \option{lualatex} or \option{vtex}
618 % options together with non-standard printing paper, you can set it
619 % via the \option{width} and \option{height} option, or simply add
620 % the respective paper definition to your |crop.cfg| file (see \ref{sec:config}).
621 % Let's for example define a new \option{weird} paper format, whereby the first dimension
622 % shall describe the paper width. Don't forget to request |true| dimensions,
623 % otherwise you will get really weird results with scaled documents.
624 %
625 % \begin{example}
626 % |\DeclareOption{weird}{\CROP@size{12truecm}{34truecm}}|
627 % \end{example}
628 %
629 % Now you can use your new printing paper format like the pre-defined ones.
630 %
631 % \begin{example}
632 % |\usepackage[frame,weird,center]{crop}|\\
633 % \end{example}
634 %
635 % If you don't need that format regularly or don't want to depend on a
636 % |crop.cfg| file, then you might prefer to declare the dimensions in the document:
637 %
638 % \begin{example}
639 % |\usepackage[frame,width=12truecm,height=34truecm,center]{crop}|\hspace*{-3cm}\\
640 % \end{example}
641 % \null
642 %
643 %
644 %
645 %
646 %
647 % \subsection{Defining your own marks}
648 % \label{sec:cropdef}
649 %
650 % If you need a \option{funny} mode, you can easily define it with
651 % only a couple of macros. The \DescribeMacro{\cropdef}|\cropdef| command
652 % defines the mode switch.
653 % It takes as arguments: the name of a macro providing the page info
654 % (optional; enclosed in brackets), four macro names to be assigned to
655 % the upper left, the upper right, the lower left, and the lower right
656 % corner, each representing a |picture| with zero width and height, or
657 % |\relax|, and finally the mode name. The optional brackets may also
658 % be empty, if no page info is wanted, or contain the info code instead of
659 % a macro name.
660 %
661 % \begin{example}
662 % |\newcommand*\funnymarkA{% % a little x|\\
663 % | \begin{picture}(0,0)|\\
664 % | \thinlines\unitlength1pt|\\
665 % | \put(-5,-5){\line(1,1){10}}|\\
666 % | \put(-5,5){\line(1,-1){10}}|\\
667 % | \end{picture}}|
668 % \end{example}
669 %
670 % \indent
671 % \begin{example}
672 % |\newcommand*\funnymarkB{% % a bullet|\\
673 % | \begin{picture}(0,0)|\\
674 % | \unitlength1pt|\\
675 % | \put(0,0){\circle*{5}}|\\
676 % | \end{picture}}|\\
677 % \end{example}
678 %
679 % \indent
680 % \begin{example}[.91\textwidth]
681 % |\newcommand*\funnyinfo{funny page info}|\\
682 % |\cropdef[\funnyinfo]\relax\funnymarkA\relax\funnymarkB{funny}|
683 % \end{example}
684 %
685 %
686 % Now you can select your new mode by typing |\crop[funny]|.
687 %
688 % Each of the axis marks is a |picture| that you can easily replace
689 % by some custom definition. There's no setup command like |\cropdef|, though.
690 % The kernel provides two `hooks' that can be used to add local
691 % extensions. These are macros that default to |\relax|. The first, |\CROP@user@a|,
692 % is executed at every page, no matter if marks are shown or not, while the
693 % second, |\CROP@user@b| is only executed at pages that contain crop marks.
694 % Local definitions and modifications are ideally put into a local configuration
695 % file:
696 %
697 %
698 % \subsection{The configuration file}
699 % \label{sec:config}
700 %
701 % If you want to change the predefined settings or add new features,
702 % then create a file named `|crop.cfg|' and put it in a directory, where \TeX\
703 % can find it. This configuration file will then be loaded
704 % at the end of the |crop.sty| file, so you can redefine
705 % any settings or commands therein, select package options and even
706 % introduce new ones. But if you intend to give
707 % your documents to others, don't forget to give them the
708 % required configuration files, too! That's how such a file
709 % could look like:
710 %
711 % \begin{example}
712 % |% define a new printing paper size|\\
713 % |\DeclareOption{special}{\CROP@size{22truecm}{37truecm}}|
714 % \end{example}
715 %
716 % \indent
717 % \begin{example}
718 % |% make the internal time string (used in the page|\\
719 % |% information) accessible in the whole document|\\
720 % |\let\Time\CROP@time|
721 % \end{example}
722 %
723 % \indent
724 % \begin{example}
725 % |% let's use a different font for the predefined page|\\
726 % |% information (we could also have written|\\
727 % |% \newcommand*\CROP@font[1]{\textsf{#1}})|\\
728 % |\crop[font=textsf]|\\
729 % |\endinput|\\
730 % {}
731 % \end{example}
732 %
733 %
734 %
735 % \section{How the package works}
736 %
737 % \subsection{The kernel mechanism}
738 %
739 % \TeX\ outputs a page via the |\shipout| command. The \CROP\ package
740 % redefines |\shipout| to insert the requested marks before it outputs
741 % the page contents. It is carefully designed to coexist peacefully with
742 % other packages, which use the same method (like the \package{everyshi} package
743 % by \person{Martin Schr\"oder,} from whom I have in fact borrowed some ideas).
744 %
745 % In addition to the crop marks every page gets an info line containing the
746 % jobname, the current date and time, the page number and an index number
747 % printed on top. This line can be turned off (\option{noinfo}) and on (\option{info})
748 % anywhere in the document.
749 %
750 %
751 %
752 %
753 % \subsection{Dependencies}
754 %
755 % \subsubsection{\package{latex.ltx}}
756 %
757 % The package works with all \LaTeXe\ standard classes (tested with
758 % \LaTeXe\ 1997/12/01 and sporadically with later versions), it does
759 % not work with plain \TeX.
760 %
761 % The \CROP\ package uses (and relies on) the internal \LaTeX\ tokens
762 % |\hb@xt@|, |\filename@parse|, |\@classoptionslist|,
763 % |\@ifundefined|, |\@height|, |\@depth|, |\filename@base|
764 % |\@width|, |\z@|, |\@ne|, |\z@skip|, |\p@|,
765 % |\c@page|, |\@namedef|, |\@nameuse|, |\strip@pt|, |\two@digits|,
766 % |\count@|, |\dimen@|, |\@for|, |\@empty|, |\@gobble| and |\@undefined|,
767 % % all of which are expected to keep their current meaning in future
768 % \LaTeXe\ releases. The \CROP\ package will, however, be supported
769 % at least for some years, so you needn't worry about it.
770 %
771 %
772 % \subsubsection{\package{color.sty}}
773 %
774 % \CROP's color handling depends on the \package{color} package.
775 % The following internal macros are used directly:
776 % |\@declaredcolor|, |\current@color|, |\set@color|, |\set@page@color|
777 % (Tested with |color.sty|, version~1.0i as of 1999/02/16.)
778 %
779 %
780 %
781 % \subsubsection{\package{graphics.sty}}
782 %
783 % \CROP's driver detection, as well as the options \option{rotate}
784 % \option{mirror}, and \option{nographics} depend on the
785 % \package{graphics} package. The following internal macros are used directly:
786 % |\Gin@PS@raw|, |\Ginclude@graphics|, |\Gin@driver|
787 % (Tested with |graphics.sty|, version~1.0l as of 1999/02/16.)
788 %
789 %
790 % \subsubsection{\package{ifluatex.sty}}
791 %
792 % \CROP's driver detection depends on the \package{ifluatex} package.
793 %
794 %
795 % \StopEventually{\addtocontents{toc}{\protect\end{multicols}}}
796 %
797 %
798 %
799 %
800 %
801 %
802 %
803 %
804 %^^A max 72 columns
805 %^^A--------------------------------------------------------------------
806 %
807 %
808 %
809 %
810 % \section{The implementation}
811 %
812 % \subsection{Preamble}
813 %
814 % \begin{macro}{\stockwidth}
815 % \begin{macro}{\stockheight}
816 % \begin{macro}{\CROP@index}
817 % \begin{macro}{\CROP@font}
818 % Make sure that |\stockwidth| and |\stockheight| are |\dimen|
819 % registers that hold the physical paper size. They are initially set
820 % to the paper size, but will be changed by the size options.
821 % These registers are also used\slash provided by the \package{memoir}
822 % class and the \package{hyperref} package.
823 % The |\CROP@font| macro is by default empty and can be changed
824 % through the \option{font} option.
825 %
826 % \begin{macrocode}
827 %<*package>
828 \NeedsTeXFormat{LaTeX2e}
829 \ProvidesPackage{crop}[2017/11/19 1.10 crop marks (mf)]
830 \RequirePackage{ifluatex}
831 \expandafter\ifx\csname stockwidth\endcsname\relax
832 \newdimen\stockwidth
833 \stockwidth\paperwidth
834 \fi
835 \expandafter\ifx\csname stockheight\endcsname\relax
836 \newdimen\stockheight
837 \stockheight\paperheight
838 \fi
839 \newcount\CROP@index
840 \CROP@index\z@
841 \newcommand*\CROP@font{}
842 % \end{macrocode}
843 % \end{macro}
844 % \end{macro}
845 % \end{macro}
846 % \end{macro}
847 %
848 %
849 %
850 %
851 %^^A--------------------------------------------------------------------
852 %
853 %
854 %
855 %
856 % \begin{macro}{\CROP@stockcolor}
857 % \begin{macro}{\CROP@pagecolor}
858 % \begin{macro}{\CROP@needscolor}
859 % Try to load the \package{color} package. It is needed for the
860 % \option{invert} and the \option{notext} option and, of course,
861 % for the modified |\pagecolor| command. Changing the meaning of
862 % |\current@color| looks dangerous, but it is only done if the
863 % \package{color} package couldn't be loaded, anyway.
864 %
865 % \begin{macrocode}
866 \let\CROP@stockcolor\@empty
867 \let\CROP@pagecolor\@empty
868 \IfFileExists{color.sty}{%
869 \RequirePackage{color}%
870 \let\CROP@needscolor\@empty
871 }{%
872 \newcommand*\CROP@needscolor{%
873 \PackageError{crop}{%
874 The `invert' and `notext' options require the\MessageBreak
875 `color' package, which doesn't seem to be installed%
876 }{%
877 Install the `color' package or don't use the `invert'
878 \MessageBreak or `notext' option.
879 }%
880 \let\CROP@needscolor\relax
881 }%
882 \let\current@color\relax
883 }
884 % \end{macrocode}
885 % \end{macro}
886 % \end{macro}
887 % \end{macro}
888 %
889 %
890 %
891 %
892 %^^A--------------------------------------------------------------------
893 %
894 %
895 %
896 %
897 % \subsection{The device drivers}
898 %
899 % \begin{macro}{\CROP@detdriver}
900 % \begin{macro}{\CROP@Ginclude@graphics}
901 % \begin{macro}{\CROP@ps}
902 % The options \option{graphics} and \option{nographics} depend on the
903 % \package{graphics} package, which, if configured appropriately, also
904 % tells us which output device is preferred on the system. Show a
905 % warning, if the package couldn't be loaded, because we have to use a
906 % less portable \PS\ `driver' then.
907 %
908 % \begin{macrocode}
909 \let\CROP@detdriver\@empty
910 \IfFileExists{graphics.sty}{%
911 \RequirePackage{graphics}%
912 \let\CROP@Ginclude@graphics\Ginclude@graphics
913 \ifx\Gin@driver\@empty\else
914 \filename@parse{\Gin@driver}%
915 \edef\CROP@detdriver{\filename@base}%
916 \fi
917 \let\CROP@ps\Gin@PS@raw
918 }{%
919 \PackageWarning{crop}{I couldn't find the `graphics' package, so
920 I'll use\MessageBreak my internal PostScript interface%
921 }%
922 \newcommand*\CROP@ps[1]{\special{ps: ##1}}%
923 }
924 % \end{macrocode}
925 % \end{macro}
926 % \end{macro}
927 % \end{macro}
928 %
929 %
930 %
931 %
932 %^^A--------------------------------------------------------------------
933 %
934 %
935 %
936 %
937 % \begin{macro}{\CROP@reqdriver}
938 % Define options that suggest \dots
939 %
940 % \begin{macrocode}
941 \let\CROP@reqdriver\@empty
942 \DeclareOption{vtex}{\def\CROP@reqdriver{vtex}}
943 \DeclareOption{pdftex}{\def\CROP@reqdriver{pdftex}}
944 \DeclareOption{pdflatex}{\def\CROP@reqdriver{pdftex}}
945 \DeclareOption{luatex}{\def\CROP@reqdriver{luatex}}
946 \DeclareOption{lualatex}{\def\CROP@reqdriver{luatex}}
947 \DeclareOption{dvips}{\def\CROP@reqdriver{dvips}}
948 % \end{macrocode}
949 % \end{macro}
950 %
951 %
952 %
953 %
954 %^^A--------------------------------------------------------------------
955 %
956 %
957 %
958 %
959 % \begin{macro}{\CROP@driver}
960 % \dots\ or enforce a graphics driver. Note the exclamation points!
961 %
962 % \begin{macrocode}
963 \let\CROP@driver\@empty
964 \DeclareOption{vtex!}{\def\CROP@driver{vtex}}
965 \DeclareOption{pdftex!}{\def\CROP@driver{pdftex}}
966 \DeclareOption{pdflatex!}{\def\CROP@driver{pdftex}}
967 \DeclareOption{luatex!}{\def\CROP@driver{luatex}}
968 \DeclareOption{lualatex!}{\def\CROP@driver{luatex}}
969 \DeclareOption{dvips!}{\def\CROP@driver{dvips}}
970 \DeclareOption{nodriver}{\def\CROP@driver{none}}
971 \DeclareOption{!}{\def\CROP@driver{none}}
972 % \end{macrocode}
973 % \end{macro}
974 %
975 %
976 %
977 %
978 %^^A--------------------------------------------------------------------
979 %
980 %
981 %
982 %
983 % \begin{macro}{\CROP@evaldriver}
984 % If |\CROP@driver| wasn't already set, decide |\AtBeginDocument| which
985 % graphics driver to use. A detected driver takes precedence over a
986 % `suggested' one. Show a warning if the user's choice is ignored.
987 %
988 % \begin{macrocode}
989 \newcommand*\CROP@evaldriver{%
990 \ifx\CROP@driver\@empty
991 \PackageInfo{crop}{requested driver: `\CROP@reqdriver'}%
992 \ifluatex
993 \def\CROP@detdriver{luatex}%
994 \else
995 \ifx\pdfoutput\@undefined\else
996 \ifx\pdfoutput\relax\else
997 \ifcase\pdfoutput\else
998 \def\CROP@detdriver{pdftex}%
999 \fi
1000 \fi
1001 \fi
1002 \fi
1003 \ifx\VTeXversion\@undefined\else
1004 \ifx\VTeXversion\relax\else
1005 \def\CROP@detdriver{vtex}%
1006 \fi
1007 \fi
1008 \PackageInfo{crop}{detected driver: `\CROP@detdriver'}%
1009 \ifx\CROP@reqdriver\@empty\else
1010 \ifx\CROP@reqdriver\@empty\else
1011 \ifx\CROP@reqdriver\CROP@detdriver\else
1012 \PackageWarningNoLine{crop}{%
1013 You requested the `\CROP@reqdriver' driver
1014 but I think that\MessageBreak the
1015 `\CROP@detdriver' driver works better in the
1016 current\MessageBreak context. You can force
1017 me to respect your decision\MessageBreak
1018 by adding an exclamation point as in
1019 [\CROP@reqdriver!]%
1020 }%
1021 \fi
1022 \fi
1023 \fi
1024 \ifx\CROP@detdriver\@empty
1025 \let\CROP@driver\CROP@reqdriver
1026 \else
1027 \let\CROP@driver\CROP@detdriver
1028 \fi
1029 \fi
1030 \let\CROP@evaldriver\relax
1031 }
1032 \AtBeginDocument{\CROP@evaldriver}
1033 % \end{macrocode}
1034 % \end{macro}
1035 %
1036 %
1037 %
1038 %
1039 %^^A--------------------------------------------------------------------
1040 %
1041 %
1042 %
1043 %
1044 % \begin{macro}{\CROP@init@dvips}
1045 % \begin{macro}{\CROP@init@pdftex}
1046 % \begin{macro}{\CROP@init@luatex}
1047 % \begin{macro}{\CROP@init@vtex}
1048 % \begin{macro}{\CROP@init@none}
1049 % These macros prepare the \CROP\ package for one of the supported
1050 % graphics drivers. They don't do anything spectacular, they just
1051 % select the proper \option{rotate} and \option{mirror} macro and
1052 % hand the physical paper size over to the driver program.
1053 %
1054 % \begin{macrocode}
1055 \newcommand*\CROP@init@dvips{%
1056 \PackageInfo{crop}{using `dvips' graphics driver}%
1057 \AtBeginDvi{%
1058 \special{papersize=\the\stockwidth,\the\stockheight}%
1059 }%
1060 }
1061 \newcommand*\CROP@init@pdftex{%
1062 \PackageInfo{crop}{using `pdftex' graphics driver}%
1063 \let\CROP@reflect\CROP@genreflect
1064 \let\CROP@rotate\CROP@genrotate
1065 \newcommand*\CROP@shiphook{%
1066 \pdfpagewidth\stockwidth
1067 \pdfpageheight\stockheight
1068 }%
1069 }
1070 \newcommand*\CROP@init@luatex{%
1071 \PackageInfo{crop}{using `luatex' graphics driver}%
1072 \pagewidth\stockwidth
1073 \pageheight\stockheight
1074 \let\CROP@reflect\CROP@genreflect
1075 \let\CROP@rotate\CROP@genrotate
1076 }
1077 \newcommand*\CROP@init@vtex{%
1078 \PackageInfo{crop}{using `vtex' graphics driver}%
1079 \mediawidth\stockwidth
1080 \mediaheight\stockheight
1081 \let\CROP@reflect\CROP@genreflect
1082 \let\CROP@rotate\CROP@genrotate
1083 }
1084 \newcommand*\CROP@init@none{%
1085 \PackageInfo{crop}{not using any graphics driver}%
1086 }
1087 % \end{macrocode}
1088 % \end{macro}
1089 % \end{macro}
1090 % \end{macro}
1091 % \end{macro}
1092 % \end{macro}
1093 %
1094 %
1095 %
1096 %
1097 %^^A--------------------------------------------------------------------
1098 %
1099 %
1100 %
1101 %
1102 % \subsection{Size options}
1103 %
1104 % \begin{macro}{\CROP@size}
1105 % \begin{macro}{\CROP@opt@width}
1106 % \begin{macro}{\CROP@opt@height}
1107 % These options set different standard printing paper sizes, which
1108 % are needed for centering and as a hint for the \program{dvips},
1109 % \program{pdftex}, \program{luatex} or \program{vtex} program.
1110 % Since the physical paper
1111 % dimensions must not undergo a possible scaling, |true| dimensions
1112 % are used. The \option{landscape} option exchanges the |\hoffset| and
1113 % |\voffset| values.
1114 %
1115 % \begin{macrocode}
1116 \newcommand*\CROP@size[2]{\stockwidth#1 \stockheight#2 }
1117 \DeclareOption{landscape}{%
1118 \def\CROP@size#1#2{\stockheight#1 \stockwidth#2 }%
1119 }
1120 \DeclareOption{a0}{\CROP@size{841truemm}{1189truemm}}
1121 \DeclareOption{a1}{\CROP@size{594truemm}{841truemm}}
1122 \DeclareOption{a2}{\CROP@size{420truemm}{594truemm}}
1123 \DeclareOption{a3}{\CROP@size{297truemm}{420truemm}}
1124 \DeclareOption{a4}{\CROP@size{210truemm}{297truemm}}
1125 \DeclareOption{a5}{\CROP@size{148truemm}{210truemm}}
1126 \DeclareOption{a6}{\CROP@size{105truemm}{148truemm}}
1127 \DeclareOption{b0}{\CROP@size{1000truemm}{1414truemm}}
1128 \DeclareOption{b1}{\CROP@size{707truemm}{1000truemm}}
1129 \DeclareOption{b2}{\CROP@size{500truemm}{707truemm}}
1130 \DeclareOption{b3}{\CROP@size{353truemm}{500truemm}}
1131 \DeclareOption{b4}{\CROP@size{250truemm}{353truemm}}
1132 \DeclareOption{b5}{\CROP@size{176truemm}{250truemm}}
1133 \DeclareOption{b6}{\CROP@size{125truemm}{176truemm}}
1134 \DeclareOption{letter}{\CROP@size{8.5truein}{11truein}}
1135 \DeclareOption{legal}{\CROP@size{8.5truein}{14truein}}
1136 \DeclareOption{executive}{\CROP@size{7.25truein}{10.5truein}}
1137 \newcommand\CROP@opt@width{\stockwidth\CROP@@}
1138 \newcommand\CROP@opt@height{\stockheight\CROP@@}
1139 % \end{macrocode}
1140 % \end{macro}
1141 % \end{macro}
1142 % \end{macro}
1143 %
1144 %
1145 %
1146 %
1147 %^^A--------------------------------------------------------------------
1148 %
1149 %
1150 %
1151 %
1152 % \begin{macro}{\CROP@center}
1153 % The \option{center} option sets |\voffset| and |\hoffset| so that the
1154 % document pages are centered on the printing paper sheets.
1155 %
1156 % \begin{macrocode}
1157 \DeclareOption{center}{\AtBeginDocument{\CROP@center}}
1158 \newcommand*\CROP@center{%
1159 \voffset\stockheight
1160 \advance\voffset-\paperheight
1161 \voffset.5\voffset
1162 \hoffset\stockwidth
1163 \advance\hoffset-\paperwidth
1164 \hoffset.5\hoffset
1165 }
1166 % \end{macrocode}
1167 % \end{macro}
1168 %
1169 %
1170 %
1171 %
1172 %^^A--------------------------------------------------------------------
1173 %
1174 %
1175 %
1176 %
1177 % \subsection{Runtime options handling}
1178 %
1179 % Pass every unknown option to the macro |\CROP@execopt|.
1180 %
1181 % \begin{macrocode}
1182 \DeclareOption*{\CROP@execopt\CurrentOption}
1183 % \end{macrocode}
1184 %
1185 %
1186 %
1187 %
1188 %^^A--------------------------------------------------------------------
1189 %
1190 %
1191 %
1192 %
1193 % \begin{macro}{\crop}
1194 % The |\crop| macro allows options to be used both in the preamble and
1195 % throughout the document. Every argument of the optional argument list
1196 % is passed to the macro |\CROP@execopt|. The options \option{cam} and
1197 % \option{noaxes} are selected by default.
1198 %
1199 % \begin{macrocode}
1200 \newcommand*\crop[1][cam,noaxes]{%
1201 \@for\CROP@@:=#1\do{\CROP@execopt\CROP@@}%
1202 }
1203 % \end{macrocode}
1204 % \end{macro}
1205 %
1206 %
1207 %
1208 %
1209 %^^A--------------------------------------------------------------------
1210 %
1211 %
1212 %
1213 %
1214 % \begin{macro}{\CROP@execopt}
1215 % Every execution of this macro with an argument $n$ leads to the
1216 % execution of a macro |\CROP@opt@|$n$ or a warning if no such exists.
1217 % Optional arguments (separated by an equal sign) are cut off and
1218 % stored in |\CROP@@|.
1219 % The macro tolerates even arguments for options that are not prepared
1220 % to handle arguments (e.\,g.~|cross=garbage|), or more than one
1221 % argument (e.\,g.~|mount2=1=garbage|). This makes the design simpler
1222 % and doesn't hurt.
1223 %
1224 % \begin{macrocode}
1225 \newcommand*\CROP@execopt[1]{%
1226 \def\CROP@##1=##2=##3\@nil{\def\CROP@{##1}\def\CROP@@{##2}}%
1227 \expandafter\CROP@#1==\@nil%
1228 \@ifundefined{CROP@opt@\CROP@}{%
1229 \PackageError{crop}{%
1230 Requested option `#1' not provided%
1231 }{%
1232 Note that the `*center' options are obsolete. You have to
1233 request\MessageBreak e.g. [a4,center] instead of
1234 [a4center].
1235 }%
1236 }{%
1237 \@nameuse{CROP@opt@\CROP@}%
1238 }%
1239 }
1240 % \end{macrocode}
1241 % \end{macro}
1242 %
1243 %
1244 %
1245 %
1246 %^^A--------------------------------------------------------------------
1247 %
1248 %
1249 %
1250 %
1251 % \begin{macro}{\cropdef}
1252 % The |\cropdef| macro defines a mode switch (see section
1253 % \ref{sec:cropdef}). It supports only corner marks and the page info,
1254 % but not the axis marks, mainly for hysterical raisins.
1255 %
1256 % \begin{macrocode}
1257 \newcommand*\cropdef[6][\CROP@@info]{%
1258 \@namedef{CROP@opt@#6}{%
1259 \def\CROP@info{#1}%
1260 \let\CROP@ulc#2
1261 \let\CROP@urc#3
1262 \let\CROP@llc#4
1263 \let\CROP@lrc#5
1264 \let\CROP@@@marks\CROP@marks
1265 }%
1266 }
1267 % \end{macrocode}
1268 % \end{macro}
1269 %
1270 %
1271 %
1272 %
1273 %^^A--------------------------------------------------------------------
1274 %
1275 %
1276 %
1277 %
1278 % \subsection{Axes and page info}
1279 %
1280 % \begin{macro}{\CROP@@laxis}
1281 % \begin{macro}{\CROP@@raxis}
1282 % \begin{macro}{\CROP@@upaxis}
1283 % \begin{macro}{\CROP@@loaxis}
1284 % The standard definitions for the \option{axes} option.
1285 %
1286 % \begin{macrocode}
1287 \newcommand*\CROP@@laxis{%
1288 \begin{picture}(0,0)
1289 \unitlength\p@\thinlines
1290 \put(-2,0){\line(-1,0){11}}
1291 \end{picture}%
1292 }
1293 \newcommand*\CROP@@raxis{%
1294 \begin{picture}(0,0)
1295 \unitlength\p@\thinlines
1296 \put(2,0){\line(1,0){11}}
1297 \end{picture}%
1298 }
1299 \newcommand*\CROP@@upaxis{%
1300 \begin{picture}(0,0)
1301 \unitlength\p@\thinlines
1302 \put(0,2){\line(0,1){11}}
1303 \end{picture}%
1304 }
1305 \newcommand*\CROP@@loaxis{%
1306 \begin{picture}(0,0)
1307 \unitlength\p@\thinlines
1308 \put(0,-2){\line(0,-1){11}}
1309 \end{picture}%
1310 }
1311 % \end{macrocode}
1312 % \end{macro}
1313 % \end{macro}
1314 % \end{macro}
1315 % \end{macro}
1316 %
1317 %
1318 %
1319 %
1320 %^^A--------------------------------------------------------------------
1321 %
1322 %
1323 %
1324 %
1325 % \begin{macro}{\CROP@time}
1326 % \begin{macro}{\CROP@@info}
1327 % \begin{macro}{\CROP@opt@font}
1328 % This macro prints the jobname, the current date and time, the page
1329 % number and an index number at the top of the logical page.
1330 %
1331 % \begin{macrocode}
1332 \newcommand*\CROP@time{}
1333 \bgroup
1334 \count@\time
1335 \divide\time60
1336 \count\@ne\time
1337 \multiply\time60
1338 \advance\count@-\time
1339 \xdef\CROP@time{\the\count\@ne:\two@digits{\count@}}
1340 \egroup
1341 \newcommand*\CROP@@info{{%
1342 \global\advance\CROP@index\@ne
1343 \def\x{\discretionary{}{}{\hbox{\kern.5em---\kern.5em}}}%
1344 \advance\paperwidth-20\p@
1345 \dimen@4pt
1346 \ifx\CROP@pagecolor\@empty
1347 \else
1348 \advance\dimen@\CROP@overlap
1349 \fi
1350 \hb@xt@\z@{%
1351 \hss
1352 \vbox to\z@{%
1353 \centering
1354 \hsize\paperwidth
1355 \vss
1356 \normalfont
1357 \normalsize
1358 \expandafter\csname\CROP@font\endcsname{%
1359 ``\jobname''\x
1360 \the\year/\the\month/\the\day\x
1361 \CROP@time\x
1362 page\kern.5em\thepage\x
1363 \#\the\CROP@index
1364 \strut
1365 }%
1366 \vskip\dimen@
1367 }%
1368 \hss
1369 }%
1370 }}
1371 \newcommand*\CROP@opt@font{\let\CROP@font\CROP@@}
1372 % \end{macrocode}
1373 % \end{macro}
1374 % \end{macro}
1375 % \end{macro}
1376 %
1377 %
1378 %
1379 %
1380 %^^A--------------------------------------------------------------------
1381 %
1382 %
1383 %
1384 %
1385 % \subsection{The marks}
1386 %
1387 % The following four macros provide different marks for the
1388 % \option{cam} mode. They do not touch the logical page and can, thus,
1389 % be printed on every single sheet.
1390 %
1391 % \begin{macro}{\CROP@@ulc}
1392 % The \option{cam} mode corner mark for the upper left corner.
1393 %
1394 % \begin{macrocode}
1395 \newcommand*\CROP@@ulc{%
1396 \begin{picture}(0,0)
1397 \unitlength\p@\thinlines
1398 \put(-30,0){\circle{10}}
1399 \put(-30,-5){\line(0,1){10}}
1400 \put(-35,0){\line(1,0){30}}
1401 \put(0,30){\circle{10}}
1402 \put(-5,30){\line(1,0){10}}
1403 \put(0,35){\line(0,-1){30}}
1404 \end{picture}%
1405 }
1406 % \end{macrocode}
1407 % \end{macro}
1408 %
1409 %
1410 %
1411 %
1412 %^^A--------------------------------------------------------------------
1413 %
1414 %
1415 %
1416 %
1417 % \begin{macro}{\CROP@@urc}
1418 % The \option{cam} mode corner mark for the upper right corner.
1419 %
1420 % \begin{macrocode}
1421 \newcommand*\CROP@@urc{%
1422 \begin{picture}(0,0)
1423 \unitlength\p@\thinlines
1424 \put(30,0){\circle{10}}
1425 \put(30,-5){\line(0,1){10}}
1426 \put(35,0){\line(-1,0){30}}
1427 \put(0,30){\circle{10}}
1428 \put(-5,30){\line(1,0){10}}
1429 \put(0,35){\line(0,-1){30}}
1430 \end{picture}%
1431 }
1432 % \end{macrocode}
1433 % \end{macro}
1434 %
1435 %
1436 %
1437 %
1438 %^^A--------------------------------------------------------------------
1439 %
1440 %
1441 %
1442 %
1443 % \begin{macro}{\CROP@@llc}
1444 % The \option{cam} mode corner mark for the lower left corner.
1445 %
1446 % \begin{macrocode}
1447 \newcommand*\CROP@@llc{%
1448 \begin{picture}(0,0)
1449 \unitlength\p@\thinlines
1450 \put(-30,0){\circle{10}}
1451 \put(-30,-5){\line(0,1){10}}
1452 \put(-35,0){\line(1,0){30}}
1453 \put(0,-30){\circle{10}}
1454 \put(-5,-30){\line(1,0){10}}
1455 \put(0,-35){\line(0,1){30}}
1456 \end{picture}%
1457 }
1458 % \end{macrocode}
1459 % \end{macro}
1460 %
1461 %
1462 %
1463 %
1464 %^^A--------------------------------------------------------------------
1465 %
1466 %
1467 %
1468 %
1469 % \begin{macro}{\CROP@@lrc}
1470 % The \option{cam} mode corner mark for the lower right corner.
1471 %
1472 % \begin{macrocode}
1473 \newcommand*\CROP@@lrc{%
1474 \begin{picture}(0,0)
1475 \unitlength\p@\thinlines
1476 \put(30,0){\circle{10}}
1477 \put(30,-5){\line(0,1){10}}
1478 \put(35,0){\line(-1,0){30}}
1479 \put(0,-30){\circle{10}}
1480 \put(-5,-30){\line(1,0){10}}
1481 \put(0,-35){\line(0,1){30}}
1482 \end{picture}%
1483 }
1484 % \end{macrocode}
1485 % \end{macro}
1486 %
1487 %
1488 %
1489 %
1490 %^^A--------------------------------------------------------------------
1491 %
1492 %
1493 %
1494 %
1495 % \begin{macro}{\CROP@opt@cam}
1496 % Define the \option{cam} mode switch with four different marks.
1497 %
1498 % \begin{macrocode}
1499 \cropdef\CROP@@ulc\CROP@@urc\CROP@@llc\CROP@@lrc{cam}
1500 % \end{macrocode}
1501 % \end{macro}
1502 %
1503 %
1504 %
1505 %
1506 %^^A--------------------------------------------------------------------
1507 %
1508 %
1509 %
1510 %
1511 % \begin{macro}{\CROP@@cross}
1512 % This macro provides a 4~cm wide cross.
1513 %
1514 % \begin{macrocode}
1515 \newcommand*\CROP@@cross{%
1516 \begin{picture}(0,0)
1517 \unitlength1cm\thinlines
1518 \put(-2,0){\line(1,0){4}}
1519 \put(0,-2){\line(0,1){4}}
1520 \end{picture}%
1521 }
1522 % \end{macrocode}
1523 % \end{macro}
1524 %
1525 %
1526 %
1527 %
1528 %^^A--------------------------------------------------------------------
1529 %
1530 %
1531 %
1532 %
1533 % \begin{macro}{\CROP@opt@cross}
1534 % Define the \option{cross} mode switch with four times the same mark.
1535 %
1536 % \begin{macrocode}
1537 \cropdef\CROP@@cross\CROP@@cross\CROP@@cross\CROP@@cross{cross}
1538 % \end{macrocode}
1539 % \end{macro}
1540 %
1541 %
1542 %
1543 %
1544 %^^A--------------------------------------------------------------------
1545 %
1546 %
1547 %
1548 %
1549 % \begin{macro}{\CROP@@frame}
1550 % The \option{frame} mode draws a simple frame around the logical
1551 % page. The frame mark is designed to be used in the upper left
1552 % corner. Since graphics commands expect numbers without dimensions,
1553 % |\paperwidth| and \hbox{-|height|} are transformed to numbers
1554 % (representing printer's points). This is done by stripping off the
1555 % unit~|pt|.
1556 %
1557 % \begin{macrocode}
1558 \newcommand*\CROP@@frame{%
1559 \begin{picture}(0,0)
1560 \unitlength\p@\thinlines
1561 \put(0,0){\line(1,0){\strip@pt\paperwidth}}
1562 \put(0,0){\line(0,-1){\strip@pt\paperheight}}
1563 \put(\strip@pt\paperwidth,0){\line(0,-1){\strip@pt\paperheight}}
1564 \put(0,-\strip@pt\paperheight){\line(1,0){\strip@pt\paperwidth}}
1565 \end{picture}%
1566 }
1567 % \end{macrocode}
1568 % \end{macro}
1569 %
1570 %
1571 %
1572 %
1573 %^^A--------------------------------------------------------------------
1574 %
1575 %
1576 %
1577 %
1578 % \begin{macro}{\CROP@opt@frame}
1579 % Define the \option{frame} mode switch with only one mark. The other
1580 % corners may |\relax|.
1581 %
1582 % \begin{macrocode}
1583 \cropdef\CROP@@frame\relax\relax\relax{frame}
1584 % \end{macrocode}
1585 % \end{macro}
1586 %
1587 %
1588 %
1589 %
1590 %^^A--------------------------------------------------------------------
1591 %
1592 %
1593 %
1594 %
1595 % \subsection{The kernel}
1596 %
1597 % \begin{macro}{\CROP@shipout}
1598 % \begin{macro}{\shipout}
1599 % \begin{macro}{\CROP@ship}
1600 % \begin{macro}{\CROP@shiplist}
1601 % \begin{macro}{\CROP@@ship}
1602 %
1603 % These macros redefine the \TeX\ primitive |\shipout| to insert the
1604 % contents of the macro |\CROP@shiplist| on top of the box which contains
1605 % the page contents ready for output, after which the original
1606 % |\shipout| command is executed.
1607 %
1608 % \begin{macrocode}
1609 \let\CROP@shipout\shipout
1610 \renewcommand*\shipout{%
1611 \afterassignment\CROP@ship
1612 \setbox\@cclv=%
1613 }
1614 \newcommand*\CROP@ship{%
1615 \ifvoid\@cclv
1616 \expandafter\aftergroup
1617 \fi
1618 \CROP@@ship
1619 }
1620 \newcommand*\CROP@shiplist{%
1621 \lineskip\z@
1622 \lineskiplimit\z@
1623 \baselineskip\z@
1624 \CROP@kernel
1625 \box\@cclv
1626 }
1627 \newcommand*\CROP@@ship{%
1628 \csname CROP@shiphook\endcsname
1629 \CROP@shipout\vbox{\CROP@shiplist}%
1630 }
1631 % \end{macrocode}
1632 % \end{macro}
1633 % \end{macro}
1634 % \end{macro}
1635 % \end{macro}
1636 % \end{macro}
1637 %
1638 %
1639 %
1640 %
1641 %^^A--------------------------------------------------------------------
1642 %
1643 %
1644 %
1645 %
1646 % \begin{macro}{\CROP@shipadd}
1647 % This macro adds a page manipulation command to the \emph{shiplist},
1648 % which gets every ready page as argument.
1649 %
1650 % \begin{macrocode}
1651 \newcommand*\CROP@shipadd[1]{%
1652 \bgroup
1653 \toks@\expandafter{\expandafter#1\expandafter{\CROP@shiplist}}%
1654 \xdef\CROP@shiplist{\the\toks@}%
1655 \egroup
1656 }
1657 % \end{macrocode}
1658 % \end{macro}
1659 %
1660 %
1661 %
1662 %
1663 %^^A--------------------------------------------------------------------
1664 %
1665 %
1666 %
1667 %
1668 % \begin{macro}{\CROP@kernel}
1669 % \begin{macro}{\CROP@marks}
1670 % \begin{macro}{\CROP@@@marks}
1671 % \begin{macro}{\CROP@setmarkcolor}
1672 % \begin{macro}{\CROP@user@a}
1673 % \begin{macro}{\CROP@user@b}
1674 % \begin{macro}{\CROP@opt@horigin}
1675 % \begin{macro}{\CROP@opt@vorigin}
1676 % |\CROP@kernel| essentially contains a |\vbox| with zero width and
1677 % height. The |\CROP@hook| command---which normally equals
1678 % |\relax|---allows to insert commands that modify the behavior of the
1679 % selected mode (see the options \option{mount1} and \option{mount2}).
1680 % |\CROP@user@a| and |\CROP@user@b| are user definable hooks.
1681 %
1682 % \begin{macrocode}
1683 \newcommand*\CROP@kernel{%
1684 \vbox to\z@{%
1685 \vskip\CROP@vorigin
1686 \hb@xt@\z@{%
1687 \hskip\CROP@horigin
1688 \vbox to\paperheight{%
1689 \let\protect\relax
1690 \hsize\paperwidth
1691 \CROP@hook
1692 \CROP@user@a
1693 \CROP@drawstockcolor
1694 \CROP@drawpagecolor
1695 \CROP@@@marks
1696 }%
1697 \hss
1698 }%
1699 \vss
1700 }%
1701 }
1702 \newcommand*\CROP@marks{%
1703 \CROP@setmarkcolor
1704 \CROP@user@b
1705 \CROP@ulc\null\hfill\CROP@@@info\CROP@upedge\hfill\null\CROP@urc
1706 \vfill
1707 \CROP@ledge\hfill\CROP@redge
1708 \vfill
1709 \CROP@llc\null\hfill\CROP@loedge\hfill\null\CROP@lrc
1710 }
1711 \let\CROP@@@marks\CROP@marks
1712 \newcommand*\CROP@setmarkcolor{%
1713 \let\current@color\CROP@markcolor
1714 \set@color
1715 }
1716 \let\CROP@user@a\relax
1717 \let\CROP@user@b\relax
1718 \newcommand*\CROP@opt@horigin{\let\CROP@horigin\CROP@@}
1719 \newcommand*\CROP@opt@vorigin{\let\CROP@vorigin\CROP@@}
1720 % \end{macrocode}
1721 % \end{macro}
1722 % \end{macro}
1723 % \end{macro}
1724 % \end{macro}
1725 % \end{macro}
1726 % \end{macro}
1727 % \end{macro}
1728 % \end{macro}
1729 %
1730 %
1731 %
1732 %
1733 %^^A--------------------------------------------------------------------
1734 %
1735 %
1736 %
1737 %
1738 % \begin{macro}{\CROP@opt@off}
1739 % \begin{macro}{\CROP@opt@odd}
1740 % \begin{macro}{\CROP@opt@even}
1741 % These macros start and stop the output of crop marks.
1742 %
1743 % \begin{macrocode}
1744 \newcommand*\CROP@opt@off{%
1745 \let\CROP@@@marks\vfil
1746 }
1747 \newcommand*\CROP@opt@odd{%
1748 \def\CROP@@@marks{\ifodd\c@page\CROP@marks\else\vfil\fi}%
1749 }
1750 \newcommand*\CROP@opt@even{%
1751 \def\CROP@@@marks{\ifodd\c@page\vfil\else\CROP@marks\fi}%
1752 }
1753 % \end{macrocode}
1754 % \end{macro}
1755 % \end{macro}
1756 % \end{macro}
1757 %
1758 %
1759 %
1760 %
1761 %^^A--------------------------------------------------------------------
1762 %
1763 %
1764 %
1765 %
1766 % \begin{macro}{\CROP@@@info}
1767 % \begin{macro}{\CROP@opt@info}
1768 % \begin{macro}{\CROP@opt@noinfo}
1769 % \begin{macro}{\CROP@opt@axes}
1770 % \begin{macro}{\CROP@opt@noaxes}
1771 % Enable and disable the output of axis marks and page info.
1772 %
1773 % \begin{macrocode}
1774 \newcommand*\CROP@@@info{}
1775 \newcommand*\CROP@opt@info{\def\CROP@@@info{\CROP@info}}
1776 \newcommand*\CROP@opt@noinfo{\let\CROP@@@info\relax}
1777 \newcommand*\CROP@opt@axes{%
1778 \let\CROP@ledge\CROP@@laxis
1779 \let\CROP@redge\CROP@@raxis
1780 \let\CROP@upedge\CROP@@upaxis
1781 \let\CROP@loedge\CROP@@loaxis
1782 }
1783 \newcommand*\CROP@opt@noaxes{%
1784 \let\CROP@ledge\relax
1785 \let\CROP@redge\relax
1786 \let\CROP@upedge\relax
1787 \let\CROP@loedge\relax
1788 }
1789 % \end{macrocode}
1790 % \end{macro}
1791 % \end{macro}
1792 % \end{macro}
1793 % \end{macro}
1794 % \end{macro}
1795 %
1796 %
1797 %
1798 %
1799 %^^A--------------------------------------------------------------------
1800 %
1801 %
1802 %
1803 %
1804 % \subsection{Mounting}
1805 %
1806 % \begin{macro}{\CROP@opt@mount1}
1807 % \begin{macro}{\CROP@opt@mount2}
1808 % Since |\newcommand| doesn't allow macro names to contain non-letters,
1809 % we need a construction with |\csname|, |\endcsname|, and
1810 % |\expandafter|. |\@namedef| would have worked, too, but it would not
1811 % have made a check for redefinitions.
1812 %
1813 % \begin{macrocode}
1814 \expandafter\newcommand\expandafter*\csname CROP@opt@mount1\endcsname{%
1815 \let\CROP@hook\relax
1816 }
1817 \newcount\CROP@offset
1818 \expandafter\newcommand\expandafter*\csname CROP@opt@mount2\endcsname{%
1819 \CROP@offset=\ifx\CROP@@\@empty\z@\else\CROP@@\fi
1820 \def\CROP@hook{%
1821 \count@\c@page
1822 \advance\count@\CROP@offset
1823 \ifodd\count@
1824 \let\CROP@ulc\relax
1825 \let\CROP@llc\relax
1826 \let\CROP@ledge\relax
1827 \else
1828 \let\CROP@urc\relax
1829 \let\CROP@lrc\relax
1830 \let\CROP@redge\relax
1831 \fi
1832 }%
1833 }
1834 % \end{macrocode}
1835 % \end{macro}
1836 % \end{macro}
1837 %
1838 %
1839 %
1840 %
1841 %^^A--------------------------------------------------------------------
1842 %
1843 %
1844 %
1845 %
1846 % \subsection{Page manipulation}
1847 %
1848 % \begin{macro}{\CROP@reflect}
1849 % \begin{macro}{\CROP@genreflect}
1850 % \begin{macro}{\CROP@rotate}
1851 % \begin{macro}{\CROP@genrotate}
1852 % The \option{mirror} and \option{rotate} options add a macro to the
1853 % \emph{shiplist,} which then gets every output page and embeds it in
1854 % a \POSTSCRIPT\ environment (\option{dvips}) or lets the
1855 % \package{graphics} package reflect or rotate it (\option{pdftex} or
1856 % \option{luatex}).
1857 % We could also use the generic operations |\CROP@genreflect| and
1858 % |\CROP@genrotate| for the \option{dvips} mode. They would produce
1859 % correct \PS\ documents, the intermediate \DVI\ document, however,
1860 % would be unreadable.
1861 %
1862 % \begin{macrocode}
1863 \DeclareOption{mirror}{%
1864 \AtBeginDocument{\CROP@shipadd\CROP@reflect}
1865 }
1866 \newcommand*\CROP@reflect[1]{%
1867 \vbox to\z@{%
1868 \vskip\CROP@vorigin
1869 \hb@xt@\z@{%
1870 \hskip\CROP@horigin
1871 \CROP@ps{gsave currentpoint}%
1872 \kern\paperwidth
1873 \CROP@ps{currentpoint}%
1874 \hss
1875 }%
1876 \vss
1877 }%
1878 \CROP@ps{translate -1 1 scale neg exch neg exch translate}%
1879 \vbox{#1}%
1880 \CROP@ps{grestore}%
1881 }
1882 \newcommand*\CROP@genreflect[1]{%
1883 \leavevmode
1884 \dimen0\CROP@horigin
1885 \kern2\dimen0
1886 \reflectbox{%
1887 \hb@xt@\paperwidth{%
1888 \vbox to\paperheight{%
1889 #1%
1890 \vss
1891 }%
1892 \hss
1893 }%
1894 }%
1895 }
1896 \DeclareOption{rotate}{%
1897 \AtBeginDocument{\CROP@shipadd\CROP@rotate}
1898 }
1899 \newcommand*\CROP@rotate[1]{%
1900 \hb@xt@\z@{%
1901 \hskip\CROP@horigin
1902 \vbox to\z@{%
1903 \vskip\CROP@vorigin
1904 \CROP@ps{gsave currentpoint}%
1905 \kern\paperheight
1906 \hb@xt@\z@{%
1907 \kern\paperwidth
1908 \CROP@ps{currentpoint}%
1909 \hss
1910 }%
1911 \vss
1912 }%
1913 \hss
1914 }%
1915 \CROP@ps{translate 180 rotate neg exch neg exch translate}%
1916 \vbox{#1}%
1917 \CROP@ps{grestore}%
1918 }
1919 \newcommand*\CROP@genrotate[1]{%
1920 \dimen0\CROP@vorigin
1921 \kern2\dimen0
1922 \leavevmode
1923 \dimen0\CROP@horigin
1924 \kern2\dimen0
1925 \rotatebox{180}{%
1926 \hb@xt@\paperwidth{%
1927 \vbox to\paperheight{%
1928 #1%
1929 \vss
1930 }%
1931 \hss
1932 }%
1933 }%
1934 }
1935 % \end{macrocode}
1936 % \end{macro}
1937 % \end{macro}
1938 % \end{macro}
1939 % \end{macro}
1940 %
1941 %
1942 %
1943 %
1944 %^^A--------------------------------------------------------------------
1945 %
1946 %
1947 %
1948 %
1949 % \subsection{Color handling}
1950 %
1951 % \begin{macro}{\CROP@stockcolor}
1952 % \begin{macro}{\CROP@pagecolor}
1953 % \begin{macro}{\set@page@color}
1954 % \begin{macro}{\CROP@needscolor}
1955 % \begin{macro}{\CROP@defmarkcolor}
1956 % \begin{macro}{\CROP@opt@color}
1957 % \begin{macro}{\CROP@drawstockcolor}
1958 % \begin{macro}{\CROP@drawpagecolor}
1959 % \begin{macro}{\CROP@overlap}
1960 % \begin{macro}{\CROP@opt@overlap}
1961 % These macros care for the color of crop marks and of the logical and
1962 % the physical page. The \option{overlap} value is the amount that
1963 % the logical page is drawn over the page boundaries on each side.
1964 % This is necessary to get good results on imprecise cutting machines.
1965 %
1966 % \begin{macrocode}
1967 \newcommand*\CROP@defmarkcolor[1]{{%
1968 \def\set@color{\global\let\CROP@markcolor\current@color}%
1969 \@declaredcolor{#1}%
1970 }}
1971 \ifx\CROP@needscolor\@empty
1972 \renewcommand*\set@page@color{%
1973 \global\let\CROP@stockcolor\current@color
1974 }%
1975 \AtBeginDocument{%
1976 \def\set@page@color{%
1977 \global\let\CROP@pagecolor\current@color
1978 }%
1979 }%
1980 \CROP@defmarkcolor{black}%
1981 \let\CROP@needscolor\relax
1982 \fi
1983 \newcommand*\CROP@opt@color{%
1984 \CROP@needscolor
1985 \expandafter\CROP@defmarkcolor\expandafter{\CROP@@}%
1986 }
1987 \newcommand*\CROP@drawstockcolor{%
1988 \ifx\CROP@stockcolor\@empty
1989 \else
1990 \rlap{%
1991 \smash{%
1992 \raise\voffset\hbox{%
1993 \let\current@color\CROP@stockcolor
1994 \set@color
1995 \hskip-\hoffset
1996 \vrule width\stockwidth height\z@ depth\stockheight
1997 }%
1998 }%
1999 }%
2000 \fi
2001 }
2002 \newcommand*\CROP@drawpagecolor{%
2003 \ifx\CROP@pagecolor\@empty
2004 \else
2005 \rlap{%
2006 \smash{%
2007 \dimen@\CROP@overlap
2008 \advance\paperwidth2\dimen@
2009 \advance\paperheight2\dimen@
2010 \raise\dimen@\hbox{%
2011 \let\current@color\CROP@pagecolor
2012 \set@color
2013 \hskip-\dimen@
2014 \vrule width\paperwidth height\z@ depth\paperheight
2015 }%
2016 }%
2017 }%
2018 \fi
2019 }
2020 \def\CROP@overlap{3truemm}
2021 \newcommand*\CROP@opt@overlap{\let\CROP@overlap\CROP@@}
2022 % \end{macrocode}
2023 % \end{macro}
2024 % \end{macro}
2025 % \end{macro}
2026 % \end{macro}
2027 % \end{macro}
2028 % \end{macro}
2029 % \end{macro}
2030 % \end{macro}
2031 % \end{macro}
2032 % \end{macro}
2033 %
2034 %
2035 %
2036 %
2037 %^^A--------------------------------------------------------------------
2038 %
2039 %
2040 %
2041 %
2042 % \begin{macro}{\CROP@invert}
2043 % The \option{invert} option simply switches to black background
2044 % and white text, after which it disables all color
2045 % switching commands. The \option{notext} option does the same
2046 % with white text on white background. The |\@gobble| on the last
2047 % line keeps \option{notext} from switching to white background
2048 % and breaking a prior \option{invert}.
2049 %
2050 % \begin{macrocode}
2051 \newcommand*\CROP@invert[1]{%
2052 \CROP@needscolor
2053 \AtBeginDvi{%
2054 \pagecolor{#1}%
2055 \global\let\set@page@color\relax
2056 \global\let\CROP@setpagecolor\relax
2057 }%
2058 \color{white}%
2059 \DeclareRobustCommand*\color[2][]{}%
2060 \let\pagecolor\color
2061 \let\textcolor\color
2062 \let\CROP@invert\@gobble
2063 }
2064 \DeclareOption{invert}{%
2065 \CROP@invert{black}%
2066 \let\CROP@setmarkcolor\relax
2067 }
2068 \DeclareOption{notext}{%
2069 \CROP@invert{white}%
2070 }
2071 % \end{macrocode}
2072 % \end{macro}
2073 %
2074 %
2075 %
2076 %
2077 %^^A--------------------------------------------------------------------
2078 %
2079 %
2080 %
2081 %
2082 % \subsection{The graphics commands}
2083 %
2084 % \begin{macro}{\CROP@opt@nographics}
2085 % \begin{macro}{\CROP@opt@graphics}
2086 % The \option{nographics} option redefines the |\Ginclude@graphics|
2087 % command from the \package{graphics} package, so that it outputs its
2088 % argument as a phantom. This makes the image invisible but takes up
2089 % the same amount of white space. The \option{graphics} option
2090 % re-enables graphics.
2091 %
2092 % \begin{macrocode}
2093 \newcommand*\CROP@opt@nographics{%
2094 \def\Ginclude@graphics##1{%
2095 \phantom{%
2096 \CROP@Ginclude@graphics{##1}%
2097 }%
2098 }%
2099 }%
2100 \newcommand*\CROP@opt@graphics{%
2101 \let\Ginclude@graphics\CROP@Ginclude@graphics
2102 }
2103 % \end{macrocode}
2104 % \end{macro}
2105 % \end{macro}
2106 %
2107 %
2108 %
2109 %
2110 %^^A--------------------------------------------------------------------
2111 %
2112 %
2113 %
2114 %
2115 % \subsection{Final settings}
2116 %
2117 % \begin{macro}{\CROP@horigin}
2118 % \begin{macro}{\CROP@vorigin}
2119 % Switch off marks and axes, set one page per sheet,
2120 % load the local configuration file, and
2121 % process the requested options. Finally: Exit.
2122 %
2123 % Notice that we cannot simply use |\ExecuteOptions| to preselect
2124 % options \option{off}, \option{noaxes}, \option{info}, and
2125 % \option{mount1}, because it does not accept default options declared
2126 % with |\DeclareOption*|. |\@nameuse| doesn't complain if the command
2127 % sequence is undefined. We let this only be executed |\AtBeginDocument|,
2128 % because there are possibly commands from the \option{center} option
2129 % in the queue that have to be processed first.
2130 %
2131 % \begin{macrocode}
2132 \newcommand*\CROP@horigin{-1truein}
2133 \newcommand*\CROP@vorigin{-1truein}
2134 \crop[cam,off,noaxes,info,mount1]
2135 \InputIfFileExists{crop.cfg}{%
2136 \PackageInfo{crop}{Local config file crop.cfg used}
2137 }{}
2138 \ProcessOptions
2139 \AtBeginDocument{\@nameuse{CROP@init@\CROP@driver}}
2140 \endinput
2141 %</package>
2142 % \end{macrocode}
2143 % \end{macro}
2144 % \end{macro}
2145 %
2146 %
2147 %
2148 %
2149 %^^A--------------------------------------------------------------------
2150 %
2151 %
2152 %
2153 %
2154 % \subsection{A \option{mount4} example}
2155 % \label{sec:mount4}
2156 %
2157 % Since a \option{mount4} mode is likely to be subject to specific local
2158 % needs, there's only a suggestion provided, which supports a page
2159 % arrangement as shown in figure \ref{fig:mount4}.
2160 %
2161 % \begin{figure}
2162 % \begin{center}
2163 % \vspace*{10pt}
2164 % \makeatletter \catcode`\|=12
2165 % \sffamily\bfseries
2166 % \begin{tabular}{|c|c|}
2167 % \hline
2168 % \vrule\@height16\p@\@depth8\p@\@width\z@ 2&1\\
2169 % \hline
2170 % \vrule\@height16\p@\@depth8\p@\@width\z@ 0&3\\
2171 % \hline
2172 % \end{tabular}
2173 % \vspace*{-10pt}
2174 % \end{center}
2175 % \caption{Possible \option{mount4} arrangement}
2176 % \label{fig:mount4}
2177 % \end{figure}
2178 %
2179 %
2180 % First of all |\CROP@offset| is set to the value of the (optional)
2181 % argument or zero.
2182 % Then |\CROP@hook| is defined first to set |\count@| to the page number
2183 % increased by this offset: $p=\mbox{pagenumber}+\mbox{offset}$.
2184 % \medbreak
2185 %
2186 % {\def\MacroFont{\small\ttfamily\itshape}%
2187 %\begin{verbatim}
2188 %\expandafter\newcommand\expandafter*\csname CROP@opt@mount4\endcsname{%
2189 % \CROP@offset=\ifx\CROP@@\@empty\z@\else\CROP@@\fi
2190 % \def\CROP@hook{%
2191 % \count@\c@page
2192 % \advance\count@\CROP@offset
2193 %\end{verbatim}
2194 %
2195 % \noindent
2196 % Now bits~0 and~1 are checked via |\ifodd| to get
2197 % $p$ modulo 4, after which the respective marks are deleted.
2198 % The comments in the example use for simplicity C-notation in which
2199 % `|%|' is the modulo or remainder operator, `|==|' the equal, and
2200 % `{\catcode`\|=12\texttt{||}}' the logical (inclusive) OR operator.
2201 %
2202 %\begin{verbatim}
2203 % \ifodd\count@ %% if (p % 4 == 1 || p % 4 == 3)
2204 % \let\CROP@ulc\relax
2205 % \let\CROP@llc\relax
2206 % \let\CROP@ledge\relax
2207 % \divide\count@2
2208 % \ifodd\count@ %% if (p % 4 == 3)
2209 % \let\CROP@urc\relax
2210 % \let\CROP@info\relax
2211 % \let\CROP@upedge\relax
2212 % \else %% if (p % 4 == 1)
2213 % \let\CROP@lrc\relax
2214 % \let\CROP@loedge\relax
2215 % \fi
2216 % \else %% if (p % 4 == 0 || p % 4 == 2)
2217 % \let\CROP@urc\relax
2218 % \let\CROP@lrc\relax
2219 % \let\CROP@redge\relax
2220 % \divide\count@2
2221 % \ifodd\count@ %% if (p % 4 == 2)
2222 % \let\CROP@llc\relax
2223 % \let\CROP@loedge\relax
2224 % \else %% if (p % 4 == 0)
2225 % \let\CROP@ulc\relax
2226 % \let\CROP@info\relax
2227 % \let\CROP@upedge\relax
2228 % \fi
2229 % \fi
2230 % }%
2231 %}
2232 %\end{verbatim}
2233 % }
2234 %
2235 % ^^A \PrintChanges
2236 % ^^A vim:ts=4:sw=4:et:cindent
2237 % \Finale ^^A.E.I.O.U.^^