some cleanup and tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-07-29 22:39:55 +03:00
parent 5c019db562
commit 839906c96d

View File

@ -28,53 +28,90 @@
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% options... % options...
%
% XXX handle options:
% - image block (w, h)
% ...should this be a global setting or a template thing???
% pdf layout... % pdf layout...
%
% see: hyperref's pdfpagelayout for more options... % see: hyperref's pdfpagelayout for more options...
\DeclareStringOption[TwoPageRight]{pdfpagelayout} \DeclareStringOption[TwoPageRight]{pdfpagelayout}
% page geometry... % page geometry...
% %
% <---> bindingoffset
% <---> bleed <---> innerbleed % <---> bleed <---> innerbleed
% %
% +-----------------------------------------------+ ^ % + - - - - - - - - - - - - - - - - - - - - - + - + ^
% | | | | bleed % . . . | bleed
% | +-----------------------------------+ | | v % . +---------------------------------------+ . v . . ---
% | | ^ | | | % . | ^ . | .
% | | | | | | % . | . . . . . . | . . | . ^
% | |<-- pagewidth -------------------->| | | % . |<-- pagewidth ------------------------>| . |
% | | | | | | % . | . | . . | . |
% | | | | | | % . | | . | . textheight
% | | | | | | % . | . | . . | . |
% | | pageheight | | | % . | pageheight . | . |
% | | | | | | % . | . | . . | . |
% | | | | | | % . | | <---> bindingoffset |
% | | | | | | % . | . . . . . . | . . | . v
% | | v | | | % . | v . | .
% | +-----------------------------------+ | | % . +---------------------------------------+ . ^ . . ---
% | | | % . . . . | bleed
% +-----------------------------------------------+ % + - - - - - - - - - - - - - - - - - - - - - + - + v
% . .
% | <-- textwidth --------------> . |
% ^ binding line
% %
\DeclareStringOption[5mm]{bleed} % NOTE: if pagewidth/pageheight are set they will force recalculations
% and overriding of the paperwidth/paperheight if they were changed
% by the user code anywhere between \documentclass[..]{photobook}
% and \begin{document}...
\DeclareStringOption[5mm]{bleed}[5mm]
\DeclareStringOption{innerbleed} \DeclareStringOption{innerbleed}
\DeclareStringOption{pagewidth} \DeclareStringOption{pagewidth}
\DeclareStringOption{pageheight} \DeclareStringOption{pageheight}
\DeclareStringOption[0]{bindingoffset} \DeclareStringOption[0]{bindingoffset}[10mm]
% XXX handle options:
% - image block (w, h)
% ...should this be a global setting or a template thing???
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{book}} \DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessKeyvalOptions* \ProcessKeyvalOptions*
% Parent class...
%
\LoadClass[9pt, final, openany]{book} \LoadClass[9pt, final, openany]{book}
%----------------------------------------------------------------------
% Globals...
% NOTE: page and bleed block sizes are set via \RecalculatePageLengths
\newlength\pagewidth
\newlength\pageheight
% NOTE: these are equivalent to \paperwidth and \paperheight but are
% independent of them...
\newlength\bleedblockwidth
\newlength\bleedblockheight
\newlength\bleed
\setlength\bleed{\photobook@bleed}
\newlength\innerbleed
\setlength\innerbleed{
\ifx\photobook@innerbleed\empty
\bleed
\else
\photobook@innerbleed
\fi }
\newlength\bindingoffset
\setlength\bindingoffset{\photobook@bindingoffset}
%---------------------------------------------------------------------- %----------------------------------------------------------------------
% Commands... % Commands...
@ -112,33 +149,6 @@
\relax} } \relax} }
%----------------------------------------------------------------------
% Globals...
\newlength\pagewidth
\newlength\pageheight
% NOTE: these are equivalent to \paperwidth and \paperheight but are
% independent of them...
\newlength\bleedblockwidth
\newlength\bleedblockheight
\newlength\bleed
\setlength\bleed{\photobook@bleed}
\newlength\innerbleed
\setlength\innerbleed{
\ifx\photobook@innerbleed\empty
\bleed
\else
\photobook@innerbleed
\fi }
\newlength\bindingoffset
\setlength\bindingoffset{\photobook@bindingoffset}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% update global values... % update global values...
@ -146,11 +156,19 @@
%----------------------------------------------------------------------
% page / spread templates...
% XXX
%---------------------------------------------------------------------- %----------------------------------------------------------------------
\AtEndPreamble{ \AtEndPreamble{
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% pdf metadata... % Metadata...
\hypersetup{ \hypersetup{
pdfinfo={ pdfinfo={
@ -171,19 +189,20 @@
\geometry{ \geometry{
% paper size (incl. bleeds)... % paper size (incl. bleeds)...
paperwidth=\bleedblockwidth, paperheight=\bleedblockheight, paperwidth=\bleedblockwidth, paperheight=\bleedblockheight,
bindingoffset=\bindingoffset,
% XXX these should be overridable...
% include header/footer/margin notes in printed area % include header/footer/margin notes in printed area
twoside, includeall, nomarginpar, twoside, includeall, nomarginpar,
ignorehead=false, ignorefoot=false, ignoremp=false, ignorehead=false, ignorefoot=false, ignoremp=false,
% center printed area on page % center printed area on page
vcentering, hcentering, vcentering, hcentering, }
bindingoffset=\bindingoffset}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% pdf boxes... % pdf boxes...
% calculate pdf box dimensions in pt... % calculate pdf box dimensions in pt...
% XXX should these be local or global???
\edef\@pdfWidthPt{\strip@pt\dimexpr \edef\@pdfWidthPt{\strip@pt\dimexpr
0.996264009963\bleedblockwidth \relax} 0.996264009963\bleedblockwidth \relax}
\edef\@pdfHeightPt{\strip@pt\dimexpr \edef\@pdfHeightPt{\strip@pt\dimexpr