clearence reworked, mostly, still need testing...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-05-05 15:27:39 +03:00
parent 485bb4ba07
commit 8cdf25b17e
2 changed files with 136 additions and 31 deletions

View File

@ -5,7 +5,7 @@
% page size... % page size...
blockwidth=240mm, blockheight=220mm, blockwidth=240mm, blockheight=220mm,
bleed=4mm, bleed=4mm,
%bindingoffset=5mm, bindingoffset=5mm,
% image block configuration... % image block configuration...
imageblockwidth=0.98, imageblockheight=0.98, imageblockwidth=0.98, imageblockheight=0.98,
imageblockoffsettop=-0.1, imageblockoffsettop=-0.1,
@ -38,56 +38,52 @@
% XXX there is an offset (\bleed sized???) on the left... % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{page} \begin{page}
% XXX leftside: width seems to be off by one bleed....
\begin{leftside} \begin{leftside}
\imagecell[fit]{}{DSC00403-2} \imagecell[fit]{}{DSC00403-2}
\end{leftside} \end{leftside}
\begin{rightside} \begin{rightside*}
\imagecell[fit]{}{DSC00403-2} \imagecell[fit, clearance=-\bleed]{}{DSC00403-2}
\end{rightside} \end{rightside*}
\end{page} \end{page}
\begin{page} \begin{page}
% XXX leftside: width seems to be off by one bleed....
\begin{leftside} \begin{leftside}
\begin{cliptocell} \begin{cliptocell}
\imagecell[fit]{}{DSC00403-2} \imagecell[fit]{}{DSC00403-2}
\end{cliptocell} \end{cliptocell}
\end{leftside} \end{leftside}
\begin{rightside} \begin{rightside*}
\begin{cliptocell} \begin{cliptocell}
\imagecell[fit]{}{DSC00403-2} \imagecell[fit, clearance=-\bleed]{}{DSC00403-2}
\end{cliptocell} \end{cliptocell}
\end{rightside} \end{rightside*}
\end{page} \end{page}
\begin{page} \begin{page}
% XXX leftside: width seems to be off by one bleed....
\begin{leftside} \begin{leftside}
\begin{cliptocell} \begin{cliptocell}
\imagecell[fill]{}{DSC00403-2} \imagecell[fill]{}{DSC00403-2}
\end{cliptocell} \end{cliptocell}
\end{leftside} \end{leftside}
\begin{rightside} \begin{rightside*}
\begin{cliptocell} \begin{cliptocell}
\imagecell[fill]{}{DSC00403-2} \imagecell[fill, clearance=-\bleed]{}{DSC00403-2}
\end{cliptocell} \end{cliptocell}
\end{rightside} \end{rightside*}
\end{page} \end{page}
% XXX the left side's width seems to be off by one \bleed + it is offset
% by a bleed depending on page being even/odd...
% ...is this a binding offset issue???
\GenerateTemplate \GenerateTemplate
\GenerateTemplate \GenerateTemplate

View File

