mirror of
https://github.com/flynx/photobook.git
synced 2025-12-17 00:51:39 +00:00
almost done with foldouts, only panel width offsets left...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ee49355fde
commit
4e0919c332
@ -46,11 +46,38 @@
|
|||||||
|
|
||||||
\begin{foldout}[3]
|
\begin{foldout}[3]
|
||||||
count
|
count
|
||||||
|
\begin{foldoutcell}[2]
|
||||||
|
\lipsum
|
||||||
|
\lipsum
|
||||||
|
\lipsum
|
||||||
|
\end{foldoutcell}
|
||||||
|
\newpage
|
||||||
|
\begin{foldoutcell*}[1]
|
||||||
|
\lipsum
|
||||||
|
\lipsum
|
||||||
|
\lipsum
|
||||||
|
\end{foldoutcell*}
|
||||||
|
\begin{foldoutcell*}[2]
|
||||||
|
\begin{cliptocell}
|
||||||
|
\begin{bottomup}
|
||||||
|
\lipsum
|
||||||
|
\lipsum
|
||||||
|
\lipsum
|
||||||
|
\end{bottomup}
|
||||||
|
\end{cliptocell}
|
||||||
|
\end{foldoutcell*}
|
||||||
|
% XXX too much goes into right bleed...
|
||||||
|
\begin{foldoutcell*}[3]
|
||||||
|
\lipsum
|
||||||
|
\lipsum
|
||||||
|
\lipsum
|
||||||
|
\end{foldoutcell*}
|
||||||
\end{foldout}
|
\end{foldout}
|
||||||
|
|
||||||
\begin{foldout}[in]
|
\begin{foldout}[in]
|
||||||
in
|
in
|
||||||
\end{foldout}
|
\end{foldout}
|
||||||
|
|
||||||
%
|
%
|
||||||
%\ImagePageFill{\PageInfo}{\TestImage}
|
%\ImagePageFill{\PageInfo}{\TestImage}
|
||||||
%
|
%
|
||||||
|
|||||||
176
photobook.cls
176
photobook.cls
@ -2873,6 +2873,7 @@
|
|||||||
\newlength\clearfoldoutedge
|
\newlength\clearfoldoutedge
|
||||||
\setlength\clearfoldoutedge{1mm}
|
\setlength\clearfoldoutedge{1mm}
|
||||||
|
|
||||||
|
\def\foldoutcellfolds{}
|
||||||
\def\foldoutcellwidths{}
|
\def\foldoutcellwidths{}
|
||||||
|
|
||||||
% XXX length or command???
|
% XXX length or command???
|
||||||
@ -2882,42 +2883,51 @@
|
|||||||
\foldmarkstrue
|
\foldmarkstrue
|
||||||
|
|
||||||
|
|
||||||
% XXX make this a box... (???)
|
% XXX make this a tikz... (???)
|
||||||
|
% XXX should we replace in/out text with something like v and ^ ???
|
||||||
|
\newif\ifphotobook@foldmark@in
|
||||||
\newcommand\photobook@foldmark[3][\foldoutfold]{%
|
\newcommand\photobook@foldmark[3][\foldoutfold]{%
|
||||||
|
\begingroup%
|
||||||
|
\ifnumodd{\thepage}{%
|
||||||
|
\ifthenelse{\equal{#1}{in}}{%
|
||||||
|
\photobook@foldmark@intrue}{%
|
||||||
|
\photobook@foldmark@infalse}}{%
|
||||||
|
\ifthenelse{\equal{#1}{in}}{%
|
||||||
|
\photobook@foldmark@infalse}{%
|
||||||
|
\photobook@foldmark@intrue}}%
|
||||||
\begin{textblock*}{0pt}(#3)%
|
\begin{textblock*}{0pt}(#3)%
|
||||||
\setlength{\unitlength}{1mm}%
|
\setlength{\unitlength}{1mm}%
|
||||||
\begin{picture}(0, 0)(0,0)%
|
\begin{picture}(0, 0)(0,0)%
|
||||||
\thicklines
|
|
||||||
\color{white}
|
\color{white}
|
||||||
|
\thicklines
|
||||||
\put(0,0){\line(0,#2){4}}
|
\put(0,0){\line(0,#2){4}}
|
||||||
\ifnumodd{\thepage}{%
|
|
||||||
\put(0, \numexpr #2 / 2 \relax){%
|
\put(0, \numexpr #2 / 2 \relax){%
|
||||||
\ifthenelse{\equal{#1}{in}}{%
|
\circle*{1.5}}
|
||||||
\circle{1.5}
|
\ifphotobook@foldmark@in
|
||||||
}{%
|
\put(1.5, \numexpr #2 / 2 - 1 \relax){\vee}
|
||||||
\circle*{1.5}}}
|
\else
|
||||||
\put(1.5, \numexpr #2 / 2 - 1 \relax){#1}}{}
|
\put(1.5, \numexpr #2 / 2 - 1 \relax){\wedge}\fi
|
||||||
\thinlines
|
|
||||||
\color{black}
|
\color{black}
|
||||||
|
\thinlines
|
||||||
\put(0,0){\line(0,#2){4}}
|
\put(0,0){\line(0,#2){4}}
|
||||||
\ifnumodd{\thepage}{%
|
|
||||||
\put(0, \numexpr #2 / 2 \relax){%
|
\put(0, \numexpr #2 / 2 \relax){%
|
||||||
\ifthenelse{\equal{#1}{in}}{%
|
\ifphotobook@foldmark@in
|
||||||
\circle{1.5}
|
\circle{1.5}
|
||||||
}{%
|
\else
|
||||||
\circle*{1.5}}}
|
\circle*{1.5}\fi}
|
||||||
\put(1.5,\numexpr #2 / 2 - 1 \relax){#1}}{}
|
\ifphotobook@foldmark@in
|
||||||
|
\put(1.5, \numexpr #2 / 2 - 1 \relax){\vee}
|
||||||
|
\else
|
||||||
|
\put(1.5, \numexpr #2 / 2 - 1 \relax){\wedge}\fi
|
||||||
\end{picture}
|
\end{picture}
|
||||||
\end{textblock*}}
|
\end{textblock*}%
|
||||||
|
\endgroup}
|
||||||
\newcommand\photobook@topfoldmark[2][in]{%
|
\newcommand\photobook@topfoldmark[2][in]{%
|
||||||
\photobook@foldmark[#1]{3}{#2}}
|
\photobook@foldmark[#1]{3}{#2}}
|
||||||
\newcommand\photobook@bottomfoldmark[2][in]{%
|
\newcommand\photobook@bottomfoldmark[2][in]{%
|
||||||
\photobook@foldmark[#1]{-3}{#2}}
|
\photobook@foldmark[#1]{-3}{#2}}
|
||||||
% XXX also add this to jacket/cover...
|
|
||||||
% XXX test position correctness...
|
|
||||||
% >> \photobook@markfold[<fold>]{<offset>}
|
% >> \photobook@markfold[<fold>]{<offset>}
|
||||||
\newcommand\photobook@markfold[2][in]{%
|
\newcommand\photobook@markfold[2][in]{%
|
||||||
\iffoldmarks%
|
|
||||||
\photobook@topfoldmark[#1]{
|
\photobook@topfoldmark[#1]{
|
||||||
#2,
|
#2,
|
||||||
\bleed
|
\bleed
|
||||||
@ -2926,7 +2936,7 @@
|
|||||||
#2,
|
#2,
|
||||||
\blockheight
|
\blockheight
|
||||||
+ \bleed
|
+ \bleed
|
||||||
+ \foldmarkoffset}\fi}
|
+ \foldmarkoffset}}
|
||||||
|
|
||||||
% >> \photobook@setfoldoutoffset{<name>}{<from>}{<to>}
|
% >> \photobook@setfoldoutoffset{<name>}{<from>}{<to>}
|
||||||
% XXX doc [from, to[
|
% XXX doc [from, to[
|
||||||
@ -2944,11 +2954,6 @@
|
|||||||
\csname #1\endcsname%
|
\csname #1\endcsname%
|
||||||
+ \foldoutcellwidths[##1]}}\fi}
|
+ \foldoutcellwidths[##1]}}\fi}
|
||||||
|
|
||||||
% XXX new arg syntax:
|
|
||||||
% <num> -- number of panels
|
|
||||||
% in|out ... -- fold direction
|
|
||||||
% <dim> in|out <dim> ...
|
|
||||||
% -- fold direction with panel widths
|
|
||||||
\newlength\photobook@foldout@panelwidth
|
\newlength\photobook@foldout@panelwidth
|
||||||
\setlength\photobook@foldout@panelwidth{0pt}
|
\setlength\photobook@foldout@panelwidth{0pt}
|
||||||
\newlength\photobook@foldout@maxpanelwidth
|
\newlength\photobook@foldout@maxpanelwidth
|
||||||
@ -2956,6 +2961,7 @@
|
|||||||
\edef\photobook@foldout@count{}
|
\edef\photobook@foldout@count{}
|
||||||
\edef\photobook@foldout@prevfold{in}
|
\edef\photobook@foldout@prevfold{in}
|
||||||
|
|
||||||
|
% >> \photobook@foldout@pushpanel{<width>}{<fold>}
|
||||||
% XXX setup numbers...
|
% XXX setup numbers...
|
||||||
\newcommand\photobook@foldout@pushpanel[2]{%
|
\newcommand\photobook@foldout@pushpanel[2]{%
|
||||||
% use default width....
|
% use default width....
|
||||||
@ -2981,26 +2987,43 @@
|
|||||||
\setlength\foldoutwidth{
|
\setlength\foldoutwidth{
|
||||||
\foldoutwidth
|
\foldoutwidth
|
||||||
+ \photobook@foldout@panelwidth}%
|
+ \photobook@foldout@panelwidth}%
|
||||||
% panel widths list...
|
% panel spec lists...
|
||||||
|
\edef\foldoutcellfolds{%
|
||||||
|
\foldoutcellfolds,#2}%
|
||||||
\edef\foldoutcellwidths{%
|
\edef\foldoutcellwidths{%
|
||||||
\foldoutcellwidths,\the\photobook@foldout@panelwidth}}
|
\foldoutcellwidths,\the\photobook@foldout@panelwidth}}
|
||||||
|
|
||||||
% XXX need to iterate through \foldoutcellwidths...
|
% XXX FOLDMARK...
|
||||||
%\edef\photobook@foldout@showmarks{}
|
% XXX also add this to jacket/cover...
|
||||||
%\newcommand\photobook@foldout@mark[1]{
|
\newlength\photobook@showmarks@offset
|
||||||
% \edef\photobook@foldout@showmarks{%
|
\setlength\photobook@showmarks@offset{0pt}
|
||||||
% \photobook@foldout@showmarks%
|
|
||||||
% \photobook@markfold[\photobook@foldout@prevfold]{#1}}}
|
|
||||||
|
|
||||||
% XXX this should be run after each page...
|
|
||||||
\newcommand\photobook@showmarks{%
|
\newcommand\photobook@showmarks{%
|
||||||
\ifx \foldoutcellwidths \empty \else%
|
\ifx \foldoutcellwidths \empty \else%
|
||||||
\foreachitem \photobook@showmarks@width \in \foldoutcellwidths{%
|
\begingroup%
|
||||||
% XXX
|
\setlength\photobook@showmarks@offset{\bleed}%
|
||||||
}\fi}
|
% NOTE: we need to iterate left/right pages in reverse order...
|
||||||
|
% NOTE: the below branches are similar but not identical...
|
||||||
|
\ifnumodd{\thepage}{%
|
||||||
|
\xintFor* ##1 in {\xintSeq{1}{\foldoutcellwidthslen - 1}} \do {%
|
||||||
|
\setlength\photobook@showmarks@offset{
|
||||||
|
\photobook@showmarks@offset
|
||||||
|
+ \foldoutcellwidths[##1]}%
|
||||||
|
% XXX HACK: it appears that we can't expand \foldoutcellfolds[##1] in [..]...
|
||||||
|
\edef\photobook@showmarks@tmp{\foldoutcellfolds[##1]}%
|
||||||
|
\photobook@markfold[\photobook@showmarks@tmp]{\photobook@showmarks@offset}}%
|
||||||
|
}{
|
||||||
|
\xintFor* ##1 in {\xintSeq{\foldoutcellwidthslen}{2}} \do {%
|
||||||
|
\setlength\photobook@showmarks@offset{
|
||||||
|
\photobook@showmarks@offset
|
||||||
|
+ \foldoutcellwidths[##1]}%
|
||||||
|
% XXX HACK: it appears that we can't expand \foldoutcellfolds[##1] in [..]...
|
||||||
|
\edef\photobook@showmarks@tmp{\foldoutcellfolds[##1 - 1]}%
|
||||||
|
\photobook@markfold[\photobook@showmarks@tmp]{\photobook@showmarks@offset}}}%
|
||||||
|
\endgroup\fi}
|
||||||
|
\AtBeginShipout{%
|
||||||
|
\iffoldmarks%
|
||||||
|
\photobook@showmarks\fi}
|
||||||
|
|
||||||
% XXX mark folds on every page...
|
|
||||||
% XXX need to set marks on top of all other content -- create them last/at shipout?
|
|
||||||
% XXX in/out branches are identical -- unify...
|
% XXX in/out branches are identical -- unify...
|
||||||
\newenvironment{foldout}[1][\foldoutspec]{%
|
\newenvironment{foldout}[1][\foldoutspec]{%
|
||||||
\begingroup%
|
\begingroup%
|
||||||
@ -3029,11 +3052,7 @@
|
|||||||
% build the panels...
|
% build the panels...
|
||||||
\xintFor* ##1 in {\xintSeq{1}{\photobook@foldout@count}} \do {%
|
\xintFor* ##1 in {\xintSeq{1}{\photobook@foldout@count}} \do {%
|
||||||
\photobook@foldout@pushpanel{%
|
\photobook@foldout@pushpanel{%
|
||||||
0pt}{\photobook@foldout@prevfold}%
|
0pt}{\photobook@foldout@prevfold}}%
|
||||||
% skip for last panel...
|
|
||||||
\ifnum \photobook@foldout@count = ##1 \else%
|
|
||||||
%\photobook@foldout@mark{\foldoutwidth}\fi}%
|
|
||||||
\photobook@markfold[\photobook@foldout@prevfold]{\foldoutwidth}\fi}%
|
|
||||||
% fold spec...
|
% fold spec...
|
||||||
\else%
|
\else%
|
||||||
\foreachitem \photobook@foldout@opt \in \photobook@foldout@args{%
|
\foreachitem \photobook@foldout@opt \in \photobook@foldout@args{%
|
||||||
@ -3045,8 +3064,6 @@
|
|||||||
\edef\photobook@foldout@prevfold{%
|
\edef\photobook@foldout@prevfold{%
|
||||||
\photobook@foldout@opt}%
|
\photobook@foldout@opt}%
|
||||||
\setlength\photobook@foldout@panelwidth{0pt}%
|
\setlength\photobook@foldout@panelwidth{0pt}%
|
||||||
%\photobook@foldout@mark{\foldoutwidth}%
|
|
||||||
\photobook@markfold[\photobook@foldout@prevfold]{\foldoutwidth}%
|
|
||||||
% out...
|
% out...
|
||||||
}{\ifthenelse{\equal{\photobook@foldout@opt}{out}}{%
|
}{\ifthenelse{\equal{\photobook@foldout@opt}{out}}{%
|
||||||
\photobook@foldout@pushpanel{%
|
\photobook@foldout@pushpanel{%
|
||||||
@ -3055,16 +3072,12 @@
|
|||||||
\edef\photobook@foldout@prevfold{%
|
\edef\photobook@foldout@prevfold{%
|
||||||
\photobook@foldout@opt}%
|
\photobook@foldout@opt}%
|
||||||
\setlength\photobook@foldout@panelwidth{0pt}%
|
\setlength\photobook@foldout@panelwidth{0pt}%
|
||||||
%\photobook@foldout@mark{\foldoutwidth}%
|
|
||||||
\photobook@markfold[\photobook@foldout@prevfold]{\foldoutwidth}%
|
|
||||||
% explicit size...
|
% explicit size...
|
||||||
}{%
|
}{%
|
||||||
% finalize prev panel...
|
% finalize prev panel...
|
||||||
\ifdim \photobook@foldout@panelwidth > 0pt%
|
\ifdim \photobook@foldout@panelwidth > 0pt%
|
||||||
\photobook@foldout@pushpanel{%
|
\photobook@foldout@pushpanel{%
|
||||||
\photobook@foldout@panelwidth}{\photobook@foldout@prevfold}%
|
\photobook@foldout@panelwidth}{\photobook@foldout@prevfold}\fi%
|
||||||
%\photobook@foldout@mark{\foldoutwidth}\fi%
|
|
||||||
\photobook@markfold[\photobook@foldout@prevfold]{\foldoutwidth}\fi%
|
|
||||||
%
|
%
|
||||||
% XXX need to disable clearences here...
|
% XXX need to disable clearences here...
|
||||||
\setlength\photobook@foldout@panelwidth{\photobook@foldout@opt}}}}%
|
\setlength\photobook@foldout@panelwidth{\photobook@foldout@opt}}}}%
|
||||||
@ -3072,6 +3085,12 @@
|
|||||||
\photobook@foldout@pushpanel{%
|
\photobook@foldout@pushpanel{%
|
||||||
\photobook@foldout@panelwidth}{\photobook@foldout@prevfold}%
|
\photobook@foldout@panelwidth}{\photobook@foldout@prevfold}%
|
||||||
\fi%
|
\fi%
|
||||||
|
\setsepchar{,}%
|
||||||
|
% NOTE: the first element is empty due to how we create these
|
||||||
|
% i.e. ('' + ',<value>')...
|
||||||
|
\ignoreemptyitems%
|
||||||
|
\readlist*\foldoutcellfolds{\foldoutcellfolds}%
|
||||||
|
\readlist*\foldoutcellwidths{\foldoutcellwidths}%
|
||||||
%
|
%
|
||||||
% pages...
|
% pages...
|
||||||
% NOTE: we'll keep the start of the foldout set at the right page
|
% NOTE: we'll keep the start of the foldout set at the right page
|
||||||
@ -3086,6 +3105,7 @@
|
|||||||
|
|
||||||
|
|
||||||
%% \DescribeEnv{foldoutcell}
|
%% \DescribeEnv{foldoutcell}
|
||||||
|
%% \DescribeEnv{foldoutcell*}
|
||||||
%
|
%
|
||||||
%% \EXPERIMENTAL
|
%% \EXPERIMENTAL
|
||||||
%%
|
%%
|
||||||
@ -3094,6 +3114,9 @@
|
|||||||
%% >> \begin{foldoutcell} ... \end{foldoutcell}
|
%% >> \begin{foldoutcell} ... \end{foldoutcell}
|
||||||
%% >> \begin{foldoutcell}[<num>] ... \end{foldoutcell}
|
%% >> \begin{foldoutcell}[<num>] ... \end{foldoutcell}
|
||||||
%% >> \begin{foldoutcell}[<from>-<to>] ... \end{foldoutcell}
|
%% >> \begin{foldoutcell}[<from>-<to>] ... \end{foldoutcell}
|
||||||
|
%
|
||||||
|
%% |foldoutcell*| is the same as the non-star version but creates cells
|
||||||
|
%% including bleeds.
|
||||||
%%
|
%%
|
||||||
\newlength\photobook@foldoutcell@left
|
\newlength\photobook@foldoutcell@left
|
||||||
\setlength\photobook@foldoutcell@left{0pt}
|
\setlength\photobook@foldoutcell@left{0pt}
|
||||||
@ -3102,8 +3125,8 @@
|
|||||||
|
|
||||||
% XXX doc [from, to]
|
% XXX doc [from, to]
|
||||||
% XXX if no args are given, should this auto-advance???
|
% XXX if no args are given, should this auto-advance???
|
||||||
% XXX need to clip left/right of all but first/last panels...
|
|
||||||
% XXX this can't be used outside of a foldout...
|
% XXX this can't be used outside of a foldout...
|
||||||
|
% XXX should these clip???
|
||||||
\newenvironment{foldoutcell}[1][1]{%
|
\newenvironment{foldoutcell}[1][1]{%
|
||||||
\begingroup%
|
\begingroup%
|
||||||
\setsepchar{-}%
|
\setsepchar{-}%
|
||||||
@ -3123,15 +3146,62 @@
|
|||||||
\setlength\photobook@foldoutcell@width{%
|
\setlength\photobook@foldoutcell@width{%
|
||||||
\foldoutcellwidths[{\photobook@foldoutcell@panels[1]}]}\fi%
|
\foldoutcellwidths[{\photobook@foldoutcell@panels[1]}]}\fi%
|
||||||
%
|
%
|
||||||
% XXX need to clip bleeds on left (except panel 1) and right (except panel -1)...
|
|
||||||
\begin{cell*}{%
|
\begin{cell*}{%
|
||||||
\photobook@foldoutcell@left,%
|
\bleed
|
||||||
|
+ \photobook@foldoutcell@left,%
|
||||||
\bleed}%
|
\bleed}%
|
||||||
{\photobook@foldoutcell@width}%
|
{\photobook@foldoutcell@width}%
|
||||||
{\pageblockheight}%
|
{\pageblockheight}%
|
||||||
}{%
|
}{%
|
||||||
\end{cell*}%
|
\end{cell*}%
|
||||||
\endgroup}
|
\endgroup}
|
||||||
|
% bleed version...
|
||||||
|
\newenvironment{foldoutcell*}[1][1]{%
|
||||||
|
\begingroup%
|
||||||
|
\setsepchar{-}%
|
||||||
|
\readlist*\photobook@foldoutcell@panels{#1}%
|
||||||
|
% left offset...
|
||||||
|
\photobook@setfoldoutoffset{photobook@foldoutcell@left}{%
|
||||||
|
1
|
||||||
|
}{%
|
||||||
|
\photobook@foldoutcell@panels[1]}%
|
||||||
|
% panel width...
|
||||||
|
\ifnum \photobook@foldoutcell@panelslen > 1%
|
||||||
|
\photobook@setfoldoutoffset{photobook@foldoutcell@width}{%
|
||||||
|
\photobook@foldoutcell@panels[1]%
|
||||||
|
}{%
|
||||||
|
\photobook@foldoutcell@panels[2] + 1}%
|
||||||
|
% add bleed to last panel...
|
||||||
|
\ifnum \photobook@foldoutcell@panels[2] = \foldoutcellwidthslen%
|
||||||
|
\setlength\photobook@foldoutcell@width{%
|
||||||
|
\bleed
|
||||||
|
+ \photobook@foldoutcell@width}\fi%
|
||||||
|
\else%
|
||||||
|
\setlength\photobook@foldoutcell@width{%
|
||||||
|
\foldoutcellwidths[{\photobook@foldoutcell@panels[1]}]}
|
||||||
|
\fi%
|
||||||
|
% add bleed to first/last panel...
|
||||||
|
\ifnum \photobook@foldoutcell@panels[1] = 1%
|
||||||
|
\setlength\photobook@foldoutcell@width{%
|
||||||
|
\bleed
|
||||||
|
+ \photobook@foldoutcell@width}
|
||||||
|
\else%
|
||||||
|
\setlength\photobook@foldoutcell@left{%
|
||||||
|
\bleed
|
||||||
|
+ \photobook@foldoutcell@left}\fi%
|
||||||
|
\ifnum \photobook@foldoutcell@panels[1] = \foldoutcellwidthslen%
|
||||||
|
\setlength\photobook@foldoutcell@width{%
|
||||||
|
\bleed
|
||||||
|
+ \photobook@foldoutcell@width}\fi%
|
||||||
|
%
|
||||||
|
\begin{cell*}{%
|
||||||
|
\photobook@foldoutcell@left,%
|
||||||
|
0pt}%
|
||||||
|
{\photobook@foldoutcell@width}%
|
||||||
|
{\pageblockheight + 2\bleed}%
|
||||||
|
}{%
|
||||||
|
\end{cell*}%
|
||||||
|
\endgroup}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user