diff options
author | Norbert Preining <norbert@preining.info> | 2023-06-27 03:00:56 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-06-27 03:00:56 +0000 |
commit | a0b68c12d9e67182560eb31f202f3e86f0e4a5de (patch) | |
tree | 5d0d249a669c45205fc467d62bd18d5edb2ae3ae /macros/latex/contrib/photobook/photobook.cls | |
parent | a2ebe77da32f4499676953174f774795b0d054fb (diff) |
CTAN sync 202306270300
Diffstat (limited to 'macros/latex/contrib/photobook/photobook.cls')
-rw-r--r-- | macros/latex/contrib/photobook/photobook.cls | 206 |
1 files changed, 176 insertions, 30 deletions
diff --git a/macros/latex/contrib/photobook/photobook.cls b/macros/latex/contrib/photobook/photobook.cls index a0188d793b..d29c923dd3 100644 --- a/macros/latex/contrib/photobook/photobook.cls +++ b/macros/latex/contrib/photobook/photobook.cls @@ -38,10 +38,18 @@ % % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % -% XXX should cliptocell offsets be tweakable??? -% XXX ASAP should cover/jacket/endpaper/spread template cells account -% for bleeds as an option??? -% ...i.e. include cliptocell defaults??? +% XXX ASAP: imagecell: photobook@imagecell@left and photobook@imagecell@left +% should explicitly account for clearence@left and clearence@top resp. +% XXX ASAP: imagecell: clearance should have the same semantics as cliptocell +% offsts... +% (CLEARANCE) +% XXX ASAP should cover/jacket/endpaper/spread cells set default cliptocell +% bleeds??? +% ...needs testing and experimenting... +% XXX ASAP: should \blockwidth include \bindingoffset (current) or not??? +% ...currently I think that no, as \blockwidth indicates the outer +% width of the block, and this poses the question: +% should \pagewidth include \bindingoffset??? % XXX ASAP should cover/jacket/endpaper/spread templates/cells account % for \bindingoffset (likely no) and/or \gutteroffset ??? % ...especially relevant to endpaper/spread... @@ -49,11 +57,11 @@ % ...all cells should ignore bleeds unless explicitly stated % otherwise -- needs testing... % +% % XXX captions behave in an odd way... % the internal (macro) minipage for some reason does not affect text % justification while adding a minipage in the macro argument works % as expected -- some odd input mode??? -% XXX Q: should \blockwidth include \bindingoffset (current) or not??? % XXX revise \clearcaption / \captionclearpage... % XXX unify API -- see CellContent env... % XXX make this loadable both as a class and as a package... @@ -85,8 +93,8 @@ %%% NOTE: \def\<module-name>@[A-Z]+ macros will be visible to both the %%% code and the generated docs... -\edef\photobook@FILEVERSION{v0.1.21} -\edef\photobook@FILEDATE{2023-04-22} +\edef\photobook@FILEVERSION{v0.1.23} +\edef\photobook@FILEDATE{2023-05-05} %% \documentclass{ltxdoc} @@ -952,7 +960,13 @@ %% \DescribeMacro{\cellheight=<len>} %% \DescribeMacro{\celloffsetleft=<len>} %% \DescribeMacro{\celloffsettop=<len>} -%% \DescribeMacro{\clearance=<len>} +% XXX EXPERIMENTAL CLEARANCE +%%% \DescribeMacro{\clearanceleft=<len>} +%%% \DescribeMacro{\clearancetop=<len>} +%%% \DescribeMacro{\clearanceright=<len>} +%%% \DescribeMacro{\clearancebottom=<len>} +% XXX LEGACY CLEARANCE +%%% \DescribeMacro{\clearance=<len>} % %% Cell geometry. %% @@ -973,8 +987,19 @@ \setlength\celloffsetleft{0pt} \newlength\celloffsettop \setlength\celloffsettop{0pt} -\newlength\clearance -\setlength\clearance{0pt} +% XXX EXPERIMENTAL CLEARANCE +\newlength\clearanceleft +\setlength\clearanceleft{0pt} +\newlength\clearancetop +\setlength\clearancetop{0pt} +\newlength\clearanceright +\setlength\clearanceright{0pt} +\newlength\clearancebottom +\setlength\clearancebottom{0pt} +\def\clearances{0pt} +% XXX LEGACY CLEARANCE +%\newlength\clearance +%\setlength\clearance{0pt} %% \DescribeMacro{\clearfoldoutgutter=<len>} @@ -1587,7 +1612,13 @@ %% \DescribeMacro{\cellparentheight=<len>} %% \DescribeMacro{\celloffsettop=<len>} %% \DescribeMacro{\celloffsetleft=<len>} -%% \DescribeMacro{\clearance=<len>} +% XXX EXPERIMENTAL CLEARANCE +%%% \DescribeMacro{\clearanceleft=<len>} +%%% \DescribeMacro{\clearancetop=<len>} +%%% \DescribeMacro{\clearanceright=<len>} +%%% \DescribeMacro{\clearancebottom=<len>} +% XXX LEGACY CLEARANCE +%%% \DescribeMacro{\clearance=<len>} %% %% A cell defines a set of contextual lengths: %% @@ -1719,7 +1750,13 @@ \setlength\cellheight{\photobook@protect@h}% \setlength\celloffsettop{0pt}% \setlength\celloffsetleft{0pt}% - \setlength\clearance{0pt}% + % XXX EXPERIMENTAL CLEARANCE + \setlength\clearanceleft{0pt}% + \setlength\clearancetop{0pt}% + \setlength\clearanceright{0pt}% + \setlength\clearancebottom{0pt}% + % XXX LEGACY CLEARANCE + %\setlength\clearance{0pt}% % \begin{MinipageCellContent}[\photobook@minipagecell@parentvalign]{minipagecell}% }{% @@ -2009,6 +2046,7 @@ \setlength\photobook@cliptocell@right{0mm}% \newlength\photobook@cliptocell@bottom \setlength\photobook@cliptocell@bottom{0mm}% +\def\cliptocellclearances{0mm 0mm 0mm 0mm}% %% Set the default bleeds for |cliptocell| environments %% @@ -2019,9 +2057,13 @@ %% This will only affect |cliptocell| environments on the same level, %% without affecting the nested |cliptocell|s. %% -% XXX should this set the setsepchar back to default??? -% XXX should this be public??? -% ...mainly due to setsepchar... +%%% \DescribeEnv{cliptocellclearances=<left> <bottom> <right> <top>} +%%% +%%% Set by |\cliptocellbleeds{..}| and contains clearances (negative +%%% clipping bleeds) usable by imagecell. +% +% XXX BUG: bleeds is set correctly for one value but 2 and 4 seem to be +% misbehaving (see: ./examples/endpaper.tex) \newcommand\cliptocellbleeds[1]{ \setsepchar{ }% \readlist*\photobook@cliptocell@bleeds{#1}% @@ -2055,7 +2097,13 @@ \setlength\photobook@cliptocell@right{% \photobook@cliptocell@bleeds[3]}% \setlength\photobook@cliptocell@top{% - \photobook@cliptocell@bleeds[4]}\fi} + \photobook@cliptocell@bleeds[4]}\fi% + % NOTE: trailing spaces here are significant... + \def\cliptocellclearances{% + {-\photobook@cliptocell@left} % + {-\photobook@cliptocell@bottom} % + {-\photobook@cliptocell@right} % + {-\photobook@cliptocell@top}}} \newenvironment{cliptocell}[1][0mm]{% \begingroup% @@ -2272,6 +2320,16 @@ \def\photobook@imagecell@captiontop{0pt} \def\photobook@imagecell@captionleft{0pt} +% XXX EXPERIMENTAL +\newlength\photobook@imagecell@clearance@left +\setlength\photobook@imagecell@clearance@left{0pt} +\newlength\photobook@imagecell@clearance@top +\setlength\photobook@imagecell@clearance@top{0pt} +\newlength\photobook@imagecell@clearance@right +\setlength\photobook@imagecell@clearance@right{0pt} +\newlength\photobook@imagecell@clearance@bottom +\setlength\photobook@imagecell@clearance@bottom{0pt} +% XXX LEGACY \newlength\photobook@imagecell@clearance \setlength\photobook@imagecell@clearance{0pt} @@ -2288,15 +2346,22 @@ \define@boolkey{imagecell@args}{center}[true]{% \def\photobook@imagecell@top{\dimexpr +0.5\cellheight + % XXX EXPERIMENTAL CLEARANCE -- test... + +0.5\photobook@imagecell@clearance@top + -0.5\photobook@imagecell@clearance@bottom -0.5\ht\photobook@imagebox \relax}% \def\photobook@imagecell@left{\dimexpr +0.5\cellwidth + % XXX EXPERIMENTAL CLEARANCE -- test... + +0.5\photobook@imagecell@clearance@left + -0.5\photobook@imagecell@clearance@right -0.5\wd\photobook@imagebox \relax}}% % left/right... % shortdands... \newcommand\photobook@imagecell@LEFT{% \def\photobook@imagecell@left{\dimexpr% - +\photobook@imagecell@clearance \relax}% + +\photobook@imagecell@clearance@left \relax}% + %+\photobook@imagecell@clearance \relax}% \def\photobook@imagecell@captionleft{ % XXX not sure why this branch is needed... \ifKV@imagecell@args@fit @@ -2304,12 +2369,14 @@ \else% \dimexpr% +\cellwidth - -\photobook@imagecell@clearance + -\photobook@imagecell@clearance@left + %-\photobook@imagecell@clearance -\wd\photobook@imagebox \relax\fi}}% \newcommand\photobook@imagecell@RIGHT{% \def\photobook@imagecell@left{\dimexpr +\cellwidth - -\photobook@imagecell@clearance + -\photobook@imagecell@clearance@right + %-\photobook@imagecell@clearance -\wd\photobook@imagebox \relax} % XXX not sure why 0.5 but it seems to work... \def\photobook@imagecell@captionleft{% @@ -2333,7 +2400,8 @@ % top/bottom... \define@boolkey{imagecell@args}{top}[true]{% \def\photobook@imagecell@top{% - \photobook@imagecell@clearance}% + \photobook@imagecell@clearance@top}% + %\photobook@imagecell@clearance}% \def\photobook@imagecell@captiontop{% -\dimexpr +\cellheight @@ -2342,14 +2410,55 @@ \def\photobook@imagecell@top{% \dimexpr +\cellheight - -\photobook@imagecell@clearance + -\photobook@imagecell@clearance@bottom + %-\photobook@imagecell@clearance -\ht\photobook@imagebox \relax}% \def\photobook@imagecell@captiontop{% \dimexpr \photobook@imagecell@top - +\photobook@imagecell@clearance \relax}}% + +\photobook@imagecell@clearance@bottom \relax}}% + %+\photobook@imagecell@clearance \relax}}% % clearance=<len>... +% clearance=<horizontal> <vertical>... +% clearance=<left> <bottom> <right> <top>... \define@key{imagecell@args}{clearance}{% + % XXX EXPERIMENTAL + % XXX this is essentially the same as \photobook@cliptocell@bleeds -- unite... + \def\photobook@imagecell@clearances{#1}% + \setsepchar{ } + \readlist*\photobook@imagecell@clearencelist{#1}% + \setsepchar{,}% + %% args: size + \ifnum \photobook@imagecell@clearencelistlen = 1% + \setlength\photobook@imagecell@clearance@left{% + \photobook@imagecell@clearencelist[1]}% + \setlength\photobook@imagecell@clearance@bottom{% + \photobook@imagecell@clearencelist[1]}% + \setlength\photobook@imagecell@clearance@right{% + \photobook@imagecell@clearencelist[1]}% + \setlength\photobook@imagecell@clearance@top{% + \photobook@imagecell@clearencelist[1]}\fi% + % args: horizontal vertical + \ifnum \photobook@imagecell@clearencelistlen = 2% + \setlength\photobook@imagecell@clearance@left{% + \photobook@imagecell@clearencelist[1]}% + \setlength\photobook@imagecell@clearance@bottom{% + \photobook@imagecell@clearencelist[2]}% + \setlength\photobook@imagecell@clearance@right{% + \photobook@imagecell@clearencelist[1]}% + \setlength\photobook@imagecell@clearance@top{% + \photobook@imagecell@clearencelist[2]}\fi% + % args: left bottom right top + \ifnum \photobook@imagecell@clearencelistlen = 4% + \setlength\photobook@imagecell@clearance@left{% + \photobook@imagecell@clearencelist[1]}% + \setlength\photobook@imagecell@clearance@bottom{% + \photobook@imagecell@clearencelist[2]}% + \setlength\photobook@imagecell@clearance@right{% + \photobook@imagecell@clearencelist[3]}% + \setlength\photobook@imagecell@clearance@top{% + \photobook@imagecell@clearencelist[4]}\fi% + % XXX LEGACY... \setlength\photobook@imagecell@clearance{#1}}% % offsettop=<len> / offsetleft=<len>... @@ -2398,10 +2507,14 @@ keepaspectratio, width=\photobook@imagecell@scale\dimexpr \cellwidth - - ((\photobook@imagecell@clearance) * 2) \relax, + - \photobook@imagecell@clearance@left + - \photobook@imagecell@clearance@right \relax, + %- ((\photobook@imagecell@clearance) * 2) \relax, height=\photobook@imagecell@scale\dimexpr \cellheight - - ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% + - \photobook@imagecell@clearance@top + - \photobook@imagecell@clearance@bottom \relax]{#3}}% + %- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% % fill... \else\ifKV@imagecell@args@fill% % preload image to get its proportions... @@ -2420,14 +2533,18 @@ keepaspectratio, width=\photobook@imagecell@scale\dimexpr + \cellwidth - - ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% + - \photobook@imagecell@clearance@left + - \photobook@imagecell@clearance@right \relax]{#3}}% + %- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% \else% \sbox{\photobook@imagebox}{% \includegraphics[% keepaspectratio, height=\photobook@imagecell@scale\dimexpr + \cellheight - - ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% + - \photobook@imagecell@clearance@top + - \photobook@imagecell@clearance@bottom \relax]{#3}}% + %- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% \fi\fi\fi% % \setlength\celloffsetleft{% @@ -2470,7 +2587,14 @@ \maxdim{\celloffsetleft}{0pt}}% \setlength\celloffsettop{% \maxdim{\celloffsettop}{0pt}}% - \setlength\clearance{\photobook@imagecell@clearance}% + % XXX EXPERIMENTAL CLEARANCE + \setlength\clearanceleft{\photobook@imagecell@clearance@left} + \setlength\clearancetop{\photobook@imagecell@clearance@top} + \setlength\clearanceright{\photobook@imagecell@clearance@right} + \setlength\clearancebottom{\photobook@imagecell@clearance@bottom} + \def\clearances{\photobook@imagecell@clearences} + % XXX LEGACY CLEARANCE + %\setlength\clearance{\photobook@imagecell@clearance}% % clear parent... % XXX might be a good idea to put this into a special reusable cell... \ifphotobook@imagecell@captionclearparent% @@ -2930,7 +3054,10 @@ - \cellwidth - \clearcaption % XXX this is only present in images... - - \clearance \relax% + % XXX change this to use \clearanceleft / \clearanceright / ... + % XXX LEGACY CLEARANCE + - \clearance + \relax% \else% \photobook@captionblockcell@width\fi}% \setlength\cellparentwidth{% @@ -3917,7 +4044,9 @@ %%%%% Endpaper cells % %% \DescribeEnv{leftside} +%%% \DescribeEnv{leftside*} %% \DescribeEnv{rightside} +%%% \DescribeEnv{rightside*} % %% \begin{minipage}{\textwidth} %% \begin{verbatim} @@ -3933,14 +4062,24 @@ %% \end{verbatim} %% \end{minipage} %% +%%% The star versions set the appropriate bleeds for cliptocell. +%%% % XXX for some reason naming these anything starting with endpaper will % make LaTeX complain that that is already defined... % ...collision with bools??? \newenvironment{leftside}{% - \begin{pagecell}% + \begin{cell*}% + {\bleed, \bleed}% + {\pageblockwidth}{\pageblockheight}% }{% - \end{pagecell}} + \end{cell*}} +% XXX EXPERIMENTAL +\newenvironment{leftside*}{% + \begin{leftside}% + \cliptocellbleeds{{\bleed} {\bleed} 0mm {\bleed}}% +}{% + \end{leftside}} \newenvironment{rightside}{% \begin{cell*}% @@ -3948,6 +4087,13 @@ {\pageblockwidth}{\pageblockheight}% }{% \end{cell*}} +% XXX EXPERIMENTAL +\newenvironment{rightside*}{% + \begin{rightside}% + \cliptocellbleeds{0mm {\bleed} {\bleed} {\bleed}}% +}{% + \end{rightside}} + % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |