extended \cliptocell env to optionaly include bleeds...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-04-19 21:01:24 +03:00
parent d39f1d473a
commit e85e579fca
3 changed files with 92 additions and 43 deletions

View File

@ -0,0 +1,30 @@
%----------------------------------------------------------------------
\documentclass[
layoutmode=cover,
spinewidth=20mm,
spinefold=7mm,
coverboardgrow=3mm,
coverflap=17mm,
% page size...
blockwidth=240mm, blockheight=220mm,
bleed=4mm,
bindingoffset=5mm,
% image block configuration...
imageblockwidth=0.98, imageblockheight=0.98,
imageblockoffsettop=-0.1,
% misc...
9pt,final,openany
]{photobook}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{document}
\GenerateTemplate
\end{document}
%----------------------------------------------------------------------
% vim:set ts=4 sw=4 :

View File

@ -21,7 +21,29 @@
\begin{document} \begin{document}
\GenerateTemplate \begin{page}
\begin{frontcover}
\begin{cliptocell}[0mm \coverflap]
\imagecell[fill, clearance=-\coverflap]{}{DSC00403-2}
\end{cliptocell}
\end{frontcover}
\begin{backcover}
\begin{cliptocell}
\imagecell[fill]{}{DSC00403-2}
\end{cliptocell}
\end{backcover}
\begin{spine}
\begin{cliptocell}
\imagecell[fill]{}{DSC00403-2}
\end{cliptocell}
\end{spine}
\begin{frontflap}
Some text
\end{frontflap}
\begin{backflap}
Some text
\end{backflap}
\end{page}
\end{document} \end{document}

View File

