%D \module %D [ file=pack-cut, % comes from core-vis/trac-vis %D version=1996.06.01, %D title=\CONTEXT\ Packaging Macros, %D subtitle=Cut boxes, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. \unprotect %D When I am in the mood I will implement the main macro in a more modern way using %D offsets and such. Or maybe using \METAPOST\ instead %D %D \macros %D {makecutbox, cuthbox, cutvbox, cutvtop} %D %D Although mainly used for marking the page, these macros can also serve local use. %D %D \startbuffer %D \setbox0=\vbox{a real \crlf vertical box} \makecutbox0 %D \stopbuffer %D %D \typebuffer %D %D This marked \type{\vbox} shows up as: %D %D \startlinecorrection %D \getbuffer %D \stoplinecorrection %D %D The alternative macros are used as: %D %D \startbuffer %D \cuthbox{a made cut box} %D \stopbuffer %D %D \typebuffer %D %D This is typeset as: %D %D \startlinecorrection %D \getbuffer %D \stoplinecorrection %D %D By setting the next macros one can influence the length of the marks as well as %D the horizontal and vertical divisions. \newdimension\d_pack_cutmarks_width \newdimension\d_pack_cutmarks_height \newdimension\d_pack_cutmarks_depth \newinteger \horizontalcutmarks \horizontalcutmarks \plustwo \newinteger \verticalcutmarks \verticalcutmarks \plustwo \newinteger \cutmarkoffset \cutmarkoffset \plusone \mutable\let\cutmarksymbol \relax \mutable\def\cutmarklength {2\bodyfontsize} \mutable\def\cutmarkrulethickness{\onepoint} \mutable\lettonothing\cutmarktoptext \mutable\lettonothing\cutmarkbottomtext \mutable\lettonothing\cutmarkhoffset \mutable\lettonothing\cutmarkvoffset \permanent\protected\def\horizontalcuts {\hpack to \d_pack_cutmarks_width {\localcontrolledrepeat\horizontalcutmarks{\vrule\s!width\cutmarkrulethickness\s!height\cutmarklength\hfill}% \unskip}} \permanent\protected\def\verticalcuts {\vpack to {\d_pack_cutmarks_height+\d_pack_cutmarks_depth}% {\hsize\cutmarklength \localcontrolledrepeat\verticalcutmarks{\vrule\s!height\cutmarkrulethickness\s!width\hsize\vfill}% \unskip}} \permanent\protected\def\baselinecuts {\ifdim\d_pack_cutmarks_depth>\zeropoint \vpack to {\d_pack_cutmarks_height+\d_pack_cutmarks_depth}% {\hsize{\cutmarklength/2}% \vskip\zeropoint\s!plus\d_pack_cutmarks_height \vrule\s!height\cutmarkrulethickness\s!width\hsize \vskip\zeropoint\s!plus\d_pack_cutmarks_depth}% \fi} \permanent\protected\def\cutmarksymbols#1% {\hpack to \d_pack_cutmarks_width {\setbox\scratchbox\hbox to \cutmarklength {\hss\infofont\cutmarksymbol\hss}% \hss \vpack to \cutmarklength {\scratchdimen{\cutmarklength/2}% \scratchdistance\ifempty\cutmarkhoffset\cutmarkoffset\scratchdimen\else\cutmarkhoffset\fi \vss \hbox to \d_pack_cutmarks_width {\llap{\copy\scratchbox\kern\scratchdistance}% \kern\scratchdimen\hss \infofont#1% \hss \kern\scratchdimen \rlap{\kern\scratchdistance\copy\scratchbox}}% \vss}% \hss}} \permanent\protected\def\makecutbox#1% not grouped ! {\d_pack_cutmarks_height\ht#1% \d_pack_cutmarks_depth \dp#1% \d_pack_cutmarks_width \wd#1% \setbox#1\hpack {\dontcomplain \forgetall \boxmaxdepth\maxdimen \offinterlineskip \scratchdimen{\cutmarklength/2}% \hsize\d_pack_cutmarks_width \setbox\scratchbox\vpack {\setbox\scratchbox\hpack{\horizontalcuts}% \scratchdistance\ifempty\cutmarkvoffset\cutmarkoffset\scratchdimen\else\cutmarkvoffset\fi \tlap{\copy\scratchbox\vskip\scratchdistance}% \hpack to \d_pack_cutmarks_width {\scratchdistance\ifempty\cutmarkhoffset\cutmarkoffset\scratchdimen\else\cutmarkhoffset\fi \setbox\scratchbox\hpack{\verticalcuts}% \llap{\copy\scratchbox\kern\scratchdistance}% \ifzeropt\d_pack_cutmarks_depth \hfill \else \begingroup \setbox\scratchbox\hpack{\baselinecuts}% \llap{\copy\scratchbox\kern\scratchdistance}% \hfill \rlap{\kern\scratchdistance\copy\scratchbox}% \endgroup \fi \rlap{\kern\scratchdistance\copy\scratchbox}}% \blap{\vskip\scratchdistance\copy\scratchbox}}% \ht\scratchbox\d_pack_cutmarks_height \dp\scratchbox\d_pack_cutmarks_depth \wd\scratchbox\zeropoint \startcolor[\defaulttextcolor]% \box\scratchbox \ifrelax\cutmarksymbol \else \setbox\scratchbox\vpack {\scratchdistance\ifempty\cutmarkvoffset\cutmarkoffset\scratchdimen\else\cutmarkvoffset\fi \vskip{-\scratchdistance-\cutmarklength}% \hpack{\cutmarksymbols\cutmarktoptext}% \vskip{\scratchdistance+\d_pack_cutmarks_height+\d_pack_cutmarks_depth+\scratchdistance}% \hpack{\cutmarksymbols\cutmarkbottomtext}}% \ht\scratchbox\d_pack_cutmarks_height \dp\scratchbox\d_pack_cutmarks_depth \wd\scratchbox\zeropoint \box\scratchbox \fi \stopcolor \box#1}% \wd#1\d_pack_cutmarks_width \ht#1\d_pack_cutmarks_height \dp#1\d_pack_cutmarks_depth \box#1} \permanent\protected\def\cuthbox{\hpack\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\hbox} \permanent\protected\def\cutvbox{\vpack\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\vbox} \permanent\protected\def\cutvtop{\tpack\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\vtop} \protect \endinput