lots of tweaks + docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-08-12 16:48:00 +03:00
parent 8b0a0365fb
commit 18454aa0bb

View File

@ -378,6 +378,18 @@
\DeclareBoolOption{geometrynodefaults} \DeclareBoolOption{geometrynodefaults}
%% \DescribeMacro{roundprintedlengthsto=<num>}
%
%% Number of digits to round printed lengths to (default: 1).
%%
%% This is a shorthand to |numprint|'s |\nprounddigits{..}|, us it to
%% change values mid-document if needed.
%%
%% This is mostly used for |\GenerateTemplate|.
%%
\DeclareStringOption[1]{roundprintedlengthsto}[1]
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{book}} \DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessKeyvalOptions* \ProcessKeyvalOptions*
@ -407,6 +419,7 @@
%\RequirePackage{pdfcomment} %\RequirePackage{pdfcomment}
\RequirePackage{eso-pic} \RequirePackage{eso-pic}
\RequirePackage{environ} \RequirePackage{environ}
\RequirePackage{numprint}
\RequirePackage{xcolor} \RequirePackage{xcolor}
\RequirePackage{colorspace} \RequirePackage{colorspace}
\RequirePackage{graphicx} \RequirePackage{graphicx}
@ -702,7 +715,9 @@
\relax} \relax}
\setlength\bleedblockheight{\dimexpr \setlength\bleedblockheight{\dimexpr
2\bleed + \blockheight 2\bleed + \blockheight
\relax} } \relax}
% misc...
\nprounddigits{\photobook@roundprintedlengthsto} }
%% \DescribeMacro{\ResetPage} %% \DescribeMacro{\ResetPage}
@ -936,12 +951,6 @@
% 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???
% within a block/cell env these store the cell width and height...
\newlength\cellwidth
\newlength\cellheight
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%%%%% Generic %%%%% Generic
@ -959,16 +968,24 @@
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Covers, Jackets and endpapers...
%
%%%%% Cell environments %%%%% Cell environments
% %
%% A cell environments is designed to place a cell/box at a specific %% A cell environments is a box of specified size placed at a specific
%% location in a page. %% location in a page.
%%
%% Cells are implemented via |textpos|'s |textblock*| environment.
%%
%% A cell defines |\cellwidth| and |\cellheight| within it's body that
%% store the initial cell dimentions.
%%
\newlength\cellwidth
\newlength\cellheight
%% \DescribeEnv{cell} %% \DescribeEnv{cell}
% %
%% Create a basic cell.
%
%% >> \begin{cell}{<top>, <left>}{<width>}{<height>} ... %% >> \begin{cell}{<top>, <left>}{<width>}{<height>} ...
% %
% XXX EXPERIMENTAL... % XXX EXPERIMENTAL...
@ -1165,47 +1182,66 @@
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%%%%% Cell helper macros
\newcommand\photobook@TemplateCell[1]{
% XXX should digits/rounding be configurable???
\newcommand\photobook@TemplateCell[2][mm]{
% 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
#1 \\ #2 \\
(\the\cellwidth \space x \the\cellheight) (\lenprint[#1]{\cellwidth} \space x \lenprint[#1]{\cellheight})
\vfill \vfill
\end{center} } \end{center} }
%\end{center} }} } %\end{center} }} }
\newcommand\GenerateTemplate{ %% \DescribeMacro{\GenerateTemplate\{..\}}
%
%% Generate template page for current |layoutmode|.
%
%% >> \GenerateTemplate
%
%% Cell size can be printed in |mm| (default) or in any explicit unit
%% supported by \LaTeX.
%
%% >> \GenerateTemplate{<unit>}
%
%% This can be useful if one needs to make the cover/jacket/... in either a
%% different software package or by hand.
%%
%% This is a no-op for |layoutmode=block|.
%%
\newcommand\GenerateTemplate[1][mm]{
% XXX undo this after... % XXX undo this after...
\TPoptions{showboxes=true} \TPoptions{showboxes=true}
\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...
\begin{leftside} \begin{leftside}
\photobook@TemplateCell{ENDPAPER LEFT} \photobook@TemplateCell[#1]{ENDPAPER LEFT}
\end{leftside} \end{leftside}
\begin{rightside} \begin{rightside}
\photobook@TemplateCell{ENDPAPER RIGHT} \photobook@TemplateCell[#1]{ENDPAPER RIGHT}
\end{rightside} \end{rightside}
\begin{frontcover} \begin{frontcover}
\photobook@TemplateCell{FRONT COVER} \photobook@TemplateCell[#1]{FRONT COVER}
\end{frontcover} \end{frontcover}
%\begin{vspine}[90] %\begin{vspine}[90]
%\begin{vspine}[down] %\begin{vspine}[down]
\begin{vspine} \begin{vspine}
\photobook@TemplateCell{SPINE} \photobook@TemplateCell[#1]{SPINE}
\end{vspine} \end{vspine}
\begin{backcover} \begin{backcover}
\photobook@TemplateCell{BACK COVER} \photobook@TemplateCell[#1]{BACK COVER}
\end{backcover} \end{backcover}
\begin{frontflap} \begin{frontflap}
\photobook@TemplateCell{FRONT FLAP} \photobook@TemplateCell[#1]{FRONT FLAP}
\end{frontflap} \end{frontflap}
\begin{backflap} \begin{backflap}
\photobook@TemplateCell{BACK FLAP} \photobook@TemplateCell[#1]{BACK FLAP}
\end{backflap} \end{backflap}
\end{page} } \end{page} }
@ -2110,7 +2146,7 @@
%---------------------------------------------------------------------- %----------------------------------------------------------------------
%5%% XXX DEBUG... %%% XXX DEBUG...
%%%\AtBeginDocument{ %%%\AtBeginDocument{
%%%} %%%}