diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/zwpagelayout/zwpagelayout.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/zwpagelayout/zwpagelayout.tex | 694 |
1 files changed, 558 insertions, 136 deletions
diff --git a/Master/texmf-dist/doc/latex/zwpagelayout/zwpagelayout.tex b/Master/texmf-dist/doc/latex/zwpagelayout/zwpagelayout.tex index 3291d9da76e..42860154c76 100644 --- a/Master/texmf-dist/doc/latex/zwpagelayout/zwpagelayout.tex +++ b/Master/texmf-dist/doc/latex/zwpagelayout/zwpagelayout.tex @@ -1,8 +1,8 @@ -%% $Id: zwpagelayout.tex 290 2008-12-26 17:43:49Z zw $ +%% $Id: zwpagelayout.tex 375 2010-12-21 11:27:31Z zw $ \input utf8-t1 % encTeX required \documentclass[11pt]{article} \usepackage{zwgetfdate} -\usepackage[footskip=30pt,topmargin=2cm,leftmargin=2cm,rightmargin=5cm,botmargin]{zwpagelayout} +\usepackage[footskip=30pt,topmargin=2cm,leftmargin=2cm,rightmargin=5cm,botmargin,nopdfinfo]{zwpagelayout} \usepackage[T1]{fontenc} \usepackage{lmodern,array,dcolumn,verbatim,graphicx} \usepackage[figuresright]{rotating} @@ -34,6 +34,11 @@ \def\bool#1{\texorpdfstring{\textit{#1}}{#1}} \def\is{\unskip\nobreak\space =\penalty200 \space\ignorespaces} +\DeclareRobustCommand\XeTeX{X\kern-.125em\lower.5ex\hbox{\csname + reflectbox\endcsname{E}}\kern-.1667em\TeX} +\DeclareRobustCommand\XeLaTeX{X\kern-.125em\lower.5ex\hbox{\csname + reflectbox\endcsname{E}}\LaTeX} + \makeatletter \newcommand*\papdims[2][.]{\bgroup \def\zw@papdim##1,##2\zw@{\sepunit{##1}#1\sepunit{##2}}% @@ -57,8 +62,11 @@ \let\zwcomma\, \def\,{\texorpdfstring{\zwcomma}{}} +\clubpenalty10000 +\widowpenalty10000 + \begin{document} -\hyphenation{allow-with-height-switching} +\hyphenation{post-script ghost-script allow-with-height-switching Output-Condition Output-Condition-Identifier} \title{Page Layout with Crop Marks} \author{Zdeněk Wagner\\\url{http://icebearsoft.euweb.cz}} \date{Package date: \DateOfPackage{zwpagelayout}} @@ -90,6 +98,13 @@ will calculate it from the page width, the flap width and the spine thickness. W value of the spine thickness is known, you change it in the list of options and the whole layout will adapt automatically. +The files usually fail to meet PDF/X conformance due to silly reasons. It is always mandatory to +set the title, creation date and modification date in any PDF file. It can be done by the +\pkg{hyperref} package. However, \pkg{hyperref} is a complex package that may cause clashes with +other packages. We do not want to kill ants by cannon balls, therefore we do simple things by simple +means. Options for partial PDF/X conformance were added but may be switched off if a user wishes to +use \pkg{hyperref}. + The package is a result of a long-term development inspired by author's everyday needs. It is a collection of macros that were manually copied from document to document, later placed into private packages and finally it matured into a package prepared for general use. @@ -101,13 +116,25 @@ proof-reading is time consuming and expensive. This package therefore allows the to be switched off and just add the crop marks provided the paper dimensions are correctly supplied. The details will be explained later when describing the package options. +\section{Package dependence} +As written in the introduction, the goal was to implement as much within this single package in +order to reduce the risk of clashes. Yet a few packages may be loaded. The package needs to know +what engine is being used. For this purpose the \pkg{ifxetex} and \pkg{ifpdf} packages are used. If +any of these packages is not found, it is assumed that the corresponding engine is not available. +No error is reported. The color support requires the \pkg{color} package. It is loaded only if the +color support is requested. The algorithm for deciding when the package is needed will be described +in detail in section~\ref{color}. + +Option setting is implemented via the \pkg{kvoptions} package which in turn loads the \pkg{keyval} +package. These packages should be available in any nowaday's \TeX\ distribution. + \section{Usage} The package is loaded simply by: \vb \verb;\usepackage[;$\langle$options$\rangle$\verb;]{zwpagelayout}; -\vb +\vb\noindent Remember that the options cannot be given later, all of them must be present either here or as options to the \cmd{documentclass} command. The package will set some dimensions based upon \cmd{normalsize}. The package that modifies font sizes must therefore be loaded before @@ -119,6 +146,30 @@ Some options accept a value. If the option is not specified, it may have a \text option may be given without a value. It will then have a \textbf{standard} value. The default and standard values will be given in the option description. +The option value may sometimes contain spaces and commas. However, commas are used to separate +options, and during parsing the spaces are ignored. The spaces must therefore be preceded by a +backslash and an option value containing commas must be enclosed in braces, for example: + +\vb +\begin{verbatim} +\usepackage[a4,subject=Some\ subject, + keywords={keyword\ 1,\ keyword\ 2}]{zwpagelayout} +\end{verbatim} + +\section{Driver selection}\label{driver.selection} +The driver is usually selected automatically. The package makes use of the \pkg{ifxetex} and +\pkg{ifpdf} packages to detect either \XeTeX\ or pdftex. If none of them is detected, dvips is +assumed. + +\omg{driver} +It may sometimes be necessary to set the driver manually by giving the \opt{driver} option. This +option recognizes drivers \texttt{unknown}, \texttt{pdftex}, \texttt{xetex}, and \texttt{dvips}. In +addition \texttt{other} is an alias to \texttt{unknown}, \texttt{dvipdfm} and \texttt{xdvipdfmx} +are aliases to \texttt{xetex}. + +The package shows the driver in the log file. If the driver is set to \texttt{unknown}, all driver +specific features will be disabled. + \section{Paper size and orientation} The first task of the package is to define paper size and orientation. Remember that the package is intended for use in real life where we cannot be limitted to standard papers sizes. However, the @@ -206,6 +257,23 @@ milimeters. For instance, the A6 size is \papdims[\krat]{a6}. The package also s \opt{AllowWidthHeightSwitching} and \opt{Portrait} are assumed. The page orientation may be switched by option \opt{Landscape} (see section~\ref{orientation}). +\subsection{Page bounding boxes}\label{Bboxes} +The drivers usually set MediaBox to the physical size of the page. If cropmarks are requested (see +section~\ref{cropmarks}), the package sets also BleedBox, TrimBox and ArtBox. CropBox is +intentionally unset since it causes cropped display in Adobe Reader. Since page size setting is +delayed, MediaBox contains the whole page including the area for the cropmarks. MediaBox is +calculated by the driver, the other boxes are calculated by \TeX. Their dimensions are therefore +not exact because \TeX\ does not use floating point arithmetic. The difference is negligible. + +\omg{noBboxes} +Option \opt{noBboxes} disables setting the above mentioned boxes. Currently there is a known bug +causing fatal error in Adobe Distiller if these boxes are set. + +\cmg{noBboxes} +Macro \cmd{noBboxes} performs exactly the same action as the \opt{noBboxes} option. The only +advantage is that it can be used later in the preamble of the document. It cannot be used after +\verb.\begin{document}. because the boxes are already set at that time. + \section{Page layout options} These options define the layout of the odd page. The layout of the even page is assumed to be a mirror image. The values of \cmd{oddsidemargin} and \cmd{evensidemargin} are calculated from the values of the options. @@ -246,7 +314,7 @@ The following options are used to specify the height and width of the text. \subsubsection{Option \opt{textwidth}, default --1\,in} \omg{textwidth} This option specifies the width of the text without marginal notes. Its meaning is different for -book covers. The option specifies the width of the cover without the extra spine (\opt{xsipne}), +book covers. The option specifies the width of the cover without the extra spine (\opt{xspine}), flap (\opt{flap}) and trimming (\opt{xtrim} or \opt{trim}). \subsubsection{Option \opt{textheight}, default --1\,in} @@ -290,7 +358,7 @@ total height. If \opt{adjustfootskip} is set to \false, the difference is added \includegraphics{adjustfoot}\hfill \includegraphics{adjusthead} -\medskip +\vb \caption{Compensation of \cmd{textheight} by changing \cmd{footskip} (on the left) and \cmd{headsep} (on the right)}\label{adj} \end{figure} @@ -298,17 +366,17 @@ total height. If \opt{adjustfootskip} is set to \false, the difference is added The difference betweem these two options is shown in figure~\ref{adj}. Adjustment of \cmd{footskip} was achieved by: -\medskip +\vb \begin{verbatim} \usepackage[c8,margins=6mm,headheight=4mm,headsep=4mm, croplength=3mm,cropgap=2mm, cropmarks,cropframe,croptitle=Adjust\ footskip]{zwpagelayout} \end{verbatim} -\medskip \noindent +\vb \noindent The sample on te right side of the figure was created by: -\medskip +\vb \begin{verbatim} \usepackage[c8,margins=6mm,headheight=4mm,headsep=4mm,adjustheadsep, croplength=3mm,cropgap=2mm, @@ -319,6 +387,140 @@ The sample on te right side of the figure was created by: \omg{adjustheadsep} This is a complementary option to \opt{adjustfootskip}. +\section{Calculation of missing dimensions}\label{missing} +The package can either calculate paper size from the page layout dimensions or calculate missing +page layout dimensions if the paper size and some dimensions are known. It operates separately for +the height and width. You can \eg. define the paper height and calculate the text height from it +and the margins but specify all width layout dimensions and calculate the paper width. + +When designing simple pages it is better to define the paper size and calculate some page layout +dimensions. However, for bok covers it is recommended to calculate at least the paper width from +the layout dimensions of the front cover, the spine and the flap width. + +\subsection{Calculation of the paper size} +Remember that paper size can be calculated only if all page layout dimensions for the corresponding +orientation (height, width) are specified. There is no diagnostics for warning you if some +important options are missing, the resukt will just be wrong or the package may even report an +error. All dimensions are considered \emph{without} the area for the crop marks. + +\subsubsection{Paper height} +Calculation of the paper height is very simple. The formula is: + +\vb +\cmd{paperheight} = \opt{topmargin} + \opt{textheight} + \opt{botmargin} + 2 \opt{ytrim} + +\vb \noindent +Remember that \opt{textheight} includes also \cmd{headheight}, \cmd{headsep}, and \cmd{footskip}. +It is not necessary to specify \opt{ytrim}, the package checks the existence of this option and +removes it from the formula if not given. + +\subsubsection{Paper width} +Algorithm for calculating the paper width differs for simple pages and book covers. In the simple +case the paper width is calculated as follows: + +\vb +\cmd{paperwidth} = \opt{leftmargin} + \opt{textwidth} + \opt{rightmargin} + +\vb \noindent +The value of \cmd{textwidth} will be equal to \opt{textwidth}. The same value will be stored in +macro \cmd{UserWidth}, see section~\ref{crop.macros}. + +If the book cover is designed, the \opt{textwidth} option refers to the width of the text at the +front cover but \opt{leftmargin} and \opt{rightmargin} are used to set \cmd{oddsidemargin} and +\cmd{evensidemargin}. It is therefore better to set these options to zero, or alternatively to the +same value as \opt{flap} or \opt{xtrim} if the corresponding area will be left empty. The value of +\cmd{textwidth} will then be calculated from the final paper width by: + +\vb +\cmd{textwidth} = \cmd{paperwidth} -- \opt{leftmargin} -- \opt{rightmargin} + +\vb +If the \opt{flap} option is used without the \opt{spine} option in order to emulate the front cover +and spine with an empty back cover, the paper width is calculated as: + +\vb +\cmd{paperwidth} = \opt{leftmargin} + \opt{flap} + \opt{textwidth} + \opt{xtrim} + +\opt{rightmargin} + +\vb \noindent +The value of \opt{xtrim} may be omitted. The value of \opt{xspine} will be silently ignored. It is +not allowed to have just the spine, the front cover and the flap while leaqving the back cover +empty. + +The case of a book cover with the spine given is a bit more complicated: + +\vb +\textit{width} = \opt{xspine} + \opt{textwidth} + \opt{flap} + \opt{xtrim} + +\cmd{paperwidth} = \opt{leftmargin} + \opt{spine} + 2 \textit{width} + \opt{rightmargin} + +\vb \noindent +Options \opt{xspine}, \opt{flap}, and \opt{xtrim} need not be specified if these elements are not +needed. + +\subsection{Calculation of page layout dimensions}\label{calc.pg.layout} +Algorithm for calculating the page layout dimensions is intended for simple pages, not for book +covers. Options \opt{xtrim}, \opt{ytrim}, \opt{spine}, \opt{xspine}, and \opt{flap} are silently +ignored but will be taken into account when producing the crop marks. You can still make use of +this algorithm if you understand what you are doing and if you wish to do extra calculations +yourself. + +The dimensions may be overdetermined. In such a case the algorithm disregards one of the dimensions +and calculates it. + +\subsubsection{Vertical dimensions}\label{vert.dim} +The algorithm first looks whether \opt{textheight} was given. If not it is assumed that the user +wishes to have it calculated from the paper height and the margins. If the \opt{botmargin} option was +not set, it will be set to the same valu as \opt{topmargin}. + +In the second step the package looks whether \opt{botmargin} is defined, either by the user or from +the previous step. If so, the text height is calculated, otherwise the bottom margin is calculated +from the top margin and the text height. As a matter of fact, the bottom margin is never used by +\TeX. + +Finally the value of \cmd{textwidth} is reduced by \cmd{headheight}, \cmd{headsep}, and +\cmd{footskip}. If \opt{strictheight} is \cmd{false}, the values are later adjusted according to +options \opt{adjustfootskip} and \opt{adjustheadsep} so that \cmd{textheight} -- \cmd{topskip} is +an integer multiple of \cmd{baselineskip}. + +\subsubsection{Horizontal dimensions} +The sum of the horizontal dimensions must be equal to the paper width according to the relation: + +\vb +\opt{leftmargin} + \opt{textwidth} + \opt{rightmargin} = \cmd{paperwidth} + +\vb \noindent +If all three dimensions are specified, \opt{textwidth} is disregarded and calculated from the other +dimensions. If any two dimensions are given, the missing one is calculated from the above formula. +If only one dimension is given, it is assumed that both margins have the same size and the above +formula is applied. It is even possible to omit all dimensions. In such a case the margins are +assumed to have the same size as \opt{topmargin} and the text width can thus be calculated. + +\section{Page reflection}\label{reflection} +\omg{Reflect\-Horizontally} +\omg{ReflectVertically} +We sometimes need to print the whole document as a mirror image. Although there are external tools +that can provide such a job taking PDF or PS as input, it is useful to do everything in a single +step. The package provides options \opt{ReflectHorizontally} for horizontal reflection and +\opt{ReflectVertically} for vertical reflection, respectively. If you specify both, some drivers +may interpret both of them and print rotated 180$^{\circ}$, some interpret only one of them. + +The PostScript to PDF converters optionally rotate pages according to the text direction. They may +be confused by reflected text and add undesired rotation. If the horizontally reflected text is +roteted 180$^{\circ}$, it looks as if it were reflected vertically instead. + +Remember that these options are intended for printing only. +The hypertext links made by the \pkg{hyperref} package will be wrong. If you wish to rotate parts +of texts and preserve hyperlinks, use \pkg{rotating} instead. + +A word of warning has to be said. In \texttt{pdftext} reflection is implemented by redefininng +\cmd{shipout}. We add PDF literal code to the beginning of each page. For \texttt{dvips} we add +code to the \texttt{bop-hook}. If you need your own code in the \texttt{bop-hook}, you have to +store the old definition and execute it. For \texttt{xetex} we add code to \texttt{bop} and +\texttt{eop}. It seems that only one \texttt{bop} and one \texttt{eop} can be used. That is why the +page is reflected vertically if both options are used. As a result you are not allowed to use your +own \texttt{bop} and \texttt{eop} code together with these options. + \section{Crop marks}\label{cropmarks} The crop marks must appear outside the print area. The package assumes that \cmd{paperheight} and \cmd{paperwidth} contain the page size after trimming. These dimensions will then be increased and the page @@ -328,7 +530,7 @@ will be shifted by setting \cmd{hoffset} and \cmd{voffset}. If you wish to print The values of \cmd{hoffset} and \cmd{voffset} will be set to the sum of \opt{croplength} and \opt{cropgap}, see the following text. -\subsection{Basic crop marks options} +\subsection{Basic crop marks options}\label{cropmarks} Options described in this section define basic behaviour of the crop marks. \subsubsection{Option \opt{onlycropmarks}, default \false, standard \true} @@ -444,11 +646,28 @@ not be clipped. It may be useful if you know that nothing extends to the crop ma \pkg{color} package may clash with other packages required by your document. -\subsection{Color support for crop marks} +\section{Color support}\label{color} The package is able to produce basic color support, namely it prints the names of separations. The color support is implemented via a few options. Color printing is performed using the \pkg{color} package that is loaded automatically. The package does not use predefined color names. +The package recognizes the \pkg{color} package by existence of the \cmd{definecolor} macro. If this +macro is not defined, the \pkg{color} package will be added if: +\begin{itemize} +\item option \opt{color} is \true +\item option \opt{nobleedclip} is \false\ and \opt{cropmarks} is \true +\item option \opt{redefineblack} is \true +\item option \opt{redefinetocmyk} is \true +\item option \opt{overprint} is \true +\end{itemize} +If none of the above applies, the color support is not needed and the package will not be loaded. + +If the \pkg{color} package is being loaded, no options are given to it. Especially the driver +selected by the \opt{driver} option (see section~\ref{driver.selection}) is not sent. If you must +specify any option for the \pkg{color} package, you have to load it yourself before loading +\pkg{zwpagelayout}. + +\subsection{Color support for cropmarks} \omg{color} Option \opt{color} asks for the color support. Without setting this option to \true\ all other color options are silently ignored. @@ -473,7 +692,7 @@ following examples. Suppose that for some strange reason you prepare the document in the RGB space. Your specification will then be: -\medskip +\vb \begin{verbatim} \usepackage[cropmarks,color,colormodel=rgb,cropcolor={1,1,1}, @@ -481,7 +700,7 @@ will then be: croptitle=RGB\ example]{zwpagelayout} \end{verbatim} -\medskip +\vb Now we show a more realistic example. The document should be printed in custom colors. Since the true specification of custom colors requires much work and is rarely worth the trouble, we make use @@ -490,7 +709,7 @@ of the CMYK model. We will use cyan instead of Pantone 298 (blue), magenta inste produce anything on the yellow separation and we should provide proper color names. The specification will therefore look as: -\medskip +\vb \begin{verbatim} \usepackage[cropmarks,color,cropcolor={1,1,0,1}, @@ -499,131 +718,170 @@ specification will therefore look as: croptitle=Example\ with\ custom\ colors]{zwpagelayout} \end{verbatim} -\medskip +\vb Notice that the \opt{colormodel} option was not specified. Its default value was used. The \opt{cropcolor} option left zero for the yellow separation. -\section{Calculation of missing dimensions}\label{missing} -The package can either calculate paper size from the page layout dimensions or calculate missing -page layout dimensions if the paper size and some dimensions are known. It operates separately for -the height and width. You can \eg. define the paper height and calculate the text height from it -and the margins but specify all width layout dimensions and calculate the paper width. - -When designing simple pages it is better to define the paper size and calculate some page layout -dimensions. However, for bok covers it is recommended to calculate at least the paper width from -the layout dimensions of the front cover, the spine and the flap width. - -\subsection{Calculation of the paper size} -Remember that paper size can be calculated only if all page layout dimensions for the corresponding -orientation (height, width) are specified. There is no diagnostics for warning you if some -important options are missing, the resukt will just be wrong or the package may even report an -error. All dimensions are considered \emph{without} the area for the crop marks. - -\subsubsection{Paper height} -Calculation of the paper height is very simple. The formula is: - -\medskip -\cmd{paperheight} = \opt{topmargin} + \opt{textheight} + \opt{botmargin} + 2 \opt{ytrim} - -\medskip \noindent -Remember that \opt{textheight} includes also \cmd{headheight}, \cmd{headsep}, and \cmd{footskip}. -It is not necessary to specify \opt{ytrim}, the package checks the existence of this option and -removes it from the formula if not given. - -\subsubsection{Paper width} -Algorithm for calculating the paper width differs for simple pages and book covers. In the simple -case the paper width is calculated as follows: - -\medskip -\cmd{paperwidth} = \opt{leftmargin} + \opt{textwidth} + \opt{rightmargin} - -\medskip \noindent -The value of \cmd{textwidth} will be equal to \opt{textwidth}. The same value will be stored in -macro \cmd{UserWidth}, see section~\ref{crop.macros}. - -If the book cover is designed, the \opt{textwidth} option refers to the width of the text at the -front cover but \opt{leftmargin} and \opt{rightmargin} are used to set \cmd{oddsidemargin} and -\cmd{evensidemargin}. It is therefore better to set these options to zero, or alternatively to the -same value as \opt{flap} or \opt{xtrim} if the corresponding area will be left empty. The value of -\cmd{textwidth} will then be calculated from the final paper width by: - -\medskip -\cmd{textwidth} = \cmd{paperwidth} -- \opt{leftmargin} -- \opt{rightmargin} - -\medskip -If the \opt{flap} option is used without the \opt{spine} option in order to emulate the front cover -and spine with an empty back cover, the paper width is calculated as: - -\medskip -\cmd{paperwidth} = \opt{leftmargin} + \opt{flap} + \opt{textwidth} + \opt{xtrim} + -\opt{rightmargin} +\subsection{CMYK colors}\label{cmykcolors} +\mg{cmykblack}\mg{cmykread}\mg{cmykgreen}\mg{cmykblue} +The \pkg{color} package defines \textit{black} using the GRAY model and colors \textit{red}, +\textit{green}, \textit{blue} by the RGB model. The GRAY model rarely causes any problem but the +RGB model is not acceptable for printing. The \opt{zwpagelayout} package therefore defines the +corresponding colors using the CMYK model. Different names are selected so that there is no clash +in case you really need these colors in RGB. + +\subsection{Overprinting support, default \false, standard \true}\label{overprinting} +\omg{overprint} +The overprinting support must be requested by the \opt{overprint} option. If the option remains +\false, the overprinting commands will be defined but will do nothing. Remember that you can +overprint any color, not just black. You thus should not enable overprinting globally. The mode is +therefore set to \textit{knockout} within the package. + +Overprint support is currently implemented for pdftex and dvips only. Support for (x)dvipdfm(x) is +prepared but there is a bug in it. It will hopefully be fixed soon. + +\cmg{SetOverprint}\cmg{SetKnockout} +These macros change the mode to \textit{overprint} or \textit{knockout}, respectively. They act as +declarative macros, similarly as \eg. \cmd{itshape}. You have to use them within a group. The +macros are intended to be used for changing the mode for a longer part of text. Due to the way how +environments are handled in \LaTeX, it is also possible to write: -\medskip \noindent -The value of \opt{xtrim} may be omitted. The value of \opt{xspine} will be silently ignored. It is -not allowed to have just the spine, the front cover and the flap while leaqving the back cover -empty. - -The case of a book cover with the spine given is a bit more complicated: - -\medskip -\textit{width} = \opt{xspine} + \opt{textwidth} + \opt{flap} + \opt{xtrim} +\vb +\begin{verbatim} +\begin{SetOverprint} +Some long text to be overprinted... +\end{SetOverprint} +\end{verbatim} -\cmd{paperwidth} = \opt{leftmargin} + \opt{spine} + 2 \textit{width} + \opt{rightmargin} +\vb -\medskip \noindent -Options \opt{xspine}, \opt{flap}, and \opt{xtrim} need not be specified if these elements are not +\cmg{textoverprint}\cmg{textknockout} +If a short part of text should be printed in a different mode, one-argument macros +\cmd{textoverprint} and \cmd{textknockout} can be used. They act similarly as the \cmd{textit} +macro. + +\omg{redefineblack} +Overprinting works only if both the background and forground colors are in the CMYK model. However, +the \textit{black} color, which is most often overprinted, is defined in the GRAY model as default. +This package defines the \texttt{cmykblack} color that may be used for this purpose. In addition if +\opt{redefineblack} is set to \true, the standard \textit{black} color will be redefined in CMYK. + +\omg{redefinetocmyk} +Although \textit{red}, \textit{green}, \textit{blue} will rarely be used for overprinting (maybe +just as a background), option \opt{redefinetocmyk} requests redefinition of these colors to CMYK. +The \textit{black} color will be redefined as well. + +\mg{grblack}\mg{rgbred}\mg{rgbgreen}\mg{rgbblue} +If the colors are redefined to CMYK, the original definitions are not available. Although you +redefine them due to a printing process where the RGB colors are undesirable, you can sometimes +need them. For this purpose \textit{grblack}, \textit{rgbred}, \textit{rgbgreen}, \textit{rgbblue} +colors are always available. + +\section{PDF information}\label{pdfinfo} +The package writes the basic information that is required by PDF/X even if PDF/X conformace is not +requested. The basic pieces of information are \texttt{CreationDate} and \texttt{ModDate}. +Implementation is driver dependent and some information is supplied by the driver itself. Thus +\texttt{pdftex} inserts both, (x)dvipdfm(x) (\XeTeX) adds \texttt{CreationDate} only, dvips adds +none. The missing information is supplied by this package based on \cmd{date} and \cmd{time}. The +next subsections will explain how other fields can be defined and how they can be disabled if needed. -\subsection{Calculation of page layout dimensions}\label{calc.pg.layout} -Algorithm for calculating the page layout dimensions is intended for simple pages, not for book -covers. Options \opt{xtrim}, \opt{ytrim}, \opt{spine}, \opt{xspine}, and \opt{flap} are silently -ignored but will be taken into account when producing the crop marks. You can still make use of -this algorithm if you understand what you are doing and if you wish to do extra calculations -yourself. - -The dimensions may be overdetermined. In such a case the algorithm disregards one of the dimensions -and calculates it. - -\subsubsection{Vertical dimensions}\label{vert.dim} -The algorithm first looks whether \opt{textheight} was given. If not it is assumed that the user -wishes to have it calculated from the paper height and the margins. If the \opt{botmargin} option was -not set, it will be set to the same valu as \opt{topmargin}. - -In the second step the package looks whether \opt{botmargin} is defined, either by the user or from -the previous step. If so, the text height is calculated, otherwise the bottom margin is calculated -from the top margin and the text height. As a matter of fact, the bottom margin is never used by -\TeX. +\subsection{PDF title}\label{pdftitle} +\omg{title} +The \opt{title} option is used to set the title field. The default is to take the contents of the +\opt{croptitle} option even if the cropmarks are switched off. If \opt{croptitle} is empty, +\cmd{jobname} is used. If you specify this option without a value, it has a special meaning of +suppressing creation of PDF information field. Since this is not mnemonic, there is a +\opt{nopdfinfo} option with the same effect, see subsection~\ref{nopdfinfo}. + +\subsection{PDF author} +\omg{author} +The \opt{author} option sets the author of the document. The field is not required by PDF/X, +therefore it has no default value. + +\subsection{PDF subject} +\omg{subject} +The \opt{subject} option defines the subject of the document. + +\subsection{PDF keywords} +\omg{keywords} +The \opt{keywords} option is used to set the list of keywords. Usually the keywords will be given +as a comma separated list. They must therefore be enclosed in braces. + +\subsection{Option \opt{nopdfinfo}}\label{nopdfinfo} +\omg{nopdfinfo} +The above mentioned fields may also be set in the PDF file by the \pkg{hyperref} package. If +\pkg{hyperref} is used, it may not be desirable if \pkg{zwpagelayout} wrote the PDF information. If +you specify \opt{nopdfinfo} in the list of options, setting all above mentined information (including +\texttt{ModDate}) will be disabled. This option is not boolean, it just erases the contents of the +\opt{title} option, see subsection~\ref{pdftitle}. Since options are procesed in the order in which +they are declared in the package, \opt{nopdfinfo} will always erase the PDF title even if it is +specified before \opt{title}. + +\section{PDF/X-1a compliance}\label{pdfx1a} +The package partially implements the PDF/X-1a standard. Remember that implementation is driver +dependent and not everything can be achieved with all drivers. The following sections will give you +more detail. Unlike the \pkg{pdfx} package we try to do as much in \texttt{xetex} and set the +bounding boxes according to the real page size. + +\subsection{Option \opt{pdfminorversion}} +\omg{pdfminorversion} +This option allows you to set the version of the PDF file. It works with \texttt{pdftex} only. There +is no \cmd{special} for sending this information to (x)dvipdfm(x), it can only be set on the +command line. Similarly PostScript to PDF converters accept such setting from the command line or a +configuration file although there is a PS command for setting it. + +\cmg{SetPDFminorversion} +The same effect can also be achieved by \cmd{SetPDFminorversion} from a preamble. The macro accepts +a single argument and is implemented for \texttt{pdftex} only. It does nothing for other drivers. + +\subsection{Option \opt{pdfx}} +\omg{pdfx} +This option ask the package to create PDF/X-1a file. The first requirement is to set PDF version +to~1.3, thus it sets the minor version to~3 and then disables macro \cmd{SetPDFminorversion}. Other options +have reasonable default values but they can be changed as described in the following subsections. + +PDF/X-1a compliance is not handled for \texttt{dvips} and some features are not available for +\texttt{xetex}. + +\subsection{Options \opt{OutputCondition} and \opt{OutputConditionIdentifier}, default Euroscale +Coated~v2} +\omg{OutputCondition} +\omg{OutputConditionIdentifier} +These options specify the ICC profile. I am not sure how to obtain the correct names. The default +values correspond to the ICC profiles used in Europe but you can easily set another value. From my +personal experience I prefer \textit{eucmyk50} when converting my images from AdobeRGB to CMYK. + +\subsection{Option \opt{ICCfile}} +\omg{ICCfile} +This option specifies the name of the file containing the ICC profile. There is no default +definition and no profile is embedded. The profiles usually accompany commercial products as +printers and scanners or can be downloaded from the web. If you have a CMYK profile that you wish +to embed, you can specify its name with the opt{ICCfile} option. The profile can only be embedded +by \texttt{pdftex}. + +\subsection{Font embedding} +PDF/X requires all fonts to be embedded. The \pkg{zwpagelayout} package cannot ensure it. You have +to verify your configuration files and make sure that fonts are embedded. + +\subsection{Page bounding boxes} +It is mandatory to set BleedBox, TrimBox, and ArtBox in addittion to MediaBox. Setting these boxes +is explained in section~\ref{Bboxes}. + +\subsection{PDF information} +Mandatory fields are title, CreationDate and ModDate. All these fields are set automatically unless +they are disabled as described in section~\ref{pdfinfo}. + +\subsection{MPT metadata} +Emdedding MPT metadata is currently not implemented. It will be implemented in the future but only +for \texttt{pdftex}. + +\subsection{Color} +PDF/X-1a allows only CMYK colors and spot colors. Since \pkg{zwpagelayout} does not handle colors +itself but makes use of the \pkg{color} package, it cannot verify that only allowed colors are +used. -Finally the value of \cmd{textwidth} is reduced by \cmd{headheight}, \cmd{headsep}, and -\cmd{footskip}. If \opt{strictheight} is \cmd{false}, the values are later adjusted according to -options \opt{adjustfootskip} and \opt{adjustheadsep} so that \cmd{textheight} -- \cmd{topskip} is -an integer multiple of \cmd{baselineskip}. - -\subsubsection{Horizontal dimensions} -The sum of the horizontal dimensions must be equal to the paper width according to the relation: - -\medskip -\opt{leftmargin} + \opt{textwidth} + \opt{rightmargin} = \cmd{paperwidth} - -\medskip \noindent -If all three dimensions are specified, \opt{textwidth} is disregarded and calculated from the other -dimensions. If any two dimensions are given, the missing one is calculated from the above formula. -If only one dimension is given, it is assumed that both margins have the same size and the above -formula is applied. It is even possible to omit all dimensions. In such a case the margins are -assumed to have the same size as \opt{topmargin} and the text width can thus be calculated. - -\section{Page reflection} -\omg{Reflect\-Horizontally} -\omg{ReflectVertically} -We sometimes need to print the whole document as a mirror image. Although there are external tools -that can provide such a job taking PDF or PS as input, it is useful to do everything in a single -step. The package provides options \opt{ReflectHorizontally} for horizontal reflection and -\opt{ReflectVertically} for vertical reflection, respectively. If you specify both, some drivers -may interpret both of them and print rotated 180$^{\circ}$, some interpret only one of them and -some driver may get totally confused. Remember that these options are intended for printing only. -The hypertext links made by the \pkg{hyperref} package will be wrong. If you wish to rotate parts -of texts and preserve hyperlinks, use \pkg{rotating} instead. \section{Useful macros}\label{macros} The package offers two types of useful macros. The macros from the first group help in designing @@ -664,10 +922,10 @@ dimensions. However, you have no control over the page style of the inserted empty even page. This feature is enabled in the \cmd{NewOddPage} macro. Its syntax is: -\medskip +\vb \verb;\NewOddPage*[;$\langle$style$\rangle$\verb;]; -\medskip\noindent +\vb\noindent Optional parameter $\langle$style$\rangle$ defines the style of the empty even page that should be fed to the \cmd{thispagestyle} command. The default is \texttt{empty}. The starred version displays a warning in the log file if an empty page was inserted. @@ -717,7 +975,7 @@ macros: \cmd{CropFlap}\is\opt{flap}, \cmd{CropSpine}\is\opt{spine}, \cmd{CropXSp The use of these macros can be shown by an example. The book cover with flaps displayed in Figure~\ref{cover} was prepared by the following code: -\medskip +\vb \verbatiminput{coversample} \begin{sidewaysfigure}[p] @@ -734,7 +992,7 @@ the \opt{trim} option fills both \opt{xtrim} and \opt{ytrim}. You can take advan your document more general. You can \eg. define the book cover in two variants, with or without flaps, using this trick: -\medskip +\vb \begin{verbatim} \ifcat$\CropFlap$ % no flaps @@ -745,7 +1003,7 @@ flaps, using this trick: \fi \end{verbatim} -\medskip +\vb \cmg{thePageNumber} Macro \cmd{thePageNumber} is used to print the page number together with the crop mark text. We have @@ -754,6 +1012,58 @@ to redefine it. We can \eg. define the book title with the \opt{croptitle} optio text ``Cover'' instead of the page number when typesetting the cover. Usage of this macro is also demonstrated in Figure~\ref{cover}. +\subsection{Driver switching macros}\label{driver.switching} +These macros provides conditional branching according to the currently selected driver no matter +whether it is chosen automatically or by specifying the \opt{driver} option described in +section~\ref{driver.selection}. The macros do not change page layout, they are therefore available +even if the \opt{onlycropmarks} option was given. + +\cmg{ifcaseZWdriver} +Macro \cmd{ifcaseZWdriver} expands to an open \cmd{ifcase} primitive. You can thus branch the code +according to the driver. The numeric values are 0 for \texttt{unknown}, 1 for \texttt{pdftex}, 2 +for \texttt{xetex}, 3 for \texttt{dvips}. The branching may look as follows: + +\vb +\begin{verbatim} +\ifcaseZWdriver + Code for unknown +\or + Code for pdftex +\or + Code for xetex +\or + Code for dvips +\else + Error, it may not happen! +\fi +\end{verbatim} + +\vb +Since \cmd{ifcaseZWdriver} is a macro, it cannot by used inside another conditional statement. If +it falls to the \false\ branch, it will not be expanded and \TeX\ will complain that it sees +misplaced \cmd{else} etc. You would have to enter all corresponding contidional as \cmd{csname} +constructions or define the condition in a separate macro that will be invoked from the condition. + +\textbf{Important note:} It is not guaranteed that the numerical assignment will be kept unchanched +in future versions. + +\cmg{ZWifdriver} +The \cmd{ZWifdriver} allows conditional execution of a code for a specified driver. It requires two +parameters. The first parameter is the driver name, the second parameter is the code to be +executed. The macro recognizes all driver names and aliases as given in +section~\ref{driver.selection}. It can be used \eg. in cases when you have to perform some action +for a specific driver only. Suppose that you do not want to set the page bounding boxes +(see~\ref{Bboxes}) if \texttt{dvips} is used but want to set them if the same document is +processed by any other driver. You can thus put the following command to the preamble of the +document: + +\vb \noindent +\verb.\ZWifdriver{dvips}{\noBboxes}. + +\vb +\textbf{Note:} This macro does not depend on the numerical assignment given above. It will +therefore work the same way in the future versions. + \section{Customizing crop styles} This section is intended for real \TeX perts. The package tries to provide a lot of options that enable to customize the default crop style. Try to live with them because here you are touching the @@ -764,7 +1074,7 @@ your stomach is strong enough, then read on, but remember, you have been warned. You ask for a different crop style by the \opt{cropstyle} option as described in section~\ref{cropstyle} on page~\pageref{cropstyle}. Assume that you load the package with: -\medskip +\vb \begin{verbatim} \usepackage[cropmarks,cropstyle=special,...]{zwpagelayout} \end{verbatim} @@ -782,11 +1092,123 @@ therefore only mention that the package defines a few useful macros that can be style definition. If your temptation to design your own crop style is really strong, you should better study the package internals yourself. -\enlargethispage*{2in} +\section{Summary of driver specific features} +The driver specific features are described throughout the manual but it may not be clear from the +option or macro description that it is driver dependent. These features with the reference to the +section, where it is described, are written below. All these features are disabled if an +\texttt{unknown} driver is being used (section~\ref{driver.selection}). +\begin{itemize} +\item Page bounding boxes, section~\ref{Bboxes} +\item Page reflection, section~\ref{reflection} +\item Overprinting, section~\ref{overprinting} +\item Setting PDF information, section~\ref{pdfinfo} +\item PDF/X-1a compliance, section~\ref{pdfx1a} +\end{itemize} +Color support is, of course, driver dependent too. However, the \pkg{zwpagelayout} has no +pretention to deal with it. It is fully handled within the \pkg{color} package. + +\section{Known bugs and unimplemented features} +This section describes features that are known not to work in all case or those that do not work with +all drivers. + +\subsection{Driver repertoire} +Only a few most frequent drivers are automatically detected and supported. Their list is presented +in section~\ref{driver.selection}. If you use another driver, you should probably disable all +driver specific features. + +\subsection{Page style inheritance} +It is not possible to inherit part of the definition of another page style. Suppose you need +``plain'' pages but with a fixed running head. You will try to define it as: + +\vb + +\begin{verbatim} +\def\ps@mypagestyle{\ps@plain + \def\@oddhead{\hfill My running head}\let\@evenhead\@oddhead} +\pagestyle{mypagestyle} +\end{verbatim} + +\vb + +This will work fine if cropmarks are not requested. If you request cropmarks, \LaTeX\ will sooner +or later fall into an endless loop which will stop when memory is exhausted. You have to define +page styles from scratch. + +\subsection{Shifted cropmarks when the running foot overflows} +If there is not enough space for the running foot, the cropmarks will most likely be shifted. It +usually happens if you set option \opt{footskip} to zero (which is its default value) and forget to +use \verb.\pagestyle{empty}.. + +\subsection{Page boxes and Adobe Distiller} +Setting page boxes causes a fatal error in Adobe Distiller (verified with versions 4 and~9). See +section~\ref{Bboxes}. + +\subsection{Page reflection} +Option \opt{ReflectVertically} seems to produce slightly shifted output. If any of these options is +used in \XeTeX\ or more specifically with (x)dvipdfm(x) drivers, other \texttt{bop} or \texttt{eop} +code must not be used. See section~\ref{reflection} for details on its implementation. + +\subsection{Overprinting} +Overprinting is not yet supported in (x)dvipdfm(x), thus it does not work in \XeTeX, see +section~\ref{overprinting}. The author will try to implement it soon. In fact the macros are prepared +but commented out because they cause an error message and resulting PDF file cannot be displayed. +Your help will be appreciated. + +It was also found that overprinting does not work if the PostScript file is converted to PDF by +GhostScript version~7.x. This is a bug in GhostScript, overprinting works fine if +GhostScript~8.x is used. + +The effect of oveprinting was tested in Adobe Acrobat~9 Pro in MS~Windows~XP Home Service Pack~3. + +\subsection{Inconsistent dates} +Values of \texttt{CreationDate} and \texttt{ModDate} (see section~\ref{pdfinfo}) supplied by the driver contain information on +the time zone. Unfortunatelly, time zone setting is not available in \TeX. If both fields come from +the same origin, they are set consistently. If one of them is set by the driver and the other by +the \pkg{zwpagelayout} package, then only the field set by he driver will contain the time zone +value. Depending on your time zone it may look as if the document were modified before it was +created. + +\subsection{PDF/X conformance} +The PDF/X conformance is only partial. The details are given in section~\ref{pdfx1a} and its +subsections. + +\section{Changes} +This section summarizes the changes. The version and the package date is given. It may be useful to +specify the date in the \cmd{usepackage} or \cmd{RequirePackage} command if you rely on a specific +feature not available in the old version of the package. + +\subsection{Version 1.1, 2010/12/xx} +Two bugs were fixed and a few new features were introduced. Documentation is modified and extended as +well. +\begin{itemize} +\item Bug fix, if \cmd{pagestyle} or \cmd{thispagestyle} was issued within a group while cropmarks +were active, the package often failed into an endless loop which resulted in exhausting the memory. +\item Bug fix, the code for page reflection for \texttt{dvips} did not preserve properly the old +\texttt{bop-hook}. +\item New feature, the driver can be explicitly selected (section~\ref{driver.selection}) and the +code can be branched according to the driver (section~\ref{driver.switching}). +\item New feature, page reflection implemented for (x)dvipdfm(x) drivers, \ie. for \XeTeX\ +(section~\ref{reflection}). +\item New feature, CMYK and RGB colors explicitly defined (section~\ref{color}). +\item New feature, colors may be redefined to use the CMYK model (section~\ref{color}). +\item New feature, overprinting implemented for \texttt{pdftex} and \texttt{dvips} +(section~\ref{overprinting}). +\item New feature, PDF information can be set without the need of loading the \pkg{hyperref} +package (section~\ref{pdfinfo}). +\item New feature, partial PDF/X-1a compliance (section~\ref{pdfx1a}). +\end{itemize} + +\subsection{Version 1.0a, 2008/12/26} +The sample files distributed with the package no longer require enc\TeX\ and private macro +packages. \section{License} The package can be used and distributed according to the \LaTeX\ Project Public License version~1.3 or later the text of which can be found at the \texttt{License.txt} file in the \texttt{doc} directory or at \url{http://www.latex-project.org/lppl.txt} +\section{Trade marks} +This document makes use of trade marks owned by Adobe Systems Incorporated and Microsoft +Corporation when refering to their products. + \end{document} |