% \iffalse %% File: crop.dtx Copyright (C) 1998,1999,2000,2001,2002 Melchior FRANZ %% $Id: crop.dtx,v 1.33 2002/05/14 14:50:52 m Exp $ %<*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.7", %% date = "14 May 2002", %% filename = "crop.dtx", %% address = "Melchior FRANZ %% Rieder Hauptstrasse 52 %% A-5212 SCHNEEGATTERN %% AUSTRIA", %% telephone = "++43 7746 3109", %% URL = "http://www.unet.univie.ac.at/~a8603365/", %% email = "a8603365@unet.univie.ac.at", %% codetable = "ISO/ASCII", %% keywords = "cropmarks, frame, mirror, rotate, invert", %% supported = "yes", %% docstring = "This document describes the crop package, which %% provides different forms of cropmarks 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 marking %% the vertical and horizontal middle axis, 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. % % % % %<*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} % % % % %<*driver> \def\fileversion{1.7} \def\filedate{2002/05/14} \documentclass[draft]{ltxdoc} % \newcommand*\option{\textsf} % mode/option names are typeset this way \newcommand*\package{\texttt} \newcommand*\program{\texttt} \newcommand*\person{\textsc} \newcommand*\CROP{\package{crop}} \newcommand*\PS{\textsc{\small PS}} \newcommand*\POSTSCRIPT{\textsc{PostScript}} \newcommand*\DVI{\textsc{\small DVI}} \newcommand*\FIXME{\message{}} % % % \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 \DocInput{crop.dtx} \end{document} % % \fi % % % \CheckSum{851} % \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 \package{crop} package} % % \author{Melchior \textsc{FRANZ}} % \date{May 14, 2002} % \maketitle % % % \changes{v1.0}{1998/05/20}{Initial version}% % % \changes{v1.1a}{1998/10/20}{`smash replaced; The cropmarks % 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} % % % % % \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 cropmarks 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 marking the vertical and horizontal middle axis, 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} % % These options may only be used in the preamble and have to be stated % as arguments to the |\usepackage| command (e.\,g.~|\usepackage[frame]{crop}|). % % \begin{labeling}{\indent\indent} % \changes{v1.5}{2001/10/07}{paper size options added}% % \item[\sffamily 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. They are mandatory % if the \option{center} option is used and optional if one of the \option{dvips}, % \option{pdftex} and \option{vtex} options is used, in which case the paper size is % passed to the respective \DVI\ device driver. % % \changes{v1.7}{2002/05/14}{width/height added}% % \item[\sffamily width, height]--- % Instead of using one of the pre-defined paper formats as described % above, you can also set the paper dimensions directly. You can omit % the `|true|' specifier if you don't plan to scale the document. % Example: |\usepackage[cam,width=10truecm,height=13truecm]{crop}| % % \changes{v1.1}{1998/07/01}{center options added}% % \changes{v1.5}{2001/10/07}{center options replaced by a separate center option}% % \item[\sffamily center] % This option centers the logical document page on the physical printer paper % and requires therefore, that you declare the sheet size properly. Write % e.\,g.~|\usepackage[cam,a4,center]{crop}| to center a document of any size % on \textsc{ISO-A4} sheets. If no paper size is chosen you get an error % message, but you can proceed nevertheless. % % \item[\sffamily landscape]--- % Use this option in addition to the \option{center} option if you want % to center a document on \emph{landscape oriented} paper. Note that it has nothing % to do with the standard |landscape| option. % % \changes{v1.5}{2001/10/07}{options `dvips', `pdftex', `vtex' and `nodriver' added}% % \changes{v1.6}{2001/11/16}{option `pdflatex' added}% % \item[\sffamily 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 you are planning to print on to % the respective program. Especially viewer programs like \program{gs} or \program{gv} % make use of that \emph{bounding box} information. % This requires, of course, that you also choose one of the paper size % options mentioned above (e.\,g.~|[letter,dvips]|). % If none of the driver options is given, \CROP\ automatically % uses the \package{graphics} driver that your installation suggests % (see the |graphics.cfg| file). The \option{nodriver} % option suppresses this automatism. This is, for example, required if a document scaled % with \TeX's |\mag| register is to be processed by \program{ghostcript}. % \option{pdflatex} is a synonym for \option{pdftex}. % % \changes{v1.2}{1998/12/07}{mirror option added} % \item[\sffamily mirror] % This option reflects the whole document, provided that the \DVI\ output % driver handles \POSTSCRIPT\ |\special|'s. It uses the standard graphics interfaces, % if the \package{graphics} package could be found or the \package{color} package is included, % or a matching interface file such as |dvips.def|. % If no interface is defined, the package uses its internal, less portable macros. % % \changes{v1.4}{2000/02/02}{rotate option added} % \item[\sffamily 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. % This option relies on \PS, just like the \option{mirror} option. % % \changes{v1.2}{1998/12/07}{invert option added} % \item[\sffamily 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 an % output device that is capable of executing \PS\ commands. All further color % changing commands stated in the document are ignored. This option is ignored % after a \option{notext} option request. % % \changes{v1.5}{2001/10/07}{notext option added} % \item[\sffamily 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. Note that neither cropmarks nor the info line are shown. % See the description of the options \option{nographics} and % \option{graphics} on page~\pageref{graphics} for an explanation. % This option is ignored after an \option{invert} option request. % \end{labeling} % % % % % % % % \subsection{Runtime options} % % These options may be used in the preamble like the `conventional' options % (see above), but also as arguments to the |\crop| command everywhere in the % document (e.\,g.~|\crop[frame]|). % % \begin{labeling}{\indent\indent} % \item[\sffamily cam] % This mode provides four different marks (see figure \ref{fig:marks}), % one for each corner, which show 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[\sffamily cross] % This mode provides four two inch wide crosses (see figure % \ref{fig:marks}), one at each corner that touch the logical paper % edge. That's the reason why they should be printed on an extra page % to be used as a cover page while trimming the whole paper stack. % (This is also the \emph{Red Cross} mode ;-) % % \item[\sffamily frame] % This mode draws a frame around the logical page and is mainly thought % for visualizing the document page dimensions. % % \item[\sffamily 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. % % \changes{v1.7}{2002/05/14}{odd, even options added}% % \item[\sffamily odd, even]--- % Use these options to let the cropmarks be put on odd\slash even pages only. % The marks must have been turned on before, using one of the options |cam|, % |cross|, or |frame|, otherwise there will be no effect. Note that only % the page number is considered. If you have two subsequent pages both with % page number 1 and give the |odd| option, then both pages will have % marks. % % \item[\sffamily axes, noaxes]--- % These options enable\slash disable the output of little marks which % show the horizontal and vertical middle axis of the logical page and % may be selected in addition to one of the above modes. These marks % might be needed for punching. Notice that they are lost after % trimming, since they lie outside the logical page. % These marks are disabled by default. % % \changes{v1.4}{2000/02/02}{info/noinfo options added} % \item[\sffamily info, noinfo]--- % Show the page info 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, so that it is more % reliable than page numbers, which are not unique and may be negative or % contain letters. It can also be seen as a cropmarks counter. % This page information is enabled by default. % % \changes{v1.6}{2001/11/16}{font option added} % \item[\sffamily 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 to the \option{font} option parameter. This command % may take one argument (like |\textsf{}|) or stand alone (like |\small|). % You may even use more than one command, but note that just the last % one is able to take the argument: |\crop[font=\small\textsf]|. You can, % of course, still define a more complex command first, and assign that % one: |\newcommand*\infofont[1]{\textcolor{blue}{\textsf{\small#1}}}| % |\crop[font=\infofont]| % % \changes{v1.1}{1998/07/01}{mount options added}% % \item[\sffamily 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} mode prints only the outer marks. % There's also a \option{mount1} mode that is selected by default. % These commands take a number as an optional argument serving % as a 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}.) % % \changes{v1.5}{2001/10/07}{options horigin and vorigin added}% % \item[\sffamily 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. % % \changes{v1.5}{2001/10/07}{options `graphics' and `nographics' added} % \item[\sffamily 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 through a color printer to % print the \option{notext} version, and then through a mono laser printer with the % \option{nographics} version. The \option{graphics} option turns graphics on again. You may % want to mark up every colored picture so that you can decide in the preamble, % whether they shall be printed or not. % % \begin{example}[.86\textwidth]^^A % |%\newcommand*\colorgraphics{} % print them|\\ % |\newcommand*\colorgraphics{\crop[nographics]} % don't!|\\ % |...|\\ % |{\colorgraphics|\\ % |\includegraphics{...}|\\ % |\caption{...}|\\ % |}| % \end{example} % \end{labeling} % % % % {\makeatletter % \ifx\CROPSTYfound\active % \begin{figure} % \begin{quote} % \begin{center} % \vspace{.6in} % \leavevmode % \hbox{\paperwidth9cm\CROP@@ulc\rlap{\CROP@@info}\hskip\paperwidth\CROP@@urc} % \vspace{.2in} % \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 % cropmarks 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 are to 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 A4~page on % A4~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\FIXME % % 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(s) 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{Custom document paper size} % % 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 \textsc{ISO-A4} 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 \package{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 all cases, 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! Some of \CROP's options depend very much on the used output device, % thus, always specify the correct driver option when you load \package{crop.sty}. % % % % % % \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} % % \noindent % You can select your own mode by typing |\crop[funny]|. % Local definitions like these 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 may 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} % |% introduce an option `oldinfo', which restores the page|\\ % |% information that was used in older package releases|\\ % |\newcommand*\CROP@opt@oldinfo{%|\\ % |\renewcommand*\CROP@@info{%|\\ % | \hskip\paperwidth\hskip12\p@|\\ % | \raise12\p@\hbox{\vbox{%|\\ % | \hbox{``\jobname''\strut}%|\\ % | \hbox{\the\year/\the\month/\the\day\strut}%|\\ % | \hbox{page \thepage\strut}}}}}| % \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{\small\textsf})|\\ % |\crop[font=\small\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 cropmarks 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{Compatibility} % % The package works with all \LaTeXe\ standard classes (tested with % \LaTeXe\ 1997/12/01), 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. % % \StopEventually{\addtocontents{toc}{\protect\end{multicols}}} % % % % % % % % %^^A max 72 columns %^^A-------------------------------------------------------------------- % % % % % \section{The macros} % % \subsection{Preamble} % % \begin{macro}{\CROP@driver} % \begin{macro}{\CROP@font} % The options \option{graphics} and \option{nographics} depend on the \package{graphics} % package, so we try to load it here. We don't complain now if it can't % be found, because we cannot say yet, if one of these options is used in % the document at all. Then we try to be clever and look if there's % a device dependent graphics driver already loaded, that we can use. % This information can, of course, be overridden by the driver options. % The |\CROP@font| macro is by default empty and can be changed % via the \option{font} option. % % \begin{macrocode} %<*package> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{crop}[2002/05/14 v1.7 cropmarks (mf)] \ifx\stockwidth\@undefined \newdimen\stockwidth \stockwidth\z@\fi \ifx\stockheight\@undefined \newdimen\stockheight \stockheight\z@\fi \newcount\CROP@index \CROP@index\z@ \newcommand*\CROP@driver{} \IfFileExists{graphics.sty}{% \RequirePackage{graphics}% \let\CROP@Ginclude@graphics\Ginclude@graphics \ifx\Gin@driver\@empty\else \filename@parse{\Gin@driver}% \edef\CROP@driver{\filename@base}% \fi }{} \newcommand*\CROP@font{} % \end{macrocode} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{Size options} % \changes{v1.3}{1999/03/07}{the center options are processed `AtBeginDocument} % \changes{v1.7}{2002/05/14}{width and height options added} % % \begin{macro}{\CROP@size} % \begin{macro}{\CROP@opt@width} % \begin{macro}{\CROP@opt@height} % These options set different standard printing paper sizes, which % are needed for centering and as hint for the \program{dvips}, % \program{pdftex} or \program{vtex} program. % Since the physical paper dimensions must not underlie % a possible scaling, |true| dimensions are taken. The \option{landscape} % option exchanges the |\hoffset| and |\voffset| values. % % \begin{macrocode} \newcommand*\CROP@size[2]{\stockwidth#1 \stockheight#2 } \DeclareOption{landscape}{% \def\CROP@size#1#2{\stockheight#1 \stockwidth#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}} \newcommand\CROP@opt@width{\stockwidth\CROP@@} \newcommand\CROP@opt@height{\stockheight\CROP@@} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@center} % The \option{center} option sets |\voffset| and |\hoffset| so that the document % pages are centered on the printing paper sheet. % % \begin{macrocode} \DeclareOption{center}{\AtEndOfPackage{\CROP@center}} \newcommand*\CROP@center{% \ifdim\stockwidth=\z@ \PackageError{crop}{% No printing paper size selected% }{% You have to select a paper size like `a4' or `height=20truecm,width=...' to be able to use the `center' option.% }% \else \voffset\stockheight \advance\voffset-\paperheight \voffset.5\voffset \hoffset\stockwidth \advance\hoffset-\paperwidth \hoffset.5\hoffset \fi } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{Runtime options handling} % % Every unknown option is passed to the macro |\CROP@execopt|. % % \begin{macrocode} \DeclareOption*{\CROP@execopt\CurrentOption} % \end{macrocode} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\crop} % The |\crop| macro allows runtime option requests. Every argument of % the optional argument list is passed to the macro |\CROP@execopt|. % The options \option{cam} and \option{noaxes} are selected by default. % % \begin{macrocode} \newcommand*\crop[1][cam,noaxes]{% \@for\CROP@@:=#1\do{\CROP@execopt\CROP@@}% } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@execopt} % Every execution of this macro with an argument $n$ leads to the % execution of a macro |\CROP@opt@|$n$ or a warning if no such exists. % Optional arguments (separated by an equal sign) are cut off and % stored in |\CROP@@|. % The macro tolerates even arguments for options that are not prepared % to handle arguments (e.\,g.~|cross=garbage|), or more than one argument % (e.\,g.~|mount2=1=garbage|). This is not a bug, it's a feature! % % \changes{v1.1}{1998/07/01}{Parsing optional option arguments}% % % \begin{macrocode} \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@}% }% } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\cropdef} % \changes{v1.1a}{1998/10/20}{`CROP@info is `def'ed now}% % The |\cropdef| macro defines a mode switch (see section % \ref{sec:cropdef}). % % \begin{macrocode} \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 }% } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{Axes and page info} % % \begin{macro}{\CROP@@vaxis} % \begin{macro}{\CROP@@haxis} % \changes{v1.1a}{1998/10/20}{`smash replaced}% % The standard definitions for the \option{axes} option. The |\CROP@@vaxis| % macro must have zero height and depth. % % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@time} % \begin{macro}{\CROP@@info} % \begin{macro}{\CROP@opt@font} % This macro prints the jobname, the current date and time, the page number % and an index number at the top of the page. % \changes{v1.3}{1999/03/07}{killed `uppercase; (devotion to LINUX)} % \changes{v1.5}{2001/10/07}{complete rewrite: time and line breaking added} % \changes{v1.6}{2001/11/16}{font option added} % % \begin{macrocode} \newcommand*\CROP@time{} \bgroup \count@\time \divide\time60 \count\@ne\time \multiply\time60 \advance\count@-\time \xdef\CROP@time{\the\count\@ne:\two@digits{\count@}} \egroup \newcommand*\CROP@@info{{% \global\advance\CROP@index\@ne \def\x{\discretionary{}{}{\hbox{\kern.5em---\kern.5em}}}% \hskip10\p@ \advance\paperwidth-20\p@ \raise10\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@@} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{The marks} % % The following four macros provide different marks for the \option{cam} % mode. They do not touch the logical page and can, thus, be printed % on every single sheet. % % \begin{macro}{\CROP@@ulc} % The \option{cam} mode corner mark for the upper left corner. % \begin{macrocode} \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}% } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@@urc} % The \option{cam} mode corner mark for the upper right corner. % % \begin{macrocode} \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}% } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@@llc} % The \option{cam} mode corner mark for the lower left corner. % % \begin{macrocode} \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}% } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@@lrc} % The \option{cam} mode corner mark for the lower right corner. % % \begin{macrocode} \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}% } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@opt@cam} % Define the \option{cam} mode switch with four different marks. % % \begin{macrocode} \cropdef\CROP@@ulc\CROP@@urc\CROP@@llc\CROP@@lrc{cam} % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@@cross} % This macro provides a 4~cm wide cross. % % \begin{macrocode} \newcommand*\CROP@@cross{% \begin{picture}(0,0) \unitlength2cm\thinlines \put(-1,0){\line(1,0){2}} \put(0,-1){\line(0,1){2}} \end{picture}% } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@opt@cross} % Define the \option{cross} mode switch with four times the same mark. % % \begin{macrocode} \cropdef\CROP@@cross\CROP@@cross\CROP@@cross\CROP@@cross{cross} % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@@frame} % The \option{frame} mode draws a simple frame around the document % page. The respective mark is designed to be used in the upper left % corner. Since graphics commands expect numbers without dimensions, % |\paperwidth| and \hbox{-|height|} are transformed to numbers % (representing printer's points). This is done by stripping off the % unit~|pt|. % % \begin{macrocode} \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}% } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@opt@frame} % Define the \option{frame} mode switch with only one mark. The other % corners may |\relax|. % % \begin{macrocode} \cropdef\CROP@@frame\relax\relax\relax{frame} % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{The kernel} % % \begin{macro}{\CROP@shipout} % \begin{macro}{\shipout} % \begin{macro}{\CROP@ship} % \begin{macro}{\CROP@shiplist} % \begin{macro}{\CROP@@ship} % \changes{v1.1}{1998/07/01}{kernel re-implemented completely new}% % \changes{v1.2}{1998/12/07}{`CROP@shiplist added, `CROP@@ship changed} % % These macros redefine the \TeX\ primitive |\shipout| to insert the % contents of the macro |\CROP@@@ship| on top of the box which contains % the page contents ready for output, after which the original % |\shipout| command is executed. % % \begin{macrocode} \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}% } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@shipadd} % \changes{v1.2}{1998/12/07}{`CROP@shipadd introduced} % This macro adds a \emph{page manipulation command} to the \emph{shiplist}, % which gets every ready page as argument. % % \begin{macrocode} \newcommand*\CROP@shipadd[1]{% \bgroup \toks@\expandafter{\expandafter#1\expandafter{\CROP@shiplist}}% \xdef\CROP@shiplist{\the\toks@}% \egroup } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@kernel} % \begin{macro}{\CROP@opt@horigin} % \begin{macro}{\CROP@opt@vorigin} % \changes{v1.1}{1998/07/01}{`CROP@every inserted}% % \changes{v1.1a}{1998/10/20}{`smash replaced}% % \changes{v1.2}{1998/12/07}{color support added}% % \changes{v1.5}{2001/10/07}{variable origin added}% % |\CROP@kernel| essentially contains a |\vbox| with zero width and height. % The |\CROP@every| command---which normally equals |\relax|---allows to % insert commands that modify the behavior of the selected mode % (see the options \option{mount1} and \option{mount2}). % % \begin{macrocode} \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@@} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@@@ship} % \begin{macro}{\CROP@on} % \begin{macro}{\CROP@opt@off} % \begin{macro}{\CROP@opt@odd} % \begin{macro}{\CROP@opt@even} % These macros start and stop the kernel mechanism. % % \begin{macrocode} \newcommand*\CROP@@@ship{} \newcommand*\CROP@on{\let\CROP@@@ship\CROP@kernel} \newcommand*\CROP@opt@off{\let\CROP@@@ship\relax} \newcommand*\CROP@opt@odd{% \def\CROP@@@ship{\ifodd\c@page\CROP@kernel\fi}% } \newcommand*\CROP@opt@even{% \def\CROP@@@ship{\ifodd\c@page\else\CROP@kernel\fi}% } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \begin{macro}{\CROP@@@info} % \begin{macro}{\CROP@opt@info} % \begin{macro}{\CROP@opt@noinfo} % \begin{macro}{\CROP@opt@axes} % \begin{macro}{\CROP@opt@noaxes} % \begin{macro}{\CROP@uedge} % \begin{macro}{\CROP@ledge} % Enable and disable the output of axis marks and page info. % % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{Mounting} % % \begin{macro}{\CROP@opt@mount1} % \begin{macro}{\CROP@opt@mount2} % Since |\newcommand| doesn't allow macro names to contain non-letters, % we need a somewhat strange construction using |\csname|, |\endcsname|, % and |\expandafter|. % |\@namedef| would have worked, too, but it would not have made a check % for redefinitions. % % \begin{macrocode} \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 }% } % \end{macrocode} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{Page manipulation} % % \changes{v1.2}{1998/12/07}{option `mirror' added} % \changes{v1.4}{2000/02/02}{option `rotate' added} % \changes{v1.5}{2001/10/07}{origin support added} % % \begin{macro}{\CROP@reflect} % \begin{macro}{\CROP@rotate} % \begin{macro}{\CROP@setps} % The \option{mirror} and \option{rotate} options add a macro to the \emph{shiplist,} % which then gets every output page and embeds it in a \POSTSCRIPT\ environment. % The \PS\ commands are only interpreted by \PS-aware output drivers % and do not affect the outcome on all other drivers. Raw \PS\ % commands are output via the \package{graphics} package's \POSTSCRIPT\ interface |\Gin@PS@raw|, % or the built-in |\CROP@ps|. The latter issues a warning, because it is % less portable. % % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{Color handling} % % \begin{macro}{\CROP@invert} % \changes{v1.2}{1998/12/07}{option `invert' added} % The \option{invert} option simply switches to black background % and white text, after which it disables all color % switching commands. % % \begin{macrocode} \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}} } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{The graphics commands} % % \begin{macro}{\CROP@opt@nographics} % \begin{macro}{\CROP@opt@graphics} % \changes{v1.5}{2001/10/07}{options `graphics' and `nographics' added} % The \option{nographics} option redefines the |\Ginclude@graphics| command from % the \package{graphics} package, so that it outputs its argument as a phantom. % This makes the image invisible but takes up the same amount of white space. % The \option{graphics} option re-enables graphics. % % \begin{macrocode} \newcommand*\CROP@opt@nographics{% \def\Ginclude@graphics##1{% \phantom{% \CROP@Ginclude@graphics{##1}% }% }% }% \newcommand*\CROP@opt@graphics{% \let\Ginclude@graphics\CROP@Ginclude@graphics } % \end{macrocode} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{The device drivers} % % \begin{macro}{\CROP@init@dvips} % \begin{macro}{\CROP@init@pdftex} % \begin{macro}{\CROP@init@vtex} % \begin{macro}{\CROP@driver} % \changes{v1.6}{2001/11/16}{driver options re-implemented} % \changes{v1.7}{2002/05/14}{nodriver option implemented} % These options are automatically selected (via definition in |graphics.cfg|) % and can as well be chosen explicitly. They do nothing else than handing % the given printer paper size over to the \DVI\ driver. This wouldn't % be necessary if there were some sort of standard. Sigh \dots % % \begin{macrocode} \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{}} \newcommand*\CROP@init@dvips{% \PackageInfo{crop}{using dvips graphics driver}% \AtBeginDvi{% \ifdim\stockwidth=\z@ \else \special{papersize=\the\stockwidth,\the\stockheight}% \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 doesn't seem to be pdftex!}% \else \AtBeginDocument{% \ifdim\stockwidth=\z@ \else \pdfpagewidth\stockwidth \pdfpageheight\stockheight \fi }% \fi } \newcommand*\CROP@init@vtex{% \PackageInfo{crop}{using vtex graphics driver}% \ifdim\stockwidth=\z@\else \ifx\@undefined\mediawidth \PackageWarning{crop}{implicit or explicit vtex option ignored:^^JThis doesn't seem to be vtex!}% \else \AtBeginDocument{% \mediawidth\stockwidth \mediaheight\stockheight }% \fi \fi } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{Compatibility stuff} % % \begin{macro}{\CROP@compat} % These options are just kept for compatibility reasons. They issue % a warning that will become an error message in the next % release. Finally they will be dropped altogether. % % \begin{macrocode} \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} } % \end{macrocode} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{Final settings} % % \begin{macro}{\CROP@horigin} % \begin{macro}{\CROP@vorigin} % \changes{v1.1}{1998/07/01}{Load optional configuration file `crop.cfg'}% % \changes{v1.6}{2001/11/16}{Execute graphics driver specific settings}% % Switch off marks and axes, set one page per sheet, % load the local configuration file, and % process the requested options. Finally: Exit. % % Notice that we cannot simply use |\ExecuteOptions| to preselect options % \option{off}, \option{noaxes}, \option{info}, and \option{mount1}, because it does not accept % default options declared with |\DeclareOption*|. |\@nameuse| doesn't % complain if the command sequence is undefined. We let this only be % executed |\AtEndOfPackage|, because there are possibly commands from % the \option{center} option in the queue that have to be processed first. % % \begin{macrocode} \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{macrocode} % \end{macro} % \end{macro} % % % % %^^A-------------------------------------------------------------------- % % % % % \subsection{A \option{mount4} example} % \label{sec:mount4} % % Since a \option{mount4} mode is likely to be subject to specific local % needs, there's only a suggestion provided, which supports a page % arrangement as shown in figure \ref{fig:mount4}. % % \begin{figure} % \begin{center} % \vspace*{10pt} % \makeatletter \catcode`\|=12 % \sffamily\bfseries % \begin{tabular}{|c|c|} % \hline % \vrule\@height16\p@\@depth8\p@\@width\z@ 2&1\\ % \hline % \vrule\@height16\p@\@depth8\p@\@width\z@ 0&3\\ % \hline % \end{tabular} % \vspace*{-10pt} % \end{center} % \caption{Possible \option{mount4} arrangement} % \label{fig:mount4} % \end{figure} % % % \noindent % First of all |\CROP@offset| is set to the value of the (optional) % argument or zero. % Then |\CROP@every| is defined first to set |\count@| to the page number % increased by this offset: $p=\mbox{pagenumber}+\mbox{offset}$. % \medbreak % % {\def\MacroFont{\small\ttfamily\itshape}% %\begin{verbatim} %\expandafter\newcommand\expandafter*\csname CROP@opt@mount4\endcsname % {\CROP@offset=\ifx\CROP@@\empty\z@\else\CROP@@\fi % \def\CROP@every{\count@\c@page % \advance\count@\CROP@offset %\end{verbatim} % % \noindent % Now bits~0 and~1 are checked via |\ifodd| to get % $p$ modulo 4, after which the respective marks are deleted. % The comments in the example use for simplicity C-Notation in which % `|%|' is the modulo or remainder operator, `|==|' the equal, and % `{\catcode`\|=12\texttt{||}}' the logical (inclusive) OR operator. % %\begin{verbatim} % \ifodd\count@ %% if (p % 4 == 1 || p % 4 == 3) % \let\CROP@ulc\relax\let\CROP@llc\relax % \divide\count@2 \ifodd\count@ %% if (p % 4 == 3) % \let\CROP@urc\relax % \let\CROP@info\relax % \else %% if (p % 4 == 1) % \let\CROP@lrc\relax % \fi % \else %% if (p % 4 == 0 || p % 4 == 2) % \let\CROP@urc\relax\let\CROP@lrc\relax % \let\CROP@info\relax % \divide\count@2 \ifodd\count@ %% if (p % 4 == 2) % \let\CROP@llc\relax % \else %% if (p % 4 == 0) % \let\CROP@ulc\relax % \fi % \fi}} %\end{verbatim} % } % % ^^A \PrintChanges % ^^A vim:ts=4:sw=4:et:cindent % \Finale ^^A.E.I.O.U.^^