Debian Codegraph @

texmf-dist/doc/latex/zwpagelayout/zwpagelayout.tex

raw
1 %% $Id: zwpagelayout.tex 552 2022-04-18 09:39:07Z zw $
2 \input utf8-t1 % encTeX required
3 \documentclass[11pt]{article}
4 \usepackage{zwgetfdate}
5 \usepackage[footskip=30pt,topmargin=2cm,leftmargin=15mm,rightmargin=55mm,botmargin,nopdfinfo]{zwpagelayout}
6 \usepackage[T1]{fontenc}
7 \usepackage{lmodern,array,dcolumn,verbatim,graphicx}
8 \usepackage[figuresright]{rotating}
9 \usepackage[protrusion=false,expansion=true,stretch=8,shrink=24,step=4]{microtype}
10 \makeatletter
11 \renewcommand*\l@section{\@dottedtocline{1}{\z@}{1.5em}}
12 \makeatother
13 \extrarowheight 2pt
14 \mubytein 0 % important due to bug in url.sty
15 \usepackage[pdftitle=Page\ Layout\ with\ Crop\ Marks, pdfauthor=Zdenek\ Wagner,
16 pdfkeywords={page layout,\ crop marks},
17 bookmarks,bookmarksopen,bookmarksopenlevel=2]{hyperref}
18 \mubytein 1 \mubyteout 1 \mubytelog 1
19
20 \marginparwidth\UserRightMargin
21 \advance\marginparwidth -1cm
22 \advance\marginparwidth-\marginparsep
23
24 \def\mg#1{\ifvmode\leavevmode\fi\marginpar{\texttt{#1}}\ignorespaces}
25 \def\cmg#1{\mg{\char`\\#1}}
26 \def\omg#1{\ifvmode\leavevmode\fi\marginpar{\raggedright\hspace{0pt}\opt{#1}}\ignorespaces}
27 \def\opt#1{\texorpdfstring{\textmd{\textsc{#1}}}{#1}}
28 \let\pkg\textsc
29 \DeclareRobustCommand\cmd[1]{\texttt{\char`\\#1}}
30 \def\ie.{i.\,e.\@}
31 \def\eg.{e.\,g.\@}
32 \def\true{\bool{true}}
33 \def\false{\bool{false}}
34 \def\bool#1{\texorpdfstring{\textit{#1}}{#1}}
35 \def\is{\unskip\nobreak\space =\penalty200 \space\ignorespaces}
36
37 \DeclareRobustCommand\XeTeX{X\kern-.125em\lower.5ex\hbox{\csname
38 reflectbox\endcsname{E}}\kern-.1667em\TeX}
39 \DeclareRobustCommand\XeLaTeX{X\kern-.125em\lower.5ex\hbox{\csname
40 reflectbox\endcsname{E}}\LaTeX}
41
42 \makeatletter
43 \newcommand*\papdims[2][.]{\bgroup
44 \def\zw@papdim##1,##2\zw@{\sepunit{##1}#1\sepunit{##2}}%
45 \setkeys{zwpl}{#2}%
46 \expandafter\zw@papdim\zwpl@papersize\zw@\egroup}
47
48 \newcommand*\sepunit[2][\,]{\def\zw@a{}\def\zw@x{#1}\def\zw@y{}\def\zw@z{}\zw@sepunit#2\zw@}
49 \def\zw@sepunit#1{\ifx#1\zw@
50 \let\next\zw@sep@finished
51 \else
52 \edef\zw@a{\zw@a\zw@y}\edef\zw@y{\zw@z}\edef\zw@z{#1}\let\next\zw@sepunit
53 \fi \next}
54 \def\zw@sep@finished{\zw@a\zw@x\mbox{\zw@y\zw@z}}
55 \makeatother
56
57 \def\krat{\,\ensuremath{\times}\,}
58
59 \newcolumntype{x}{D{.}{\krat}{-1}}
60 \def\xx#{\multicolumn{1}{c|}}
61
62 \let\zwcomma\,
63 \def\,{\texorpdfstring{\zwcomma}{}}
64
65 \clubpenalty10000
66 \widowpenalty10000
67
68 \begin{document}
69 \hyphenation{post-script ghost-script allow-with-height-switching Output-Condition Output-Condition-Identifier}
70
71 \title{Page Layout with Crop Marks}
72 \author{Zdeněk Wagner\\\url{http://icebearsoft.euweb.cz}}
73 \date{Package date: \DateOfPackage{zwpagelayout}}
74 \maketitle
75
76 \begin{abstract}\noindent
77 This package was developed as a typographers toolbox offering the most important features for
78 everyday work. First it allows setting the paper size as well as the page layout. The next
79 important feature is the ability of printing crop marks both with \TeX~+~dvips or (x)dvipdfm(x) and with pdf\TeX.
80 Finally it is possible to reflect pages both horizontally and vertically, select black overprint
81 and set various PDF/X features.
82 \end{abstract}
83
84 \tableofcontents
85
86 \section{Introduction}
87 Users will probably ask: ``Why another page layout package? Is not \pkg{geometry} all what we
88 need?'' The answer to this question is not easy. The \pkg{geometry} package provides a lot of
89 features, maybe even too many features. However, some features are missing. Packages for crop marks
90 can also be found but correct positioning of the crop marks requires cooperation with the
91 page layout package. It is therefore natural to integrate both these functions into a single
92 package.
93
94 The package is useful also for preparation of book covers. It places the marks showing the position
95 of a spine and optionally flaps. If you want to see whether the spine and the front and back cover
96 contents are properly aligned, you can display the frames. Moreover, it is often necessary to
97 create a proof of the cover while the book is not yet finished and the thickness of the spine is
98 not known and can be only approximated. You can thus leave the paper width empty and the package
99 will calculate it from the page width, the flap width and the spine thickness. Whenever the final
100 value of the spine thickness is known, you change it in the list of options and the whole layout
101 will adapt automatically.
102
103 The files usually fail to meet PDF/X conformance due to silly reasons. It is always mandatory to
104 set the title, creation date and modification date in any PDF file. It can be done by the
105 \pkg{hyperref} package. However, \pkg{hyperref} is a complex package that may cause clashes with
106 other packages. We do not want to kill ants by cannon balls, therefore we do simple things by simple
107 means. Options for partial PDF/X conformance were added but may be switched off if a user wishes to
108 use \pkg{hyperref}.
109
110 The package is a result of a long-term development inspired by author's everyday needs. It is a
111 collection of macros that were manually copied from document to document, later placed into private
112 packages and finally it matured into a package prepared for general use.
113
114 Being a result of development it may happen that you may be in the same situation in which I was
115 myself. The book was finished and the last task was to add the crop marks. Removing layout
116 definition from a document and replacing it with a different package may cause errors and one more
117 proof-reading is time consuming and expensive. This package therefore allows the page layout logic
118 to be switched off and just add the crop marks provided the paper dimensions are correctly
119 supplied. The details will be explained later when describing the package options.
120
121 \section{Installation}\label{installation}
122 The package consists of a single file, \texttt{zwpagelayout.sty}. Put it to a directory where
123 \LaTeX\ expects packages, preferably \texttt{texmf-dist/tex/latex/zwpagelayout}. All remaining
124 files belong to the documentation, put them to a directory where documentation (including
125 documentation sources) is expected by \pkg{texdoc} or a similar program, preferably
126 \texttt{texmf-dist/doc/zwpagelayout}.
127
128 \section{Package dependence}
129 As written in the introduction, the goal was to implement as much within this single package in
130 order to reduce the risk of clashes. Yet a few packages may be loaded. The package needs to know
131 what engine is being used. For this purpose the \pkg{iftex} package\footnote{Up to version 1.4c
132 both \pkg{ifxetex} and \pkg{ifpdf} were used. Nowadays both these packages are deprecated and load
133 \pkg{iftex}. The package would fail with a critical error if they were used.} is used. If
134 the package is not found, it is assumed that the engines are not available.
135 No error is reported. The color support requires the \pkg{color} package. It is loaded only if the
136 color support is requested. The algorithm for deciding when the package is needed will be described
137 in detail in section~\ref{color}.
138
139 Option setting is implemented via the \pkg{kvoptions} package which in turn loads the \pkg{keyval}
140 package. These packages should be available in any nowaday's \TeX\ distribution.
141
142 \section{Usage}
143 The package is loaded simply by:
144
145 \vb
146 \verb;\usepackage[;$\langle$options$\rangle$\verb;]{zwpagelayout};
147
148 \vb\noindent
149 Remember that the options cannot be given later, all of them must be present either here or as
150 options to the \cmd{documentclass} command. The package will set some dimensions based upon
151 \cmd{normalsize}. The package that modifies font sizes must therefore be loaded before
152 \pkg{zwpagelayout}.
153
154 \section{Option values}
155
156 Some options accept a value. If the option is not specified, it may have a \textbf{default} value. For ease of use an
157 option may be given without a value. It will then have a \textbf{standard} value. The default and standard
158 values will be given in the option description.
159
160 The option value may sometimes contain spaces and commas. However, commas are used to separate
161 options, and during parsing the spaces are ignored. The spaces must therefore be preceded by a
162 backslash and an option value containing commas must be enclosed in braces, for example:
163
164 \vb
165 \begin{verbatim}
166 \usepackage[a4,subject=Some\ subject,
167 keywords={keyword\ 1,\ keyword\ 2}]{zwpagelayout}
168 \end{verbatim}
169
170 \section{Driver selection}\label{driver.selection}
171 The driver is usually selected automatically. The package makes use of the \pkg{ifxetex} and
172 \pkg{ifpdf} packages to detect either \XeTeX\ or pdftex. If none of them is detected, dvips is
173 assumed.
174
175 \omg{driver}
176 It may sometimes be necessary to set the driver manually by giving the \opt{driver} option. This
177 option recognizes drivers \texttt{unknown}, \texttt{pdftex}, \texttt{xetex}, and \texttt{dvips}. In
178 addition \texttt{other} is an alias to \texttt{unknown}, \texttt{dvipdfm} and \texttt{xdvipdfmx}
179 are aliases to \texttt{xetex}.
180
181 The package shows the driver in the log file. If the driver is set to \texttt{unknown}, all driver
182 specific features will be disabled.
183
184 \section{Paper size and orientation}
185 The first task of the package is to define paper size and orientation. Remember that the package is
186 intended for use in real life where we cannot be limitted to standard papers sizes. However, the
187 standard paper sizes are used quite often and we must be able to use them too. The options were
188 tested with pdf\TeX, \pkg{dvips} as well as \pkg{(x)dvipdfm(x)}.
189
190 \subsection{Orientation}\label{orientation}
191 \omg{AllowWidthHeightSwitching}
192 The package usually accepts the dimentsions as they are, \ie. width and height of the page. The
193 orientation cannot be changed. If you wish to have the possibility to change the orientation, you
194 have to use this option. It is used automatically with all standard paper sizes (see
195 section~\ref{standard}). You will rarely specify it yourself.
196
197 \omg{Portrait}\omg{Landscape}
198 These options sets the paper orientation, \opt{Portrait} is the default. They can be used only if
199 \opt{AllowWidthHeightSwitching} was specified, otherwise they are ignored.
200
201 \subsection{Paper size}
202 The package option defines the trimmed paper size. If the crop marks are added, the real paper size
203 will be added. Dimensions \cmd{paperwidth} and \cmd{paperheight} will thus contain the values that
204 will subsequently be sent to the driver. If you for any reason wish to know the trimmed dimensions,
205 you can calculate them as follows:
206
207 \begin{center}
208 trimmed width = \cmd{paperwidth} -- 2\cmd{hoffset}
209
210 trimmed height = \cmd{paperheight} -- 2\cmd{voffset}
211 \end{center}
212
213 \subsubsection{Generic paper size}
214 \omg{papersize}
215 Option \opt{papersize} is used to define arbitrary paper size. You define it as a pair of two
216 dimensions, the width and the height. The numbers are separated by a comma, therefore the
217 specification must be enclosed within braces, \eg.
218
219 \begin{verbatim}
220 \usepackage[papersize={200mm,100mm}]{zwpagelayout}
221 \end{verbatim}
222
223 The above written command sets the paper width to 200\,mm and the paper height to 100\,mm, \ie. the
224 paper orientation will be landscape. Now consider the following:
225
226 \begin{verbatim}
227 \usepackage[papersize={200mm,100mm},
228 AllowWidthHeightSwitching]{zwpagelayout}
229 \end{verbatim}
230
231 Since the width/height switching is allowed and the default orientation is portrait (option
232 \opt{Portrait} is the default), the width will be 100\,mm and the height will be 200\,mm.
233
234 You can achieve the same result as the first command by the lengthy code:
235
236 \begin{verbatim}
237 \usepackage[papersize={200mm,100mm},
238 AllowWidthHeightSwitching,Landscape]{zwpagelayout}
239 \end{verbatim}
240
241 You see that the command may become confusing. You should better not use
242 \opt{AllowWidthHeightSwitching} together with \opt{papersize}.
243
244 If the \opt{papersize} option is not used, it defaults to the A4 size, \ie. to paper dimensions \papdims[\krat]{a4}.
245
246 If the book cover is being typeset, we want to calculate at least the width. The detailed
247 explanation will be given in section~\ref{missing}. Here we put just as an example:
248
249 \begin{verbatim}
250 \usepackage[papersize={,200mm},spine=15mm,textwidth=14cm,
251 margins]{zwpagelayout}
252 \end{verbatim}
253
254 It is even possible to calculate both dimensions using \eg.
255
256 \begin{verbatim}
257 \usepackage[papersize,spine=15mm,textwidth=14cm,textheight=20cm,
258 margins]{zwpagelayout}
259 \end{verbatim}
260
261 \subsubsection{Standard paper sizes}\label{standard}
262 \omg{a0\,\ldots\,c10}\omg{executive}\omg{legal}\omg{letter}
263 Options \opt{a0}\ldots\opt{a10}, \opt{b0}\ldots\opt{b10}, \opt{c0}\ldots\opt{c10} are used to
264 select paper size according to the A, B or C series where the dimensions are rounded to integers in
265 milimeters. For instance, the A6 size is \papdims[\krat]{a6}. The package also supports paper sizes
266 \opt{executive} (\papdims[\krat]{executive}), \opt{legal} (\papdims[\krat]{legal}), and
267 \opt{letter} (\papdims[\krat]{letter}). If one of these options is used,
268 \opt{AllowWidthHeightSwitching} and \opt{Portrait} are assumed. The page orientation may be
269 switched by option \opt{Landscape} (see section~\ref{orientation}).
270
271 \subsection{Page bounding boxes}\label{Bboxes}
272 The drivers usually set MediaBox to the physical size of the page. If cropmarks are requested (see
273 section~\ref{cropmarks}), the package sets also BleedBox and TrimBox, ArtBox is explicitely
274 forbidden by PDF/X. CropBox is
275 intentionally unset since it causes cropped display in Adobe Reader. Since page size setting is
276 delayed, MediaBox contains the whole page including the area for the cropmarks. MediaBox is
277 calculated by the driver, the other boxes are calculated by \TeX. Their dimensions are therefore
278 not exact because \TeX\ does not use floating point arithmetic. The difference is negligible.
279
280 \omg{noBboxes}
281 Option \opt{noBboxes} disables setting the above mentioned boxes. Currently there is a known bug
282 causing fatal error in Adobe Distiller if these boxes are set.
283
284 \cmg{noBboxes}
285 Macro \cmd{noBboxes} performs exactly the same action as the \opt{noBboxes} option. The only
286 advantage is that it can be used later in the preamble of the document. It cannot be used after
287 \verb.\begin{document}. because the boxes are already set at that time.
288
289 \section{Page layout options}
290 These options define the layout of the odd page. The layout of the even page is assumed to be a mirror image.
291 The values of \cmd{oddsidemargin} and \cmd{evensidemargin} are calculated from the values of the options.
292
293 \subsection{Margins}
294 This set of options us used to define margin sizes.
295 Remember that all margins are measured from the top left corner of the paper, not from 1in border which is
296 the \textsc{dvi} origin!
297
298 \subsubsection{Option \opt{margins}, standard 0\,mm}
299 \omg{margins}
300 This option sets all margins (top, left, right, bottom) to the specified size. You will not be able to change
301 some of the margin to another size. If you need different size for any margin, you have to set all of them
302 separately and not use this option. Notice that almost everything may be calculated automatically, thus it is
303 not necessary to specify all values.
304
305 \subsubsection{Option \opt{topmargin}, default 1\,in}
306 \omg{topmargin}
307 This option sets the value of \cmd{topmargin}.
308
309 \subsubsection{Option \opt{botmargin}, standard \opt{topmargin}}
310 \omg{botmargin}
311 This option specifies the size of the margin below the running footer.
312
313 \subsubsection{Option \opt{leftmargin}, default --1\,in}
314 \omg{leftmargin}
315 This option sets the value of the margin at the left side of an odd page (and the margin at the right side of
316 an even page). Negative value means that the value was not given.
317
318 \subsubsection{Option \opt{rightmargin}, default --1\,in}
319 \omg{rightmargin}
320 This is the size of the right side of an odd page. Similarly the negative value means that the option was not
321 specified.
322
323 \subsection{Text dimensions}
324 The following options are used to specify the height and width of the text.
325
326 \subsubsection{Option \opt{textwidth}, default --1\,in}
327 \omg{textwidth}
328 This option specifies the width of the text without marginal notes. Its meaning is different for
329 book covers. The option specifies the width of the cover without the extra spine (\opt{xspine}),
330 flap (\opt{flap}) and trimming (\opt{xtrim} or \opt{trim}).
331
332 \subsubsection{Option \opt{textheight}, default --1\,in}
333 \omg{textheight}
334 This option specifies the total height of the text including the header and footer.
335
336 \subsubsection{Option \opt{headheight}, default 0\,mm}
337 \omg{headheight}
338 This option specifies the height of the running head.
339
340 \subsubsection{Option \opt{headsep}, default 0\,mm}
341 \omg{headsep}
342 This is the value of \cmd{headsep}.
343
344 \subsubsection{Option \opt{footskip}, default 0\,mm}
345 \omg{footskip}
346 This option specifies the value of \cmd{footskip}.
347
348 \subsubsection{Option \opt{topskip}\texorpdfstring{, default \cmd{topskip}}{}}
349 \omg{topskip}
350 This option enables changing the value of \cmd{topskip}. It is rarely needed. However, the value of
351 \cmd{topskip} is usually less than \cmd{baselineskip} which may cause problems in some page layout schemes.
352 Since we have already written that font sizes must be defined before \pkg{zwpagelayout} is loaded, you can
353 safely specify \verb;topskip=\baselineskip;.
354
355 \subsubsection{Option \opt{strictheight}, default \false, standard \true}
356 \omg{strictheight}
357 The value of the \LaTeX\ dimension \cmd{textheight} is calculated from the values of the options and later
358 adjusted so that together with \cmd{topskip} it represents an integer number of lines. This may not be
359 desirable in some cases. This option instructs the package not to perform any adjustment and accept the
360 calculated value.
361
362 \subsubsection{Option \opt{adjustfootskip}, default \true, standard \true}
363 \omg{adjustfootskip}
364 If option \opt{strictheight} is not given, the calculated value of \cmd{textheight} is decreased to the nearest
365 integer multiple of \cmd{baselineskip}. The difference is then added to \cmd{footskip} in order to preserve to
366 total height. If \opt{adjustfootskip} is set to \false, the difference is added to \cmd{headsep} instead.
367
368 \begin{figure}[bt]
369 \noindent
370 \includegraphics{adjustfoot}\hfill
371 \includegraphics{adjusthead}
372
373 \vb
374 \caption{Compensation of \cmd{textheight} by changing \cmd{footskip} (on the left) and
375 \cmd{headsep} (on the right)}\label{adj}
376 \end{figure}
377
378 The difference betweem these two options is shown in figure~\ref{adj}. Adjustment of \cmd{footskip}
379 was achieved by:
380
381 \vb
382 \begin{verbatim}
383 \usepackage[c8,margins=6mm,headheight=4mm,headsep=4mm,
384 croplength=3mm,cropgap=2mm,
385 cropmarks,cropframe,croptitle=Adjust\ footskip]{zwpagelayout}
386 \end{verbatim}
387
388 \vb \noindent
389 The sample on te right side of the figure was created by:
390
391 \vb
392 \begin{verbatim}
393 \usepackage[c8,margins=6mm,headheight=4mm,headsep=4mm,adjustheadsep,
394 croplength=3mm,cropgap=2mm,
395 cropmarks,cropframe,croptitle=Adjust\ headsep]{zwpagelayout}
396 \end{verbatim}
397
398 \subsubsection{Option \opt{adjustheadsep}, default \true, standard \true}
399 \omg{adjustheadsep}
400 This is a complementary option to \opt{adjustfootskip}.
401
402 \section{Calculation of missing dimensions}\label{missing}
403 The package can either calculate paper size from the page layout dimensions or calculate missing
404 page layout dimensions if the paper size and some dimensions are known. It operates separately for
405 the height and width. You can \eg. define the paper height and calculate the text height from it
406 and the margins but specify all width layout dimensions and calculate the paper width.
407
408 When designing simple pages it is better to define the paper size and calculate some page layout
409 dimensions. However, for bok covers it is recommended to calculate at least the paper width from
410 the layout dimensions of the front cover, the spine and the flap width.
411
412 \subsection{Calculation of the paper size}
413 Remember that paper size can be calculated only if all page layout dimensions for the corresponding
414 orientation (height, width) are specified. There is no diagnostics for warning you if some
415 important options are missing, the resukt will just be wrong or the package may even report an
416 error. All dimensions are considered \emph{without} the area for the crop marks.
417
418 \subsubsection{Paper height}
419 Calculation of the paper height is very simple. The formula is:
420
421 \vb
422 \cmd{paperheight} = \opt{topmargin} + \opt{textheight} + \opt{botmargin} + 2 \opt{ytrim}
423
424 \vb \noindent
425 Remember that \opt{textheight} includes also \cmd{headheight}, \cmd{headsep}, and \cmd{footskip}.
426 It is not necessary to specify \opt{ytrim}, the package checks the existence of this option and
427 removes it from the formula if not given.
428
429 \subsubsection{Paper width}
430 Algorithm for calculating the paper width differs for simple pages and book covers. In the simple
431 case the paper width is calculated as follows:
432
433 \vb
434 \cmd{paperwidth} = \opt{leftmargin} + \opt{textwidth} + \opt{rightmargin}
435
436 \vb \noindent
437 The value of \cmd{textwidth} will be equal to \opt{textwidth}. The same value will be stored in
438 macro \cmd{UserWidth}, see section~\ref{crop.macros}.
439
440 If the book cover is designed, the \opt{textwidth} option refers to the width of the text at the
441 front cover but \opt{leftmargin} and \opt{rightmargin} are used to set \cmd{oddsidemargin} and
442 \cmd{evensidemargin}. It is therefore better to set these options to zero, or alternatively to the
443 same value as \opt{flap} or \opt{xtrim} if the corresponding area will be left empty. The value of
444 \cmd{textwidth} will then be calculated from the final paper width by:
445
446 \vb
447 \cmd{textwidth} = \cmd{paperwidth} -- \opt{leftmargin} -- \opt{rightmargin}
448
449 \vb
450 If the \opt{flap} option is used without the \opt{spine} option in order to emulate the front cover
451 and spine with an empty back cover, the paper width is calculated as:
452
453 \vb
454 \cmd{paperwidth} = \opt{leftmargin} + \opt{flap} + \opt{textwidth} + \opt{xtrim} +
455 \opt{rightmargin}
456
457 \vb \noindent
458 The value of \opt{xtrim} may be omitted. The value of \opt{xspine} will be silently ignored. It is
459 not allowed to have just the spine, the front cover and the flap while leaqving the back cover
460 empty.
461
462 The case of a book cover with the spine given is a bit more complicated:
463
464 \vb
465 \textit{width} = \opt{xspine} + \opt{textwidth} + \opt{flap} + \opt{xtrim}
466
467 \cmd{paperwidth} = \opt{leftmargin} + \opt{spine} + 2 \textit{width} + \opt{rightmargin}
468
469 \vb \noindent
470 Options \opt{xspine}, \opt{flap}, and \opt{xtrim} need not be specified if these elements are not
471 needed.
472
473 \subsection{Calculation of page layout dimensions}\label{calc.pg.layout}
474 Algorithm for calculating the page layout dimensions is intended for simple pages, not for book
475 covers. Options \opt{xtrim}, \opt{ytrim}, \opt{spine}, \opt{xspine}, and \opt{flap} are silently
476 ignored but will be taken into account when producing the crop marks. You can still make use of
477 this algorithm if you understand what you are doing and if you wish to do extra calculations
478 yourself.
479
480 The dimensions may be overdetermined. In such a case the algorithm disregards one of the dimensions
481 and calculates it.
482
483 \subsubsection{Vertical dimensions}\label{vert.dim}
484 The algorithm first looks whether \opt{textheight} was given. If not it is assumed that the user
485 wishes to have it calculated from the paper height and the margins. If the \opt{botmargin} option was
486 not set, it will be set to the same valu as \opt{topmargin}.
487
488 In the second step the package looks whether \opt{botmargin} is defined, either by the user or from
489 the previous step. If so, the text height is calculated, otherwise the bottom margin is calculated
490 from the top margin and the text height. As a matter of fact, the bottom margin is never used by
491 \TeX.
492
493 Finally the value of \cmd{textwidth} is reduced by \cmd{headheight}, \cmd{headsep}, and
494 \cmd{footskip}. If \opt{strictheight} is \cmd{false}, the values are later adjusted according to
495 options \opt{adjustfootskip} and \opt{adjustheadsep} so that \cmd{textheight} -- \cmd{topskip} is
496 an integer multiple of \cmd{baselineskip}.
497
498 \subsubsection{Horizontal dimensions}
499 The sum of the horizontal dimensions must be equal to the paper width according to the relation:
500
501 \vb
502 \opt{leftmargin} + \opt{textwidth} + \opt{rightmargin} = \cmd{paperwidth}
503
504 \vb \noindent
505 If all three dimensions are specified, \opt{textwidth} is disregarded and calculated from the other
506 dimensions. If any two dimensions are given, the missing one is calculated from the above formula.
507 If only one dimension is given, it is assumed that both margins have the same size and the above
508 formula is applied. It is even possible to omit all dimensions. In such a case the margins are
509 assumed to have the same size as \opt{topmargin} and the text width can thus be calculated.
510
511 \section{Page reflection}\label{reflection}
512 \omg{Reflect\-Horizontally}
513 \omg{ReflectVertically}
514 We sometimes need to print the whole document as a mirror image. Although there are external tools
515 that can provide such a job taking PDF or PS as input, it is useful to do everything in a single
516 step. The package provides options \opt{ReflectHorizontally} for horizontal reflection and
517 \opt{ReflectVertically} for vertical reflection, respectively. If you specify both, some drivers
518 may interpret both of them and print rotated 180$^{\circ}$, some interpret only one of them.
519
520 The PostScript to PDF converters optionally rotate pages according to the text direction. They may
521 be confused by reflected text and add undesired rotation. If the horizontally reflected text is
522 roteted 180$^{\circ}$, it looks as if it were reflected vertically instead.
523
524 Remember that these options are intended for printing only.
525 The hypertext links made by the \pkg{hyperref} package will be wrong. If you wish to rotate parts
526 of texts and preserve hyperlinks, use \pkg{rotating} instead.
527
528 A word of warning has to be said. In \texttt{pdftex} reflection is implemented by redefininng
529 \cmd{shipout}. We add PDF literal code to the beginning of each page. For \texttt{dvips} we add
530 code to the \texttt{bop-hook}. If you need your own code in the \texttt{bop-hook}, you have to
531 store the old definition and execute it. For \texttt{xetex} we add code to \texttt{bop} and
532 \texttt{eop}. It seems that only one \texttt{bop} and one \texttt{eop} can be used. That is why the
533 page is reflected vertically if both options are used. As a result you are not allowed to use your
534 own \texttt{bop} and \texttt{eop} code together with these options.
535
536 \section{Crop marks}\label{cropmarks}
537 The crop marks must appear outside the print area. The package assumes that \cmd{paperheight} and
538 \cmd{paperwidth} contain the page size after trimming. These dimensions will then be increased and the page
539 will be shifted by setting \cmd{hoffset} and \cmd{voffset}. If you wish to print the crop marks using
540 \opt{zwpagelayout}, you must not change values of \cmd{hoffset} and \cmd{voffset}.
541
542 The values of \cmd{hoffset} and \cmd{voffset} will be set to the sum of \opt{croplength} and \opt{cropgap}, see the following
543 text.
544
545 \subsection{Basic crop marks options}
546 Options described in this section define basic behaviour of the crop marks. The options can be used
547 in all crop mark styles.
548
549 \subsubsection{Option \opt{onlycropmarks}, default \false, standard \true}
550 \omg{onlycropmarks}
551 It may happen that a document is already finished and proof-read and just the crop marks have to be added.
552 By specifying option \opt{onlycropmarks} you instruct the package to ignore all page layout options and
553 interpret the crop marks options only. You just have to ensure that \cmd{paperheight} and \cmd{paperwidth} are
554 set to the dimensions of the trimmed page before the \pkg{zwpagelayout} package is loaded and \cmd{hoffset} and
555 \cmd{voffset} are left at their default values.
556
557 \subsubsection{Option \opt{cropmarks}, default \false, standard \true}
558 \omg{cropmarks}
559 This option asks for creation of the crop marks.
560
561 \subsubsection{Option \opt{nocropmarks}, default \true, standard \true}
562 \omg{nocropmarks}
563 This is a complementary option to \opt{cropmarks}.
564
565 \subsubsection{Option \opt{croplength}, default 5\,mm}
566 \omg{croplength}
567 This option specifies the length of the crop mark.
568
569 \subsubsection{Option \opt{cropgap}, default 5\,mm}
570 \omg{cropgap}
571 This is the space that must be left blank between the crop marks and the trimmed page. This area is
572 also known as bleed.
573
574 \subsubsection{Option \opt{cropframe}, default \false, standard \true}\label{cropframe}
575 \omg{cropframe}
576 When designing a book cover we often wish to verify whether all elements are properly aligned.
577 Option \opt{cropframe} can be used to print the frames. It is active only if \opt{cropmarks} was
578 specified.
579
580 \subsubsection{Option \opt{nocropframe}, default \true, standard \true}
581 \omg{nocropframe}
582 This is a complementary option to \opt{cropframe}.
583
584 \subsubsection{Option \opt{cropstyle}}\label{cropstyle}
585 \omg{cropstyle}
586 This option selects the style of the crop marks. Two styles are defined, \textit{default} and
587 \textit{leaflet}.
588
589 \subsubsection{Option \opt{croptitle}}
590 \omg{croptitle}
591 This option defines the text that should be printed on each page. It may \eg. be the title of the
592 document. Remember that all spaces are gobbled when parsing the options. The spaces must therefore
593 be specified as \verb*;\ ; or the text must be enclosed in curly braces.
594
595 \subsubsection{Option \opt{cropseparator}}
596 \omg{cropseparator}
597 This is the separator between the title and the page number. Its default value is \verb;:\quad;.
598
599 \subsubsection{Option \opt{pagenumberfirst}, default \false, standard \true}
600 \omg{pagenumberfirst}
601 Each page contains the title followed by the separator and the page number. If you set this
602 option to \true, the order will be reversed.
603
604 \subsubsection{Option \opt{pagenumberlast}, default \true, standard \true}
605 \omg{pagenumberlast}
606 This is a complementary option to \opt{pagenumberfirst}.
607
608 \subsubsection{Option \opt{usepagenumbers}, default \true, standard \true}
609 \omg{usepagenumbers}
610 This option requests printing the page numbers.
611
612 \subsubsection{Option \opt{nopagenumbers}, default \false, standard \true}
613 \omg{nopagenumbers}
614 This is a complementary option to \opt{usepagenumbers}.
615
616 \iffalse
617 \subsubsection{Option \opt{cropfontsize}}
618 \omg{cropfontsize}
619 This option defines the font size command issued just before the title and page number are printed.
620 The default command is \verb;\fontsize{10}{10};.
621
622 \subsubsection{Option \opt{cropfont}}
623 \omg{cropfont}
624 This option contains the command to select a font for the title and the page number. The default
625 command is \cmd{normalfont}.
626 \fi
627
628 \subsubsection{Option \opt{nobleedclip}, default \false, standard \true}
629 \omg{nobleedclip}
630 The pages are clipped to the bleed box so that graphics does not collide with the crop marks. Since
631 the package must work also with \pkg{dvips}, the PDF operators are not used and the crop marks area
632 outside the bleed box is just overpainted with white rectangles. The \pkg{color} package is thus
633 required and will be loaded automatically. If you set \opt{nobleedclip} to \true, the pages will
634 not be clipped. It may be useful if you know that nothing extends to the crop marks area and the
635 \pkg{color} package may clash with other packages required by your document.
636
637 \subsection{Options for the \textit{default} style}
638 These options can be used if \opt{cropstyle} is set to \textit{default} or omitted.
639
640 \subsubsection{Option \opt{spine}}
641 \omg{spine}
642 This option is used for designing book covers. It specifies the width of the book spine. You can
643 even request a zero width but negative values will have disastrous results.
644
645 \subsubsection{Option \opt{xspine}}
646 \omg{xspine}
647 This option defines the extra space adjacent to the spine so that the book can be safely opened.
648 This space should not be used for printing logos etc., because they will soon be damaged by
649 frequent use of the book. The option is ignored unless \opt{spine} is used.
650
651 \subsubsection{Option \opt{flap}}
652 \omg{flap}
653 This is another option for book covers. It specifies the width of the flap. If \opt{spine} is
654 given, the book cover is supposed to have flaps of equal sizes on both sides. Sometimes you do not
655 have flaps and the back cover remains empty, thus you do not like to prepare the design of it, you
656 just wish to design the spine and the front cover. This can be acheved by specifying \opt{flap} as
657 the spine thickness and omitting \opt{spine}.
658
659 \subsubsection{Options \opt{trim}, \opt{xtrim}, \opt{ytrim}}
660 \omg{trim}\omg{xtrim}\omg{ytrim}
661 The paper or canvas used for printing the book covers is folded to the inner side yet part of it
662 will be visible. Such part is specified by \opt{xtrim} in horizontal direction and \opt{ytrim} in
663 vertical direction. You can use \opt{trim} to set both of them to the same value.
664
665 \subsection{Options for the \textit{leaflet} style}\label{cropstyle.leaflet}
666 The following options can be used if \opt{cropstyle} is defined as \textit{leaflet}. As the value
667 says, the style is useful for leaflet production because in addtion to the crop marks additional
668 marks for folding. Not all options can be used with all fold types. It will be described in greater
669 detail in the following text.
670
671 The leaflets are usually printed on both sides and sometimes one of the leaves needs width
672 correction as will be explained later. The macros will apply the correction the one side on odd
673 pages and on the other side on even pages. This can only happen if the \opt{twoside} class option
674 is given or a class is used where two-side printing is the default. Usually the leaflet will
675 consist of two pages only but no check is made.
676
677 The \opt{cropframe} option (see~\ref{cropframe}) can also be used for previewing the leaflet
678 layout.
679
680 \subsubsection{Option \opt{leafcount}, default 4}
681 \omg{leafcount}
682 This option defines the number of leaves to be used in the Z-type. It is silently ignored with
683 other fold types. Internally other fold types overwrite it with the value they need in the macros.
684
685 \subsubsection{Option \opt{foldcorr}, default 0mm}
686 \omg{foldcorr}
687 As default all leaves have equal width. However, from technical or stylistic reasons the letmost or
688 righmost leaf requires a different width. This can be achieved by this option. The value specifies
689 an additional horizontal skip that is applied when printing the crop/fold marks and the optional
690 frames.
691
692 The width of the leaves is equal because it is achieved by \cmd{hfil}. If you specify
693 \verb.foldcorr=-2mm., the corrected leaf will be 2\,mm narower that the others. Since there is
694 \textit{1fil} in the width specification of the leaves, you can achieve nice tricks be specifying
695 \verb.foldcorr=5cm plus -1fil.. In such a case the \textit{1fil} in the corrected leaf will vanish
696 and its width will be 5\,cm.
697
698 Width corrections are not allowed in the \textit{Z} and \textit{4} types and the option value is
699 ignored. The details of the \opt{foldcorr} will be given in the next section.
700
701 \subsubsection{Option \opt{fold}, default 2}
702 \omg{fold}
703 This option selects a fold type used with the leaflet. Supported options are \textit{2},
704 \textit{3left}, \textit{3right}, \textit{4}, \textit{Z}. Their exact meaning is described below.
705
706 \begin{description}
707 \item[2] This option is used for singly folded leaflet. Usually the leaves will have different
708 widths. The width of the left leaf is modified by the \opt{foldcorr} option.
709 \item[3left] This option defines a leaflet with three leaves folded inside. For technical reasons
710 the leaf folded inside must be slightly narrower. Typically this is the leftmost leaf. The leaf can
711 be made narrower by applying \opt{foldcorr}.
712 \item[3right] This is essentially the same as the previous option with the only difference that the
713 \opt{foldcorr} correction is applied to the rightmost leaf.
714 \item[Z] This option is used for Z-folded leaflets. The number of leaves is defined by the
715 \opt{leafcount} option and with correction is not allowed.
716 \item[4] This type of leaflet looks as the Z-type but without a fold in the middle. It can be
717 viewed as a middle leaf of double width and the outer leaves are folded so that they touch each
718 other. The middle crop mark is therefore missing because there is no fold there but a line will be
719 drawn if the \opt{cropframe} option is requested.
720 \end{description}
721
722 As a final remark it is important to write that the width correction is applied as explained above
723 on the odd pages. The correction of the same size is applied to the opposite side of the leaflet on
724 even pages.
725
726 \section{Color support}\label{color}
727 The package offers basic color support, namely it prints the names of separations. The
728 color support is implemented via a few options. Color printing is performed using the \pkg{color}
729 package that is loaded automatically. The package does not use predefined color names.
730
731 The package recognizes the \pkg{color} package by existence of the \cmd{definecolor} macro. If this
732 macro is not defined, the \pkg{color} package will be added if:
733 \begin{itemize}
734 \item option \opt{color} is \true
735 \item option \opt{nobleedclip} is \false\ and \opt{cropmarks} is \true
736 \item option \opt{redefineblack} is \true
737 \item option \opt{redefinetocmyk} is \true
738 \item option \opt{overprint} is \true
739 \end{itemize}
740 If none of the above applies, the color support is not needed and the package will not be loaded.
741
742 If the \pkg{color} package is being loaded, no options are given to it. Especially the driver
743 selected by the \opt{driver} option (see section~\ref{driver.selection}) is not set. If you must
744 specify any option for the \pkg{color} package, you have to load it yourself before loading
745 \pkg{zwpagelayout}.
746
747 \subsection{Color support for cropmarks}
748 \omg{color}
749 Option \opt{color} asks for the color support. Without setting this option to \true\ all other
750 color options are silently ignored.
751
752 \omg{colormodel}
753 Option \opt{colormodel} defines the color model used. Its default value is \texttt{cmyk}. You will
754 rarely need to change it.
755
756 \omg{cropcolor}
757 Option \opt{cropcolor} specifies the color to be used for the crop marks. Remember that the crop
758 marks must be visible on all separations, thus it might not be sufficient to print them in black.
759 As default their color is mixed of 100\,\% of all components of the current color model. Since the
760 default model is \texttt{cmyk}, the default value of this option is \verb;{1,1,1,1};. Notice that the
761 syntax conforms to the requirements of the \pkg{color} package.
762
763 \omg{colors}\label{colors}
764 Option \opt{colors} assigns names to the color components of the current model. Specification of
765 each color must be enclosed in curly brackets. The color name is followed by a colon and comma
766 separated values conforming to the syntax of the \pkg{color} package. It will be clear from the
767 following examples.
768
769 Suppose that for some strange reason you prepare the document in the RGB space. Your specification
770 will then be:
771
772 \vb
773
774 \begin{verbatim}
775 \usepackage[cropmarks,color,colormodel=rgb,cropcolor={1,1,1},
776 colors={{RED:1,0,0},{GREEN:0,1,0},{BLUE:0,0,1}},
777 croptitle=RGB\ example]{zwpagelayout}
778 \end{verbatim}
779
780 \vb
781
782 Now we show a more realistic example. The document should be printed in custom colors. Since the
783 true specification of custom colors requires much work and is rarely worth the trouble, we make use
784 of the CMYK model. We will use cyan instead of Pantone 298 (blue), magenta instead of Pantone 213
785 (red), black will remain black and the yellow separation will be unused. The crop marks should not
786 produce anything on the yellow separation and we should provide proper color names. The
787 specification will therefore look as:
788
789 \vb
790
791 \begin{verbatim}
792 \usepackage[cropmarks,color,cropcolor={1,1,0,1},
793 colors={{Pantone\ 298\ (blue):1,0,0,0},
794 {Pantone\ 213\ (red):0,1,0,0},{Black:0,0,0,1}},
795 croptitle=Example\ with\ custom\ colors]{zwpagelayout}
796 \end{verbatim}
797
798 \vb
799
800 Notice that the \opt{colormodel} option was not specified. Its default value was used. The
801 \opt{cropcolor} option left zero for the yellow separation.
802
803 If a color is light as e.\,g. the process yellow, it may be better to display its name in white on
804 a colored background. This is achieved by preceding the color name with an asterisk. This is now
805 the default behaviour for the yellow color. The default definition is:
806
807 \vb
808 \begin{verbatim}
809 colors={{CYAN:1,0,0,0},{MAGENTA:0,1,0,0},{*YELLOW:0,0,1,0},{BLACK:0,0,0,1}}
810 \end{verbatim}
811
812 \vb
813
814 \subsection{CMYK colors}\label{cmykcolors}
815 \mg{cmykblack}\mg{cmykread}\mg{cmykgreen}\mg{cmykblue}
816 The \pkg{color} package defines \textit{black} using the GRAY model and colors \textit{red},
817 \textit{green}, \textit{blue} by the RGB model. The GRAY model rarely causes any problem but the
818 RGB model is not acceptable for printing. The \opt{zwpagelayout} package therefore defines the
819 corresponding colors using the CMYK model. Different names are selected so that there is no clash
820 in case you really need these colors in RGB.
821
822 \subsection{Overprinting support, default \false, standard \true}\label{overprinting}
823 \omg{overprint}
824 The overprinting support must be requested by the \opt{overprint} option. If the option remains
825 \false, the overprinting commands will be defined but will do nothing. Remember that you can
826 overprint any color, not just black. You thus should not enable overprinting globally. The mode is
827 therefore set to \textit{knockout} within the package.
828
829 \cmg{OverprintXeTeXExtGState}
830 Overprint is implemented in all supported drivers. However, there is a minor problem with the
831 (x)dvipdfm(x) family of drivers. The definition of the graphic state must be present in the
832 resources of each page where overprinting is used. The (x)dvipdfm(x) drivers do not do it
833 automatically, it has to be done by the \cmd{OverprintXeTeXExtGState} macro. Since the cropmarks
834 switch overprint off, they require the definition of the graphic state and the macro is always
835 invoked from the running head. This requirement is thus a minor problem. The user usually does not
836 care whether overprint is enabled for preview and proof-reading. The final document will have
837 cropmarks and thus overprint will be enabled.
838
839 \cmg{SetOverprint}\cmg{SetKnockout}
840 These macros change the mode to \textit{overprint} or \textit{knockout}, respectively. They act as
841 declarative macros, similarly as \eg. \cmd{itshape}. You have to use them within a group. The
842 macros are intended to be used for changing the mode for a longer part of text. Due to the way how
843 environments are handled in \LaTeX, it is also possible to write:
844
845 \vb
846 \begin{verbatim}
847 \begin{SetOverprint}
848 Some long text to be overprinted...
849 \end{SetOverprint}
850 \end{verbatim}
851
852 \vb
853
854 \cmg{textoverprint}\cmg{textknockout}
855 If a short part of text should be printed in a different mode, one-argument macros
856 \cmd{textoverprint} and \cmd{textknockout} can be used. They act similarly as the \cmd{textit}
857 macro.
858
859 \omg{redefineblack}
860 Overprinting works only if both the background and forground colors are in the CMYK model. However,
861 the \textit{black} color, which is most often overprinted, is defined in the GRAY model as default.
862 This package defines the \texttt{cmykblack} color that may be used for this purpose. In addition if
863 \opt{redefineblack} is set to \true, the standard \textit{black} color will be redefined in CMYK.
864
865 \omg{redefinetocmyk}
866 Although \textit{red}, \textit{green}, \textit{blue} will rarely be used for overprinting (maybe
867 just as a background), option \opt{redefinetocmyk} requests redefinition of these colors to CMYK.
868 The \textit{black} color will be redefined as well.
869
870 \vb
871 \textbf{Important note:} the (x)dvipdfm(x) drivers may switch to the gray colour model after
872 \cmd{textcolor} even if redefinition of black or even all colours to CMYK was requested. If black
873 overprint does not work, insert explicit \verb;\color{cmykblack};. This trick is not needed with
874 pdf\TeX\ or dvips.
875
876 \vb
877
878 \mg{grblack}\mg{rgbred}\mg{rgbgreen}\mg{rgbblue}
879 If the colors are redefined to CMYK, the original definitions are not available. Although you
880 redefine them due to a printing process where the RGB colors are undesirable, you can sometimes
881 need them. For this purpose \textit{grblack}, \textit{rgbred}, \textit{rgbgreen}, \textit{rgbblue}
882 colors are always available.
883
884 \section{PDF information}\label{pdfinfo}
885 The package writes the basic information that is required by PDF/X even if PDF/X conformace is not
886 requested. The basic pieces of information are \texttt{CreationDate} and \texttt{ModDate}.
887 Implementation is driver dependent and some information is supplied by the driver itself. Thus
888 \texttt{pdftex} inserts both, (x)dvipdfm(x) (\XeTeX) adds \texttt{CreationDate} only, dvips adds
889 none. The missing information is supplied by this package based on \cmd{date} and \cmd{time}. The
890 next subsections will explain how other fields can be defined and how they can be disabled if
891 needed.
892
893 \subsection{PDF title}\label{pdftitle}
894 \omg{title}
895 The \opt{title} option is used to set the title field. The default is to take the contents of the
896 \opt{croptitle} option even if the cropmarks are switched off. If \opt{croptitle} is empty,
897 \cmd{jobname} is used. If you specify this option without a value, it has a special meaning of
898 suppressing creation of PDF information field. Since this is not mnemonic, there is a
899 \opt{nopdfinfo} option with the same effect, see subsection~\ref{nopdfinfo}.
900
901 \subsection{PDF author}
902 \omg{author}
903 The \opt{author} option sets the author of the document. The field is not required by PDF/X,
904 therefore it has no default value.
905
906 \subsection{PDF subject}
907 \omg{subject}
908 The \opt{subject} option defines the subject of the document.
909
910 \subsection{PDF keywords}
911 \omg{keywords}
912 The \opt{keywords} option is used to set the list of keywords. Usually the keywords will be given
913 as a comma separated list. They must therefore be enclosed in braces.
914
915 \subsection{Option \opt{nopdfinfo}}\label{nopdfinfo}
916 \omg{nopdfinfo}
917 The above mentioned fields may also be set in the PDF file by the \pkg{hyperref} package. If
918 \pkg{hyperref} is used, it may not be desirable if \pkg{zwpagelayout} wrote the PDF information. If
919 you specify \opt{nopdfinfo} in the list of options, setting all above mentined information (including
920 \texttt{ModDate}) will be disabled. This option is not boolean, it just erases the contents of the
921 \opt{title} option, see subsection~\ref{pdftitle}. Since options are procesed in the order in which
922 they are declared in the package, \opt{nopdfinfo} will always erase the PDF title even if it is
923 specified before \opt{title}.
924
925 It has recently been found that these packages do not conflict, it is safe to specify some
926 pieces of information by \pkg{zwpagelayout} and other pieces of information via \pkg{hyperref}.
927 Anyway, this option will be preserved for the case that it might be needed in the future.
928
929 \section{PDF/X-1a compliance}\label{pdfx1a}
930 The package partially implements the PDF/X-1a standard. Remember that implementation is driver
931 dependent and not everything can be achieved with all drivers. The following sections will give you
932 more detail. Unlike the \pkg{pdfx} package we try to do as much in \texttt{xetex} and set the
933 bounding boxes according to the real page size.
934
935 \subsection{Option \opt{pdfminorversion}}
936 \omg{pdfminorversion}
937 This option allows you to set the version of the PDF file. It works with \texttt{pdftex} only. There
938 is no \cmd{special} for sending this information to (x)dvipdfm(x), it can only be set on the
939 command line. Similarly PostScript to PDF converters accept such setting from the command line or a
940 configuration file although there is a PS command for setting it.
941
942 \cmg{SetPDFminorversion}
943 The same effect can also be achieved by \cmd{SetPDFminorversion} from a preamble. The macro accepts
944 a single argument and is implemented for \texttt{pdftex} only. It does nothing for other drivers.
945
946 \subsection{Option \opt{pdfx}}
947 \omg{pdfx}
948 This option ask the package to create PDF/X-1a file. The first requirement is to set PDF version
949 to~1.3, thus it sets the minor version to~3 and then disables macro \cmd{SetPDFminorversion}. Other options
950 have reasonable default values but they can be changed as described in the following subsections.
951
952 PDF/X-1a compliance is not handled for \texttt{dvips} and some features are not available for
953 \texttt{xetex}.
954
955 \subsection{Options \opt{OutputCondition} and \opt{OutputConditionIdentifier}, default Euroscale
956 Coated~v2}
957 \omg{OutputCondition}
958 \omg{OutputConditionIdentifier}
959 These options specify the ICC profile. I am not sure how to obtain the correct names. The default
960 values correspond to the ICC profiles used in Europe but you can easily set another value. From my
961 personal experience I prefer \textit{eucmyk50} when converting my images from AdobeRGB to CMYK.
962
963 \subsection{Option \opt{ICCfile}}
964 \omg{ICCfile}
965 This option specifies the name of the file containing the ICC profile. There is no default
966 definition and no profile is embedded. The profiles usually accompany commercial products as
967 printers and scanners or can be downloaded from the web. If you have a CMYK profile that you wish
968 to embed, you can specify its name with the opt{ICCfile} option. The profile can only be embedded
969 by \texttt{pdftex}.
970
971 \subsection{Font embedding}
972 PDF/X requires all fonts to be embedded. The \pkg{zwpagelayout} package cannot ensure it. You have
973 to verify your configuration files and make sure that fonts are embedded.
974
975 \subsection{Page bounding boxes}
976 It is mandatory to set BleedBox and TrimBox in addittion to MediaBox. Setting these boxes
977 is explained in section~\ref{Bboxes}. ArtBox is explicitely forbidden by PDF/x, therefore it is not
978 set.
979
980 \subsection{PDF information}
981 Mandatory fields are title, CreationDate and ModDate. All these fields are set automatically unless
982 they are disabled as described in section~\ref{pdfinfo}.
983
984 \subsection{MPT metadata}
985 Emdedding MPT metadata is currently not implemented. It will be implemented in the future but only
986 for \texttt{pdftex}.
987
988 \subsection{Color}
989 PDF/X-1a allows only CMYK colors and spot colors. Since \pkg{zwpagelayout} does not handle colors
990 itself but makes use of the \pkg{color} package, it cannot verify that only allowed colors are
991 used.
992
993
994 \section{Useful macros}\label{macros}
995 The package offers two types of useful macros. The macros from the first group help in designing
996 the document. However, as mentioned in the Introduction, the package may be deployed in already
997 existing document just for adding the crop marks. In order to reduce the risk of conflicts with
998 other packages these macros are unavailable if the \opt{onlycropmarks} option is used. The second
999 group contains macros that are primarily used in the crop mark generation. They are always visible.
1000
1001 \subsection{Userspace macros}\label{user.macros}
1002 As written above, macros of this group are available only if the \opt{onlycropmarks} option was not
1003 used. It is not planned to make any interface for providing them even with the \opt{onlycropmarks}
1004 option. If the document is already finished, you do not need them. If you write a new document, it
1005 is preferable to use the whole package for defining the page layout. The macros will than be
1006 available.
1007
1008 \cmg{topskip}
1009 \cmg{Vcorr}
1010 \TeX\ should use integer arithmetic but some implementations, \eg. em\TeX, violate this rule. This
1011 makes processing the text faster but may have bad results. If you combine text with boxes and fixed
1012 size glues the height of which is an integer multiple of \cmd{baselineskip}, the round-off errors
1013 may add a few scaled points, the page overflows and as a result is made one line shorter and
1014 underfull vbox is reported. For this reason tiny shrink is added to \cmd{topskip}, its
1015 size is \the\topskip. Yet it may not be sufficient in some cases. We therefore provide vertical
1016 skip macro \cmd{Vcorr} the size of which is shrinkable zero. The meaning of \cmd{Vcorr} is {\tt
1017 \meaning\Vcorr}.
1018
1019 \cmg{vb}
1020 We often need a vertical skip the size of which is a multiple of \cmd{baselineskip}. Macro \cmd{vb}
1021 serves this very purpose. It accepts an optional argument in square brackets which denotes the
1022 multiple of \cmd{baselineskip}. The default value is~1. The command also contains compensation
1023 shrinkage. Some packages activate several characters, even those which could be used in numerical
1024 and dimension specifications. Hyphens and dots are temporarily deactivated within the optional
1025 argument of the \cmd{vb} macro. You thus can comfortably specify negative as well as fractional
1026 dimensions.
1027
1028 \cmg{NewOddPage}
1029 \LaTeX\ provides \cmd{cleardoublepage} for moving the next text to the beginning of the odd page.
1030 However, you have no control over the page style of the inserted empty even page. This feature is
1031 enabled in the \cmd{NewOddPage} macro. Its syntax is:
1032
1033 \vb
1034 \verb;\NewOddPage*[;$\langle$style$\rangle$\verb;];
1035
1036 \vb\noindent
1037 Optional parameter $\langle$style$\rangle$ defines the style of the empty even page that should be
1038 fed to the \cmd{thispagestyle} command. The default is \texttt{empty}. The starred version displays
1039 a warning in the log file if an empty page was inserted.
1040
1041 \cmg{SetOddPageMessage}
1042 This macro sets the contents of the message that should be displayed as a warning if an empty page
1043 was inserted as a result of \cmd{NewOddPage*}. The macro acts as \cmd{gdef}. This means that the
1044 definition is global and you can therefore have only one message unless you redefine it. The body
1045 of the message may contain macros. They will be expanded when the message is being written. You can
1046 use \cmd{MessageBreak} in order to split the text into several lines.
1047
1048 \cmg{NewEvenPage}
1049 Generally speaking, you should not start a chapter on an even page but there are cases when it is
1050 desirable. Imagine the situation when each chapter starts with a full page illustration on the left
1051 and with its title page on the right. In such cases you need to start at the even page but \LaTeX\
1052 does not contain any direct tool for doing it. This package provides the \cmd{NewEvenPage} with the
1053 same syntax as \cmd{NewOddPage}.
1054
1055 \cmg{SetEvenPageMessage}
1056 Similarly this macro serves for setting the message text that appears if an empty page was inserted
1057 as a result of the \cmd{NewEvenPage*} macro.
1058
1059 \subsection{Crop mark macros}\label{crop.macros}
1060 \cmg{clap}
1061 \TeX\ offers zero-width horizontal boxes with contents overlapping to the right (\cmd{rlap}) or to
1062 the left (\cmd{llap}). The \pkg{zwpagelayout} package frequently needs a zero-width box with the
1063 contents centered overlapping evenly to both sides. The package thus provides macro \cmd{clap} and
1064 makes it available for the user.
1065
1066 \cmg{CropFlap}
1067 \cmg{CropSpine}
1068 \cmg{CropXSpine}
1069 \cmg{CropXtrim}
1070 \cmg{CropYtrim}
1071 \cmg{UserWidth}
1072 \cmg{UserLeftMargin}
1073 \cmg{UserRightMargin}
1074 It was written in the Introduction that the package allows to prepare the book cover before the
1075 exact dimensions are known. Later we just adapt the values of the package options and everything is
1076 recalculated automatically. As a matter of fact, it could not happen if we did not refer to
1077 selected dimensions in the document symbolically. Thus the values of some options are available in
1078 macros: \cmd{CropFlap}\is\opt{flap}, \cmd{CropSpine}\is\opt{spine}, \cmd{CropXSpine}\is\opt{spine},
1079 \cmd{CropXtrim}\is\opt{xtrim}, \cmd{CropYtrim}\is\opt{ytrim},
1080 \cmd{UserWidth}\is\opt{textwidth}, \cmd{UserLeftMargin}\is\opt{leftmargin},
1081 \cmd{UserRightMargin}\is\opt{rightmargin}.
1082
1083 The use of these macros can be shown by an example. The book cover with flaps displayed in
1084 Figure~\ref{cover} was prepared by the following code:
1085
1086 \vb
1087 \verbatiminput{coversample}
1088
1089 \begin{sidewaysfigure}[p]
1090 \centerline{\includegraphics{coversample}}
1091
1092 \caption{Sample of a book cover with flaps}\label{cover}
1093 \end{sidewaysfigure}
1094
1095 Remember that these macros contain only the dimensions that were specified in the \cmd{usepackage}
1096 command, not those that were calculated by the algorithm described in section~\ref{calc.pg.layout}.
1097 If a shortcut option was used, all real dimensions are defined, \ie. the \opt{margins} option fills
1098 all four margin options, \opt{topmargin}, \opt{leftmargin}, \opt{rightmargin}, \opt{botmargin}, and
1099 the \opt{trim} option fills both \opt{xtrim} and \opt{ytrim}. You can take advantage of it to make
1100 your document more general. You can \eg. define the book cover in two variants, with or without
1101 flaps, using this trick:
1102
1103 \vb
1104 \begin{verbatim}
1105 \ifcat$\CropFlap$
1106 % no flaps
1107 \else
1108 \vbox to \textheight{\hsize\CropFlap
1109 Flap text
1110 }\hss
1111 \fi
1112 \end{verbatim}
1113
1114 \vb
1115
1116 \cmg{thePageNumber}
1117 Macro \cmd{thePageNumber} is used to print the page number together with the crop mark text. We have
1118 already shownd that it may be suppressed by the \opt{nopagenumbers} option. Another possibility is
1119 to redefine it. We can \eg. define the book title with the \opt{croptitle} option and use the
1120 text ``Cover'' instead of the page number when typesetting the cover. Usage of this macro is also
1121 demonstrated in Figure~\ref{cover}.
1122
1123 \subsection{Driver switching macros}\label{driver.switching}
1124 These macros provides conditional branching according to the currently selected driver no matter
1125 whether it is chosen automatically or by specifying the \opt{driver} option described in
1126 section~\ref{driver.selection}. The macros do not change page layout, they are therefore available
1127 even if the \opt{onlycropmarks} option was given.
1128
1129 \cmg{ifcaseZWdriver}
1130 Macro \cmd{ifcaseZWdriver} expands to an open \cmd{ifcase} primitive. You can thus branch the code
1131 according to the driver. The numeric values are 0 for \texttt{unknown}, 1 for \texttt{pdftex}, 2
1132 for \texttt{xetex}, 3 for \texttt{dvips}. The branching may look as follows:
1133
1134 \vb
1135 \begin{verbatim}
1136 \ifcaseZWdriver
1137 Code for unknown
1138 \or
1139 Code for pdftex
1140 \or
1141 Code for xetex
1142 \or
1143 Code for dvips
1144 \else
1145 Error, it may not happen!
1146 \fi
1147 \end{verbatim}
1148
1149 \vb
1150 Since \cmd{ifcaseZWdriver} is a macro, it cannot be used inside another conditional statement. If
1151 it falls to the \false\ branch, it will not be expanded and \TeX\ will complain that it sees
1152 misplaced \cmd{else} etc. You would have to enter all corresponding contidional as \cmd{csname}
1153 constructions or define the condition in a separate macro that will be invoked from the condition.
1154
1155 \textbf{Important note:} It is not guaranteed that the numerical assignment will be kept unchanched
1156 in future versions.
1157
1158 \cmg{ZWifdriver}
1159 The \cmd{ZWifdriver} allows conditional execution of a code for a specified driver. It requires two
1160 parameters. The first parameter is the driver name, the second parameter is the code to be
1161 executed. The macro recognizes all driver names and aliases as given in
1162 section~\ref{driver.selection}. It can be used \eg. in cases when you have to perform some action
1163 for a specific driver only. Suppose that you do not want to set the page bounding boxes
1164 (see~\ref{Bboxes}) if \texttt{dvips} is used but want to set them if the same document is
1165 processed by any other driver. You can thus put the following command to the preamble of the
1166 document:
1167
1168 \vb \noindent
1169 \verb.\ZWifdriver{dvips}{\noBboxes}.
1170
1171 \vb
1172 \textbf{Note:} This macro does not depend on the numerical assignment given above. It will
1173 therefore work the same way in the future versions.
1174
1175 \section{Customizing crop styles}
1176 This section is intended for real \TeX perts. The package tries to provide a lot of options that
1177 enable to customize the default crop style. Try to live with them because here you are touching the
1178 very guts of the package. If you squeeze them badly, your document will suffer from strange
1179 problems the source of which will be difficult to trace. However, if you like tough challenges and
1180 your stomach is strong enough, then read on, but remember, you have been warned.
1181
1182 You ask for a different crop style by the \opt{cropstyle} option as described in
1183 section~\ref{cropstyle} on page~\pageref{cropstyle}. Assume that you load the package with:
1184
1185 \vb
1186 \begin{verbatim}
1187 \usepackage[cropmarks,cropstyle=special,...]{zwpagelayout}
1188 \end{verbatim}
1189
1190 \cmg{cropstyle@special}
1191 You will then have to define macro \cmd{cropstyle@special}. The package first patches the footer in
1192 all page styles. A zero-width, zero-height, zero-depth box is added to the beginning of the footer.
1193 The actual point is set to the lower left corner of the paper as defined by \cmd{paperheight} and
1194 \cmd{paperwidth}. If \opt{nobleedclip} was not used, the area outside the bleed box is erased. The
1195 current color is set according to \opt{cropcolor} option and the font is selected. Afterwards the
1196 \cmd{cropstyle@special} macro is called.
1197
1198 Some crop styles may require initialization. If it is the case of your style, you have to define
1199 macro \cmd{cropstyle@special@setup}. This macro will be executed in the \cmd{AtBeginDocument} hook.
1200 Execution of the macro in that hook allows you to defin the crop style in a package that may be
1201 loaded after \pkg{zwpagelayout}.
1202 It is not an error if the setup macro does not exist.
1203
1204 As already noted, the intention is to discourage users from writing their own crop styles. We will
1205 therefore only mention that the package defines a few useful macros that can be used in the crop
1206 style definition. If your temptation to design your own crop style is really strong, you should
1207 better study the package internals yourself.
1208
1209 \section{Summary of driver specific features}
1210 The driver specific features are described throughout the manual but it may not be clear from the
1211 option or macro description that it is driver dependent. These features with the reference to the
1212 section, where it is described, are written below. All these features are disabled if an
1213 \texttt{unknown} driver is being used (section~\ref{driver.selection}).
1214 \begin{itemize}
1215 \item Page bounding boxes, section~\ref{Bboxes}
1216 \item Page reflection, section~\ref{reflection}
1217 \item Overprinting, section~\ref{overprinting}
1218 \item Setting PDF information, section~\ref{pdfinfo}
1219 \item PDF/X-1a compliance, section~\ref{pdfx1a}
1220 \end{itemize}
1221 Color support is, of course, driver dependent too. However, the \pkg{zwpagelayout} has no
1222 pretention to deal with it. It is fully handled within the \pkg{color} package.
1223
1224 \section{Known bugs and unimplemented features}
1225 This section describes features that are known not to work in all case or those that do not work with
1226 all drivers.
1227
1228 \subsection{Driver repertoire}
1229 Only a few most frequent drivers are automatically detected and supported. Their list is presented
1230 in section~\ref{driver.selection}. If you use another driver, you should probably disable all
1231 driver specific features.
1232
1233 \subsection{Shifted cropmarks when the running foot overflows}
1234 If there is not enough space for the running foot, the cropmarks will most likely be shifted. It
1235 usually happens if you set option \opt{footskip} to zero (which is its default value) and forget to
1236 use \verb.\pagestyle{empty}..
1237
1238 \subsection{Page boxes and Adobe Distiller}
1239 Setting page boxes causes a fatal error in Adobe Distiller (verified with versions 4 and~9). See
1240 section~\ref{Bboxes}.
1241
1242 \subsection{Page reflection}
1243 Option \opt{ReflectVertically} seems to produce slightly shifted output. If any of these options is
1244 used in \XeTeX\ or more specifically with (x)dvipdfm(x) drivers, other \texttt{bop} or \texttt{eop}
1245 code must not be used. See section~\ref{reflection} for details on its implementation.
1246
1247 \subsection{Overprinting}
1248 Overprinting works in (x)dvipdfm(x) drivers but may be cumbersome in some situations. More details
1249 are given in section~\ref{overprinting}.
1250
1251 It was also found that overprinting does not work if the PostScript file is converted to PDF by
1252 GhostScript version~7.x. This is a bug in GhostScript, overprinting works fine if
1253 GhostScript~8.x is used.
1254
1255 The effect of oveprinting was tested in Adobe Acrobat~9 Pro in MS~Windows~XP Home Service Pack~3.
1256
1257 \subsection{Inconsistent dates}
1258 Values of \texttt{CreationDate} and \texttt{ModDate} (see section~\ref{pdfinfo}) supplied by the driver contain information on
1259 the time zone. Unfortunatelly, time zone setting is not available in \TeX. If both fields come from
1260 the same origin, they are set consistently. If one of them is set by the driver and the other by
1261 the \pkg{zwpagelayout} package, then only the field set by he driver will contain the time zone
1262 value. Depending on your time zone it may look as if the document were modified before it was
1263 created.
1264
1265 \subsection{PDF/X conformance}
1266 The PDF/X conformance is only partial. The details are given in section~\ref{pdfx1a} and its
1267 subsections.
1268
1269 \section{Changes}
1270 This section summarizes the changes. The version and the package date is given. It may be useful to
1271 specify the date in the \cmd{usepackage} or \cmd{RequirePackage} command if you rely on a specific
1272 feature not available in the old version of the package.
1273
1274 \subsection{Version 1.4e, 2022/04/18}
1275 Bug fix, a typo in a macro name.
1276
1277 \subsection{Version 1.4d, 2020/02/07}
1278 \begin{itemize}
1279 \item Bug fix, packages \pkg{ifpdf} and \pkg{ifxetex} replaced with \pkg{iftex}.
1280 \item Bug fix, identification of PDF/X-1a corrected.
1281 \item Feature request, luatex85 loaded in order to support Lua\LaTeX\ compatibility.
1282 \item Modification, distribution file flattened as required by CTAN, see
1283 section~\ref{installation}.
1284 \end{itemize}
1285
1286 \subsection{Version 1.4c, 2013/01/13}
1287 Bug fix, the PDF boxes are properly set even in the (x)dvipdfm(x) family of drivers, i.\,e.\@ in
1288 \XeLaTeX.
1289
1290 \subsection{Version 1.4b, 2012/10/04}
1291 New feature, the color name in the cropmarks can be displayed in white on a colored background, see
1292 page~\pageref{color}.
1293
1294 \subsection{Version 1.4a, 2012/05/20}
1295 Bug fix, if a user requested unexistent page style, the cropmark mechanism looped forever until all
1296 main memory was exhausted. Now the package issues an error message and uses the ``empty'' page
1297 style.
1298
1299 \subsection{Version 1.4, 2012/05/13}
1300 Black overprint is implemented for the (x)dvipdfm(x) family of drivers. It means that it now works
1301 in \XeLaTeX, see section~\ref{overprinting}.
1302
1303 \subsection{Version 1.3a, 2012/01/10}
1304 \begin{itemize}
1305 \item Bug fix, code rearrangement in order to prevent an error message if \opt{onlycropmarks} is
1306 used. It leads to the following changes in the functionality:
1307 \begin{enumerate}
1308 \item Page size is always set in the driver specific way. It is still assumed that
1309 \cmd{paperheight} and \cmd{paperwidth} contained correct values before the package was loaded.
1310 \item Bounding boxes are set unless they are explicitly suppressed.
1311 \item PDF options are honoured. It is therefore possible to request PDF/X compliance, set the PDF
1312 title and other information. If you do not wish it, you have to suppress it explicitely by
1313 \opt{nopdfinfo}.
1314 \end{enumerate}
1315 \end{itemize}
1316
1317 \subsection{Version 1.3, 2011/11/22}
1318 \begin{itemize}
1319 \item Bug fix, weird errors appeared if the \pkg{ifxetex} package was loaded previously either
1320 directly or indirectly. Loading of both \pkg{ifpdf} and \pkg{ifxetex} packages written in a different way.
1321 \item Bug fix, pagestyle patching redesigned (r.~409); in the previous versions the crop marks may
1322 disapear if \cmd{pagestyle} was issued again, mainly when the \pkg{fancyhdr} package was used.
1323 \item New feature, when defining a page style, a part of another style may now be inherited. The
1324 following code now can be used:
1325 \begin{verbatim}
1326 \def\ps@mypagestyle{\ps@plain
1327 \def\@oddhead{\hfill My running head}\let\@evenhead\@oddhead}
1328 \pagestyle{mypagestyle}
1329 \end{verbatim}
1330 \item Bug fix: \cmd{globaldefs} is set to zero for printing crop marks. If it were nonzero,
1331 crop marks will not work and will spoil the document. \LaTeX\ users probably do not know this
1332 primitive but who knows\,\ldots
1333 \item Bug fix: without the \opt{twoside} class option and with asymetric margins the crop marks were
1334 printed on wrong positions on the even pages.
1335 \item New feature: crop marks style for leaflets added (section~\ref{cropstyle.leaflet}).
1336 \end{itemize}
1337
1338 \subsection{Version 1.2, 2011/09/04}
1339 \begin{itemize}
1340 \item Bug fix, \cmd{fi} was missing in the definition of \cmd{ZWifdriver}.
1341 \end{itemize}
1342
1343 \subsection{Version 1.1, 2010/12/21}
1344 Two bugs were fixed and a few new features were introduced. Documentation is modified and extended as
1345 well.
1346 \begin{itemize}
1347 \item Bug fix, if \cmd{pagestyle} or \cmd{thispagestyle} was issued within a group while crop marks
1348 were active, the package often failed into an endless loop which resulted in exhausting the memory.
1349 \item Bug fix, the code for page reflection for \texttt{dvips} did not preserve properly the old
1350 \texttt{bop-hook}.
1351 \item New feature, the driver can be explicitly selected (section~\ref{driver.selection}) and the
1352 code can be branched according to the driver (section~\ref{driver.switching}).
1353 \item New feature, page reflection implemented for (x)dvipdfm(x) drivers, \ie. for \XeTeX\
1354 (section~\ref{reflection}).
1355 \item New feature, CMYK and RGB colors explicitly defined (section~\ref{color}).
1356 \item New feature, colors may be redefined to use the CMYK model (section~\ref{color}).
1357 \item New feature, overprinting implemented for \texttt{pdftex} and \texttt{dvips}
1358 (section~\ref{overprinting}).
1359 \item New feature, PDF information can be set without the need of loading the \pkg{hyperref}
1360 package (section~\ref{pdfinfo}).
1361 \item New feature, partial PDF/X-1a compliance (section~\ref{pdfx1a}).
1362 \end{itemize}
1363
1364 \subsection{Version 1.0a, 2008/12/26}
1365 The sample files distributed with the package no longer require enc\TeX\ and private macro
1366 packages.
1367
1368 \section{License}
1369 The package can be used and distributed according to the \LaTeX\ Project Public License version~1.3 or later the
1370 text of which can be found at the \texttt{License.txt} file or at
1371 \url{http://www.latex-project.org/lppl.txt}
1372
1373 \section{Trade marks}
1374 This document makes use of trade marks owned by Adobe Systems Incorporated and Microsoft
1375 Corporation when refering to their products.
1376
1377 \end{document}