| 1 |
% \iffalse |
| 2 |
%% |
| 3 |
%% File: ncccropbox.dtx Copyright (C) 2002--2004 by Alexander I. Rozhenko |
| 4 |
%% |
| 5 |
%<package>\NeedsTeXFormat{LaTeX2e} |
| 6 |
%<package>\ProvidesPackage{ncccropbox} |
| 7 |
%<package> [2004/11/24 v1.1 Crop Box Package (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/24}{Documentation was prepared} |
| 12 |
% |
| 13 |
%<*driver> |
| 14 |
\let\makeindex\relax |
| 15 |
\documentclass{ltxdoc} |
| 16 |
\usepackage{ncccropbox} |
| 17 |
\GetFileInfo{ncccropbox.sty} |
| 18 |
\begin{document} |
| 19 |
\title{The \textsf{ncccropbox} package\thanks{This file |
| 20 |
has version number \fileversion, last |
| 21 |
revised \filedate.}} |
| 22 |
\author{Alexander I. Rozhenko\\[email protected]} |
| 23 |
\date{\filedate} |
| 24 |
\maketitle |
| 25 |
\DocInput{ncccropbox.dtx} |
| 26 |
\end{document} |
| 27 |
%</driver> |
| 28 |
% \fi |
| 29 |
% |
| 30 |
% \section{User Interface} |
| 31 |
% |
| 32 |
% \DescribeMacro{\cropbox} |
| 33 |
% The package implements the command |
| 34 |
% \begin{quote} |
| 35 |
% |\cropbox|\oarg{width}\oarg{height}\marg{content} |
| 36 |
% \end{quote} |
| 37 |
% preparing a horizontal box with crop-marks at its corners looking like angles. |
| 38 |
% The crop-box is aligned at the bottom and is lowered at the |\lineskip| value. |
| 39 |
% The optional \meta{width} and \meta{height} parameters specify the width and |
| 40 |
% height of the crop-box respectively. If some of them is omitted or is |
| 41 |
% empty, the width or height of the crop-box \meta{content} is used for calculation |
| 42 |
% the omitted dimension. In this case, the doubled value of the |
| 43 |
% \textit{crop-box separation\/} parameter is added to the natural dimension |
| 44 |
% of the box's \meta{content}. The \meta{content} is centered inside the crop-box. |
| 45 |
% |
| 46 |
% \DescribeMacro{\cropboxsep} |
| 47 |
% The |\cropboxsep|\marg{length} command specifies the separation value to be used |
| 48 |
% in calculation of crop-box dimensions when any of optional parameters is |
| 49 |
% omitted or empty. The default is |\cropboxsep{5pt}|. |
| 50 |
% |
| 51 |
% \DescribeMacro{\croplinewidth} |
| 52 |
% The |\croplinewidth|\marg{length} command specifies a width of crop-lines. |
| 53 |
% The default is |\croplinewidth{.4pt}|. |
| 54 |
% |
| 55 |
% \DescribeMacro{\croplinelength} |
| 56 |
% The |\croplinelength|\marg{length} command specifies a length and direction |
| 57 |
% of crop-lines: the absolute value of \meta{length} specifies |
| 58 |
% a length of crop-lines and the sign of \meta{length} specifies a direction. |
| 59 |
% If the \meta{length} is negative, the angles look outside the crop-box. |
| 60 |
% Otherwise, they look inside the crop-box. |
| 61 |
% |
| 62 |
% The following example shows how crop-boxes are docked together: |
| 63 |
% \begin{center} |
| 64 |
% \cropbox[30mm][10mm]{Box 1}\cropbox[30mm][10mm]{Box 2}\cropbox[30mm][10mm]{Box 3}\cropbox[30mm][10mm]{Box 4}\\ |
| 65 |
% \cropbox[30mm][10mm]{Box 5}\cropbox[30mm][10mm]{Box 6}\cropbox[30mm][10mm]{Box 7}\cropbox[30mm][10mm]{Box 8} |
| 66 |
% \end{center} |
| 67 |
% It was prepared as follows: |
| 68 |
% \begin{quote} |
| 69 |
% |\begin{center}|\\ |
| 70 |
% |\cropbox[30mm][10mm]{Box 1}\cropbox[30mm][10mm]{Box 2}%|\\ |
| 71 |
% |\cropbox[30mm][10mm]{Box 3}\cropbox[30mm][10mm]{Box 4}\\|\\ |
| 72 |
% |\cropbox[30mm][10mm]{Box 5}\cropbox[30mm][10mm]{Box 6}%|\\ |
| 73 |
% |\cropbox[30mm][10mm]{Box 7}\cropbox[30mm][10mm]{Box 8}|\\ |
| 74 |
% |\end{center}| |
| 75 |
% \end{quote} |
| 76 |
% You can see that crop-lines of neighbour boxes exactly coincide. |
| 77 |
% \StopEventually{} |
| 78 |
% |
| 79 |
% \section{The Implementation} |
| 80 |
% |
| 81 |
% \begin{macro}{\croplinelength} |
| 82 |
% \begin{macro}{\croplinewidth} |
| 83 |
% \begin{macro}{\cropboxsep} |
| 84 |
% Styling macros: |
| 85 |
% \begin{macrocode} |
| 86 |
%<*package> |
| 87 |
\newcommand*{\croplinelength}[1]{\def\CRB@length{#1}} |
| 88 |
\newcommand*{\croplinewidth}[1]{\def\CRB@width{#1}} |
| 89 |
\newcommand*{\cropboxsep}[1]{\def\CRB@sep{#1}} |
| 90 |
% \end{macrocode} |
| 91 |
% \end{macro} |
| 92 |
% \end{macro} |
| 93 |
% \end{macro} |
| 94 |
% |
| 95 |
% \begin{macro}{\cropbox} |
| 96 |
% The |\cropbox| command: |
| 97 |
% \begin{macrocode} |
| 98 |
\newcommand*{\cropbox}[1][]{\@ifnextchar[{\CRB@box[#1]}{\CRB@box[#1][]}} |
| 99 |
\def\CRB@box[#1][#2]#3{% |
| 100 |
% \end{macrocode} |
| 101 |
% Calculate crop-box dimensions in |\@tempdima| and |\@tempdimb|: |
| 102 |
% \begin{macrocode} |
| 103 |
\@begin@tempboxa\hbox{#3}% |
| 104 |
\def\@tempa{#1}\ifx\@tempa\@empty |
| 105 |
\@tempdima\width \advance\@tempdima 2\CRB@sep\relax |
| 106 |
\else |
| 107 |
\setlength\@tempdima{#1}% |
| 108 |
\fi |
| 109 |
\def\@tempa{#2}\ifx\@tempa\@empty |
| 110 |
\@tempdimb\totalheight \advance\@tempdimb 2\CRB@sep\relax |
| 111 |
\else |
| 112 |
\setlength\@tempdimb{#2}% |
| 113 |
\fi |
| 114 |
% \end{macrocode} |
| 115 |
% Prepare crop-marks in 0th box of zero width: |
| 116 |
% \begin{macrocode} |
| 117 |
\setbox\z@\hb@xt@\z@{% |
| 118 |
\linethickness{\CRB@width}% |
| 119 |
\setlength\unitlength{\CRB@length}% |
| 120 |
\ifdim\unitlength=\z@ \else |
| 121 |
\ifdim\unitlength>\z@ |
| 122 |
\CRB@hcross\z@\z@\@ne\@ne |
| 123 |
\CRB@hcross\@tempdima\z@\m@ne\@ne |
| 124 |
\CRB@hcross\z@\@tempdimb\@ne\m@ne |
| 125 |
\CRB@hcross\@tempdima\@tempdimb\m@ne\m@ne |
| 126 |
\else \unitlength -\unitlength |
| 127 |
\CRB@hcross\z@\z@\m@ne\m@ne |
| 128 |
\CRB@hcross\@tempdima\z@\@ne\m@ne |
| 129 |
\CRB@hcross\z@\@tempdimb\m@ne\@ne |
| 130 |
\CRB@hcross\@tempdima\@tempdimb\@ne\@ne |
| 131 |
\fi |
| 132 |
\fi |
| 133 |
}% |
| 134 |
% \end{macrocode} |
| 135 |
% Put crop-marks as a background for vertical box containing the |
| 136 |
% crop-box content. We decrease the height of vertical box on |
| 137 |
% the |\lineskip| to make the exact docking of vertically neighbour |
| 138 |
% crop-boxes. |
| 139 |
% \begin{macrocode} |
| 140 |
\leavevmode \ht\z@\z@ \dp\z@\z@ \box\z@ |
| 141 |
\advance\@tempdimb -\lineskip |
| 142 |
\vbox to\@tempdimb{\vss\vskip -\lineskip |
| 143 |
\hb@xt@\@tempdima{\hss\unhbox\@tempboxa\hss}\vss\kern\z@ |
| 144 |
}% |
| 145 |
\@end@tempboxa |
| 146 |
} |
| 147 |
% \end{macrocode} |
| 148 |
% \end{macro} |
| 149 |
% |
| 150 |
% \begin{macro}{\CRB@hcross} |
| 151 |
% This command prepares a crop-mark. |
| 152 |
% \begin{macrocode} |
| 153 |
\def\CRB@hcross#1#2#3#4{% |
| 154 |
\@killglue\raise#2\hb@xt@\z@{\kern#1\line(#3,0)\@ne\hss}\hss |
| 155 |
\@killglue\raise#2\hb@xt@\z@{\kern#1\line(0,#4)\@ne\hss}\hss |
| 156 |
} |
| 157 |
% \end{macrocode} |
| 158 |
% \end{macro} |
| 159 |
% |
| 160 |
% Initial settings: |
| 161 |
% \begin{macrocode} |
| 162 |
\croplinelength{10pt} |
| 163 |
\croplinewidth{.4pt} |
| 164 |
\cropboxsep{5pt} |
| 165 |
%</package> |
| 166 |
% \end{macrocode} |
| 167 |
\endinput |