summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/genmisc/cropmark.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-12 23:46:03 +0000
committerKarl Berry <karl@freefriends.org>2006-01-12 23:46:03 +0000
commit873660d1a83ece926fe7206288dda9c36b349c1b (patch)
treea48f77125c309a355b5d0eb58d6b24446abe9d62 /Master/texmf-dist/tex/generic/genmisc/cropmark.sty
parent2939242967231097459df0fc3150fabc2f639111 (diff)
generic 1
git-svn-id: svn://tug.org/texlive/trunk@613 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/genmisc/cropmark.sty')
-rw-r--r--Master/texmf-dist/tex/generic/genmisc/cropmark.sty94
1 files changed, 94 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/genmisc/cropmark.sty b/Master/texmf-dist/tex/generic/genmisc/cropmark.sty
new file mode 100644
index 00000000000..f6bdada0fb6
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/genmisc/cropmark.sty
@@ -0,0 +1,94 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Cropmark.tex
+% version 1.0
+%
+% This will put crop marks on everythings that's \shipout'ed.
+% It will work with any format, since it relies on redefinition
+% of \shipout. Exception: if you declare \output{} you will
+% not get crop marks.
+%
+% Cut along the center of the rules to get exactly the shipped
+% out box. To get padding around this box, use the parameters below.
+%
+% User adjustable parameters:
+% \croplength length of the crop rules
+% \cropwidth width of the crop rules
+% \cropsep separation between rule and page box
+% \croppadtop padding in case page box looks bigger than it is
+% \croppadbot (for instance with plain TeX head/footline)
+% \croppadlr
+%
+% Date: 17 March 1992
+%
+% Author:
+% Victor Eijkhout
+% Department of Computer Science
+% University Tennessee at Knoxville
+% 104 Ayres Hall
+% Knoxville, TN 37996
+% USA
+%
+% eijkhout@cs.utk.edu
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% save the old \shipout command
+\let\xshipout\shipout
+
+% define a new one: investigate what's being shipped
+\def\shipout{\futurelet\SomeBox\yshipout}
+
+% if its a box register, do postprocessing with \afterassignment,
+% otherwise do \afterassignment which will do \aftergroup
+\def\yshipout
+ {\ifx\SomeBox\box \let\next\shipAfterRegister
+ \else \ifx\SomeBox\copy \let\next\shipAfterRegister
+ \else \let\next\shipAfterBox \fi\fi
+ \afterassignment\next\setbox0=
+ }
+\def\shipAfterBox{\aftergroup\shipAfterRegister}
+
+% now we have whatever is being shipped in box0,
+% so we can insert crop marks
+\newdimen\croplength \croplength=20pt
+\newdimen\cropsep \cropsep=10pt
+\newdimen\cropwidth \cropwidth=2pt
+
+\newdimen\croppadtop \croppadtop=0pt
+\newdimen\croppadbot \croppadbot=0pt
+\newdimen\croppadlr \croppadlr=0pt
+
+\def\crophrule{\vrule height\cropwidth depth0pt width\croplength}
+\def\cropvrule{\vrule width\cropwidth depth0pt height\croplength}
+
+\def\shipAfterRegister
+ {\setbox0\vbox
+ {\offinterlineskip
+ \dimen0\cropsep\advance\dimen0\croplength
+ \setbox2\hbox to \wd0
+ {\kern-\croppadlr\kern-.5\cropwidth
+ \cropvrule\hfil\cropvrule
+ \kern-.5\cropwidth\kern-\croppadlr}
+ \setbox4\hbox to \wd0{\llap{\crophrule\kern\cropsep\kern\croppadlr}
+ \hfil
+ \rlap{\kern\croppadlr\kern\cropsep\crophrule}}
+ % go a bit up, put vertical rules, put horizontal rules
+ \kern-\dimen0
+ \copy2
+ \kern\cropsep\kern-.5\cropwidth
+ \copy4
+ \kern-.5\cropwidth
+ % padding
+ \kern\croppadtop
+ % the box to be shipped
+ \box0
+ % padding
+ \kern\croppadbot
+ % and now the top in reverse
+ \kern-.5\cropwidth
+ \box4
+ \kern-.5\cropwidth\kern\cropsep
+ \box2
+ }
+ \xshipout\box0\relax}
+\endinput