cleanup and fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-08-29 03:01:01 +03:00
parent 7f0e085f2e
commit f7eb1399e6
2 changed files with 219 additions and 194 deletions

View File

@ -390,7 +390,6 @@
\LoadClass[9pt, final, openany]{book} \LoadClass[9pt, final, openany]{book}
%---------------------------------------------------------------------- %----------------------------------------------------------------------
% Packages... % Packages...
% %
@ -954,16 +953,61 @@
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%%%%% Cells %%%%% Cells
% %
%% A cell environments is a box of specified size placed at a specific %% A cell environment is a box of specified size.
%% location in a page.
%% %%
%% Cells are implemented via |textpos|'s |textblock*| environment. %% Cells can be both placed inline relative to other content or in an
%% absolute location.
%% %%
%% A cell defines |\cellwidth| and |\cellheight| within it's body that %% Note that absolute cells are placed relative to the page and currently
%% store the initial cell dimentions. %% can not be placed relative to other absolute cells (this might change
%% in the future).
%%
%% \DescribeMacro{\cellwidth=<len>}
%% \DescribeMacro{\cellheight=<len>}
%% \DescribeMacro{\cellparentwidth=<len>}
%% \DescribeMacro{\cellparentheight=<len>}
%% \DescribeMacro{\celloffsettop=<len>}
%% \DescribeMacro{\celloffsetleft=<len>}
%%
%% A cell defines a set of contextual lengths:
%%
%% \begin{minipage}{\textwidth}
%% \begin{verbatim}
%%
%% <--> celloffsetleft
%% . <--------------> cellwidth
%% <----------------------> cellparentwidth
%% . . . .
%% +----------------------+ . . . . . . .
%% | . . | ^ ^ celloffsettop
%% | . . | | |
%% | +--------------+ . | . . | . . . v
%% | | | | | ^
%% | | | | | | cellheight
%% | | cell | | | |
%% | | | | | |
%% | | | | | |
%% | +--------------+ . | . . | . v
%% | | |
%% | | | cellparentheight
%% +----------------------+ . . v
%%
%% \end{verbatim}
%% \end{minipage}
%%
%% For absolutely positioned cells these define the cell offset from
%% parent.
%%
%% The bare page can be reasonably be treated as a cell.
%%
%% Initally, outside of any cells |\cellwidth|, |\cellparentwidth| and
%% |\cellheight|, |\cellparentheight| are equal to |\paperwidth| and
%% |\paperheight| respectively, and |\celloffsettop| and |\celloffsetleft|
%% are set to |0pt|.
%%
%% Changing these is not recommended, it likely will not affect the
%% current cell but can mess up nested cells.
%% %%
% XXX should we treat the root page as a cell???
\newlength\cellparentwidth \newlength\cellparentwidth
\setlength\cellparentwidth{\paperwidth} \setlength\cellparentwidth{\paperwidth}
@ -997,10 +1041,14 @@
% XXX % XXX
\newenvironment{inlinecell}[3][t]{% \newenvironment{inlinecell}[3][t]{%
\begingroup% \begingroup%
% get args by value...
\edef\photobook@protect@w{\the\dimexpr #2 \relax}%
\edef\photobook@protect@h{\the\dimexpr #3 \relax}%
%
\setlength\cellparentwidth{\cellwidth}% \setlength\cellparentwidth{\cellwidth}%
\setlength\cellparentheight{\cellheight}% \setlength\cellparentheight{\cellheight}%
\setlength\cellwidth{\dimexpr #2 \relax}% \setlength\cellwidth{\photobook@protect@w}%
\setlength\cellheight{\dimexpr #3 \relax}% \setlength\cellheight{\photobook@protect@h}%
\setlength\celloffsettop{0pt}% \setlength\celloffsettop{0pt}%
\setlength\celloffsetleft{0pt}% \setlength\celloffsetleft{0pt}%
% %
@ -1020,18 +1068,21 @@
%% %%
% XXX test % XXX test
% XXX EXPERIMENTAL % XXX EXPERIMENTAL
\NewEnviron{vinlinecell}[2][t]{% \newenvironment{vinlinecell}[3][t]{%
\begingroup% \begingroup%
% get args by value...
\edef\photobook@protect@w{\the\dimexpr #2 \relax}
\edef\photobook@protect@h{\the\dimexpr #3 \relax}
% NOTE: these are needed to let inlinecell setup parent dimension % NOTE: these are needed to let inlinecell setup parent dimension
% relative to cell orientation... % relative to cell orientation...
\setlength\cellwidth{#3}% \setlength\cellwidth{\photobook@protect@h}%
\setlength\cellheight{#2}% \setlength\cellheight{\photobook@protect@w}%
% %
\rotatebox{90}{% \begin{turn}{90}%
\begin{inlinecell}[#1]{#3}{#2}% \begin{inlinecell}[#1]{#3}{#2}%
\ignorespaces% }{%
\BODY% \end{inlinecell}%
\end{inlinecell}}% \end{turn}%
\endgroup} \endgroup}
@ -1170,20 +1221,22 @@
% %
%% %%
% XXX EXPERIMENTAL % XXX EXPERIMENTAL
\NewEnviron{topdown}{% \newenvironment{topdown}[1][t]{%
\begin{flushright}% \begin{flushright}%
\rotatebox{270}{% \begin{turn}{270}%
\begin{inlinecell}{\cellheight}{\cellwidth}% \begin{inlinecell}[#1]{\cellheight}{\cellwidth}%
\BODY% }{%
\end{inlinecell}} \end{inlinecell}%
\end{turn}
\end{flushright}} \end{flushright}}
% XXX EXPERIMENTAL % XXX EXPERIMENTAL
\NewEnviron{bottomup}{% \newenvironment{bottomup}[1][t]{%
\rotatebox{90}{% \begin{turn}{90}%
\begin{inlinecell}{\cellheight}{\cellwidth}% \begin{inlinecell}[#1]{\cellheight}{\cellwidth}%
\BODY% }{%
\end{inlinecell}}} \end{inlinecell}%
\end{turn}}
%% \DescribeEnv{cliptocell} %% \DescribeEnv{cliptocell}
@ -1595,14 +1648,14 @@
% helpers... % helpers...
% XXX set minipage height to available cell height... % XXX set minipage height to available cell height...
\renewcommand\photobook@captioncell@formatTopAlign[1]{% \newcommand\photobook@captioncell@formatTopAlign[1]{%
% XXX for some reason without this things are misaligned... % XXX for some reason without this things are misaligned...
\vspace{0pt}% \vspace{0pt}%
\begin{\photobook@captioncell@align}% \begin{\photobook@captioncell@align}%
#1% #1%
\end{\photobook@captioncell@align}} \end{\photobook@captioncell@align}}
% XXX set minipage height to available cell height... % XXX set minipage height to available cell height...
\renewcommand\photobook@captioncell@formatBottomAlign[1]{% \newcommand\photobook@captioncell@formatBottomAlign[1]{%
\begin{minipage}[t][\cellheight][b]{\cellwidth}% \begin{minipage}[t][\cellheight][b]{\cellwidth}%
\begin{\photobook@captioncell@align}% \begin{\photobook@captioncell@align}%
#1% #1%
@ -1678,6 +1731,18 @@
%% See samples for better illustration. %% See samples for better illustration.
%% %%
% helper... % helper...
\newif\ifphotobook@vcaptioncell@bottomup
\photobook@vcaptioncell@bottomuptrue
% bottomup / topdown...
\def\photobook@vcaptioncell@orientation{bottomup}
\define@boolkey{vcaptioncell@args}{bottomup}[true]{%
\photobook@vcaptioncell@bottomuptrue
\def\photobook@vcaptioncell@orientation{bottomup}}
\define@boolkey{vcaptioncell@args}{topdown}[true]{%
\photobook@vcaptioncell@bottomupfalse
\def\photobook@vcaptioncell@orientation{topdown}}
\def\photobook@vcaptioncell@nested#1{% \def\photobook@vcaptioncell@nested#1{%
\captioncell[% \captioncell[%
\photobook@vcaptioncell@position, \photobook@vcaptioncell@position,
@ -1712,16 +1777,6 @@
under% under%
\else% \else%
over\fi}} over\fi}}
% bottomup / topdown...
\newif\ifphotobook@vcaptioncell@bottomup
\photobook@vcaptioncell@bottomuptrue
\def\photobook@vcaptioncell@orientation{bottomup}
\define@boolkey{vcaptioncell@args}{bottomup}[true]{%
\photobook@vcaptioncell@bottomuptrue
\def\photobook@vcaptioncell@orientation{bottomup}}
\define@boolkey{vcaptioncell@args}{topdown}[true]{%
\photobook@vcaptioncell@bottomupfalse
\def\photobook@vcaptioncell@orientation{topdown}}
% align... % align...
\def\photobook@vcaptioncell@align{} \def\photobook@vcaptioncell@align{}
% XXX for some reason \define@choicekey{..} does not expand macros... % XXX for some reason \define@choicekey{..} does not expand macros...
@ -1975,19 +2030,17 @@
% XXX for some reason naming this anything starting with endpaper will % XXX for some reason naming this anything starting with endpaper will
% make LaTeX complain that that is already defined... % make LaTeX complain that that is already defined...
\NewEnviron{leftside}{% \newenvironment{leftside}{%
\ifendpaperlayout%
\begin{pagecell}% \begin{pagecell}%
\BODY% }{%
\end{pagecell} \fi } \end{pagecell}}
\NewEnviron{rightside}{% \newenvironment{rightside}{%
\ifendpaperlayout%
\begin{cell}% \begin{cell}%
{\bleed + \pageblockwidth, \bleed}% {\bleed + \pageblockwidth, \bleed}%
{\pageblockwidth}{\pageblockheight}% {\pageblockwidth}{\pageblockheight}%
\BODY% }{%
\end{cell} \fi } \end{cell}}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2022,8 +2075,7 @@
%% \end{verbatim} %% \end{verbatim}
%% \end{minipage} %% \end{minipage}
%% %%
\NewEnviron{frontcover}{% \newenvironment{frontcover}{%
\ifcoverlikelayout%
\begin{cell}{ \begin{cell}{
\bleed \bleed
+ \jacketflapback + \jacketflapback
@ -2037,11 +2089,10 @@
+ \coverflap }% + \coverflap }%
{ \pageblockwidth + \coverboardgrow }% { \pageblockwidth + \coverboardgrow }%
{ \pageblockheight + 2\coverboardgrow }% { \pageblockheight + 2\coverboardgrow }%
\BODY% }{%
\end{cell} \fi } \end{cell}}
\NewEnviron{backcover}{% \newenvironment{backcover}{%
\ifcoverlikelayout%
\begin{cell}{ \begin{cell}{
\bleed \bleed
+ \jacketflapback + \jacketflapback
@ -2051,14 +2102,13 @@
+ \coverflap }% + \coverflap }%
{ \pageblockwidth + \coverboardgrow }% { \pageblockwidth + \coverboardgrow }%
{ \pageblockheight + 2\coverboardgrow }% { \pageblockheight + 2\coverboardgrow }%
\BODY% }{%
\end{cell} \fi } \end{cell}}
% spines... % spines...
% %
\NewEnviron{spine}{% \newenvironment{spine}{%
\ifcoverlikelayout
\begin{cell}{ \begin{cell}{
\bleed \bleed
+ \jacketflapback + \jacketflapback
@ -2070,36 +2120,23 @@
\bleed \bleed
+ \coverflap }% + \coverflap }%
{ \spinewidth }% { \spinewidth }%
{ \pageblockheight + 2\coverboardgrow } { \pageblockheight + 2\coverboardgrow }%
\BODY% }{%
\end{cell} \fi } \end{cell}}
\NewEnviron{vspine}[1][270]{% \newenvironment{vspine}[1][topdown]{%
\ifcoverlikelayout \def\photobook@vspine@orientation{#1}%
\begin{cell}{ %
\bleed \begin{spine}%
+ \jacketflapback \begin{\photobook@vspine@orientation}%
+ \coverflap }{%
+ \jacketwrap \end{\photobook@vspine@orientation}%
+ \coverboardgrow \end{spine}}
+ \pageblockwidth
+ \spinefold,
\bleed
+ \coverflap }%
{ \spinewidth }%
{ \pageblockheight + 2\coverboardgrow }
\begin{turn}{#1}%
\begin{minipage}[t][\cellwidth][t]{\cellheight}%
\BODY%
\end{minipage}%
\end{turn}%
\end{cell} \fi }
% jackets flaps... % jackets flaps...
% %
\NewEnviron{frontflap}{% \newenvironment{frontflap}{%
\ifjacketlayout
\begin{cell}{ \begin{cell}{
\bleed \bleed
+ \jacketflapback + \jacketflapback
@ -2112,19 +2149,18 @@
+ \coverflap }% + \coverflap }%
{ \jacketflapfront }% { \jacketflapfront }%
{ \pageblockheight + 2\coverboardgrow }% { \pageblockheight + 2\coverboardgrow }%
\BODY% }{%
\end{cell} \fi } \end{cell}}
\NewEnviron{backflap}{% \newenvironment{backflap}{%
\ifjacketlayout
\begin{cell}{ \begin{cell}{
\bleed, \bleed,
\bleed \bleed
+ \coverflap }% + \coverflap }%
{ \jacketflapback }% { \jacketflapback }%
{ \pageblockheight + 2\coverboardgrow }% { \pageblockheight + 2\coverboardgrow }%
\BODY% }{%
\end{cell} \fi } \end{cell}}
@ -2899,10 +2935,11 @@
% XXX this seems to be bigger than the size given... % XXX this seems to be bigger than the size given...
%\fbox{\parbox[t][\cellheight][t]{\cellwidth}{% %\fbox{\parbox[t][\cellheight][t]{\cellwidth}{%
\begin{center} \begin{center}
\vfill \vfill%
#2 \\ #2 \\
(\lenprint[#1]{\cellwidth} \space x \lenprint[#1]{\cellheight}) (\lenprint[#1]{\cellwidth} \space x \lenprint[#1]{\cellheight})
\vfill \vfill%
\vspace{0pt}%
\end{center}} \end{center}}
%\end{center} }} } %\end{center} }} }
@ -2929,29 +2966,30 @@
\begin{page} \begin{page}
\setlength{\parindent}{0em} \setlength{\parindent}{0em}
% NOTE: only the relevant blocks will be visible... % NOTE: only the relevant blocks will be visible...
\ifendpaperlayout%
\begin{leftside} \begin{leftside}
\photobook@TemplateCell[#1]{ENDPAPER LEFT} \photobook@TemplateCell[#1]{ENDPAPER LEFT}
\end{leftside} \end{leftside}
\begin{rightside} \begin{rightside}
\photobook@TemplateCell[#1]{ENDPAPER RIGHT} \photobook@TemplateCell[#1]{ENDPAPER RIGHT}
\end{rightside} \end{rightside}\fi%
\ifcoverlikelayout%
\begin{frontcover} \begin{frontcover}
\photobook@TemplateCell[#1]{FRONT COVER} \photobook@TemplateCell[#1]{FRONT COVER}
\end{frontcover} \end{frontcover}
%\begin{vspine}[90] \begin{vspine}%
%\begin{vspine}[down] \photobook@TemplateCell[#1]{SPINE}%
\begin{vspine}
\photobook@TemplateCell[#1]{SPINE}
\end{vspine} \end{vspine}
\begin{backcover} \begin{backcover}
\photobook@TemplateCell[#1]{BACK COVER} \photobook@TemplateCell[#1]{BACK COVER}
\end{backcover} \end{backcover}\fi%
\begin{frontflap} \ifjacketlayout%
\photobook@TemplateCell[#1]{FRONT FLAP} \begin{frontflap}%
\photobook@TemplateCell[#1]{FRONT FLAP}%
\end{frontflap} \end{frontflap}
\begin{backflap} \begin{backflap}%
\photobook@TemplateCell[#1]{BACK FLAP} \photobook@TemplateCell[#1]{BACK FLAP}
\end{backflap} \end{backflap}\fi%
\end{page} } \end{page} }

View File

@ -14,35 +14,22 @@
]{photobook} ]{photobook}
\newlength\spacewidth
\newsavebox\spacebox
\newcommand\calcspacewidth{%
\sbox{\spacebox}{ }%
\setlength\spacewidth{\wd\spacebox}}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{document} \begin{document}
%\TPoptions{showboxes=true} \fbox{
\begin{inlinecell}{80mm}{40mm}
\lenprint[mm]{\cellwidth} x \lenprint[mm]{\cellheight}
\end{inlinecell}}
\newline
\fbox{
\begin{inlinecell}{80mm}{40mm}
\begin{bottomup}
\lenprint[mm]{\cellwidth} x \lenprint[mm]{\cellheight}
\end{bottomup}
\end{inlinecell}}
\calcspacewidth
Space width: \the\spacewidth
\null
\newpage
\def\imageblockwidth{1}
\def\imageblockheight{1}
\imagepage{Caption}{DSC00403-2}
\imagepage{Caption}{DSC00403-2}
\imagepage{Caption}{DSC00403-2vert}
%\imagepage{Caption}{DSC00403-2}
%\imagepage{}{DSC00403-2vert}
\end{document} \end{document}