% \iffalse %% File: crop.dtx Copyright (C) 1998,1999 Melchior FRANZ % %<*preamble> % % (1) run `crop.dtx' through LaTeX to get `crop.ins', % (if you don't already have it) % % (2) run `crop.ins' through (La)TeX to get % the package `crop.sty' % % [or use `docstrip', and extract `crop.sty' from `crop.dtx' % using option `package'] % % (3) now run `crop.dtx' three times through LaTeX % to get the documentation file `crop.dvi' % % %% ==================================================================== %% @LaTeX-package-file{ %% author = "Melchior FRANZ", %% version = "1.3", %% date = "07 March 1999", %% filename = "crop.dtx", %% address = "Melchior FRANZ %% A-5212 SCHNEEGATTERN 34 %% AUSTRIA", %% telephone = "++43 7746 3109", %% URL = "http://unet.univie.ac.at/~a8603365/", %% email = "a8603365@unet.univie.ac.at", %% codetable = "ISO/ASCII", %% keywords = "cropmarks, frame, mirror, 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, and for %% reflecting and inverting the whole document. %% Custom definitions are supported by loading %% a local configuration file and providing a mode %% definition command, which is demonstrated in an %% example.", %% } %% ==================================================================== % % % IMPORTANT COPYRIGHT NOTICE: % % This package is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. % % You are NOT ALLOWED to change this file. % % Permission is granted to copy this file to another file with a % clearly different name and to customize the declarations in that % copy to serve the needs of your installation. % % However, NO PERMISSION is granted to produce or to distribute a % modified version of this file under its original name. % % You are NOT ALLOWED to take money for the distribution or use of % this file (or a changed version) except for a nominal charge % for copying etc. % % You ARE ALLOWED to distribute this file alone. % % % %<*batchfile> \begin{filecontents}{crop.ins} \def\batchfile{crop.ins} \input docstrip.tex \keepsilent \generate{\file{crop.sty}{\from{crop.dtx}{package}}} \endbatchfile \end{filecontents} % % % % %<*driver> \def\fileversion{1.3} \def\filedate{1999/03/07} \documentclass[draft]{ltxdoc} % \let\opt\textsf % mode/option names are typeset this way % % \IfFileExists{crop.sty} {\usepackage{crop}[1999/03/07]\let\CROPSTYfound\active} {\GenericWarning{crop.dtx} {Package file `crop.sty' not found (Two pictures will be missing.^^J Generate `crop.sty' by (La)TeXing `crop.ins', 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} % % ^^A \RecordChanges % \begin{document} \hfuzz.6pt \DocInput{crop.dtx} \end{document} % % \fi % % % \CheckSum{526} % \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 \texttt{crop} package} % % \author{Melchior \textsc{FRANZ}} % \date{March 7, 1999} % \maketitle % % % \changes{v1.0}{1998/05/20}{Initial version (under this name---sigh!)}% % % \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 Pauli \textsc{VILJAMAA.}}% % % \changes{v1.2}{1998/12/07}{options `mirror' and `invert' added % on suggestion by Rolf \textsc{NIEPRASCHK.}}% % % \changes{v1.3}{1999/03/07}{center the logical paper `AtBeginDocument' % instead of immediately; postamble changed slightly; `uppercase % removed from info} % % % \begin{abstract} % This article describes the \texttt{crop} package\footnote{This file has version % number \fileversion, last revised \filedate.\\I'd like to thank % \textsc{Rolf Niepraschk} for his useful hints and suggestions, which influenced % the package substantially.}, 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, and for reflecting and inverting % the whole document. % Custom definitions are supported by loading a local configuration % file and providing a mode definition command, which is demonstrated % in an example. % % The package was originally developed for needs of the % Austrian Red Cross\slash Federal Province of Vienna\slash % Department of Radiation Protection. % \end{abstract} % % % {\parskip0pt\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 ligning up the single pages on % printing plates for photographical duplication a set of corner marks % is required. % % % \section{How to use the package} % % \subsection{The options} % \newcommand\Ast{\llap{$^\ast$}} % % The following list shows all package options, whereby those marked with % a little asterisk are conventional options that are only accessible, % when the package is loaded (e.\,g.~|\usepackage[frame]{crop}|). % All other options can also be executed after loading the % package, in which case they are to be stated as an optional argument(list) % to the |\crop| command (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 logical paper 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 options requested. % % \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.1}{1998/07/01}{Implemented mount options}% % \item[\sffamily mount1, mount2]--- % If more than one logical page is to be mounted on a physical sheet, % you normally wouldn't want marks to appear on the inner edges, where % the pages touch each other. % The \opt{mount2} mode prints only the outer marks. % There's also a \opt{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.\footnote{The `|=|' notation may not % look very intuitive at first glance, but other packages already use % this notation for assignments and it was not desirable to introduce a % new one.} Since further modes are likely to be document, driver, and % printer dependent, no more modes are included. It is up to you, to % implement such modes. (See a \opt{mount4} suggestion on page % \pageref{sec:mount4}.) % % \changes{v1.1}{1998/07/01}{Implemented center options}% % \item[\sffamily\Ast a4center, a5center, b5center, lettercenter, % legalcenter, executivecenter]---\hfill\break % Corresponding to the standard classes' |paper| options there are % \opt{center} options that allow to center the logical output page % on the respective physical printer paper. % % \item[\sffamily\Ast landscapecenter]--- % This option is to be set in addition to a \opt{center} % option if a document should be centered on `landscape oriented' % paper. It has nothing to do with the standard |landscape| option. % % \changes{v1.2}{1998/12/07}{Implemented mirror and invert option} % \item[\sffamily\Ast mirror] % This option reflects the whole document, provided that the `dvi' output % driver handles \textsc{PS} |\special|'s. It uses the standard graphics interfaces, % if the document loads the |graphics| and/or the |color| package, % or a matching interface file such as |dvips.def|. % If no interface is defined, the package uses its internal macros. % \emph{(This option is somewhat experimental, since I % tested it only with} |dvips| \emph{and a native PS printer, and with % GhostScript under LINUX, where it worked properly. I'd like to know about % your experience with other device drivers.)} % % \item[\sffamily\Ast invert] % This option lets the whole document be printed white onto black background, % if the |color| package can be loaded and the document is output with an % output device that is capable of executing PostScript commands. All color % changing commands stated in the document are ignored. % \end{labeling} % % %^^A \noindent %^^A Further marks can be implemented using the |\cropdef| command (see below). % % {\makeatletter % \ifx\CROPSTYfound\active % \begin{figure} % \begin{quote} % \begin{center} % \vspace{.6in} % \leavevmode % \hbox{\hspace{.5in}\rlap{\hskip-\paperwidth\CROP@@info}\CROP@@urc % \hspace{2in} % \rlap{\hskip-\paperwidth\CROP@@info}\CROP@@cross % \hspace{1in}}\vspace{1in} % \caption{The upper right mark in \opt{cam} and \opt{cross} mode % both with the page info.} % \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 \textsc{DVI} driver or the printer. % The |center| commands center every logical page on the respective % physical paper. The \opt{a4center} command, for example, centers the % page exactly on an \textsc{ISO~A4} sheet. % % \bigbreak\noindent{\catcode`\|=12\hbadness\maxdimen % \begin{tabular*}{\hsize}{@{\extracolsep{0pt}}l|l@{\extracolsep{10pt}}} % \verb+\documentclass[a5paper]{article}+ &\verb+\documentclass[a5paper]{article}+\\ % \verb+\usepackage[cam,a4center]{crop}+ &\verb+\usepackage[a4center]{crop}+\\ % \verb+\begin{document}+ &\verb+\begin{document}+\\ % \verb+...+ &\verb+...+\\ % \verb+\end{document}+ &\verb+\crop % or: \crop[cross], etc.+\\ % &\verb+...+\\ % &\verb+\end{document}+\\ % \end{tabular*}} % % \bigbreak\noindent % 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$). % % % % \subsection{Controlling the package} % % You get corner markings at every page shipped out after a \opt{cam}, % \opt{cross}, or \opt{frame} mode request until you turn things off by % typing \DescribeMacro{\crop}|\crop[off]|, or the actual grouping level % or the document, of course, ends. % Typing |\crop| without argument(s) is equivalent to typing % |\crop[cam,noaxes]|. % Axis marks appear only together with one of these modes. % If you only want one cover page for trimming, make sure that a page is % output in the scope of |\crop|, e.\,g.: %\begin{verbatim} %\newpage %{\crop[cross,axes]\null\newpage} %\end{verbatim} % % % % % \subsection{Defining your own mode} % \label{sec:cropdef} % % If you urgently need a \opt{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{verbatim} %\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}} % %\newcommand*\funnymarkB{% % a bullet % \begin{picture}(0,0) % \unitlength1pt % \put(0,0){\circle*{5}} % \end{picture}} % %\newcommand*\funnyinfo{funny page info} %\cropdef[\funnyinfo]\relax\funnymarkA\relax\funnymarkB{funny} %\end{verbatim} % % \noindent % You can select your own mode by typing |\crop[funny]|. % % The package tries to find a file `crop.cfg' where local stuff is to be % placed in. If you want to prevent your system from desperately seeking % this file, you can speed it up by placing an empty configuration file % in a directory, where \TeX\ looks first. % % Don't hesitate to ask for special marks and modes---I'll do what I can. % Maybe some of the suggestions and requests are of common interest and % will be included in future releases. % % % % % % \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 |everyshi| package % by \textsc{Martin Schr\"oder}, from whom I have in fact borrowed some ideas). % % % % % \subsection{The page info} % % Every page gets its page info, containing the jobname, the current date, % and the page number placed at the upper left corner. % The standard macro |\CROP@@info|, however, jumps first to the right corner. % % % % % \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@|, |\@height|, |\@depth|, |\@width|, |\z@|, |\z@skip|, |\p@|, % |\@ifundefined|, |\c@page|, |\@namedef|, |\@nameuse|, % |\strip@pt|, |\count@|, |\dimen@|, and |\@for|, % all of which are expected to keep their current meaning in future % \LaTeX\ releases. The \texttt{crop} package will, however, be supported % at least for some years, so you needn't worry about it. % % \StopEventually{\addtocontents{toc}{\protect\end{multicols}}} % % % % % \section{The macros} % % \begin{macrocode} %<*package> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{crop}[1999/03/07 v1.3 cropmarks (mf)] % \end{macrocode} % % % \subsection{Conventional options} % \changes{v1.3}{1999/03/07}{the center options are processed `AtBeginDocument} % % These options set the offset values to center a logical page on % a physical sheet. Since the physical paper dimensions must not underlie % a possible scaling, |true| dimensions are taken. The \opt{landscape} % option exchanges the |\hoffset| and |\voffset| dimension. % % \begin{macrocode} \DeclareOption{landscapecenter}{% \def\CROP@center#1#2{\AtBeginDocument{\CROP@setoffset{#2}{#1}}}} \DeclareOption{a4center}{\CROP@center{297truemm}{210truemm}} \DeclareOption{a5center}{\CROP@center{210truemm}{148truemm}} \DeclareOption{b5center}{\CROP@center{250truemm}{176truemm}} \DeclareOption{lettercenter}{\CROP@center{11truein}{8.5truein}} \DeclareOption{legalcenter}{\CROP@center{14truein}{8.5truein}} \DeclareOption{executivecenter}{\CROP@center{10.5truein}{7.25truein}} % \end{macrocode} % % % % \begin{macro}{\CROP@setoffset} % \begin{macro}{\CROP@center} % This macro expects height and width of the physical sheet and sets % |\voffset| and |\hoffset| to center the logical page on it. % It is undefined at the end of the package to save % (admittedly not very much) memory. % % \begin{macrocode} \newcommand*\CROP@setoffset[2]{% \voffset#1\advance\voffset-\paperheight\voffset.5\voffset \hoffset#2\advance\hoffset-\paperwidth\hoffset.5\hoffset} \def\CROP@center#1#2{\AtBeginDocument{\CROP@setoffset{#1}{#2}}} % \end{macrocode} % \end{macro} % \end{macro} % % % % \subsection{Special options handling} % % Every unknown option is passed to the macro |\CROP@execopt|. % % \begin{macrocode} \DeclareOption*{\CROP@execopt\CurrentOption} % \end{macrocode} % % % \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 \opt{cam} and \opt{noaxes} are selected by default. % % \begin{macrocode} \newcommand*\crop[1][cam,noaxes]{% \@for\CROP@@:=#1\do{\CROP@execopt\CROP@@}} % \end{macrocode} % \end{macro} % % % % \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@@| before. % % \TeX{}nicians will recognize that 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 neither a bug, nor a feature. It's rather a consequence of % the attempt to write simple and fast code. % The reason why I didn't make use of the |keyval| package that does all % this (and much more) is, that the |crop| package shouldn't be dependent % on \emph{any} further package (except \LaTeX, of course). % % \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@}% {\PackageWarning{crop}{Requested option `#1' not provided}}% {\@nameuse{CROP@opt@\CROP@}}} % \end{macrocode} % \end{macro} % % % % \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} % % % % \subsection{Standard definitions} % % \begin{macro}{\CROP@@vaxis} % \begin{macro}{\CROP@@haxis} % \changes{v1.1a}{1998/10/20}{`smash replaced}% % The standard definitions for the \opt{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} % % % \begin{macro}{\CROP@@info} % This macro prints the jobname, the current date, and the page number % at the upper right corner. (In fact it prints it at the upper \emph{left} % corner, but the first thing the macro does is jumping to the % right.) % \changes{v1.3}{1999/03/07}{killed `uppercase; (devotion to LINUX)} % % \begin{macrocode} \newcommand*\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{macrocode} % \end{macro} % % % % % \subsection{The \opt{cam} mode} % % The following four macros provide different marks for the \opt{cam} % mode. Since they do not affect the logical page by keeping distance % from its edges, they may be printed on every single output page. % % \begin{macro}{\CROP@@ulc} % The \opt{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} % % % \begin{macro}{\CROP@@urc} % The \opt{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} % % \begin{macro}{\CROP@@llc} % The \opt{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} % % \begin{macro}{\CROP@@lrc} % The \opt{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} % % % \begin{macro}{\CROP@opt@cam} % Define the \opt{cam} mode switch with four different marks. % % \begin{macrocode} \cropdef\CROP@@ulc\CROP@@urc\CROP@@llc\CROP@@lrc{cam} % \end{macrocode} % \end{macro} % % % % % \subsection{The \opt{cross} mode} % % \begin{macro}{\CROP@@cross} % This macro provides a two inch wide cross. % % \begin{macrocode} \newcommand*\CROP@@cross{% \begin{picture}(0,0)\unitlength1in\thinlines \put(-1,0){\line(1,0){2}} \put(0,-1){\line(0,1){2}} \end{picture}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\CROP@opt@cross} % Define the \opt{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} % % % % % \subsection{The \opt{frame} mode} % % \begin{macro}{\CROP@@frame} % The \opt{frame} mode draws a simple frame around the logical % page. The respective mark is designed to be used in the upper left % corner. Since graphics commands take 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} % % % \begin{macro}{\CROP@opt@frame} % Define the \opt{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} % % % % % % \subsection{The kernel} % % \changes{v1.1}{1998/07/01}{kernel re-implemented completely new}% % \begin{macro}{\CROP@shipout} % \begin{macro}{\CROP@ship} % \begin{macro}{\CROP@@ship} % \begin{macro}{\CROP@shiplist} % \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\unvbox\@cclv} \newcommand*\CROP@@ship{\CROP@shipout\vbox{\CROP@shiplist}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \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 and may change it somehow. % % \begin{macrocode} \newcommand*\CROP@shipadd[1]{\begingroup \toks@\expandafter{\expandafter#1\expandafter{\CROP@shiplist}}% \xdef\CROP@shiplist{\the\toks@}% \endgroup} % \end{macrocode} % \end{macro} % % % \begin{macro}{\CROP@kernel} % \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} % |\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 behaviour of the selected mode % (see the options \opt{mount1} and \opt{mount2}). % % \begin{macrocode} \newcommand*\CROP@kernel{\color@setgroup \vbox to\z@{\vskip-1in \hb@xt@\z@{\hskip-1in \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} % \end{macrocode} % \end{macro} % % % % \begin{macro}{\CROP@on} % \begin{macro}{\CROP@@@ship} % \begin{macro}{\CROP@opt@off} % These macros start and stop the kernel mechanism. % % \begin{macrocode} \newcommand*\CROP@on{\let\CROP@@@ship\CROP@kernel} \newcommand*\CROP@opt@off{\let\CROP@@@ship\relax} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % % % \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. % % \begin{macrocode} \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} % % % % % % \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} % % % % % % \subsection{Page manipulation} % \changes{v1.2}{1998/12/07}{options `mirror' and `invert' added} % % \begin{macro}{\CROP@reflect} % \begin{macro}{\CROP@setps} % The \opt{mirror} option adds this command to the \emph{shiplist,} % after which |\CROP@reflect| gets every output page and puts it in % a reflected box. If no interface macro |\Gin@PS@raw| can be found, % the package command |\CROP@ps| is used to output raw \textsc{PS} commands. % % \begin{macrocode} \DeclareOption{mirror}{% \AtBeginDocument{\CROP@shipadd\CROP@reflect\CROP@setps}} \newcommand*\CROP@reflect[1]{% \vbox to\z@{\vskip-1in\hb@xt@\z@{\hskip-1in \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}} \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\undefined} % \end{macrocode} % \end{macro} % \end{macro} % % % % \begin{macro}{\CROP@invert} % The \opt{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}} \newcommand*\CROP@invert{% \ifx\color\undefined \PackageWarning{crop}% {The `color' package could not be loaded,^^J% so I'm ignoring the `invert' option}% \else \pagecolor{black}\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\undefined} % \end{macrocode} % \end{macro} % % % % \subsection{Final 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 % \opt{off}, \opt{noaxes}, and \opt{mount1}, because it does not accept % default options declared with |\DeclareOption*|. % \changes{v1.1}{1998/07/01}{Load optional configuration file `crop.cfg'}% % % \begin{macrocode} \crop[off,noaxes,mount1] \InputIfFileExists{crop.cfg}% {\PackageInfo{crop}{Local config file crop.cfg used}}{} \ProcessOptions \endinput % % \end{macrocode} % % % % % \subsection{A \opt{mount4} example} % \label{sec:mount4} % % Since a \opt{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 \opt{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 % \Finale ^^A.E.I.O.U.^^ %