| 1 |
% \iffalse |
| 2 |
%% |
| 3 |
%% File: ncccropmark.dtx Copyright (C) 2002--2004 by Alexander I. Rozhenko |
| 4 |
%% |
| 5 |
%<package>\NeedsTeXFormat{LaTeX2e} |
| 6 |
%<package>\ProvidesPackage{ncccropmark} |
| 7 |
%<package> [2004/11/29 v1.1 Cropmarks (NCC)] |
| 8 |
% |
| 9 |
% \changes{v1.02}{2002/01/31}{This version is uploaded to CTAN} |
| 10 |
% \changes{v1.03}{2002/02/08}{The package is renamed to ncccropbox} |
| 11 |
% \changes{v1.1}{2004/11/29}{Bug fix on misusing the bottom skip instead of top one} |
| 12 |
% \changes{v1.1}{2004/11/29}{Documentation was prepared} |
| 13 |
% |
| 14 |
%<*driver> |
| 15 |
\let\makeindex\relax |
| 16 |
\documentclass{ltxdoc} |
| 17 |
\usepackage{ncccropmark,watermark} |
| 18 |
\GetFileInfo{ncccropmark.sty} |
| 19 |
\begin{document} |
| 20 |
\title{The \textsf{ncccropmark} package\thanks{This file |
| 21 |
has version number \fileversion, last |
| 22 |
revised \filedate.}} |
| 23 |
\author{Alexander I. Rozhenko\\[email protected]} |
| 24 |
\date{\filedate} |
| 25 |
\maketitle |
| 26 |
\DocInput{ncccropmark.dtx} |
| 27 |
\end{document} |
| 28 |
%</driver> |
| 29 |
% \fi |
| 30 |
% |
| 31 |
% \watermark{\cropmark[f]{10mm}{10mm}{10mm}{10mm}{5mm} |
| 32 |
% \cropmark[f]{10mm}{10mm}{10mm}{10mm}{-5mm}} |
| 33 |
% \thiswatermark{\cropmark[f]{10mm}{10mm}{10mm}{10mm}{5mm}} |
| 34 |
% |
| 35 |
% \section{User Interface} |
| 36 |
% |
| 37 |
% \DescribeMacro{cropmark} |
| 38 |
% The package implements the command |
| 39 |
% \begin{quote} |
| 40 |
% |\cropmark|\oarg{fields}\marg{left}\marg{right}\marg{top}\marg{bottom}\marg{length} |
| 41 |
% \end{quote} |
| 42 |
% useful as a watermark. The command was desired for use together with the |
| 43 |
% |watermark| package. It must be called inside the picture environment |
| 44 |
% (a watermark content is prepared in such a way). |
| 45 |
% |
| 46 |
% The optional \meta{fields} parameter contains a combination of letters |
| 47 |
% |h| (header), |f| (footer), and |m| (marginal notes). |
| 48 |
% It determines the additional fields of paper area to be taken into account |
| 49 |
% in crop area when the crop-mark is typed out. If the optional parameter is omitted, |
| 50 |
% the crop area coincides with the text area only. |
| 51 |
% |
| 52 |
% Next four parameters mean padding values for crop-mark corners with respect to |
| 53 |
% the crop area and the last parameter is equal to crop lines length. |
| 54 |
% Its positive value means crop-mark corners looking on the crop area. |
| 55 |
% Otherwise, the corners look outside of the crop area. |
| 56 |
% To prepare crosses, you need to use the crop-mark twice with positive |
| 57 |
% and negative values. |
| 58 |
% |
| 59 |
% In two-side mode the left and right padding are swapped for |
| 60 |
% every even page. |
| 61 |
% |
| 62 |
% For example, |\watermark{\cropmark[f]{10mm}{10mm}{10mm}{10mm}{5mm}}| |
| 63 |
% means a crop-mark indented on 10mm in all directions from the crop area |
| 64 |
% containing the text area and the page footer. You can see the result |
| 65 |
% on this page. The crosses on the next page were prepared with |
| 66 |
% the following command: |
| 67 |
% \begin{quote} |
| 68 |
% |\watermark{\cropmark[f]{10mm}{10mm}{10mm}{10mm}{5mm}|\\ |
| 69 |
% | \cropmark[f]{10mm}{10mm}{10mm}{10mm}{-5mm}}| |
| 70 |
% \end{quote} |
| 71 |
% \StopEventually{} |
| 72 |
% |
| 73 |
% \section{The Implementation} |
| 74 |
% This package requires the |ncccropbox| package to prepare a |
| 75 |
% crop-mark and the |tocenter| package to calculate crop-area |
| 76 |
% dimensions. |
| 77 |
% \begin{macrocode} |
| 78 |
%<*package> |
| 79 |
\RequirePackage{ncccropbox,tocenter} |
| 80 |
% \end{macrocode} |
| 81 |
% |
| 82 |
% \begin{macro}{\cropmark} |
| 83 |
% We suppose here that the |\cropmark| will be |
| 84 |
% used at the beginning of header. The |\NCC@pos| command |
| 85 |
% from the |tocenter| package parses the \meta{fields} parameter |
| 86 |
% and prepares |\NCC@h|\marg{register}, |\NCC@f|\marg{register}, |
| 87 |
% and |\NCC@m|\marg{register} commands to adjust values of skip |
| 88 |
% registers. See the |tocenter| package for more details. |
| 89 |
% \begin{macrocode} |
| 90 |
\newcommand*{\cropmark}[6][]{\NCC@pos{#1}% |
| 91 |
% \end{macrocode} |
| 92 |
% At the first, we calculate the width of crop-box and the |
| 93 |
% left skip from the beginning of header. |
| 94 |
% The |\@tempswatrue| means reverse left and right paddings. |
| 95 |
% \begin{macrocode} |
| 96 |
\@tempswafalse |
| 97 |
\if@twoside \ifodd\c@page \else \@tempswatrue \fi\fi |
| 98 |
% \end{macrocode} |
| 99 |
% Set |\@tempdima| to the left padding and |\@tempdimb| to the right |
| 100 |
% padding. |
| 101 |
% \begin{macrocode} |
| 102 |
\if@tempswa |
| 103 |
\setlength{\@tempdima}{#3}% |
| 104 |
\setlength{\@tempdimb}{#2}% |
| 105 |
\else |
| 106 |
\setlength{\@tempdima}{#2}% |
| 107 |
\setlength{\@tempdimb}{#3}% |
| 108 |
\fi |
| 109 |
% \end{macrocode} |
| 110 |
% Adjust values of |\@tempdima| and |\@tempdimb| with margin |
| 111 |
% widths: |
| 112 |
% \begin{macrocode} |
| 113 |
\if@twocolumn |
| 114 |
\NCC@m\@tempdima \NCC@m\@tempdimb |
| 115 |
\else |
| 116 |
\if@tempswa |
| 117 |
\if@reversemargin \NCC@m\@tempdimb \else \NCC@m\@tempdima \fi |
| 118 |
\else |
| 119 |
\if@reversemargin \NCC@m\@tempdima \else \NCC@m\@tempdimb \fi |
| 120 |
\fi |
| 121 |
\fi |
| 122 |
% \end{macrocode} |
| 123 |
% Calculate the left skip in |\@tempskipa| and the crop-box width |
| 124 |
% in |\@tempdima|: |
| 125 |
% \begin{macrocode} |
| 126 |
\@tempskipa -\@tempdima |
| 127 |
\advance\@tempdima\@tempdimb |
| 128 |
\advance\@tempdima\textwidth |
| 129 |
% \end{macrocode} |
| 130 |
% Now we calculate the height of crop-box in the |\@tempdimb| register |
| 131 |
% and the bottom skip in the |\@tempskipb| register: |
| 132 |
% \begin{macrocode} |
| 133 |
\@tempdimb\headsep |
| 134 |
\advance\@tempdimb\textheight |
| 135 |
\NCC@f\@tempdimb |
| 136 |
\addtolength{\@tempdimb}{#5}% |
| 137 |
\@tempskipb -\@tempdimb |
| 138 |
\advance\@tempdimb -\headsep |
| 139 |
\NCC@h\@tempdimb |
| 140 |
\addtolength{\@tempdimb}{#4}% |
| 141 |
% \end{macrocode} |
| 142 |
% All necessary calculations are done. Put the crop-box at |
| 143 |
% the relative position |\@tempskipa,\@tempskipb|: |
| 144 |
% \begin{macrocode} |
| 145 |
\begingroup |
| 146 |
\croplinelength{#6}% |
| 147 |
\lineskip\z@ |
| 148 |
\@killglue\raise\@tempskipb |
| 149 |
\hb@xt@\z@{\kern\@tempskipa |
| 150 |
\cropbox[\@tempdima][\@tempdimb]{}\hss}\hss% |
| 151 |
\endgroup |
| 152 |
} |
| 153 |
%</package> |
| 154 |
% \end{macrocode} |
| 155 |
% \end{macro} |
| 156 |
\endinput |