diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/cropmark |
Initial commit
Diffstat (limited to 'macros/generic/cropmark')
-rw-r--r-- | macros/generic/cropmark/cropmark.sty | 94 | ||||
-rw-r--r-- | macros/generic/cropmark/croptest.tex | 44 |
2 files changed, 138 insertions, 0 deletions
diff --git a/macros/generic/cropmark/cropmark.sty b/macros/generic/cropmark/cropmark.sty new file mode 100644 index 0000000000..f6bdada0fb --- /dev/null +++ b/macros/generic/cropmark/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 diff --git a/macros/generic/cropmark/croptest.tex b/macros/generic/cropmark/croptest.tex new file mode 100644 index 0000000000..06058b6861 --- /dev/null +++ b/macros/generic/cropmark/croptest.tex @@ -0,0 +1,44 @@ +% An illustration of cropmark.sty by Victor Eijkhout. +% This file belongs to cropmark.sty version 1.0 or later, +% it is both plain TeX and LaTeX compatible. + +\def\plainname{plain} +\ifx\fmtname\plainname + \input cropmark.sty +\else + \documentstyle[cropmark]{article} + \begin{document} +\fi + +\parindent=0pt +\def\page +{Left\hfill toP +\vfill +Bottom\hfill righT +\eject} + +% First illustrate the default settings + +\page + +% Now stretch a bit (this is necessary for LaTeX) + +\ifx\plainname\fmtname + \advance\croppadtop by 5pt + \advance\croppadbot by 5pt + \advance\croppadlr by 2pt +\else + \addtolength{\croppadtop}{-10pt} + \addtolength{\croppadbot}{15pt} + \addtolength{\croppadlr}{15pt} +\fi + +\page + +\edef\byebye{ +\if\fmtname\plainname + \noexpand\csname bye\noexpand\endcsname +\else + \noexpand\end{document} +\fi} +\byebye
\ No newline at end of file |