Annotation of OpenXM/doc/Papers/cropmark.sty, Revision 1.1
1.1 ! noro 1: % $OpenXM$
! 2: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! 3: %
! 4: % Cropmark.sty or .tex
! 5: % version 1.1 (minor enhancements see below)
! 6: %
! 7: % This will put crop marks on everythings that's \shipout'ed.
! 8: % It will work with any format, since it relies on redefinition
! 9: % of \shipout. Exception: if you declare \output{} you will
! 10: % not get crop marks.
! 11: %
! 12: % Cut along the center of the rules to get exactly the shipped
! 13: % out box. To get padding around this box, use the parameters below.
! 14: %
! 15: % User adjustable parameters:
! 16: % \croplength length of the crop rules
! 17: % \cropwidth width of the crop rules
! 18: % \cropsep separation between rule and page box
! 19: % \croppadtop padding in case page box looks bigger than it is
! 20: % \croppadbot (for instance with plain TeX head/footline)
! 21: % \croppadlr
! 22: %
! 23: % Version 1.0 - Date: 17 March 1992
! 24: %
! 25: % Author:
! 26: % Victor Eijkhout
! 27: % Department of Computer Science
! 28: % University Tennessee at Knoxville
! 29: % 104 Ayres Hall
! 30: % Knoxville, TN 37996
! 31: % USA
! 32: %
! 33: % eijkhout@cs.utk.edu
! 34: %
! 35: % "Enhancements":
! 36: % \thispagecropped enables cropmarks for the current page only
! 37: % \allpagescropped enables cropmarks on all subsequent pages
! 38: % \nopagecropped stops cropmarks
! 39: % \ifbottomcrops conditional for copmarks at the bottom of the page
! 40: % left marks shifted by \@themargin
! 41: %
! 42: % Version 1.1 - Date: 21 July 1993
! 43: %
! 44: % Author:
! 45: % Frank Holzwarth
! 46: % Springer-Verlag
! 47: % Abteilung Neue Techniken/Produktentwicklung
! 48: % Tiergartenstrasse 17
! 49: % D-69121 Heidelberg
! 50: % FRG
! 51: %
! 52: % holzwarth@vax.ntp.springer.de
! 53: %
! 54: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! 55: % save the old \shipout command
! 56: \let\xshipout\shipout
! 57:
! 58: % define a new one: investigate what's being shipped
! 59: \def\cshipout{\futurelet\SomeBox\yshipout}
! 60:
! 61: % if its a box register, do postprocessing with \afterassignment,
! 62: % otherwise do \afterassignment which will do \aftergroup
! 63: \def\yshipout
! 64: {\ifx\SomeBox\box \let\next\shipAfterRegister
! 65: \else \ifx\SomeBox\copy \let\next\shipAfterRegister
! 66: \else \let\next\shipAfterBox \fi\fi
! 67: \afterassignment\next\setbox0=
! 68: }
! 69: \def\shipAfterBox{\aftergroup\shipAfterRegister}
! 70:
! 71: % now we have whatever is being shipped in box0,
! 72: % so we can insert crop marks
! 73: \newdimen\croplength \croplength=20pt
! 74: \newdimen\cropsep \cropsep=10pt
! 75: \newdimen\cropwidth \cropwidth=0.5pt
! 76:
! 77: \newdimen\croppadtop \croppadtop=-5pt % difference normal \baselineskip
! 78: % to height of a \small\strutbox
! 79: \newdimen\croppadbot \croppadbot=0pt
! 80: \newdimen\croppadlr \croppadlr=0pt
! 81: \newif\ifbottomcrops \bottomcropsfalse
! 82:
! 83: \def\crophrule{\vrule height\cropwidth depth0pt width\croplength}
! 84: \def\cropvrule{\vrule width\cropwidth depth0pt height\croplength}
! 85:
! 86: {\catcode`@=11 % use @ as a normal character
! 87: \expandafter\ifx\csname @themargin\endcsname\relax
! 88: \global\let\@themargin=\z@\fi
! 89:
! 90: \gdef\shipAfterRegister
! 91: {\setbox0\vbox
! 92: {\offinterlineskip
! 93: \dimen0\cropsep\advance\dimen0\croplength
! 94: \setbox2\hbox to \wd0
! 95: {\kern-\croppadlr\kern-.5\cropwidth
! 96: \kern\@themargin
! 97: \cropvrule\hfil\cropvrule
! 98: \kern-.5\cropwidth\kern-\croppadlr}
! 99: \setbox4\hbox to \wd0{\kern\@themargin
! 100: \llap{\crophrule\kern\cropsep\kern\croppadlr}
! 101: \hfil
! 102: \rlap{\kern\croppadlr\kern\cropsep\crophrule}}
! 103: % go a bit up, put vertical rules, put horizontal rules
! 104: \kern-\dimen0
! 105: \copy2
! 106: \kern\cropsep\kern-.5\cropwidth
! 107: \copy4
! 108: \kern-.5\cropwidth
! 109: % padding
! 110: \kern\croppadtop
! 111: % the box to be shipped
! 112: \box0
! 113: \ifbottomcrops
! 114: % padding
! 115: \kern\croppadbot
! 116: % and now the top in reverse
! 117: \kern-.5\cropwidth
! 118: \box4
! 119: \kern-.5\cropwidth\kern\cropsep
! 120: \box2
! 121: \fi
! 122: }
! 123: \xshipout\box0\relax
! 124: \if Y\CROP\else\global\let\shipout=\xshipout\fi}}%
! 125:
! 126: \let\CROP=N%
! 127: \def\thispagecropped{\global\let\shipout=\cshipout}
! 128: \def\allpagescropped{\global\let\CROP=Y\thispagecropped}
! 129: \def\nopagecropped{\global\let\CROP=N\global\let\shipout=\xshipout}
! 130:
! 131: \endinput
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>