2021-08-08 01:54:37 +03:00
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%
|
|
|
|
|
%
|
|
|
|
|
% This does the following:
|
|
|
|
|
% - sets up the document/pdf for viewing as a book
|
|
|
|
|
% - adds support for page bleeds
|
|
|
|
|
% - adds basic templates for image pages (XXX)
|
|
|
|
|
%
|
|
|
|
|
%
|
|
|
|
|
% XXX BUG: fix \OFFSETFIX
|
|
|
|
|
% XXX BUG: fix \CAPTIONWIDTHFIX
|
|
|
|
|
% XXX BUG: there seems to be a slight offset bias...
|
|
|
|
|
%
|
|
|
|
|
% XXX might be a good idea to add a spine calculator...
|
|
|
|
|
%
|
|
|
|
|
%----------------------------------------------------------------------
|
2021-08-10 06:14:42 +03:00
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%%% NOTE: \def\<module-name>@[A-Z]+ macros will be visible to both the
|
|
|
|
|
%%% code and the generated docs...
|
2021-08-10 06:14:42 +03:00
|
|
|
\def\photobook@FILEVERSION{v0.1}
|
|
|
|
|
\def\photobook@FILEDATE{2021-07-28}
|
|
|
|
|
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \documentclass{ltxdoc}
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \usepackage[a4paper,margin=25mm,left=55mm,nohead]{geometry}
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \usepackage[numbered]{hypdoc}
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \usepackage{doctools}
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%%% \newcommand\DescribeGlobal[1]{%
|
|
|
|
|
%%% \DescribeMacro{#1}}
|
|
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
|
|
|
|
%% \begin{document}
|
|
|
|
|
%%
|
2021-08-10 06:14:42 +03:00
|
|
|
%% \title{\textsf{photobook} --- Document class for building photo-books
|
|
|
|
|
%% \thanks{This file describes version \FILEVERSION,
|
|
|
|
|
%% last revised \FILEDATE.}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
|
|
|
|
%% \author{Alex A. Naanou\thanks{E-mail: alex.nanou@gmail.com}}
|
|
|
|
|
%%
|
2021-08-10 06:14:42 +03:00
|
|
|
%% \date{Released \FILEDATE}
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
|
|
|
|
%% \maketitle
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \fbox{\bf%
|
2021-08-12 17:00:23 +03:00
|
|
|
%% Note: all older templates/commnads/macros will get reworked soon! }
|
2021-08-08 14:07:52 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%%%% Usage
|
2021-08-12 17:00:23 +03:00
|
|
|
%
|
2021-08-08 01:54:37 +03:00
|
|
|
%% >> \documentclass[<options>]{photobook}
|
|
|
|
|
%%
|
|
|
|
|
%
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
\NeedsTeXFormat{LaTeX2e}
|
|
|
|
|
|
2021-08-10 06:14:42 +03:00
|
|
|
\ProvidesClass{photobook}
|
|
|
|
|
[\photobook@FILEDATE \space \photobook@FILEVERSION Photo book document class]
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%% Options
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
|
|
\RequirePackage{kvoptions}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
% Helpers...
|
|
|
|
|
|
|
|
|
|
\newcommand\@DeclareLiteralOptionTo[2]{%
|
|
|
|
|
\DeclareVoidOption{#2}{%
|
|
|
|
|
\expandafter\edef\csname photobook@#1\endcsname{#2}}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2021-08-08 12:16:50 +03:00
|
|
|
%%%%% Page geometry
|
|
|
|
|
%
|
|
|
|
|
%% \DescribeMacro{blockwidth=<len>}
|
|
|
|
|
%% \DescribeMacro{blockheight=<len>}
|
|
|
|
|
%% \DescribeMacro{bindingoffset=<len>}
|
|
|
|
|
%% \DescribeMacro{bleed=<len>}
|
|
|
|
|
%
|
|
|
|
|
%% This is similar to what |geometry| does, but adds bleed support.
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% <---> bleed <---> bleed
|
|
|
|
|
%%
|
|
|
|
|
%% + - - - - - - - - - - - - - - - - - - - - - + - + ^
|
|
|
|
|
%% . . . | bleed
|
|
|
|
|
%% . +---------------------------------------+----- v . . ---
|
|
|
|
|
%% . | ^ . = .
|
|
|
|
|
%% . | . . . . . . | . . = . ^
|
|
|
|
|
%% . |<-- blockwidth ----------------------->= . |
|
|
|
|
|
%% . | . | . . = . |
|
|
|
|
|
%% . | | . = . textheight
|
|
|
|
|
%% . | . | . . = . |
|
|
|
|
|
%% . | blockheight . = . |
|
|
|
|
|
%% . | . | . . = . |
|
|
|
|
|
%% . | | <---> bindingoffset |
|
|
|
|
|
%% . | . . . . . . | . . = . v
|
|
|
|
|
%% . | v . = .
|
|
|
|
|
%% . +---------------------------------------+----- ^ . . ---
|
|
|
|
|
%% . . . . | bleed
|
|
|
|
|
%% + - - - - - - - - - - - - - - - - - - - - - + - + v
|
|
|
|
|
%% . .
|
|
|
|
|
%% | <-- textwidth --------------> . |
|
|
|
|
|
%% ^ binding line
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%
|
|
|
|
|
% NOTE: if blockwidth/blockheight are set they will force recalculations
|
|
|
|
|
% and overriding of the paperwidth/paperheight if they were changed
|
|
|
|
|
% by the user code anywhere between \documentclass[..]{photobook}
|
|
|
|
|
% and \begin{document}...
|
|
|
|
|
\DeclareStringOption{blockwidth}
|
|
|
|
|
\DeclareStringOption{blockheight}
|
2021-08-20 16:57:00 +03:00
|
|
|
\DeclareStringOption[0pt]{bindingoffset}[10mm]
|
2021-08-08 12:16:50 +03:00
|
|
|
\DeclareStringOption[5mm]{bleed}[5mm]
|
|
|
|
|
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
%%%%% layout
|
|
|
|
|
%
|
|
|
|
|
%% \DescribeMacro{layoutmode=<layout>}
|
|
|
|
|
%% \DescribeMacro{block}
|
|
|
|
|
%% \DescribeMacro{endpaper}
|
|
|
|
|
%% \DescribeMacro{cover}
|
|
|
|
|
%% \DescribeMacro{jacket}
|
|
|
|
|
%%
|
|
|
|
|
%% >> layoutmode=<option>
|
|
|
|
|
%%
|
|
|
|
|
%% |block| (default)
|
|
|
|
|
%%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% Basic page layout.
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \begin{verbatim}
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%% blockwidth
|
|
|
|
|
%% <--------------->
|
|
|
|
|
%%
|
|
|
|
|
%% +---------------+
|
|
|
|
|
%% | |
|
|
|
|
|
%% | |
|
|
|
|
|
%% | |
|
|
|
|
|
%% | |
|
|
|
|
|
%% | |
|
|
|
|
|
%% +---------------+
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \end{verbatim}
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \end{minipage}
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
|
|
|
|
%%
|
|
|
|
|
%% |endpaper|:
|
|
|
|
|
%%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% Endpaper layout.
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \begin{verbatim}
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%% blockwidth 2x
|
|
|
|
|
%% <------------------------------->
|
|
|
|
|
%%
|
|
|
|
|
%% +---------------+---------------+
|
|
|
|
|
%% | . |
|
|
|
|
|
%% | . |
|
|
|
|
|
%% | . |
|
|
|
|
|
%% | . |
|
|
|
|
|
%% | . |
|
|
|
|
|
%% +---------------+---------------+
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \end{verbatim}
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \end{minipage}
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
|
|
|
|
%%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% |cover|
|
|
|
|
|
%%
|
|
|
|
|
%% Book cover layout
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \DescribeMacro{coverboardgrow=<len>}
|
|
|
|
|
%% \DescribeMacro{coverflap=<len>}
|
|
|
|
|
%% \DescribeMacro{spinewidth=<len>}
|
|
|
|
|
%% \DescribeMacro{spinewidth=<len>}
|
|
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \begin{verbatim}
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%% blockwidth blockwidth
|
|
|
|
|
%% <---------------> <--------------->
|
|
|
|
|
%% <-> coverboardgrow <-> coverboardgrow
|
|
|
|
|
%% <-> coverflap . <-> coverflap
|
|
|
|
|
%% . . . . . .
|
|
|
|
|
%% +-------------------++---++-------------------+ ---
|
|
|
|
|
%% | + - - - - - - - - ++ - ++ - - - - - - - - + | --^ coverflap
|
|
|
|
|
%% | . + - - - - - - - ++ - ++ - - - - - - - + . | --^ coverboardgrow
|
|
|
|
|
%% | . . .. .. . . | ^
|
|
|
|
|
%% | . . .. .. . . | | blockheight
|
|
|
|
|
%% | . . Back .. .. Front . . | |
|
|
|
|
|
%% | . . .. .. . . | |
|
|
|
|
|
%% | . . .. .. . . | v
|
|
|
|
|
%% | . + - - - - - - - ++ - ++ - - - - - - - + . | --v coverboardgrow
|
|
|
|
|
%% | + - - - - - - - - ++ - ++ - - - - - - - - + | --v coverflap
|
|
|
|
|
%% +-------------------++---++-------------------+ ---
|
|
|
|
|
%% . .
|
|
|
|
|
%% ^. .^ spinefold
|
|
|
|
|
%% . .
|
|
|
|
|
%% <---> spinewidth
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \end{verbatim}
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% |jacket|
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% Dust jacket layout
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \DescribeMacro{jacketwrap=<len>}
|
|
|
|
|
%% \DescribeMacro{jacketflap=<len>}
|
|
|
|
|
%% \DescribeMacro{jacketflapfront=<len>}
|
|
|
|
|
%% \DescribeMacro{jacketflapback=<len>}
|
|
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \begin{verbatim}
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%% <---> jaketflap/jacketflapback <---> jaketflap/jacketflapfront
|
|
|
|
|
%% . . . .
|
|
|
|
|
%% . . blockwidth blockwidth . .
|
|
|
|
|
%% . . <---------------> <---------------> . .
|
|
|
|
|
%% . .<-> coverboardgrow <-> coverboardgrow
|
|
|
|
|
%% . . . . . .
|
|
|
|
|
%% +---++-----------------++---++-----------------++---+ ---
|
|
|
|
|
%% | .. + - - - - - - - ++ - ++ - - - - - - - + .. | --^ coverboardgrow
|
|
|
|
|
%% | .. . .. .. . .. | ^
|
|
|
|
|
%% | .. . .. .. . .. | | blockheight
|
|
|
|
|
%% | .. . Back .. .. Front . .. | |
|
|
|
|
|
%% | .. . .. .. . .. | |
|
|
|
|
|
%% | .. . .. .. . .. | v
|
|
|
|
|
%% | .. + - - - - - - - ++ - ++ - - - - - - - + .. | --v coverboardgrow
|
|
|
|
|
%% +---++-----------------++---++-----------------++---+ ---
|
|
|
|
|
%% .. . . ..
|
|
|
|
|
%% ^ jacketwrap . . ^ jacketwrap
|
|
|
|
|
%% ^. .^ spinefold
|
|
|
|
|
%% . .
|
|
|
|
|
%% <---> spinewidth
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \end{verbatim}
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
% XXX in cover layout setup pdf boxes in a way to use \bleed as foldover...
|
|
|
|
|
% ...see hyperref docs to set pdf view/print area (???)
|
|
|
|
|
% .....should also set \bleed default to something like 17mm
|
|
|
|
|
% XXX also need a way to:
|
|
|
|
|
% - setup front-cover
|
|
|
|
|
% - setup pine
|
|
|
|
|
% - setup back-cover
|
|
|
|
|
% ...envs??
|
2021-08-10 06:14:42 +03:00
|
|
|
% XXX do we need to implement cover fold over???
|
2021-08-08 01:54:37 +03:00
|
|
|
% XXX not yet sure how to go about this -- should we update \blockwidth
|
|
|
|
|
% or should we define a new length and let some templates
|
|
|
|
|
% use one and some use the other???
|
|
|
|
|
% ...I'm leaning towards the later...
|
|
|
|
|
% XXX fold/cut marks???
|
|
|
|
|
% XXX write all the dimensions to pdf comment...
|
|
|
|
|
% XXX EXPERIMENTAL...
|
|
|
|
|
\DeclareStringOption[block]{layoutmode}[block]
|
|
|
|
|
\@DeclareLiteralOptionTo{layoutmode}{block}
|
|
|
|
|
%\@DeclareLiteralOptionTo{layoutmode}{web}
|
|
|
|
|
\@DeclareLiteralOptionTo{layoutmode}{endpaper}
|
|
|
|
|
% XXX add overhang...
|
|
|
|
|
% XXX minght be a good idea to add cover types as separate values and
|
|
|
|
|
% preset defeaults per type, e.g:
|
|
|
|
|
% layoutmode= hardcover softcover
|
|
|
|
|
% should also set:
|
|
|
|
|
% spinefold= 5mm 5mm
|
|
|
|
|
% coverflap= 17mm 0mm
|
|
|
|
|
% bleed= 0mm 5mm
|
|
|
|
|
\@DeclareLiteralOptionTo{layoutmode}{cover}
|
|
|
|
|
%\@DeclareLiteralOptionTo{layoutmode}{hardcover}
|
|
|
|
|
%\@DeclareLiteralOptionTo{layoutmode}{softcover}
|
|
|
|
|
% XXX add flap sizes...
|
|
|
|
|
% XXX not implemented...
|
|
|
|
|
\@DeclareLiteralOptionTo{layoutmode}{jacket}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% NOTE: this is only used when layoutmode=cover
|
2021-08-08 12:16:50 +03:00
|
|
|
% NOTE: these are documented inline with layoutmode=.. docs...
|
2021-08-08 01:54:37 +03:00
|
|
|
\DeclareStringOption[0pt]{spinewidth}[0pt]
|
|
|
|
|
\DeclareStringOption[0pt]{spinefold}[7mm]
|
|
|
|
|
\DeclareStringOption[0pt]{coverboardgrow}[3mm]
|
|
|
|
|
% XXX defaults should depend on cover type...
|
|
|
|
|
\DeclareStringOption[0pt]{coverflap}[17mm]
|
|
|
|
|
\DeclareStringOption[0pt]{jacketwrap}[2mm]
|
|
|
|
|
\DeclareStringOption[0pt]{jacketflap}[50mm]
|
|
|
|
|
\DeclareStringOption[0pt]{jacketflapfront}[50mm]
|
|
|
|
|
\DeclareStringOption[0pt]{jacketflapback}[50mm]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%% Image clearance
|
|
|
|
|
%
|
|
|
|
|
%% \DescribeMacro{clearimage=<len>}
|
|
|
|
|
%
|
|
|
|
|
%% Distance from image to paper border (clearance) for full-page images.
|
|
|
|
|
%%
|
|
|
|
|
%% this can be:
|
|
|
|
|
%% - negative value set image bleed,
|
|
|
|
|
%% - positive value set distance from paper edge to image.
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
\DeclareStringOption{clearimage}[-5mm]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%% Image block layout
|
|
|
|
|
%
|
|
|
|
|
%% \DescribeMacro{imageblockwidth=<len>}
|
|
|
|
|
%% \DescribeMacro{imageblockheight=<len>}
|
|
|
|
|
%% \DescribeMacro{imageblockoffsettop=<len>}
|
|
|
|
|
%
|
|
|
|
|
%% Image block size relative to text block.
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
% XXX better name...
|
|
|
|
|
\DeclareStringOption[0.85]{imageblockwidth}[1]
|
|
|
|
|
\DeclareStringOption[0.85]{imageblockheight}[1]
|
|
|
|
|
\DeclareStringOption[-0.05]{imageblockoffsettop}[0]
|
|
|
|
|
|
|
|
|
|
%%%%% PDF Viewer layout
|
|
|
|
|
%
|
|
|
|
|
%% \DescribeMacro{pdfpagelayout=<mode>}
|
|
|
|
|
%% \DescribeMacro{SinglePage}
|
|
|
|
|
%% \DescribeMacro{OneColumn}
|
|
|
|
|
%% \DescribeMacro{TwoColumnLeft}
|
|
|
|
|
%% \DescribeMacro{TwoColumnRight}
|
|
|
|
|
%% \DescribeMacro{TwoPageLeft}
|
|
|
|
|
%% \DescribeMacro{TwoPageRight}
|
|
|
|
|
%
|
|
|
|
|
% defaults:
|
|
|
|
|
% - TwoColumnLeft (for layoutmode=block)
|
|
|
|
|
% - SinglePage
|
|
|
|
|
%
|
2021-08-10 14:14:43 +03:00
|
|
|
% XXX make this a proper link...
|
|
|
|
|
%% See: hyperref's pdfpagelayout for more options.
|
|
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\DeclareStringOption{pdfpagelayout}
|
|
|
|
|
\@DeclareLiteralOptionTo{pdfpagelayout}{SinglePage}
|
|
|
|
|
\@DeclareLiteralOptionTo{pdfpagelayout}{OneColumn}
|
|
|
|
|
\@DeclareLiteralOptionTo{pdfpagelayout}{TwoColumnRight}
|
|
|
|
|
\@DeclareLiteralOptionTo{pdfpagelayout}{TwoColumnLeft}
|
|
|
|
|
\@DeclareLiteralOptionTo{pdfpagelayout}{TwoPageRight}
|
|
|
|
|
\@DeclareLiteralOptionTo{pdfpagelayout}{TwoPageLeft}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%% Other options
|
|
|
|
|
%
|
|
|
|
|
%% \DescribeMacro{geometrynodefaults}
|
|
|
|
|
%
|
|
|
|
|
%% let the user set geometry defaults.
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
|
|
|
|
%% If this is not set |photobook| will override some user settings when
|
|
|
|
|
%% initializing geometry.
|
|
|
|
|
%%
|
|
|
|
|
%% If set |photobook| will only set override:
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%% paperwidth=\bleedblockwidth
|
|
|
|
|
%% paperheight=\bleedblockheight
|
|
|
|
|
%% bindingoffset=\bindingoffset
|
|
|
|
|
%% \end{verbatim}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
% XXX better name..
|
|
|
|
|
\DeclareBoolOption{geometrynodefaults}
|
|
|
|
|
|
|
|
|
|
|
2021-08-12 16:48:00 +03:00
|
|
|
%% \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]
|
|
|
|
|
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{book}}
|
|
|
|
|
\ProcessKeyvalOptions*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
% Parent class...
|
|
|
|
|
%
|
|
|
|
|
\LoadClass[9pt, final, openany]{book}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
% Packages...
|
|
|
|
|
%
|
|
|
|
|
% NOTE: imports are after \LoadClass{ .. } to avoid figting over macro
|
|
|
|
|
% names...
|
|
|
|
|
|
|
|
|
|
\RequirePackage{calc}
|
|
|
|
|
\RequirePackage{xargs}
|
|
|
|
|
\RequirePackage{ifthen}
|
|
|
|
|
\RequirePackage{iftex}
|
2021-08-15 13:38:32 +03:00
|
|
|
\RequirePackage{pgffor}
|
2021-08-19 23:53:01 +03:00
|
|
|
|
|
|
|
|
% XXX argument processing -- use one of the following two...
|
|
|
|
|
%\RequirePackage{pgfkeys}
|
|
|
|
|
\RequirePackage{xkeyval}
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
\RequirePackage{etoolbox}
|
|
|
|
|
\RequirePackage{atbegshi}
|
|
|
|
|
%\RequirePackage{afterpage}
|
|
|
|
|
%\RequirePackage{changepage}
|
|
|
|
|
\RequirePackage[unicode]{hyperref}
|
|
|
|
|
%\RequirePackage{pdfcomment}
|
|
|
|
|
\RequirePackage{eso-pic}
|
|
|
|
|
\RequirePackage{environ}
|
2021-08-12 16:48:00 +03:00
|
|
|
\RequirePackage{numprint}
|
2021-08-14 03:02:59 +03:00
|
|
|
\RequirePackage{trimclip}
|
2021-08-08 01:54:37 +03:00
|
|
|
\RequirePackage{xcolor}
|
|
|
|
|
\RequirePackage{colorspace}
|
|
|
|
|
\RequirePackage{graphicx}
|
2021-08-16 06:34:22 +03:00
|
|
|
\RequirePackage{adjustbox}
|
2021-08-08 01:54:37 +03:00
|
|
|
\RequirePackage[overlay,absolute]{textpos}
|
|
|
|
|
\RequirePackage[linewidth=1pt]{mdframed}
|
|
|
|
|
\RequirePackage{rotating}
|
|
|
|
|
% XXX flow text frames...
|
2021-08-08 12:16:50 +03:00
|
|
|
% XXX this messes with geometry....
|
|
|
|
|
%\RequirePackage{flowfram}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%%%% Globals
|
2021-08-10 06:14:42 +03:00
|
|
|
%
|
2021-08-15 13:38:32 +03:00
|
|
|
% NOTE: most of these are setup in \InitPages...
|
2021-08-10 06:14:42 +03:00
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%%% \DescribeGlobal{layoutmode}
|
|
|
|
|
%% \DescribeMacro{\layoutmode=<mode>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Layout mode
|
|
|
|
|
%%
|
|
|
|
|
\edef\layoutmode{\photobook@layoutmode}
|
|
|
|
|
|
|
|
|
|
% layout mode tests...
|
|
|
|
|
\newif\ifcoverlayout
|
|
|
|
|
\newif\ifhardcoverlayout
|
|
|
|
|
\newif\ifsoftcoverlayout
|
|
|
|
|
\newif\ifendpaperlayout
|
|
|
|
|
\newif\ifjacketlayout
|
|
|
|
|
% agrigates...
|
|
|
|
|
\newif\ifcoverlikelayout
|
|
|
|
|
\newif\ifblocklayout
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\pdfpagelayout=<mode>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Controls the default layout in the pdf viewer.
|
|
|
|
|
%%
|
|
|
|
|
\edef\pdfpagelayout{\photobook@pdfpagelayout}
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\spinewidth=<len>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Spine width
|
|
|
|
|
%%
|
|
|
|
|
\newlength\spinewidth
|
|
|
|
|
\setlength\spinewidth{\photobook@spinewidth}
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\spinefold=<len>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Spine fold width
|
|
|
|
|
%%
|
|
|
|
|
\newlength\spinefold
|
|
|
|
|
\setlength\spinefold{\photobook@spinefold}
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\coverboardgrow=<len>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Controls how much biger the cover board is than the page block
|
|
|
|
|
%%
|
|
|
|
|
\newlength\coverboardgrow
|
|
|
|
|
\setlength\coverboardgrow{\photobook@coverboardgrow}
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\coverflap=<len>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Cover flap
|
|
|
|
|
%%
|
|
|
|
|
\newlength\coverflap
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\jacketwrap=<len>}
|
|
|
|
|
%% \DescribeMacro{\jacketflap=<len>}
|
|
|
|
|
%% \DescribeMacro{\jacketflapfront=<len>}
|
|
|
|
|
%% \DescribeMacro{\jacketflapback=<len>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Jacker configuration
|
|
|
|
|
%%
|
|
|
|
|
\newlength\jacketwrap
|
|
|
|
|
\newlength\jacketflap
|
|
|
|
|
\newlength\jacketflapfront
|
|
|
|
|
\newlength\jacketflapback
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\blockwidth=<len>}
|
|
|
|
|
%% \DescribeMacro{\blockheight=<len>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Page block size
|
|
|
|
|
%%
|
2021-08-15 13:38:32 +03:00
|
|
|
% NOTE: page and bleed block sizes are set via \InitPages
|
2021-08-08 01:54:37 +03:00
|
|
|
\newlength\blockwidth
|
|
|
|
|
\newlength\blockheight
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\bleedblockwidth=<len>}
|
|
|
|
|
%% \DescribeMacro{\bleedblockheight=<len>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Page block size with bleeds
|
|
|
|
|
%%
|
|
|
|
|
%% These are equivalent to |\paperwidth| and |\paperheight| but are
|
|
|
|
|
%% independent of them...
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\newlength\bleedblockwidth
|
|
|
|
|
\newlength\bleedblockheight
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\pageblockwidth=<len>}
|
|
|
|
|
%% \DescribeMacro{\pageblockheight=<len>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Original page block size
|
|
|
|
|
%%
|
|
|
|
|
%% for the block layout these are the same as |\blockwidth| and |\blockheight|
|
|
|
|
|
%% for other layouts these are the original page layout size while the
|
|
|
|
|
%% |\blockwidth| are set tho the current layout visible size.
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\newlength\pageblockwidth
|
|
|
|
|
\newlength\pageblockheight
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\bleed=<len>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Page bleed size
|
|
|
|
|
%%
|
|
|
|
|
\newlength\bleed
|
|
|
|
|
\setlength\bleed{\photobook@bleed}
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\bindingoffset=<len>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Binding offset
|
|
|
|
|
%%
|
|
|
|
|
\newlength\bindingoffset
|
|
|
|
|
\setlength\bindingoffset{\photobook@bindingoffset}
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\clearimage=<len>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-19 23:53:01 +03:00
|
|
|
%% Image clearance
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
|
|
|
|
% NOTE: since this can be any number but we need to detect if it was set
|
|
|
|
|
% manually we'll set it to \maxdimen and hope noe will print
|
2021-08-19 23:53:01 +03:00
|
|
|
% something big enough and dare to use it as image clearance...
|
2021-08-08 01:54:37 +03:00
|
|
|
\newlength{\clearimage}
|
|
|
|
|
\setlength\clearimage{\maxdimen}
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imageblockwidth=<ratio>}
|
|
|
|
|
%% \DescribeMacro{\imageblockheight=<ratio>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Image block width relative to |\textwidth|
|
|
|
|
|
%%
|
|
|
|
|
\edef\imageblockwidth{\photobook@imageblockwidth}
|
|
|
|
|
\edef\imageblockheight{\photobook@imageblockheight}
|
|
|
|
|
|
2021-08-20 16:57:00 +03:00
|
|
|
%% \DescribeMacro{\pagetextwidth=<len>}
|
|
|
|
|
%% \DescribeMacro{\pagetextheight=<len>}
|
|
|
|
|
%
|
|
|
|
|
%% Root page text width/height.
|
|
|
|
|
%%
|
|
|
|
|
\newlength\pagetextwidth
|
|
|
|
|
\setlength\pagetextwidth{\textwidth}
|
|
|
|
|
\newlength\pagetextheight
|
|
|
|
|
\setlength\pagetextheight{\textheight}
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imageblockoffsettop=<ratio>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%%
|
|
|
|
|
%%
|
|
|
|
|
\edef\imageblockoffsettop{\photobook@imageblockoffsettop}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%%%% Initialization
|
|
|
|
|
%%
|
2021-08-15 13:38:32 +03:00
|
|
|
%% \DescribeMacro{\InitPages}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% Initialize page dimensions.
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
2021-08-15 13:38:32 +03:00
|
|
|
\newcommand\InitPages{
|
2021-08-08 01:54:37 +03:00
|
|
|
% layout bools/tests...
|
|
|
|
|
\coverlayoutfalse
|
|
|
|
|
\hardcoverlayoutfalse
|
|
|
|
|
\softcoverlayoutfalse
|
|
|
|
|
\endpaperlayoutfalse
|
|
|
|
|
\jacketlayoutfalse
|
|
|
|
|
\coverlikelayoutfalse
|
|
|
|
|
\blocklayoutfalse
|
|
|
|
|
\ifdefstring{\layoutmode}{block}{
|
|
|
|
|
\blocklayouttrue }{}
|
|
|
|
|
\ifdefstring{\layoutmode}{cover}{
|
|
|
|
|
\coverlayouttrue
|
|
|
|
|
\coverlikelayouttrue }{}
|
|
|
|
|
\ifdefstring{\layoutmode}{hardcover}{
|
|
|
|
|
\hardcoverlayouttrue
|
|
|
|
|
\coverlikelayouttrue }{}
|
|
|
|
|
\ifdefstring{\layoutmode}{softcover}{
|
|
|
|
|
\softcoverlayouttrue
|
|
|
|
|
\coverlikelayouttrue }{}
|
|
|
|
|
\ifdefstring{\layoutmode}{jacket}{%
|
|
|
|
|
\jacketlayouttrue
|
|
|
|
|
\coverlikelayouttrue }{}
|
|
|
|
|
\ifdefstring{\layoutmode}{endpaper}{
|
|
|
|
|
\endpaperlayouttrue }{}
|
|
|
|
|
% pdf layout...
|
|
|
|
|
\ifx\photobook@pdfpagelayout\empty
|
|
|
|
|
\ifblocklayout
|
|
|
|
|
\def\pdfpagelayout{TwoPageRight}
|
|
|
|
|
\else
|
|
|
|
|
\def\pdfpagelayout{SinglePage}
|
|
|
|
|
\fi
|
|
|
|
|
\else
|
|
|
|
|
\def\pdfpagelayout{\photobook@pdfpagelayout}
|
|
|
|
|
\fi
|
|
|
|
|
% items to ignore in different layouts...
|
|
|
|
|
% XXX is this the correct way to go???
|
|
|
|
|
\ifcoverlayout
|
|
|
|
|
\setlength\coverflap{\photobook@coverflap}
|
|
|
|
|
\else
|
|
|
|
|
\setlength\coverflap{0pt}
|
|
|
|
|
\fi
|
|
|
|
|
\ifjacketlayout
|
|
|
|
|
\setlength\jacketwrap{\photobook@jacketwrap}
|
|
|
|
|
\setlength\jacketflap{\photobook@jacketflap}
|
|
|
|
|
\else
|
|
|
|
|
\setlength\jacketwrap{0pt}
|
|
|
|
|
\setlength\jacketflap{0pt}
|
|
|
|
|
\fi
|
|
|
|
|
% flaps...
|
|
|
|
|
\ifdim\jacketflapfront=0pt
|
|
|
|
|
\setlength\jacketflapfront{\jacketflap}
|
|
|
|
|
\fi
|
|
|
|
|
\ifdim\jacketflapback=0pt
|
|
|
|
|
\setlength\jacketflapback{\jacketflap}
|
|
|
|
|
\fi
|
|
|
|
|
% block size...
|
|
|
|
|
\ifdim\blockwidth=0pt
|
|
|
|
|
% layout: block...
|
|
|
|
|
\setlength\blockwidth{
|
|
|
|
|
\ifx\photobook@blockwidth\empty
|
|
|
|
|
\dimexpr
|
|
|
|
|
\paperwidth
|
|
|
|
|
- 2\bleed
|
|
|
|
|
\relax
|
|
|
|
|
\else
|
|
|
|
|
\photobook@blockwidth
|
|
|
|
|
\fi}
|
|
|
|
|
\setlength\pageblockwidth{\blockwidth}
|
|
|
|
|
% layout: cover...
|
|
|
|
|
\ifcoverlayout
|
|
|
|
|
\setlength\blockwidth{
|
|
|
|
|
\dimexpr
|
|
|
|
|
2\blockwidth
|
|
|
|
|
+ \spinewidth
|
|
|
|
|
+ 2\spinefold
|
|
|
|
|
+ 2\coverboardgrow
|
|
|
|
|
+ 2\coverflap
|
|
|
|
|
\relax } \fi
|
|
|
|
|
% layout: jacket...
|
|
|
|
|
% XXX this seems to be about 6mm off -- what are we missing here???
|
|
|
|
|
\ifjacketlayout
|
|
|
|
|
\setlength\blockwidth{
|
|
|
|
|
\dimexpr
|
|
|
|
|
2\blockwidth
|
|
|
|
|
+ \spinewidth
|
|
|
|
|
+ 2\spinefold
|
|
|
|
|
+ 2\jacketwrap
|
|
|
|
|
+ \jacketflapfront
|
|
|
|
|
+ \jacketflapback
|
|
|
|
|
\relax } \fi
|
|
|
|
|
% layout: endpaper...
|
|
|
|
|
\ifendpaperlayout
|
|
|
|
|
\setlength\blockwidth{ 2\blockwidth } \fi
|
|
|
|
|
\fi
|
|
|
|
|
\ifdim\blockheight=0pt
|
|
|
|
|
% layout: block / endpaper...
|
|
|
|
|
\setlength\blockheight{
|
|
|
|
|
\ifx\photobook@blockheight\empty
|
|
|
|
|
\dimexpr \paperheight - 2\bleed \relax
|
|
|
|
|
\else
|
|
|
|
|
\photobook@blockheight
|
|
|
|
|
\fi}
|
|
|
|
|
\setlength\pageblockheight{\blockheight}
|
|
|
|
|
% layout: cover...
|
|
|
|
|
\ifcoverlayout
|
|
|
|
|
\setlength\blockheight{
|
|
|
|
|
\dimexpr
|
|
|
|
|
\blockheight
|
|
|
|
|
+ 2\coverboardgrow
|
|
|
|
|
+ 2\coverflap
|
|
|
|
|
\relax } \fi
|
|
|
|
|
% layout: jacket...
|
|
|
|
|
\ifjacketlayout
|
|
|
|
|
\setlength\blockheight{
|
|
|
|
|
\dimexpr
|
|
|
|
|
\blockheight
|
|
|
|
|
+ 2\coverboardgrow
|
|
|
|
|
\relax } \fi
|
|
|
|
|
\fi
|
2021-08-19 23:53:01 +03:00
|
|
|
% default image clearance...
|
2021-08-08 01:54:37 +03:00
|
|
|
\ifdim\clearimage=\maxdimen
|
|
|
|
|
\ifx\photobook@clearimage\empty
|
|
|
|
|
\setlength\clearimage{-\bleed}
|
|
|
|
|
\else
|
|
|
|
|
\setlength\clearimage{\photobook@clearimage}
|
|
|
|
|
\fi
|
|
|
|
|
\fi
|
|
|
|
|
% page with bleeds...
|
|
|
|
|
% NOTE: this is essentially \paperwidth and \paperheight but we do
|
|
|
|
|
% not rely on them being defined -- photobook settings take
|
|
|
|
|
% priority over \paperwidth and \paperwidth...
|
|
|
|
|
\setlength\bleedblockwidth{\dimexpr
|
|
|
|
|
2\bleed + \blockwidth
|
|
|
|
|
\relax}
|
|
|
|
|
\setlength\bleedblockheight{\dimexpr
|
|
|
|
|
2\bleed + \blockheight
|
2021-08-12 16:48:00 +03:00
|
|
|
\relax}
|
|
|
|
|
% misc...
|
|
|
|
|
\nprounddigits{\photobook@roundprintedlengthsto} }
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
2021-08-15 13:38:32 +03:00
|
|
|
%% \DescribeMacro{\ResetPages}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Reset and re-initialize page dimentions.
|
|
|
|
|
%%
|
2021-08-15 13:38:32 +03:00
|
|
|
\newcommand\ResetPages{
|
2021-08-08 01:54:37 +03:00
|
|
|
\setlength\blockwidth{0mm}
|
|
|
|
|
\setlength\blockheight{0mm}
|
|
|
|
|
\edef\pdfpagelayout{}
|
|
|
|
|
%
|
2021-08-15 13:38:32 +03:00
|
|
|
\InitPages}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
% Setup...
|
|
|
|
|
|
|
|
|
|
% init/update lengths...
|
2021-08-15 13:38:32 +03:00
|
|
|
\InitPages
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
% minimal geometry setup...
|
|
|
|
|
\RequirePackage[
|
|
|
|
|
% paper size (incl. bleeds)...
|
|
|
|
|
paperwidth=\bleedblockwidth, paperheight=\bleedblockheight,
|
|
|
|
|
]{geometry}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
% Setup (pre-document)...
|
|
|
|
|
|
|
|
|
|
\AtEndPreamble{
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
% Metadata...
|
|
|
|
|
|
|
|
|
|
\hypersetup{
|
|
|
|
|
pdfinfo={
|
|
|
|
|
Title={\@title},
|
|
|
|
|
Subject={\@subject},
|
|
|
|
|
Author={\@author},
|
|
|
|
|
Keywords={\@keywords},
|
|
|
|
|
},
|
|
|
|
|
pdfpagelayout=\pdfpagelayout,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
% Geometry...
|
|
|
|
|
|
2021-08-15 13:38:32 +03:00
|
|
|
\InitPages
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
% no-defaults -- the user is expected to set things up...
|
|
|
|
|
\ifphotobook@geometrynodefaults
|
|
|
|
|
\geometry{
|
|
|
|
|
% paper size (incl. bleeds)...
|
|
|
|
|
paperwidth=\bleedblockwidth, paperheight=\bleedblockheight,
|
|
|
|
|
bindingoffset=\bindingoffset}
|
|
|
|
|
% normal mode...
|
|
|
|
|
\else
|
|
|
|
|
\geometry{
|
|
|
|
|
% paper size (incl. bleeds)...
|
|
|
|
|
paperwidth=\bleedblockwidth, paperheight=\bleedblockheight,
|
|
|
|
|
bindingoffset=\bindingoffset,
|
|
|
|
|
% include header/footer/margin notes in printed area
|
|
|
|
|
twoside, includeall, nomarginpar,
|
|
|
|
|
ignorehead=false, ignorefoot=false, ignoremp=false,
|
|
|
|
|
% center printed area on page
|
|
|
|
|
vcentering, hcentering}
|
|
|
|
|
\fi
|
|
|
|
|
|
2021-08-20 16:57:00 +03:00
|
|
|
\setlength\pagetextwidth{\textwidth}
|
|
|
|
|
\setlength\pagetextheight{\textheight}
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
% pdf boxes...
|
|
|
|
|
|
|
|
|
|
% calculate pdf box dimensions in pt...
|
|
|
|
|
\edef\@pdfWidthPt{\strip@pt\dimexpr
|
|
|
|
|
0.996264009963\bleedblockwidth \relax}
|
|
|
|
|
\edef\@pdfHeightPt{\strip@pt\dimexpr
|
|
|
|
|
0.996264009963\bleedblockheight \relax}
|
|
|
|
|
\edef\@pdfBleedPt{\strip@pt\dimexpr
|
|
|
|
|
0.996264009963\bleed \relax}
|
|
|
|
|
\edef\@pdfTopPt{\strip@pt\dimexpr
|
|
|
|
|
0.996264009963\dimexpr
|
|
|
|
|
\bleedblockheight - \bleed \relax \relax}
|
|
|
|
|
\edef\@pdfRightPt{\strip@pt\dimexpr
|
|
|
|
|
0.996264009963\dimexpr
|
|
|
|
|
\bleedblockwidth - \bleed \relax \relax}
|
|
|
|
|
|
|
|
|
|
% set the boxes...
|
|
|
|
|
\ifxetex
|
|
|
|
|
% XXX not tested...
|
|
|
|
|
\AtBeginShipout{\AtBeginShipoutAddToBox{
|
|
|
|
|
\special{pdf:put @thispage <<
|
|
|
|
|
/MediaBox [0 0 \@pdfWidthPt\space \@pdfHeightPt]
|
|
|
|
|
/BleedBox [0 0 \@pdfWidthPt\space \@pdfHeightPt]
|
|
|
|
|
/ArtBox [\@pdfBleedPt\space \@pdfBleedPt\space \@pdfRightPt\space \@pdfTopPt]
|
|
|
|
|
/TrimBox [\@pdfBleedPt\space \@pdfBleedPt\space \@pdfRightPt\space \@pdfTopPt]
|
|
|
|
|
/CropBox [\@pdfBleedPt\space \@pdfBleedPt\space \@pdfRightPt\space \@pdfTopPt]
|
|
|
|
|
>>} }}
|
|
|
|
|
|
|
|
|
|
\else
|
|
|
|
|
\edef\pdfboxes{
|
|
|
|
|
/MediaBox [0 0 \@pdfWidthPt\space \@pdfHeightPt]
|
|
|
|
|
/BleedBox [0 0 \@pdfWidthPt\space \@pdfHeightPt]
|
|
|
|
|
/ArtBox [\@pdfBleedPt\space \@pdfBleedPt\space \@pdfRightPt\space \@pdfTopPt]
|
|
|
|
|
/TrimBox [\@pdfBleedPt\space \@pdfBleedPt\space \@pdfRightPt\space \@pdfTopPt]
|
|
|
|
|
/CropBox [\@pdfBleedPt\space \@pdfBleedPt\space \@pdfRightPt\space \@pdfTopPt]
|
|
|
|
|
}
|
|
|
|
|
\expandafter\pdfpageattr\expandafter{\pdfboxes}
|
|
|
|
|
\fi
|
|
|
|
|
|
|
|
|
|
} % \AtEndPreamble{..}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%%%% Generic commands
|
|
|
|
|
%%
|
|
|
|
|
|
2021-08-14 03:02:59 +03:00
|
|
|
|
|
|
|
|
%% \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 }
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\keywords\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Set pdf metadata keywords
|
|
|
|
|
%%
|
|
|
|
|
%% >> \keywords{<keywords>}
|
|
|
|
|
%%
|
|
|
|
|
\def\@keywords{}
|
|
|
|
|
|
|
|
|
|
\newcommand\keywords[1]{%
|
|
|
|
|
\def\@keywords{#1}}
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\subject\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Set pdf metadata subject
|
|
|
|
|
%%
|
|
|
|
|
%% >> \subject{<subject>}
|
|
|
|
|
%%
|
|
|
|
|
\def\@subject{}
|
|
|
|
|
|
|
|
|
|
\newcommand\subject[1]{%
|
|
|
|
|
\def\@subject{#1}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%% \DescribeMacro{\cleartoleftpage}
|
|
|
|
|
%
|
|
|
|
|
%% Forces content to left page
|
|
|
|
|
%%
|
|
|
|
|
\newcommand*{\cleartoleftpage}{%
|
|
|
|
|
\clearpage
|
|
|
|
|
\if@twoside
|
|
|
|
|
\ifodd\c@page
|
|
|
|
|
\hbox{}\newpage
|
|
|
|
|
\if@twocolumn
|
|
|
|
|
\hbox{}\newpage \fi\fi\fi }
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\pdfpagecount\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Get pdf page count
|
|
|
|
|
%%
|
2021-08-10 06:14:42 +03:00
|
|
|
%% >> \pdfpagecount{<file.pdf>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
|
|
|
|
\newcommand\pdfpagecount[1]{
|
|
|
|
|
\ifpdftex
|
|
|
|
|
\pdfximage{#1}
|
|
|
|
|
\number\pdflastximagepages%
|
|
|
|
|
\else\ifxetex
|
|
|
|
|
\number\XeTeXpdfpagecount"#1"%
|
|
|
|
|
\else\ifluatex
|
|
|
|
|
\number\directlua{%
|
|
|
|
|
local pages = 0
|
|
|
|
|
local doc = pdfe.open("\luaescapestring{#1}")
|
|
|
|
|
if doc then
|
|
|
|
|
pages = pdfe.getnofpages(doc)
|
|
|
|
|
pdfe.close(doc)
|
|
|
|
|
end
|
|
|
|
|
tex.write(pages) } \fi\fi }
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\pdfspinewidth\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Calculate spine thickness
|
|
|
|
|
%%
|
|
|
|
|
%% >> \pdfspinewidth{<paper-thikness>}{<cover-thikness>}{<block-pdf>}
|
|
|
|
|
%%
|
|
|
|
|
% NOTE: really "like" how LaTeX overcomplicats simple math...
|
|
|
|
|
\newcommand\pdfspinewidth[3]{%
|
|
|
|
|
\setlength\spinewidth{\dimexpr
|
|
|
|
|
(#1 mm) * \numexpr \pdfpagecount{#3} / 2 \relax
|
|
|
|
|
+ ((#2 mm) * 2)
|
|
|
|
|
\relax} }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% XXX workaround a problem with xelatex vs. lualatex...
|
|
|
|
|
\ifxetex
|
2021-08-20 16:57:00 +03:00
|
|
|
\newcommand\ShipoutPicture[1]{%
|
2021-08-08 01:54:37 +03:00
|
|
|
\AddToShipoutPicture*{#1}}
|
|
|
|
|
|
|
|
|
|
\else
|
|
|
|
|
% XXX for some reason in pdflatex and lualatex \pagecolor{..} and
|
|
|
|
|
% \AddToShipoutPicture*{..} start fighting over space...
|
|
|
|
|
% XXX this draws over page numbers...
|
2021-08-20 16:57:00 +03:00
|
|
|
\newcommand\ShipoutPicture[1]{%
|
2021-08-08 01:54:37 +03:00
|
|
|
\AddToShipoutPictureFG*{#1}}
|
|
|
|
|
\fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
% XXX HACKS...
|
|
|
|
|
|
|
|
|
|
% XXX for some reason we are pushed away from the left edge...
|
|
|
|
|
\newlength{\OFFSETFIX}
|
|
|
|
|
\setlength{\OFFSETFIX}{-4mm}
|
|
|
|
|
|
|
|
|
|
% This compensates for caption width being miscalcualted for right
|
|
|
|
|
% alingned captions...
|
|
|
|
|
\newlength{\CAPTIONWIDTHFIX}
|
|
|
|
|
\setlength{\CAPTIONWIDTHFIX}{-5mm}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
2021-08-13 15:09:38 +03:00
|
|
|
%%%% Environments and Cells
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
% XXX need a way to place images / templates into these...
|
|
|
|
|
% XXX should these only be visible in respective modes or for non-zero widths???
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2021-08-09 13:43:36 +03:00
|
|
|
%%%%% Generic
|
2021-08-08 01:54:37 +03:00
|
|
|
|
2021-08-09 13:43:36 +03:00
|
|
|
%% \DescribeEnv{page}
|
|
|
|
|
%
|
|
|
|
|
%% Page environment.
|
|
|
|
|
%%
|
2021-08-15 13:38:32 +03:00
|
|
|
%% This is mainly designed to wrap other cell environment described later.
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
2021-08-08 01:54:37 +03:00
|
|
|
% XXX this may span more than one page if there is enoug stuff packed
|
|
|
|
|
% into it...
|
|
|
|
|
\newenvironment{page}{}{%
|
|
|
|
|
\null
|
|
|
|
|
\clearpage }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2021-08-13 15:09:38 +03:00
|
|
|
%%%%% Cells
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
2021-08-12 16:48:00 +03:00
|
|
|
%% A cell environments is a box of specified size placed at a specific
|
2021-08-09 13:43:36 +03:00
|
|
|
%% location in a page.
|
2021-08-12 16:48:00 +03:00
|
|
|
%%
|
|
|
|
|
%% 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
|
2021-08-12 15:22:03 +03:00
|
|
|
|
2021-08-15 13:38:32 +03:00
|
|
|
% XXX should we treat the page as a cell???
|
|
|
|
|
\setlength\cellwidth{\textwidth}
|
|
|
|
|
\setlength\cellheight{\textheight}
|
|
|
|
|
|
|
|
|
|
|
2021-08-16 06:34:22 +03:00
|
|
|
% \DescribeMacro{\begin\{inlinecell\}\{..\} ...}
|
2021-08-15 13:38:32 +03:00
|
|
|
%% \DescribeEnv{inlinecell}
|
|
|
|
|
%
|
|
|
|
|
%% Create a basic inline cell.
|
|
|
|
|
%
|
|
|
|
|
%% >> \begin{inline}<width>}{<height>} ... \end{inlinecell}
|
|
|
|
|
%
|
|
|
|
|
%% This is just like |minipage| but provides cell mechanics.
|
|
|
|
|
%%
|
|
|
|
|
% XXX
|
|
|
|
|
\newenvironment{inlinecell}[2]{%
|
|
|
|
|
\begingroup%
|
|
|
|
|
\setlength\cellwidth{\dimexpr #1 \relax}%
|
|
|
|
|
\setlength\cellheight{\dimexpr #2 \relax}%
|
|
|
|
|
%
|
|
|
|
|
\begin{minipage}[t][\cellheight][t]{\cellwidth}%
|
2021-08-20 16:57:00 +03:00
|
|
|
\ignorespaces%
|
2021-08-15 13:38:32 +03:00
|
|
|
}{%
|
|
|
|
|
\end{minipage}%
|
|
|
|
|
\endgroup}
|
|
|
|
|
|
2021-08-12 15:22:03 +03:00
|
|
|
|
2021-08-16 06:34:22 +03:00
|
|
|
% \DescribeMacro{\begin\{cell\}\{..\} ...}
|
2021-08-12 15:22:03 +03:00
|
|
|
%% \DescribeEnv{cell}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
2021-08-15 13:38:32 +03:00
|
|
|
%% Create a basic absolutely positioned cell.
|
2021-08-12 16:48:00 +03:00
|
|
|
%
|
2021-08-15 13:38:32 +03:00
|
|
|
%% >> \begin{cell}{<top>, <left>}{<width>}{<height>} ... \end{cell}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
2021-08-12 15:22:03 +03:00
|
|
|
% XXX cells can not be nested -- they will mess up the \cellwidth and
|
|
|
|
|
% \cellheight for parents...
|
|
|
|
|
% XXX SYNTAX: place the second arg in braces...
|
|
|
|
|
% \begin{cell}(<top>, <left>){<width>}{<height>}
|
|
|
|
|
\newenvironment{cell}[3]{%
|
2021-08-20 16:57:00 +03:00
|
|
|
\begingroup%
|
|
|
|
|
\setlength\parindent{0em}%
|
2021-08-15 13:38:32 +03:00
|
|
|
\begin{textblock*}{#2}(#1)%
|
|
|
|
|
\begin{inlinecell}{#2}{#3}%
|
2021-08-12 15:22:03 +03:00
|
|
|
}{%
|
2021-08-15 13:38:32 +03:00
|
|
|
\end{inlinecell}%
|
2021-08-20 16:57:00 +03:00
|
|
|
\end{textblock*}%
|
|
|
|
|
\endgroup}
|
2021-08-12 15:22:03 +03:00
|
|
|
|
|
|
|
|
|
2021-08-16 06:34:22 +03:00
|
|
|
% \DescribeMacro{\begin\{clipcell\}\{..\} ...}
|
2021-08-14 03:02:59 +03:00
|
|
|
%% \DescribeEnv{clipcell}
|
|
|
|
|
%
|
|
|
|
|
%% Create a clipped cell.
|
|
|
|
|
%
|
2021-08-15 13:38:32 +03:00
|
|
|
%% >> \begin{clipcell}{<top>, <left>}{<width>}{<height>} ... \end{clipcell}
|
2021-08-14 03:02:59 +03:00
|
|
|
%
|
|
|
|
|
%% This is like the |cell| environment but will clip everything not in the
|
|
|
|
|
%% the cell.
|
|
|
|
|
%%
|
|
|
|
|
%% Note that this uses |clip| and |cliptocell| environments internally.
|
|
|
|
|
\newenvironment{clipcell}[3]{%
|
|
|
|
|
\begin{cell}{#1}{#2}{#3}%
|
|
|
|
|
\begin{cliptocell}%
|
2021-08-20 16:57:00 +03:00
|
|
|
\ignorespaces%
|
2021-08-14 03:02:59 +03:00
|
|
|
}{%
|
|
|
|
|
\end{cliptocell}%
|
2021-08-15 13:38:32 +03:00
|
|
|
\end{cell}}
|
2021-08-14 03:02:59 +03:00
|
|
|
|
|
|
|
|
|
2021-08-13 15:09:38 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Cell macros
|
|
|
|
|
%
|
|
|
|
|
%% Cell macros require a cell environment to function correctly.
|
|
|
|
|
%%
|
|
|
|
|
|
2021-08-16 06:34:22 +03:00
|
|
|
% XXX
|
2021-08-14 03:02:59 +03:00
|
|
|
\newcommand\captionformat[1]{%
|
|
|
|
|
\begin{flushright}%
|
2021-08-15 13:38:32 +03:00
|
|
|
\captionsize #1%
|
|
|
|
|
\end{flushright}}
|
2021-08-14 03:02:59 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%% \DescribeEnv{cliptocell}
|
|
|
|
|
%
|
2021-08-18 22:15:03 +03:00
|
|
|
%% Clip content to cell env.
|
2021-08-14 03:02:59 +03:00
|
|
|
%%
|
|
|
|
|
\newenvironment{cliptocell}{%
|
|
|
|
|
\begin{clipbox*}{0cm {\height - \cellheight} {\cellwidth} {\height}}%
|
|
|
|
|
\begin{minipage}[t][\cellheight][t]{\cellwidth}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{minipage}%
|
2021-08-15 13:38:32 +03:00
|
|
|
\end{clipbox*}}
|
2021-08-14 03:02:59 +03:00
|
|
|
|
|
|
|
|
|
2021-08-20 01:22:17 +03:00
|
|
|
%% \DescribeMacro{\imagecell\{..\}}
|
2021-08-18 22:15:03 +03:00
|
|
|
%
|
2021-08-19 23:53:01 +03:00
|
|
|
%% Fit image to cell.
|
2021-08-18 22:15:03 +03:00
|
|
|
%
|
2021-08-20 01:22:17 +03:00
|
|
|
%% >> \imagecell{<caption-cell>}{<image>}
|
|
|
|
|
%% >> \imagecell[<key>=<value>, ..]{<caption-cell>}{<image>}
|
2021-08-18 22:15:03 +03:00
|
|
|
%%
|
2021-08-20 01:22:17 +03:00
|
|
|
%% >> \imagecell[fit]{}{landscape-image}
|
|
|
|
|
%% >> \imagecell[fill]{}{landscape-image}
|
2021-08-19 23:53:01 +03:00
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-20 01:22:17 +03:00
|
|
|
%% fit (default) fill
|
|
|
|
|
%% +-----------------+ . . . +-----------------+ . . .
|
|
|
|
|
%% | | . . | | . .
|
|
|
|
|
%% +-----------------+ . | | .
|
|
|
|
|
%% | . . | . | . . | .
|
|
|
|
|
%% | . . | . | . . | .
|
|
|
|
|
%% | image | . | image | .
|
|
|
|
|
%% | . . | . | . . | .
|
|
|
|
|
%% | . . | . | . . | .
|
|
|
|
|
%% +-----------------+ . | | .
|
|
|
|
|
%% | | . . | | . .
|
|
|
|
|
%% +-----------------+ . . . +-----------------+ . . .
|
2021-08-19 23:53:01 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-20 01:22:17 +03:00
|
|
|
%% Centering. The image will be centered by default.
|
|
|
|
|
%%
|
|
|
|
|
%% >> \imagecell{}{landscape-image}
|
|
|
|
|
%% >> \imagecell[center]{}{landscape-image}
|
|
|
|
|
%%
|
2021-08-19 23:53:01 +03:00
|
|
|
%% Vertical alignment for landscape images.
|
|
|
|
|
%%
|
2021-08-20 01:22:17 +03:00
|
|
|
%% >> \imagecell[top]{}{landscape-image}
|
|
|
|
|
%% >> \imagecell[bottom]{}{landscape-image}
|
2021-08-19 23:53:01 +03:00
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% top center (default) bottom
|
|
|
|
|
%% +-----------------+ +-----------------+ +-----------------+
|
|
|
|
|
%% | . . | | | | |
|
|
|
|
|
%% | . . | +-----------------+ | |
|
|
|
|
|
%% | image | | . . | | |
|
|
|
|
|
%% | . . | | . . | +-----------------+
|
|
|
|
|
%% | . . | | image | | . . |
|
|
|
|
|
%% +-----------------+ | . . | | . . |
|
|
|
|
|
%% | | | . . | | image |
|
|
|
|
|
%% | | +-----------------+ | . . |
|
|
|
|
|
%% | | | | | . . |
|
|
|
|
|
%% +-----------------+ +-----------------+ +-----------------+
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%% Horizontal alignment for portrait images.
|
|
|
|
|
%%
|
2021-08-20 01:22:17 +03:00
|
|
|
%% >> \imagecell[left]{}{portrait-image}
|
|
|
|
|
%% >> \imagecell[right]{}{portrait-image}
|
2021-08-19 23:53:01 +03:00
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% left center (default) right
|
|
|
|
|
%% +-------------+---+ +-+-------------+-+ +---+-------------+
|
|
|
|
|
%% | . . | | | | . . | | | | . . |
|
|
|
|
|
%% | . . | | | | . . | | | | . . |
|
|
|
|
|
%% | . . | | | | . . | | | | . . |
|
|
|
|
|
%% | . . | | | | . . | | | | . . |
|
|
|
|
|
%% | image | | | | image | | | | image |
|
|
|
|
|
%% | . . | | | | . . | | | | . . |
|
|
|
|
|
%% | . . | | | | . . | | | | . . |
|
|
|
|
|
%% | . . | | | | . . | | | | . . |
|
|
|
|
|
%% | . . | | | | . . | | | | . . |
|
|
|
|
|
%% +-------------+---+ +-+-------------+-+ +---+-------------+
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%% Horizontal and vertical alignment can be combined to control alignment
|
|
|
|
|
%% of both vertical and horizontal images at the same time.
|
|
|
|
|
%%
|
|
|
|
|
%% Image |clearance|. This sets the amount of clearance around an image
|
|
|
|
|
%% (default: |0pt|).
|
|
|
|
|
%%
|
2021-08-20 01:22:17 +03:00
|
|
|
%% >> \imagecell[clearance=-4mm]{}{landscape-image}
|
2021-08-19 23:53:01 +03:00
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% clearance > 0pt clearance = 0pt clearance < 0pt
|
|
|
|
|
%% (default)
|
2021-08-20 17:36:22 +03:00
|
|
|
%% +--------v--------+ +-----------------+ +--------^--------+
|
2021-08-19 23:53:01 +03:00
|
|
|
%% | | | | | |
|
|
|
|
|
%% |+---------------+| +-----------------+ ..+-----------------+..
|
|
|
|
|
%% || . . || | . . | . |. .| .
|
|
|
|
|
%% || . . || | . . | . | . . | .
|
2021-08-20 17:36:22 +03:00
|
|
|
%% |> image <| | image | < | image | >
|
2021-08-19 23:53:01 +03:00
|
|
|
%% || . . || | . . | . | . . | .
|
|
|
|
|
%% || . . || | . . | . |. .| .
|
|
|
|
|
%% |+---------------+| +-----------------+ ..+-----------------+..
|
|
|
|
|
%% | | | | | |
|
2021-08-20 17:36:22 +03:00
|
|
|
%% +--------^--------+ +-----------------+ +--------v--------+
|
2021-08-19 23:53:01 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%% Note that if |clearance| is less than 0, the image will take up more
|
2021-08-20 01:22:17 +03:00
|
|
|
%% space than the containing cell, |\imagecell{..}| will not clip
|
2021-08-19 23:53:01 +03:00
|
|
|
%% its content and the whole image surface will be shown. If clipping is
|
|
|
|
|
%% needed then use |clipcell| environment as a container.
|
|
|
|
|
%%
|
2021-08-20 16:57:00 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% +-----------------+ - - caption cell size
|
|
|
|
|
%% . . .
|
|
|
|
|
%% +-----------------+ .
|
|
|
|
|
%% | | .
|
|
|
|
|
%% ..+-----------------+.. . +
|
|
|
|
|
%% . |.caption cell .| . |
|
|
|
|
|
%% . | . . | . |
|
|
|
|
|
%% . | . | . |
|
|
|
|
|
%% . | . . | . |
|
|
|
|
|
%% . |. .| . |
|
|
|
|
|
%% ..+-----------------+.. . +
|
|
|
|
|
%% | |
|
|
|
|
|
%% +-----------------+
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%% |<caption-cell>| occupies the same space as the image clipped by the
|
|
|
|
|
%% containing cell and provides all the cell functionality.
|
2021-08-19 23:53:01 +03:00
|
|
|
%%
|
|
|
|
|
|
2021-08-20 01:42:20 +03:00
|
|
|
% XXX TODO:
|
|
|
|
|
% - offset fix for fill mode...
|
|
|
|
|
% - caption cell in fill mode...
|
2021-08-20 16:57:00 +03:00
|
|
|
% - do we need to reverse left/right for fill? (feels counter-intuitive)
|
2021-08-19 23:53:01 +03:00
|
|
|
% XXX HACK -- need to track down where is this coming from and either
|
|
|
|
|
% set it to zero or account for it correctly....
|
2021-08-20 01:22:17 +03:00
|
|
|
% XXX RENAME -- make this global...
|
2021-08-20 16:57:00 +03:00
|
|
|
\newlength\photobook@HOFFSETFIX
|
|
|
|
|
\setlength\photobook@HOFFSETFIX{1.5pt}
|
2021-08-19 23:53:01 +03:00
|
|
|
|
|
|
|
|
% XXX should these be lengths or macros???
|
2021-08-20 01:22:17 +03:00
|
|
|
\def\photobook@imagecell@top{0pt}
|
|
|
|
|
\def\photobook@imagecell@left{0pt}
|
|
|
|
|
\def\photobook@imagecell@clearance{0pt}
|
|
|
|
|
|
|
|
|
|
% fit/fill...
|
|
|
|
|
\define@boolkey{imagecell@args}{fit}[true]{%
|
|
|
|
|
\KV@imagecell@args@fillfalse}
|
|
|
|
|
\define@boolkey{imagecell@args}{fill}[true]{%
|
|
|
|
|
\KV@imagecell@args@fitfalse}
|
2021-08-19 23:53:01 +03:00
|
|
|
% center...
|
2021-08-20 01:22:17 +03:00
|
|
|
\define@boolkey{imagecell@args}{center}[true]{%
|
|
|
|
|
\def\photobook@imagecell@top{\dimexpr
|
2021-08-19 23:53:01 +03:00
|
|
|
+0.5\cellheight
|
|
|
|
|
-0.5\ht\photobook@imagebox \relax}%
|
2021-08-20 01:22:17 +03:00
|
|
|
\def\photobook@imagecell@left{\dimexpr
|
2021-08-20 16:57:00 +03:00
|
|
|
+\photobook@HOFFSETFIX
|
2021-08-19 23:53:01 +03:00
|
|
|
+0.5\cellwidth
|
|
|
|
|
-0.5\wd\photobook@imagebox \relax}}%
|
|
|
|
|
% left/right...
|
|
|
|
|
% shortdands...
|
2021-08-20 01:22:17 +03:00
|
|
|
\newcommand\photobook@imagecell@LEFT{%
|
|
|
|
|
\def\photobook@imagecell@left{\dimexpr%
|
2021-08-20 16:57:00 +03:00
|
|
|
+\photobook@HOFFSETFIX
|
2021-08-20 01:22:17 +03:00
|
|
|
+\photobook@imagecell@clearance \relax}}%
|
|
|
|
|
\newcommand\photobook@imagecell@RIGHT{%
|
|
|
|
|
\def\photobook@imagecell@left{\dimexpr
|
2021-08-20 16:57:00 +03:00
|
|
|
+\photobook@HOFFSETFIX
|
2021-08-19 23:53:01 +03:00
|
|
|
+\cellwidth
|
2021-08-20 01:22:17 +03:00
|
|
|
-\photobook@imagecell@clearance
|
2021-08-19 23:53:01 +03:00
|
|
|
-\wd\photobook@imagebox \relax}}%
|
|
|
|
|
% args...
|
2021-08-20 01:22:17 +03:00
|
|
|
\define@boolkey{imagecell@args}{left}[true]{%
|
|
|
|
|
\photobook@imagecell@LEFT}
|
2021-08-20 16:57:00 +03:00
|
|
|
\define@boolkey{imagecell@args}{right}[true]{%
|
2021-08-20 01:22:17 +03:00
|
|
|
\photobook@imagecell@RIGHT}
|
2021-08-19 23:53:01 +03:00
|
|
|
% inside/outside...
|
2021-08-20 01:22:17 +03:00
|
|
|
\define@boolkey{imagecell@args}{inside}[true]{%
|
2021-08-19 23:53:01 +03:00
|
|
|
\ifthenelse{\isodd{\thepage}}{
|
2021-08-20 01:22:17 +03:00
|
|
|
\photobook@imagecell@LEFT%
|
2021-08-19 23:53:01 +03:00
|
|
|
}{%
|
2021-08-20 01:22:17 +03:00
|
|
|
\photobook@imagecell@RIGHT}}%
|
|
|
|
|
\define@boolkey{imagecell@args}{outside}[true]{%
|
2021-08-20 16:57:00 +03:00
|
|
|
\ifthenelse{\isodd{\thepage}}{%
|
2021-08-20 01:22:17 +03:00
|
|
|
\photobook@imagecell@RIGHT%
|
2021-08-19 23:53:01 +03:00
|
|
|
}{%
|
2021-08-20 01:22:17 +03:00
|
|
|
\photobook@imagecell@LEFT}}%
|
2021-08-19 23:53:01 +03:00
|
|
|
% top/bottom...
|
2021-08-20 01:22:17 +03:00
|
|
|
\define@boolkey{imagecell@args}{top}[true]{%
|
|
|
|
|
\def\photobook@imagecell@top{%
|
|
|
|
|
\photobook@imagecell@clearance}}%
|
|
|
|
|
\define@boolkey{imagecell@args}{bottom}[true]{%
|
|
|
|
|
\def\photobook@imagecell@top{\dimexpr
|
2021-08-19 23:53:01 +03:00
|
|
|
+\cellheight
|
2021-08-20 01:22:17 +03:00
|
|
|
-\photobook@imagecell@clearance
|
2021-08-19 23:53:01 +03:00
|
|
|
-\ht\photobook@imagebox \relax}}%
|
|
|
|
|
% clearance=<len>...
|
2021-08-20 01:22:17 +03:00
|
|
|
\define@key{imagecell@args}{clearance}{%
|
|
|
|
|
\def\photobook@imagecell@clearance{#1}}%
|
2021-08-19 23:53:01 +03:00
|
|
|
|
2021-08-20 17:36:22 +03:00
|
|
|
\def\photobook@imagecell@captionalign{t}
|
|
|
|
|
\define@choicekey{imagecell@args}{caption-align}{t,c,b}[t]{%
|
|
|
|
|
\def\photobook@imagecell@captionalign{#1}}%
|
|
|
|
|
|
2021-08-19 23:53:01 +03:00
|
|
|
% XXX can't seem to get rid of small placement errors...
|
2021-08-20 01:42:20 +03:00
|
|
|
% ...feels like we've still got a stray space someplace...
|
2021-08-20 16:57:00 +03:00
|
|
|
% see: \photobook@HOFFSETFIX
|
2021-08-19 23:53:01 +03:00
|
|
|
% XXX can we make this an env???
|
2021-08-20 01:22:17 +03:00
|
|
|
\newcommand\imagecell[3][]{%
|
2021-08-20 01:42:20 +03:00
|
|
|
\begingroup%
|
2021-08-19 23:53:01 +03:00
|
|
|
% args...
|
2021-08-20 01:22:17 +03:00
|
|
|
\setkeys{imagecell@args}{fit,center,clearance=0pt,#1}%
|
2021-08-19 23:53:01 +03:00
|
|
|
% preload image...
|
2021-08-20 01:22:17 +03:00
|
|
|
% fit...
|
|
|
|
|
\ifKV@imagecell@args@fit%
|
|
|
|
|
\sbox{\photobook@imagebox}{%
|
2021-08-20 01:42:20 +03:00
|
|
|
\includegraphics[%
|
2021-08-20 01:22:17 +03:00
|
|
|
keepaspectratio,
|
|
|
|
|
width=\dimexpr
|
|
|
|
|
\cellwidth
|
|
|
|
|
- ((\photobook@imagecell@clearance) * 2) \relax,
|
|
|
|
|
height=\dimexpr
|
|
|
|
|
\cellheight
|
2021-08-20 16:57:00 +03:00
|
|
|
- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}%
|
2021-08-20 01:22:17 +03:00
|
|
|
% fill...
|
|
|
|
|
\else\ifKV@imagecell@args@fill%
|
|
|
|
|
% preload image to get its proportions...
|
|
|
|
|
\sbox{\photobook@imagebox}{\includegraphics{#3}}
|
|
|
|
|
% constrain minimal dimension of image...
|
|
|
|
|
\ifdim \wd\photobook@imagebox < \ht\photobook@imagebox%
|
|
|
|
|
\sbox{\photobook@imagebox}{%
|
2021-08-20 01:42:20 +03:00
|
|
|
\includegraphics[%
|
2021-08-20 01:22:17 +03:00
|
|
|
keepaspectratio,
|
|
|
|
|
width=\dimexpr
|
|
|
|
|
+\cellwidth
|
2021-08-20 01:42:20 +03:00
|
|
|
- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}%
|
2021-08-20 01:22:17 +03:00
|
|
|
\else%
|
|
|
|
|
\sbox{\photobook@imagebox}{%
|
2021-08-20 01:42:20 +03:00
|
|
|
\includegraphics[%
|
2021-08-20 01:22:17 +03:00
|
|
|
keepaspectratio,
|
|
|
|
|
height=\dimexpr
|
|
|
|
|
+\cellheight
|
2021-08-20 01:42:20 +03:00
|
|
|
- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}\fi\fi\fi%
|
2021-08-20 01:22:17 +03:00
|
|
|
% place image box...
|
2021-08-19 23:53:01 +03:00
|
|
|
% XXX for some odd reason without this the alignment completely breaks...
|
|
|
|
|
\vspace{0pt}%
|
2021-08-20 01:42:20 +03:00
|
|
|
\adjustbox{%
|
2021-08-19 23:53:01 +03:00
|
|
|
margin=
|
2021-08-20 16:57:00 +03:00
|
|
|
{\photobook@imagecell@left - \photobook@HOFFSETFIX}
|
2021-08-19 23:53:01 +03:00
|
|
|
0pt 0pt
|
2021-08-20 01:22:17 +03:00
|
|
|
{\photobook@imagecell@top}}{%
|
|
|
|
|
% image....
|
2021-08-19 23:53:01 +03:00
|
|
|
\usebox\photobook@imagebox%
|
2021-08-20 01:22:17 +03:00
|
|
|
% caption cell...
|
2021-08-19 23:53:01 +03:00
|
|
|
\ifx #2 \empty \else%
|
2021-08-20 01:42:20 +03:00
|
|
|
\begingroup%
|
|
|
|
|
% XXX broken for fill...
|
|
|
|
|
% XXX test for portrait images...
|
2021-08-19 23:53:01 +03:00
|
|
|
\hspace{-\mindim{%
|
|
|
|
|
\wd\photobook@imagebox
|
|
|
|
|
}{%
|
2021-08-20 01:22:17 +03:00
|
|
|
\cellwidth - \photobook@imagecell@clearance}}{%
|
2021-08-19 23:53:01 +03:00
|
|
|
\setlength\cellwidth{\dimexpr%
|
2021-08-20 16:57:00 +03:00
|
|
|
-2\photobook@HOFFSETFIX
|
2021-08-19 23:53:01 +03:00
|
|
|
+\mindim{\wd\photobook@imagebox}{\cellwidth} \relax}%
|
|
|
|
|
\setlength\cellheight{%
|
|
|
|
|
\mindim{\ht\photobook@imagebox}{\cellheight}}%
|
|
|
|
|
\setlength\fboxsep{0pt}%
|
2021-08-20 17:36:22 +03:00
|
|
|
\begin{minipage}[b][\cellheight][\photobook@imagecell@captionalign]{\cellwidth}%
|
2021-08-19 23:53:01 +03:00
|
|
|
#2%
|
|
|
|
|
\end{minipage}}%
|
|
|
|
|
\endgroup\fi}%
|
|
|
|
|
\endgroup}
|
2021-08-18 22:15:03 +03:00
|
|
|
|
|
|
|
|
|
2021-08-20 17:36:22 +03:00
|
|
|
%% \DescribeMacro{\captioncell\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% \fbox{XXX EXPERIMENTAL}
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% [ above ]
|
|
|
|
|
%% +-----------------+
|
|
|
|
|
%% |[ top ]|
|
|
|
|
|
%% | |
|
|
|
|
|
%% | |
|
|
|
|
|
%% | |
|
|
|
|
|
%% | |
|
|
|
|
|
%% | |
|
|
|
|
|
%% | |
|
|
|
|
|
%% |[ bottom ]|
|
|
|
|
|
%% +-----------------+
|
|
|
|
|
%% [ below ]
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-21 17:29:10 +03:00
|
|
|
|
2021-08-20 16:57:00 +03:00
|
|
|
% XXX revise keywords...
|
2021-08-21 17:29:10 +03:00
|
|
|
\define@boolkey{captioncell@args}{above}[true]{}
|
2021-08-20 16:57:00 +03:00
|
|
|
\define@boolkey{captioncell@args}{top}[true]{}
|
|
|
|
|
\define@boolkey{captioncell@args}{bottom}[true]{}
|
2021-08-21 17:29:10 +03:00
|
|
|
\define@boolkey{captioncell@args}{below}[true]{}
|
|
|
|
|
|
|
|
|
|
% XXX add fields: before/left/right/after... (vertical???)
|
|
|
|
|
% XXX add vertical fields direction: up/down
|
2021-08-20 16:57:00 +03:00
|
|
|
|
2021-08-21 17:29:10 +03:00
|
|
|
% XXX expand choices...
|
|
|
|
|
\define@choicekey{captioncell@args}{align}{flushleft,center,flushright}{}
|
2021-08-20 16:57:00 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
\newcommand\captioncell[2][]{%
|
2021-08-21 17:29:10 +03:00
|
|
|
\setkeys{captioncell@args}{top, align=flushleft,#1}%
|
2021-08-20 16:57:00 +03:00
|
|
|
% XXX
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
% XXX HACK -- make over/under/... an argument...
|
|
|
|
|
\newcommand\captioncellunder[1]{
|
|
|
|
|
\vspace{\cellheight}%
|
|
|
|
|
\begin{flushright}%
|
|
|
|
|
\captionformat{%
|
|
|
|
|
\adjustbox{margin=0pt 0.5em}{#1}}%
|
|
|
|
|
\end{flushright}}
|
2021-08-19 23:53:01 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
%% \DescribeMacro{\cimagetocellfit\{..\}}
|
2021-08-13 15:09:38 +03:00
|
|
|
%
|
|
|
|
|
%% Fit an image to cell (centered).
|
|
|
|
|
%
|
2021-08-19 23:53:01 +03:00
|
|
|
%% >> \cimagetocellfit[<clearence>]{<caption>}{<image>}
|
2021-08-15 13:38:32 +03:00
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% +-----------------+
|
|
|
|
|
%% | |
|
|
|
|
|
%% +-----------------+
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% | image |
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% +-----------------+
|
|
|
|
|
%% | c |
|
|
|
|
|
%% +-----------------+
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-13 15:09:38 +03:00
|
|
|
%% Image position can be tweaked via |\vspace{..}| or |\hspace{..}|
|
2021-08-16 06:53:51 +03:00
|
|
|
%
|
2021-08-19 23:53:01 +03:00
|
|
|
% XXX do we need this???
|
2021-08-15 13:38:32 +03:00
|
|
|
% XXX revise caption for vertical images...
|
2021-08-19 23:53:01 +03:00
|
|
|
\newcommand\cimagetocellfit[3][0mm]{%
|
2021-08-20 16:57:00 +03:00
|
|
|
\imagecell[center, clearance=#1]{\captioncellunder{#2}}{#3}}
|
2021-08-14 03:02:59 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
% XXX like fill but trim to cell...
|
2021-08-16 06:34:22 +03:00
|
|
|
% XXX do we need this???
|
2021-08-20 01:22:17 +03:00
|
|
|
\newcommand\imagetocellclip[3][0pt]{%
|
2021-08-16 06:34:22 +03:00
|
|
|
\begin{cliptocell}%
|
2021-08-20 01:22:17 +03:00
|
|
|
\imagecell[clearance=#1,fill]{#2}{#3}%
|
2021-08-16 06:34:22 +03:00
|
|
|
\end{cliptocell}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Paper cells
|
|
|
|
|
|
|
|
|
|
%% \DescribeEnv{papercell}
|
|
|
|
|
%
|
|
|
|
|
%% Paper cell.
|
|
|
|
|
%%
|
|
|
|
|
%% This does not include bleeds and is independent of |layoutmode|.
|
|
|
|
|
%%
|
|
|
|
|
\newenvironment{papercell}{%
|
|
|
|
|
\begin{cell}{\bleed, \bleed}{\blockwidth}{\blockheight}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{cell}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%% \DescribeEnv{paperbleedcell}
|
|
|
|
|
%
|
|
|
|
|
%% Paper bleed cell.
|
|
|
|
|
%%
|
|
|
|
|
%% Like |papercell| but includes bleeds.
|
|
|
|
|
%%
|
|
|
|
|
\newenvironment{paperbleedcell}{%
|
|
|
|
|
\begin{cell}{0, 0}{\bleedblockwidth}{\bleedblockheight}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{cell}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Page cells
|
|
|
|
|
|
|
|
|
|
%% \DescribeEnv{pagecell}
|
|
|
|
|
%
|
|
|
|
|
%% Page cell.
|
|
|
|
|
%%
|
|
|
|
|
%% This corresponds to the visible page in the |layoutmode=block| and
|
|
|
|
|
%% does not include bleeds.
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% + - - - - - - - - - +
|
|
|
|
|
%% . +---------------+ .
|
|
|
|
|
%% . | | .
|
|
|
|
|
%% . | | .
|
|
|
|
|
%% . | pagecell | .
|
|
|
|
|
%% . | | .
|
|
|
|
|
%% . | | .
|
|
|
|
|
%% . +---------------+ .
|
|
|
|
|
%% + - - - - - - - - - +
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%% Note that |layoutmode|'s other than block will change the paper size
|
|
|
|
|
%% but will not affect this.
|
|
|
|
|
%%
|
|
|
|
|
% XXX
|
|
|
|
|
\newenvironment{pagecell}{%
|
2021-08-20 16:57:00 +03:00
|
|
|
\begin{cell}{\bleed,\bleed}{\pageblockwidth}{\pageblockheight}%
|
2021-08-16 06:34:22 +03:00
|
|
|
}{%
|
|
|
|
|
\end{cell}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%% \DescribeEnv{pagebleedcell}
|
|
|
|
|
%
|
|
|
|
|
%% Like |page| but includes bleeds.
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% +-------------------+
|
|
|
|
|
%% | + - - - - - - - + |
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% | . pagebleedcell . |
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% | + - - - - - - - + |
|
|
|
|
|
%% +-------------------+
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%% Note that |layoutmode|'s other than block will change the paper size
|
|
|
|
|
%% but will not affect this.
|
|
|
|
|
%%
|
|
|
|
|
% XXX
|
|
|
|
|
\newenvironment{pagebleedcell}{%
|
|
|
|
|
\begin{cell}{0mm, 0mm}{\bleedblockwidth}{\bleedblockheight}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{cell}}
|
2021-08-13 15:09:38 +03:00
|
|
|
|
|
|
|
|
|
2021-08-17 02:13:34 +03:00
|
|
|
% XXX EXPERIMENTAL
|
2021-08-20 16:57:00 +03:00
|
|
|
%% \DescribeEnv{textcell}
|
2021-08-17 02:13:34 +03:00
|
|
|
%
|
|
|
|
|
%% A cell taking up the page text block.
|
|
|
|
|
%
|
|
|
|
|
%% >> \begin{textcell}{<width>}{<height>} ... \end{textcell}
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% <-----------> \textwidth
|
|
|
|
|
%% +---------------+
|
|
|
|
|
%% | +-----------+ | ^
|
|
|
|
|
%% | | | | | \textheight
|
|
|
|
|
%% | | textcell | | |
|
|
|
|
|
%% | | | | |
|
|
|
|
|
%% | +-----------+ | v
|
|
|
|
|
%% +---------------+
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%% Note that this is an inline cell and if something is on the page it
|
|
|
|
|
%% may not be centered properly.
|
|
|
|
|
%%
|
|
|
|
|
% XXX test...
|
|
|
|
|
\newenvironment{textcell}{%
|
|
|
|
|
\begin{inlinecell}{\textwidth}{\textheight}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{inlinecell}}
|
|
|
|
|
|
|
|
|
|
|
2021-08-09 13:43:36 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Endpaper cells
|
|
|
|
|
%
|
|
|
|
|
%% \DescribeEnv{leftside}
|
|
|
|
|
%% \DescribeEnv{rightside}
|
|
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% +---------------+---------------+
|
|
|
|
|
%% | | |
|
|
|
|
|
%% | | |
|
|
|
|
|
%% | leftside | rightside |
|
|
|
|
|
%% | | |
|
|
|
|
|
%% | | |
|
|
|
|
|
%% +---------------+---------------+
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
% XXX for some reason naming this anything starting with endpaper will
|
|
|
|
|
% make LaTeX complain that that is already defined...
|
|
|
|
|
|
|
|
|
|
\NewEnviron{leftside}{%
|
2021-08-12 15:22:03 +03:00
|
|
|
\ifendpaperlayout%
|
2021-08-12 17:00:23 +03:00
|
|
|
\begin{pagecell}%
|
2021-08-08 01:54:37 +03:00
|
|
|
\BODY%
|
2021-08-12 17:00:23 +03:00
|
|
|
\end{pagecell} \fi }
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
\NewEnviron{rightside}{%
|
2021-08-12 15:22:03 +03:00
|
|
|
\ifendpaperlayout%
|
|
|
|
|
\begin{cell}%
|
|
|
|
|
{\bleed + \pageblockwidth, \bleed}%
|
|
|
|
|
{\pageblockwidth}{\pageblockheight}%
|
2021-08-08 01:54:37 +03:00
|
|
|
\BODY%
|
2021-08-12 15:22:03 +03:00
|
|
|
\end{cell} \fi }
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
2021-08-09 13:43:36 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Cover and dust jacket cells
|
|
|
|
|
%
|
|
|
|
|
%% \DescribeEnv{frontcover}
|
|
|
|
|
%% \DescribeEnv{backcover}
|
|
|
|
|
%
|
|
|
|
|
%% \DescribeEnv{spine}
|
|
|
|
|
%% \DescribeEnv{vspine}
|
|
|
|
|
%
|
|
|
|
|
%% \DescribeEnv{frontflap}
|
|
|
|
|
%% \DescribeEnv{backflap}
|
|
|
|
|
%
|
|
|
|
|
%% Covers and dust jackets differ only in that covers do not {usually}
|
|
|
|
|
%% have flaps.
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% backflap spline/vspine frontflap
|
|
|
|
|
%% . backcover . frontcover .
|
|
|
|
|
%% v v v v v
|
|
|
|
|
%% +---+---------------+---+---------------+---+
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%% | | Back | | Front | |
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%% +---+---------------+---+---------------+---+
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-12 15:22:03 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\NewEnviron{frontcover}{%
|
2021-08-12 15:22:03 +03:00
|
|
|
\ifcoverlikelayout%
|
|
|
|
|
\begin{cell}{
|
|
|
|
|
\bleed
|
|
|
|
|
+ \jacketflapback
|
|
|
|
|
+ \coverflap
|
|
|
|
|
+ \jacketwrap
|
|
|
|
|
+ \coverboardgrow
|
|
|
|
|
+ \pageblockwidth
|
|
|
|
|
+ 2\spinefold
|
|
|
|
|
+ \spinewidth,
|
|
|
|
|
\bleed
|
|
|
|
|
+ \coverflap }%
|
|
|
|
|
{ \pageblockwidth + \coverboardgrow }%
|
|
|
|
|
{ \pageblockheight + 2\coverboardgrow }%
|
2021-08-08 01:54:37 +03:00
|
|
|
\BODY%
|
2021-08-12 15:22:03 +03:00
|
|
|
\end{cell} \fi }
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
\NewEnviron{backcover}{%
|
2021-08-12 15:22:03 +03:00
|
|
|
\ifcoverlikelayout%
|
|
|
|
|
\begin{cell}{
|
|
|
|
|
\bleed
|
|
|
|
|
+ \jacketflapback
|
|
|
|
|
+ \coverflap
|
|
|
|
|
+ \jacketwrap,
|
|
|
|
|
\bleed
|
|
|
|
|
+ \coverflap }%
|
|
|
|
|
{ \pageblockwidth + \coverboardgrow }%
|
|
|
|
|
{ \pageblockheight + 2\coverboardgrow }%
|
2021-08-08 01:54:37 +03:00
|
|
|
\BODY%
|
2021-08-12 15:22:03 +03:00
|
|
|
\end{cell} \fi }
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
% spines...
|
|
|
|
|
%
|
|
|
|
|
\NewEnviron{spine}{%
|
|
|
|
|
\ifcoverlikelayout
|
2021-08-12 15:22:03 +03:00
|
|
|
\begin{cell}{
|
|
|
|
|
\bleed
|
|
|
|
|
+ \jacketflapback
|
|
|
|
|
+ \coverflap
|
|
|
|
|
+ \jacketwrap
|
|
|
|
|
+ \coverboardgrow
|
|
|
|
|
+ \pageblockwidth
|
|
|
|
|
+ \spinefold,
|
|
|
|
|
\bleed
|
|
|
|
|
+ \coverflap }%
|
|
|
|
|
{ \spinewidth }%
|
|
|
|
|
{ \pageblockheight + 2\coverboardgrow }
|
2021-08-08 01:54:37 +03:00
|
|
|
\BODY%
|
2021-08-12 15:22:03 +03:00
|
|
|
\end{cell} \fi }
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
\NewEnviron{vspine}[1][270]{%
|
|
|
|
|
\ifcoverlikelayout
|
2021-08-12 15:22:03 +03:00
|
|
|
\begin{cell}{
|
|
|
|
|
\bleed
|
|
|
|
|
+ \jacketflapback
|
|
|
|
|
+ \coverflap
|
|
|
|
|
+ \jacketwrap
|
|
|
|
|
+ \coverboardgrow
|
|
|
|
|
+ \pageblockwidth
|
|
|
|
|
+ \spinefold,
|
|
|
|
|
\bleed
|
|
|
|
|
+ \coverflap }%
|
|
|
|
|
{ \spinewidth }%
|
|
|
|
|
{ \pageblockheight + 2\coverboardgrow }
|
|
|
|
|
\begin{turn}{#1}%
|
|
|
|
|
\begin{minipage}[t][\cellwidth][t]{\cellheight}%
|
|
|
|
|
\BODY%
|
|
|
|
|
\end{minipage}%
|
|
|
|
|
\end{turn}%
|
|
|
|
|
\end{cell} \fi }
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
% jackets flaps...
|
|
|
|
|
%
|
|
|
|
|
\NewEnviron{frontflap}{%
|
|
|
|
|
\ifjacketlayout
|
2021-08-12 15:22:03 +03:00
|
|
|
\begin{cell}{
|
|
|
|
|
\bleed
|
|
|
|
|
+ \jacketflapback
|
|
|
|
|
+ 2\jacketwrap
|
|
|
|
|
+ 2\coverboardgrow
|
|
|
|
|
+ 2\pageblockwidth
|
|
|
|
|
+ 2\spinefold
|
|
|
|
|
+ \spinewidth,
|
|
|
|
|
\bleed
|
|
|
|
|
+ \coverflap }%
|
|
|
|
|
{ \jacketflapfront }%
|
|
|
|
|
{ \pageblockheight + 2\coverboardgrow }%
|
2021-08-08 01:54:37 +03:00
|
|
|
\BODY%
|
2021-08-12 15:22:03 +03:00
|
|
|
\end{cell} \fi }
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
\NewEnviron{backflap}{%
|
|
|
|
|
\ifjacketlayout
|
2021-08-12 15:22:03 +03:00
|
|
|
\begin{cell}{
|
|
|
|
|
\bleed,
|
|
|
|
|
\bleed
|
|
|
|
|
+ \coverflap }%
|
|
|
|
|
{ \jacketflapback }%
|
|
|
|
|
{ \pageblockheight + 2\coverboardgrow }%
|
2021-08-08 01:54:37 +03:00
|
|
|
\BODY%
|
2021-08-12 15:22:03 +03:00
|
|
|
\end{cell} \fi }
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2021-08-12 16:48:00 +03:00
|
|
|
%%%%% Cell helper macros
|
|
|
|
|
|
|
|
|
|
% XXX should digits/rounding be configurable???
|
|
|
|
|
\newcommand\photobook@TemplateCell[2][mm]{
|
2021-08-08 01:54:37 +03:00
|
|
|
% XXX this seems to be bigger than the size given...
|
|
|
|
|
%\fbox{\parbox[t][\cellheight][t]{\cellwidth}{%
|
|
|
|
|
\begin{center}
|
|
|
|
|
\vfill
|
2021-08-12 16:48:00 +03:00
|
|
|
#2 \\
|
|
|
|
|
(\lenprint[#1]{\cellwidth} \space x \lenprint[#1]{\cellheight})
|
2021-08-08 01:54:37 +03:00
|
|
|
\vfill
|
|
|
|
|
\end{center} }
|
|
|
|
|
%\end{center} }} }
|
|
|
|
|
|
|
|
|
|
|
2021-08-12 16:48:00 +03:00
|
|
|
%% \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]{
|
2021-08-08 01:54:37 +03:00
|
|
|
% XXX undo this after...
|
|
|
|
|
\TPoptions{showboxes=true}
|
|
|
|
|
\begin{page}
|
|
|
|
|
\setlength{\parindent}{0em}
|
|
|
|
|
% NOTE: only the relevant blocks will be visible...
|
|
|
|
|
\begin{leftside}
|
2021-08-12 16:48:00 +03:00
|
|
|
\photobook@TemplateCell[#1]{ENDPAPER LEFT}
|
2021-08-08 01:54:37 +03:00
|
|
|
\end{leftside}
|
|
|
|
|
\begin{rightside}
|
2021-08-12 16:48:00 +03:00
|
|
|
\photobook@TemplateCell[#1]{ENDPAPER RIGHT}
|
2021-08-08 01:54:37 +03:00
|
|
|
\end{rightside}
|
|
|
|
|
\begin{frontcover}
|
2021-08-12 16:48:00 +03:00
|
|
|
\photobook@TemplateCell[#1]{FRONT COVER}
|
2021-08-08 01:54:37 +03:00
|
|
|
\end{frontcover}
|
|
|
|
|
%\begin{vspine}[90]
|
|
|
|
|
%\begin{vspine}[down]
|
|
|
|
|
\begin{vspine}
|
2021-08-12 16:48:00 +03:00
|
|
|
\photobook@TemplateCell[#1]{SPINE}
|
2021-08-08 01:54:37 +03:00
|
|
|
\end{vspine}
|
|
|
|
|
\begin{backcover}
|
2021-08-12 16:48:00 +03:00
|
|
|
\photobook@TemplateCell[#1]{BACK COVER}
|
2021-08-08 01:54:37 +03:00
|
|
|
\end{backcover}
|
|
|
|
|
\begin{frontflap}
|
2021-08-12 16:48:00 +03:00
|
|
|
\photobook@TemplateCell[#1]{FRONT FLAP}
|
2021-08-08 01:54:37 +03:00
|
|
|
\end{frontflap}
|
|
|
|
|
\begin{backflap}
|
2021-08-12 16:48:00 +03:00
|
|
|
\photobook@TemplateCell[#1]{BACK FLAP}
|
2021-08-08 01:54:37 +03:00
|
|
|
\end{backflap}
|
|
|
|
|
\end{page} }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
% pages...
|
|
|
|
|
|
|
|
|
|
% XXX
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%%%% Captions
|
|
|
|
|
% XXX need to be able to configure/pass/override:
|
|
|
|
|
% - size / \captionsize...
|
|
|
|
|
% - color...
|
|
|
|
|
% XXX captions seem not to account for \imageblockoffsettop...
|
|
|
|
|
|
|
|
|
|
%\newcommand\captionsize{\scriptsize}
|
|
|
|
|
\newcommand\captionsize{\fontsize{6.5pt}{8pt}\selectfont}
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imagecaption\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% >> \imagecaption{<caption>}{<location-date>}
|
|
|
|
|
%%
|
|
|
|
|
\newcommand\imagecaption[2]{
|
|
|
|
|
{\captionsize%
|
|
|
|
|
#1 %
|
|
|
|
|
\par\vspace{-\parskip}%
|
|
|
|
|
#2}}
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\overlaycaption\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% >> \overlaycaption{<caption>}{<location-date>}
|
|
|
|
|
%%
|
|
|
|
|
\newcommand\overlaycaption[2]{
|
|
|
|
|
\begin{flushright}
|
|
|
|
|
\captionsize%
|
|
|
|
|
\color{black}{%
|
|
|
|
|
\colorbox{white}{ #1 }%
|
|
|
|
|
\par\vspace{-\parskip}%
|
|
|
|
|
\colorbox{white}{ #2 }}
|
|
|
|
|
\end{flushright}}
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\captionsidebox\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% >> \captionsidebox[<offset>]{<imagebox>}{<text>}
|
|
|
|
|
%%
|
|
|
|
|
\newcommand\captionsidebox[3][0mm]{
|
|
|
|
|
\begin{minipage}{\dimexpr
|
|
|
|
|
% caption-image distance...
|
|
|
|
|
-1em
|
|
|
|
|
-\clearimage
|
|
|
|
|
+\blockwidth
|
|
|
|
|
-(\wd#2 - #1)
|
|
|
|
|
+(\nudgeimageby)
|
|
|
|
|
-(0.5\blockwidth - 0.5\textwidth) \relax}%
|
|
|
|
|
{ \captionsize #3 }
|
|
|
|
|
\end{minipage}}
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\captionboxleft\{..\}}
|
|
|
|
|
%% \DescribeMacro{\captionboxright\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% >> \captionboxleft[<offset>]{<imagebox>}{<text>}
|
|
|
|
|
%% >> \captionboxright[<offset>]{<imagebox>}{<text>}
|
|
|
|
|
%%
|
|
|
|
|
\newcommand\captionboxleft[3][0mm]{
|
|
|
|
|
\null
|
|
|
|
|
\vfill
|
|
|
|
|
\begin{flushleft}
|
|
|
|
|
\captionsidebox[#1]{#2}{%
|
|
|
|
|
\begin{flushright}
|
|
|
|
|
#3
|
|
|
|
|
\end{flushright}}
|
|
|
|
|
\end{flushleft}}
|
|
|
|
|
\newcommand\captionboxright[3][0mm]{
|
|
|
|
|
\null
|
|
|
|
|
\vfill
|
|
|
|
|
\begin{flushright}
|
|
|
|
|
\captionsidebox[#1]{#2}{%
|
|
|
|
|
\begin{flushleft}
|
|
|
|
|
#3
|
|
|
|
|
\end{flushleft}}
|
|
|
|
|
\end{flushright}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% XXX \CAPTIONWIDTHFIX
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\captionbottombox\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% >> \captionbottombox[<offset>]{<imagebox>}{<text>}
|
|
|
|
|
%%
|
|
|
|
|
% XXX for some reason the width is wrong here...
|
|
|
|
|
\newcommand\captionbottombox[3][0mm]{
|
|
|
|
|
\hspace{ #1 }{
|
|
|
|
|
% XXX the \CAPTIONWIDTHFIX factor is compensating for an odd alignment error...
|
|
|
|
|
\begin{minipage}{\dimexpr \CAPTIONWIDTHFIX + \wd#2 \relax}
|
|
|
|
|
{ \captionsize #3 }
|
|
|
|
|
\end{minipage}}}
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\graycaptionpage\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% >> \graycaptionpage{<text>}
|
|
|
|
|
%%
|
|
|
|
|
% XXX should this be \captionsize or \scriptsize
|
|
|
|
|
\newcommand\graycaptionpage[1]{
|
|
|
|
|
\pagestyle{empty}
|
|
|
|
|
\pagecolor{normgray}
|
|
|
|
|
\color{white}
|
|
|
|
|
\null
|
|
|
|
|
\vfill
|
|
|
|
|
\hspace{0.66\textwidth}{%
|
|
|
|
|
\begin{minipage}{0.33\textwidth}
|
|
|
|
|
\setlength{\parskip}{0.5em}%
|
|
|
|
|
\captionsize\it%
|
|
|
|
|
#1
|
|
|
|
|
\end{minipage} }
|
|
|
|
|
\newpage
|
|
|
|
|
\nopagecolor
|
|
|
|
|
\color{black} }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%%%% Page Templates
|
|
|
|
|
|
|
|
|
|
\newsavebox\photobook@imagebox
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imagepagefitWH\{..\}}
|
2021-08-08 12:16:50 +03:00
|
|
|
%
|
|
|
|
|
%% >> \imagepagefitWH{<width>}{<height>}{<caption>}{<image>}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
% NOTE: width and hight are ratios of \textwidth and \textheight
|
|
|
|
|
% respectively.
|
|
|
|
|
% i.e. \imagepagefitWH{0.5}{0.5}{...} will set image size to half
|
|
|
|
|
% the size of the text block....
|
|
|
|
|
%
|
|
|
|
|
% XXX this generates lots of warnings...
|
|
|
|
|
% XXX broblems with captions:
|
|
|
|
|
% - vertical offset is floating depending on image proportions...
|
|
|
|
|
% - width is a bit off...
|
|
|
|
|
% XXX BUG: vertical alignment falls apart if page head is changed...
|
|
|
|
|
% XXX replace \ifthenelse\isodd .. with etoolbox equivalent.... (???)
|
|
|
|
|
\newcommand\imagepagefitWH[4]{
|
|
|
|
|
\sbox{\photobook@imagebox}{
|
|
|
|
|
\includegraphics[
|
|
|
|
|
keepaspectratio=true,
|
|
|
|
|
width=#1\textwidth,
|
2021-08-16 06:34:22 +03:00
|
|
|
height=#2\textheight,]{#4} }
|
2021-08-08 01:54:37 +03:00
|
|
|
\null
|
|
|
|
|
\vfill
|
|
|
|
|
% image...
|
|
|
|
|
\vspace{ \imageblockoffsettop\textheight }
|
|
|
|
|
\begin{center}
|
|
|
|
|
\usebox\photobook@imagebox
|
|
|
|
|
\end{center}
|
|
|
|
|
\vfill
|
|
|
|
|
% caption...
|
|
|
|
|
\ShipoutPicture{
|
2021-08-20 16:57:00 +03:00
|
|
|
% XXX for some magical reason \vfill here makes latex err
|
|
|
|
|
% "Missing } inserted", removing it fixes the error but breaks
|
|
|
|
|
% captions...
|
|
|
|
|
% ...also adding a '}' here does not break things...
|
2021-08-08 01:54:37 +03:00
|
|
|
\vfill
|
|
|
|
|
\vspace{ \dimexpr
|
|
|
|
|
% XXX this is not accurate for some reason...
|
|
|
|
|
( 1em
|
|
|
|
|
+ (\dimexpr \imageblockoffsettop\textheight / 2 \relax)
|
|
|
|
|
+ \paperheight
|
|
|
|
|
+ \ht\photobook@imagebox )
|
|
|
|
|
/ 2 \relax }
|
|
|
|
|
\begin{minipage}{\paperwidth}
|
|
|
|
|
\begin{center}
|
|
|
|
|
\ifthenelse{\isodd{\thepage}}%
|
|
|
|
|
% odd pages...
|
|
|
|
|
{ \captionbottombox[ \bindingoffset ]{\photobook@imagebox}{%
|
|
|
|
|
\begin{flushright}
|
|
|
|
|
#3
|
|
|
|
|
\end{flushright} } }%
|
|
|
|
|
% even pages...
|
|
|
|
|
{ \captionbottombox[ -\bindingoffset ]{\photobook@imagebox}{%
|
|
|
|
|
\begin{flushright}
|
|
|
|
|
#3
|
|
|
|
|
\end{flushright} } }%
|
|
|
|
|
\end{center}
|
|
|
|
|
\end{minipage} }
|
|
|
|
|
\newpage }
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imagepagefitW\{..\}}
|
|
|
|
|
%% \DescribeMacro{\imagepagefitH\{..\}}
|
2021-08-08 12:16:50 +03:00
|
|
|
%
|
|
|
|
|
%% Shorthands to |\imagepagefitWH|
|
|
|
|
|
%
|
|
|
|
|
%% >> \imagepagefitH[<height>]{<caption>}{<image>}
|
|
|
|
|
%% >> \imagepagefitW[<width>]{<caption>}{<image>}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\newcommand\imagepagefitH[3][\imageblockheight]{
|
|
|
|
|
\imagepagefitWH{\imageblockwidth}{#1}{#2}{#3} }
|
|
|
|
|
\newcommand\imagepagefitW[3][\imageblockwidth]{
|
|
|
|
|
\imagepagefitWH{#1}{\imageblockheight}{#2}{#3} }
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imagepage\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% Basic image page
|
|
|
|
|
%
|
|
|
|
|
%% >> \imagepage{<caption>}{<path>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% +---------------+
|
|
|
|
|
%% | |
|
|
|
|
|
%% | +-----------+ |
|
|
|
|
|
%% | |. .| |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | image | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | |. .| |
|
|
|
|
|
%% | +-----------+ |
|
|
|
|
|
%% | c |
|
|
|
|
|
%% | |
|
|
|
|
|
%% +---------------+
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-20 16:57:00 +03:00
|
|
|
\newcommand\imagepageO[2]{
|
2021-08-08 01:54:37 +03:00
|
|
|
\imagepagefitWH{\imageblockwidth}{\imageblockheight}{#1}{#2} }
|
|
|
|
|
|
|
|
|
|
|
2021-08-20 16:57:00 +03:00
|
|
|
% XXX this is not yet 100% the same as \imagepage{..}
|
|
|
|
|
% - vertical offset seems not to match (not sure who's fault is it)...
|
|
|
|
|
% XXX needs caption...
|
|
|
|
|
\newcommand\imagepage[2]{%
|
|
|
|
|
\begin{page}%
|
|
|
|
|
\begin{pagecell}%
|
|
|
|
|
\begin{minipage}[t][\cellheight][c]{\cellwidth}%
|
|
|
|
|
\vspace{\imageblockoffsettop\pagetextheight}%
|
|
|
|
|
\begin{center}%
|
|
|
|
|
\hspace{\ifnumodd{\thepage}{\bindingoffset}{-\bindingoffset}}{%
|
|
|
|
|
\begin{inlinecell}%
|
|
|
|
|
{\imageblockwidth\pagetextwidth}%
|
|
|
|
|
{\imageblockheight\pagetextheight}%
|
|
|
|
|
\imagecell[fit]{\captioncellunder{#1}}{#2}%
|
|
|
|
|
\end{inlinecell}}%
|
|
|
|
|
\end{center}%
|
|
|
|
|
\end{minipage}%
|
|
|
|
|
\end{pagecell}%
|
|
|
|
|
\end{page}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
% XXX
|
|
|
|
|
% XXX captions wrong...
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imagepagefit\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% Similar to |\imagepage| but will fit an image into page...
|
|
|
|
|
%
|
|
|
|
|
%% >> \imagepagefit[<clearence>]{<caption>}{<image>}
|
2021-08-14 03:02:59 +03:00
|
|
|
%%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . .
|
2021-08-08 12:16:50 +03:00
|
|
|
%% +---------------+
|
|
|
|
|
%% | |. .| |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | image | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | |. .| |
|
|
|
|
|
%% +---------------+
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . .
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-14 03:02:59 +03:00
|
|
|
\newcommand\imagepagefit[3][\clearimage]{%
|
|
|
|
|
\null%
|
2021-08-13 15:09:38 +03:00
|
|
|
\begin{pagecell}%
|
2021-08-19 23:53:01 +03:00
|
|
|
\cimagetocellfit[#1]{#2}{#3}%
|
2021-08-14 03:02:59 +03:00
|
|
|
\end{pagecell}%
|
2021-08-13 15:09:38 +03:00
|
|
|
\clearpage }
|
|
|
|
|
|
2021-08-14 03:02:59 +03:00
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imagepagefill\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-14 03:02:59 +03:00
|
|
|
%% Like |\imagepage| but will fill page with image.
|
2021-08-08 12:16:50 +03:00
|
|
|
%
|
|
|
|
|
%% >> \imagepagefill[<clearence>]{<caption>}{<image>}
|
2021-08-14 03:02:59 +03:00
|
|
|
%%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-14 03:02:59 +03:00
|
|
|
%% . . . . . . . . . . . . . . . . . . .
|
|
|
|
|
%% . . +---------------+ . .
|
|
|
|
|
%% . . | c | . .
|
|
|
|
|
%% . . | | . .
|
|
|
|
|
%% . |. .| .
|
|
|
|
|
%% . | . . | .
|
|
|
|
|
%% . | image | .
|
|
|
|
|
%% . | . . | .
|
|
|
|
|
%% . |. .| .
|
|
|
|
|
%% . . | | . .
|
|
|
|
|
%% . . | | . .
|
|
|
|
|
%% . . +---------------+ . .
|
|
|
|
|
%% . . . . . . . . . . . . . . . . . . .
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-14 03:02:59 +03:00
|
|
|
% XXX add nudge/grow support...
|
2021-08-08 01:54:37 +03:00
|
|
|
\newcommand\imagepagefill[3][\clearimage]{
|
2021-08-14 03:02:59 +03:00
|
|
|
\null%
|
|
|
|
|
\begin{pagecell}%
|
2021-08-20 01:22:17 +03:00
|
|
|
\imagecell[clearance=#1,fill]{#2}{#3}%
|
2021-08-14 03:02:59 +03:00
|
|
|
\end{pagecell}%
|
|
|
|
|
\clearpage }
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
% XXX
|
|
|
|
|
% XXX \OFFSETFIX
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\portraitimagepageleft\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% >> portraitimagepageleft[<clearence>]{<caption>}{<image>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . . .
|
|
|
|
|
%% . +---------------+
|
|
|
|
|
%% . |. .| |
|
|
|
|
|
%% . | . . | |
|
|
|
|
|
%% . | . . | |
|
|
|
|
|
%% . | . . | |
|
|
|
|
|
%% . | image | |
|
|
|
|
|
%% . | . . | |
|
|
|
|
|
%% . | . . | |
|
|
|
|
|
%% . | . . | |
|
|
|
|
|
%% . |. .| c |
|
|
|
|
|
%% . +---------------+
|
|
|
|
|
%% . . . . . . . .
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\newcommand\portraitimagepageleft[3][\clearimage]{
|
|
|
|
|
\sbox{\photobook@imagebox}{
|
|
|
|
|
\includegraphics[
|
|
|
|
|
keepaspectratio,
|
2021-08-16 06:34:22 +03:00
|
|
|
height=\dimexpr \blockheight - ((#1) * 2) \relax,]{#3} }
|
2021-08-08 01:54:37 +03:00
|
|
|
\clearpage
|
|
|
|
|
\captionboxright[-#1]{\photobook@imagebox}{#2}
|
|
|
|
|
\ShipoutPicture{
|
|
|
|
|
\AtPageLowerLeft{
|
|
|
|
|
\hspace*{\dimexpr \OFFSETFIX + #1 \relax}{
|
|
|
|
|
\raisebox{\dimexpr #1 + \bleed \relax}{
|
|
|
|
|
\usebox\photobook@imagebox } } } }
|
|
|
|
|
\newpage }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% XXX
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\portraitimagepageright\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-08 14:07:52 +03:00
|
|
|
%% >> portraitimagepageright{<caption>}{<image>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-08 14:07:52 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . . .
|
|
|
|
|
%% +---------------+ .
|
|
|
|
|
%% | |. .| .
|
|
|
|
|
%% | | . . | .
|
|
|
|
|
%% | | . . | .
|
|
|
|
|
%% | | . . | .
|
|
|
|
|
%% | | image | .
|
|
|
|
|
%% | | . . | .
|
|
|
|
|
%% | | . . | .
|
|
|
|
|
%% | | . . | .
|
|
|
|
|
%% | c |. .| .
|
|
|
|
|
%% +---------------+ .
|
|
|
|
|
%% . . . . . . . .
|
2021-08-08 14:07:52 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\newcommand\portraitimagepageright[3][\clearimage]{
|
|
|
|
|
\sbox{\photobook@imagebox}{
|
|
|
|
|
\includegraphics[
|
|
|
|
|
keepaspectratio,
|
2021-08-16 06:34:22 +03:00
|
|
|
height=\dimexpr \blockheight - ((#1) * 2) \relax,]{#3} }
|
2021-08-08 01:54:37 +03:00
|
|
|
\clearpage
|
|
|
|
|
\captionboxleft[-#1]{\photobook@imagebox}{#2}
|
|
|
|
|
\ShipoutPicture{
|
|
|
|
|
\AtPageLowerLeft{
|
|
|
|
|
\hspace*{\dimexpr
|
|
|
|
|
-#1
|
|
|
|
|
+\blockwidth
|
|
|
|
|
-\wd\photobook@imagebox \relax}{
|
|
|
|
|
\raisebox{\dimexpr #1 + \bleed \relax}{
|
|
|
|
|
\usebox\photobook@imagebox } } } }
|
|
|
|
|
\newpage }
|
|
|
|
|
|
|
|
|
|
|
2021-08-10 06:14:42 +03:00
|
|
|
% XXX
|
|
|
|
|
% XXX \OFFSETFIX
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imageleftspreadfullbleed\{..\}}
|
2021-08-10 06:14:42 +03:00
|
|
|
%
|
|
|
|
|
%% Image left page spread with full bleed.
|
|
|
|
|
%
|
|
|
|
|
%% >> \imageleftspreadfullbleed[<vertical-offset>]{<caption>}{<image>}
|
|
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . . . . . . .
|
|
|
|
|
%% . +---------------+
|
|
|
|
|
%% . | . |
|
|
|
|
|
%% . | . |
|
|
|
|
|
%% . | . |
|
|
|
|
|
%% . | . |
|
|
|
|
|
%% . | image
|
|
|
|
|
%% . | . |
|
|
|
|
|
%% . | . |
|
|
|
|
|
%% . | . |
|
|
|
|
|
%% . | . c |
|
|
|
|
|
%% . +---------------+
|
|
|
|
|
%% . . . . . . . . . . . .
|
2021-08-10 06:14:42 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-10 06:14:42 +03:00
|
|
|
\newcommand\imageleftspreadfullbleed[3][0mm]{
|
|
|
|
|
\sbox{\photobook@imagebox}{
|
|
|
|
|
\includegraphics[
|
|
|
|
|
keepaspectratio,
|
|
|
|
|
width=\dimexpr
|
2021-08-16 06:34:22 +03:00
|
|
|
2\blockwidth - 2\clearimage + \vgrowimageby \relax,]{#3} }
|
2021-08-10 06:14:42 +03:00
|
|
|
\clearpage
|
|
|
|
|
\null
|
|
|
|
|
\vfill
|
|
|
|
|
\begin{flushright}
|
|
|
|
|
#2
|
|
|
|
|
\end{flushright}
|
|
|
|
|
\ShipoutPicture{
|
|
|
|
|
\AtPageCenter{
|
|
|
|
|
\hspace{\dimexpr
|
|
|
|
|
\OFFSETFIX
|
|
|
|
|
-(\nudgeimageby)
|
|
|
|
|
+\clearimage
|
|
|
|
|
-0.5\blockwidth \relax}{
|
|
|
|
|
\raisebox{\dimexpr
|
|
|
|
|
(#1)
|
|
|
|
|
+\clearimage
|
|
|
|
|
-(0.5\blockheight
|
|
|
|
|
+(0.5\ht\photobook@imagebox - 0.5\blockheight))
|
|
|
|
|
- 0.5\vgrowimageby - \vnudgeimageby \relax}{
|
|
|
|
|
\usebox\photobook@imagebox } } } }
|
|
|
|
|
\newpage
|
|
|
|
|
\resetnudgeimage }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% XXX
|
|
|
|
|
% XXX \OFFSETFIX
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imagerightspreadfullbleed\{..\}}
|
2021-08-10 06:14:42 +03:00
|
|
|
%
|
|
|
|
|
%% Image spread right page with full bleed.
|
|
|
|
|
%
|
|
|
|
|
%% >> \imagerightspreadfullbleed[<vertical-offset>]{<caption>}{<image>}
|
|
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . . . . . . .
|
|
|
|
|
%% +---------------+ .
|
|
|
|
|
%% | . | .
|
|
|
|
|
%% | . | .
|
|
|
|
|
%% | . | .
|
|
|
|
|
%% | . | .
|
|
|
|
|
%% image | .
|
|
|
|
|
%% | . | .
|
|
|
|
|
%% | . | .
|
|
|
|
|
%% | . | .
|
|
|
|
|
%% | . c | .
|
|
|
|
|
%% +---------------+ .
|
|
|
|
|
%% . . . . . . . . . . . .
|
2021-08-10 06:14:42 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-10 06:14:42 +03:00
|
|
|
\newcommand\imagerightspreadfullbleed[3][0mm]{
|
|
|
|
|
\sbox{\photobook@imagebox}{
|
|
|
|
|
\includegraphics[
|
|
|
|
|
keepaspectratio,
|
|
|
|
|
width=\dimexpr
|
2021-08-16 06:34:22 +03:00
|
|
|
2\blockwidth - 2\clearimage + \vgrowimageby \relax,]{#3} }
|
2021-08-10 06:14:42 +03:00
|
|
|
\clearpage
|
|
|
|
|
\null
|
|
|
|
|
\vfill
|
|
|
|
|
% XXX for some reason the last line here is a bit off...
|
|
|
|
|
% XXX do we need to restrict caption width here??? ...0.5\textwidth??
|
|
|
|
|
% XXX make caption sizing a bit more flexible...
|
|
|
|
|
\begin{flushright}
|
|
|
|
|
\captionsize #2
|
|
|
|
|
\end{flushright}
|
|
|
|
|
\ShipoutPicture{
|
|
|
|
|
\AtPageCenter{
|
|
|
|
|
\hspace{\dimexpr
|
|
|
|
|
\OFFSETFIX
|
|
|
|
|
-(\nudgeimageby)
|
|
|
|
|
+\clearimage
|
|
|
|
|
-1.5\blockwidth \relax}{
|
|
|
|
|
\raisebox{\dimexpr
|
|
|
|
|
(#1)
|
|
|
|
|
+\clearimage
|
|
|
|
|
-(0.5\blockheight
|
|
|
|
|
+(0.5\ht\photobook@imagebox - 0.5\blockheight))
|
|
|
|
|
- 0.5\vgrowimageby - \vnudgeimageby \relax}{
|
|
|
|
|
\usebox\photobook@imagebox } } } }
|
|
|
|
|
\newpage
|
|
|
|
|
\resetnudgeimage }
|
|
|
|
|
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%%%% Spread Templates
|
|
|
|
|
|
|
|
|
|
\newlength{\photobook@tmpnudgeimageby}
|
|
|
|
|
\newlength{\photobook@tmpvnudgeimageby}
|
|
|
|
|
\newlength{\photobook@tmpvgrowimageby}
|
|
|
|
|
|
|
|
|
|
\newlength{\nudgeimageby}
|
|
|
|
|
\setlength{\nudgeimageby}{0mm}
|
|
|
|
|
|
|
|
|
|
\newlength{\vnudgeimageby}
|
|
|
|
|
\setlength{\vnudgeimageby}{0mm}
|
|
|
|
|
|
|
|
|
|
\newlength{\vgrowimageby}
|
|
|
|
|
\setlength{\vgrowimageby}{0mm}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\nudgeimage\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-09 13:43:36 +03:00
|
|
|
%% Nudge an image horizontally within bleeds. Positive values nudge/move
|
|
|
|
|
%% to the right negative values nudge left.
|
|
|
|
|
%
|
|
|
|
|
%% >> \nudgeimage{<amount>}
|
|
|
|
|
%
|
|
|
|
|
%% in addition to spread commands below this is also used by |\captionsidebox{..}|
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\newcommand\nudgeimage[1]{%
|
|
|
|
|
\setlength{\nudgeimageby}{#1}}
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\vnudgeimage\{..\}}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
|
|
|
|
%% Like |\nudgeimage{..}| but nudges vertically.
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-09 13:43:36 +03:00
|
|
|
%% >> \vnudgeimage{<amount>}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
% NOTE: this should not be used in conjunction with \vgrowimage{..} and
|
|
|
|
|
% should not exceed 1/2 of the amount given to \vgrowimage{..}
|
|
|
|
|
\newcommand\vnudgeimage[1]{%
|
|
|
|
|
\setlength{\vnudgeimageby}{#1}}
|
|
|
|
|
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\vgrowimage\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-09 13:43:36 +03:00
|
|
|
%% Grow an image within bleeds.
|
|
|
|
|
%
|
|
|
|
|
%% >> \vgrowimage{<amount>}
|
|
|
|
|
%
|
|
|
|
|
%% This sizes the image relative to its center this adding 1/2 the
|
|
|
|
|
%% amount to the top and 1/2 to the bottom.
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\newcommand\vgrowimage[1]{%
|
|
|
|
|
\setlength{\vgrowimageby}{#1}}
|
|
|
|
|
|
|
|
|
|
|
2021-08-09 13:43:36 +03:00
|
|
|
%% \DescribeMacro{\resetnudgeimage}
|
|
|
|
|
%
|
|
|
|
|
%% Reset the effects of nudging and growing back to 0.
|
|
|
|
|
%
|
|
|
|
|
%% >> \resetnudgeimage
|
|
|
|
|
%
|
|
|
|
|
%% When working with shipout place this after |\newpage| as when
|
|
|
|
|
%% placed before this will reset the |\nudgeimageby{..}| BEFORE the image
|
|
|
|
|
%% placing commands have a chance to execute.
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
% XXX rename
|
|
|
|
|
\newcommand\resetnudgeimage{%
|
|
|
|
|
\setlength{\vgrowimageby}{0mm}%
|
|
|
|
|
\setlength{\vnudgeimageby}{0mm}%
|
|
|
|
|
\setlength{\nudgeimageby}{0mm}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
|
|
|
|
|
% XXX
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\portraitspreadbleedleft\{..\}}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
|
|
|
|
%% >> \portraitspreadbleedleft[<clearence>]{<caption>}{<image>}
|
|
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . . .
|
2021-08-09 13:43:36 +03:00
|
|
|
%% +---------------+---------------+
|
|
|
|
|
%% | |. .| |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | image | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | |. .| c |
|
|
|
|
|
%% +---------------+---------------+
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . . .
|
2021-08-09 13:43:36 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\newcommand\portraitspreadbleedleft[3][\clearimage]{
|
|
|
|
|
\cleartoleftpage
|
|
|
|
|
% style the caption...
|
|
|
|
|
\null
|
|
|
|
|
\vfill
|
|
|
|
|
\begin{flushright}
|
|
|
|
|
#2%
|
|
|
|
|
\end{flushright}
|
|
|
|
|
\newpage
|
|
|
|
|
% XXX add \bleed
|
|
|
|
|
\portraitimagepageleft[#1]{}{#3} }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% XXX
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\portraitspreadbleedright\{..\}}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
|
|
|
|
%% >> \portraitspreadbleedright[<clearence>]{<caption>}{<image>}
|
|
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . . .
|
2021-08-09 13:43:36 +03:00
|
|
|
%% +---------------+---------------+
|
|
|
|
|
%% | |. .| |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | image | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | c |. .| |
|
|
|
|
|
%% +---------------+---------------+
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . . .
|
2021-08-09 13:43:36 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\newcommand\portraitspreadbleedright[3][\clearimage]{
|
|
|
|
|
\cleartoleftpage
|
|
|
|
|
% style the caption...
|
|
|
|
|
% XXX add \bleed
|
|
|
|
|
\portraitimagepageright[#1]{}{#3}
|
|
|
|
|
\null
|
|
|
|
|
\vfill
|
|
|
|
|
\begin{flushleft}
|
|
|
|
|
#2%
|
|
|
|
|
\end{flushleft}
|
|
|
|
|
\newpage }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% XXX
|
|
|
|
|
% XXX \OFFSETFIX
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imagespreadleft\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-09 13:43:36 +03:00
|
|
|
%% Image spread aligned left (with bleed).
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-09 13:43:36 +03:00
|
|
|
%% >> \imagespreadleft[<clearence>]{<caption>}{<image>}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-09 13:43:36 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . . . . . . . . . . .
|
|
|
|
|
%% . +---------------+---------------+
|
|
|
|
|
%% . | . . . | |
|
|
|
|
|
%% . | . . . | |
|
|
|
|
|
%% . | . . . | |
|
|
|
|
|
%% . | . .. | |
|
|
|
|
|
%% . | image | |
|
|
|
|
|
%% . | . .. | |
|
|
|
|
|
%% . | . . . | |
|
|
|
|
|
%% . | . . . | |
|
|
|
|
|
%% . | . . . | c |
|
|
|
|
|
%% . +---------------+---------------+
|
|
|
|
|
%% . . . . . . . . . . . . . . . .
|
2021-08-09 13:43:36 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
% XXX might be a good idea to do a version of this with min/max width of
|
|
|
|
|
% the caption block...
|
|
|
|
|
\newcommand\imagespreadleft[3][\clearimage]{
|
|
|
|
|
\sbox{\photobook@imagebox}{
|
|
|
|
|
\includegraphics[
|
|
|
|
|
keepaspectratio,
|
2021-08-16 06:34:22 +03:00
|
|
|
height=\dimexpr \blockheight - ((#1) * 2) + \vgrowimageby \relax,]{#3} }
|
2021-08-08 01:54:37 +03:00
|
|
|
% left page...
|
|
|
|
|
% XXX BUG: this in some cases creates an extra empty spread before this...
|
|
|
|
|
% ...appears to be a problem where we have a tweak.tex
|
2021-08-13 15:09:38 +03:00
|
|
|
\cleartoleftpage
|
2021-08-08 01:54:37 +03:00
|
|
|
\null
|
|
|
|
|
\ShipoutPicture{
|
|
|
|
|
\AtPageLowerLeft{
|
|
|
|
|
\hspace*{\dimexpr
|
|
|
|
|
\OFFSETFIX
|
|
|
|
|
-(\nudgeimageby)
|
|
|
|
|
+#1
|
|
|
|
|
+\bleed
|
|
|
|
|
\relax}{
|
|
|
|
|
\raisebox{\dimexpr
|
|
|
|
|
#1
|
|
|
|
|
+ \bleed
|
|
|
|
|
- 0.5\vgrowimageby
|
|
|
|
|
- \vnudgeimageby
|
|
|
|
|
\relax}{
|
|
|
|
|
\usebox\photobook@imagebox } } } }
|
|
|
|
|
\newpage
|
|
|
|
|
% right page...
|
|
|
|
|
\captionboxright[\blockwidth]{\photobook@imagebox}{#2}
|
|
|
|
|
\ShipoutPicture{
|
|
|
|
|
\AtPageLowerLeft{
|
|
|
|
|
\hspace*{\dimexpr
|
|
|
|
|
\OFFSETFIX
|
|
|
|
|
-(\nudgeimageby)
|
|
|
|
|
+#1
|
|
|
|
|
-\blockwidth
|
|
|
|
|
+\bleed
|
|
|
|
|
\relax}{
|
|
|
|
|
\raisebox{\dimexpr
|
|
|
|
|
#1
|
|
|
|
|
+ \bleed
|
|
|
|
|
- 0.5\vgrowimageby
|
|
|
|
|
- \vnudgeimageby
|
|
|
|
|
\relax}{
|
|
|
|
|
\usebox\photobook@imagebox } } } }
|
|
|
|
|
\newpage
|
|
|
|
|
\resetnudgeimage }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% XXX
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imagespreadright\{..\}}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
|
|
|
|
%% Image spread aligned right (with bleed).
|
|
|
|
|
%
|
|
|
|
|
%% >> \imagespreadright[<clearence>]{<caption>}{<image>}
|
|
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . . . . . . . . . . .
|
|
|
|
|
%% +---------------+---------------+ .
|
|
|
|
|
%% | | . . . | .
|
|
|
|
|
%% | | . . . | .
|
|
|
|
|
%% | | . . . | .
|
|
|
|
|
%% | | .. . | .
|
|
|
|
|
%% | | image | .
|
|
|
|
|
%% | | .. . | .
|
|
|
|
|
%% | | . . . | .
|
|
|
|
|
%% | | . . . | .
|
|
|
|
|
%% | c | . . . | .
|
|
|
|
|
%% +---------------+---------------+ .
|
|
|
|
|
%% . . . . . . . . . . . . . . . .
|
2021-08-09 13:43:36 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
\newcommand\imagespreadright[3][\clearimage]{
|
|
|
|
|
\sbox{\photobook@imagebox}{
|
|
|
|
|
\includegraphics[
|
|
|
|
|
keepaspectratio,
|
2021-08-16 06:34:22 +03:00
|
|
|
height=\dimexpr \blockheight - ((#1) * 2) + \vgrowimageby \relax,]{#3} }
|
2021-08-08 01:54:37 +03:00
|
|
|
% left page...
|
2021-08-13 15:09:38 +03:00
|
|
|
\cleartoleftpage
|
2021-08-08 01:54:37 +03:00
|
|
|
\null
|
|
|
|
|
\captionboxleft[\blockwidth]{\photobook@imagebox}{#2}
|
|
|
|
|
\ShipoutPicture{
|
|
|
|
|
\AtPageLowerLeft{
|
|
|
|
|
\hspace*{\dimexpr
|
|
|
|
|
-#1
|
|
|
|
|
+0.5\OFFSETFIX
|
|
|
|
|
+(\nudgeimageby)
|
|
|
|
|
+2\blockwidth
|
|
|
|
|
+\bleed
|
|
|
|
|
-\wd\photobook@imagebox \relax}{
|
|
|
|
|
\raisebox{\dimexpr
|
|
|
|
|
#1 + \bleed
|
|
|
|
|
- 0.5\vgrowimageby - \vnudgeimageby \relax}{
|
|
|
|
|
\usebox\photobook@imagebox } } } }
|
|
|
|
|
\newpage
|
|
|
|
|
% right page...
|
|
|
|
|
\null
|
|
|
|
|
\ShipoutPicture{
|
|
|
|
|
\AtPageLowerLeft{
|
|
|
|
|
\hspace*{\dimexpr
|
|
|
|
|
-#1
|
|
|
|
|
+0.5\OFFSETFIX
|
|
|
|
|
+(\nudgeimageby)
|
|
|
|
|
+\blockwidth
|
|
|
|
|
+\bleed
|
|
|
|
|
-\wd\photobook@imagebox \relax}{
|
|
|
|
|
\raisebox{\dimexpr
|
|
|
|
|
#1 + \bleed
|
|
|
|
|
- 0.5\vgrowimageby - \vnudgeimageby \relax}{
|
|
|
|
|
\usebox\photobook@imagebox } } } }
|
|
|
|
|
\newpage
|
|
|
|
|
\resetnudgeimage }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% XXX BUG?: this is not centered vertically...
|
|
|
|
|
% XXX
|
2021-08-10 14:14:43 +03:00
|
|
|
%% \DescribeMacro{\imagespreadfullbleed\{..\}}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
|
|
|
|
%% Image spread with full bleed.
|
|
|
|
|
%
|
|
|
|
|
%% >> \imagespreadfullbleed[<vertical-offset>]{<caption>}{<image>}
|
|
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%% . . . . . . . . . . . . . . . . . . .
|
|
|
|
|
%% . +---------------+---------------+ .
|
|
|
|
|
%% . | . . . | .
|
|
|
|
|
%% . | . . . | .
|
|
|
|
|
%% . | . . . | .
|
|
|
|
|
%% . | . . . | .
|
|
|
|
|
%% . | image | .
|
|
|
|
|
%% . | . . . | .
|
|
|
|
|
%% . | . . . | .
|
|
|
|
|
%% . | . . . | .
|
|
|
|
|
%% . | . . . c | .
|
|
|
|
|
%% . +---------------+---------------+ .
|
|
|
|
|
%% . . . . . . . . . . . . . . . . . . .
|
2021-08-09 13:43:36 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
% XXX do we need the same thing but with a left caption???
|
|
|
|
|
\newcommand\imagespreadfullbleed[3][0mm]{
|
|
|
|
|
\setlength{\photobook@tmpnudgeimageby}{\nudgeimageby}
|
|
|
|
|
\setlength{\photobook@tmpvnudgeimageby}{\vnudgeimageby}
|
|
|
|
|
\setlength{\photobook@tmpvgrowimageby}{\vgrowimageby}
|
|
|
|
|
\cleartoleftpage
|
|
|
|
|
\imageleftspreadfullbleed[#1]{}{#3}
|
|
|
|
|
\nudgeimage{\photobook@tmpnudgeimageby}
|
|
|
|
|
\vnudgeimage{\photobook@tmpvnudgeimageby}
|
|
|
|
|
\vgrowimage{\photobook@tmpvgrowimageby}
|
|
|
|
|
\imagerightspreadfullbleed[#1]{#2}{#3} }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
2021-08-12 16:48:00 +03:00
|
|
|
%%% XXX DEBUG...
|
2021-08-08 01:54:37 +03:00
|
|
|
%%%\AtBeginDocument{
|
|
|
|
|
%%%}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%% \end{document} % im:set ts=4 sw=4 :
|