started work on cell layout...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-08-13 15:09:38 +03:00
parent 14aaeb8db6
commit 2ac6d715e3

View File

@ -945,7 +945,7 @@
%---------------------------------------------------------------------- %----------------------------------------------------------------------
%%%% Environments %%%% Environments and Cells
% %
% XXX need a way to place images / templates into these... % XXX need a way to place images / templates into these...
% XXX should these only be visible in respective modes or for non-zero widths??? % XXX should these only be visible in respective modes or for non-zero widths???
@ -968,7 +968,7 @@
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%%%%% Cell environments %%%%% Cells
% %
%% A cell environments is a box of specified size placed at a specific %% A cell environments is a box of specified size placed at a specific
%% location in a page. %% location in a page.
@ -1009,16 +1009,22 @@
%% \DescribeEnv{pagecell} %% \DescribeEnv{pagecell}
% %
%% Page cell.
%%
%% This corresponds to the visible page and does not include bleeds.
%%
%% \begin{minipage}{\textwidth} %% \begin{minipage}{\textwidth}
%% \begin{verbatim} %% \begin{verbatim}
%% %%
%% +---------------+ %% + - - - - - - - - - +
%% | | %% . +---------------+ .
%% | | %% . | | .
%% | pagecell | %% . | | .
%% | | %% . | pagecell | .
%% | | %% . | | .
%% +---------------+ %% . | | .
%% . +---------------+ .
%% + - - - - - - - - - +
%% %%
%% \end{verbatim} %% \end{verbatim}
%% \end{minipage} %% \end{minipage}
@ -1030,6 +1036,77 @@
\end{cell} } \end{cell} }
%% \DescribeEnv{pagebleedcell}
%
%% Like |page| but includes bleeds.
%%
%% \begin{minipage}{\textwidth}
%% \begin{verbatim}
%%
%% +-------------------+
%% | + - - - - - - - + |
%% | . . |
%% | . . |
%% | . pagebleedcell . |
%% | . . |
%% | . . |
%% | + - - - - - - - + |
%% +-------------------+
%%
%% \end{verbatim}
%% \end{minipage}
%%
% XXX
\newenvironment{pagebleedcell}{%
\begin{cell}{0mm, 0mm}{\bleedblockwidth}{\bleedblockheight}%
}{%
\end{cell} }
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%%%%% Cell macros
%
%% Cell macros require a cell environment to function correctly.
%%
%% \DescribeMacro{\fitimagetocell\{..\}}
%
%% Fit an image to cell (centered).
%
%% >> \fitimagetocell[<clearence>]{<caption>}{<image>}
%
%% Image position can be tweaked via |\vspace{..}| or |\hspace{..}|
%%
% XXX caption is not supported yet...
\newcommand\fitimagetocell[3][0mm]{
\sbox{\photobook@imagebox}{
\includegraphics[
keepaspectratio,
width=\dimexpr \cellwidth - ((#1) * 2) \relax,
height=\dimexpr \cellheight - ((#1) * 2) \relax]{#3} }%
\vspace{\dimexpr
+0.5\cellheight
-0.5\ht\photobook@imagebox \relax}%
\hspace{\dimexpr
+0.5\cellwidth
-0.5\wd\photobook@imagebox \relax}{%
\usebox\photobook@imagebox}%
\linebreak%
% caption...
\ifx #2 \empty \else%
% XXX need keep under corner of image if image is less than X and
% at Ymm from page edge if it's larger...
% min( \wd\photobook@imagebox, \cellwidth )
% ...or should we account for \textwidth???
\begin{minipage}{\cellwidth}%
\begin{flushright}%
\captionsize #2
\end{flushright}%
\end{minipage}%
\fi }
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%%%%% Endpaper cells %%%%% Endpaper cells
% %
@ -1536,37 +1613,45 @@
%% \end{verbatim} %% \end{verbatim}
%% \end{minipage} %% \end{minipage}
%% %%
% XXX EXPERIMENTAL
% XXX add caption support...
\newcommand\imagepagefit[3][\clearimage]{ \newcommand\imagepagefit[3][\clearimage]{
\sbox{\photobook@imagebox}{
\includegraphics[
keepaspectratio,
width=\dimexpr \blockwidth - ((#1) * 2) \relax,
height=\dimexpr \blockheight - ((#1) * 2) \relax]{#3} }
%\clearpage
\null \null
% XXX misaligned... \begin{pagecell}%
\captionboxright{\photobook@imagebox}{#2}% \fitimagetocell[#1]{#2}{#3}
\ShipoutPicture{% \end{pagecell}
%\AtPageCenter{% \clearpage }
% XXX this for some reason not at -\bleed horizontally...
\AtPageLowerLeft{% %\newcommand\imagepagefit[3][\clearimage]{
\hspace*{\dimexpr % \sbox{\photobook@imagebox}{
% XXX when \AtPageCenter{ .. }for some reason -\bleed puts % \includegraphics[
% the image in the center but adding -0.5\ht\photobook@imagebox % keepaspectratio,
% to it offsets the image to the left -- scaling????!! % width=\dimexpr \blockwidth - ((#1) * 2) \relax,
%-\bleed % height=\dimexpr \blockheight - ((#1) * 2) \relax]{#3} }
+0.5\OFFSETFIX % %\clearpage
+0.5\blockwidth % \null
-0.5\wd\photobook@imagebox % % XXX misaligned...
+\bleed % \captionboxright{\photobook@imagebox}{#2}%
\relax}{ % \ShipoutPicture{%
\raisebox{\dimexpr % %\AtPageCenter{%
+0.5\blockheight % % XXX this for some reason not at -\bleed horizontally...
-0.5\ht\photobook@imagebox % \AtPageLowerLeft{%
+\bleed % \hspace*{\dimexpr
\relax}{ % % XXX when \AtPageCenter{ .. }for some reason -\bleed puts
\usebox\photobook@imagebox } } } } % % the image in the center but adding -0.5\ht\photobook@imagebox
\newpage } % % to it offsets the image to the left -- scaling????!!
% %-\bleed
% +0.5\blockwidth
% -0.5\wd\photobook@imagebox
% +\bleed
% \relax}{%
% \raisebox{\dimexpr
% +0.5\blockheight
% -0.5\ht\photobook@imagebox
% +\bleed
% \relax}{%
% \usebox\photobook@imagebox } } } }
% \newpage }
% XXX does not work... % XXX does not work...
@ -1602,6 +1687,7 @@
\sbox{\photobook@imagebox}{ \sbox{\photobook@imagebox}{
\includegraphics[ \includegraphics[
keepaspectratio, keepaspectratio,
%width=\dimexpr \blockwidth - ((#1) * 2) \relax,
width=\dimexpr \blockwidth - ((#1) * 2) \relax, width=\dimexpr \blockwidth - ((#1) * 2) \relax,
% XXX make this use the minumum dimention and not width... % XXX make this use the minumum dimention and not width...
%height=\dimexpr \blockheight - ((#1) * 2) \relax %height=\dimexpr \blockheight - ((#1) * 2) \relax
@ -1614,12 +1700,12 @@
+0.5\blockwidth +0.5\blockwidth
-0.5\wd\photobook@imagebox -0.5\wd\photobook@imagebox
-\bleed -\bleed
-0.5\OFFSETFIX %-0.5\OFFSETFIX
\relax}{ \relax}{%
\raisebox{\dimexpr \raisebox{\dimexpr
(#1) (#1)
+\clearimage +\clearimage
+\bleed \relax}{ +\bleed \relax}{%
\usebox\photobook@imagebox } } } } \usebox\photobook@imagebox } } } }
\newpage } \newpage }
@ -2018,7 +2104,7 @@
% left page... % left page...
% XXX BUG: this in some cases creates an extra empty spread before this... % XXX BUG: this in some cases creates an extra empty spread before this...
% ...appears to be a problem where we have a tweak.tex % ...appears to be a problem where we have a tweak.tex
%\cleartoleftpage \cleartoleftpage
\null \null
\ShipoutPicture{ \ShipoutPicture{
\AtPageLowerLeft{ \AtPageLowerLeft{
@ -2091,7 +2177,7 @@
keepaspectratio, keepaspectratio,
height=\dimexpr \blockheight - ((#1) * 2) + \vgrowimageby \relax]{#3} } height=\dimexpr \blockheight - ((#1) * 2) + \vgrowimageby \relax]{#3} }
% left page... % left page...
%\cleartoleftpage \cleartoleftpage
\null \null
\captionboxleft[\blockwidth]{\photobook@imagebox}{#2} \captionboxleft[\blockwidth]{\photobook@imagebox}{#2}
\ShipoutPicture{ \ShipoutPicture{