fixed an image clearence bug + added no-defaults for \geometry{ .. }...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-08-02 17:03:53 +03:00
parent f43258534d
commit 89b907d842

View File

@ -216,19 +216,39 @@
% and overriding of the paperwidth/paperheight if they were changed % and overriding of the paperwidth/paperheight if they were changed
% by the user code anywhere between \documentclass[..]{photobook} % by the user code anywhere between \documentclass[..]{photobook}
% and \begin{document}... % and \begin{document}...
\DeclareStringOption[5mm]{bleed}[5mm]
\DeclareStringOption{blockwidth} \DeclareStringOption{blockwidth}
\DeclareStringOption{blockheight} \DeclareStringOption{blockheight}
\DeclareStringOption[0]{bindingoffset}[10mm] \DeclareStringOption[0]{bindingoffset}[10mm]
\DeclareStringOption[5mm]{bleed}[5mm]
% Distance from image to paper border (clearence) for full-page images.
%
% this can be:
% - negative value set image bleed,
% - positive value set distance frome paper edge to image.
%
\DeclareStringOption{clearimage}[-5mm]
% Image block size relative to text block... % Image block size relative to text block...
% %
% XXX not yet used...
% XXX better name... % XXX better name...
\DeclareStringOption[0.85]{imageblockwidth}[1] \DeclareStringOption[0.85]{imageblockwidth}[1]
\DeclareStringOption[0.85]{imageblockheight}[1] \DeclareStringOption[0.85]{imageblockheight}[1]
\DeclareStringOption[-0.05]{imageblockoffsettop}[0] \DeclareStringOption[-0.05]{imageblockoffsettop}[0]
% let the user set geometry defaults.
%
% NOTE: if this is not set any options set by the uset intersecting with
% options set in the class will get overriden by class options...
% NOTE: this does not affect the following:
% paperwidth=\bleedblockwidth
% paperheight=\bleedblockheight
% bindingoffset=\bindingoffset
%
% XXX better name...
\DeclareBoolOption{geometrynodefaults}
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{book}} \DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessKeyvalOptions* \ProcessKeyvalOptions*
@ -267,24 +287,19 @@
\newlength\bindingoffset \newlength\bindingoffset
\setlength\bindingoffset{\photobook@bindingoffset} \setlength\bindingoffset{\photobook@bindingoffset}
% NOTE: since this can be any number but we need to detect if it was set
% manually we'll set it to a really big and random not so random
% prime and hope no will print something big enough and dare to use
% it as image clearence...
\newlength{\clearimage}
\setlength\clearimage{32553}
\edef\imageblockwidth{\photobook@imageblockwidth} \edef\imageblockwidth{\photobook@imageblockwidth}
\edef\imageblockheight{\photobook@imageblockheight} \edef\imageblockheight{\photobook@imageblockheight}
\edef\imageblockoffsettop{\photobook@imageblockoffsettop} \edef\imageblockoffsettop{\photobook@imageblockoffsettop}
% distance from image to paper border (clearence) for full-page images.
%
% - negative value set bleed siae,
% - positive value set distance frome paper edge to image.
%
% XXX for some reason this is not even around the page and is less on
% the left -- \OFFSETFIX is used to compensate for this effect...
% ...need to find a real fix...
% XXX make configurable...
\newlength{\clearimage}
\setlength{\clearimage}{-4mm}
%---------------------------------------------------------------------- %----------------------------------------------------------------------
@ -352,6 +367,14 @@
+ 2\coverboardgrow + 2\coverboardgrow
\relax } }{} \relax } }{}
\fi \fi
% default image clearence...
\ifdim\clearimage=32553
\ifx\photobook@clearimage\empty
\setlength\clearimage{-\bleed}
\else
\setlength\clearimage{\photobook@clearimage}
\fi
\fi
% page with bleeds... % page with bleeds...
% NOTE: this is essentially \paperwidth and \paperheight but we do % NOTE: this is essentially \paperwidth and \paperheight but we do
% not rely on them being defined -- photobook settings take % not rely on them being defined -- photobook settings take
@ -395,16 +418,24 @@
\RecalculatePageLengths \RecalculatePageLengths
\geometry{ % no-defaults -- the user is expected to set things up...
% paper size (incl. bleeds)... \ifphotobook@geometrynodefaults
paperwidth=\bleedblockwidth, paperheight=\bleedblockheight, \geometry{
bindingoffset=\bindingoffset, % paper size (incl. bleeds)...
% XXX these should be overridable... paperwidth=\bleedblockwidth, paperheight=\bleedblockheight,
% include header/footer/margin notes in printed area bindingoffset=\bindingoffset}
twoside, includeall, nomarginpar, % normal mode...
ignorehead=false, ignorefoot=false, ignoremp=false, \else
% center printed area on page \geometry{
vcentering, hcentering} % paper size (incl. bleeds)...
paperwidth=\bleedblockwidth, paperheight=\bleedblockheight,
bindingoffset=\bindingoffset,
% include header/footer/margin notes in printed area
twoside, includeall, nomarginpar,
ignorehead=false, ignorefoot=false, ignoremp=false,
% center printed area on page
vcentering, hcentering}
\fi
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -609,6 +640,11 @@
%---------------------------------------------------------------------- %----------------------------------------------------------------------
% Cover/endpaper Templates... % Cover/endpaper Templates...
%
% XXX need:
% \begin{front} ...
% \begin{spine} ...
% \begin{spine} ...
% XXX % XXX
@ -634,8 +670,7 @@
% - vertical offset is floating depending on image proportions... % - vertical offset is floating depending on image proportions...
% - width is a bit off... % - width is a bit off...
% XXX BUG: vertical alignment falls apart if page head is changed... % XXX BUG: vertical alignment falls apart if page head is changed...
% XXX replace \ifthenelse\isodd .. with etoolbox equivalent.... % XXX replace \ifthenelse\isodd .. with etoolbox equivalent.... (???)
% ...this is the only dependency on \RequirePackage{ifthen}
\newcommand\imagepagefitWH[4]{ \newcommand\imagepagefitWH[4]{
\sbox{\photobook@imagebox}{ \sbox{\photobook@imagebox}{
\includegraphics[ \includegraphics[
@ -791,7 +826,6 @@
+0.5\blockwidth +0.5\blockwidth
-0.5\wd\photobook@imagebox -0.5\wd\photobook@imagebox
-\bleed -\bleed
% XXX
-0.5\OFFSETFIX -0.5\OFFSETFIX
\relax}{ \relax}{
\raisebox{\dimexpr \raisebox{\dimexpr
@ -1209,6 +1243,7 @@
\resetnudgeimage } \resetnudgeimage }
% XXX BUG?: this is not centered vertically...
% XXX % XXX
% imagespreadfullbleed[vertical-offset]{caption}{image} % imagespreadfullbleed[vertical-offset]{caption}{image}
% %