started reworking legacy code...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-08-31 02:43:22 +03:00
parent 958aaa083c
commit 2664e4e71d
2 changed files with 54 additions and 112 deletions

View File

@ -2064,6 +2064,7 @@
% NOTE: this essentially counts pages, \usecell{..} / \usecell*{..} are % NOTE: this essentially counts pages, \usecell{..} / \usecell*{..} are
% better suited for custom stuff... % better suited for custom stuff...
% NOTE: page is a 1 based offset in pages and can be fractional... % NOTE: page is a 1 based offset in pages and can be fractional...
% NOTE: \usecell*{..} takes care of all the bleed calculations...
\def\usespreadpage{\@ifstar{% \def\usespreadpage{\@ifstar{%
\photobook@usespreadpage@star% \photobook@usespreadpage@star%
}{% }{%
@ -2903,12 +2904,11 @@
\newpage } \newpage }
% XXX
% XXX \OFFSETFIX
%% \DescribeMacro{\imagespreadleft\{..\}} %% \DescribeMacro{\imagespreadleft\{..\}}
%% \DescribeMacro{\imagespreadleftcaption\{..\}}
%% \DescribeMacro{\resetimagespreadleftcaption}
%% \DescribeMacro{\imagespreadleft*\{..\}}
% %
%% \LEGACY
%%
%% Image spread aligned left (with bleed). %% Image spread aligned left (with bleed).
% %
%% >> \imagespreadleft[<clearence>]{<caption>}{<image>} %% >> \imagespreadleft[<clearence>]{<caption>}{<image>}
@ -2933,64 +2933,29 @@
%% \end{verbatim} %% \end{verbatim}
%% \end{minipage} %% \end{minipage}
%% %%
% XXX might be a good idea to do a version of this with min/max width of % XXX do a better default...
% the caption block... % XXX need a caption box...
\newcommand\imagespreadleft[3][\clearimage]{ \ResettableMacro{imagespreadleftcaption}[1]{%
\sbox{\photobook@imagebox}{ \vcaptioncell[after, align=flushleft]{%
\includegraphics[ \captionformat{#1}}}
keepaspectratio,
height=\dimexpr \blockheight - ((#1) * 2) + \vgrowimageby \relax,]{#3} } % XXX add nudge/grow support...
% left page... \ImagePageTemplate{imagespreadleft}{%
% XXX BUG: this in some cases creates an extra empty spread before this... \cleartoleftpage%
% ...appears to be a problem where we have a tweak.tex \begin{spreadtopages}[2]%
\cleartoleftpage \imagecell[fit, left, clearance=\clearimage, #1]{#2}{#3}%
\null \end{spreadtopages}}
\ShipoutPicture{
\AtPageLowerLeft{
\hspace*{\dimexpr
\OFFSETFIX
-(\nudgeimageby)
+#1
+\bleed
\relax}{
\raisebox{\dimexpr
#1
+ \bleed
- 0.5\vgrowimageby
- \vnudgeimageby
\relax}{
\usebox\photobook@imagebox } } } }
\newpage
% right page...
\captionboxright[\blockwidth]{\photobook@imagebox}{#2}
\ShipoutPicture{
\AtPageLowerLeft{
\hspace*{\dimexpr
\OFFSETFIX
-(\nudgeimageby)
+#1
-\blockwidth
+\bleed
\relax}{
\raisebox{\dimexpr
#1
+ \bleed
- 0.5\vgrowimageby
- \vnudgeimageby
\relax}{
\usebox\photobook@imagebox } } } }
\newpage
\resetnudgeimage }
% XXX % XXX
%% \DescribeMacro{\imagespreadright\{..\}} %% \DescribeMacro{\imagespreadright\{..\}}
%% \DescribeMacro{\imagespreadrightcaption\{..\}}
%% \DescribeMacro{\resetimagespreadrightcaption}
%% \DescribeMacro{\imagespreadright*\{..\}}
% %
%% \LEGACY
%%
%% Image spread aligned right (with bleed). %% Image spread aligned right (with bleed).
% %
%% >> \imagespreadright[<clearence>]{<caption>}{<image>} %% >> \imagespreadright[<options>]{<caption>}{<image>}
% %
%% \begin{minipage}{\textwidth} %% \begin{minipage}{\textwidth}
%% \begin{verbatim} %% \begin{verbatim}
@ -3012,57 +2977,28 @@
%% \end{verbatim} %% \end{verbatim}
%% \end{minipage} %% \end{minipage}
%% %%
\newcommand\imagespreadright[3][\clearimage]{ % XXX need a caption box...
\sbox{\photobook@imagebox}{ % XXX do a better default...
\includegraphics[ \ResettableMacro{imagespreadrightcaption}[1]{%
keepaspectratio, \vcaptioncell[before, align=flushleft]{%
height=\dimexpr \blockheight - ((#1) * 2) + \vgrowimageby \relax,]{#3} } \captionformat{#1}}}
% left page...
\cleartoleftpage % XXX add nudge/grow support...
\null \ImagePageTemplate{imagespreadright}{%
\captionboxleft[\blockwidth]{\photobook@imagebox}{#2} \cleartoleftpage%
\ShipoutPicture{ \begin{spreadtopages}[2]%
\AtPageLowerLeft{ \imagecell[fit, right, clearance=\clearimage, #1]{#2}{#3}%
\hspace*{\dimexpr \end{spreadtopages}}
-#1
+0.5\OFFSETFIX
+(\nudgeimageby)
+2\blockwidth
+\bleed
-\wd\photobook@imagebox \relax}{
\raisebox{\dimexpr
#1 + \bleed
- 0.5\vgrowimageby - \vnudgeimageby \relax}{
\usebox\photobook@imagebox } } } }
\newpage
% right page...
\null
\ShipoutPicture{
\AtPageLowerLeft{
\hspace*{\dimexpr
-#1
+0.5\OFFSETFIX
+(\nudgeimageby)
+\blockwidth
+\bleed
-\wd\photobook@imagebox \relax}{
\raisebox{\dimexpr
#1 + \bleed
- 0.5\vgrowimageby - \vnudgeimageby \relax}{
\usebox\photobook@imagebox } } } }
\newpage
\resetnudgeimage }
% XXX BUG?: this is not centered vertically... %% \DescribeMacro{\imagespreadfill\{..\}}
% XXX %% \DescribeMacro{\imagespreadfillcaption\{..\}}
%% \DescribeMacro{\imagespreadfullbleed\{..\}} %% \DescribeMacro{\resetimagespreadfillcaption}
%% \DescribeMacro{\imagespreadfill*\{..\}}
% %
%% \LEGACY
%%
%% Image spread with full bleed. %% Image spread with full bleed.
% %
%% >> \imagespreadfullbleed[<vertical-offset>]{<caption>}{<image>} %% >> \imagespreadfill[<options>]{<caption>}{<image>}
% %
%% \begin{minipage}{\textwidth} %% \begin{minipage}{\textwidth}
%% \begin{verbatim} %% \begin{verbatim}
@ -3084,17 +3020,18 @@
%% \end{verbatim} %% \end{verbatim}
%% \end{minipage} %% \end{minipage}
%% %%
% XXX do we need the same thing but with a left caption???
\newcommand\imagespreadfullbleed[3][0mm]{ % XXX do a better default...
\setlength{\photobook@tmpnudgeimageby}{\nudgeimageby} \ResettableMacro{imagespreadfillcaption}[1]{%
\setlength{\photobook@tmpvnudgeimageby}{\vnudgeimageby} \captioncell[bottom, align=flushright]{%
\setlength{\photobook@tmpvgrowimageby}{\vgrowimageby} \captionformat{#1}}}
\cleartoleftpage
\imageleftspreadfullbleed[#1]{}{#3} % XXX add nudge/grow support...
\nudgeimage{\photobook@tmpnudgeimageby} \ImagePageTemplate{imagespreadfill}{%
\vnudgeimage{\photobook@tmpvnudgeimageby} \cleartoleftpage%
\vgrowimage{\photobook@tmpvgrowimageby} \begin{spreadtopages}[2]%
\imagerightspreadfullbleed[#1]{#2}{#3} } \imagecell[fill, clearance=\clearimage, #1]{#2}{#3}%
\end{spreadtopages}}

View File

@ -22,6 +22,11 @@
\begin{document} \begin{document}
\imagespreadleft{mooo}{DSC00403-2}
\imagespreadright{mooo}{DSC00403-2}
\imagespreadfill{mooo}{DSC00403-2}
\begin{spreadtopages*}{moo}{% \begin{spreadtopages*}{moo}{%
\imagecell[fill, clearance=-\bleed]{}{DSC00403-2}} \imagecell[fill, clearance=-\bleed]{}{DSC00403-2}}