mirror of
https://github.com/flynx/photobook.git
synced 2025-10-29 18:30:10 +00:00
more refactoring + now captions take no space in page stack...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
681bc5f9d4
commit
0ae612ce55
4
Makefile
4
Makefile
@ -27,8 +27,8 @@ TEX := lualatex $(ARGS)
|
|||||||
texToDoc = \
|
texToDoc = \
|
||||||
@echo "texToDoc: $1 -> $2"; \
|
@echo "texToDoc: $1 -> $2"; \
|
||||||
cat $1 \
|
cat $1 \
|
||||||
| egrep '(^%%|^\\\\def\\\\$*@[A-Z]+)' \
|
| egrep '(^%%|^\\\\edef\\\\$*@[A-Z][A-Z]+)' \
|
||||||
| sed 's/^\(\\\\def\\\\\)$*@/%%\\1/'\
|
| sed 's/^\(\\\\edef\\\\\)$*@/%%\\1/'\
|
||||||
| sed 's/%%%%%% \(.*\)/%%\\\\subsubsection{\1}/' \
|
| sed 's/%%%%%% \(.*\)/%%\\\\subsubsection{\1}/' \
|
||||||
| sed 's/%%%%% \(.*\)/%%\\\\subsection{\1}/' \
|
| sed 's/%%%%% \(.*\)/%%\\\\subsection{\1}/' \
|
||||||
| sed 's/%%%% \(.*\)/%%\\\\section{\1}/' \
|
| sed 's/%%%% \(.*\)/%%\\\\section{\1}/' \
|
||||||
|
|||||||
367
photobook.cls
367
photobook.cls
@ -8,17 +8,16 @@
|
|||||||
%
|
%
|
||||||
%
|
%
|
||||||
% XXX see where we need to \ignorespaces...
|
% XXX see where we need to \ignorespaces...
|
||||||
%
|
|
||||||
% XXX BUG: fix \OFFSETFIX
|
|
||||||
%
|
|
||||||
% XXX might be a good idea to add a spine calculator...
|
% XXX might be a good idea to add a spine calculator...
|
||||||
|
% XXX LEGACY BUG: fix \OFFSETFIX
|
||||||
|
%
|
||||||
%
|
%
|
||||||
%----------------------------------------------------------------------
|
%----------------------------------------------------------------------
|
||||||
|
|
||||||
%%% 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...
|
||||||
\def\photobook@FILEVERSION{v0.1}
|
\edef\photobook@FILEVERSION{v0.1}
|
||||||
\def\photobook@FILEDATE{2021-07-28}
|
\edef\photobook@FILEDATE{2021-07-28}
|
||||||
|
|
||||||
|
|
||||||
%% \documentclass{ltxdoc}
|
%% \documentclass{ltxdoc}
|
||||||
@ -277,8 +276,6 @@
|
|||||||
\@DeclareLiteralOptionTo{layoutmode}{cover}
|
\@DeclareLiteralOptionTo{layoutmode}{cover}
|
||||||
%\@DeclareLiteralOptionTo{layoutmode}{hardcover}
|
%\@DeclareLiteralOptionTo{layoutmode}{hardcover}
|
||||||
%\@DeclareLiteralOptionTo{layoutmode}{softcover}
|
%\@DeclareLiteralOptionTo{layoutmode}{softcover}
|
||||||
% XXX add flap sizes...
|
|
||||||
% XXX not implemented...
|
|
||||||
\@DeclareLiteralOptionTo{layoutmode}{jacket}
|
\@DeclareLiteralOptionTo{layoutmode}{jacket}
|
||||||
|
|
||||||
|
|
||||||
@ -306,7 +303,6 @@
|
|||||||
%% - negative value set image bleed,
|
%% - negative value set image bleed,
|
||||||
%% - positive value set distance from paper edge to image.
|
%% - positive value set distance from paper edge to image.
|
||||||
%%
|
%%
|
||||||
%
|
|
||||||
\DeclareStringOption{clearimage}[-5mm]
|
\DeclareStringOption{clearimage}[-5mm]
|
||||||
|
|
||||||
|
|
||||||
@ -364,8 +360,6 @@
|
|||||||
%% bindingoffset=\bindingoffset
|
%% bindingoffset=\bindingoffset
|
||||||
%% \end{verbatim}
|
%% \end{verbatim}
|
||||||
%%
|
%%
|
||||||
%
|
|
||||||
% XXX better name..
|
|
||||||
\DeclareBoolOption{geometrynodefaults}
|
\DeclareBoolOption{geometrynodefaults}
|
||||||
|
|
||||||
|
|
||||||
@ -445,7 +439,7 @@
|
|||||||
\newif\ifsoftcoverlayout
|
\newif\ifsoftcoverlayout
|
||||||
\newif\ifendpaperlayout
|
\newif\ifendpaperlayout
|
||||||
\newif\ifjacketlayout
|
\newif\ifjacketlayout
|
||||||
% agrigates...
|
% aggregates...
|
||||||
\newif\ifcoverlikelayout
|
\newif\ifcoverlikelayout
|
||||||
\newif\ifblocklayout
|
\newif\ifblocklayout
|
||||||
|
|
||||||
@ -849,28 +843,6 @@
|
|||||||
%%
|
%%
|
||||||
|
|
||||||
|
|
||||||
%% \DescribeMacro{\mindim\{..\}}
|
|
||||||
%% \DescribeMacro{\maxdim\{..\}}
|
|
||||||
%
|
|
||||||
%% Get min/max dimension.
|
|
||||||
%
|
|
||||||
%% >> \mindim{A}{B}
|
|
||||||
%
|
|
||||||
%% >> \maxdim{A}{B}
|
|
||||||
%%
|
|
||||||
\newcommand\mindim[2]{
|
|
||||||
\ifdim \dimexpr #1 \relax < \dimexpr #2 \relax%
|
|
||||||
\dimexpr #1 \relax%
|
|
||||||
\else%
|
|
||||||
\dimexpr #2 \relax\fi}
|
|
||||||
|
|
||||||
\newcommand\maxdim[2]{
|
|
||||||
\ifdim \dimexpr #1 \relax > \dimexpr #2 \relax%
|
|
||||||
\dimexpr #1 \relax%
|
|
||||||
\else%
|
|
||||||
\dimexpr #2 \relax\fi}
|
|
||||||
|
|
||||||
|
|
||||||
%% \DescribeMacro{\keywords\{..\}}
|
%% \DescribeMacro{\keywords\{..\}}
|
||||||
%
|
%
|
||||||
%% Set pdf metadata keywords
|
%% Set pdf metadata keywords
|
||||||
@ -895,6 +867,28 @@
|
|||||||
\def\@subject{#1}}
|
\def\@subject{#1}}
|
||||||
|
|
||||||
|
|
||||||
|
%% \DescribeMacro{\mindim\{..\}}
|
||||||
|
%% \DescribeMacro{\maxdim\{..\}}
|
||||||
|
%
|
||||||
|
%% Get min/max dimension.
|
||||||
|
%
|
||||||
|
%% >> \mindim{A}{B}
|
||||||
|
%
|
||||||
|
%% >> \maxdim{A}{B}
|
||||||
|
%%
|
||||||
|
\newcommand\mindim[2]{
|
||||||
|
\ifdim \dimexpr #1 \relax < \dimexpr #2 \relax%
|
||||||
|
\dimexpr #1 \relax%
|
||||||
|
\else%
|
||||||
|
\dimexpr #2 \relax\fi}
|
||||||
|
|
||||||
|
\newcommand\maxdim[2]{
|
||||||
|
\ifdim \dimexpr #1 \relax > \dimexpr #2 \relax%
|
||||||
|
\dimexpr #1 \relax%
|
||||||
|
\else%
|
||||||
|
\dimexpr #2 \relax\fi}
|
||||||
|
|
||||||
|
|
||||||
%% \DescribeMacro{\cleartoleftpage}
|
%% \DescribeMacro{\cleartoleftpage}
|
||||||
%
|
%
|
||||||
%% Forces content to left page
|
%% Forces content to left page
|
||||||
@ -908,6 +902,7 @@
|
|||||||
\hbox{}\newpage \fi\fi\fi }
|
\hbox{}\newpage \fi\fi\fi }
|
||||||
|
|
||||||
|
|
||||||
|
% XXX LEGACY?
|
||||||
% XXX workaround a problem with xelatex vs. lualatex...
|
% XXX workaround a problem with xelatex vs. lualatex...
|
||||||
\ifxetex
|
\ifxetex
|
||||||
\newcommand\ShipoutPicture[1]{%
|
\newcommand\ShipoutPicture[1]{%
|
||||||
@ -922,6 +917,53 @@
|
|||||||
\fi
|
\fi
|
||||||
|
|
||||||
|
|
||||||
|
%% \DescribeMacro{\ResettableMacro\{..\}}
|
||||||
|
%
|
||||||
|
%% Create a resettable command.
|
||||||
|
%
|
||||||
|
%% >> \ResettableMacro{<name>}{<code>}
|
||||||
|
%% >> \ResettableMacro{<name>}[<arg-count>]{<code>}
|
||||||
|
%% >> \ResettableMacro{<name>}[<arg-count>][<default>]{<code>}
|
||||||
|
%
|
||||||
|
%% This is similar to |\newcommand{..}| but will define two commands:
|
||||||
|
%%
|
||||||
|
%% >> \<name>{..}
|
||||||
|
%%
|
||||||
|
%% >> \reset<name>
|
||||||
|
%%
|
||||||
|
%% |\<name>{..}| can be freely redefined or undefined by user.
|
||||||
|
%%
|
||||||
|
%% |\reset<name>| will reset |\<name>{..}| to its original state.
|
||||||
|
%%
|
||||||
|
% parse args...
|
||||||
|
\def\ResettableMacro#1{%
|
||||||
|
\@ifnextchar[{%
|
||||||
|
\photobook@ResettableMacro@pre{#1}%
|
||||||
|
}{%
|
||||||
|
\photobook@ResettableMacro{#1}}}
|
||||||
|
\def\photobook@ResettableMacro@pre#1[#2]{%
|
||||||
|
\@ifnextchar[{%
|
||||||
|
\photobook@ResettableMacro@args@dfl{#1}[#2]%
|
||||||
|
}{%
|
||||||
|
\photobook@ResettableMacro@args{#1}[#2]}}
|
||||||
|
% pre -- main command definition...
|
||||||
|
\def\photobook@ResettableMacro#1#2{%
|
||||||
|
\expandafter\newcommand\csname photobook@#1\endcsname{#2}%
|
||||||
|
\photobook@ResettableMacro@tail{#1}}
|
||||||
|
\def\photobook@ResettableMacro@args#1[#2]#3{%
|
||||||
|
\expandafter\newcommand\csname photobook@#1\endcsname[#2]{#3}%
|
||||||
|
\photobook@ResettableMacro@tail{#1}}
|
||||||
|
\def\photobook@ResettableMacro@args@dfl#1[#2][#3]#4{%
|
||||||
|
\expandafter\newcommand\csname photobook@#1\endcsname[#2][#3]{#4}%
|
||||||
|
\photobook@ResettableMacro@tail{#1}}
|
||||||
|
% post...
|
||||||
|
\def\photobook@ResettableMacro@tail#1{%
|
||||||
|
% \reset<name>
|
||||||
|
\expandafter\newcommand\csname reset#1\endcsname{%
|
||||||
|
\expandafter\let\csname #1\expandafter\endcsname\csname photobook@#1\endcsname}
|
||||||
|
% initialize...
|
||||||
|
\csname reset#1\endcsname}
|
||||||
|
|
||||||
|
|
||||||
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
% XXX HACKS...
|
% XXX HACKS...
|
||||||
@ -942,13 +984,15 @@
|
|||||||
%% Page environment.
|
%% Page environment.
|
||||||
%%
|
%%
|
||||||
%% This is mainly designed to wrap other cell environment described later.
|
%% This is mainly designed to wrap other cell environment described later.
|
||||||
%
|
%%
|
||||||
% XXX this may span more than one page if there is enoug stuff packed
|
%% Note that this may span more than one page if there is enough stuff
|
||||||
% into it...
|
%% packed in.
|
||||||
|
%%
|
||||||
\newenvironment{page}{%
|
\newenvironment{page}{%
|
||||||
\null
|
\null%
|
||||||
|
\ignorespaces%
|
||||||
}{%
|
}{%
|
||||||
\clearpage }
|
\clearpage}
|
||||||
|
|
||||||
|
|
||||||
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@ -1100,7 +1144,8 @@
|
|||||||
\ignorespaces%
|
\ignorespaces%
|
||||||
}{%
|
}{%
|
||||||
\end{inlinecell*}%
|
\end{inlinecell*}%
|
||||||
\end{textblock*}}
|
\end{textblock*}%
|
||||||
|
\ignorespaces}
|
||||||
|
|
||||||
\newenvironment{cell}[3]{%
|
\newenvironment{cell}[3]{%
|
||||||
\begin{cell*}{#1}{#2}{#3}%
|
\begin{cell*}{#1}{#2}{#3}%
|
||||||
@ -1108,7 +1153,8 @@
|
|||||||
\ignorespaces%
|
\ignorespaces%
|
||||||
}{%
|
}{%
|
||||||
\end{cliptocell}%
|
\end{cliptocell}%
|
||||||
\end{cell*}}
|
\end{cell*}%
|
||||||
|
\ignorespaces}
|
||||||
|
|
||||||
|
|
||||||
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@ -1134,7 +1180,8 @@
|
|||||||
\expandafter\sbox\csname #1\endcsname{%
|
\expandafter\sbox\csname #1\endcsname{%
|
||||||
\begin{inlinecell*}{#2}{#3}%
|
\begin{inlinecell*}{#2}{#3}%
|
||||||
#4%
|
#4%
|
||||||
\end{inlinecell*}}}
|
\end{inlinecell*}}%
|
||||||
|
\ignorespaces}
|
||||||
|
|
||||||
|
|
||||||
% \usecell{..} variants...
|
% \usecell{..} variants...
|
||||||
@ -1202,7 +1249,7 @@
|
|||||||
\begin{inlinecell*}[#1]{\cellheight}{\cellwidth}%
|
\begin{inlinecell*}[#1]{\cellheight}{\cellwidth}%
|
||||||
}{%
|
}{%
|
||||||
\end{inlinecell*}%
|
\end{inlinecell*}%
|
||||||
\end{turn}
|
\end{turn}%
|
||||||
\end{flushright}}
|
\end{flushright}}
|
||||||
|
|
||||||
\newenvironment{bottomup}[1][t]{%
|
\newenvironment{bottomup}[1][t]{%
|
||||||
@ -1215,11 +1262,12 @@
|
|||||||
|
|
||||||
%% \DescribeEnv{cliptocell}
|
%% \DescribeEnv{cliptocell}
|
||||||
%
|
%
|
||||||
%% Clip content to cell env.
|
%% Clip content to parent cell.
|
||||||
%%
|
%%
|
||||||
\newenvironment{cliptocell}{%
|
\newenvironment{cliptocell}{%
|
||||||
\begin{clipbox*}{0cm {\height - \cellheight} {\cellwidth} {\height}}%
|
\begin{clipbox*}{0cm {\height - \cellheight} {\cellwidth} {\height}}%
|
||||||
\begin{minipage}[t][\cellheight][t]{\cellwidth}%
|
\begin{minipage}[t][\cellheight][t]{\cellwidth}%
|
||||||
|
\ignorespaces%
|
||||||
}{%
|
}{%
|
||||||
\end{minipage}%
|
\end{minipage}%
|
||||||
\end{clipbox*}}
|
\end{clipbox*}}
|
||||||
@ -1458,8 +1506,6 @@
|
|||||||
% ...i.e. an argument that will shift the image v/h from base position.
|
% ...i.e. an argument that will shift the image v/h from base position.
|
||||||
% also need to shift the caption box accordingly but still keep it
|
% also need to shift the caption box accordingly but still keep it
|
||||||
% within the cell...
|
% within the cell...
|
||||||
% XXX need to help caption-cell be able to create new cells to left/right/top/left
|
|
||||||
% of image...
|
|
||||||
% XXX can we make this an env???
|
% XXX can we make this an env???
|
||||||
\newcommand\imagecell[3][]{%
|
\newcommand\imagecell[3][]{%
|
||||||
\begingroup%
|
\begingroup%
|
||||||
@ -1517,7 +1563,7 @@
|
|||||||
\usebox\photobook@imagebox%
|
\usebox\photobook@imagebox%
|
||||||
%
|
%
|
||||||
% caption cell...
|
% caption cell...
|
||||||
% XXX do not do this if no caption is given...
|
% XXX make this conditional -- if caption is not empty...
|
||||||
\begingroup%
|
\begingroup%
|
||||||
% setup the cell env...
|
% setup the cell env...
|
||||||
% NOTE: this needs the original \cellwidth...
|
% NOTE: this needs the original \cellwidth...
|
||||||
@ -1552,6 +1598,7 @@
|
|||||||
% adjust top if image is taller than cell...
|
% adjust top if image is taller than cell...
|
||||||
\raisebox{-\celloffsettop}{%
|
\raisebox{-\celloffsettop}{%
|
||||||
\begin{minipage}[b][\cellheight][\photobook@imagecell@captionalign]{\cellwidth}%
|
\begin{minipage}[b][\cellheight][\photobook@imagecell@captionalign]{\cellwidth}%
|
||||||
|
\ignorespaces%
|
||||||
#2%
|
#2%
|
||||||
\end{minipage}}}
|
\end{minipage}}}
|
||||||
\endgroup}%
|
\endgroup}%
|
||||||
@ -1618,49 +1665,53 @@
|
|||||||
%% >> \captioncell[align=center]{<caption>}
|
%% >> \captioncell[align=center]{<caption>}
|
||||||
%% >> \captioncell[align=flushright]{<caption>}
|
%% >> \captioncell[align=flushright]{<caption>}
|
||||||
%%
|
%%
|
||||||
% XXX would be nice to create cells above/below/left/right of image...
|
%% Note that a caption cell does not take up any space in the parent cell
|
||||||
|
%% so multiple captions can be used in combination with other elements.
|
||||||
|
%%
|
||||||
|
|
||||||
% helpers...
|
% helpers...
|
||||||
% XXX set minipage height to available cell height...
|
% XXX set minipage height to available cell height (???)
|
||||||
\newcommand\photobook@captioncell@formatTopAlign[1]{%
|
\newcommand\photobook@captioncell@formatalign[3][0pt]{%
|
||||||
% XXX for some reason without this things are misaligned...
|
\smash{\makebox[0pt][l]{%
|
||||||
\vspace{0pt}%
|
\begin{minipage}[t][\cellheight][t]{\cellwidth}%
|
||||||
\begin{\photobook@captioncell@align}%
|
% XXX for some reason without this things get misaligned...
|
||||||
#1%
|
\vspace{#1}%
|
||||||
\end{\photobook@captioncell@align}}
|
% XXX HACK: for some magical reason setting the above minipage to 'b'
|
||||||
% XXX set minipage height to available cell height...
|
% will make \vspace{..} above break...
|
||||||
\newcommand\photobook@captioncell@formatBottomAlign[1]{%
|
% ...adding another nested minipage seems to fix the issue...
|
||||||
\begin{minipage}[t][\cellheight][b]{\cellwidth}%
|
\begin{minipage}[t][\cellheight][#2]{\cellwidth}%
|
||||||
\begin{\photobook@captioncell@align}%
|
\begin{\photobook@captioncell@align}%
|
||||||
#1%
|
\ignorespaces%
|
||||||
\end{\photobook@captioncell@align}%
|
#3%
|
||||||
\end{minipage}}
|
\end{\photobook@captioncell@align}%
|
||||||
|
\end{minipage}
|
||||||
|
\end{minipage}}}}
|
||||||
% format...
|
% format...
|
||||||
\def\photobook@captioncell@format#1{%
|
\def\photobook@captioncell@format#1{%
|
||||||
\photobook@captioncell@formatTopAlign{#1}}
|
\photobook@captioncell@formatalign{t}{#1}}
|
||||||
|
|
||||||
% over / top / center / bottom / under...
|
% over / top / center / bottom / under...
|
||||||
\define@boolkey{captioncell@args}{over}[true]{%
|
\define@boolkey{captioncell@args}{over}[true]{%
|
||||||
\def\photobook@captioncell@format##1{%
|
\def\photobook@captioncell@format##1{%
|
||||||
\vspace{-\dimexpr \cellheight + 2\fboxsep \relax}%
|
\photobook@captioncell@formatalign[-\cellheight]{b}{##1}}}
|
||||||
\photobook@captioncell@formatBottomAlign{##1}}}
|
|
||||||
\define@boolkey{captioncell@args}{top}[true]{%
|
\define@boolkey{captioncell@args}{top}[true]{%
|
||||||
\def\photobook@captioncell@format##1{%
|
\def\photobook@captioncell@format##1{%
|
||||||
\photobook@captioncell@formatTopAlign{##1}}}
|
\photobook@captioncell@formatalign{t}{##1}}}
|
||||||
\define@boolkey{captioncell@args}{center}[true]{%
|
\define@boolkey{captioncell@args}{center}[true]{%
|
||||||
\def\photobook@captioncell@format##1{%
|
\def\photobook@captioncell@format##1{%
|
||||||
\begin{minipage}[t][\cellheight][c]{\cellwidth}%
|
\smash{\makebox[0pt][l]{%
|
||||||
\begin{\photobook@captioncell@align}%
|
\begin{minipage}[t][\cellheight][c]{\cellwidth}%
|
||||||
##1%
|
\begin{\photobook@captioncell@align}%
|
||||||
\end{\photobook@captioncell@align}%
|
\ignorespaces%
|
||||||
\end{minipage}}}
|
##1%
|
||||||
|
\end{\photobook@captioncell@align}%
|
||||||
|
\end{minipage}}}}}
|
||||||
\define@boolkey{captioncell@args}{bottom}[true]{%
|
\define@boolkey{captioncell@args}{bottom}[true]{%
|
||||||
\def\photobook@captioncell@format##1{%
|
\def\photobook@captioncell@format##1{%
|
||||||
\photobook@captioncell@formatBottomAlign{##1}}}
|
\photobook@captioncell@formatalign{b}{##1}}}
|
||||||
\define@boolkey{captioncell@args}{under}[true]{%
|
\define@boolkey{captioncell@args}{under}[true]{%
|
||||||
\def\photobook@captioncell@format##1{%
|
\def\photobook@captioncell@format##1{%
|
||||||
\vspace{\dimexpr \cellheight + 2\fboxsep \relax}%
|
\photobook@captioncell@formatalign[\cellheight]{t}{##1}}}
|
||||||
\photobook@captioncell@formatTopAlign{##1}}}
|
|
||||||
% align...
|
% align...
|
||||||
\def\photobook@captioncell@align{}
|
\def\photobook@captioncell@align{}
|
||||||
% XXX for some reason \define@choicekey{..} does not expand macros...
|
% XXX for some reason \define@choicekey{..} does not expand macros...
|
||||||
@ -1669,14 +1720,14 @@
|
|||||||
\def\photobook@captioncell@align{#1}}
|
\def\photobook@captioncell@align{#1}}
|
||||||
% margin...
|
% margin...
|
||||||
\def\photobook@captioncell@margin{0pt}
|
\def\photobook@captioncell@margin{0pt}
|
||||||
\define@key{captioncell@args}{margin}{
|
\define@key{captioncell@args}{margin}{%
|
||||||
\def\photobook@captioncell@margin{#1}}
|
\def\photobook@captioncell@margin{#1}}
|
||||||
|
|
||||||
\newcommand\captioncell[2][]{%
|
\newcommand\captioncell[2][]{%
|
||||||
\setkeys{captioncell@args}{top, align=flushright, margin=1pt, #1}%
|
\setkeys{captioncell@args}{top, align=flushright, margin=1pt, #1}%
|
||||||
%
|
|
||||||
\photobook@captioncell@format{%
|
\photobook@captioncell@format{%
|
||||||
\adjustbox{margin=\photobook@captioncell@margin}{#2}}}
|
\adjustbox{margin=\photobook@captioncell@margin}{#2}}%
|
||||||
|
\ignorespaces}
|
||||||
|
|
||||||
|
|
||||||
%% \DescribeMacro{\vcaptioncell\{..\}}
|
%% \DescribeMacro{\vcaptioncell\{..\}}
|
||||||
@ -1707,18 +1758,12 @@
|
|||||||
% bottomup / topdown...
|
% bottomup / topdown...
|
||||||
\def\photobook@vcaptioncell@orientation{bottomup}
|
\def\photobook@vcaptioncell@orientation{bottomup}
|
||||||
\define@boolkey{vcaptioncell@args}{bottomup}[true]{%
|
\define@boolkey{vcaptioncell@args}{bottomup}[true]{%
|
||||||
\KV@vcaptioncell@args@topdownfalse
|
\KV@vcaptioncell@args@topdownfalse%
|
||||||
\def\photobook@vcaptioncell@orientation{bottomup}}
|
\def\photobook@vcaptioncell@orientation{bottomup}}
|
||||||
\define@boolkey{vcaptioncell@args}{topdown}[true]{%
|
\define@boolkey{vcaptioncell@args}{topdown}[true]{%
|
||||||
\KV@vcaptioncell@args@bottomupfalse
|
\KV@vcaptioncell@args@bottomupfalse%
|
||||||
\def\photobook@vcaptioncell@orientation{topdown}}
|
\def\photobook@vcaptioncell@orientation{topdown}}
|
||||||
|
|
||||||
\def\photobook@vcaptioncell@nested#1{%
|
|
||||||
\captioncell[%
|
|
||||||
\photobook@vcaptioncell@position,
|
|
||||||
align=\photobook@vcaptioncell@align,
|
|
||||||
margin=\photobook@vcaptioncell@margin]{#1}}
|
|
||||||
|
|
||||||
% before / left / center / right / after...
|
% before / left / center / right / after...
|
||||||
\def\photobook@vcaptioncell@position{top}
|
\def\photobook@vcaptioncell@position{top}
|
||||||
\define@boolkey{vcaptioncell@args}{before}[true]{%
|
\define@boolkey{vcaptioncell@args}{before}[true]{%
|
||||||
@ -1755,29 +1800,41 @@
|
|||||||
\def\photobook@vcaptioncell@align{#1}}
|
\def\photobook@vcaptioncell@align{#1}}
|
||||||
% margin...
|
% margin...
|
||||||
\def\photobook@vcaptioncell@margin{0pt}
|
\def\photobook@vcaptioncell@margin{0pt}
|
||||||
\define@key{vcaptioncell@args}{margin}{
|
\define@key{vcaptioncell@args}{margin}{%
|
||||||
\def\photobook@vcaptioncell@margin{#1}}
|
\def\photobook@vcaptioncell@margin{#1}}
|
||||||
|
|
||||||
|
\def\photobook@vcaptioncell@valign{%
|
||||||
|
\ifKV@vcaptioncell@args@bottomup%
|
||||||
|
b%
|
||||||
|
\else%
|
||||||
|
t\fi}
|
||||||
|
|
||||||
\newcommand\vcaptioncell[2][]{%
|
\newcommand\vcaptioncell[2][]{%
|
||||||
\setkeys{vcaptioncell@args}{left, bottomup, align=flushleft, margin=1pt, #1}%
|
\setkeys{vcaptioncell@args}{left, bottomup, align=flushleft, margin=1pt, #1}%
|
||||||
%
|
%
|
||||||
%% XXX for some reason this errs with:
|
\smash{\makebox[0pt][l]{%
|
||||||
%% "LaTeX Error: \begin{bottomup} on input line 432 ended by \end{bottomup}"
|
\begin{minipage}[t][\cellheight][\photobook@vcaptioncell@valign]{\cellwidth}%
|
||||||
%\begin{\photobook@vcaptioncell@orientation}%
|
\begin{\photobook@vcaptioncell@orientation}%
|
||||||
% \captioncell[%
|
\captioncell[%
|
||||||
% \photobook@vcaptioncell@position,
|
\photobook@vcaptioncell@position,
|
||||||
% align=\photobook@vcaptioncell@align,
|
align=\photobook@vcaptioncell@align,
|
||||||
% margin=\photobook@vcaptioncell@margin]{#2}%
|
margin=\photobook@vcaptioncell@margin]{#2}%
|
||||||
%\end{\photobook@vcaptioncell@orientation}}
|
\end{\photobook@vcaptioncell@orientation}%
|
||||||
\ifKV@vcaptioncell@args@bottomup%
|
\end{minipage}}}%
|
||||||
\begin{bottomup}%
|
\ignorespaces}
|
||||||
\photobook@vcaptioncell@nested{#2}
|
|
||||||
\end{bottomup}%
|
|
||||||
\else
|
%% \DescribeMacro{\rcaptioncell\{..\}}
|
||||||
\begin{topdown}%
|
%
|
||||||
\photobook@vcaptioncell@nested{#2}
|
%% \EXPERIMENTAL
|
||||||
\end{topdown}%
|
%%
|
||||||
\fi}
|
% XXX a bit off...
|
||||||
|
\newcommand\rcaptioncell[2][]{%
|
||||||
|
\captioncell[align=flushleft, #1]{%
|
||||||
|
\begin{turn}{180}%
|
||||||
|
#2%
|
||||||
|
\end{turn}}%
|
||||||
|
\ignorespaces}
|
||||||
|
|
||||||
|
|
||||||
% XXX need to do a caption block -- a cell to one side of an image to the
|
% XXX need to do a caption block -- a cell to one side of an image to the
|
||||||
@ -1840,7 +1897,6 @@
|
|||||||
%% Note that |layoutmode|'s other than block will change the paper size
|
%% Note that |layoutmode|'s other than block will change the paper size
|
||||||
%% but will not affect this.
|
%% but will not affect this.
|
||||||
%%
|
%%
|
||||||
% XXX
|
|
||||||
\newenvironment{pagecell}{%
|
\newenvironment{pagecell}{%
|
||||||
\begin{cell*}{\bleed,\bleed}{\pageblockwidth}{\pageblockheight}%
|
\begin{cell*}{\bleed,\bleed}{\pageblockwidth}{\pageblockheight}%
|
||||||
}{%
|
}{%
|
||||||
@ -1870,7 +1926,6 @@
|
|||||||
%% Note that |layoutmode|'s other than block will change the paper size
|
%% Note that |layoutmode|'s other than block will change the paper size
|
||||||
%% but will not affect this.
|
%% but will not affect this.
|
||||||
%%
|
%%
|
||||||
% XXX
|
|
||||||
\newenvironment{pagebleedcell}{%
|
\newenvironment{pagebleedcell}{%
|
||||||
\begin{cell*}{0mm, 0mm}{\bleedblockwidth}{\bleedblockheight}%
|
\begin{cell*}{0mm, 0mm}{\bleedblockwidth}{\bleedblockheight}%
|
||||||
}{%
|
}{%
|
||||||
@ -1878,16 +1933,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
% XXX EXPERIMENTAL
|
% XXX EXPERIMENTAL / TEST...
|
||||||
\NewEnviron{shipoutbgcell}{%
|
\NewEnviron{shipoutbgcell}{%
|
||||||
\AddToShipoutPictureBG*{%
|
\AddToShipoutPictureBG*{%
|
||||||
\begin{pagecell}%
|
\begin{pagecell}%
|
||||||
\BODY%
|
\BODY%
|
||||||
\end{pagecell}}}
|
\end{pagecell}}%
|
||||||
|
\ignorespaces}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
% XXX EXPERIMENTAL
|
% XXX EXPERIMENTAL / TEST...
|
||||||
%% \DescribeEnv{textcell}
|
%% \DescribeEnv{textcell}
|
||||||
%
|
%
|
||||||
%% A cell taking up the page text block.
|
%% A cell taking up the page text block.
|
||||||
@ -1912,7 +1968,6 @@
|
|||||||
%% Note that this is an inline cell and if something is on the page it
|
%% Note that this is an inline cell and if something is on the page it
|
||||||
%% may not be centered properly.
|
%% may not be centered properly.
|
||||||
%%
|
%%
|
||||||
% XXX test...
|
|
||||||
\newenvironment{textcell}{%
|
\newenvironment{textcell}{%
|
||||||
\begin{inlinecell*}{\textwidth}{\textheight}%
|
\begin{inlinecell*}{\textwidth}{\textheight}%
|
||||||
}{%
|
}{%
|
||||||
@ -1973,7 +2028,8 @@
|
|||||||
{\cellwidth}{\cellheight}%
|
{\cellwidth}{\cellheight}%
|
||||||
\end{pagecell}%
|
\end{pagecell}%
|
||||||
\clearpage}%
|
\clearpage}%
|
||||||
\endgroup}
|
\endgroup%
|
||||||
|
\ignorespaces}
|
||||||
|
|
||||||
|
|
||||||
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@ -1996,10 +2052,10 @@
|
|||||||
%% \end{verbatim}
|
%% \end{verbatim}
|
||||||
%% \end{minipage}
|
%% \end{minipage}
|
||||||
%%
|
%%
|
||||||
%
|
|
||||||
% XXX for some reason naming this anything starting with endpaper will
|
|
||||||
% make LaTeX complain that that is already defined...
|
|
||||||
|
|
||||||
|
% XXX for some reason naming these anything starting with endpaper will
|
||||||
|
% make LaTeX complain that that is already defined...
|
||||||
|
% ...collision with bools???
|
||||||
\newenvironment{leftside}{%
|
\newenvironment{leftside}{%
|
||||||
\begin{pagecell}%
|
\begin{pagecell}%
|
||||||
}{%
|
}{%
|
||||||
@ -2141,13 +2197,20 @@
|
|||||||
% - color...
|
% - color...
|
||||||
% XXX captions seem not to account for \imageblockoffsettop...
|
% XXX captions seem not to account for \imageblockoffsettop...
|
||||||
|
|
||||||
%\newcommand\captionsize{\scriptsize}
|
%% \DescribeMacro{\captionsize\{..\}}
|
||||||
\newcommand\captionsize{%
|
%
|
||||||
|
%% Defines the caption font setup macro
|
||||||
|
%%
|
||||||
|
\ResettableMacro{captionsize}{%
|
||||||
\fontsize{6.5pt}{8pt}\selectfont}
|
\fontsize{6.5pt}{8pt}\selectfont}
|
||||||
|
|
||||||
|
|
||||||
|
%% \DescribeMacro{\captionsize\{..\}}
|
||||||
|
%
|
||||||
|
%%
|
||||||
|
%%
|
||||||
% XXX move to a better location... (???)
|
% XXX move to a better location... (???)
|
||||||
\newcommand\captionformat[1]{%
|
\ResettableMacro{captionformat}[1]{%
|
||||||
\adjustbox{margin=0.1em 0.2em}{%
|
\adjustbox{margin=0.1em 0.2em}{%
|
||||||
\captionsize #1}}
|
\captionsize #1}}
|
||||||
|
|
||||||
@ -2200,8 +2263,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%----------------------------------------------------------------------
|
%----------------------------------------------------------------------
|
||||||
%%%% Page Templates
|
%%%% Page Templates
|
||||||
|
|
||||||
@ -2210,28 +2271,6 @@
|
|||||||
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
% meta-commands...
|
% meta-commands...
|
||||||
|
|
||||||
% \DescribeMacro{\ResettableMacro\{..\}}
|
|
||||||
%
|
|
||||||
% Create a resettable template command...
|
|
||||||
%
|
|
||||||
% >> \ResettableMacro{<name>}[<arg-count>]{<code>}
|
|
||||||
%
|
|
||||||
% Will define two commands:
|
|
||||||
%
|
|
||||||
% >> \<name>{..}
|
|
||||||
%
|
|
||||||
% >> \reset<name>
|
|
||||||
%
|
|
||||||
% |\<name>{..}| can be freely redefined or undefined by user.
|
|
||||||
%
|
|
||||||
% |\reset<name>| will reset |\<name>{..}| to its original state.
|
|
||||||
%
|
|
||||||
\def\ResettableMacro#1[#2]#3{%
|
|
||||||
\expandafter\newcommand\csname photobook@#1\endcsname[#2]{#3}%
|
|
||||||
\expandafter\newcommand\csname reset#1\endcsname{%
|
|
||||||
\expandafter\let\csname #1\expandafter\endcsname\csname photobook@#1\endcsname}
|
|
||||||
\csname reset#1\endcsname}
|
|
||||||
|
|
||||||
|
|
||||||
% \DescribeMacro{\ImagePageTemplate\{..\}}
|
% \DescribeMacro{\ImagePageTemplate\{..\}}
|
||||||
%
|
%
|
||||||
@ -2309,7 +2348,6 @@
|
|||||||
%
|
%
|
||||||
%% >> \resetimagepagecaption
|
%% >> \resetimagepagecaption
|
||||||
%%
|
%%
|
||||||
% XXX
|
|
||||||
\ResettableMacro{imagepagecaption}[1]{%
|
\ResettableMacro{imagepagecaption}[1]{%
|
||||||
\captioncell[under, align=flushright]{%
|
\captioncell[under, align=flushright]{%
|
||||||
\captionformat{#1}}}
|
\captionformat{#1}}}
|
||||||
@ -2364,6 +2402,12 @@
|
|||||||
%%
|
%%
|
||||||
%% |<options>| is the same as for |\imagecell{..}|.
|
%% |<options>| is the same as for |\imagecell{..}|.
|
||||||
%%
|
%%
|
||||||
|
%% Note that fit/fill versions are split mainly to provide ability to
|
||||||
|
%% configure the template defaults separately.
|
||||||
|
%%
|
||||||
|
%% Default image clearence (|clearimage| option value in |\imagecell{..}|)
|
||||||
|
%% is set by |\clearimage| global length.
|
||||||
|
%%
|
||||||
% XXX make captions adaptive???
|
% XXX make captions adaptive???
|
||||||
\ResettableMacro{imagepagefitcaption}[1]{%
|
\ResettableMacro{imagepagefitcaption}[1]{%
|
||||||
\captioncell[under, align=flushright]{%
|
\captioncell[under, align=flushright]{%
|
||||||
@ -2408,17 +2452,15 @@
|
|||||||
%%
|
%%
|
||||||
%% |<options>| is the same as for |\imagecell{..}|.
|
%% |<options>| is the same as for |\imagecell{..}|.
|
||||||
%%
|
%%
|
||||||
% XXX add a way to set this for one image...
|
%% Default image clearence (|clearimage| option value in |\imagecell{..}|)
|
||||||
|
%% is set by |\clearimage| global length.
|
||||||
|
%%
|
||||||
\ResettableMacro{imagepagefillcaption}[1]{%
|
\ResettableMacro{imagepagefillcaption}[1]{%
|
||||||
\captioncell[top, align=flushright]{%
|
\captioncell[top, align=flushright]{%
|
||||||
\captionformat{#1}}}
|
\captionformat{#1}}}
|
||||||
|
|
||||||
\ImagePageTemplate{imagepagefill}{%
|
\ImagePageTemplate{imagepagefill}{%
|
||||||
\begin{page}%
|
\imagepagefit*[fill, #1]{#2}{#3}}
|
||||||
\begin{pagecell}%
|
|
||||||
\imagecell[fill, clearance=\clearimage, #1]{#2}{#3}%
|
|
||||||
\end{pagecell}%
|
|
||||||
\end{page}}
|
|
||||||
|
|
||||||
|
|
||||||
% XXX
|
% XXX
|
||||||
@ -2460,8 +2502,8 @@
|
|||||||
\AtPageLowerLeft{
|
\AtPageLowerLeft{
|
||||||
\hspace*{\dimexpr \OFFSETFIX + #1 \relax}{
|
\hspace*{\dimexpr \OFFSETFIX + #1 \relax}{
|
||||||
\raisebox{\dimexpr #1 + \bleed \relax}{
|
\raisebox{\dimexpr #1 + \bleed \relax}{
|
||||||
\usebox\photobook@imagebox } } } }
|
\usebox\photobook@imagebox}}}}
|
||||||
\newpage }
|
\newpage}
|
||||||
|
|
||||||
|
|
||||||
% XXX
|
% XXX
|
||||||
@ -2989,16 +3031,14 @@
|
|||||||
|
|
||||||
% XXX should digits/rounding be configurable???
|
% XXX should digits/rounding be configurable???
|
||||||
\newcommand\photobook@TemplateCell[2][mm]{
|
\newcommand\photobook@TemplateCell[2][mm]{
|
||||||
% XXX this seems to be bigger than the size given...
|
|
||||||
%\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}%
|
\vspace{0pt}%
|
||||||
\end{center}}
|
\end{center}%
|
||||||
%\end{center} }} }
|
\ignorespaces}
|
||||||
|
|
||||||
|
|
||||||
%% \DescribeMacro{\GenerateTemplate\{..\}}
|
%% \DescribeMacro{\GenerateTemplate\{..\}}
|
||||||
@ -3018,8 +3058,7 @@
|
|||||||
%% This is a no-op for |layoutmode=block|.
|
%% This is a no-op for |layoutmode=block|.
|
||||||
%%
|
%%
|
||||||
\newcommand\GenerateTemplate[1][mm]{
|
\newcommand\GenerateTemplate[1][mm]{
|
||||||
% 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...
|
||||||
@ -3042,12 +3081,12 @@
|
|||||||
\end{backcover}\fi%
|
\end{backcover}\fi%
|
||||||
\ifjacketlayout%
|
\ifjacketlayout%
|
||||||
\begin{frontflap}%
|
\begin{frontflap}%
|
||||||
\photobook@TemplateCell[#1]{FRONT FLAP}%
|
\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}\fi%
|
\end{backflap}\fi%
|
||||||
\end{page} }
|
\end{page}}
|
||||||
|
|
||||||
|
|
||||||
%% \DescribeMacro{\pdfpagecount\{..\}}
|
%% \DescribeMacro{\pdfpagecount\{..\}}
|
||||||
@ -3056,13 +3095,13 @@
|
|||||||
%%
|
%%
|
||||||
%% >> \pdfpagecount{<file.pdf>}
|
%% >> \pdfpagecount{<file.pdf>}
|
||||||
%%
|
%%
|
||||||
\newcommand\pdfpagecount[1]{
|
\newcommand\pdfpagecount[1]{%
|
||||||
\ifpdftex
|
\ifpdftex%
|
||||||
\pdfximage{#1}
|
\pdfximage{#1}%
|
||||||
\number\pdflastximagepages%
|
\number\pdflastximagepages%
|
||||||
\else\ifxetex
|
\else\ifxetex%
|
||||||
\number\XeTeXpdfpagecount"#1"%
|
\number\XeTeXpdfpagecount"#1"%
|
||||||
\else\ifluatex
|
\else\ifluatex%
|
||||||
\number\directlua{%
|
\number\directlua{%
|
||||||
local pages = 0
|
local pages = 0
|
||||||
local doc = pdfe.open("\luaescapestring{#1}")
|
local doc = pdfe.open("\luaescapestring{#1}")
|
||||||
@ -3070,7 +3109,7 @@
|
|||||||
pages = pdfe.getnofpages(doc)
|
pages = pdfe.getnofpages(doc)
|
||||||
pdfe.close(doc)
|
pdfe.close(doc)
|
||||||
end
|
end
|
||||||
tex.write(pages) } \fi\fi }
|
tex.write(pages) }\fi\fi}
|
||||||
|
|
||||||
|
|
||||||
%% \DescribeMacro{\pdfspinewidth\{..\}}
|
%% \DescribeMacro{\pdfspinewidth\{..\}}
|
||||||
@ -3083,8 +3122,8 @@
|
|||||||
\newcommand\pdfspinewidth[3]{%
|
\newcommand\pdfspinewidth[3]{%
|
||||||
\setlength\spinewidth{\dimexpr
|
\setlength\spinewidth{\dimexpr
|
||||||
(#1 mm) * \numexpr \pdfpagecount{#3} / 2 \relax
|
(#1 mm) * \numexpr \pdfpagecount{#3} / 2 \relax
|
||||||
+ ((#2 mm) * 2)
|
+ ((#2 mm) * 2)
|
||||||
\relax} }
|
\relax}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,13 @@
|
|||||||
9pt,final,openany
|
9pt,final,openany
|
||||||
]{photobook}
|
]{photobook}
|
||||||
|
|
||||||
|
\setlength\parindent{0pt}
|
||||||
|
|
||||||
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
@ -20,8 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
%\imagepage*{moo}{DSC00403-2}
|
%\imagepage*{moo}{DSC00403-2}
|
||||||
|
%\imagepage{moo}{DSC00403-2}
|
||||||
\imagepage{moo}{DSC00403-2}
|
|
||||||
|
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user