@ -38,16 +38,6 @@
% %
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% %
% XXX ASAP add options to cliptocell (or a separate env) to clip to
% bleeds/borders...
% \cliptocell[top left bottom right]{..}
% \cliptocell[0mm 10mm 0mm 10mm]{..}
% \cliptocell[5mm]{..}
% \cliptocell[5mm 10mm]{..}
% ...
% ...semantics similar to CSS margins...
% ...content should be aligned to the parent cell's position and
% not the clipping box...
% 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...
@ -89,7 +79,7 @@
%%% 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.18} \edef\photobook@FILEVERSION{v0.1.19}
\edef\photobook@FILEDATE{2023-04-11} \edef\photobook@FILEDATE{2023-04-11}
@ -1976,76 +1966,83 @@
% %
%% Clip content to parent cell. %% Clip content to parent cell.
%% %%
% clipbox args: l t w h %% >> \begin{cliptocell} ... \end{cliptocell}
\newenvironment{cliptocell}{% %%
\begin{clipbox*}{0cm {\height - \cellheight} {\cellwidth} {\height}}% %% Clip content to cell adding bleeds
\begin{minipage}[t][\cellheight][t]{\cellwidth}% %%
\ignorespaces% %% >> \begin{cliptocell}[<size>] ... \end{cliptocell}
}{% %% >> \begin{cliptocell}[<horizontal> <vertical>] ... \end{cliptocell}
\end{minipage}% %% >> \begin{cliptocell}[<left> <bottom> <right> <top>] ... \end{cliptocell}
\end{clipbox*}} %%
%\newenvironment{cliptocell}{%
% \begin{clipbox*}{0cm {\height - \cellheight} {\cellwidth} {\height}}%
% \begin{minipage}[t][\cellheight][t]{\cellwidth}%
% \ignorespaces%
%}{%
% \end{minipage}%
% \end{clipbox*}}
% XXX TEST...
% XXX merge with cliptocell...
\newlength\photobook@cliptocell@left \newlength\photobook@cliptocell@left
\setlength\photobook@cliptocell@left{0mm}%
\newlength\photobook@cliptocell@top \newlength\photobook@cliptocell@top
\setlength\photobook@cliptocell@top{0mm}%
\newlength\photobook@cliptocell@right \newlength\photobook@cliptocell@right
\setlength\photobook@cliptocell@right{0mm}%
\newlength\photobook@cliptocell@bottom \newlength\photobook@cliptocell@bottom
\setlength\photobook@cliptocell@bottom{0mm}%
\newenvironment{cliptocell*}[1][0pt]{% \newenvironment{cliptocell}[1][0mm]{%
\begingroup% \begingroup%
\setsepchar{ }% \setsepchar{ }%
\readlist*\photobook@cliptocell@bleeds{#1}% \readlist*\photobook@cliptocell@bleeds{#1}%
% %
\ifnum \photobook@cliptocell@bleedslen = 0%
\setlength\photobook@cliptocell@left{0pt}%
\setlength\photobook@cliptocell@top{0pt}%
\setlength\photobook@cliptocell@right{0pt}%
\setlength\photobook@cliptocell@bottom{0pt}\fi%
% bleed % bleed
\ifnum \photobook@cliptocell@bleedslen = 1% \ifnum \photobook@cliptocell@bleedslen = 1%
\setlength\photobook@cliptocell@left{% \setlength\photobook@cliptocell@left{%
\photobook@cliptocell@bleeds[1]}% \photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@top{% \setlength\photobook@cliptocell@bottom{%
\photobook@cliptocell@bleeds[1]}% \photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@right{% \setlength\photobook@cliptocell@right{%
\photobook@cliptocell@bleeds[1]}% \photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@bottom{% \setlength\photobook@cliptocell@top{%
\photobook@cliptocell@bleeds[1]}\fi% \photobook@cliptocell@bleeds[1]}\fi%
% horizontal vertical % horizontal vertical
\ifnum \photobook@cliptocell@bleedslen = 2% \ifnum \photobook@cliptocell@bleedslen = 2%
\setlength\photobook@cliptocell@left{% \setlength\photobook@cliptocell@left{%
\photobook@cliptocell@bleeds[1]}% \photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@top{% \setlength\photobook@cliptocell@bottom{%
\photobook@cliptocell@bleeds[2]}% \photobook@cliptocell@bleeds[2]}%
\setlength\photobook@cliptocell@right{% \setlength\photobook@cliptocell@right{%
\photobook@cliptocell@bleeds[1]}% \photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@bottom{% \setlength\photobook@cliptocell@top{%
\photobook@cliptocell@bleeds[2]}\fi% \photobook@cliptocell@bleeds[2]}\fi%
% left top right bottom % left top right bottom
\ifnum \photobook@cliptocell@bleedslen = 4% \ifnum \photobook@cliptocell@bleedslen = 4%
\setlength\photobook@cliptocell@left{% \setlength\photobook@cliptocell@left{%
\photobook@cliptocell@bleeds[1]}% \photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@top{%
\photobook@cliptocell@bleeds[2]}%
\setlength\photobook@cliptocell@bottom{% \setlength\photobook@cliptocell@bottom{%
\photobook@cliptocell@bleeds[3]}% \photobook@cliptocell@bleeds[2]}%
\setlength\photobook@cliptocell@right{% \setlength\photobook@cliptocell@right{%
\photobook@cliptocell@bleeds[3]}%
\setlength\photobook@cliptocell@top{%
\photobook@cliptocell@bleeds[4]}\fi% \photobook@cliptocell@bleeds[4]}\fi%
% %
\begin{clipbox*}{% % XXX the spaces at the end of each line here are significant...
{0cm - \photobook@cliptocell@left}% \begin{trimbox}{{\photobook@cliptocell@left} %
{\height - \cellheight - \photobook@cliptocell@top}% {\photobook@cliptocell@bottom} %
{\cellwidth + \photobook@cliptocell@left + \photobook@cliptocell@right}% {\photobook@cliptocell@right} %
{\height + \photobook@cliptocell@top + \photobook@cliptocell@bottom}}% {\photobook@cliptocell@top}}%
\begin{marginbox}{#1}% \begin{clipbox*}{{-\photobook@cliptocell@left} %
{\height - \cellheight - \photobook@cliptocell@bottom} %
{\cellwidth + \photobook@cliptocell@right} %
{\height + \photobook@cliptocell@top} %
}%
\begin{minipage}[t][\cellheight][t]{\cellwidth}% \begin{minipage}[t][\cellheight][t]{\cellwidth}%
\ignorespaces% \ignorespaces%
}{% }{%
\end{minipage}% \end{minipage}%
\end{marginbox}%
\end{clipbox*}% \end{clipbox*}%
\end{trimbox}%
\endgroup} \endgroup}