[XeTeX] Synching PDF paper size with typesetting size

Philip TAYLOR (Webmaster, Ret'd) P.Taylor at Rhul.Ac.Uk
Sat Nov 5 21:55:13 CET 2011



Karljurgen Feuerherm wrote:

> Hmm. Is there not an integrated solution, set one thing to do it both places?

Well, specifying a given constant in exactly one place
is certainly a cornerstone of rigorous and defensive
programming, so I for one am all in favour of such
solutions.  Here, by way of example, is the preamble
of a document on which I am currently working -- you will
see that every key dimension is specified in one place
and one place only.  I don't pretend for one second that
it addresses your particular needs, but it does show that
"one constant, one definition" is not difficult to achieve.

Philip Taylor
--------
% !TeX program = xetex

\newdimen \innermargin
\newdimen \outermargin
\newdimen \uppermargin
\newdimen \lowermargin
\newdimen \cropwidth
\newdimen \cropheight
\newdimen \cropmark
\newdimen \cropmitre
\newdimen \Knuthoffset

\pdfpagewidth = 210 mm
\pdfpageheight = 297mm
\cropwidth = 190 mm
\cropheight = 250 mm
\cropmark = 1 cm
\cropmitre = 0.2 cm
\innermargin = 1 in
\outermargin = 1.5 in
\uppermargin = 1 in
\lowermargin = 1 in
\Knuthoffset = 1 in

\def \onehalf {0.5}

\hoffset = \pdfpagewidth
\advance \hoffset by -\cropwidth
\hoffset = \onehalf \hoffset
\advance \hoffset by \innermargin
\advance \hoffset by -\Knuthoffset

\voffset = \pdfpageheight
\advance \voffset by -\cropheight
\voffset = \onehalf \voffset
\advance \voffset by \uppermargin
\advance \voffset by -\Knuthoffset

\hsize = \cropwidth
\advance \hsize by -\innermargin
\advance \hsize by -\outermargin

\vsize = \cropheight
\advance \vsize by -\uppermargin
\advance \vsize by -\lowermargin

\input cropmarks
\topcropmark = \uppermargin plus \cropmark minus -\cropmitre
\bottomcropmark = \cropheight  plus \cropmark minus -\cropmitre
\advance \bottomcropmark by -\uppermargin
\leftcropmark = \innermargin plus \cropmark minus -\cropmitre
\rightcropmark = \cropwidth plus \cropmark minus -\cropmitre
\advance \rightcropmark by -\innermargin


More information about the XeTeX mailing list