@ -38,10 +38,16 @@
% %
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% %
% XXX ASAP: imagecell: clearance should have the same semantics as cliptocell
% offsts...
% (CLEARANCE)
% XXX ASAP should cover/jacket/endpaper/spread cells set default cliptocell % XXX ASAP should cover/jacket/endpaper/spread cells set default cliptocell
% bleeds??? % bleeds???
% ...needs testing and experimenting... % ...needs testing and experimenting...
% XXX ASAP: should \blockwidth include \bindingoffset (current) or not??? % XXX ASAP: should \blockwidth include \bindingoffset (current) or not???
% ...currently I think that no, as \blockwidth indicates the outer
% width of the block, and this poses the question:
% should \pagewidth include \bindingoffset???
% XXX ASAP should cover/jacket/endpaper/spread templates/cells account % XXX ASAP should cover/jacket/endpaper/spread templates/cells account
% for \bindingoffset (likely no) and/or \gutteroffset ??? % for \bindingoffset (likely no) and/or \gutteroffset ???
% ...especially relevant to endpaper/spread... % ...especially relevant to endpaper/spread...
@ -85,8 +91,8 @@
%%% NOTE: \def\<module-name>@[A-Z]+ macros will be visible to both the %%% NOTE: \def\<module-name>@[A-Z]+ macros will be visible to both the
%%% code and the generated docs... %%% code and the generated docs...
\edef\photobook@FILEVERSION{v0.1.21} \edef\photobook@FILEVERSION{v0.1.22}
\edef\photobook@FILEDATE{2023-04-22} \edef\photobook@FILEDATE{2023-05-05}
%% \documentclass{ltxdoc} %% \documentclass{ltxdoc}
@ -952,6 +958,12 @@
%% \DescribeMacro{\cellheight=<len>} %% \DescribeMacro{\cellheight=<len>}
%% \DescribeMacro{\celloffsetleft=<len>} %% \DescribeMacro{\celloffsetleft=<len>}
%% \DescribeMacro{\celloffsettop=<len>} %% \DescribeMacro{\celloffsettop=<len>}
% XXX EXPERIMENTAL CLEARANCE
%%% \DescribeMacro{\clearanceleft=<len>}
%%% \DescribeMacro{\clearancetop=<len>}
%%% \DescribeMacro{\clearanceright=<len>}
%%% \DescribeMacro{\clearancebottom=<len>}
% XXX LEGACY CLEARANCE
%% \DescribeMacro{\clearance=<len>} %% \DescribeMacro{\clearance=<len>}
% %
%% Cell geometry. %% Cell geometry.
@ -973,6 +985,17 @@
\setlength\celloffsetleft{0pt} \setlength\celloffsetleft{0pt}
\newlength\celloffsettop \newlength\celloffsettop
\setlength\celloffsettop{0pt} \setlength\celloffsettop{0pt}
% XXX EXPERIMENTAL CLEARANCE
\newlength\clearanceleft
\setlength\clearanceleft{0pt}
\newlength\clearancetop
\setlength\clearancetop{0pt}
\newlength\clearanceright
\setlength\clearanceright{0pt}
\newlength\clearancebottom
\setlength\clearancebottom{0pt}
\def\clearances{0pt}
% XXX LEGACY CLEARANCE
\newlength\clearance \newlength\clearance
\setlength\clearance{0pt} \setlength\clearance{0pt}
@ -1587,6 +1610,12 @@
%% \DescribeMacro{\cellparentheight=<len>} %% \DescribeMacro{\cellparentheight=<len>}
%% \DescribeMacro{\celloffsettop=<len>} %% \DescribeMacro{\celloffsettop=<len>}
%% \DescribeMacro{\celloffsetleft=<len>} %% \DescribeMacro{\celloffsetleft=<len>}
% XXX EXPERIMENTAL CLEARANCE
%%% \DescribeMacro{\clearanceleft=<len>}
%%% \DescribeMacro{\clearancetop=<len>}
%%% \DescribeMacro{\clearanceright=<len>}
%%% \DescribeMacro{\clearancebottom=<len>}
% XXX LEGACY CLEARANCE
%% \DescribeMacro{\clearance=<len>} %% \DescribeMacro{\clearance=<len>}
%% %%
%% A cell defines a set of contextual lengths: %% A cell defines a set of contextual lengths:
@ -1719,6 +1748,12 @@
\setlength\cellheight{\photobook@protect@h}% \setlength\cellheight{\photobook@protect@h}%
\setlength\celloffsettop{0pt}% \setlength\celloffsettop{0pt}%
\setlength\celloffsetleft{0pt}% \setlength\celloffsetleft{0pt}%
% XXX EXPERIMENTAL CLEARANCE
\setlength\clearanceleft{0pt}%
\setlength\clearancetop{0pt}%
\setlength\clearanceright{0pt}%
\setlength\clearancebottom{0pt}%
% XXX LEGACY CLEARANCE
\setlength\clearance{0pt}% \setlength\clearance{0pt}%
% %
\begin{MinipageCellContent}[\photobook@minipagecell@parentvalign]{minipagecell}% \begin{MinipageCellContent}[\photobook@minipagecell@parentvalign]{minipagecell}%
@ -2269,6 +2304,16 @@
\def\photobook@imagecell@captiontop{0pt} \def\photobook@imagecell@captiontop{0pt}
\def\photobook@imagecell@captionleft{0pt} \def\photobook@imagecell@captionleft{0pt}
% XXX EXPERIMENTAL
\newlength\photobook@imagecell@clearance@left
\setlength\photobook@imagecell@clearance@left{0pt}
\newlength\photobook@imagecell@clearance@top
\setlength\photobook@imagecell@clearance@top{0pt}
\newlength\photobook@imagecell@clearance@right
\setlength\photobook@imagecell@clearance@right{0pt}
\newlength\photobook@imagecell@clearance@bottom
\setlength\photobook@imagecell@clearance@bottom{0pt}
% XXX LEGACY
\newlength\photobook@imagecell@clearance \newlength\photobook@imagecell@clearance
\setlength\photobook@imagecell@clearance{0pt} \setlength\photobook@imagecell@clearance{0pt}
@ -2293,7 +2338,8 @@
% shortdands... % shortdands...
\newcommand\photobook@imagecell@LEFT{% \newcommand\photobook@imagecell@LEFT{%
\def\photobook@imagecell@left{\dimexpr% \def\photobook@imagecell@left{\dimexpr%
+\photobook@imagecell@clearance \relax}% +\photobook@imagecell@clearance@left \relax}%
%+\photobook@imagecell@clearance \relax}%
\def\photobook@imagecell@captionleft{ \def\photobook@imagecell@captionleft{
% XXX not sure why this branch is needed... % XXX not sure why this branch is needed...
\ifKV@imagecell@args@fit \ifKV@imagecell@args@fit
@ -2301,12 +2347,14 @@
\else% \else%
\dimexpr% \dimexpr%
+\cellwidth +\cellwidth
-\photobook@imagecell@clearance -\photobook@imagecell@clearance@left
%-\photobook@imagecell@clearance
-\wd\photobook@imagebox \relax\fi}}% -\wd\photobook@imagebox \relax\fi}}%
\newcommand\photobook@imagecell@RIGHT{% \newcommand\photobook@imagecell@RIGHT{%
\def\photobook@imagecell@left{\dimexpr \def\photobook@imagecell@left{\dimexpr
+\cellwidth +\cellwidth
-\photobook@imagecell@clearance -\photobook@imagecell@clearance@right
%-\photobook@imagecell@clearance
-\wd\photobook@imagebox \relax} -\wd\photobook@imagebox \relax}
% XXX not sure why 0.5 but it seems to work... % XXX not sure why 0.5 but it seems to work...
\def\photobook@imagecell@captionleft{% \def\photobook@imagecell@captionleft{%
@ -2330,7 +2378,8 @@
% top/bottom... % top/bottom...
\define@boolkey{imagecell@args}{top}[true]{% \define@boolkey{imagecell@args}{top}[true]{%
\def\photobook@imagecell@top{% \def\photobook@imagecell@top{%
\photobook@imagecell@clearance}% \photobook@imagecell@clearance@top}%
%\photobook@imagecell@clearance}%
\def\photobook@imagecell@captiontop{% \def\photobook@imagecell@captiontop{%
-\dimexpr -\dimexpr
+\cellheight +\cellheight
@ -2339,14 +2388,55 @@
\def\photobook@imagecell@top{% \def\photobook@imagecell@top{%
\dimexpr \dimexpr
+\cellheight +\cellheight
-\photobook@imagecell@clearance -\photobook@imagecell@clearance@bottom
%-\photobook@imagecell@clearance
-\ht\photobook@imagebox \relax}% -\ht\photobook@imagebox \relax}%
\def\photobook@imagecell@captiontop{% \def\photobook@imagecell@captiontop{%
\dimexpr \dimexpr
\photobook@imagecell@top \photobook@imagecell@top
+\photobook@imagecell@clearance \relax}}% +\photobook@imagecell@clearance@bottom \relax}}%
%+\photobook@imagecell@clearance \relax}}%
% clearance=<len>... % clearance=<len>...
% clearance=<horizontal> <vertical>...
% clearance=<left> <bottom> <right> <top>...
\define@key{imagecell@args}{clearance}{% \define@key{imagecell@args}{clearance}{%
% XXX EXPERIMENTAL
% XXX this is essentially the same as \photobook@cliptocell@bleeds -- unite...
\def\photobook@imagecell@clearances{#1}%
\setsepchar{ }
\readlist*\photobook@imagecell@clearencelist{#1}%
\setsepchar{,}%
%% args: size
\ifnum \photobook@imagecell@clearencelistlen = 1%
\setlength\photobook@imagecell@clearance@left{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@bottom{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@right{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@top{%
\photobook@imagecell@clearencelist[1]}\fi%
% args: horizontal vertical
\ifnum \photobook@imagecell@clearencelistlen = 2%
\setlength\photobook@imagecell@clearance@left{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@bottom{%
\photobook@imagecell@clearencelist[2]}%
\setlength\photobook@imagecell@clearance@right{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@top{%
\photobook@imagecell@clearencelist[2]}\fi%
% args: left bottom right top
\ifnum \photobook@imagecell@clearencelistlen = 4%
\setlength\photobook@imagecell@clearance@left{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@bottom{%
\photobook@imagecell@clearencelist[2]}%
\setlength\photobook@imagecell@clearance@right{%
\photobook@imagecell@clearencelist[3]}%
\setlength\photobook@imagecell@clearance@top{%
\photobook@imagecell@clearencelist[4]}\fi%
% XXX LEGACY...
\setlength\photobook@imagecell@clearance{#1}}% \setlength\photobook@imagecell@clearance{#1}}%
% offsettop=<len> / offsetleft=<len>... % offsettop=<len> / offsetleft=<len>...
@ -2395,10 +2485,14 @@
keepaspectratio, keepaspectratio,
width=\photobook@imagecell@scale\dimexpr width=\photobook@imagecell@scale\dimexpr
\cellwidth \cellwidth
- ((\photobook@imagecell@clearance) * 2) \relax, -\photobook@imagecell@clearance@left
-\photobook@imagecell@clearance@right \relax,
%- ((\photobook@imagecell@clearance) * 2) \relax,
height=\photobook@imagecell@scale\dimexpr height=\photobook@imagecell@scale\dimexpr
\cellheight \cellheight
- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% -\photobook@imagecell@clearance@top
-\photobook@imagecell@clearance@bottom \relax]{#3}}%
%- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}%
% fill... % fill...
\else\ifKV@imagecell@args@fill% \else\ifKV@imagecell@args@fill%
% preload image to get its proportions... % preload image to get its proportions...
@ -2417,14 +2511,18 @@
keepaspectratio, keepaspectratio,
width=\photobook@imagecell@scale\dimexpr width=\photobook@imagecell@scale\dimexpr
+ \cellwidth + \cellwidth
- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% -\photobook@imagecell@clearance@left
-\photobook@imagecell@clearance@right \relax]{#3}}%
%- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}%
\else% \else%
\sbox{\photobook@imagebox}{% \sbox{\photobook@imagebox}{%
\includegraphics[% \includegraphics[%
keepaspectratio, keepaspectratio,
height=\photobook@imagecell@scale\dimexpr height=\photobook@imagecell@scale\dimexpr
+ \cellheight + \cellheight
- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% -\photobook@imagecell@clearance@top
-\photobook@imagecell@clearance@bottom \relax]{#3}}%
%- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}%
\fi\fi\fi% \fi\fi\fi%
% %
\setlength\celloffsetleft{% \setlength\celloffsetleft{%
@ -2467,6 +2565,13 @@
\maxdim{\celloffsetleft}{0pt}}% \maxdim{\celloffsetleft}{0pt}}%
\setlength\celloffsettop{% \setlength\celloffsettop{%
\maxdim{\celloffsettop}{0pt}}% \maxdim{\celloffsettop}{0pt}}%
% XXX EXPERIMENTAL CLEARANCE
\setlength\clearanceleft{\photobook@imagecell@clearance@left}
\setlength\clearancetop{\photobook@imagecell@clearance@top}
\setlength\clearanceright{\photobook@imagecell@clearance@right}
\setlength\clearancebottom{\photobook@imagecell@clearance@bottom}
\def\clearances{\photobook@imagecell@clearences}
% XXX LEGACY CLEARANCE
\setlength\clearance{\photobook@imagecell@clearance}% \setlength\clearance{\photobook@imagecell@clearance}%
% clear parent... % clear parent...
% XXX might be a good idea to put this into a special reusable cell... % XXX might be a good idea to put this into a special reusable cell...
@ -2927,6 +3032,8 @@
- \cellwidth - \cellwidth
- \clearcaption - \clearcaption
% XXX this is only present in images... % XXX this is only present in images...
% XXX change this to use \clearanceleft / \clearanceright / ...
% XXX LEGACY CLEARANCE
- \clearance \relax% - \clearance \relax%
\else% \else%
\photobook@captionblockcell@width\fi}% \photobook@captionblockcell@width\fi}%
@ -3939,9 +4046,11 @@
% make LaTeX complain that that is already defined... % make LaTeX complain that that is already defined...
% ...collision with bools??? % ...collision with bools???
\newenvironment{leftside}{% \newenvironment{leftside}{%
\begin{pagecell}% \begin{cell*}%
{\bleed, \bleed}%
{\pageblockwidth}{\pageblockheight}%
}{% }{%
\end{pagecell}} \end{cell*}}
% XXX EXPERIMENTAL % XXX EXPERIMENTAL
\newenvironment{leftside*}{% \newenvironment{leftside*}{%
\begin{leftside}% \begin{leftside}%