3

I have a legacy book written in Plain TeX which contains code that centers the page in A4 paper. I need to add crop marks to these A4 pages at the correct positions for the target book size.

I have the originals TeX sources and the legacy dvi and ps files.

I thought about using dvips -k, but it does not allow me to choose the position of the crop marks. Do I need to hack crop.pro to move the crop marks to where I need them?

What other options are available? Use a small wrapper document that uses the pdfpages and crop packages?

I'd rather not have to recompile the document if I can avoid it.

6
  • A non TeX solution is to "stamp" the legacy book with crop marks: convert the book to pdf, create a one page pdf with the crop marks in the right places (using TeX or a drawing software) and stamp the pdf book with command line tools like pdftk or cpdf.
    – alwaysask
    Commented Dec 21, 2015 at 21:26
  • Do you have the dimensions of the cropmarks? You can make the PostScript code to draw the cropmarks and inject this code to every page of your PostScript file with a batch file in awk or gema, or something along those lines.
    – jarnowicz
    Commented Dec 21, 2015 at 22:13
  • @erreka, yes, that's what I meant with hacking crop.pro.
    – lhf
    Commented Dec 21, 2015 at 22:17
  • but you meant to do it while processing the dvi with dvips, right? I think you could change the ps file directly; or perhaps a backup copy, just to fall on the safe side.
    – jarnowicz
    Commented Dec 21, 2015 at 22:26
  • @erreka, I meant that yes, but your idea is good too! I can just add the proper bop=hook. Could you please add your comment as an answer? Thanks.
    – lhf
    Commented Dec 21, 2015 at 23:00

2 Answers 2

5

A non TeX solution is to "stamp" the legacy book with crop marks: convert the book to pdf, create a one page pdf with the crop marks in the right places (using TeX or a drawing software) and stamp the pdf book with command line tools like pdftk or cpdf.

4

I've ended up editing (a copy of) the legacy ps file and adding the code below just after %DVIPSSource. That was the advice given by @erreka in the comments. It's very nice that the output of dvips contains hooks; I've used bop-hook, which gets called at the beginning of each page.

The code also shifts the odd-numbered pages to cater for two-sided margins and the inner margin being larger than the outer margin.

Perhaps this code helps someone else that faces this issue in the future.

%%BeginProcSet: crop.ps
%!
/mm { 360  mul 127 div } def
/cm { 3600 mul 127 div } def
/in { 72 mul } def
/CML 1 cm def
/CM {
    moveto
    CML neg 0 rmoveto
    CML 2 mul 0 rlineto
    CML neg CML neg rmoveto
    0 CML 2 mul rlineto
    stroke
} def
%
/bop-hook {
    gsave
    13.6 mm 1 in translate
    0.3 mm setlinewidth
    0 0 0 setrgbcolor
    0 0 CM
    175 mm 0 CM
    175 mm 240 mm CM
    0 240 mm CM
    grestore
    dup
    2 mod 1 eq
    { 1 cm neg 0 translate }
    if
} def
%%EndProcSet
1
  • neat! at first, my approach suggested more brute force (changing manually, or by batch file, all the pages), but yours (just changing the hook in the header) is far more elegant.
    – jarnowicz
    Commented Dec 22, 2015 at 20:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .