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)
|
|
|
|
|
%
|
|
|
|
|
%
|
2021-09-09 00:43:30 +03:00
|
|
|
%
|
|
|
|
|
% This file contains both the code and the reference, but in a slightly
|
|
|
|
|
% more readable format than the traditional LaTeX .dtx format. In general
|
|
|
|
|
% there are two main sections:
|
|
|
|
|
% - code
|
|
|
|
|
% - reference
|
|
|
|
|
% lines starting with "%%" or "%X" where X is a section id
|
|
|
|
|
% Sections are parts of the reference that are logically ordered differently
|
|
|
|
|
% than the code, e.g. main user tools should have priority in the reference
|
|
|
|
|
% while meta code (identified by "%M") can be described later, while in code
|
|
|
|
|
% we strictly need to define macros before they are used thus meta-macros
|
|
|
|
|
% and other building blocks and components come before the user tools.
|
|
|
|
|
%
|
|
|
|
|
% Docs are build by the Makefile, so reference it for more info.
|
|
|
|
|
%
|
|
|
|
|
% $ make doc
|
|
|
|
|
%
|
|
|
|
|
%
|
|
|
|
|
%
|
2021-09-02 02:05:32 +03:00
|
|
|
% XXX unify API -- see CellContent env...
|
2021-09-06 19:59:50 +03:00
|
|
|
% XXX make this loadable both as a class and as a package...
|
|
|
|
|
% \@ifclassloaded{photobook}{<true>}{<false>}
|
2021-08-31 03:25:11 +03:00
|
|
|
% XXX revise command naming -- should be obvious from name what is what:
|
|
|
|
|
% - meta commands -- ??? (currently same as templates)
|
|
|
|
|
% - general macros -- \usecell{..}
|
|
|
|
|
% - templates -- \ImagePage{..}
|
2021-08-27 19:04:05 +03:00
|
|
|
% XXX see where we need to \ignorespaces...
|
2021-08-08 01:54:37 +03:00
|
|
|
% XXX might be a good idea to add a spine calculator...
|
2021-08-30 01:42:11 +03:00
|
|
|
%
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%----------------------------------------------------------------------
|
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-30 01:42:11 +03:00
|
|
|
\edef\photobook@FILEVERSION{v0.1}
|
|
|
|
|
\edef\photobook@FILEDATE{2021-07-28}
|
2021-08-10 06:14:42 +03:00
|
|
|
|
|
|
|
|
|
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-09-03 16:32:03 +03:00
|
|
|
%%
|
|
|
|
|
%% % NOTE: this needs to load before hyperref or bookmarks will break...
|
|
|
|
|
%% % NOTE: loading hyperref here will break it loading later in one of
|
|
|
|
|
%% % the packages...
|
|
|
|
|
%% \usepackage{titlesec}
|
|
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \usepackage[numbered]{hypdoc}
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \usepackage{doctools}
|
2021-09-03 16:32:03 +03:00
|
|
|
%% \usepackage{needspace}
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
2021-09-03 05:18:18 +03:00
|
|
|
%% \usepackage[toc]{multitoc}
|
|
|
|
|
%% \renewcommand*{\multicolumntoc}{2}
|
|
|
|
|
%% \setlength{\columnseprule}{0.5pt}
|
|
|
|
|
%%
|
|
|
|
|
%% \usepackage{imakeidx}
|
|
|
|
|
%% \makeindex[
|
2021-09-04 05:18:06 +03:00
|
|
|
%% columns=1,
|
2021-09-03 05:18:18 +03:00
|
|
|
%% title=Alphabetical Index,
|
|
|
|
|
%% intoc,
|
2021-09-04 05:18:06 +03:00
|
|
|
%% options= -s photobook.ist ]
|
2021-09-03 04:03:28 +03:00
|
|
|
%%
|
2021-08-10 14:14:43 +03:00
|
|
|
%%% \newcommand\DescribeGlobal[1]{%
|
|
|
|
|
%%% \DescribeMacro{#1}}
|
|
|
|
|
%%
|
2021-08-26 04:04:38 +03:00
|
|
|
%% \newcommand\LEGACY{\fbox{LEGACY}}
|
2021-08-29 17:05:28 +03:00
|
|
|
%% \newcommand\EXPERIMENTAL{\fbox{EXPERIMENTAL}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
2021-09-03 16:32:03 +03:00
|
|
|
%%% sections to new pages...
|
|
|
|
|
%% \newcommand\sectionbreak{\Needspace{5\baselineskip}}
|
|
|
|
|
%%
|
|
|
|
|
%% % remove section numbering...
|
|
|
|
|
%% \setcounter{secnumdepth}{0}
|
|
|
|
|
%%
|
|
|
|
|
%% % paragraph configuration...
|
2021-08-28 01:13:45 +03:00
|
|
|
%% \setlength\parindent{0pt}
|
|
|
|
|
%% \setlength\parskip{0.5em}
|
|
|
|
|
%%
|
2021-09-02 23:51:05 +03:00
|
|
|
%%
|
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
|
|
|
%%
|
2021-09-09 00:43:30 +03:00
|
|
|
%%
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \maketitle
|
|
|
|
|
%%
|
2021-09-09 00:43:30 +03:00
|
|
|
%% \begin{center}
|
|
|
|
|
%% \fbox{This class is still unstable}
|
|
|
|
|
%% \end{center}
|
|
|
|
|
%%
|
2021-09-03 05:18:18 +03:00
|
|
|
%% \begin{abstract}
|
|
|
|
|
%% The |photobook| \LaTeX\space document class extends the |book| class
|
|
|
|
|
%% defining a set of parameters, meta-macros, macros and environments
|
|
|
|
|
%% with reasonable defaults to help typeset, build and print books mainly
|
|
|
|
|
%% based on visual/image content.
|
|
|
|
|
%% \end{abstract}
|
2021-09-03 04:03:28 +03:00
|
|
|
%%
|
|
|
|
|
%% \tableofcontents
|
2021-08-08 14:07:52 +03:00
|
|
|
%%
|
2021-09-03 05:18:18 +03:00
|
|
|
%%%% Introduction
|
|
|
|
|
%
|
|
|
|
|
%% XXX parameters, page spreads, templates, cell concept, ...
|
|
|
|
|
%
|
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
|
2021-08-28 01:43:57 +03:00
|
|
|
%% . +--------------------------------------+----- v . . ---
|
2021-08-08 12:16:50 +03:00
|
|
|
%% . | ^ . = .
|
|
|
|
|
%% . | . . . . . . | . . = . ^
|
|
|
|
|
%% . |<-- blockwidth ----------------------->= . |
|
|
|
|
|
%% . | . | . . = . |
|
|
|
|
|
%% . | | . = . textheight
|
2021-08-28 01:43:57 +03:00
|
|
|
%% . | . Page | . . = . |
|
2021-08-08 12:16:50 +03:00
|
|
|
%% . | 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-28 01:43:57 +03:00
|
|
|
%% | page |
|
2021-08-08 01:54:37 +03:00
|
|
|
%% | |
|
|
|
|
|
%% | |
|
|
|
|
|
%% +---------------+
|
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-28 01:43:57 +03:00
|
|
|
%% | endpaper |
|
2021-08-08 01:54:37 +03:00
|
|
|
%% | . |
|
|
|
|
|
%% | . |
|
|
|
|
|
%% +---------------+---------------+
|
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
|
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 fold/cut marks???
|
|
|
|
|
\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}
|
|
|
|
|
\@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-09-06 19:59:50 +03:00
|
|
|
\DeclareStringOption{clearimage}[10mm]
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%% 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
|
|
|
\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
|
|
|
\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}
|
|
|
|
|
|
|
|
|
|
|
2021-09-02 23:51:05 +03:00
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
% 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-27 19:04:05 +03:00
|
|
|
\RequirePackage{listofitems}
|
2021-08-19 23:53:01 +03:00
|
|
|
\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-26 20:03:17 +03:00
|
|
|
\RequirePackage[absolute]{textpos}
|
2021-08-08 01:54:37 +03:00
|
|
|
\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-09-12 03:29:50 +03:00
|
|
|
\RequirePackage{fancyhdr}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%%%% Globals
|
2021-09-03 16:32:03 +03:00
|
|
|
% XXX move these out to relevant sections + add a separate globals glossary...
|
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
|
2021-08-30 01:42:11 +03:00
|
|
|
% aggregates...
|
2021-08-08 01:54:37 +03:00
|
|
|
\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}
|
|
|
|
|
|
2021-09-03 16:32:03 +03:00
|
|
|
%% \DescribeMacro{\clearcaption=<ratio>}
|
|
|
|
|
%
|
|
|
|
|
%% Block caption clearance from edge of parent cell.
|
|
|
|
|
%%
|
|
|
|
|
%% Used as default by |\captionblockcell{..}|
|
|
|
|
|
%%
|
|
|
|
|
\newlength\clearcaption
|
|
|
|
|
\setlength\clearcaption{0pt}
|
|
|
|
|
|
|
|
|
|
%% \DescribeMacro{\captioncellspacing=<ratio>}
|
|
|
|
|
%
|
|
|
|
|
%% Block caption spacing from parent cell.
|
|
|
|
|
%%
|
|
|
|
|
%% Used as default by |\captionblockcell{..}|
|
|
|
|
|
%%
|
|
|
|
|
% XXX should this be used in other caption cells???
|
|
|
|
|
\newlength\captioncellspacing
|
|
|
|
|
\setlength\captioncellspacing{5pt}
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%%%% Initialization
|
|
|
|
|
%%
|
2021-09-07 01:29:37 +03:00
|
|
|
%% \DescribeMacro{\InitPages}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-09-07 01:29:37 +03:00
|
|
|
%% Initialize page dimensions.
|
|
|
|
|
%%
|
|
|
|
|
%% This is not intended for direct use.
|
|
|
|
|
%%
|
2021-09-02 19:56:46 +03:00
|
|
|
% XXX do we need to document this??
|
|
|
|
|
% ...is there a usecase for calling this manually?
|
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
|
2021-09-06 19:59:50 +03:00
|
|
|
%\setlength\clearimage{-\bleed}
|
|
|
|
|
\setlength\clearimage{10mm}
|
2021-08-08 01:54:37 +03:00
|
|
|
\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-22 14:52:34 +03:00
|
|
|
%% \DescribeMacro{\ReInitPages}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
|
|
|
|
%% Reset and re-initialize page dimentions.
|
|
|
|
|
%%
|
2021-08-22 14:52:34 +03:00
|
|
|
\newcommand\ReInitPages{
|
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...
|
|
|
|
|
|
2021-09-03 16:32:03 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
% on-import...
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
% 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}
|
|
|
|
|
|
|
|
|
|
|
2021-09-03 16:32:03 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
% pre-document...
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
\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
|
|
|
|
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}}
|
|
|
|
|
|
|
|
|
|
|
2021-08-30 01:42:11 +03:00
|
|
|
%% \DescribeMacro{\mindim\{..\}}
|
|
|
|
|
%% \DescribeMacro{\maxdim\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% Get min/max dimension.
|
|
|
|
|
%
|
|
|
|
|
%% >> \mindim{A}{B}
|
|
|
|
|
%
|
|
|
|
|
%% >> \maxdim{A}{B}
|
|
|
|
|
%%
|
2021-09-03 16:32:03 +03:00
|
|
|
% XXX do we actually need these??
|
|
|
|
|
% ...should be simple to replace with calc's:
|
|
|
|
|
% 0pt + \minof{..}
|
|
|
|
|
% 0pt + \maxof{..}
|
2021-08-30 01:42:11 +03:00
|
|
|
\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-09-12 03:29:50 +03:00
|
|
|
%% \DescribeMacro{\emptypage\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% Create an empty page.
|
|
|
|
|
%
|
|
|
|
|
%% >> \emptypage
|
|
|
|
|
%% >> \emptypage[<style>]
|
|
|
|
|
%
|
|
|
|
|
%% |<style>| is the with |fancyhdr| style name, |empty| is the default.
|
|
|
|
|
%%
|
|
|
|
|
\newcommand\emptypage[1][empty]{%
|
|
|
|
|
\begin{page}%
|
|
|
|
|
\ifthenelse{\equal{#1}{}}{}{%
|
|
|
|
|
\thispagestyle{#1}}%
|
|
|
|
|
\end{page}}
|
|
|
|
|
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
%% \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-09-03 03:28:04 +03:00
|
|
|
%M \DescribeMacro{\ResettableMacro\{..\}}
|
2021-08-30 01:42:11 +03:00
|
|
|
%
|
2021-09-03 03:28:04 +03:00
|
|
|
%M Create a resettable command.
|
2021-08-30 01:42:11 +03:00
|
|
|
%
|
2021-09-03 03:28:04 +03:00
|
|
|
%M >> \ResettableMacro{<name>}{<code>}
|
|
|
|
|
%M >> \ResettableMacro{<name>}[<arg-count>]{<code>}
|
|
|
|
|
%M >> \ResettableMacro{<name>}[<arg-count>][<default>]{<code>}
|
2021-08-30 01:42:11 +03:00
|
|
|
%
|
2021-09-03 03:28:04 +03:00
|
|
|
%M This is similar to |\newcommand{..}| but will define two commands:
|
|
|
|
|
%M
|
|
|
|
|
%M >> \<name>{..}
|
|
|
|
|
%M
|
|
|
|
|
%M >> \reset<name>
|
|
|
|
|
%M
|
|
|
|
|
%M |\<name>{..}| can be freely redefined or undefined by user.
|
|
|
|
|
%M
|
|
|
|
|
%M |\reset<name>| will reset |\<name>{..}| to its original state.
|
|
|
|
|
%M
|
2021-08-30 01:42:11 +03:00
|
|
|
% parse args...
|
|
|
|
|
\def\ResettableMacro#1{%
|
|
|
|
|
\@ifnextchar[{%
|
|
|
|
|
\photobook@ResettableMacro@pre{#1}%
|
|
|
|
|
}{%
|
|
|
|
|
\photobook@ResettableMacro{#1}}}
|
|
|
|
|
\def\photobook@ResettableMacro@pre#1[#2]{%
|
|
|
|
|
\@ifnextchar[{%
|
|
|
|
|
\photobook@ResettableMacro@args@dfl{#1}[#2]%
|
|
|
|
|
}{%
|
|
|
|
|
\photobook@ResettableMacro@args{#1}[#2]}}
|
|
|
|
|
% pre -- main command definition...
|
|
|
|
|
\def\photobook@ResettableMacro#1#2{%
|
2021-08-30 18:55:11 +03:00
|
|
|
\expandafter\newcommand\csname photobook@ResettableMacro@#1\endcsname{#2}%
|
2021-08-30 01:42:11 +03:00
|
|
|
\photobook@ResettableMacro@tail{#1}}
|
|
|
|
|
\def\photobook@ResettableMacro@args#1[#2]#3{%
|
2021-08-30 18:55:11 +03:00
|
|
|
\expandafter\newcommand\csname photobook@ResettableMacro@#1\endcsname[#2]{#3}%
|
2021-08-30 01:42:11 +03:00
|
|
|
\photobook@ResettableMacro@tail{#1}}
|
|
|
|
|
\def\photobook@ResettableMacro@args@dfl#1[#2][#3]#4{%
|
2021-08-30 18:55:11 +03:00
|
|
|
\expandafter\newcommand\csname photobook@ResettableMacro@#1\endcsname[#2][#3]{#4}%
|
2021-08-30 01:42:11 +03:00
|
|
|
\photobook@ResettableMacro@tail{#1}}
|
|
|
|
|
% post...
|
|
|
|
|
\def\photobook@ResettableMacro@tail#1{%
|
|
|
|
|
% \reset<name>
|
|
|
|
|
\expandafter\newcommand\csname reset#1\endcsname{%
|
2021-08-30 18:55:11 +03:00
|
|
|
\expandafter\let\csname #1\expandafter\endcsname\csname photobook@ResettableMacro@#1\endcsname}
|
2021-08-30 01:42:11 +03:00
|
|
|
% initialize...
|
|
|
|
|
\csname reset#1\endcsname}
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
2021-08-13 15:09:38 +03:00
|
|
|
%%%% Environments and Cells
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
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-30 01:42:11 +03:00
|
|
|
%%
|
|
|
|
|
%% Note that this may span more than one page if there is enough stuff
|
|
|
|
|
%% packed in.
|
|
|
|
|
%%
|
2021-08-27 19:04:05 +03:00
|
|
|
\newenvironment{page}{%
|
2021-08-30 01:42:11 +03:00
|
|
|
\null%
|
|
|
|
|
\ignorespaces%
|
2021-08-28 13:56:31 +03:00
|
|
|
}{%
|
2021-08-30 01:42:11 +03:00
|
|
|
\clearpage}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
2021-09-03 16:32:03 +03:00
|
|
|
%% \DescribeEnv{leftpage}
|
|
|
|
|
%
|
|
|
|
|
%% \EXPERIMENTAL
|
|
|
|
|
%%
|
|
|
|
|
% XXX not sure about this...
|
|
|
|
|
\newenvironment{leftpage}{%
|
|
|
|
|
\begin{page}%
|
|
|
|
|
\cleartoleftpage%
|
|
|
|
|
}{%
|
|
|
|
|
\end{page}}
|
|
|
|
|
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2021-08-13 15:09:38 +03:00
|
|
|
%%%%% Cells
|
2021-09-02 02:05:32 +03:00
|
|
|
|
|
|
|
|
% meta helpers...
|
|
|
|
|
|
2021-09-03 03:28:04 +03:00
|
|
|
%M \DescribeMacro{\CellContentOptions\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%M \EXPERIMENTAL
|
|
|
|
|
%M
|
|
|
|
|
%M Define standard cell options.
|
|
|
|
|
%M
|
2021-09-02 02:05:32 +03:00
|
|
|
% XXX figure out how to align and pad without messing with geometry...
|
|
|
|
|
\newcommand\CellContentOptions[1]{%
|
|
|
|
|
%% align...
|
|
|
|
|
%\expandafter\def\csname photobook@#1@align\endcsname{flushleft}%
|
|
|
|
|
%\define@key{#1@args}{align}{%
|
|
|
|
|
% \expandafter\edef\csname photobook@#1@align\endcsname{##1}}%
|
|
|
|
|
% valign...
|
|
|
|
|
\expandafter\def\csname photobook@#1@valign\endcsname{t}%
|
|
|
|
|
\define@key{#1@args}{valign}{%
|
|
|
|
|
\expandafter\edef\csname photobook@#1@valign\endcsname{##1}}%
|
|
|
|
|
%% margin...
|
|
|
|
|
%\expandafter\def\csname photobook@#1@margin\endcsname{0pt}%
|
|
|
|
|
%\define@key{#1@args}{margin}{%
|
|
|
|
|
% \expandafter\edef\csname photobook@#1@margin\endcsname{##1}}%
|
|
|
|
|
%% padding...
|
|
|
|
|
%\expandafter\def\csname photobook@#1@padding\endcsname{0pt}%
|
|
|
|
|
%\define@key{#1@args}{padding}{%
|
|
|
|
|
% \expandafter\edef\csname photobook@#1@padding\endcsname{##1}}%
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-03 03:28:04 +03:00
|
|
|
%M \DescribeEnv{CellContent}
|
|
|
|
|
%M \DescribeEnv{CellContent*}
|
|
|
|
|
%
|
|
|
|
|
%M \EXPERIMENTAL
|
|
|
|
|
%M
|
|
|
|
|
%M Standard cell content wrapper, used by |inlinecell|.
|
2021-09-02 02:05:32 +03:00
|
|
|
%
|
2021-09-03 03:28:04 +03:00
|
|
|
%M >> \begin{CellContent}[<parent-align>]{<name>} ... \end{CellContent}
|
|
|
|
|
%M >> \begin{CellContent*}[<parent-align>]{<name>}{<width>}{<height>} ... \end{CellContent}
|
|
|
|
|
%
|
|
|
|
|
%M The star version requires width/height to be manually passed while the
|
|
|
|
|
%M non-star version will get the values from |\cellwidth| and |\cellheight|
|
|
|
|
|
%M respectively.
|
2021-09-02 02:05:32 +03:00
|
|
|
%
|
2021-09-02 18:50:55 +03:00
|
|
|
% XXX TEST params...
|
2021-09-02 02:05:32 +03:00
|
|
|
\newenvironment{CellContent}[2][t]{%
|
|
|
|
|
\begin{CellContent*}[#1]{#2}{\cellwidth}{\cellheight}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{CellContent*}}
|
|
|
|
|
|
|
|
|
|
\newenvironment{CellContent*}[4][t]{%
|
2021-09-02 16:22:53 +03:00
|
|
|
\begin{adjustbox}{
|
|
|
|
|
minipage=[#1][#4][\csname photobook@#2@valign\endcsname]{#3},
|
|
|
|
|
valign=#1}%
|
2021-09-02 02:05:32 +03:00
|
|
|
\ignorespaces%
|
|
|
|
|
}{%
|
2021-09-03 03:28:04 +03:00
|
|
|
% NOTE: prevent empty "minipage" from collapsing...
|
2021-09-02 18:50:55 +03:00
|
|
|
\hspace{\fill}%
|
2021-09-02 16:22:53 +03:00
|
|
|
\end{adjustbox}}
|
2021-09-02 02:05:32 +03:00
|
|
|
|
|
|
|
|
|
2021-09-03 03:28:04 +03:00
|
|
|
%M \DescribeEnv{CellContent}
|
|
|
|
|
%M \DescribeEnv{CellContent*}
|
|
|
|
|
%
|
|
|
|
|
%M \EXPERIMENTAL
|
|
|
|
|
%M
|
|
|
|
|
%M Like |CellContent| / |CellContent*| but will use |minipage| as the wrapper.
|
2021-09-02 18:50:55 +03:00
|
|
|
%
|
2021-09-03 03:28:04 +03:00
|
|
|
%M >> \begin{MinipageCellContent}[<parent-align>]{<name>} ... \end{MinipageCellContent}
|
|
|
|
|
%M >> \begin{MinipageCellContent*}[<parent-align>]{<name>}{<width>}{<height>} ... \end{MinipageCellContent}
|
2021-09-02 18:50:55 +03:00
|
|
|
%
|
|
|
|
|
% XXX TEST...
|
|
|
|
|
% XXX doc...
|
|
|
|
|
\newenvironment{MinipageCellContent}[2][t]{%
|
|
|
|
|
\begin{MinipageCellContent*}[#1]{#2}{\cellwidth}{\cellheight}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{MinipageCellContent*}}
|
|
|
|
|
|
|
|
|
|
\newenvironment{MinipageCellContent*}[4][t]{%
|
|
|
|
|
\begin{minipage}[#1][#4][\csname photobook@#2@valign\endcsname]{#3}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{minipage}}
|
|
|
|
|
|
2021-09-02 02:05:32 +03:00
|
|
|
|
2021-08-29 03:01:01 +03:00
|
|
|
%% A cell environment is a box of specified size.
|
2021-08-12 16:48:00 +03:00
|
|
|
%%
|
2021-08-29 03:01:01 +03:00
|
|
|
%% Cells can be both placed inline relative to other content or in an
|
|
|
|
|
%% absolute location.
|
2021-08-12 16:48:00 +03:00
|
|
|
%%
|
2021-08-29 03:01:01 +03:00
|
|
|
%% Note that absolute cells are placed relative to the page and currently
|
|
|
|
|
%% can not be placed relative to other absolute cells (this might change
|
|
|
|
|
%% in the future).
|
|
|
|
|
%%
|
|
|
|
|
%% \DescribeMacro{\cellwidth=<len>}
|
|
|
|
|
%% \DescribeMacro{\cellheight=<len>}
|
|
|
|
|
%% \DescribeMacro{\cellparentwidth=<len>}
|
|
|
|
|
%% \DescribeMacro{\cellparentheight=<len>}
|
|
|
|
|
%% \DescribeMacro{\celloffsettop=<len>}
|
|
|
|
|
%% \DescribeMacro{\celloffsetleft=<len>}
|
2021-09-01 04:05:31 +03:00
|
|
|
%% \DescribeMacro{\clearance=<len>}
|
2021-08-29 03:01:01 +03:00
|
|
|
%%
|
|
|
|
|
%% A cell defines a set of contextual lengths:
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% <--> celloffsetleft
|
|
|
|
|
%% . <--------------> cellwidth
|
|
|
|
|
%% <----------------------> cellparentwidth
|
|
|
|
|
%% . . . .
|
|
|
|
|
%% +----------------------+ . . . . . . .
|
|
|
|
|
%% | . . | ^ ^ celloffsettop
|
|
|
|
|
%% | . . | | |
|
|
|
|
|
%% | +--------------+ . | . . | . . . v
|
|
|
|
|
%% | | | | | ^
|
|
|
|
|
%% | | | | | | cellheight
|
|
|
|
|
%% | | cell | | | |
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%% | +--------------+ . | . . | . v
|
|
|
|
|
%% | | |
|
|
|
|
|
%% | | | cellparentheight
|
|
|
|
|
%% +----------------------+ . . v
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%% For absolutely positioned cells these define the cell offset from
|
|
|
|
|
%% parent.
|
|
|
|
|
%%
|
|
|
|
|
%% The bare page can be reasonably be treated as a cell.
|
|
|
|
|
%%
|
|
|
|
|
%% Initally, outside of any cells |\cellwidth|, |\cellparentwidth| and
|
|
|
|
|
%% |\cellheight|, |\cellparentheight| are equal to |\paperwidth| and
|
|
|
|
|
%% |\paperheight| respectively, and |\celloffsettop| and |\celloffsetleft|
|
|
|
|
|
%% are set to |0pt|.
|
|
|
|
|
%%
|
|
|
|
|
%% Changing these is not recommended, it likely will not affect the
|
|
|
|
|
%% current cell but can mess up nested cells.
|
2021-08-12 16:48:00 +03:00
|
|
|
%%
|
2021-08-27 19:04:05 +03:00
|
|
|
\newlength\cellparentwidth
|
|
|
|
|
\setlength\cellparentwidth{\paperwidth}
|
|
|
|
|
|
|
|
|
|
\newlength\cellparentheight
|
|
|
|
|
\setlength\cellparentheight{\paperheight}
|
|
|
|
|
|
2021-08-12 16:48:00 +03:00
|
|
|
\newlength\cellwidth
|
2021-08-27 19:04:05 +03:00
|
|
|
\setlength\cellwidth{\cellparentwidth}
|
|
|
|
|
|
2021-08-12 16:48:00 +03:00
|
|
|
\newlength\cellheight
|
2021-08-27 19:04:05 +03:00
|
|
|
\setlength\cellheight{\cellparentheight}
|
|
|
|
|
|
|
|
|
|
\newlength\celloffsetleft
|
|
|
|
|
\setlength\celloffsetleft{0pt}
|
|
|
|
|
|
|
|
|
|
\newlength\celloffsettop
|
|
|
|
|
\setlength\celloffsettop{0pt}
|
2021-08-12 15:22:03 +03:00
|
|
|
|
2021-09-01 04:05:31 +03:00
|
|
|
\newlength\clearance
|
|
|
|
|
\setlength\clearance{0pt}
|
2021-08-15 13:38:32 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
%% \DescribeEnv{inlinecell}
|
2021-08-29 17:05:28 +03:00
|
|
|
%% \DescribeEnv{inlinecell*}
|
2021-08-15 13:38:32 +03:00
|
|
|
%
|
|
|
|
|
%% Create a basic inline cell.
|
|
|
|
|
%
|
2021-08-26 04:04:38 +03:00
|
|
|
%% >> \begin{inlinecell}{<width>}{<height>} ... \end{inlinecell}
|
2021-08-27 19:04:05 +03:00
|
|
|
%% >> \begin{inlinecell}[<valign>]{<width>}{<height>} ... \end{inlinecell}
|
2021-08-15 13:38:32 +03:00
|
|
|
%
|
2021-08-29 17:05:28 +03:00
|
|
|
%% This will clip oversized content.
|
2021-08-15 13:38:32 +03:00
|
|
|
%%
|
2021-08-29 17:05:28 +03:00
|
|
|
%% |inlinecell*| is like |inlinecell| but will not clip.
|
|
|
|
|
%
|
|
|
|
|
%% >> \begin{inlinecell*}{<width>}{<height>} ... \end{inlinecell*}
|
|
|
|
|
%% >> \begin{inlinecell*}[<valign>]{<width>}{<height>} ... \end{inlinecell*}
|
|
|
|
|
%
|
|
|
|
|
%% |<valign>| can be one of |t| (default) for top, |c| for center or |b| for bottom.
|
|
|
|
|
%%
|
|
|
|
|
%% These are just like |minipage| but provide cell mechanics.
|
|
|
|
|
%%
|
2021-09-02 02:05:32 +03:00
|
|
|
% XXX EXPERIMENTAL
|
|
|
|
|
\CellContentOptions{inlinecell}
|
|
|
|
|
|
|
|
|
|
\def\photobook@inlinecell@parentvalign{t}
|
|
|
|
|
\define@boolkey{inlinecell@args}{t}[true]{%
|
|
|
|
|
\def\photobook@inlinecell@parentvalign{t}}
|
|
|
|
|
\define@boolkey{inlinecell@args}{c}[true]{%
|
|
|
|
|
\def\photobook@inlinecell@parentvalign{c}}
|
|
|
|
|
\define@boolkey{inlinecell@args}{b}[true]{%
|
|
|
|
|
\def\photobook@inlinecell@parentvalign{b}}
|
|
|
|
|
|
|
|
|
|
\newenvironment{inlinecell*}[3][]{%
|
2021-08-15 13:38:32 +03:00
|
|
|
\begingroup%
|
2021-09-02 02:05:32 +03:00
|
|
|
\setkeys{inlinecell@args}{
|
|
|
|
|
t,
|
|
|
|
|
#1}%
|
|
|
|
|
%
|
2021-08-29 03:01:01 +03:00
|
|
|
% get args by value...
|
|
|
|
|
\edef\photobook@protect@w{\the\dimexpr #2 \relax}%
|
|
|
|
|
\edef\photobook@protect@h{\the\dimexpr #3 \relax}%
|
|
|
|
|
%
|
2021-08-27 19:04:05 +03:00
|
|
|
\setlength\cellparentwidth{\cellwidth}%
|
|
|
|
|
\setlength\cellparentheight{\cellheight}%
|
2021-08-29 03:01:01 +03:00
|
|
|
\setlength\cellwidth{\photobook@protect@w}%
|
|
|
|
|
\setlength\cellheight{\photobook@protect@h}%
|
2021-08-27 19:04:05 +03:00
|
|
|
\setlength\celloffsettop{0pt}%
|
|
|
|
|
\setlength\celloffsetleft{0pt}%
|
2021-08-15 13:38:32 +03:00
|
|
|
%
|
2021-09-02 02:05:32 +03:00
|
|
|
\begin{CellContent}[\photobook@inlinecell@parentvalign]{inlinecell}%
|
2021-08-15 13:38:32 +03:00
|
|
|
}{%
|
2021-09-02 02:05:32 +03:00
|
|
|
\end{CellContent}%
|
2021-08-15 13:38:32 +03:00
|
|
|
\endgroup}
|
|
|
|
|
|
2021-08-29 17:05:28 +03:00
|
|
|
\newenvironment{inlinecell}[3][t]{%
|
|
|
|
|
\begin{inlinecell*}[#1]{#2}{#3}%
|
|
|
|
|
\begin{cliptocell}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{cliptocell}%
|
|
|
|
|
\end{inlinecell*}}
|
|
|
|
|
|
2021-08-12 15:22:03 +03:00
|
|
|
|
2021-09-02 18:50:55 +03:00
|
|
|
% XXX EXPERIMENTAL
|
|
|
|
|
%% \DescribeEnv{minipagecell}
|
|
|
|
|
%% \DescribeEnv{minipagecell*}
|
|
|
|
|
%
|
|
|
|
|
%% \EXPERIMENTAL
|
|
|
|
|
%%
|
|
|
|
|
\CellContentOptions{minipagecell}
|
|
|
|
|
|
|
|
|
|
\def\photobook@minipagecell@parentvalign{t}
|
|
|
|
|
\define@boolkey{minipagecell@args}{t}[true]{%
|
|
|
|
|
\def\photobook@minipagecell@parentvalign{t}}
|
|
|
|
|
\define@boolkey{minipagecell@args}{c}[true]{%
|
|
|
|
|
\def\photobook@minipagecell@parentvalign{c}}
|
|
|
|
|
\define@boolkey{minipagecell@args}{b}[true]{%
|
|
|
|
|
\def\photobook@minipagecell@parentvalign{b}}
|
|
|
|
|
|
|
|
|
|
\newenvironment{minipagecell*}[3][]{%
|
|
|
|
|
\begingroup%
|
|
|
|
|
\setkeys{minipagecell@args}{
|
|
|
|
|
t,
|
|
|
|
|
#1}%
|
|
|
|
|
% get args by value...
|
|
|
|
|
\edef\photobook@protect@w{\the\dimexpr #2 \relax}%
|
|
|
|
|
\edef\photobook@protect@h{\the\dimexpr #3 \relax}%
|
|
|
|
|
%
|
|
|
|
|
\setlength\cellparentwidth{\cellwidth}%
|
|
|
|
|
\setlength\cellparentheight{\cellheight}%
|
|
|
|
|
\setlength\cellwidth{\photobook@protect@w}%
|
|
|
|
|
\setlength\cellheight{\photobook@protect@h}%
|
|
|
|
|
\setlength\celloffsettop{0pt}%
|
|
|
|
|
\setlength\celloffsetleft{0pt}%
|
|
|
|
|
\setlength\clearance{0pt}%
|
|
|
|
|
%
|
|
|
|
|
\begin{MinipageCellContent}[\photobook@minipagecell@parentvalign]{minipagecell}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{MinipageCellContent}%
|
|
|
|
|
\endgroup}
|
|
|
|
|
|
|
|
|
|
\newenvironment{minipagecell}[3][t]{%
|
|
|
|
|
\begin{minipagecell*}[#1]{#2}{#3}%
|
|
|
|
|
\begin{cliptocell}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{cliptocell}%
|
|
|
|
|
\end{minipagecell*}}
|
|
|
|
|
|
|
|
|
|
|
2021-09-02 02:05:32 +03:00
|
|
|
% XXX EXPERIMENTAL
|
|
|
|
|
%% \DescribeEnv{zinlinecell}
|
|
|
|
|
%% \DescribeEnv{zinlinecell*}
|
|
|
|
|
%
|
|
|
|
|
%% \EXPERIMENTAL
|
|
|
|
|
%%
|
|
|
|
|
%% Like |inlinecell| / |inlinecell*| but will take up zero space.
|
|
|
|
|
%%
|
|
|
|
|
%% >> \begin{zinlinecell}{<width>}{<height>} ... \end{zinlinecell}
|
|
|
|
|
%% >> \begin{zinlinecell}[<valign>]{<width>}{<height>} ... \end{zinlinecell}
|
|
|
|
|
%%
|
2021-09-02 18:50:55 +03:00
|
|
|
% XXX need to get rid of the raisebox here...
|
2021-09-02 02:05:32 +03:00
|
|
|
\NewEnviron{zinlinecell*}[1][]{%
|
|
|
|
|
\smash{\makebox[0pt][l]{%
|
|
|
|
|
% XXX HACK: RAISEBOX -- feels hackish...
|
|
|
|
|
\raisebox{0pt - \totalheightof{O}}{%
|
|
|
|
|
\begin{inlinecell*}[#1]{\cellwidth}{\cellheight}%
|
|
|
|
|
\BODY%
|
|
|
|
|
\end{inlinecell*}}}}}
|
|
|
|
|
|
|
|
|
|
\NewEnviron{zinlinecell}[1][]{%
|
|
|
|
|
\smash{\makebox[0pt][l]{%
|
|
|
|
|
% XXX HACK: RAISEBOX -- feels hackish...
|
|
|
|
|
\raisebox{0pt - \totalheightof{O}}{%
|
|
|
|
|
\begin{inlinecell}[#1]{\cellwidth}{\cellheight}%
|
|
|
|
|
\BODY%
|
|
|
|
|
\end{inlinecell}}}}}
|
|
|
|
|
|
|
|
|
|
|
2021-08-12 15:22:03 +03:00
|
|
|
%% \DescribeEnv{cell}
|
2021-08-29 17:05:28 +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-09-08 04:37:44 +03:00
|
|
|
%% >> \begin{cell}{<left>, <top>}{<width>}{<height>} ... \end{cell}
|
2021-08-29 17:05:28 +03:00
|
|
|
%
|
|
|
|
|
%% Oversized content will be clipped.
|
|
|
|
|
%%
|
|
|
|
|
%% |cell*| is just like |cell| but will not clip its content.
|
|
|
|
|
%
|
2021-09-08 04:37:44 +03:00
|
|
|
%% >> \begin{cell*}{<left>, <top>}{<width>}{<height>} ... \end{cell*}
|
2021-08-27 19:04:05 +03:00
|
|
|
%%
|
2021-08-12 15:22:03 +03:00
|
|
|
% XXX SYNTAX: place the second arg in braces...
|
2021-09-08 04:37:44 +03:00
|
|
|
% \begin{cell*}(<left>, <top>){<width>}{<height>}
|
2021-08-29 17:05:28 +03:00
|
|
|
\newenvironment{cell*}[3]{%
|
2021-08-27 19:04:05 +03:00
|
|
|
\readlist*\photobook@cell@offset{#1}%
|
|
|
|
|
%
|
2021-08-15 13:38:32 +03:00
|
|
|
\begin{textblock*}{#2}(#1)%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{inlinecell*}{#2}{#3}%
|
2021-08-27 19:04:05 +03:00
|
|
|
\setlength\celloffsettop{\photobook@cell@offset[1]}%
|
|
|
|
|
\setlength\celloffsetleft{\photobook@cell@offset[2]}%
|
|
|
|
|
\ignorespaces%
|
2021-08-12 15:22:03 +03:00
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{inlinecell*}%
|
2021-08-30 01:42:11 +03:00
|
|
|
\end{textblock*}%
|
|
|
|
|
\ignorespaces}
|
2021-08-12 15:22:03 +03:00
|
|
|
|
2021-08-29 17:05:28 +03:00
|
|
|
\newenvironment{cell}[3]{%
|
|
|
|
|
\begin{cell*}{#1}{#2}{#3}%
|
2021-08-14 03:02:59 +03:00
|
|
|
\begin{cliptocell}%
|
2021-08-27 19:04:05 +03:00
|
|
|
\ignorespaces%
|
2021-08-14 03:02:59 +03:00
|
|
|
}{%
|
|
|
|
|
\end{cliptocell}%
|
2021-08-30 01:42:11 +03:00
|
|
|
\end{cell*}%
|
|
|
|
|
\ignorespaces}
|
2021-08-14 03:02:59 +03:00
|
|
|
|
|
|
|
|
|
2021-09-08 18:52:23 +03:00
|
|
|
% XXX EXPERIMENTAL
|
|
|
|
|
%% \DescribeEnv{adjustcell}
|
|
|
|
|
%% \DescribeEnv{adjustcell*}
|
|
|
|
|
%
|
|
|
|
|
%% \EXPERIMENTAL
|
|
|
|
|
%%
|
|
|
|
|
\newenvironment{adjustcell*}[4][t]{%
|
|
|
|
|
\begin{adjustbox}{#2}%
|
|
|
|
|
\vspace{0pt}%
|
|
|
|
|
\begin{minipagecell*}[#1]{#3}{#4}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{minipagecell*}%
|
|
|
|
|
\end{adjustbox}}
|
|
|
|
|
|
|
|
|
|
\newenvironment{adjustcell}[4][t]{%
|
|
|
|
|
\begin{adjustbox}{#2}%
|
|
|
|
|
\vspace{0pt}%
|
|
|
|
|
\begin{minipagecell}[#1]{#3}{#4}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{minipagecell}%
|
|
|
|
|
\end{adjustbox}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-26 04:04:38 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2021-08-27 20:12:06 +03:00
|
|
|
%%%%% Save cells
|
2021-08-27 19:04:05 +03:00
|
|
|
|
2021-08-26 04:04:38 +03:00
|
|
|
%% \DescribeMacro{\savecell\{..\}}
|
2021-08-30 18:55:11 +03:00
|
|
|
%% \DescribeMacro{\gsavecell\{..\}}
|
2021-08-26 04:04:38 +03:00
|
|
|
%
|
|
|
|
|
%% Create a saved cell.
|
2021-08-27 19:04:05 +03:00
|
|
|
%
|
2021-08-26 04:04:38 +03:00
|
|
|
%% >> \savecell{<name>}{<width>}{<height>}{ .. }
|
2021-08-27 19:04:05 +03:00
|
|
|
%
|
2021-08-26 04:04:38 +03:00
|
|
|
%% This is similar to |\newsavebox{..}| and |\sbox{..}| but adds
|
|
|
|
|
%% cell functionality.
|
|
|
|
|
%%
|
2021-08-30 18:55:11 +03:00
|
|
|
%% |\gsavecell{..}| is the same as |\savecell{..}| but greates a global
|
|
|
|
|
%% cell.
|
|
|
|
|
%%
|
2021-09-02 02:05:32 +03:00
|
|
|
% XXX can/should we make this an env???
|
2021-08-26 20:03:17 +03:00
|
|
|
% XXX should this be split into \newsavecell{..} and \scell{..} ???
|
2021-08-27 19:04:05 +03:00
|
|
|
% XXX can we use root cells inside this???
|
|
|
|
|
% ...i.e. things using textbox*...
|
2021-09-02 02:05:32 +03:00
|
|
|
\newcommand\savecell[5][]{%
|
2021-08-26 04:04:38 +03:00
|
|
|
% only define a savebox once...
|
2021-09-02 02:05:32 +03:00
|
|
|
\@ifundefined{#2}{%
|
|
|
|
|
\expandafter\newsavebox\csname #2\endcsname}{}
|
|
|
|
|
\expandafter\sbox\csname #2\endcsname{%
|
|
|
|
|
\begin{inlinecell*}[#1]{#3}{#4}%
|
|
|
|
|
#5%
|
2021-08-30 01:42:11 +03:00
|
|
|
\end{inlinecell*}}%
|
|
|
|
|
\ignorespaces}
|
2021-08-26 04:04:38 +03:00
|
|
|
|
2021-09-02 02:05:32 +03:00
|
|
|
\newcommand\gsavecell[5][]{%
|
2021-08-30 18:55:11 +03:00
|
|
|
% only define a savebox once...
|
2021-09-02 02:05:32 +03:00
|
|
|
\@ifundefined{#2}{%
|
|
|
|
|
\expandafter\newsavebox\csname #2\endcsname}{}
|
|
|
|
|
\global\expandafter\sbox\csname #2\endcsname{%
|
|
|
|
|
\begin{inlinecell*}[#1]{#3}{#4}%
|
|
|
|
|
#5%
|
2021-08-30 18:55:11 +03:00
|
|
|
\end{inlinecell*}}%
|
|
|
|
|
\ignorespaces}
|
|
|
|
|
|
2021-08-26 04:04:38 +03:00
|
|
|
|
|
|
|
|
%% \DescribeMacro{\usecell\{..\}}
|
2021-08-29 17:05:28 +03:00
|
|
|
%% \DescribeMacro{\usecell*\{..\}}
|
2021-08-26 04:04:38 +03:00
|
|
|
%
|
2021-08-27 19:04:05 +03:00
|
|
|
%% Use part of a saved cell.
|
2021-08-26 04:04:38 +03:00
|
|
|
%%
|
2021-08-27 19:04:05 +03:00
|
|
|
%% >> \usecell{<name>}(<top>, <left>){<width>}{<height>}
|
|
|
|
|
%%
|
|
|
|
|
%% This will clip the content to cell.
|
2021-08-26 04:04:38 +03:00
|
|
|
%%
|
2021-08-29 17:05:28 +03:00
|
|
|
%% |\usecell*{..}| is similar to |\usecell{..}| but will not clip the
|
|
|
|
|
%% cell content.
|
|
|
|
|
%%
|
|
|
|
|
%% >> \usecell*{<name>}(<top>, <left>){<width>}{<height>}
|
|
|
|
|
%%
|
|
|
|
|
%% These are similar to |\usebox{..}|.
|
2021-08-26 04:04:38 +03:00
|
|
|
%%
|
2021-09-02 02:05:32 +03:00
|
|
|
\def\usecell{\@ifstar{%
|
|
|
|
|
\photobook@usecell%
|
|
|
|
|
}{%
|
|
|
|
|
\photobook@usecell@star}}
|
|
|
|
|
|
|
|
|
|
% cell content...
|
|
|
|
|
% NOTE: this is not intended for direct use -- depends closure/context...
|
|
|
|
|
\def\photobook@usecell@placecell#1(#2){%
|
|
|
|
|
\readlist*\photobook@usecell@offset{#2}%
|
|
|
|
|
% XXX how we align things feels a bit odd...
|
|
|
|
|
\vspace{-\dimexpr \photobook@usecell@offset[1] \relax}%
|
|
|
|
|
\adjustbox{margin={-\dimexpr \photobook@usecell@offset[2] \relax} 0pt 0pt 0pt}{%
|
|
|
|
|
\expandafter\usebox\csname #1\endcsname}}
|
|
|
|
|
|
2021-08-27 19:04:05 +03:00
|
|
|
% XXX add option to rotate saved cell...
|
2021-09-02 02:05:32 +03:00
|
|
|
\def\photobook@usecell@star#1(#2)#3#4{
|
2021-08-27 19:04:05 +03:00
|
|
|
\begin{inlinecell}{#3}{#4}%
|
|
|
|
|
\photobook@usecell@placecell{#1}(#2)%
|
2021-08-26 04:04:38 +03:00
|
|
|
\end{inlinecell}}
|
|
|
|
|
|
2021-08-27 19:04:05 +03:00
|
|
|
% XXX add option to rotate saved cell...
|
|
|
|
|
\def\photobook@usecell#1(#2)#3#4{
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{inlinecell*}{#3}{#4}%
|
2021-08-27 19:04:05 +03:00
|
|
|
\photobook@usecell@placecell{#1}(#2)%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{inlinecell*}}
|
2021-08-26 04:04:38 +03:00
|
|
|
|
|
|
|
|
|
2021-08-13 15:09:38 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Cell macros
|
|
|
|
|
%
|
|
|
|
|
%% Cell macros require a cell environment to function correctly.
|
|
|
|
|
%%
|
|
|
|
|
|
2021-08-27 19:04:05 +03:00
|
|
|
%% \DescribeEnv{topdown}
|
|
|
|
|
%% \DescribeEnv{bottomup}
|
|
|
|
|
%
|
|
|
|
|
%% Rotate cell content vertically, orienting it top-down or bottom-up.
|
|
|
|
|
%
|
|
|
|
|
%% >> \begin{topdown} ... \end{topdown}
|
|
|
|
|
%% >> \begin{bottomup} ... \end{bottomup}
|
|
|
|
|
%%
|
2021-08-29 03:01:01 +03:00
|
|
|
\newenvironment{topdown}[1][t]{%
|
2021-08-27 19:04:05 +03:00
|
|
|
\begin{flushright}%
|
2021-08-29 03:01:01 +03:00
|
|
|
\begin{turn}{270}%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{inlinecell*}[#1]{\cellheight}{\cellwidth}%
|
2021-08-29 03:01:01 +03:00
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{inlinecell*}%
|
2021-08-30 01:42:11 +03:00
|
|
|
\end{turn}%
|
2021-08-27 19:04:05 +03:00
|
|
|
\end{flushright}}
|
|
|
|
|
|
2021-08-29 03:01:01 +03:00
|
|
|
\newenvironment{bottomup}[1][t]{%
|
|
|
|
|
\begin{turn}{90}%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{inlinecell*}[#1]{\cellheight}{\cellwidth}%
|
2021-08-29 03:01:01 +03:00
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{inlinecell*}%
|
2021-08-29 03:01:01 +03:00
|
|
|
\end{turn}}
|
2021-08-27 19:04:05 +03:00
|
|
|
|
|
|
|
|
|
2021-08-14 03:02:59 +03:00
|
|
|
%% \DescribeEnv{cliptocell}
|
|
|
|
|
%
|
2021-08-30 01:42:11 +03:00
|
|
|
%% Clip content to parent cell.
|
2021-08-14 03:02:59 +03:00
|
|
|
%%
|
|
|
|
|
\newenvironment{cliptocell}{%
|
|
|
|
|
\begin{clipbox*}{0cm {\height - \cellheight} {\cellwidth} {\height}}%
|
|
|
|
|
\begin{minipage}[t][\cellheight][t]{\cellwidth}%
|
2021-08-30 01:42:11 +03:00
|
|
|
\ignorespaces%
|
2021-08-14 03:02:59 +03:00
|
|
|
}{%
|
|
|
|
|
\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-29 17:05:28 +03:00
|
|
|
%% Place image in 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-29 17:05:28 +03:00
|
|
|
%% >> \imagecell[fit]{}{<image>}
|
|
|
|
|
%% >> \imagecell[fill]{}{<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.
|
|
|
|
|
%%
|
2021-08-29 17:05:28 +03:00
|
|
|
%% >> \imagecell{}{<image>}
|
|
|
|
|
%% >> \imagecell[center]{}{<image>}
|
2021-08-20 01:22:17 +03:00
|
|
|
%%
|
2021-08-29 17:05:28 +03:00
|
|
|
%% Vertical alignment
|
2021-08-19 23:53:01 +03:00
|
|
|
%%
|
2021-08-29 17:05:28 +03:00
|
|
|
%% >> \imagecell[top]{}{<image>}
|
|
|
|
|
%% >> \imagecell[bottom]{}{<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}
|
|
|
|
|
%%
|
2021-08-29 17:05:28 +03:00
|
|
|
%% Horizontal alignment
|
2021-08-19 23:53:01 +03:00
|
|
|
%%
|
2021-08-29 17:05:28 +03:00
|
|
|
%% >> \imagecell[left]{}{<image>}
|
|
|
|
|
%% >> \imagecell[right]{}{<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-29 17:05:28 +03:00
|
|
|
%% >> \imagecell[clearance=-4mm]{}{<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-09-02 02:05:32 +03:00
|
|
|
% XXX might be a good idea to split this into two parts:
|
|
|
|
|
% - \aligncell{..}
|
|
|
|
|
% - \imagecell{caption}{image}
|
|
|
|
|
% -> size image
|
|
|
|
|
% -> \aligncell{
|
|
|
|
|
% image
|
|
|
|
|
% caption}
|
2021-08-31 08:27:37 +03:00
|
|
|
% XXX document scale/offsettop/offsetleft...
|
2021-08-19 23:53:01 +03:00
|
|
|
|
2021-08-27 02:49:28 +03:00
|
|
|
% NOTE: these are macros and not lengths as we need to "resolve" these
|
|
|
|
|
% as late as possible, i.e. after all the arguments have been
|
|
|
|
|
% processed.
|
2021-08-20 01:22:17 +03:00
|
|
|
\def\photobook@imagecell@top{0pt}
|
|
|
|
|
\def\photobook@imagecell@left{0pt}
|
2021-08-23 21:06:22 +03:00
|
|
|
\def\photobook@imagecell@captiontop{0pt}
|
|
|
|
|
\def\photobook@imagecell@captionleft{0pt}
|
2021-08-23 19:26:51 +03:00
|
|
|
|
|
|
|
|
\newlength\photobook@imagecell@clearance
|
|
|
|
|
\setlength\photobook@imagecell@clearance{0pt}
|
2021-08-20 01:22:17 +03:00
|
|
|
|
2021-08-27 02:49:28 +03:00
|
|
|
% NOTE: these feel like a hack...
|
|
|
|
|
\newlength\photobook@imagecell@imgratio
|
|
|
|
|
\newlength\photobook@imagecell@cellratio
|
|
|
|
|
|
2021-08-20 01:22:17 +03:00
|
|
|
% 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-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-23 21:06:22 +03:00
|
|
|
+\photobook@imagecell@clearance \relax}%
|
|
|
|
|
\def\photobook@imagecell@captionleft{
|
|
|
|
|
% XXX not sure why this branch is needed...
|
|
|
|
|
\ifKV@imagecell@args@fit
|
|
|
|
|
0pt
|
|
|
|
|
\else%
|
|
|
|
|
\dimexpr%
|
|
|
|
|
+\cellwidth
|
|
|
|
|
-\photobook@imagecell@clearance
|
|
|
|
|
-\wd\photobook@imagebox \relax\fi}}%
|
2021-08-20 01:22:17 +03:00
|
|
|
\newcommand\photobook@imagecell@RIGHT{%
|
|
|
|
|
\def\photobook@imagecell@left{\dimexpr
|
2021-08-19 23:53:01 +03:00
|
|
|
+\cellwidth
|
2021-08-20 01:22:17 +03:00
|
|
|
-\photobook@imagecell@clearance
|
2021-08-23 21:06:22 +03:00
|
|
|
-\wd\photobook@imagebox \relax}
|
|
|
|
|
% XXX not sure why 0.5 but it seems to work...
|
|
|
|
|
\def\photobook@imagecell@captionleft{%
|
|
|
|
|
-0.5\photobook@imagecell@left}}%
|
2021-08-19 23:53:01 +03:00
|
|
|
% 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-09-08 04:37:44 +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{%
|
2021-09-08 04:37:44 +03:00
|
|
|
\photobook@imagecell@clearance}%
|
|
|
|
|
\def\photobook@imagecell@captiontop{%
|
2021-08-23 21:06:22 +03:00
|
|
|
-\dimexpr
|
|
|
|
|
+\cellheight
|
|
|
|
|
-\ht\photobook@imagebox \relax}}%
|
2021-08-20 01:22:17 +03:00
|
|
|
\define@boolkey{imagecell@args}{bottom}[true]{%
|
2021-09-12 03:29:50 +03:00
|
|
|
\def\photobook@imagecell@top{%
|
|
|
|
|
\dimexpr
|
|
|
|
|
+\cellheight
|
|
|
|
|
-\photobook@imagecell@clearance
|
|
|
|
|
-\ht\photobook@imagebox \relax}%
|
2021-08-23 21:06:22 +03:00
|
|
|
\def\photobook@imagecell@captiontop{%
|
2021-09-12 03:29:50 +03:00
|
|
|
\dimexpr
|
|
|
|
|
\photobook@imagecell@top
|
|
|
|
|
+\photobook@imagecell@clearance \relax}}%
|
2021-08-19 23:53:01 +03:00
|
|
|
% clearance=<len>...
|
2021-08-20 01:22:17 +03:00
|
|
|
\define@key{imagecell@args}{clearance}{%
|
2021-08-23 19:26:51 +03:00
|
|
|
\setlength\photobook@imagecell@clearance{#1}}%
|
2021-08-19 23:53:01 +03:00
|
|
|
|
2021-08-31 08:27:37 +03:00
|
|
|
% offsettop=<len> / offsetleft=<len>...
|
|
|
|
|
\newlength\photobook@imagecell@offsettop%
|
|
|
|
|
\setlength\photobook@imagecell@offsettop{0pt}%
|
|
|
|
|
\define@key{imagecell@args}{offsettop}[0pt]{%
|
|
|
|
|
\setlength\photobook@imagecell@offsettop{#1}}%
|
|
|
|
|
\newlength\photobook@imagecell@offsetleft%
|
|
|
|
|
\setlength\photobook@imagecell@offsetleft{0pt}%
|
|
|
|
|
\define@key{imagecell@args}{offsetleft}[0pt]{%
|
|
|
|
|
\setlength\photobook@imagecell@offsetleft{#1}}%
|
|
|
|
|
|
|
|
|
|
% scale=<num>...
|
|
|
|
|
\edef\photobook@imagecell@scale{1}%
|
|
|
|
|
\define@key{imagecell@args}{scale}[1]{%
|
|
|
|
|
\edef\photobook@imagecell@scale{#1}}%
|
|
|
|
|
|
2021-09-02 02:05:32 +03:00
|
|
|
% captionalign=t|c|b...
|
2021-08-20 17:36:22 +03:00
|
|
|
\def\photobook@imagecell@captionalign{t}
|
2021-09-02 02:05:32 +03:00
|
|
|
\define@choicekey{imagecell@args}{captionalign}{t,c,b}[t]{%
|
2021-09-08 04:37:44 +03:00
|
|
|
\def\photobook@imagecell@captionalign{#1}}
|
2021-08-20 17:36:22 +03:00
|
|
|
|
2021-08-27 02:49:28 +03:00
|
|
|
% XXX add offset support...
|
|
|
|
|
% ...i.e. an argument that will shift the image v/h from base position.
|
|
|
|
|
% also need to shift the caption box accordingly but still keep it
|
|
|
|
|
% within the cell...
|
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-09-08 04:37:44 +03:00
|
|
|
\setkeys{imagecell@args}{%
|
2021-08-24 01:54:52 +03:00
|
|
|
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,
|
2021-08-31 08:27:37 +03:00
|
|
|
width=\photobook@imagecell@scale\dimexpr
|
2021-08-20 01:22:17 +03:00
|
|
|
\cellwidth
|
|
|
|
|
- ((\photobook@imagecell@clearance) * 2) \relax,
|
2021-08-31 08:27:37 +03:00
|
|
|
height=\photobook@imagecell@scale\dimexpr
|
2021-08-20 01:22:17 +03:00
|
|
|
\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...
|
2021-09-11 14:52:30 +03:00
|
|
|
\sbox{\photobook@imagebox}{\includegraphics{#3}}%
|
2021-08-20 01:22:17 +03:00
|
|
|
% constrain minimal dimension of image...
|
2021-08-26 20:03:17 +03:00
|
|
|
% NOTE: here we calculate image/cell eccentricity to decide
|
|
|
|
|
% to fit to width or heigh of cell...
|
|
|
|
|
% NOTE: did I say that I "love" how LaTeX does basic math??
|
2021-09-11 14:52:30 +03:00
|
|
|
\setlength\photobook@imagecell@imgratio{%
|
|
|
|
|
1pt * \ratio{\wd\photobook@imagebox}{\ht\photobook@imagebox}}%
|
|
|
|
|
\setlength\photobook@imagecell@cellratio{%
|
|
|
|
|
1pt * \ratio{\cellwidth}{\cellheight}}%
|
2021-09-08 04:37:44 +03:00
|
|
|
\ifdim \photobook@imagecell@imgratio < \photobook@imagecell@cellratio%
|
2021-08-20 01:22:17 +03:00
|
|
|
\sbox{\photobook@imagebox}{%
|
2021-08-20 01:42:20 +03:00
|
|
|
\includegraphics[%
|
2021-08-20 01:22:17 +03:00
|
|
|
keepaspectratio,
|
2021-08-31 08:27:37 +03:00
|
|
|
width=\photobook@imagecell@scale\dimexpr
|
2021-08-26 20:03:17 +03:00
|
|
|
+ \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,
|
2021-08-31 08:27:37 +03:00
|
|
|
height=\photobook@imagecell@scale\dimexpr
|
2021-08-26 20:03:17 +03:00
|
|
|
+ \cellheight
|
2021-09-11 14:52:30 +03:00
|
|
|
- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}%
|
2021-09-12 03:29:50 +03:00
|
|
|
\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-09-12 03:29:50 +03:00
|
|
|
%fbox=0.1pt 0pt 0pt,
|
2021-08-31 08:27:37 +03:00
|
|
|
margin=
|
|
|
|
|
{\dimexpr
|
|
|
|
|
\photobook@imagecell@offsetleft
|
|
|
|
|
+ \photobook@imagecell@left \relax}
|
|
|
|
|
0pt 0pt
|
|
|
|
|
{\dimexpr
|
|
|
|
|
\photobook@imagecell@offsettop
|
|
|
|
|
+ \photobook@imagecell@top \relax}}{%
|
2021-08-20 01:22:17 +03:00
|
|
|
% image....
|
2021-08-19 23:53:01 +03:00
|
|
|
\usebox\photobook@imagebox%
|
2021-08-27 19:04:05 +03:00
|
|
|
%
|
2021-08-20 01:22:17 +03:00
|
|
|
% caption cell...
|
2021-08-30 01:42:11 +03:00
|
|
|
% XXX make this conditional -- if caption is not empty...
|
2021-08-23 21:06:22 +03:00
|
|
|
\begingroup%
|
2021-08-27 19:04:05 +03:00
|
|
|
% setup the cell env...
|
2021-09-01 04:05:31 +03:00
|
|
|
\setlength\clearance{\photobook@imagecell@clearance}%
|
2021-08-27 19:04:05 +03:00
|
|
|
% NOTE: this needs the original \cellwidth...
|
|
|
|
|
\setlength\celloffsetleft{%
|
|
|
|
|
\mindim{%
|
2021-08-23 21:06:22 +03:00
|
|
|
\wd\photobook@imagebox
|
|
|
|
|
}{%
|
|
|
|
|
+\cellwidth
|
|
|
|
|
-\photobook@imagecell@captionleft
|
|
|
|
|
-0.5\dimexpr
|
|
|
|
|
+\cellwidth
|
2021-08-27 19:04:05 +03:00
|
|
|
-\wd\photobook@imagebox \relax}}%
|
|
|
|
|
\setlength\cellparentwidth{\cellwidth}%
|
|
|
|
|
\setlength\cellparentheight{\cellheight}%
|
|
|
|
|
\setlength\cellwidth{%
|
|
|
|
|
\mindim{\wd\photobook@imagebox}{\cellwidth}}%
|
|
|
|
|
\setlength\cellheight{%
|
|
|
|
|
\mindim{\ht\photobook@imagebox}{\cellheight}}%
|
|
|
|
|
% NOTE: this needs the new \cellheight...
|
|
|
|
|
\setlength\celloffsettop{%
|
|
|
|
|
\mindim{%
|
|
|
|
|
0pt
|
|
|
|
|
}{%
|
|
|
|
|
+ 0.5\dimexpr
|
|
|
|
|
+\cellheight
|
|
|
|
|
-\ht\photobook@imagebox
|
2021-09-12 03:29:50 +03:00
|
|
|
-\photobook@imagecell@captiontop \relax}}%
|
2021-08-27 19:04:05 +03:00
|
|
|
%
|
|
|
|
|
% place the caption cell...
|
2021-09-12 03:29:50 +03:00
|
|
|
\smash{\makebox[0pt][l]{%
|
|
|
|
|
\hspace{-\celloffsetleft}{%
|
|
|
|
|
\setlength\fboxsep{0pt}%
|
|
|
|
|
% adjust top if image is taller than cell...
|
|
|
|
|
\raisebox{-\celloffsettop}{%
|
|
|
|
|
\begin{minipage}[b][\cellheight][\photobook@imagecell@captionalign]{\cellwidth}%
|
|
|
|
|
\ignorespaces%
|
|
|
|
|
#2%
|
|
|
|
|
\end{minipage}}}}}%
|
2021-08-23 21:06:22 +03:00
|
|
|
\endgroup}%
|
2021-08-19 23:53:01 +03:00
|
|
|
\endgroup}
|
2021-08-18 22:15:03 +03:00
|
|
|
|
|
|
|
|
|
2021-08-20 17:36:22 +03:00
|
|
|
%% \DescribeMacro{\captioncell\{..\}}
|
|
|
|
|
%
|
2021-08-26 04:04:38 +03:00
|
|
|
%% Caption cell
|
|
|
|
|
%%
|
2021-08-28 01:13:45 +03:00
|
|
|
%% Placement:
|
|
|
|
|
%
|
|
|
|
|
%% >> \captioncell[<position>]{<caption>}
|
|
|
|
|
%
|
2021-08-20 17:36:22 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-28 01:43:57 +03:00
|
|
|
%% over
|
2021-08-20 17:36:22 +03:00
|
|
|
%% +-----------------+
|
2021-08-28 01:43:57 +03:00
|
|
|
%% | top |
|
2021-08-20 17:36:22 +03:00
|
|
|
%% | |
|
|
|
|
|
%% | |
|
|
|
|
|
%% | |
|
2021-08-28 01:43:57 +03:00
|
|
|
%% | center |
|
2021-08-20 17:36:22 +03:00
|
|
|
%% | |
|
|
|
|
|
%% | |
|
2021-08-26 04:04:38 +03:00
|
|
|
%% | |
|
2021-08-28 01:43:57 +03:00
|
|
|
%% | bottom |
|
2021-08-20 17:36:22 +03:00
|
|
|
%% +-----------------+
|
2021-08-28 01:43:57 +03:00
|
|
|
%% under
|
2021-08-20 17:36:22 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-26 04:04:38 +03:00
|
|
|
%% Default:
|
|
|
|
|
%% >> \captioncell{<caption>}
|
2021-08-28 01:13:45 +03:00
|
|
|
%% >> \captioncell[top]{<caption>}
|
2021-08-26 04:04:38 +03:00
|
|
|
%%
|
2021-08-28 01:13:45 +03:00
|
|
|
%% >> \captioncell[center]{<caption>}
|
|
|
|
|
%% >> \captioncell[bottom]{<caption>}
|
|
|
|
|
%%
|
|
|
|
|
%% >> \captioncell[over]{<caption>}
|
|
|
|
|
%% >> \captioncell[under]{<caption>}
|
2021-08-26 04:04:38 +03:00
|
|
|
%%
|
2021-08-28 01:13:45 +03:00
|
|
|
%% Horizontal alignment
|
|
|
|
|
%
|
|
|
|
|
%% >> \captioncell[align=<mode>]{<caption>}
|
|
|
|
|
%
|
2021-08-26 04:04:38 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% +-----------------+ +-----------------+ +-----------------+
|
|
|
|
|
%% |flushleft | | center | | flushright|
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-28 01:13:45 +03:00
|
|
|
%% Default:
|
|
|
|
|
%% >> \captioncell{<caption>}
|
|
|
|
|
%% >> \captioncell[align=flushleft]{<caption>}
|
|
|
|
|
%%
|
|
|
|
|
%% >> \captioncell[align=center]{<caption>}
|
|
|
|
|
%% >> \captioncell[align=flushright]{<caption>}
|
|
|
|
|
%%
|
2021-08-30 01:42:11 +03:00
|
|
|
%% Note that a caption cell does not take up any space in the parent cell
|
|
|
|
|
%% so multiple captions can be used in combination with other elements.
|
|
|
|
|
%%
|
2021-09-02 02:05:32 +03:00
|
|
|
%% Note that caption cells currently do not play well with other content
|
|
|
|
|
%% in the same cell that takes up space, e.g. text, pictures, ...etc.
|
|
|
|
|
%% Captions are mainly suited to play well with image cells.
|
|
|
|
|
%%
|
2021-09-08 04:37:44 +03:00
|
|
|
% XXX make captions clear left/right of page...
|
2021-09-02 02:05:32 +03:00
|
|
|
% XXX need a way to make caption boxes independent of other cell content...
|
|
|
|
|
% ...two ways to do this that come to mind:
|
|
|
|
|
% - place cell content into a 0-space cell
|
|
|
|
|
% - place captions outside of the actual cell...
|
2021-08-24 01:54:52 +03:00
|
|
|
|
2021-08-28 13:28:15 +03:00
|
|
|
% over / top / center / bottom / under...
|
2021-08-25 14:01:41 +03:00
|
|
|
\define@boolkey{captioncell@args}{over}[true]{%
|
2021-08-24 01:54:52 +03:00
|
|
|
\def\photobook@captioncell@format##1{%
|
2021-08-30 01:42:11 +03:00
|
|
|
\photobook@captioncell@formatalign[-\cellheight]{b}{##1}}}
|
2021-08-24 01:54:52 +03:00
|
|
|
\define@boolkey{captioncell@args}{top}[true]{%
|
|
|
|
|
\def\photobook@captioncell@format##1{%
|
2021-08-30 01:42:11 +03:00
|
|
|
\photobook@captioncell@formatalign{t}{##1}}}
|
2021-08-24 01:54:52 +03:00
|
|
|
\define@boolkey{captioncell@args}{center}[true]{%
|
|
|
|
|
\def\photobook@captioncell@format##1{%
|
2021-08-30 01:42:11 +03:00
|
|
|
\smash{\makebox[0pt][l]{%
|
|
|
|
|
\begin{minipage}[t][\cellheight][c]{\cellwidth}%
|
|
|
|
|
\begin{\photobook@captioncell@align}%
|
|
|
|
|
\ignorespaces%
|
|
|
|
|
##1%
|
|
|
|
|
\end{\photobook@captioncell@align}%
|
|
|
|
|
\end{minipage}}}}}
|
2021-08-24 01:54:52 +03:00
|
|
|
\define@boolkey{captioncell@args}{bottom}[true]{%
|
|
|
|
|
\def\photobook@captioncell@format##1{%
|
2021-08-30 01:42:11 +03:00
|
|
|
\photobook@captioncell@formatalign{b}{##1}}}
|
2021-08-25 14:01:41 +03:00
|
|
|
\define@boolkey{captioncell@args}{under}[true]{%
|
2021-08-24 01:54:52 +03:00
|
|
|
\def\photobook@captioncell@format##1{%
|
2021-08-30 01:42:11 +03:00
|
|
|
\photobook@captioncell@formatalign[\cellheight]{t}{##1}}}
|
2021-09-02 02:05:32 +03:00
|
|
|
% align=<len>...
|
2021-08-24 01:54:52 +03:00
|
|
|
\def\photobook@captioncell@align{}
|
2021-08-28 01:13:45 +03:00
|
|
|
% XXX for some reason \define@choicekey{..} does not expand macros...
|
|
|
|
|
%\define@choicekey{captioncell@args}{align}{flushleft,center,flushright}{%
|
|
|
|
|
\define@key{captioncell@args}{align}{%
|
2021-08-24 01:54:52 +03:00
|
|
|
\def\photobook@captioncell@align{#1}}
|
2021-09-02 02:05:32 +03:00
|
|
|
% margin=<len>...
|
2021-08-24 01:54:52 +03:00
|
|
|
\def\photobook@captioncell@margin{0pt}
|
2021-08-30 01:42:11 +03:00
|
|
|
\define@key{captioncell@args}{margin}{%
|
2021-08-24 01:54:52 +03:00
|
|
|
\def\photobook@captioncell@margin{#1}}
|
2021-08-20 16:57:00 +03:00
|
|
|
|
2021-09-02 02:05:32 +03:00
|
|
|
% helpers...
|
|
|
|
|
% XXX set minipage height to available cell height (???)
|
|
|
|
|
\newcommand\photobook@captioncell@formatalign[3][0pt]{%
|
|
|
|
|
\smash{\makebox[0pt][l]{%
|
|
|
|
|
\begin{minipage}[t][\cellheight][t]{\cellwidth}%
|
|
|
|
|
% XXX for some reason without this things get misaligned...
|
|
|
|
|
\vspace{#1}%
|
|
|
|
|
% XXX HACK: for some magical reason setting the above minipage to 'b'
|
|
|
|
|
% will make \vspace{..} above break...
|
|
|
|
|
% ...adding another nested minipage seems to fix the issue...
|
|
|
|
|
\begin{minipage}[t][\cellheight][#2]{\cellwidth}%
|
|
|
|
|
\begin{\photobook@captioncell@align}%
|
|
|
|
|
\ignorespaces%
|
|
|
|
|
#3%
|
|
|
|
|
\end{\photobook@captioncell@align}%
|
|
|
|
|
\end{minipage}
|
|
|
|
|
\end{minipage}}}}
|
|
|
|
|
% format...
|
|
|
|
|
\def\photobook@captioncell@format#1{%
|
|
|
|
|
\photobook@captioncell@formatalign{t}{#1}}
|
|
|
|
|
|
2021-08-20 16:57:00 +03:00
|
|
|
\newcommand\captioncell[2][]{%
|
2021-09-02 02:05:32 +03:00
|
|
|
\setkeys{captioncell@args}{
|
|
|
|
|
top,
|
|
|
|
|
align=flushright,
|
|
|
|
|
margin=1pt,
|
|
|
|
|
#1}%
|
2021-08-24 01:54:52 +03:00
|
|
|
\photobook@captioncell@format{%
|
2021-08-30 01:42:11 +03:00
|
|
|
\adjustbox{margin=\photobook@captioncell@margin}{#2}}%
|
|
|
|
|
\ignorespaces}
|
2021-08-24 01:54:52 +03:00
|
|
|
|
2021-08-20 16:57:00 +03:00
|
|
|
|
2021-08-28 01:13:45 +03:00
|
|
|
%% \DescribeMacro{\vcaptioncell\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% Vertical caption cell
|
|
|
|
|
%%
|
2021-08-28 01:43:57 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% (topdown) (bottomup)
|
|
|
|
|
%% +-----------------+ +-----------------+
|
|
|
|
|
%% b | l c r | a | |
|
|
|
|
|
%% e | e e i | f | |
|
|
|
|
|
%% f | f n g | t | |
|
|
|
|
|
%% o | t t h | e e | r |
|
|
|
|
|
%% r | e t | r r | e t | r
|
|
|
|
|
%% e | r | o | t t h | e
|
|
|
|
|
%% | | f | f n g | t
|
|
|
|
|
%% | | e | e e i | f
|
|
|
|
|
%% | | b | l c r | a
|
|
|
|
|
%% +-----------------+ +-----------------+
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%% See samples for better illustration.
|
|
|
|
|
%%
|
2021-09-08 04:37:44 +03:00
|
|
|
% XXX make captions clear top/bottom of page...
|
2021-08-29 03:01:01 +03:00
|
|
|
% bottomup / topdown...
|
|
|
|
|
\def\photobook@vcaptioncell@orientation{bottomup}
|
|
|
|
|
\define@boolkey{vcaptioncell@args}{bottomup}[true]{%
|
2021-08-30 01:42:11 +03:00
|
|
|
\KV@vcaptioncell@args@topdownfalse%
|
2021-08-29 03:01:01 +03:00
|
|
|
\def\photobook@vcaptioncell@orientation{bottomup}}
|
|
|
|
|
\define@boolkey{vcaptioncell@args}{topdown}[true]{%
|
2021-08-30 01:42:11 +03:00
|
|
|
\KV@vcaptioncell@args@bottomupfalse%
|
2021-08-29 03:01:01 +03:00
|
|
|
\def\photobook@vcaptioncell@orientation{topdown}}
|
|
|
|
|
|
2021-08-28 13:28:15 +03:00
|
|
|
% before / left / center / right / after...
|
2021-08-28 01:13:45 +03:00
|
|
|
\def\photobook@vcaptioncell@position{top}
|
|
|
|
|
\define@boolkey{vcaptioncell@args}{before}[true]{%
|
|
|
|
|
\def\photobook@vcaptioncell@position{%
|
2021-08-29 07:03:36 +03:00
|
|
|
\ifKV@vcaptioncell@args@bottomup%
|
2021-08-28 01:13:45 +03:00
|
|
|
over%
|
|
|
|
|
\else%
|
|
|
|
|
under\fi}}
|
|
|
|
|
\define@boolkey{vcaptioncell@args}{left}[true]{%
|
|
|
|
|
\def\photobook@vcaptioncell@position{%
|
2021-08-29 07:03:36 +03:00
|
|
|
\ifKV@vcaptioncell@args@bottomup%
|
2021-08-28 01:13:45 +03:00
|
|
|
top%
|
|
|
|
|
\else%
|
|
|
|
|
bottom\fi}}
|
|
|
|
|
\define@boolkey{vcaptioncell@args}{center}[true]{%
|
|
|
|
|
\def\photobook@vcaptioncell@position{center}}
|
|
|
|
|
\define@boolkey{vcaptioncell@args}{right}[true]{%
|
|
|
|
|
\def\photobook@vcaptioncell@position{%
|
2021-08-29 07:03:36 +03:00
|
|
|
\ifKV@vcaptioncell@args@bottomup%
|
2021-08-28 01:13:45 +03:00
|
|
|
bottom%
|
|
|
|
|
\else%
|
|
|
|
|
top\fi}}
|
|
|
|
|
\define@boolkey{vcaptioncell@args}{after}[true]{%
|
|
|
|
|
\def\photobook@vcaptioncell@position{%
|
2021-08-29 07:03:36 +03:00
|
|
|
\ifKV@vcaptioncell@args@bottomup%
|
2021-08-28 01:13:45 +03:00
|
|
|
under%
|
|
|
|
|
\else%
|
|
|
|
|
over\fi}}
|
2021-08-28 13:28:15 +03:00
|
|
|
% align...
|
2021-08-28 01:13:45 +03:00
|
|
|
\def\photobook@vcaptioncell@align{}
|
|
|
|
|
% XXX for some reason \define@choicekey{..} does not expand macros...
|
|
|
|
|
%\define@choicekey{vcaptioncell@args}{align}{flushleft,center,flushright}{%
|
|
|
|
|
\define@key{vcaptioncell@args}{align}{%
|
|
|
|
|
\def\photobook@vcaptioncell@align{#1}}
|
2021-08-28 13:28:15 +03:00
|
|
|
% margin...
|
2021-08-28 01:13:45 +03:00
|
|
|
\def\photobook@vcaptioncell@margin{0pt}
|
2021-08-30 01:42:11 +03:00
|
|
|
\define@key{vcaptioncell@args}{margin}{%
|
2021-08-28 01:13:45 +03:00
|
|
|
\def\photobook@vcaptioncell@margin{#1}}
|
|
|
|
|
|
2021-09-01 04:05:31 +03:00
|
|
|
% valign
|
2021-08-30 01:42:11 +03:00
|
|
|
\def\photobook@vcaptioncell@valign{%
|
|
|
|
|
\ifKV@vcaptioncell@args@bottomup%
|
|
|
|
|
b%
|
|
|
|
|
\else%
|
|
|
|
|
t\fi}
|
|
|
|
|
|
2021-08-28 01:13:45 +03:00
|
|
|
\newcommand\vcaptioncell[2][]{%
|
2021-09-02 02:05:32 +03:00
|
|
|
\setkeys{vcaptioncell@args}{
|
|
|
|
|
left,
|
|
|
|
|
bottomup,
|
|
|
|
|
align=flushleft,
|
|
|
|
|
margin=1pt,
|
|
|
|
|
#1}%
|
2021-08-28 01:13:45 +03:00
|
|
|
%
|
2021-08-30 01:42:11 +03:00
|
|
|
\smash{\makebox[0pt][l]{%
|
|
|
|
|
\begin{minipage}[t][\cellheight][\photobook@vcaptioncell@valign]{\cellwidth}%
|
|
|
|
|
\begin{\photobook@vcaptioncell@orientation}%
|
|
|
|
|
\captioncell[%
|
|
|
|
|
\photobook@vcaptioncell@position,
|
|
|
|
|
align=\photobook@vcaptioncell@align,
|
|
|
|
|
margin=\photobook@vcaptioncell@margin]{#2}%
|
|
|
|
|
\end{\photobook@vcaptioncell@orientation}%
|
|
|
|
|
\end{minipage}}}%
|
|
|
|
|
\ignorespaces}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%% \DescribeMacro{\rcaptioncell\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% \EXPERIMENTAL
|
|
|
|
|
%%
|
2021-08-31 16:25:50 +03:00
|
|
|
%% Upside-down caption cell.
|
|
|
|
|
%%
|
2021-08-30 01:42:11 +03:00
|
|
|
% XXX a bit off...
|
|
|
|
|
\newcommand\rcaptioncell[2][]{%
|
|
|
|
|
\captioncell[align=flushleft, #1]{%
|
|
|
|
|
\begin{turn}{180}%
|
2021-09-02 02:05:32 +03:00
|
|
|
% XXX HACK: RAISEBOX -- need to shift by x-height...
|
2021-08-31 16:25:50 +03:00
|
|
|
% ...currently this is set to 1/(golden ratio) would
|
|
|
|
|
% be nice to make this parametric / font-derived...
|
2021-09-02 02:05:32 +03:00
|
|
|
\raisebox{1ex * \real{-0.618033988749855}}{#2}%
|
2021-08-30 01:42:11 +03:00
|
|
|
\end{turn}}%
|
|
|
|
|
\ignorespaces}
|
2021-08-28 01:13:45 +03:00
|
|
|
|
|
|
|
|
|
2021-09-01 04:05:31 +03:00
|
|
|
%% \DescribeMacro{\captionblockcell\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% \EXPERIMENTAL
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-09-03 16:32:03 +03:00
|
|
|
%% celloffsetleft celloffsetleft
|
|
|
|
|
%% <-------> v
|
|
|
|
|
%% . <--------------> .<-------------> cellwidth
|
|
|
|
|
%% <------------------------> <------------------------> cellparentwidth
|
|
|
|
|
%% . .. .. .. . .
|
|
|
|
|
%% +------------------------+ +------------------------+
|
|
|
|
|
%% | | | |
|
|
|
|
|
%% | | | |
|
|
|
|
|
%% |+-------++ - - - - - - +| |+ - - - - - - ++-------+|
|
|
|
|
|
%% || |. .| |. .| ||
|
|
|
|
|
%% || |. .| |. .| ||
|
|
|
|
|
%% || cap. |. cell .| |. cell .| cap. ||
|
|
|
|
|
%% || |. .| |. .| ||
|
|
|
|
|
%% || |. .| |. .| ||
|
|
|
|
|
%% |+-------++ - - - - - - +| |+ - - - - - - ++-------+|
|
|
|
|
|
%% | | | |
|
|
|
|
|
%% | | | |
|
|
|
|
|
%% +------------------------+ +------------------------+
|
|
|
|
|
%% <> clearcaption .. <> clearcaption
|
|
|
|
|
%% <> spacing <> spacing
|
2021-09-01 04:05:31 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-09-08 04:37:44 +03:00
|
|
|
% XXX make captions clear top/bottom of page...
|
2021-09-03 16:32:03 +03:00
|
|
|
% XXX add cell spacing...
|
2021-08-28 01:43:57 +03:00
|
|
|
% XXX need to do a caption block -- a cell to one side of an image to the
|
|
|
|
|
% end of the page...
|
2021-08-31 16:25:50 +03:00
|
|
|
% XXX can we use the normal caption and simply insert a minipage of the
|
|
|
|
|
% appropriate width???
|
2021-09-01 04:05:31 +03:00
|
|
|
|
|
|
|
|
\newlength\photobook@captionblockcell@tmplen
|
|
|
|
|
|
2021-09-02 02:05:32 +03:00
|
|
|
% left / right
|
2021-09-01 04:05:31 +03:00
|
|
|
\define@boolkey{captionblockcell@args}{left}[true]{%
|
|
|
|
|
\KV@captionblockcell@args@rightfalse}
|
|
|
|
|
\define@boolkey{captionblockcell@args}{right}[true]{%
|
|
|
|
|
\KV@captionblockcell@args@leftfalse}
|
|
|
|
|
|
2021-09-02 02:05:32 +03:00
|
|
|
% align=flushright|center|flushright
|
2021-09-01 04:05:31 +03:00
|
|
|
% XXX this should depend on left/right...
|
2021-09-02 16:22:53 +03:00
|
|
|
\def\photobook@captionblockcell@align{%
|
|
|
|
|
\ifKV@captionblockcell@args@left%
|
|
|
|
|
flushright%
|
|
|
|
|
\else%
|
|
|
|
|
flushleft\fi}
|
2021-09-01 04:05:31 +03:00
|
|
|
\define@key{captionblockcell@args}{align}{%
|
2021-09-02 16:22:53 +03:00
|
|
|
\def\photobook@captionblockcell@align{#1}}
|
2021-09-01 04:05:31 +03:00
|
|
|
|
2021-09-02 02:05:32 +03:00
|
|
|
% valign=t|c|b
|
2021-09-01 04:05:31 +03:00
|
|
|
% XXX should be a boolkey -- t|c|b???
|
|
|
|
|
\edef\photobook@captionblockcell@valign{b}
|
|
|
|
|
\define@key{captionblockcell@args}{valign}{%
|
|
|
|
|
\edef\photobook@captionblockcell@valign{#1}}
|
|
|
|
|
|
2021-09-03 16:32:03 +03:00
|
|
|
% clearance=<len> (defaults: \clearcaption)
|
2021-09-01 04:05:31 +03:00
|
|
|
\newlength\photobook@captionblockcell@clearance
|
|
|
|
|
\define@key{captionblockcell@args}{clearance}{%
|
|
|
|
|
\setlength\photobook@captionblockcell@clearance{#1}}
|
|
|
|
|
|
2021-09-03 16:32:03 +03:00
|
|
|
% spacing=<len> (default: \captioncellspacing)
|
|
|
|
|
\newlength\photobook@captionblockcell@spacing
|
|
|
|
|
\setlength\photobook@captionblockcell@spacing{0pt}
|
|
|
|
|
\define@key{captionblockcell@args}{spacing}{%
|
|
|
|
|
\setlength\photobook@captionblockcell@spacing{#1}}
|
|
|
|
|
|
2021-09-02 02:05:32 +03:00
|
|
|
% width=<len>
|
2021-09-01 04:05:31 +03:00
|
|
|
\newlength\photobook@captionblockcell@width
|
|
|
|
|
\setlength\photobook@captionblockcell@width{0pt}
|
|
|
|
|
\define@key{captionblockcell@args}{width}{%
|
|
|
|
|
\setlength\photobook@captionblockcell@width{#1}}
|
|
|
|
|
|
2021-09-02 02:05:32 +03:00
|
|
|
% showbox
|
|
|
|
|
\define@boolkey{captionblockcell@args}{showbox}[true]{}
|
|
|
|
|
|
|
|
|
|
\newcommand\photobook@captionblockcell@content[1]{%
|
|
|
|
|
\begin{minipage}[t][\cellheight][\photobook@captionblockcell@valign]{\cellwidth}%
|
|
|
|
|
\begin{\photobook@captionblockcell@align}%
|
|
|
|
|
\ignorespaces%
|
|
|
|
|
#1%
|
|
|
|
|
\end{\photobook@captionblockcell@align}%
|
|
|
|
|
\end{minipage}}
|
|
|
|
|
|
|
|
|
|
% XXX revise how \clearance is handled...
|
2021-09-01 04:05:31 +03:00
|
|
|
% XXX do we need top/bottom boxes???
|
|
|
|
|
% ...if yes do we need lop/left, top/right, bottom/left and bottom/right???
|
|
|
|
|
% XXX should we keep within parent cell if imagecell has negative clearance???
|
|
|
|
|
% XXX need to auto-place within images via \offsetleft...
|
|
|
|
|
% XXX add tweak support...
|
2021-08-31 08:27:37 +03:00
|
|
|
\newcommand\captionblockcell[2][]{%
|
2021-09-01 04:05:31 +03:00
|
|
|
% XXX should this be within the group???
|
|
|
|
|
\setkeys{captionblockcell@args}{
|
|
|
|
|
left,
|
|
|
|
|
valign=b,
|
|
|
|
|
clearance=\clearcaption,
|
2021-09-03 16:32:03 +03:00
|
|
|
spacing=\captioncellspacing,
|
2021-09-01 04:05:31 +03:00
|
|
|
#1}%
|
|
|
|
|
%
|
|
|
|
|
\smash{\makebox[0pt][l]{%
|
|
|
|
|
\begingroup%
|
|
|
|
|
% setup cell context...
|
|
|
|
|
\setlength\clearcaption{\photobook@captionblockcell@clearance}%
|
|
|
|
|
\setlength\photobook@captionblockcell@tmplen{\cellwidth}%
|
|
|
|
|
\setlength\cellwidth{%
|
|
|
|
|
\ifnum \photobook@captionblockcell@width = 0%
|
|
|
|
|
\dimexpr
|
2021-09-03 16:32:03 +03:00
|
|
|
\cellparentwidth
|
|
|
|
|
- \photobook@captionblockcell@spacing
|
|
|
|
|
- \cellwidth
|
|
|
|
|
- \clearcaption
|
|
|
|
|
% XXX this is only present in images...
|
|
|
|
|
- \clearance \relax%
|
2021-09-01 04:05:31 +03:00
|
|
|
\else%
|
|
|
|
|
\photobook@captionblockcell@width\fi}%
|
|
|
|
|
\setlength\cellparentwidth{\photobook@captionblockcell@tmplen}%
|
|
|
|
|
\setlength\celloffsetleft{%
|
|
|
|
|
\ifKV@captionblockcell@args@left%
|
2021-09-03 16:32:03 +03:00
|
|
|
\dimexpr
|
|
|
|
|
- \cellwidth%
|
|
|
|
|
- \photobook@captionblockcell@spacing \relax%
|
2021-09-01 04:05:31 +03:00
|
|
|
\else%
|
2021-09-03 16:32:03 +03:00
|
|
|
\dimexpr
|
|
|
|
|
\cellparentwidth
|
|
|
|
|
+ \photobook@captionblockcell@spacing \relax%
|
|
|
|
|
\fi}%
|
2021-09-01 04:05:31 +03:00
|
|
|
%
|
|
|
|
|
\hspace{\celloffsetleft}{%
|
2021-09-02 02:05:32 +03:00
|
|
|
\ifKV@captionblockcell@args@showbox%
|
|
|
|
|
\fbox{%
|
|
|
|
|
\photobook@captionblockcell@content{#2}}%
|
|
|
|
|
\else%
|
|
|
|
|
\photobook@captionblockcell@content{#2}\fi}%
|
2021-09-01 04:05:31 +03:00
|
|
|
\endgroup}}%
|
|
|
|
|
\ignorespaces}
|
2021-08-28 01:43:57 +03:00
|
|
|
|
|
|
|
|
|
2021-08-16 06:34:22 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Paper cells
|
|
|
|
|
|
|
|
|
|
%% \DescribeEnv{papercell}
|
|
|
|
|
%
|
|
|
|
|
%% Paper cell.
|
|
|
|
|
%%
|
|
|
|
|
%% This does not include bleeds and is independent of |layoutmode|.
|
|
|
|
|
%%
|
|
|
|
|
\newenvironment{papercell}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{cell*}{\bleed, \bleed}{\blockwidth}{\blockheight}%
|
2021-08-16 06:34:22 +03:00
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{cell*}}
|
2021-08-16 06:34:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
%% \DescribeEnv{paperbleedcell}
|
|
|
|
|
%
|
|
|
|
|
%% Paper bleed cell.
|
|
|
|
|
%%
|
|
|
|
|
%% Like |papercell| but includes bleeds.
|
|
|
|
|
%%
|
|
|
|
|
\newenvironment{paperbleedcell}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{cell*}{0, 0}{\bleedblockwidth}{\bleedblockheight}%
|
2021-08-16 06:34:22 +03:00
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{cell*}}
|
2021-08-16 06:34:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Page cells
|
|
|
|
|
|
|
|
|
|
%% \DescribeEnv{pagecell}
|
2021-09-08 04:37:44 +03:00
|
|
|
%% \DescribeEnv{pagecell*}
|
2021-08-16 06:34:22 +03:00
|
|
|
%
|
|
|
|
|
%% Page cell.
|
|
|
|
|
%%
|
|
|
|
|
%% This corresponds to the visible page in the |layoutmode=block| and
|
|
|
|
|
%% does not include bleeds.
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-09-07 01:29:37 +03:00
|
|
|
%% <-> bleed <-> bleed
|
|
|
|
|
%%
|
|
|
|
|
%% + - - - - - - - - - + + bleed
|
|
|
|
|
%% . +---------------+ . v
|
|
|
|
|
%% . | | .
|
|
|
|
|
%% . | | .
|
|
|
|
|
%% . | pagecell | .
|
|
|
|
|
%% . | | .
|
|
|
|
|
%% . | | .
|
|
|
|
|
%% . +---------------+ . + bleed
|
|
|
|
|
%% + - - - - - - - - - + v
|
2021-08-16 06:34:22 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-09-08 04:37:44 +03:00
|
|
|
%% The star version accounts for |\bindingoffset|.
|
|
|
|
|
%%
|
2021-08-16 06:34:22 +03:00
|
|
|
%% Note that |layoutmode|'s other than block will change the paper size
|
|
|
|
|
%% but will not affect this.
|
|
|
|
|
%%
|
|
|
|
|
\newenvironment{pagecell}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{cell*}{\bleed,\bleed}{\pageblockwidth}{\pageblockheight}%
|
2021-08-16 06:34:22 +03:00
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{cell*}}
|
2021-08-16 06:34:22 +03:00
|
|
|
|
2021-09-08 04:37:44 +03:00
|
|
|
\newenvironment{pagecell*}{%
|
|
|
|
|
\begin{cell*}{%
|
|
|
|
|
\bleed + \ifnumodd{\thepage}{\bindingoffset}{0pt}%
|
|
|
|
|
,\bleed}%
|
|
|
|
|
{\pageblockwidth - \bindingoffset}%
|
|
|
|
|
{\pageblockheight}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{cell*}}
|
|
|
|
|
|
2021-08-16 06:34:22 +03:00
|
|
|
|
|
|
|
|
%% \DescribeEnv{pagebleedcell}
|
|
|
|
|
%
|
|
|
|
|
%% Like |page| but includes bleeds.
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-09-07 01:29:37 +03:00
|
|
|
%% <-> bleed <-> bleed
|
|
|
|
|
%%
|
|
|
|
|
%% +-------------------+ + bleed
|
|
|
|
|
%% | + - - - - - - - + | v
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% | . pagebleedcell . |
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% | . . |
|
|
|
|
|
%% | + - - - - - - - + | + bleed
|
|
|
|
|
%% +-------------------+ v
|
2021-08-16 06:34:22 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%% Note that |layoutmode|'s other than block will change the paper size
|
|
|
|
|
%% but will not affect this.
|
|
|
|
|
%%
|
|
|
|
|
\newenvironment{pagebleedcell}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{cell*}{0mm, 0mm}{\bleedblockwidth}{\bleedblockheight}%
|
2021-08-16 06:34:22 +03:00
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{cell*}}
|
2021-08-13 15:09:38 +03:00
|
|
|
|
|
|
|
|
|
2021-08-26 20:03:17 +03:00
|
|
|
|
2021-08-30 01:42:11 +03:00
|
|
|
% XXX EXPERIMENTAL / TEST...
|
2021-08-26 20:03:17 +03:00
|
|
|
\NewEnviron{shipoutbgcell}{%
|
|
|
|
|
\AddToShipoutPictureBG*{%
|
|
|
|
|
\begin{pagecell}%
|
|
|
|
|
\BODY%
|
2021-08-30 01:42:11 +03:00
|
|
|
\end{pagecell}}%
|
|
|
|
|
\ignorespaces}
|
2021-08-26 20:03:17 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-30 01:42:11 +03:00
|
|
|
% XXX EXPERIMENTAL / TEST...
|
2021-08-20 16:57:00 +03:00
|
|
|
%% \DescribeEnv{textcell}
|
2021-08-17 02:13:34 +03:00
|
|
|
%
|
2021-09-07 01:29:37 +03:00
|
|
|
%% \EXPERIMENTAL
|
|
|
|
|
%%
|
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}
|
|
|
|
|
%%
|
2021-09-07 01:29:37 +03:00
|
|
|
%% <-----------> \textwidth
|
|
|
|
|
%%
|
|
|
|
|
%% <-----------------> \pageblockwidth
|
|
|
|
|
%%
|
|
|
|
|
%% +-----------------+ ^ \pageblockheight
|
|
|
|
|
%% | | |
|
|
|
|
|
%% | +-----------+ | | ^ \textheight
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%% | | textcell | | | |
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%% | | | | | |
|
|
|
|
|
%% | +-----------+ | | v
|
|
|
|
|
%% | | |
|
|
|
|
|
%% +-----------------+ v
|
2021-08-17 02:13:34 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
|
|
|
|
%% Note that this is an inline cell and if something is on the page it
|
|
|
|
|
%% may not be centered properly.
|
|
|
|
|
%%
|
|
|
|
|
\newenvironment{textcell}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{inlinecell*}{\textwidth}{\textheight}%
|
2021-08-17 02:13:34 +03:00
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{inlinecell*}}
|
2021-08-17 02:13:34 +03:00
|
|
|
|
|
|
|
|
|
2021-08-30 22:59:21 +03:00
|
|
|
%% \DescribeEnv{spreadtopages}
|
|
|
|
|
%% \DescribeEnv{spreadtopages*}
|
|
|
|
|
%% \DescribeMacro{\usespreadpage\{..\}}
|
|
|
|
|
%% \DescribeMacro{\usespreadpage*\{..\}}
|
2021-08-27 20:12:06 +03:00
|
|
|
%
|
|
|
|
|
%% Spread cell into pages.
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% +----------------------------------- -
|
|
|
|
|
%% | <-- input cell
|
|
|
|
|
%% | . . .
|
|
|
|
|
%% | Oversized content cell...
|
|
|
|
|
%% | . . .
|
|
|
|
|
%% |
|
|
|
|
|
%% +----------.----------.----------.-- -
|
|
|
|
|
%% . . . . . . .
|
|
|
|
|
%% . . . . . . .
|
|
|
|
|
%% +----------+ +----------+ +----------+ +-- -
|
|
|
|
|
%% | | | | | | | <-- output pages
|
|
|
|
|
%% | | | | | | |
|
|
|
|
|
%% | Overs| |ized conte| |nt cell...| |
|
|
|
|
|
%% | | | | | | |
|
|
|
|
|
%% | | | | | | |
|
|
|
|
|
%% +----------+ +----------+ +----------+ +-- -
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-30 22:59:21 +03:00
|
|
|
%% |spreadtopages| creates a cell and spreads it into pages right away.
|
|
|
|
|
%%
|
|
|
|
|
%% >> \begin{spreadtopages} .. \end{spreadtopages}
|
|
|
|
|
%% >> \begin{spreadtopages}[<page-count>] .. \end{spreadtopages}
|
|
|
|
|
%%
|
|
|
|
|
%% |spreadtopages*| creates a named save cell.
|
|
|
|
|
%%
|
|
|
|
|
%% >> \begin{spreadtopages*}{<name>} .. \end{spreadtopages*}
|
|
|
|
|
%% >> \begin{spreadtopages*}[<page-count>]{<name>} .. \end{spreadtopages*}
|
|
|
|
|
%%
|
|
|
|
|
%% |\usespreadpage{..}| places a page from a saved cell.
|
|
|
|
|
%%
|
|
|
|
|
%% >> \usespreadpage{<name>}
|
|
|
|
|
%% >> \usespreadpage[<page-num>]{<name>}
|
|
|
|
|
%%
|
|
|
|
|
%% |\usespreadpage*{..}| is the same as the non-star version but will
|
|
|
|
|
%% not use a |page| environment, enabling the user to populate the page
|
|
|
|
|
%% with other elements.
|
|
|
|
|
%%
|
|
|
|
|
%% Page numbers a re 1-based.
|
|
|
|
|
%%
|
|
|
|
|
%% Note that the cell created by |spreadtopages*| env is a normal save
|
|
|
|
|
%% cell and can be manipulated via |\usecell{..}| and |\usecell*{..}|.
|
|
|
|
|
%%
|
2021-08-27 20:12:06 +03:00
|
|
|
% XXX add nudge/grow support...
|
2021-08-30 18:55:11 +03:00
|
|
|
|
|
|
|
|
\NewEnviron{spreadtopages*}[2][2]{%
|
2021-08-30 19:00:40 +03:00
|
|
|
% setup page count...
|
|
|
|
|
\@ifundefined{thespreadtopages#2page}{%
|
|
|
|
|
\newcounter{spreadtopages#2page}}{}
|
2021-08-30 18:55:11 +03:00
|
|
|
\setcounter{spreadtopages#2page}{1}
|
2021-08-30 19:00:40 +03:00
|
|
|
%
|
2021-08-30 18:55:11 +03:00
|
|
|
\begingroup%
|
|
|
|
|
% create the actual cell...
|
|
|
|
|
\setlength\cellparentwidth{\cellwidth}%
|
|
|
|
|
\setlength\cellparentheight{\cellheight}%
|
|
|
|
|
\setlength\cellwidth{#1\pageblockwidth}%
|
|
|
|
|
\setlength\cellheight{\pageblockheight}%
|
|
|
|
|
%
|
|
|
|
|
\gsavecell{#2}{\cellwidth}{\cellheight}{\BODY}%
|
|
|
|
|
\endgroup%
|
|
|
|
|
\ignorespaces}
|
|
|
|
|
|
2021-08-30 22:59:21 +03:00
|
|
|
% NOTE: this essentially counts pages, \usecell{..} / \usecell*{..} are
|
|
|
|
|
% better suited for custom stuff...
|
|
|
|
|
% NOTE: page is a 1 based offset in pages and can be fractional...
|
2021-08-31 02:43:22 +03:00
|
|
|
% NOTE: \usecell*{..} takes care of all the bleed calculations...
|
2021-08-30 22:59:21 +03:00
|
|
|
\def\usespreadpage{\@ifstar{%
|
|
|
|
|
\photobook@usespreadpage@star%
|
|
|
|
|
}{%
|
|
|
|
|
\photobook@usespreadpage}}
|
|
|
|
|
\newcommand\photobook@usespreadpage@star[2][]{%
|
2021-08-30 18:55:11 +03:00
|
|
|
\begin{pagecell}%
|
|
|
|
|
% auto advance pages...
|
|
|
|
|
\ifthenelse{\equal{#1}{}}{%
|
|
|
|
|
\usecell*{#2}%
|
|
|
|
|
(0pt, \numexpr \value{spreadtopages#2page} - 1 \relax\cellwidth)%
|
|
|
|
|
{\cellwidth}{\cellheight}%
|
|
|
|
|
\stepcounter{spreadtopages#2page}%
|
|
|
|
|
% manual page selected...
|
|
|
|
|
}{%
|
|
|
|
|
\usecell*{#2}%
|
|
|
|
|
(0pt, \numexpr #1 - 1 \relax\cellwidth)%
|
|
|
|
|
{\cellwidth}{\cellheight}}%
|
2021-08-30 22:59:21 +03:00
|
|
|
\end{pagecell}}
|
|
|
|
|
\newcommand\photobook@usespreadpage[2][]{%
|
|
|
|
|
\begin{page}%
|
|
|
|
|
\usespreadpage*[#1]{#2}%
|
2021-08-30 18:55:11 +03:00
|
|
|
\end{page}}
|
|
|
|
|
|
2021-08-27 20:12:06 +03:00
|
|
|
\NewEnviron{spreadtopages}[1][2]{%
|
|
|
|
|
\begingroup%
|
|
|
|
|
% create the actual cell...
|
|
|
|
|
\setlength\cellparentwidth{\cellwidth}%
|
|
|
|
|
\setlength\cellparentheight{\cellheight}%
|
|
|
|
|
\setlength\cellwidth{#1\pageblockwidth}%
|
|
|
|
|
\setlength\cellheight{\pageblockheight}%
|
|
|
|
|
%
|
|
|
|
|
\savecell{photobook@spreadtopages}{\cellwidth}{\cellheight}{\BODY}%
|
2021-08-30 22:59:21 +03:00
|
|
|
%
|
|
|
|
|
% place the pages...
|
2021-08-30 18:55:11 +03:00
|
|
|
\foreach \photobook@spreadtopages@page in {1, ..., #1}{%
|
|
|
|
|
\usespreadpage[\photobook@spreadtopages@page]{photobook@spreadtopages}}%
|
2021-08-30 01:42:11 +03:00
|
|
|
\endgroup%
|
|
|
|
|
\ignorespaces}
|
2021-08-27 20:12:06 +03:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2021-08-30 01:42:11 +03:00
|
|
|
% XXX for some reason naming these anything starting with endpaper will
|
|
|
|
|
% make LaTeX complain that that is already defined...
|
|
|
|
|
% ...collision with bools???
|
2021-08-29 03:01:01 +03:00
|
|
|
\newenvironment{leftside}{%
|
|
|
|
|
\begin{pagecell}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{pagecell}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
2021-08-29 03:01:01 +03:00
|
|
|
\newenvironment{rightside}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{cell*}%
|
2021-08-29 03:01:01 +03:00
|
|
|
{\bleed + \pageblockwidth, \bleed}%
|
|
|
|
|
{\pageblockwidth}{\pageblockheight}%
|
|
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{cell*}}
|
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-29 03:01:01 +03:00
|
|
|
\newenvironment{frontcover}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{cell*}{
|
2021-08-29 03:01:01 +03:00
|
|
|
\bleed
|
|
|
|
|
+ \jacketflapback
|
|
|
|
|
+ \coverflap
|
|
|
|
|
+ \jacketwrap
|
|
|
|
|
+ \coverboardgrow
|
|
|
|
|
+ \pageblockwidth
|
|
|
|
|
+ 2\spinefold
|
|
|
|
|
+ \spinewidth,
|
|
|
|
|
\bleed
|
|
|
|
|
+ \coverflap }%
|
|
|
|
|
{ \pageblockwidth + \coverboardgrow }%
|
|
|
|
|
{ \pageblockheight + 2\coverboardgrow }%
|
|
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{cell*}}
|
2021-08-29 03:01:01 +03:00
|
|
|
|
|
|
|
|
\newenvironment{backcover}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{cell*}{
|
2021-08-29 03:01:01 +03:00
|
|
|
\bleed
|
|
|
|
|
+ \jacketflapback
|
|
|
|
|
+ \coverflap
|
|
|
|
|
+ \jacketwrap,
|
|
|
|
|
\bleed
|
|
|
|
|
+ \coverflap }%
|
|
|
|
|
{ \pageblockwidth + \coverboardgrow }%
|
|
|
|
|
{ \pageblockheight + 2\coverboardgrow }%
|
|
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{cell*}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
% spines...
|
|
|
|
|
%
|
2021-08-29 03:01:01 +03:00
|
|
|
\newenvironment{spine}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{cell*}{
|
2021-08-29 03:01:01 +03:00
|
|
|
\bleed
|
|
|
|
|
+ \jacketflapback
|
|
|
|
|
+ \coverflap
|
|
|
|
|
+ \jacketwrap
|
|
|
|
|
+ \coverboardgrow
|
|
|
|
|
+ \pageblockwidth
|
|
|
|
|
+ \spinefold,
|
|
|
|
|
\bleed
|
|
|
|
|
+ \coverflap }%
|
|
|
|
|
{ \spinewidth }%
|
|
|
|
|
{ \pageblockheight + 2\coverboardgrow }%
|
|
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{cell*}}
|
2021-08-29 03:01:01 +03:00
|
|
|
|
|
|
|
|
\newenvironment{vspine}[1][topdown]{%
|
|
|
|
|
\def\photobook@vspine@orientation{#1}%
|
|
|
|
|
%
|
|
|
|
|
\begin{spine}%
|
|
|
|
|
\begin{\photobook@vspine@orientation}%
|
|
|
|
|
}{%
|
|
|
|
|
\end{\photobook@vspine@orientation}%
|
|
|
|
|
\end{spine}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
% jackets flaps...
|
|
|
|
|
%
|
2021-08-29 03:01:01 +03:00
|
|
|
\newenvironment{frontflap}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{cell*}{
|
2021-08-29 03:01:01 +03:00
|
|
|
\bleed
|
|
|
|
|
+ \jacketflapback
|
|
|
|
|
+ 2\jacketwrap
|
|
|
|
|
+ 2\coverboardgrow
|
|
|
|
|
+ 2\pageblockwidth
|
|
|
|
|
+ 2\spinefold
|
|
|
|
|
+ \spinewidth,
|
|
|
|
|
\bleed
|
|
|
|
|
+ \coverflap }%
|
|
|
|
|
{ \jacketflapfront }%
|
|
|
|
|
{ \pageblockheight + 2\coverboardgrow }%
|
|
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{cell*}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
2021-08-29 03:01:01 +03:00
|
|
|
\newenvironment{backflap}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\begin{cell*}{
|
2021-08-29 03:01:01 +03:00
|
|
|
\bleed,
|
|
|
|
|
\bleed
|
|
|
|
|
+ \coverflap }%
|
|
|
|
|
{ \jacketflapback }%
|
|
|
|
|
{ \pageblockheight + 2\coverboardgrow }%
|
|
|
|
|
}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
\end{cell*}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
2021-08-27 19:04:05 +03:00
|
|
|
%%%% Caption Templates
|
2021-08-08 01:54:37 +03:00
|
|
|
% XXX need to be able to configure/pass/override:
|
|
|
|
|
% - size / \captionsize...
|
|
|
|
|
% - color...
|
|
|
|
|
% XXX captions seem not to account for \imageblockoffsettop...
|
|
|
|
|
|
2021-08-30 01:42:11 +03:00
|
|
|
%% \DescribeMacro{\captionsize\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% Defines the caption font setup macro
|
|
|
|
|
%%
|
|
|
|
|
\ResettableMacro{captionsize}{%
|
2021-08-28 13:28:15 +03:00
|
|
|
\fontsize{6.5pt}{8pt}\selectfont}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
2021-08-31 16:25:50 +03:00
|
|
|
%% \DescribeMacro{\captionformat\{..\}}
|
2021-08-30 01:42:11 +03:00
|
|
|
%
|
|
|
|
|
%%
|
|
|
|
|
%%
|
2021-08-27 19:45:04 +03:00
|
|
|
% XXX move to a better location... (???)
|
2021-08-30 01:42:11 +03:00
|
|
|
\ResettableMacro{captionformat}[1]{%
|
2021-08-27 19:45:04 +03:00
|
|
|
\adjustbox{margin=0.1em 0.2em}{%
|
|
|
|
|
\captionsize #1}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-31 08:27:37 +03:00
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%%%% Page Templates
|
2021-08-31 16:25:50 +03:00
|
|
|
%
|
|
|
|
|
%% This section contains a set of predefined configurable single-page
|
|
|
|
|
%% templates.
|
|
|
|
|
%%
|
2021-08-31 08:27:37 +03:00
|
|
|
|
2021-09-10 15:54:38 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Generic
|
|
|
|
|
|
2021-08-31 16:25:50 +03:00
|
|
|
%%%%% Tweaking
|
|
|
|
|
%
|
|
|
|
|
%% Most page/spread templates provide an ability to externally "tweak"
|
|
|
|
|
%% some image proportions.
|
|
|
|
|
%%
|
|
|
|
|
%% This is an alternative means to setting template properties, e.g:
|
|
|
|
|
%
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%% \tweakimagescale{0.8}
|
|
|
|
|
%% \ImagePage{image}
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%
|
|
|
|
|
%% Is equivalent to:
|
|
|
|
|
%
|
|
|
|
|
%% >> \ImagePage[scale=0.8]{image}
|
|
|
|
|
%
|
|
|
|
|
%% Tweaks get reset after each template.
|
|
|
|
|
%%
|
|
|
|
|
|
2021-08-31 08:27:37 +03:00
|
|
|
|
|
|
|
|
%% \DescribeMacro{\imagescale=<num>}
|
|
|
|
|
%% \DescribeMacro{\imageoffsettop=<len>}
|
|
|
|
|
%% \DescribeMacro{\imageoffsetleft=<len>}
|
2021-08-27 19:45:04 +03:00
|
|
|
%
|
2021-08-31 08:27:37 +03:00
|
|
|
%% Tweak next image templates scale/offsettop/offsetleft
|
2021-08-08 01:54:37 +03:00
|
|
|
%%
|
2021-08-31 16:25:50 +03:00
|
|
|
%% Note that |\imagescale| is not a length.
|
|
|
|
|
%
|
|
|
|
|
%% >> \edef\imagescale{<scale>}
|
|
|
|
|
%% >> \setlength\imageoffsettop{<len>}
|
|
|
|
|
%% >> \setlength\imageoffsetleft{<len>}
|
|
|
|
|
%%
|
2021-08-31 08:27:37 +03:00
|
|
|
\edef\imagescale{1}
|
2021-08-31 16:25:50 +03:00
|
|
|
% NOTE: these are initialized later by \resetimagetweaks...
|
2021-08-31 08:27:37 +03:00
|
|
|
\newlength\imageoffsettop
|
|
|
|
|
\newlength\imageoffsetleft
|
2021-08-08 01:54:37 +03:00
|
|
|
|
2021-08-31 08:27:37 +03:00
|
|
|
%% \DescribeMacro{\tweakimagescale\{..\}}
|
2021-09-03 05:18:18 +03:00
|
|
|
%% \DescribeMacro{\tweakimageoffsettop\{..\}}
|
2021-08-31 08:27:37 +03:00
|
|
|
%% \DescribeMacro{\tweakimageoffsetleft\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% Convenience commands
|
|
|
|
|
%%
|
2021-08-31 16:25:50 +03:00
|
|
|
%% These provide a uniform interface for tweaking.
|
|
|
|
|
%
|
|
|
|
|
%% >> \tweakimagescale{<scale>}
|
|
|
|
|
%% >> \tweakimageoffsettop{<len>}
|
|
|
|
|
%% >> \tweakimageoffsetleft{<len>}
|
|
|
|
|
%%
|
2021-08-31 08:27:37 +03:00
|
|
|
\newcommand\tweakimagescale[1]{%
|
|
|
|
|
\edef\imagescale{#1}}
|
2021-09-03 05:18:18 +03:00
|
|
|
|
2021-08-31 08:27:37 +03:00
|
|
|
\newcommand\tweakimageoffsettop[1]{%
|
|
|
|
|
\setlength\imageoffsettop{#1}}
|
2021-09-03 05:18:18 +03:00
|
|
|
|
2021-08-31 08:27:37 +03:00
|
|
|
\newcommand\tweakimageoffsetleft[1]{%
|
|
|
|
|
\setlength\imageoffsetleft{#1}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
2021-09-03 05:18:18 +03:00
|
|
|
|
2021-08-31 08:27:37 +03:00
|
|
|
%% \DescribeMacro{\resetimagetweaks\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% Reset tweaked values.
|
|
|
|
|
%%
|
|
|
|
|
\newcommand\resetimagetweaks{%
|
|
|
|
|
\edef\imagescale{1}%
|
|
|
|
|
\setlength\imageoffsettop{0pt}%
|
|
|
|
|
\setlength\imageoffsetleft{0pt}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
2021-08-31 08:27:37 +03:00
|
|
|
% setup initial state...
|
|
|
|
|
\resetimagetweaks
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
2021-08-29 17:05:28 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
% meta-commands...
|
|
|
|
|
|
2021-09-03 03:28:04 +03:00
|
|
|
%M \DescribeMacro{\ImagePageTemplate\{..\}}
|
2021-08-29 17:05:28 +03:00
|
|
|
%
|
2021-09-03 03:28:04 +03:00
|
|
|
%M >> \ImagePageTemplate{<name>}{<code>}
|
2021-08-29 17:05:28 +03:00
|
|
|
%
|
2021-09-03 03:28:04 +03:00
|
|
|
%M This will define two commands:
|
2021-08-29 17:05:28 +03:00
|
|
|
%
|
2021-09-03 03:28:04 +03:00
|
|
|
%M >> \<name>[<options>]{<caption>}{<code>}
|
|
|
|
|
%M >> \<name>*[<options>]{<caption>}{<code>}
|
2021-08-29 17:05:28 +03:00
|
|
|
%
|
2021-09-03 03:28:04 +03:00
|
|
|
%M |\<name>{..}| will use |\<name>Caption{..}| template command to typeset
|
|
|
|
|
%M the image caption while |\<name>*{..}| will show the caption as-is.
|
|
|
|
|
%M
|
2021-08-29 17:05:28 +03:00
|
|
|
\def\ImagePageTemplate#1#2{%
|
|
|
|
|
% handle <macro>* version...
|
|
|
|
|
\expandafter\def\csname #1\endcsname{\@ifstar{%
|
2021-08-31 08:27:37 +03:00
|
|
|
\csname photobook@ImagePageTemplate@#1@star\endcsname%
|
2021-08-29 17:05:28 +03:00
|
|
|
}{%
|
2021-08-31 08:27:37 +03:00
|
|
|
\csname photobook@ImagePageTemplate@#1\endcsname}}%
|
2021-08-29 17:05:28 +03:00
|
|
|
% main implementation (raw caption)...
|
2021-08-31 08:27:37 +03:00
|
|
|
\expandafter\newcommand\csname photobook@ImagePageTemplate@#1@star\endcsname[3][]{%
|
|
|
|
|
#2%
|
|
|
|
|
\resetimagetweaks}%
|
2021-08-29 17:05:28 +03:00
|
|
|
% main implementation with caption template...
|
2021-08-31 08:27:37 +03:00
|
|
|
\expandafter\newcommand\csname photobook@ImagePageTemplate@#1\endcsname[3][]{%
|
|
|
|
|
\csname photobook@ImagePageTemplate@#1@star\endcsname[##1]{%
|
2021-08-31 03:25:11 +03:00
|
|
|
\@ifundefined{#1Caption}{%
|
2021-08-29 17:05:28 +03:00
|
|
|
##2%
|
|
|
|
|
}{%
|
2021-08-31 03:25:11 +03:00
|
|
|
\csname #1Caption\endcsname{##2}}}{##3}}}
|
2021-08-29 17:05:28 +03:00
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
|
2021-08-31 16:25:50 +03:00
|
|
|
\newsavebox\photobook@imagebox
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2021-09-03 05:18:18 +03:00
|
|
|
%%%%% General interface
|
2021-08-31 16:25:50 +03:00
|
|
|
%
|
|
|
|
|
%% A templates provide a uniform interface consisting of several commands:
|
|
|
|
|
%%
|
|
|
|
|
%% Base template command:
|
|
|
|
|
%
|
|
|
|
|
%% >> \<template-name>{<caption>}{<image>}
|
|
|
|
|
%% >> \<template-name>[<options>]{<caption>}{<image>}
|
|
|
|
|
%
|
|
|
|
|
%% |<options>| is the same as for |\imagecell{..}|.
|
|
|
|
|
%%
|
|
|
|
|
%% Template-specific caption command:
|
|
|
|
|
%
|
|
|
|
|
%% >> \<template-name>Caption{<caption>}
|
|
|
|
|
%
|
|
|
|
|
%% This can be redefined to control typesetting the caption for all
|
|
|
|
|
%% consecutive templates.
|
|
|
|
|
%%
|
|
|
|
|
%% Reset template caption to default:
|
|
|
|
|
%
|
|
|
|
|
%% >> \reset<template-name>Caption
|
|
|
|
|
%
|
|
|
|
|
%% An equivalent to the non-star version but use the caption as-is:
|
|
|
|
|
%
|
|
|
|
|
%% >> \<template-name>*{<caption>}{<image>}
|
|
|
|
|
%% >> \<template-name>*[<options>]{<caption>}{<image>}
|
|
|
|
|
%
|
|
|
|
|
%% Note that thogh some template versions differ only in |<options>|
|
|
|
|
|
%% defaults passed to |\imagecell{..}|, they are split to provide ability
|
|
|
|
|
%% to configure the template defaults separately.
|
|
|
|
|
%%
|
|
|
|
|
|
2021-09-04 05:18:06 +03:00
|
|
|
|
2021-09-03 05:18:18 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% No bleed
|
|
|
|
|
|
2021-08-31 03:25:11 +03:00
|
|
|
%% \DescribeMacro{\ImagePage\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImagePageCaption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImagePageCaption}
|
|
|
|
|
%% \DescribeMacro{\ImagePage*\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% Basic image page
|
2021-08-29 07:03:36 +03:00
|
|
|
%%
|
2021-08-08 12:16:50 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-27 19:04:05 +03:00
|
|
|
%% +-----------------+
|
|
|
|
|
%% | |
|
|
|
|
|
%% | +-------------+ |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | image | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | | . . | |
|
|
|
|
|
%% | +-------------+ |
|
|
|
|
|
%% | c |
|
|
|
|
|
%% | |
|
|
|
|
|
%% +-----------------+
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-08-29 07:03:36 +03:00
|
|
|
%% Create an image page:
|
2021-08-31 16:25:50 +03:00
|
|
|
%%
|
|
|
|
|
%% Note that |\ImagePage{..}| only supports tweaking |scale|, this is
|
|
|
|
|
%% intentional ad tweaking offset will mess up page alignment relative
|
|
|
|
|
%% to other pages in a book.
|
2021-08-29 07:03:36 +03:00
|
|
|
%%
|
2021-08-31 03:25:11 +03:00
|
|
|
\ResettableMacro{ImagePageCaption}[1]{%
|
2021-08-29 07:03:36 +03:00
|
|
|
\captioncell[under, align=flushright]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
|
2021-08-31 03:25:11 +03:00
|
|
|
\ImagePageTemplate{ImagePage}{%
|
2021-09-08 04:37:44 +03:00
|
|
|
\clearpage%
|
2021-08-20 16:57:00 +03:00
|
|
|
\begin{page}%
|
2021-09-08 04:37:44 +03:00
|
|
|
\begin{pagecell*}%
|
2021-08-29 07:03:36 +03:00
|
|
|
\begin{minipage}[t][\cellheight][c]{\cellwidth}%
|
|
|
|
|
\vspace{\imageblockoffsettop\pagetextheight}%
|
|
|
|
|
\begin{center}%
|
2021-09-08 04:37:44 +03:00
|
|
|
\begin{inlinecell*}%
|
|
|
|
|
{\imageblockwidth\pagetextwidth}%
|
|
|
|
|
{\imageblockheight\pagetextheight}%
|
|
|
|
|
\imagecell[fit,
|
|
|
|
|
scale=\imagescale,
|
|
|
|
|
#1]{#2}{#3}%
|
|
|
|
|
\end{inlinecell*}%
|
2021-08-29 07:03:36 +03:00
|
|
|
\end{center}%
|
|
|
|
|
\end{minipage}%
|
2021-09-08 04:37:44 +03:00
|
|
|
\end{pagecell*}%
|
2021-08-20 16:57:00 +03:00
|
|
|
\end{page}}
|
|
|
|
|
|
|
|
|
|
|
2021-09-04 05:18:06 +03:00
|
|
|
%% \DescribeMacro{\ImagePageClear\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImagePageClearCaption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImagePageClearCaption}
|
|
|
|
|
%% \DescribeMacro{\ImagePageClear*\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% >> \ImagePageClear[<options>]{<caption>}{<image>}
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% \clearimage \clearimage
|
|
|
|
|
%% v v
|
|
|
|
|
%% +-----------------+ +-----------------+ < \clearimage
|
|
|
|
|
%% | | | +-----------+ |
|
|
|
|
|
%% |+---------------+| | | . . | |
|
|
|
|
|
%% || . . || | | . . | |
|
|
|
|
|
%% || . . || | | . . | |
|
|
|
|
|
%% || image || | | image | |
|
|
|
|
|
%% || . . || | | . . | |
|
|
|
|
|
%% || . . || | | . . | |
|
|
|
|
|
%% |+---------------+| | | . . | |
|
|
|
|
|
%% | c | | +-----------+ |
|
|
|
|
|
%% +-----------------+ +-----------------+ < \clearimage
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-09-06 19:59:50 +03:00
|
|
|
%% Default image clearance is set by |\clearimage| global length.
|
2021-09-04 05:18:06 +03:00
|
|
|
%%
|
2021-09-08 04:37:44 +03:00
|
|
|
%% This respects |\bindingoffset|.
|
|
|
|
|
%%
|
2021-09-04 05:18:06 +03:00
|
|
|
% XXX make captions adaptive???
|
|
|
|
|
\ResettableMacro{ImagePageClearCaption}[1]{%
|
|
|
|
|
\captioncell[under, align=flushright]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
|
|
|
|
|
\ImagePageTemplate{ImagePageClear}{%
|
2021-09-08 04:37:44 +03:00
|
|
|
\clearpage%
|
2021-09-04 05:18:06 +03:00
|
|
|
\begin{page}%
|
2021-09-12 03:29:50 +03:00
|
|
|
% NOTE: this accounts for \bindingoffset...
|
2021-09-08 04:37:44 +03:00
|
|
|
\begin{pagecell*}%
|
2021-09-04 05:18:06 +03:00
|
|
|
\imagecell[%
|
|
|
|
|
center,
|
|
|
|
|
clearance=\clearimage,
|
|
|
|
|
scale=\imagescale,
|
|
|
|
|
offsettop=\imageoffsettop,
|
|
|
|
|
offsetleft=\imageoffsetleft,
|
|
|
|
|
#1]{#2}{#3}%
|
2021-09-08 04:37:44 +03:00
|
|
|
\end{pagecell*}%
|
2021-09-04 05:18:06 +03:00
|
|
|
\end{page}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%% \DescribeMacro{\ImagePageClear<D>\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImagePageClear<D>Caption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImagePageClear<D>Caption}
|
|
|
|
|
%% \DescribeMacro{\ImagePageClear<D>*\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% |<D>| can be one of T, B, L or R, for top, bottom, left and right
|
|
|
|
|
%% respectively.
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% +-----------------+ +-----------------+
|
2021-09-05 02:35:57 +03:00
|
|
|
%% | +-------------+ | | |
|
|
|
|
|
%% | | . . | | | c |
|
|
|
|
|
%% | | . . | | | +-------------+ |
|
|
|
|
|
%% | | image | | | | . . | |
|
|
|
|
|
%% | | . (T) . | | | | . . | |
|
|
|
|
|
%% | | . . | | | | image | |
|
|
|
|
|
%% | +-------------+ | | | . (B) . | |
|
|
|
|
|
%% | c | | | . . | |
|
|
|
|
|
%% | | | +-------------+ |
|
2021-09-04 05:18:06 +03:00
|
|
|
%% +-----------------+ +-----------------+
|
|
|
|
|
%%
|
|
|
|
|
%% +-----------------+ +-----------------+
|
2021-09-05 02:35:57 +03:00
|
|
|
%% | +---------+ | | +---------+ |
|
|
|
|
|
%% | |. .| | | |. .| |
|
|
|
|
|
%% | | . . | | | | . . | |
|
|
|
|
|
%% | | . . | | | | . . | |
|
|
|
|
|
%% | | image | | | | image | |
|
|
|
|
|
%% | | .(L). | | | | .(R). | |
|
|
|
|
|
%% | | . . | | | | . . | |
|
|
|
|
|
%% | |. .| | | |. .| |
|
|
|
|
|
%% | +---------+ c | | c +---------+ |
|
2021-09-04 05:18:06 +03:00
|
|
|
%% +-----------------+ +-----------------+
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-09-08 04:37:44 +03:00
|
|
|
% XXX TEST...
|
2021-09-04 05:18:06 +03:00
|
|
|
\ResettableMacro{ImagePageClearTCaption}[1]{%
|
2021-09-08 04:37:44 +03:00
|
|
|
\captioncell[under]{%
|
2021-09-04 05:18:06 +03:00
|
|
|
\captionformat{#1}}}
|
2021-09-08 04:37:44 +03:00
|
|
|
% XXX the image seems to be a line too low...
|
2021-09-04 05:18:06 +03:00
|
|
|
\ImagePageTemplate{ImagePageClearT}{%
|
|
|
|
|
\ImagePageClear*[%
|
|
|
|
|
top,
|
|
|
|
|
#1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
\ResettableMacro{ImagePageClearBCaption}[1]{%
|
2021-09-08 04:37:44 +03:00
|
|
|
\captioncell[over]{%
|
2021-09-04 05:18:06 +03:00
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImagePageClearB}{%
|
|
|
|
|
\ImagePageClear*[%
|
|
|
|
|
bottom,
|
|
|
|
|
#1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
\ResettableMacro{ImagePageClearLCaption}[1]{%
|
|
|
|
|
\captionblockcell[right]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImagePageClearL}{%
|
|
|
|
|
\ImagePageClear*[%
|
|
|
|
|
left,
|
|
|
|
|
#1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
\ResettableMacro{ImagePageClearRCaption}[1]{%
|
|
|
|
|
\captionblockcell[left]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImagePageClearR}{%
|
|
|
|
|
\ImagePageClear*[%
|
|
|
|
|
right,
|
|
|
|
|
#1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-03 05:18:18 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Partial bleed
|
|
|
|
|
|
2021-08-31 03:25:11 +03:00
|
|
|
%% \DescribeMacro{\ImagePageFit\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImagePageFitCaption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImagePageFitCaption}
|
|
|
|
|
%% \DescribeMacro{\ImagePageFit*\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-31 16:25:50 +03:00
|
|
|
%% Fit image into page...
|
2021-08-08 12:16:50 +03:00
|
|
|
%
|
2021-08-31 03:25:11 +03:00
|
|
|
%% >> \ImagePageFit[<options>]{<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-29 17:05:28 +03:00
|
|
|
%% . . . . . . .
|
|
|
|
|
%% +-----------------+ +-----------------+
|
|
|
|
|
%% | | | |. .| |
|
|
|
|
|
%% . +-----------------+ . | | . . | |
|
|
|
|
|
%% . | . . | . | | . . | |
|
|
|
|
|
%% . | . . | . | | . . | |
|
|
|
|
|
%% . | image | . | | image | |
|
|
|
|
|
%% . | . . | . | | . . | |
|
|
|
|
|
%% . | . . | . | | . . | |
|
|
|
|
|
%% . +-----------------+ . | | . . | |
|
|
|
|
|
%% | c | | |. c.| |
|
|
|
|
|
%% +-----------------+ +-----------------+
|
|
|
|
|
%% . . . . . . .
|
2021-08-08 12:16:50 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-09-06 19:59:50 +03:00
|
|
|
%% Default image clearance is set by |\bleed| global length.
|
2021-08-30 01:42:11 +03:00
|
|
|
%%
|
2021-09-08 04:37:44 +03:00
|
|
|
%% If centered image fits vertically this will account for |\bindingoffset|.
|
|
|
|
|
%%
|
2021-08-29 17:05:28 +03:00
|
|
|
% XXX make captions adaptive???
|
2021-08-31 03:25:11 +03:00
|
|
|
\ResettableMacro{ImagePageFitCaption}[1]{%
|
2021-08-29 07:03:36 +03:00
|
|
|
\captioncell[under, align=flushright]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
|
2021-09-08 04:37:44 +03:00
|
|
|
\newif\ifphotobook@ImagePageFit@centered
|
|
|
|
|
\photobook@ImagePageFit@centeredfalse
|
2021-08-13 15:09:38 +03:00
|
|
|
|
2021-09-08 04:37:44 +03:00
|
|
|
\newlength\photobook@ImagePageFit@imgratio
|
|
|
|
|
\newlength\photobook@ImagePageFit@cellratio
|
|
|
|
|
\def\photobook@ImagePageFit@opt{}
|
|
|
|
|
\def\photobook@ImagePageFit@args{}
|
2021-08-14 03:02:59 +03:00
|
|
|
|
2021-09-08 04:37:44 +03:00
|
|
|
\ImagePageTemplate{ImagePageFit}{%
|
|
|
|
|
\begingroup%
|
|
|
|
|
% see if default alignment is overridden...
|
|
|
|
|
\ignoreemptyitems%
|
|
|
|
|
\readlist*\photobook@ImagePageFit@args{moo, #1}%
|
|
|
|
|
\foreachitem\photobook@ImagePageFit@opt\in\photobook@ImagePageFit@args{%
|
2021-09-08 18:52:23 +03:00
|
|
|
\ifthenelse{\equal{\photobook@ImagePageFit@opt}{inner}}{%
|
|
|
|
|
\photobook@ImagePageFit@centeredtrue}{}%
|
|
|
|
|
\ifthenelse{\equal{\photobook@ImagePageFit@opt}{outer}}{%
|
|
|
|
|
\photobook@ImagePageFit@centeredtrue}{}%
|
2021-09-08 04:37:44 +03:00
|
|
|
\ifthenelse{\equal{\photobook@ImagePageFit@opt}{top}}{%
|
2021-09-08 18:52:23 +03:00
|
|
|
\photobook@ImagePageFit@centeredtrue}{}%
|
2021-09-08 04:37:44 +03:00
|
|
|
\ifthenelse{\equal{\photobook@ImagePageFit@opt}{left}}{%
|
2021-09-08 18:52:23 +03:00
|
|
|
\photobook@ImagePageFit@centeredtrue}{}%
|
2021-09-08 04:37:44 +03:00
|
|
|
\ifthenelse{\equal{\photobook@ImagePageFit@opt}{bottom}}{%
|
2021-09-08 18:52:23 +03:00
|
|
|
\photobook@ImagePageFit@centeredtrue}{}%
|
2021-09-08 04:37:44 +03:00
|
|
|
\ifthenelse{\equal{\photobook@ImagePageFit@opt}{right}}{%
|
2021-09-08 18:52:23 +03:00
|
|
|
\photobook@ImagePageFit@centeredtrue}{}}%
|
2021-09-08 04:37:44 +03:00
|
|
|
% align center -> check if image fits vertically...
|
|
|
|
|
\ifphotobook@ImagePageFit@centered\else%
|
|
|
|
|
\sbox{\photobook@imagebox}{\includegraphics{#3}}%
|
2021-09-08 18:52:23 +03:00
|
|
|
\setlength\photobook@ImagePageFit@imgratio{%
|
|
|
|
|
1pt * \ratio{\wd\photobook@imagebox}{\ht\photobook@imagebox}}%
|
2021-09-08 04:37:44 +03:00
|
|
|
% NOTE: subtracting \bindingoffset from \cellwidth here makes sure that
|
|
|
|
|
% we avoid offsetting images close enough in ratio to the page and
|
|
|
|
|
% messing up bleeds...
|
|
|
|
|
\setlength\photobook@ImagePageFit@cellratio{1pt
|
|
|
|
|
* \ratio{\cellwidth - \bindingoffset}{\cellheight}}%
|
|
|
|
|
\ifdim \photobook@ImagePageFit@imgratio > \photobook@ImagePageFit@cellratio%
|
|
|
|
|
\photobook@ImagePageFit@centeredtrue\fi\fi%
|
|
|
|
|
%
|
|
|
|
|
% ignore \bindingoffset -> center the image...
|
|
|
|
|
\ifphotobook@ImagePageFit@centered%
|
|
|
|
|
\clearpage%
|
|
|
|
|
\begin{page}%
|
2021-09-12 03:29:50 +03:00
|
|
|
% NOTE: this does not account for \bindingoffset...
|
2021-09-08 04:37:44 +03:00
|
|
|
\begin{pagecell}%
|
|
|
|
|
\imagecell[%
|
|
|
|
|
center,
|
|
|
|
|
clearance=-\bleed,
|
|
|
|
|
scale=\imagescale,
|
|
|
|
|
offsettop=\imageoffsettop,
|
|
|
|
|
offsetleft=\imageoffsetleft,
|
|
|
|
|
#1]{#2}{#3}%
|
|
|
|
|
\end{pagecell}%
|
|
|
|
|
\end{page}%
|
|
|
|
|
% special case: centered vertical image -> account for \bindingoffset...
|
|
|
|
|
\else%
|
|
|
|
|
\ImagePageClear*[%
|
|
|
|
|
clearance=-\bleed,
|
|
|
|
|
#1]{#2}{#3}\fi%
|
|
|
|
|
\endgroup}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
2021-09-04 05:18:06 +03:00
|
|
|
%% \DescribeMacro{\ImagePageFit<D>\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImagePageFit<D>Caption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImagePageFit<D>Caption}
|
|
|
|
|
%% \DescribeMacro{\ImagePageFit<D>*\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-09-04 05:18:06 +03:00
|
|
|
%% |<D>| can be one of T, B, L or R, for top, bottom, left and right
|
|
|
|
|
%% respectively.
|
|
|
|
|
%%
|
2021-08-08 14:07:52 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-09-04 05:18:06 +03:00
|
|
|
%% . . . . . . . . . . . .
|
|
|
|
|
%% . +-----------------+ . +-----------------+
|
|
|
|
|
%% . | . . | . | |
|
|
|
|
|
%% . | . . | . | |
|
|
|
|
|
%% . | image | . | |
|
|
|
|
|
%% . | . (T) . | . . |-----------------| .
|
|
|
|
|
%% . | . . | . . | . . | .
|
|
|
|
|
%% . |-----------------| . . | . . | .
|
|
|
|
|
%% | | . | image | .
|
|
|
|
|
%% | | . | . (B) . | .
|
|
|
|
|
%% | | . | . . | .
|
|
|
|
|
%% +-----------------+ . +-----------------+ .
|
|
|
|
|
%% . . . . . . . . . . . .
|
|
|
|
|
%%
|
|
|
|
|
%% . . . . . . . . . . . . . . . .
|
|
|
|
|
%% . +-----------------+ +-----------------+ .
|
|
|
|
|
%% . |. .| | | |. .| .
|
|
|
|
|
%% . | . . | | | | . . | .
|
|
|
|
|
%% . | . . | | | | . . | .
|
|
|
|
|
%% . | . . | | | | . . | .
|
|
|
|
|
%% . | image | | | | image | .
|
|
|
|
|
%% . | .(L). | | | | .(R). | .
|
|
|
|
|
%% . | . . | | | | . . | .
|
|
|
|
|
%% . | . . | | | | . . | .
|
|
|
|
|
%% . |. .| c | | c |. .| .
|
|
|
|
|
%% . +-----------------+ +-----------------+ .
|
|
|
|
|
%% . . . . . . . . . . . . . . . .
|
2021-08-08 14:07:52 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-09-04 05:18:06 +03:00
|
|
|
\ResettableMacro{ImagePageFitTCaption}[1]{%
|
2021-09-08 04:37:44 +03:00
|
|
|
\captioncell[under]{%
|
2021-09-04 05:18:06 +03:00
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImagePageFitT}{%
|
|
|
|
|
\ImagePageFit*[%
|
|
|
|
|
top,
|
|
|
|
|
#1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
\ResettableMacro{ImagePageFitBCaption}[1]{%
|
|
|
|
|
\captioncell[over]{%
|
|
|
|
|
\captionformat{#1}}}
|
2021-09-08 04:37:44 +03:00
|
|
|
% XXX the image seems a bit too low...
|
2021-09-04 05:18:06 +03:00
|
|
|
\ImagePageTemplate{ImagePageFitB}{%
|
|
|
|
|
\ImagePageFit*[%
|
|
|
|
|
bottom,
|
|
|
|
|
#1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
\ResettableMacro{ImagePageFitLCaption}[1]{%
|
|
|
|
|
\captionblockcell[right]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImagePageFitL}{%
|
|
|
|
|
\ImagePageFit*[%
|
|
|
|
|
left,
|
|
|
|
|
#1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
\ResettableMacro{ImagePageFitRCaption}[1]{%
|
|
|
|
|
\captionblockcell[left]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImagePageFitR}{%
|
|
|
|
|
\ImagePageFit*[%
|
|
|
|
|
right,
|
|
|
|
|
#1]{#2}{#3}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
2021-09-03 05:18:18 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Full bleed
|
|
|
|
|
|
|
|
|
|
%% \DescribeMacro{\ImagePageFill\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImagePageFillCaption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImagePageFillCaption}
|
|
|
|
|
%% \DescribeMacro{\ImagePageFill*\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% Like |\ImagePage| but will fill page with image.
|
|
|
|
|
%
|
|
|
|
|
%% >> \ImagePageFill[<options>]{<caption>}{<image>}
|
|
|
|
|
%%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
|
|
|
|
%% . . . . . . . . . . . . . . . . . . .
|
|
|
|
|
%% . . +-----------------+ . .
|
|
|
|
|
%% . . | c | . .
|
|
|
|
|
%% . .| |. .
|
|
|
|
|
%% . | . . | .
|
|
|
|
|
%% . | . . | .
|
|
|
|
|
%% . | image | .
|
|
|
|
|
%% . | . . | .
|
|
|
|
|
%% . | . . | .
|
|
|
|
|
%% . .| |. .
|
|
|
|
|
%% . . | | . .
|
|
|
|
|
%% . . +-----------------+ . .
|
|
|
|
|
%% . . . . . . . . . . . . . . . . . . .
|
|
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
|
|
|
|
%%
|
2021-09-06 19:59:50 +03:00
|
|
|
%% Default image clearance is set by |\bleed| global length.
|
2021-09-03 05:18:18 +03:00
|
|
|
%%
|
|
|
|
|
\ResettableMacro{ImagePageFillCaption}[1]{%
|
|
|
|
|
\captioncell[top, align=flushright]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
|
|
|
|
|
\ImagePageTemplate{ImagePageFill}{%
|
2021-09-04 05:18:06 +03:00
|
|
|
\ImagePageFit*[%
|
|
|
|
|
fill,
|
|
|
|
|
#1]{#2}{#3}}
|
2021-09-03 05:18:18 +03:00
|
|
|
|
|
|
|
|
|
2021-08-31 16:25:50 +03:00
|
|
|
%% \DescribeMacro{\ImageHalfPageL\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImageHalfPageLCaption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImageHalfPageLCaption}
|
|
|
|
|
%% \DescribeMacro{\ImageHalfPageL*\{..\}}
|
2021-08-10 06:14:42 +03:00
|
|
|
%
|
2021-08-31 03:25:11 +03:00
|
|
|
%% Left half of image filling page with full bleed.
|
2021-08-10 06:14:42 +03:00
|
|
|
%
|
|
|
|
|
%% >> \imageleftspreadfullbleed[<vertical-offset>]{<caption>}{<image>}
|
|
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-29 17:05:28 +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-31 03:25:11 +03:00
|
|
|
% XXX TEST...
|
|
|
|
|
% XXX do a better default...
|
2021-08-31 16:25:50 +03:00
|
|
|
\ResettableMacro{ImageHalfPageLCaption}[1]{%
|
2021-08-31 03:25:11 +03:00
|
|
|
\captioncell[bottom, align=flushright]{%
|
|
|
|
|
\captionformat{#1}}}
|
2021-08-10 06:14:42 +03:00
|
|
|
|
2021-08-31 16:25:50 +03:00
|
|
|
\ImagePageTemplate{ImageHalfPageL}{%
|
|
|
|
|
\begin{spreadtopages*}[2]{photobook@ImageHalfPageL@cell}%
|
2021-09-04 05:18:06 +03:00
|
|
|
\imagecell[%
|
|
|
|
|
fill,
|
|
|
|
|
clearance=-\bleed,
|
2021-08-31 08:27:37 +03:00
|
|
|
scale=\imagescale,
|
|
|
|
|
offsettop=\imageoffsettop,
|
|
|
|
|
offsetleft=\imageoffsetleft,
|
|
|
|
|
#1]{#2}{#3}%
|
2021-08-31 03:25:11 +03:00
|
|
|
\end{spreadtopages*}%
|
|
|
|
|
%
|
2021-09-08 04:37:44 +03:00
|
|
|
\clearpage%
|
2021-08-31 16:25:50 +03:00
|
|
|
\usespreadpage[1]{photobook@ImageHalfPageL@cell}}
|
2021-08-10 06:14:42 +03:00
|
|
|
|
2021-08-31 03:25:11 +03:00
|
|
|
|
2021-08-31 08:27:37 +03:00
|
|
|
|
2021-08-31 16:25:50 +03:00
|
|
|
%% \DescribeMacro{\ImageHalfPageR\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImageHalfPageRCaption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImageHalfPageRCaption}
|
|
|
|
|
%% \DescribeMacro{\ImageHalfPageR*\{..\}}
|
2021-08-10 06:14:42 +03:00
|
|
|
%
|
2021-08-31 03:25:11 +03:00
|
|
|
%% Right half of image filling page with full bleed.
|
2021-08-10 06:14:42 +03:00
|
|
|
%
|
|
|
|
|
%% >> \imagerightspreadfullbleed[<vertical-offset>]{<caption>}{<image>}
|
|
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-08-29 17:05:28 +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-31 03:25:11 +03:00
|
|
|
% XXX TEST...
|
|
|
|
|
% XXX do a better default...
|
2021-08-31 16:25:50 +03:00
|
|
|
\ResettableMacro{ImageHalfPageRCaption}[1]{%
|
2021-08-31 03:25:11 +03:00
|
|
|
\captioncell[bottom, align=flushright]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
|
2021-08-31 16:25:50 +03:00
|
|
|
\ImagePageTemplate{ImageHalfPageR}{%
|
|
|
|
|
\begin{spreadtopages*}[2]{photobook@ImageHalfPageR@cell}%
|
2021-09-04 05:18:06 +03:00
|
|
|
\imagecell[%
|
|
|
|
|
fill,
|
|
|
|
|
clearance=-\bleed,
|
2021-08-31 08:27:37 +03:00
|
|
|
scale=\imagescale,
|
|
|
|
|
offsettop=\imageoffsettop,
|
|
|
|
|
offsetleft=\imageoffsetleft,
|
|
|
|
|
#1]{#2}{#3}%
|
2021-08-31 03:25:11 +03:00
|
|
|
\end{spreadtopages*}%
|
|
|
|
|
%
|
2021-09-08 04:37:44 +03:00
|
|
|
\clearpage%
|
2021-08-31 16:25:50 +03:00
|
|
|
\usespreadpage[2]{photobook@ImageHalfPageR@cell}}
|
2021-08-10 06:14:42 +03:00
|
|
|
|
|
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
%----------------------------------------------------------------------
|
|
|
|
|
%%%% Spread Templates
|
|
|
|
|
|
2021-09-03 05:18:18 +03:00
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2021-09-04 05:18:06 +03:00
|
|
|
%%%%% No bleed
|
2021-09-03 05:18:18 +03:00
|
|
|
|
2021-09-04 05:18:06 +03:00
|
|
|
% XXX TEST!!
|
|
|
|
|
% XXX doc...
|
|
|
|
|
% XXX Should we make this just like with pages, i.e. \imagePage{..} and
|
|
|
|
|
% \ImagePageFit{..}, the first places relative to text and raises
|
|
|
|
|
% slightly while the second simply centers...
|
|
|
|
|
%% \DescribeMacro{\ImageSpread\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImageSpreadCaption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImageSpreadCaption}
|
|
|
|
|
%% \DescribeMacro{\ImageSpread*\{..\}}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-09-04 05:18:06 +03:00
|
|
|
%% +---------------+---------------+
|
|
|
|
|
%% | +-------------+-------------+ |
|
|
|
|
|
%% | | . . . | |
|
|
|
|
|
%% | | . . . | |
|
|
|
|
|
%% | | . . . | |
|
|
|
|
|
%% | | image | |
|
|
|
|
|
%% | | . . . | |
|
|
|
|
|
%% | | . . . | |
|
|
|
|
|
%% | | . . . | |
|
|
|
|
|
%% | +-------------+-------------+ |
|
|
|
|
|
%% +---------------+---------------+
|
2021-08-09 13:43:36 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-09-04 05:18:06 +03:00
|
|
|
% XXX do a better default...
|
|
|
|
|
% ...adaptive???
|
|
|
|
|
\ResettableMacro{ImageSpreadCaption}[1]{%
|
2021-09-10 15:54:38 +03:00
|
|
|
\captioncell[under]{%
|
2021-09-04 05:18:06 +03:00
|
|
|
\captionformat{#1}}}
|
|
|
|
|
|
|
|
|
|
\ImagePageTemplate{ImageSpread}{%
|
|
|
|
|
\cleartoleftpage%
|
|
|
|
|
\begin{spreadtopages}[2]%
|
|
|
|
|
\imagecell[%
|
|
|
|
|
fit,
|
2021-09-06 19:59:50 +03:00
|
|
|
clearance=\clearimage,
|
2021-09-04 05:18:06 +03:00
|
|
|
scale=\imagescale,
|
|
|
|
|
offsettop=\imageoffsettop,
|
|
|
|
|
offsetleft=\imageoffsetleft,
|
|
|
|
|
#1]{#2}{#3}%
|
|
|
|
|
\end{spreadtopages}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
2021-09-04 05:18:06 +03:00
|
|
|
%% \DescribeMacro{\ImageSpread<D>\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImageSpread<D>Caption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImageSpread<D>Caption}
|
|
|
|
|
%% \DescribeMacro{\ImageSpread<D>*\{..\}}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
2021-09-04 05:18:06 +03:00
|
|
|
%% |<D>| can be one of T, B, L or R, for top, bottom, left and right
|
|
|
|
|
%% respectively.
|
2021-08-27 19:04:05 +03:00
|
|
|
%%
|
2021-08-09 13:43:36 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-09-04 05:18:06 +03:00
|
|
|
%% +---------------+---------------+ +---------------+---------------+
|
|
|
|
|
%% | +-------------+-------------+ | | . |
|
|
|
|
|
%% | | . . . | | | c . |
|
|
|
|
|
%% | | . . . | | | +-------------+-------------+ |
|
|
|
|
|
%% | | image | | | | . . . | |
|
|
|
|
|
%% | | . (T) . | | | | . . . | |
|
|
|
|
|
%% | | . . . | | | | image | |
|
|
|
|
|
%% | +-------------+-------------+ | | | . (B) . | |
|
|
|
|
|
%% | . c | | | . . . | |
|
|
|
|
|
%% | . | | +-------------+-------------+ |
|
|
|
|
|
%% +---------------+---------------+ +---------------+---------------+
|
|
|
|
|
%%
|
|
|
|
|
%% +---------------+---------------+ +---------------+---------------+
|
|
|
|
|
%% | +-------------+---------+ | | +---------+-------------+ |
|
|
|
|
|
%% | | . . . | | | | . . . | |
|
|
|
|
|
%% | | . . . | | | | . . . | |
|
|
|
|
|
%% | | . .. | | | | .. . | |
|
|
|
|
|
%% | | image | | | | image | |
|
|
|
|
|
%% | | . (L).. | | | | ..(R) . | |
|
|
|
|
|
%% | | . . . | | | | . . . | |
|
|
|
|
|
%% | | . . . | | | | . . . | |
|
|
|
|
|
%% | +-------------+---------+ c | | c +---------+-------------+ |
|
|
|
|
|
%% +---------------+---------------+ +---------------+---------------+
|
2021-08-09 13:43:36 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-09-04 05:18:06 +03:00
|
|
|
\ResettableMacro{ImageSpreadTCaption}[1]{%
|
2021-09-10 15:54:38 +03:00
|
|
|
\captioncell[under]{%
|
2021-09-04 05:18:06 +03:00
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImageSpreadT}{%
|
|
|
|
|
\ImageSpread*[%
|
|
|
|
|
top,
|
|
|
|
|
#1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
\ResettableMacro{ImageSpreadBCaption}[1]{%
|
|
|
|
|
\captioncell[over]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImageSpreadB}{%
|
|
|
|
|
\ImageSpread*[%
|
|
|
|
|
bottom,
|
|
|
|
|
#1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
\ResettableMacro{ImageSpreadLCaption}[1]{%
|
|
|
|
|
\captionblockcell[right]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImageSpreadL}{%
|
|
|
|
|
\ImageSpread*[%
|
|
|
|
|
left,
|
|
|
|
|
#1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
\ResettableMacro{ImageSpreadRCaption}[1]{%
|
|
|
|
|
\captionblockcell[left]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImageSpreadR}{%
|
|
|
|
|
\ImageSpread*[%
|
|
|
|
|
right,
|
|
|
|
|
#1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Partial bleed
|
|
|
|
|
|
|
|
|
|
|
2021-09-10 03:27:33 +03:00
|
|
|
%% \DescribeMacro{\ImageSpreadFit\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImageSpreadFitCaption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImageSpreadFitCaption}
|
|
|
|
|
%% \DescribeMacro{\ImageSpreadFit*\{..\}}
|
2021-08-08 01:54:37 +03:00
|
|
|
%
|
2021-08-09 13:43:36 +03:00
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
|
|
|
|
%%
|
2021-09-10 03:27:33 +03:00
|
|
|
%% . . . . . . . . . . .
|
|
|
|
|
%% +---------------+---------------+ +---------------+---------------+
|
|
|
|
|
%% | . | | |. . .|. |
|
|
|
|
|
%% . |-------------------------------| . | | . . . | |
|
|
|
|
|
%% . | . . . | . | | . . . | |
|
|
|
|
|
%% . | . . . | . | | . . . | |
|
|
|
|
|
%% . | image | . | | image | |
|
|
|
|
|
%% . | . . . | . | | . . . | |
|
|
|
|
|
%% . | . . . | . | | . . . | |
|
|
|
|
|
%% . |-------------------------------| . | | . . . | |
|
|
|
|
|
%% | . c | | |. . .| c |
|
|
|
|
|
%% +---------------+---------------+ +---------------+---------------+
|
|
|
|
|
%% . . . . . . . . . . .
|
2021-08-09 13:43:36 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-09-10 03:27:33 +03:00
|
|
|
% XXX TEST...
|
|
|
|
|
% XXX make caption adaptive...
|
|
|
|
|
\ResettableMacro{ImageSpreadFitCaption}[1]{%
|
|
|
|
|
\captioncell[under]{%
|
2021-08-31 02:43:22 +03:00
|
|
|
\captionformat{#1}}}
|
2021-09-10 03:27:33 +03:00
|
|
|
\ImagePageTemplate{ImageSpreadFit}{%
|
2021-08-31 02:43:22 +03:00
|
|
|
\cleartoleftpage%
|
|
|
|
|
\begin{spreadtopages}[2]%
|
2021-09-04 05:18:06 +03:00
|
|
|
\imagecell[%
|
|
|
|
|
fit,
|
|
|
|
|
clearance=-\bleed,
|
2021-08-31 08:27:37 +03:00
|
|
|
scale=\imagescale,
|
|
|
|
|
offsettop=\imageoffsettop,
|
|
|
|
|
offsetleft=\imageoffsetleft,
|
|
|
|
|
#1]{#2}{#3}%
|
2021-08-31 02:43:22 +03:00
|
|
|
\end{spreadtopages}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
2021-09-10 03:27:33 +03:00
|
|
|
%% \DescribeMacro{\ImageSpread<D>\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImageSpread<D>Caption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImageSpread<D>Caption}
|
|
|
|
|
%% \DescribeMacro{\ImageSpread<D>*\{..\}}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
2021-09-10 03:27:33 +03:00
|
|
|
%% Image spread aligned left (with bleed).
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
2021-09-10 03:27:33 +03:00
|
|
|
%% >> \ImageSpread<D>[<options>]{<caption>}{<image>}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
|
|
|
|
%% \begin{minipage}{\textwidth}
|
|
|
|
|
%% \begin{verbatim}
|
2021-09-10 03:27:33 +03:00
|
|
|
%%
|
|
|
|
|
%% . . . . . . . . . . . . . . . . . . .
|
|
|
|
|
%% . +---------------+---------------+ . +---------------+---------------+
|
|
|
|
|
%% . | . . . | . | c . |
|
|
|
|
|
%% . | . . . | . . |-------------------------------| .
|
|
|
|
|
%% . | . . . | . . | . . . | .
|
|
|
|
|
%% . | image | . . | . . . | .
|
|
|
|
|
%% . | . (T) . | . . | . . . | .
|
|
|
|
|
%% . | . . . | . . | image | .
|
|
|
|
|
%% . | . . . | . . | . (B) . | .
|
|
|
|
|
%% . |-------------------------------| . . | . . . | .
|
|
|
|
|
%% | . c | . | . . . | .
|
|
|
|
|
%% +---------------+---------------+ . +---------------+---------------+ .
|
|
|
|
|
%% . . . . . . . . . . . . . . . . . . .
|
|
|
|
|
%%
|
|
|
|
|
%% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
|
|
|
|
%% . +---------------+---------------+ +---------------+---------------+ .
|
|
|
|
|
%% . | . . . | | | | . . . | .
|
|
|
|
|
%% . | . . . | | | | . . . | .
|
|
|
|
|
%% . | . . . | | | | . . . | .
|
|
|
|
|
%% . | . .. | | | | .. . | .
|
|
|
|
|
%% . | image | | | | image | .
|
|
|
|
|
%% . | . (L).. | | | | .(R) . | .
|
|
|
|
|
%% . | . . . | | | | . . . | .
|
|
|
|
|
%% . | . . . | | | | . . . | .
|
|
|
|
|
%% . | . . . | c | | c | . . . | .
|
|
|
|
|
%% . +---------------+---------------+ +---------------+---------------+ .
|
|
|
|
|
%% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
2021-08-09 13:43:36 +03:00
|
|
|
%%
|
|
|
|
|
%% \end{verbatim}
|
|
|
|
|
%% \end{minipage}
|
2021-08-10 14:14:43 +03:00
|
|
|
%%
|
2021-09-10 03:27:33 +03:00
|
|
|
% XXX TEST...
|
2021-08-31 02:43:22 +03:00
|
|
|
% XXX do a better default...
|
2021-09-10 03:27:33 +03:00
|
|
|
% XXX need a caption box...
|
|
|
|
|
\ResettableMacro{ImageSpreadFitTCaption}[1]{%
|
|
|
|
|
\captioncell[under]{%
|
2021-08-31 02:43:22 +03:00
|
|
|
\captionformat{#1}}}
|
2021-09-10 03:27:33 +03:00
|
|
|
\ImagePageTemplate{ImageSpreadFitT}{%
|
|
|
|
|
\ImageSpreadFit*[top, #1]{#2}{#3}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
2021-09-10 03:27:33 +03:00
|
|
|
\ResettableMacro{ImageSpreadFitBCaption}[1]{%
|
2021-09-10 15:54:38 +03:00
|
|
|
\captioncell[over]{%
|
2021-09-10 03:27:33 +03:00
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImageSpreadFitB}{%
|
|
|
|
|
\ImageSpreadFit*[bottom, #1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
\ResettableMacro{ImageSpreadFitLCaption}[1]{%
|
|
|
|
|
\captionblockcell[right]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImageSpreadFitL}{%
|
|
|
|
|
\ImageSpreadFit*[left, #1]{#2}{#3}}
|
|
|
|
|
|
|
|
|
|
\ResettableMacro{ImageSpreadFitRCaption}[1]{%
|
|
|
|
|
\captionblockcell[left]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
\ImagePageTemplate{ImageSpreadFitR}{%
|
|
|
|
|
\ImageSpreadFit*[right, #1]{#2}{#3}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
2021-08-31 02:43:22 +03:00
|
|
|
|
2021-09-03 05:18:18 +03:00
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
%%%%% Full bleed
|
|
|
|
|
|
2021-08-31 03:25:11 +03:00
|
|
|
%% \DescribeMacro{\ImageSpreadFill\{..\}}
|
|
|
|
|
%% \DescribeMacro{\ImageSpreadFillCaption\{..\}}
|
|
|
|
|
%% \DescribeMacro{\resetImageSpreadFillCaption}
|
|
|
|
|
%% \DescribeMacro{\ImageSpreadFill*\{..\}}
|
2021-08-09 13:43:36 +03:00
|
|
|
%
|
|
|
|
|
%% Image spread with full bleed.
|
|
|
|
|
%
|
2021-08-31 03:25:11 +03:00
|
|
|
%% >> \ImageSpreadFill[<options>]{<caption>}{<image>}
|
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-31 02:43:22 +03:00
|
|
|
|
|
|
|
|
% XXX do a better default...
|
2021-08-31 03:25:11 +03:00
|
|
|
\ResettableMacro{ImageSpreadFillCaption}[1]{%
|
2021-08-31 02:43:22 +03:00
|
|
|
\captioncell[bottom, align=flushright]{%
|
|
|
|
|
\captionformat{#1}}}
|
|
|
|
|
|
2021-08-31 03:25:11 +03:00
|
|
|
\ImagePageTemplate{ImageSpreadFill}{%
|
2021-08-31 02:43:22 +03:00
|
|
|
\cleartoleftpage%
|
|
|
|
|
\begin{spreadtopages}[2]%
|
2021-09-04 05:18:06 +03:00
|
|
|
\imagecell[%
|
|
|
|
|
fill,
|
|
|
|
|
clearance=-\bleed,
|
2021-08-31 08:27:37 +03:00
|
|
|
scale=\imagescale,
|
|
|
|
|
offsettop=\imageoffsettop,
|
|
|
|
|
offsetleft=\imageoffsetleft,
|
|
|
|
|
#1]{#2}{#3}%
|
2021-08-31 02:43:22 +03:00
|
|
|
\end{spreadtopages}}
|
2021-08-08 01:54:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-02 23:51:05 +03:00
|
|
|
%----------------------------------------------------------------------
|
2021-09-03 05:18:18 +03:00
|
|
|
%%%% Meta Macros / Environments
|
2021-09-03 03:28:04 +03:00
|
|
|
%
|
|
|
|
|
%% These macros and environments are used internally to help define cells
|
|
|
|
|
%% and templates and thus can be useful when extending the functionality
|
|
|
|
|
%% of this class both when authoring styles and when creating user
|
2021-09-10 15:54:38 +03:00
|
|
|
%% macros/templates.\footnote{%
|
|
|
|
|
%% Note that in code the relevant meta-macros are defined in the logical
|
|
|
|
|
%% locations for each macro, i.e. before first use and at the start of
|
|
|
|
|
%% the relevant context. This section in the reference is placed near
|
|
|
|
|
%% the end so as to focus the user's attention on the main class interface,
|
|
|
|
|
%% class internal architecture and extension API being secondary.}
|
2021-09-02 23:51:05 +03:00
|
|
|
%%
|
2021-09-03 16:32:03 +03:00
|
|
|
%% \input{\jobname-meta}
|
2021-09-02 23:51:05 +03:00
|
|
|
%%
|
2021-09-10 15:54:38 +03:00
|
|
|
%%
|
2021-09-02 23:51:05 +03:00
|
|
|
|
|
|
|
|
|
2021-09-03 03:28:04 +03:00
|
|
|
|
2021-08-27 19:04:05 +03:00
|
|
|
%----------------------------------------------------------------------
|
2021-09-03 03:28:04 +03:00
|
|
|
%%%% Miscellaneous
|
2021-08-27 19:04:05 +03:00
|
|
|
|
|
|
|
|
% XXX should digits/rounding be configurable???
|
|
|
|
|
\newcommand\photobook@TemplateCell[2][mm]{
|
|
|
|
|
\begin{center}
|
2021-08-29 03:01:01 +03:00
|
|
|
\vfill%
|
2021-08-27 19:04:05 +03:00
|
|
|
#2 \\
|
|
|
|
|
(\lenprint[#1]{\cellwidth} \space x \lenprint[#1]{\cellheight})
|
2021-08-29 03:01:01 +03:00
|
|
|
\vfill%
|
|
|
|
|
\vspace{0pt}%
|
2021-08-30 01:42:11 +03:00
|
|
|
\end{center}%
|
|
|
|
|
\ignorespaces}
|
2021-08-27 19:04:05 +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-30 01:42:11 +03:00
|
|
|
\TPoptions{showboxes=true}%
|
2021-08-27 19:04:05 +03:00
|
|
|
\begin{page}
|
|
|
|
|
\setlength{\parindent}{0em}
|
|
|
|
|
% NOTE: only the relevant blocks will be visible...
|
2021-08-29 03:01:01 +03:00
|
|
|
\ifendpaperlayout%
|
|
|
|
|
\begin{leftside}
|
|
|
|
|
\photobook@TemplateCell[#1]{ENDPAPER LEFT}
|
|
|
|
|
\end{leftside}
|
|
|
|
|
\begin{rightside}
|
|
|
|
|
\photobook@TemplateCell[#1]{ENDPAPER RIGHT}
|
|
|
|
|
\end{rightside}\fi%
|
|
|
|
|
\ifcoverlikelayout%
|
|
|
|
|
\begin{frontcover}
|
|
|
|
|
\photobook@TemplateCell[#1]{FRONT COVER}
|
|
|
|
|
\end{frontcover}
|
|
|
|
|
\begin{vspine}%
|
|
|
|
|
\photobook@TemplateCell[#1]{SPINE}%
|
|
|
|
|
\end{vspine}
|
|
|
|
|
\begin{backcover}
|
|
|
|
|
\photobook@TemplateCell[#1]{BACK COVER}
|
|
|
|
|
\end{backcover}\fi%
|
|
|
|
|
\ifjacketlayout%
|
|
|
|
|
\begin{frontflap}%
|
2021-08-30 01:42:11 +03:00
|
|
|
\photobook@TemplateCell[#1]{FRONT FLAP}
|
2021-08-29 03:01:01 +03:00
|
|
|
\end{frontflap}
|
|
|
|
|
\begin{backflap}%
|
|
|
|
|
\photobook@TemplateCell[#1]{BACK FLAP}
|
|
|
|
|
\end{backflap}\fi%
|
2021-08-30 01:42:11 +03:00
|
|
|
\end{page}}
|
2021-08-27 19:04:05 +03:00
|
|
|
|
|
|
|
|
|
2021-09-09 00:43:30 +03:00
|
|
|
%% \DescribeMacro{\pdfcommentcell\{..\}}
|
2021-09-08 04:37:44 +03:00
|
|
|
%
|
2021-09-08 18:52:23 +03:00
|
|
|
%% Add pdf comment as margin overlay.
|
2021-09-08 04:37:44 +03:00
|
|
|
%%
|
2021-09-10 02:00:19 +03:00
|
|
|
%% >> \pdfcommentcell[<options>]{<comment>}
|
2021-09-08 04:37:44 +03:00
|
|
|
%%
|
2021-09-10 02:00:19 +03:00
|
|
|
\newcommand\pdfcommentcell[2][]{%
|
2021-09-08 18:52:23 +03:00
|
|
|
\begin{cell*}{
|
|
|
|
|
\ifnumodd{\thepage}{%
|
|
|
|
|
\cellwidth - \marginparwidth - 2\bleed - 1cm
|
|
|
|
|
}{%
|
|
|
|
|
\bleed + 1cm},
|
|
|
|
|
\bleed + 1cm
|
|
|
|
|
}{\marginparwidth}{1pt}%
|
2021-09-10 02:00:19 +03:00
|
|
|
\pdfcomment[color=yellow, #1]{#2}%
|
2021-09-08 18:52:23 +03:00
|
|
|
\end{cell*}}
|
2021-09-08 04:37:44 +03:00
|
|
|
|
|
|
|
|
|
2021-08-28 01:49:51 +03:00
|
|
|
%% \DescribeMacro{\pdfpagecount\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% Get pdf page count
|
|
|
|
|
%%
|
|
|
|
|
%% >> \pdfpagecount{<file.pdf>}
|
|
|
|
|
%%
|
2021-08-30 01:42:11 +03:00
|
|
|
\newcommand\pdfpagecount[1]{%
|
|
|
|
|
\ifpdftex%
|
|
|
|
|
\pdfximage{#1}%
|
2021-08-28 01:49:51 +03:00
|
|
|
\number\pdflastximagepages%
|
2021-08-30 01:42:11 +03:00
|
|
|
\else\ifxetex%
|
2021-08-28 01:49:51 +03:00
|
|
|
\number\XeTeXpdfpagecount"#1"%
|
2021-08-30 01:42:11 +03:00
|
|
|
\else\ifluatex%
|
2021-08-28 01:49:51 +03:00
|
|
|
\number\directlua{%
|
|
|
|
|
local pages = 0
|
|
|
|
|
local doc = pdfe.open("\luaescapestring{#1}")
|
|
|
|
|
if doc then
|
|
|
|
|
pages = pdfe.getnofpages(doc)
|
|
|
|
|
pdfe.close(doc)
|
|
|
|
|
end
|
2021-08-30 01:42:11 +03:00
|
|
|
tex.write(pages) }\fi\fi}
|
2021-08-28 01:49:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
%% \DescribeMacro{\pdfspinewidth\{..\}}
|
|
|
|
|
%
|
|
|
|
|
%% 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
|
2021-08-30 01:42:11 +03:00
|
|
|
+ ((#2 mm) * 2)
|
|
|
|
|
\relax}}
|
2021-08-28 01:49:51 +03:00
|
|
|
|
|
|
|
|
|
2021-08-27 19:04:05 +03:00
|
|
|
|
2021-08-08 01:54:37 +03:00
|
|
|
%----------------------------------------------------------------------
|
2021-09-03 05:18:18 +03:00
|
|
|
% Index...
|
2021-09-03 04:03:28 +03:00
|
|
|
%
|
2021-09-03 05:18:18 +03:00
|
|
|
% XXX this prints trash at this point...
|
2021-09-04 05:18:06 +03:00
|
|
|
% ...I do not want to build the index manually but it seems that
|
|
|
|
|
% we are slowly moving in that direction...
|
2021-09-03 04:03:28 +03:00
|
|
|
%%% \printindex
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
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 :
|