Compare commits

...

95 Commits

Author SHA1 Message Date
53442622b9 now all images are correct + tiny tweak...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2025-09-12 00:03:31 +03:00
9bbd752c63 added public domain images...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2025-09-07 00:35:49 +03:00
ac0acee865 updated action...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2025-07-14 14:34:57 +03:00
3a3e4acc55 cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2025-07-14 11:41:36 +03:00
7bef61cb0f cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2025-07-14 11:15:10 +03:00
942197fdc9 added text-image spread example
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2025-07-14 11:12:36 +03:00
5e210b54eb minor fix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2025-07-06 13:31:34 +03:00
615463cf72 Merge branch 'muzimuzhi-doc-typo' 2024-07-28 11:31:46 +03:00
Yukai Chou
90708b6ca7
Fix typos in doc 2024-07-28 06:53:12 +08:00
1508055cf3 Woraround an Arythmetic overflow in calc's \ratio{..}{..}, see Issues section in docs.
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-07-19 15:51:42 +03:00
9ad5a81054 Updated docs to better reflect the paperwidth/paperheigt within the page geometry...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-07-18 13:23:56 +03:00
d92251976b
typo fix... 2023-11-14 22:46:50 +03:00
949cd945b0 cleanup the markdown doc build, still not usable without manual tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-19 21:27:41 +03:00
be6bc7ba4d ...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-18 22:54:50 +03:00
db9497cfb4 ...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-18 01:08:04 +03:00
2983290550 added link to github releases for docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-18 01:07:01 +03:00
87e8169826 Merge branch 'main' of github.com:flynx/photobook 2023-09-17 17:27:40 +03:00
0e7524a778 leftside and rightside cells' star/non-star versions now follow the general convention of the star version not clipping it's content (POLS).
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-17 17:27:28 +03:00
60a4e8b6ef refactored the readme a bit...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-16 11:15:01 +03:00
ace4cc3e6f added a ref to the dummy book...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-16 11:02:43 +03:00
9579a4cc0b Merge branch 'main' of github.com:flynx/photobook 2023-09-16 10:06:01 +03:00
3d4ec82633 notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-16 10:05:49 +03:00
7f2f8b1ff6 fixed typo...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-15 14:40:29 +03:00
deaa409acf Merge branch 'main' of github.com:flynx/photobook 2023-09-14 23:16:32 +03:00
73c3f721e3 minor fix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-14 23:16:22 +03:00
53b4d58227 chmod +x ...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-13 22:56:42 +03:00
3a1da05700 tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-13 17:37:43 +03:00
cc06475800 ...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-12 18:10:06 +03:00
6ef54c6939 updated docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-11 22:48:44 +03:00
238597543e fixed several stray spaces.
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-11 21:16:25 +03:00
ea10fa1004 cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-11 19:41:48 +03:00
c3896ba7f9 updated docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-11 19:09:25 +03:00
5568a6d6b8 now page templates use paper cells making them more compatible with different layouts + some refactoring.
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-11 18:53:49 +03:00
ca2bb256ac added coloring docs to \GenerateTemplate...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-11 18:33:13 +03:00
74c2c5e4a7 make the cover template a bit more obvious...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-11 18:26:48 +03:00
4a19fc5a98 tests...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-10 11:04:16 +03:00
9ae85d2ea8 testing bleeds in cliptocell env...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-05 17:37:03 +03:00
0a3ef4c170 updated docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-04 21:02:02 +03:00
142ea9b4ce tweaked docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-04 20:57:45 +03:00
b21cc06599 refactored teplate generation + added option to generate paths that graphicx can handle...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-04 20:16:31 +03:00
14c62374ba added web version of book...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-08-30 22:25:49 +03:00
55244f04de typo fix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-08-29 10:44:24 +03:00
f71b433366 updated docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-08-25 10:27:08 +03:00
164fdab6a5 added \BookType to make templates usable for non-book media too (fixed).
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-08-24 23:08:28 +03:00
a49fe8265a added \BookType to make templates usable for non-book media too.
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-08-24 23:06:17 +03:00
643a656553 bugfix in scripts...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-06-26 14:49:36 +03:00
36a9c8d380 bugfix: scripts/make-spreads.sh: added extension normalization...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-06-26 14:47:34 +03:00
035861ef77 added .editorconfig
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-06-12 12:35:41 +03:00
7bf8dc9cfd notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-20 11:07:03 +03:00
62434c5cf5 notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-17 23:36:02 +03:00
832bc796e3 tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-05 18:41:27 +03:00
93105898cb testing / experimenting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-05 17:21:20 +03:00
8cdf25b17e clearence reworked, mostly, still need testing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-05 15:27:39 +03:00
485bb4ba07 notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-05 14:11:18 +03:00
7f37e7ff8c experimenting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-05 13:59:57 +03:00
0598725a54 experimenting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-05 13:59:24 +03:00
84178cf288 endpaper is behaving in an odd way...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-05 13:54:04 +03:00
e6a8b50a63 experimenting with cells...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-04 18:58:31 +03:00
0a65489501 Merge branch 'main' of github.com:flynx/photobook 2023-05-03 01:27:59 +03:00
2dbee1418f cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-02 23:27:23 +03:00
be9c1f40df notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-05-01 10:00:17 +03:00
83cc0db91f tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-30 02:08:00 +03:00
b44d563684 tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-29 16:32:43 +03:00
748d75a05b tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-29 16:31:32 +03:00
f1fbc82fca refactored the readme...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-29 16:26:35 +03:00
1ca673cf64 Merge branch 'main' of github.com:flynx/photobook 2023-04-28 02:50:35 +03:00
2e659072f3 tweaking Makefile...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-28 02:50:29 +03:00
6ce1032d33 bug in make + termux...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-27 21:01:21 +03:00
561273e27c cleanup + make ergonomics...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-27 01:46:04 +03:00
f094d073b5 Merge branch 'main' of github.com:flynx/photobook 2023-04-27 01:30:34 +03:00
7f0159fb35 added note about dependencies...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-27 01:30:17 +03:00
c670c4ccf8 cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-27 01:27:51 +03:00
79546e3407 added \cliptocellbleeds{..} to set default clipping bleeds for cliptocell env + updated how fold marks are set on jackets
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-27 01:24:24 +03:00
37b5ac92ff Merge branch 'main' of github.com:flynx/photobook 2023-04-27 00:37:44 +03:00
3a4a0b6fd5 cleanup + docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-27 00:37:37 +03:00
9a3e1bd0a1 Merge branch 'main' of github.com:flynx/photobook 2023-04-26 21:00:56 +03:00
0d14bb32e3 added notes about generated doc source...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-26 21:00:31 +03:00
c8645478f5 ...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-26 16:53:34 +03:00
fab1a5f394 notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-25 22:56:52 +03:00
2034e4fdfe minor refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-24 12:37:13 +03:00
c42d8a4208 now tested cliptocell envs do not affect each other (defaults).
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-23 03:14:01 +03:00
ca432d6546 notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-22 22:37:42 +03:00
d57f81a745 notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-21 18:05:26 +03:00
c3e4e8f81b notes..
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-20 14:47:27 +03:00
e36f67b085 cleaning up comments and notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-19 21:28:03 +03:00
1ea6c37cfa now clip to cell env supports clipping to bleeds.
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-19 21:20:50 +03:00
e85e579fca extended \cliptocell env to optionaly include bleeds...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-19 21:01:24 +03:00
d39f1d473a experimenting with more flexible \cliptocell{..}...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-19 16:38:03 +03:00
c9a2565297 started on bleed clipping...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-18 12:36:33 +03:00
2aa649c285 notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-17 18:04:17 +03:00
02a98a4aa9 notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-15 17:38:07 +03:00
4dbeae47c6 notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-14 23:50:18 +03:00
32e28dae00 several fixes and some cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-13 11:37:45 +03:00
e2fb80991f notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-12 16:06:46 +03:00
ec4bf1c0a1 typo fix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-04-12 15:57:28 +03:00
34 changed files with 1176 additions and 200 deletions

7
.editorconfig Normal file
View File

@ -0,0 +1,7 @@
root = true
[**]
indent_style = tab
tab_width = 4
charset = utf-8
end_of_line = lf

View File

@ -44,13 +44,13 @@ jobs:
photobook.pdf photobook.pdf
- name: Artifacts - build - name: Artifacts - build
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: build artifacts name: build artifacts
path: photobook.pdf path: photobook.pdf
- name: Artifacts - dist - name: Artifacts - dist
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: dist artifacts name: dist artifacts
path: dist/photobook-*.zip path: dist/photobook-*.zip

View File

@ -43,9 +43,6 @@
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# Config... # Config...
.EXPORT_ALL_VARIABLES:
# NOTE: this makes things run consistently on different systems including # NOTE: this makes things run consistently on different systems including
# things like Android... # things like Android...
SHELL := bash SHELL := bash
@ -88,8 +85,7 @@ endif
# markdown dialect... # markdown dialect...
# #
# XXX still needs some tweaking... MD_FORMAT ?= gfm
MD_FORMAT ?= markdown_github
# debug output... # debug output...
@ -176,26 +172,11 @@ LN := cp -l
# - |..| - verbatim does not work... # - |..| - verbatim does not work...
# - || - parts of doc omitted... # - || - parts of doc omitted...
# - verbatim blocks get merged sometimes... # - verbatim blocks get merged sometimes...
# - does not resolve \jobname in include...
# - ... # - ...
# ...not sure if this can be tweaked... # ...not sure if this can be tweaked...
#%.md: %.tex
# pandoc -t $(MD_FORMAT) -s $< -o $@
# XXX EXPERIMENTAL...
# XXX revise:
# ...for this to work we need to replace:
# \documentclass{ltxdoc}
# to:
# \documentclass[markdownextra]{internet}
# XXX install the internet class...
# https://github.com/loopspace/latex-to-internet
# ...needs testing...
%.md: %.tex %.md: %.tex
cat $< \ pandoc -t $(MD_FORMAT) -s $< -o $@
| sed 's/documentclass{ltxdoc}/documentclass[markdownextra]{internet}/' \
> $<.tmp
mv $<{.tmp,}
$(TEX) $< $(STDERR)
# meta-section... # meta-section...
@ -245,14 +226,10 @@ LN := cp -l
# list of dependencies... # list of dependencies...
# #
# NOTE: grep's -z flag generates a bunch if nulls that we need to clean
# out via tr.
DEPENDS.txt: $(MODULE).cls DEPENDS.txt: $(MODULE).cls
cat $< \ make depends \
| grep -Ezo '\s*\\RequirePackage(\[[^]]*\])?\{[^}]*\}' \ | grep -v make \
| sed -e 's/.*{\(.*\)}/hard \1\n/' \ | sed -e 's/^/hard /' \
| grep -a hard \
| tr -d '\000' \
> $@ > $@
@ -265,6 +242,20 @@ version:
@echo $(VERSION) @echo $(VERSION)
# NOTE: grep's -z flag generates a bunch if nulls that we need to clean
# out via tr.
# XXX this is a bit ugly -- adding/removing "hard" and then adding it
# again for DEPENDS.txt...
.PHONY: depends
depends: $(MODULE).cls
@cat $< \
| grep -Ezo '\s*\\RequirePackage(\[[^]]*\])?\{[^}]*\}' \
| sed -e 's/.*{\(.*\)}/hard \1\n/' \
| grep -a hard \
| tr -d '\000' \
| cut -d " " -f 2
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# Main targets... # Main targets...

View File

@ -4,8 +4,59 @@ photobook
[LaTeX](https://www.latex-project.org/) document class for making photo books. [LaTeX](https://www.latex-project.org/) document class for making photo books.
## Build requirements for docs Available on:
- CTAN: https://ctan.org/pkg/photobook
- GitHub: https://github.com/flynx/photobook
## Install / Build
The simplest way to install is to use either
[TeX Live](https://www.tug.org/texlive/)'s or [MiKTeX](https://miktex.org/)'s
standard way to install modules.
Installing from source:
```shell
# get the source...
$ git clone https://github.com/flynx/photobook.git
# if desired, install in the user context...
$ cd ./photobook
$ make install
```
The `photobook` document class requires a set of modules to be installed
for it to function, the full list is included in the docs and can be
generated and printed by calling:
```shell
$ make depends
```
For more info on `make` targets see the: [./Makefile](./Makefile)
# Documentation
Pre-built documentation can be found in the
[Github releases](https://github.com/flynx/photobook/releases/latest) or on
[CTAN](http://mirrors.ctan.org/macros/latex/contrib/photobook/photobook.pdf).
A full book (dummy) example is included in [./examples/book/](./examples/book/)
and can be used as a reference / starting point.
## Building documentation
Building the reference from source is done by:
```shell
$ make pdf
```
Build requirements for docs:
- LaTeX tool chain (including: `lualatex`, `latexmk`, ..) - LaTeX tool chain (including: `lualatex`, `latexmk`, ..)
The simplest way to get started is [TeX Live](https://www.tug.org/texlive/), The simplest way to get started is [TeX Live](https://www.tug.org/texlive/),
either a full install or for specific modules see the _Packages_ section either a full install or for specific modules see the _Packages_ section
@ -17,33 +68,14 @@ photobook
## Build / Install
The package is available on:
- CTAN: https://ctan.org/pkg/photobook
- GitHub: https://github.com/flynx/photobook
To install from source:
```shell
# get the source...
$ git clone https://github.com/flynx/photobook.git
# if desired, install in the user context...
$ cd ./photobook
$ make install
```
If only building the docs is required without installing:
```shell
$ make pdf
```
For more info on `make` targets see the: [./Makefile](./Makefile)
## Notes ## Notes
- The main reference is maintained inline with the source [photobook.cls](./photobook.cls)
thus it is both human-readable next to the code it documents and is
used to build the `photobook.pdf`.
Extracting the documentation source (`photobook*.tex`) is done
by [make](./Makefile) via [cls2tex.sh](scripts/README.md#cls2texsh) when
building the docs, see them for more info.
- There is a bug in default captions not being typeset correctly if too - There is a bug in default captions not being typeset correctly if too
long, a workaround is to place them in a `minipage` like this: long, a workaround is to place them in a `minipage` like this:
```latex ```latex
@ -72,3 +104,4 @@ Copyright (c) 2021-2023, Alex A. Naanou,
All rights reserved. All rights reserved.
<!-- vim:set ts=4 sw=4 nowrap : -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 4.3 MiB

28
examples/book/web.tex Normal file
View File

@ -0,0 +1,28 @@
%----------------------------------------------------------------------
%
%
%
%
%----------------------------------------------------------------------
\input{setup}
\setlength\bleed{0mm}
\ChangeLayout{spread}
\pagestyle{empty}
\begin{document} %-----------------------------------------------------
\includepdfmerge{jacket.pdf}
\includepdfmerge{cover.pdf}
\pdfspreadstopages{block}
\end{document} %-------------------------------------------------------
% vim:set ts=4 sw=4 :

View File

@ -0,0 +1,93 @@
%----------------------------------------------------------------------
\documentclass[
layoutmode=block,
% page size...
blockwidth=240mm, blockheight=220mm,
bleed=4mm,
gutteroffset=5mm,
bindingoffset=0mm,
% image block configuration...
imageblockwidth=0.98, imageblockheight=0.98,
imageblockoffsettop=0,
% misc...
9pt,final,openany
]{photobook}
\usepackage{lipsum}
\usepackage{ragged2e}
% XXX for some reason this is not in the top/left corner...
% XXX bug in photobook???
\newcommand\CaptionBox[1][Caption]{%
\setlength\fboxsep{0pt}%
\fbox{%
\setlength\fboxsep{1pt}%
\colorbox{white}{\tiny #1}}}
\begin{document} %-----------------------------------------------------
\setlength\parindent{0em}
\newlength\cellsize
\setlength\cellsize{25mm}
\renewcommand\fbox{\fcolorbox{red}{white}}
\begin{page}%
|cliptocell| bleeds
\par%
\vspace{6mm}%
\setlength\fboxsep{0pt}%
\fbox{%
\begin{inlinecell*}{\cellsize}{\cellsize}%
\imagecell[fill, clearance=-6mm]{\CaptionBox[no clip]}{landscape}%
\end{inlinecell*}}%
\hspace{1cm}%
\fbox{%
\begin{inlinecell*}{\cellsize}{\cellsize}%
\begin{cliptocell}%
\imagecell[fill, clearance=-6mm]{\CaptionBox[default=0pt]}{landscape}%
\end{cliptocell}%
\end{inlinecell*}}%
\hspace{1cm}%
\fbox{%
\begin{inlinecell*}{\cellsize}{\cellsize}%
\begin{cliptocell}[5mm]%
\imagecell[fill, clearance=-6mm]{\CaptionBox[5mm]}{landscape}%
\end{cliptocell}%
\end{inlinecell*}}%
\hspace{1cm}%
\fbox{%
\begin{inlinecell*}{\cellsize}{\cellsize}%
\begin{cliptocell}[1mm 5mm]%
\imagecell[fill, clearance=-6mm]{\CaptionBox[1mm 5mm]}{landscape}%
\end{cliptocell}%
\end{inlinecell*}}%
\hspace{1cm}%
\fbox{%
\begin{inlinecell*}{\cellsize}{\cellsize}%
\begin{cliptocell}[1mm 2mm 3mm 4mm]%
\imagecell[fill, clearance=-6mm]{\CaptionBox[1mm 2mm 3mm 4mm]}{landscape}%
\end{cliptocell}%
\end{inlinecell*}}%
\end{page}%
\begin{page}%
% XXX this is padded by 1mm for some reason -- not sure if it's the
% image or the enclosing cell...
\fbox{%
\begin{inlinecell*}{\cellsize}{\cellsize}%
\imagecell[fit]{}{landscape}%
\end{inlinecell*}}%
\hspace{1cm}%
\fbox{%
\begin{inlinecell*}{\cellsize}{\cellsize}%
\imagecell[fit, clearance=-1mm -2mm -3mm -4mm]{}{landscape}%
\end{inlinecell*}}%
\end{page}%
\end{document} %-------------------------------------------------------
% vim:set ts=4 sw=4 :

View File

@ -0,0 +1,30 @@
%----------------------------------------------------------------------
\documentclass[
layoutmode=cover,
spinewidth=20mm,
spinefold=7mm,
coverboardgrow=3mm,
coverflap=17mm,
% page size...
blockwidth=240mm, blockheight=220mm,
bleed=4mm,
bindingoffset=5mm,
% image block configuration...
imageblockwidth=0.98, imageblockheight=0.98,
imageblockoffsettop=-0.1,
% misc...
9pt,final,openany
]{photobook}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{document}
\GenerateTemplate
\end{document}
%----------------------------------------------------------------------
% vim:set ts=4 sw=4 :

View File

@ -21,7 +21,40 @@
\begin{document} \begin{document}
\GenerateTemplate \begin{page}
\begin{frontcover}
% NOTE: in the real world there is no need to extend the bleeds
% all the way to the end of the flaps, they need to go
% only 2-4 millimeters under the endpaper to account for
% cut and alignment errors...
\begin{cliptocell}[0mm {\coverflap} {\coverflap} {\coverflap}]
\imagecell[fill, clearance=-\coverflap]{}{landscape}
% title...
\begin{zinlinecell}
\begin{center}
\vfill
\color{white}
\Huge TITLE TEXT
\vfill
\end{center}
\end{zinlinecell}
\end{cliptocell}
\end{frontcover}
\begin{spine}
\begin{cliptocell}[0mm \coverflap]
\imagecell[fill, clearance=-\coverflap]{}{landscape}
\end{cliptocell}
\end{spine}
\begin{backcover}
\begin{cliptocell}[{\coverflap} {\coverflap} 0mm {\coverflap}]
\imagecell[fill, clearance=-\coverflap]{}{landscape}
\end{cliptocell}
\end{backcover}
\textblockrulecolour{white}
\textcolor{white}
\GenerateTemplate
\end{page}
\end{document} \end{document}

View File

@ -37,7 +37,7 @@
\end{inlinecell}% \end{inlinecell}%
\hspace{\textblockmargin}% \hspace{\textblockmargin}%
\begin{inlinecell}{0.75\cellwidth - \textblockmargin + \bleed}{\cellheight}% \begin{inlinecell}{0.75\cellwidth - \textblockmargin + \bleed}{\cellheight}%
\imagecell[fill]{}{DSC00403-2}% \imagecell[fill]{}{landscape}%
\end{inlinecell} \end{inlinecell}
\end{spreadtopages} \end{spreadtopages}
@ -45,7 +45,7 @@
\begin{spreadtopages}% \begin{spreadtopages}%
\hspace{-\bleed}% \hspace{-\bleed}%
\begin{inlinecell}{0.75\cellwidth - \textblockmargin + \bleed}{\cellheight}% \begin{inlinecell}{0.75\cellwidth - \textblockmargin + \bleed}{\cellheight}%
\imagecell[fill]{}{DSC00403-2}% \imagecell[fill]{}{landscape}%
\end{inlinecell}% \end{inlinecell}%
\hspace{\textblockmargin}% \hspace{\textblockmargin}%
\begin{inlinecell}{0.25\cellwidth}{\cellheight}% \begin{inlinecell}{0.25\cellwidth}{\cellheight}%

View File

@ -28,8 +28,8 @@
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\edef\TestImage{DSC00403-2} \edef\TestImage{landscape}
\edef\TestImageV{DSC00403-2vert} \edef\TestImageV{portrait}
\newcommand\Chapter[1]{ \newcommand\Chapter[1]{

View File

@ -0,0 +1,27 @@
%----------------------------------------------------------------------
\documentclass[
layoutmode=endpaper,
% page size...
blockwidth=240mm, blockheight=220mm,
bleed=4mm,
bindingoffset=5mm,
% image block configuration...
imageblockwidth=0.98, imageblockheight=0.98,
imageblockoffsettop=-0.1,
% misc...
9pt,final,openany
]{photobook}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{document}
\GenerateTemplate
\end{document}
%----------------------------------------------------------------------
% vim:set ts=4 sw=4 :

View File

@ -14,14 +14,52 @@
]{photobook} ]{photobook}
\begin{document} % - - - - - - - - - - - - - - - - - - - - - - - - - - -
% the simplest way to fill...
\ImagePageFill{}{landscape}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{document} % manual...
% NOTE: to fill the page the image cell needs to be placed relative to
% the page (papercell / pagecell) and not the text (page env)
\begin{page}
\begin{papercell}
\imagecell[fill, clearance=-\bleed]{}{landscape}
\end{papercell}
\end{page}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% control #1 -- works fine...
\begin{page}
\begin{leftside}
\imagecell[fit]{}{landscape}
\end{leftside}
\begin{rightside}
\imagecell[fit]{}{landscape}
\end{rightside}
\end{page}
\begin{page}
\begin{leftside}
\imagecell[fill, right, clearance=\cliptocellclearances]{}{landscape}
\end{leftside}
\begin{rightside}
\imagecell[fill, left, clearance=\cliptocellclearances]{}{landscape}
\end{rightside}
\end{page}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\GenerateTemplate \GenerateTemplate
\end{document}
\end{document} %-------------------------------------------------------
%----------------------------------------------------------------------
% vim:set ts=4 sw=4 : % vim:set ts=4 sw=4 :

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
version="1.1"
id="svg1"
width="3840"
height="5495"
viewBox="0 0 3840 5495"
sodipodi:docname="Johannes Vermeer - The Girl With The Pearl Earring (1665).svg"
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
inkscape:export-filename="Johannes Vermeer - The Girl With The Pearl Earring (1665).png"
inkscape:export-xdpi="50"
inkscape:export-ydpi="50"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath2">
<path
style="fill:none;stroke:#ffffff;stroke-width:15.1181;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
d="M 1920,0 0,2747.5 1920,5495 3840,2747.5 Z"
id="path3" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath6">
<rect
style="fill:none;stroke:#ffffff;stroke-width:60.4724;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
id="rect7"
width="500"
height="500"
x="318.06506"
y="257.89059" />
</clipPath>
</defs>
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showguides="true"
inkscape:zoom="0.11632839"
inkscape:cx="1916.9868"
inkscape:cy="2750.8331"
inkscape:window-width="2048"
inkscape:window-height="1115"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g1" />
<g
inkscape:groupmode="layer"
inkscape:label="Image"
id="g1">
<image
width="3840"
height="5495"
preserveAspectRatio="none"
xlink:href="Johannes%20Vermeer%20-%20The%20Girl%20With%20The%20Pearl%20Earring%20(1665).jpg"
id="image1"
sodipodi:insensitive="true"
style="display:inline" />
<g
id="g5"
inkscape:label="large diamond">
<path
style="fill:none;stroke:#000000;stroke-width:60.47244094;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke;stroke-linejoin:miter;stroke-miterlimit:10;stroke-linecap:square"
d="M 1920,0 0,2747.5 1920,5495 3840,2747.5 Z"
id="path1"
clip-path="none"
inkscape:label="black diamond" />
<path
style="fill:none;stroke:#ffffff;stroke-width:30.23622047;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke;stroke-linejoin:miter;stroke-miterlimit:10;stroke-linecap:square"
d="M 1920,0 0,2747.5 1920,5495 3840,2747.5 Z"
id="path4"
clip-path="url(#clipPath2)"
inkscape:label="white diamond" />
</g>
<g
id="g9"
inkscape:label="small diamond">
<rect
style="fill:none;stroke:#000000;stroke-width:60.4724;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
id="rect8"
width="500"
height="500"
x="250"
y="-250"
clip-path="none"
transform="rotate(45)" />
<rect
style="fill:none;stroke:#ffffff;stroke-width:60.4724;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
id="rect5"
width="500"
height="500"
x="318.06506"
y="257.89059"
clip-path="url(#clipPath6)"
transform="rotate(45,647.11071,171.7835)" />
</g>
<use
x="0"
y="0"
xlink:href="#g9"
id="use9"
transform="translate(3132.8932)" />
<use
x="0"
y="0"
xlink:href="#g9"
id="use10"
transform="translate(3132.8932,4787.8932)" />
<use
x="0"
y="0"
xlink:href="#g9"
id="use11"
transform="translate(2.0565886e-5,4789.4527)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 KiB

View File

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
version="1.1"
id="svg1"
width="2000"
height="1350"
viewBox="0 0 2000 1350"
sodipodi:docname="Katsushika Hokusai - The Great Wave off Kanagawa.svg"
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
inkscape:export-filename="Katsushika Hokusai - The Great Wave off Kanagawa.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath6">
<rect
style="fill:none;stroke:#ffffff;stroke-width:60.4724;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
id="rect7"
width="500"
height="500"
x="318.06506"
y="257.89059" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1">
<rect
style="fill:none;stroke:#ffffff;stroke-width:60.4724;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
id="rect1"
width="500"
height="500"
x="318.06506"
y="257.89059" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath3">
<rect
style="fill:none;stroke:#ffffff;stroke-width:60.4724;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
id="rect3"
width="500"
height="500"
x="318.06506"
y="257.89059" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath4">
<path
style="fill:none;stroke:#ffffff;stroke-width:15.1181;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
d="M 1920,0 0,2747.5 1920,5495 3840,2747.5 Z"
id="path3" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath5">
<use
x="0"
y="0"
xlink:href="#g2"
id="use5" />
</clipPath>
</defs>
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="0.66962963"
inkscape:cx="1000.5531"
inkscape:cy="675"
inkscape:window-width="2048"
inkscape:window-height="1115"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g1" />
<g
inkscape:groupmode="layer"
inkscape:label="Image"
id="g1">
<image
width="2000"
height="1350"
preserveAspectRatio="none"
xlink:href="Katsushika%20Hokusai%20-%20The%20Great%20Wave%20off%20Kanagawa.jpg"
id="image1"
style="display:inline" />
<g
id="g5"
inkscape:label="large diamond"
transform="matrix(0.52086102,0,0,0.24566116,-0.05316214,0.04597332)"
style="display:inline">
<path
style="display:inline;fill:none;stroke:#000000;stroke-width:60.4724;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
d="M 1920,0 0,2747.5 1920,5495 3840,2747.5 Z"
id="path1"
clip-path="none"
inkscape:label="black" />
<g
id="g3"
clip-path="url(#clipPath5)"
inkscape:label="white"
style="display:inline">
<g
inkscape:label="Clip"
id="g2">
<path
style="display:inline;fill:none;stroke:#ffffff;stroke-width:30.2362;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
d="M 1920,0 0,2747.5 1920,5495 3840,2747.5 Z"
id="path4"
clip-path="none"
inkscape:label="white diamond" />
</g>
</g>
</g>
<g
id="g9"
inkscape:label="small diamond"
transform="matrix(0.31062245,0,0,0.31062245,3.6225648,2.1883219)"
style="display:inline">
<rect
style="fill:none;stroke:#000000;stroke-width:60.4724;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
id="rect8"
width="500"
height="500"
x="250"
y="-250"
clip-path="none"
transform="rotate(45)" />
<rect
style="fill:none;stroke:#ffffff;stroke-width:60.4724;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
id="rect5"
width="500"
height="500"
x="318.06506"
y="257.89059"
clip-path="url(#clipPath6)"
transform="rotate(45,647.11071,171.7835)" />
</g>
<use
x="0"
y="0"
xlink:href="#g9"
id="use9"
transform="translate(1776.7342,-2.1240179)" />
<use
x="0"
y="0"
xlink:href="#g9"
id="use10"
transform="translate(1776.7342,1128.1684)" />
<use
x="0"
y="0"
xlink:href="#g9"
id="use11"
transform="translate(-3.6225648,1128.1684)"
style="display:inline" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -24,18 +24,18 @@
\begin{page} \begin{page}
\begin{frontcover} \begin{frontcover}
\begin{cliptocell} \begin{cliptocell}[0mm \bleed]
\imagecell[fill]{}{DSC00403-2} \imagecell[fill, clearance=-\bleed]{}{landscape}
\end{cliptocell} \end{cliptocell}
\end{frontcover} \end{frontcover}
\begin{backcover} \begin{backcover}
\begin{cliptocell} \begin{cliptocell}[0mm \bleed]
\imagecell[fill]{}{DSC00403-2} \imagecell[fill, clearance=-\bleed]{}{landscape}
\end{cliptocell} \end{cliptocell}
\end{backcover} \end{backcover}
\begin{spine} \begin{spine}
\begin{cliptocell} \begin{cliptocell}[0mm \bleed]
\imagecell[fill]{}{DSC00403-2} \imagecell[fill, clearance=-\bleed]{}{landscape}
\end{cliptocell} \end{cliptocell}
\end{spine} \end{spine}
\begin{frontflap} \begin{frontflap}

BIN
examples/landscape.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 MiB

BIN
examples/portrait.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 MiB

View File

@ -19,8 +19,8 @@
\setlength\parindent{0pt} \setlength\parindent{0pt}
\edef\TestImage{DSC00403-2} \edef\TestImage{landscape}
\edef\TestImageV{DSC00403-2vert} \edef\TestImageV{portrait}
\writeimagelistfalse \writeimagelistfalse

View File

@ -19,8 +19,8 @@
\setlength\parindent{0pt} \setlength\parindent{0pt}
\edef\TestImage{DSC00403-2} \edef\TestImage{landscape}
\edef\TestImageV{DSC00403-2vert} \edef\TestImageV{portrait}
\writeimagelistfalse \writeimagelistfalse

View File

@ -0,0 +1,44 @@
%----------------------------------------------------------------------
\documentclass[
layoutmode=block,
% page size...
blockwidth=240mm, blockheight=220mm,
bleed=4mm,
gutteroffset=5mm,
bindingoffset=0mm,
% image block configuration...
imageblockwidth=0.98, imageblockheight=0.98,
imageblockoffsettop=0,
% misc...
9pt,final,openany
]{photobook}
\usepackage{lipsum}
\usepackage{ragged2e}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\edef\TestImage{landscape}
%----------------------------------------------------------------------
\begin{document}
% force what's next to left page of spread...
\cleartoleftpage
% text...
\begin{page}
\lipsum[1-3]
\end{page}
% image...
\ImagePage{}{\TestImage}
%----------------------------------------------------------------------
\end{document} % vim:set ts=4 sw=4 :

View File

@ -19,8 +19,8 @@
\setlength\parindent{0pt} \setlength\parindent{0pt}
\edef\TestImage{DSC00403-2} \edef\TestImage{landscape}
\edef\TestImageV{DSC00403-2vert} \edef\TestImageV{portrait}
\writeimagelistfalse \writeimagelistfalse

View File

@ -38,16 +38,30 @@
% %
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% %
%
% XXX ASAP: imagecell: photobook@imagecell@left and photobook@imagecell@top
% should explicitly account for clearence@left and clearence@top resp.
% XXX ASAP: imagecell: clearance should have the same semantics as cliptocell
% offsts...
% (CLEARANCE)
% XXX ASAP should cover/jacket/endpaper/spread cells set default cliptocell
% bleeds???
% XXX ASAP: should \blockwidth include \bindingoffset (current) or not???
% ...currently I think that no, as \blockwidth indicates the outer
% width of the block, and this poses the question:
% should \pagewidth include \bindingoffset???
% XXX ASAP should cover/jacket/endpaper/spread templates/cells account % XXX ASAP should cover/jacket/endpaper/spread templates/cells account
% for \bindingoffset (likely no) and/or \gutteroffset ??? % for \bindingoffset (likely no) and/or \gutteroffset ???
% ...especially relevant to endpaper/spread... % ...especially relevant to endpaper/spread...
% XXX ASAP revise how bleeds are handled by cells... % XXX ASAP revise how bleeds are handled by cells...
% ...all cells should ignore bleeds unless explicitly stated
% otherwise -- needs testing...
%
% %
% XXX captions behave in an odd way... % XXX captions behave in an odd way...
% the internal (macro) minipage for some reason does not affect text % the internal (macro) minipage for some reason does not affect text
% justification while adding a minipage in the macro argument works % justification while adding a minipage in the macro argument works
% as expected -- some odd input mode??? % as expected -- some odd input mode???
% XXX Q: should \blockwidth include \bindingoffset (current) or not???
% XXX revise \clearcaption / \captionclearpage... % XXX revise \clearcaption / \captionclearpage...
% XXX unify API -- see CellContent env... % XXX unify API -- see CellContent env...
% XXX make this loadable both as a class and as a package... % XXX make this loadable both as a class and as a package...
@ -75,12 +89,25 @@
% cell/cell* depend on absolute mode being set globally % cell/cell* depend on absolute mode being set globally
% %
% %
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%
% Work around an issue with calc's \ratio{..}{..} breaking into an
% "Arythmetic overflow" when working with large images.
% (see Issues section for more info)
%
% NOTE: if the error persists just make this smaller but note that the
% smaller this gets the greater the error can be for very small
% images
%
\def\CalcOverflowFactor{0.1}%
%---------------------------------------------------------------------- %----------------------------------------------------------------------
%%% NOTE: \def\<module-name>@[A-Z]+ macros will be visible to both the %%% NOTE: \def\<module-name>@[A-Z]+ macros will be visible to both the
%%% code and the generated docs... %%% code and the generated docs...
\edef\photobook@FILEVERSION{v0.1.18} \edef\photobook@FILEVERSION{v0.1.31}
\edef\photobook@FILEDATE{2023-04-11} \edef\photobook@FILEDATE{2024-07-19}
%% \documentclass{ltxdoc} %% \documentclass{ltxdoc}
@ -118,8 +145,8 @@
%%% \newcommand\DescribeGlobal[1]{% %%% \newcommand\DescribeGlobal[1]{%
%%% \DescribeMacro{#1}} %%% \DescribeMacro{#1}}
%% %%
%% \newcommand\LEGACY[1][]{\fbox{LEGACY #1}} %% \newcommand\LEGACY[1][]{\fbox{LEGACY\ifstrempty{#1}{}{ #1}}}
%% \newcommand\EXPERIMENTAL[1][]{\fbox{EXPERIMENTAL #1}} %% \newcommand\EXPERIMENTAL[1][]{\fbox{EXPERIMENTAL\ifstrempty{#1}{}{ #1}}}
%% %%
%%% sections to new pages... %%% sections to new pages...
%% \newcommand\sectionbreak{\Needspace{5\baselineskip}} %% \newcommand\sectionbreak{\Needspace{5\baselineskip}}
@ -235,26 +262,27 @@
%% \begin{minipage}{\textwidth} %% \begin{minipage}{\textwidth}
%% \begin{verbatim} %% \begin{verbatim}
%% %%
%% <-------------------------------------------------> paperwidth
%% <---> bleed <---> bleed %% <---> bleed <---> bleed
%% %% paperheight v
%% + - - - - - - - - - - - - - - - - - - - - - - + - + ^ %% + - - - - - - - - - - - - - - - - - - - - - - + - + ^ . . . ---
%% . . . | bleed %% . . . | bleed .
%% . +-----------------------------------------+----- v . . --- %% . +-----------------------------------------+----- v . . ---
%% . | ^ . . = . %% . | ^ . . = . .
%% . | . . . . . . | . . . = . ^ %% . | . . . . . . | . . . = . ^
%% . |<-- blockwidth ------------------------->= . | %% . |<-- blockwidth ------------------------->= . | .
%% . | . | . . . = . | %% . | . | . . . = . |
%% . | | . . = . textheight %% . | | . . = . textheight .
%% . | . Page | . . . = . | %% . | . Page | . . . = . |
%% . | blockheight . . = . | %% . | blockheight . . = . | .
%% . | . | . . <--> bindingoffset | %% . | . | . . <--> bindingoffset |
%% . | | . . = . | %% . | | . . = . | .
%% . | . . . . . . | . <--> gutteroffset v %% . | . . . . . . | . <--> gutteroffset v
%% . | v . . = . %% . | v . . = . .
%% . +-----------------------------------------+----- ^ . . --- %% . +-----------------------------------------+----- ^ . . ---
%% . . . . | bleed %% . . . . | bleed .
%% + - - - - - - - - - - - - - - - - - - - - - - + - + v %% + - - - - - - - - - - - - - - - - - - - - - - + - + v . . . ---
%% . . %% . . ^
%% | <-- textwidth --------------> . | %% | <-- textwidth --------------> . |
%% ^ gutter %% ^ gutter
%% %%
@ -265,6 +293,9 @@
%% account for |\gutteroffset|, namely macros that do not display content %% account for |\gutteroffset|, namely macros that do not display content
%% with bleeds. %% with bleeds.
%% %%
%% Also note that bleeds are included in \href{https://ctan.org/pkg/geometry}{geometry}'s
%% |\paperwidth| and |\paperheight|.
%%
% NOTE: if blockwidth/blockheight are set they will force recalculations % NOTE: if blockwidth/blockheight are set they will force recalculations
% and overriding of the paperwidth/paperheight if they were changed % and overriding of the paperwidth/paperheight if they were changed
% by the user code anywhere between \documentclass[..]{photobook} % by the user code anywhere between \documentclass[..]{photobook}
@ -377,9 +408,10 @@
%% %%
%% blockwidth blockwidth %% blockwidth blockwidth
%% <---------------> <---------------> %% <---------------> <--------------->
%% <-> coverboardgrow <-> coverboardgrow %% <-> coverboardgrow. . <-> coverboardgrow
%% <-> coverflap . <-> coverflap %% <-> coverflap . . . <-> coverflap
%% . . . . . . %% . . . . . . . .
%% .xx . xx xx . xx. ] fold marks
%% +-------------------++---++-------------------+ --- %% +-------------------++---++-------------------+ ---
%% | + - - - - - - - - ++ - ++ - - - - - - - - + | --^ coverflap %% | + - - - - - - - - ++ - ++ - - - - - - - - + | --^ coverflap
%% | . + - - - - - - - ++ - ++ - - - - - - - + . | --^ coverboardgrow %% | . + - - - - - - - ++ - ++ - - - - - - - + . | --^ coverboardgrow
@ -391,6 +423,7 @@
%% | . + - - - - - - - ++ - ++ - - - - - - - + . | --v coverboardgrow %% | . + - - - - - - - ++ - ++ - - - - - - - + . | --v coverboardgrow
%% | + - - - - - - - - ++ - ++ - - - - - - - - + | --v coverflap %% | + - - - - - - - - ++ - ++ - - - - - - - - + | --v coverflap
%% +-------------------++---++-------------------+ --- %% +-------------------++---++-------------------+ ---
%% xx xx xx xx ] fold marks
%% . . %% . .
%% ^. .^ spinefold %% ^. .^ spinefold
%% . . %% . .
@ -416,8 +449,9 @@
%% . . . . %% . . . .
%% . . blockwidth blockwidth . . %% . . blockwidth blockwidth . .
%% . . <---------------> <---------------> . . %% . . <---------------> <---------------> . .
%% . .<-> coverboardgrow <-> coverboardgrow %% . .<-> coverboardgrow. . <-> coverboardgrow
%% . . . . . . %% . . . . . . . .
%% . xx . .x x. . xx . ] fold marks
%% +---++-----------------++---++-----------------++---+ --- %% +---++-----------------++---++-----------------++---+ ---
%% | .. + - - - - - - - ++ - ++ - - - - - - - + .. | --^ coverboardgrow %% | .. + - - - - - - - ++ - ++ - - - - - - - + .. | --^ coverboardgrow
%% | .. . .. .. . .. | ^ %% | .. . .. .. . .. | ^
@ -427,6 +461,7 @@
%% | .. . .. .. . .. | v %% | .. . .. .. . .. | v
%% | .. + - - - - - - - ++ - ++ - - - - - - - + .. | --v coverboardgrow %% | .. + - - - - - - - ++ - ++ - - - - - - - + .. | --v coverboardgrow
%% +---++-----------------++---++-----------------++---+ --- %% +---++-----------------++---++-----------------++---+ ---
%% xx x x xx ] fold marks
%% .. . . .. %% .. . . ..
%% ^ jacketwrap . . ^ jacketwrap %% ^ jacketwrap . . ^ jacketwrap
%% ^. .^ spinefold %% ^. .^ spinefold
@ -900,7 +935,7 @@
%% \DescribeMacro{\imageblockoffsettop=<ratio>} %% \DescribeMacro{\imageblockoffsettop=<ratio>}
% %
%% The ration by which the image is raised in |\ImagePage{..}| and %% The ratio by which the image is raised in |\ImagePage{..}| and
%% derived templates. %% derived templates.
%% %%
\edef\imageblockoffsettop{\photobook@imageblockoffsettop} \edef\imageblockoffsettop{\photobook@imageblockoffsettop}
@ -942,7 +977,13 @@
%% \DescribeMacro{\cellheight=<len>} %% \DescribeMacro{\cellheight=<len>}
%% \DescribeMacro{\celloffsetleft=<len>} %% \DescribeMacro{\celloffsetleft=<len>}
%% \DescribeMacro{\celloffsettop=<len>} %% \DescribeMacro{\celloffsettop=<len>}
%% \DescribeMacro{\clearance=<len>} % XXX EXPERIMENTAL CLEARANCE
%%% \DescribeMacro{\clearanceleft=<len>}
%%% \DescribeMacro{\clearancetop=<len>}
%%% \DescribeMacro{\clearanceright=<len>}
%%% \DescribeMacro{\clearancebottom=<len>}
% XXX revise...
%%% \DescribeMacro{\clearances=<len's>}
% %
%% Cell geometry. %% Cell geometry.
%% %%
@ -963,8 +1004,15 @@
\setlength\celloffsetleft{0pt} \setlength\celloffsetleft{0pt}
\newlength\celloffsettop \newlength\celloffsettop
\setlength\celloffsettop{0pt} \setlength\celloffsettop{0pt}
\newlength\clearance \newlength\clearanceleft
\setlength\clearance{0pt} \setlength\clearanceleft{0pt}
\newlength\clearancetop
\setlength\clearancetop{0pt}
\newlength\clearanceright
\setlength\clearanceright{0pt}
\newlength\clearancebottom
\setlength\clearancebottom{0pt}
\def\clearances{0pt}
%% \DescribeMacro{\clearfoldoutgutter=<len>} %% \DescribeMacro{\clearfoldoutgutter=<len>}
@ -1069,6 +1117,7 @@
% layout: cover... % layout: cover...
\ifcoverlayout \ifcoverlayout
\pagestyle{empty}% \pagestyle{empty}%
% XXX should spinefolds be panels???
\setsepchar{,}% \setsepchar{,}%
\readlist*\pagefoldpanels{% \readlist*\pagefoldpanels{%
\the\coverflap, \the\coverflap,
@ -1102,12 +1151,12 @@
\the\jacketwrap, \the\jacketwrap,
\the\dimexpr \the\dimexpr
\coverboardgrow \coverboardgrow
+ \spinefold
+ \pageblockwidth \relax, + \pageblockwidth \relax,
\the\spinefold,
\the\spinewidth, \the\spinewidth,
\the\spinefold,
\the\dimexpr \the\dimexpr
\coverboardgrow \coverboardgrow
+ \spinefold
+ \pageblockwidth \relax, + \pageblockwidth \relax,
\the\jacketwrap, \the\jacketwrap,
\the\photobook@jacketflapfront@active}% \the\photobook@jacketflapfront@active}%
@ -1124,6 +1173,7 @@
% layout: spread/endpaper... % layout: spread/endpaper...
\ifspreadlayout \ifspreadlayout
\pagestyle{empty}% \pagestyle{empty}%
\setsepchar{,}%
\readlist*\pagefoldpanels{% \readlist*\pagefoldpanels{%
\the\pageblockwidth, \the\pageblockwidth,
\the\pageblockwidth}% \the\pageblockwidth}%
@ -1454,6 +1504,9 @@
%% %%
%% Note that this may span more than one page if there is enough stuff %% Note that this may span more than one page if there is enough stuff
%% packed in. %% packed in.
%% Also note that items within the page environment are placed in the
%% same way as in any normal page, for absolute placement use either
%% specific cells/environments like |papercell| or more generic |call|.
%% %%
\newenvironment{page}{% \newenvironment{page}{%
% XXX do we need \null here??? % XXX do we need \null here???
@ -1537,8 +1590,8 @@
\end{adjustbox}} \end{adjustbox}}
%M \DescribeEnv{CellContent} %M \DescribeEnv{MinipageCellContent}
%M \DescribeEnv{CellContent*} %M \DescribeEnv{MinipageCellContent*}
% %
%M \EXPERIMENTAL %M \EXPERIMENTAL
%M %M
@ -1575,7 +1628,11 @@
%% \DescribeMacro{\cellparentheight=<len>} %% \DescribeMacro{\cellparentheight=<len>}
%% \DescribeMacro{\celloffsettop=<len>} %% \DescribeMacro{\celloffsettop=<len>}
%% \DescribeMacro{\celloffsetleft=<len>} %% \DescribeMacro{\celloffsetleft=<len>}
%% \DescribeMacro{\clearance=<len>} % XXX EXPERIMENTAL CLEARANCE
%%% \DescribeMacro{\clearanceleft=<len>}
%%% \DescribeMacro{\clearancetop=<len>}
%%% \DescribeMacro{\clearanceright=<len>}
%%% \DescribeMacro{\clearancebottom=<len>}
%% %%
%% A cell defines a set of contextual lengths: %% A cell defines a set of contextual lengths:
%% %%
@ -1707,7 +1764,10 @@
\setlength\cellheight{\photobook@protect@h}% \setlength\cellheight{\photobook@protect@h}%
\setlength\celloffsettop{0pt}% \setlength\celloffsettop{0pt}%
\setlength\celloffsetleft{0pt}% \setlength\celloffsetleft{0pt}%
\setlength\clearance{0pt}% \setlength\clearanceleft{0pt}%
\setlength\clearancetop{0pt}%
\setlength\clearanceright{0pt}%
\setlength\clearancebottom{0pt}%
% %
\begin{MinipageCellContent}[\photobook@minipagecell@parentvalign]{minipagecell}% \begin{MinipageCellContent}[\photobook@minipagecell@parentvalign]{minipagecell}%
}{% }{%
@ -1817,6 +1877,9 @@
% %
%% \EXPERIMENTAL %% \EXPERIMENTAL
%% %%
%% This a cell wrapper for |adjustbox|.
%%
% XXX DOC
\newenvironment{adjustcell*}[4][t]{% \newenvironment{adjustcell*}[4][t]{%
\begin{adjustbox}{#2}% \begin{adjustbox}{#2}%
\vspace{0pt}% \vspace{0pt}%
@ -1959,18 +2022,130 @@
\end{inlinecell*}% \end{inlinecell*}%
\end{turn}} \end{turn}}
%% \DescribeEnv{cliptocell} %% \DescribeEnv{cliptocell}
%% \DescribeEnv{setcliptocellbleeds}
% %
%% Clip content to parent cell. %% Clip content to parent cell.
%% %%
\newenvironment{cliptocell}{% %% >> \begin{cliptocell} ... \end{cliptocell}
\begin{clipbox*}{0cm {\height - \cellheight} {\cellwidth} {\height}}% %%
%% Clip content to cell plus offsets (bleeds) from each side
%%
%% >> \begin{cliptocell}[<size>] ... \end{cliptocell}
%% >> \begin{cliptocell}[<horizontal> <vertical>] ... \end{cliptocell}
%% >> \begin{cliptocell}[<left> <bottom> <right> <top>] ... \end{cliptocell}
%%
%% Offset order, i.e. left-bottom-right-top is made consistent with
%% \href{https://ctan.org/pkg/graphicx}{graphicx} and
%% \href{https://ctan.org/pkg/trimclip}{trimclip} modules and represents
%% the bottom-left and top-right viewport point offsets from the parent
%% cell.
%%
%% |cliptocell| does not affect the cell content positioning in any way.
%%
%% This is designed to simplify filling template cells and adding bleeds
%% to certain sides and clipping flush to others, for example for cells
%% of a dust jacket or a foldout, but |cliptocell| is not limited to
%% this one use-case.
%%
\newlength\photobook@cliptocell@left
\setlength\photobook@cliptocell@left{0mm}%
\newlength\photobook@cliptocell@top
\setlength\photobook@cliptocell@top{0mm}%
\newlength\photobook@cliptocell@right
\setlength\photobook@cliptocell@right{0mm}%
\newlength\photobook@cliptocell@bottom
\setlength\photobook@cliptocell@bottom{0mm}%
\def\cliptocellbleeds{{0mm} {0mm} {0mm} {0mm}}%
\def\cliptocellclearances{{0mm} {0mm} {0mm} {0mm}}%
%% Set the default bleeds for |cliptocell| environments
%%
%% >> \setcliptocellbleeds{<size>}
%% >> \setcliptocellbleeds{<horizontal> <vertical>}
%% >> \setcliptocellbleeds{<left> <bottom> <right> <top>}
%%
%% This will only affect |cliptocell| environments on the same level,
%% without affecting the nested |cliptocell|s.
%%
%%% \DescribeEnv{cliptocellbleeds=<left> <bottom> <right> <top>}
%%% \DescribeEnv{cliptocellclearances=<left> <bottom> <right> <top>}
%%%
%%% Set by |\setcliptocellbleeds{..}| and contain bleeds and clearances (negative
%%% clipping bleeds) respectively, usable by imagecell and others.
%%%
%%% XXX still testing....
\newcommand\setcliptocellbleeds[1]{
\setsepchar{ }%
\readlist*\photobook@cliptocell@bleeds{#1}%
\setsepchar{,}%
% args: size
\ifnum \photobook@cliptocell@bleedslen = 1%
\setlength\photobook@cliptocell@left{%
\photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@bottom{%
\photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@right{%
\photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@top{%
\photobook@cliptocell@bleeds[1]}\fi%
% args: horizontal vertical
\ifnum \photobook@cliptocell@bleedslen = 2%
\setlength\photobook@cliptocell@left{%
\photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@bottom{%
\photobook@cliptocell@bleeds[2]}%
\setlength\photobook@cliptocell@right{%
\photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@top{%
\photobook@cliptocell@bleeds[2]}\fi%
% args: left bottom right top
\ifnum \photobook@cliptocell@bleedslen = 4%
\setlength\photobook@cliptocell@left{%
\photobook@cliptocell@bleeds[1]}%
\setlength\photobook@cliptocell@bottom{%
\photobook@cliptocell@bleeds[2]}%
\setlength\photobook@cliptocell@right{%
\photobook@cliptocell@bleeds[3]}%
\setlength\photobook@cliptocell@top{%
\photobook@cliptocell@bleeds[4]}\fi%
% NOTE: trailing spaces here are significant...
% XXX should we use \the here?
% ...it makes things printable...
\def\cliptocellbleeds{%
{\the\photobook@cliptocell@left} %
{\the\photobook@cliptocell@bottom} %
{\the\photobook@cliptocell@right} %
{\the\photobook@cliptocell@top}}%
\def\cliptocellclearances{%
{-\the\photobook@cliptocell@left} %
{-\the\photobook@cliptocell@bottom} %
{-\the\photobook@cliptocell@right} %
{-\the\photobook@cliptocell@top}}}
\newenvironment{cliptocell}[1][0mm]{%
\begingroup%
\setcliptocellbleeds{#1}
% NOTE: the spaces at the end of each line here are significant!!
\begin{trimbox}{{\photobook@cliptocell@left} %
{\photobook@cliptocell@bottom} %
{\photobook@cliptocell@right} %
{\photobook@cliptocell@top}}%
\begin{clipbox*}{{-\photobook@cliptocell@left} %
{\height - \cellheight - \photobook@cliptocell@bottom} %
{\cellwidth + \photobook@cliptocell@right} %
{\height + \photobook@cliptocell@top}}%
% set defaults for nested cells...
\setcliptocellbleeds{0mm}%
\begin{minipage}[t][\cellheight][t]{\cellwidth}% \begin{minipage}[t][\cellheight][t]{\cellwidth}%
\ignorespaces% \ignorespaces%
}{% }{%
\end{minipage}% \end{minipage}%
\end{clipbox*}} \end{clipbox*}%
\end{trimbox}%
\endgroup}
%% \DescribeMacro{\imagecell\{..\}} %% \DescribeMacro{\imagecell\{..\}}
@ -2061,7 +2236,9 @@
%% Image |clearance|. This sets the amount of clearance around an image %% Image |clearance|. This sets the amount of clearance around an image
%% (default: |0pt|). %% (default: |0pt|).
%% %%
%% >> \imagecell[clearance=-4mm]{}{<image>} %% >> \imagecell[clearance=<size>]{}{<image>}
%% >> \imagecell[clearance=<horizontal> <vertical>]{}{<image>}
%% >> \imagecell[clearance=<left> <bottom> <top> <right>]{}{<image>}
%% %%
%% \begin{minipage}{\textwidth} %% \begin{minipage}{\textwidth}
%% \begin{verbatim} %% \begin{verbatim}
@ -2165,8 +2342,15 @@
\def\photobook@imagecell@captiontop{0pt} \def\photobook@imagecell@captiontop{0pt}
\def\photobook@imagecell@captionleft{0pt} \def\photobook@imagecell@captionleft{0pt}
\newlength\photobook@imagecell@clearance % XXX EXPERIMENTAL
\setlength\photobook@imagecell@clearance{0pt} \newlength\photobook@imagecell@clearance@left
\setlength\photobook@imagecell@clearance@left{0pt}
\newlength\photobook@imagecell@clearance@top
\setlength\photobook@imagecell@clearance@top{0pt}
\newlength\photobook@imagecell@clearance@right
\setlength\photobook@imagecell@clearance@right{0pt}
\newlength\photobook@imagecell@clearance@bottom
\setlength\photobook@imagecell@clearance@bottom{0pt}
% NOTE: these feel like a hack... % NOTE: these feel like a hack...
\newlength\photobook@imagecell@imgratio \newlength\photobook@imagecell@imgratio
@ -2181,15 +2365,19 @@
\define@boolkey{imagecell@args}{center}[true]{% \define@boolkey{imagecell@args}{center}[true]{%
\def\photobook@imagecell@top{\dimexpr \def\photobook@imagecell@top{\dimexpr
+0.5\cellheight +0.5\cellheight
+0.5\photobook@imagecell@clearance@top
-0.5\photobook@imagecell@clearance@bottom
-0.5\ht\photobook@imagebox \relax}% -0.5\ht\photobook@imagebox \relax}%
\def\photobook@imagecell@left{\dimexpr \def\photobook@imagecell@left{\dimexpr
+0.5\cellwidth +0.5\cellwidth
+0.5\photobook@imagecell@clearance@left
-0.5\photobook@imagecell@clearance@right
-0.5\wd\photobook@imagebox \relax}}% -0.5\wd\photobook@imagebox \relax}}%
% left/right... % left/right...
% shortdands... % shortdands...
\newcommand\photobook@imagecell@LEFT{% \newcommand\photobook@imagecell@LEFT{%
\def\photobook@imagecell@left{\dimexpr% \def\photobook@imagecell@left{\dimexpr%
+\photobook@imagecell@clearance \relax}% +\photobook@imagecell@clearance@left \relax}%
\def\photobook@imagecell@captionleft{ \def\photobook@imagecell@captionleft{
% XXX not sure why this branch is needed... % XXX not sure why this branch is needed...
\ifKV@imagecell@args@fit \ifKV@imagecell@args@fit
@ -2197,12 +2385,14 @@
\else% \else%
\dimexpr% \dimexpr%
+\cellwidth +\cellwidth
-\photobook@imagecell@clearance -\photobook@imagecell@clearance@left
%-\photobook@imagecell@clearance
-\wd\photobook@imagebox \relax\fi}}% -\wd\photobook@imagebox \relax\fi}}%
\newcommand\photobook@imagecell@RIGHT{% \newcommand\photobook@imagecell@RIGHT{%
\def\photobook@imagecell@left{\dimexpr \def\photobook@imagecell@left{\dimexpr
+\cellwidth +\cellwidth
-\photobook@imagecell@clearance -\photobook@imagecell@clearance@right
%-\photobook@imagecell@clearance
-\wd\photobook@imagebox \relax} -\wd\photobook@imagebox \relax}
% XXX not sure why 0.5 but it seems to work... % XXX not sure why 0.5 but it seems to work...
\def\photobook@imagecell@captionleft{% \def\photobook@imagecell@captionleft{%
@ -2226,7 +2416,7 @@
% top/bottom... % top/bottom...
\define@boolkey{imagecell@args}{top}[true]{% \define@boolkey{imagecell@args}{top}[true]{%
\def\photobook@imagecell@top{% \def\photobook@imagecell@top{%
\photobook@imagecell@clearance}% \photobook@imagecell@clearance@top}%
\def\photobook@imagecell@captiontop{% \def\photobook@imagecell@captiontop{%
-\dimexpr -\dimexpr
+\cellheight +\cellheight
@ -2235,15 +2425,53 @@
\def\photobook@imagecell@top{% \def\photobook@imagecell@top{%
\dimexpr \dimexpr
+\cellheight +\cellheight
-\photobook@imagecell@clearance -\photobook@imagecell@clearance@bottom
%-\photobook@imagecell@clearance
-\ht\photobook@imagebox \relax}% -\ht\photobook@imagebox \relax}%
\def\photobook@imagecell@captiontop{% \def\photobook@imagecell@captiontop{%
\dimexpr \dimexpr
\photobook@imagecell@top \photobook@imagecell@top
+\photobook@imagecell@clearance \relax}}% +\photobook@imagecell@clearance@bottom \relax}}%
% clearance=<len>... % clearance=<len>...
% clearance=<horizontal> <vertical>...
% clearance=<left> <bottom> <right> <top>...
\define@key{imagecell@args}{clearance}{% \define@key{imagecell@args}{clearance}{%
\setlength\photobook@imagecell@clearance{#1}}% % XXX EXPERIMENTAL
% XXX this is essentially the same as \photobook@cliptocell@bleeds -- unite...
\def\photobook@imagecell@clearances{#1}%
\setsepchar{ }%
\readlist*\photobook@imagecell@clearencelist{#1}%
\setsepchar{,}%
%% args: size
\ifnum \photobook@imagecell@clearencelistlen = 1%
\setlength\photobook@imagecell@clearance@left{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@bottom{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@right{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@top{%
\photobook@imagecell@clearencelist[1]}\fi%
% args: horizontal vertical
\ifnum \photobook@imagecell@clearencelistlen = 2%
\setlength\photobook@imagecell@clearance@left{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@bottom{%
\photobook@imagecell@clearencelist[2]}%
\setlength\photobook@imagecell@clearance@right{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@top{%
\photobook@imagecell@clearencelist[2]}\fi%
% args: left bottom right top
\ifnum \photobook@imagecell@clearencelistlen = 4%
\setlength\photobook@imagecell@clearance@left{%
\photobook@imagecell@clearencelist[1]}%
\setlength\photobook@imagecell@clearance@bottom{%
\photobook@imagecell@clearencelist[2]}%
\setlength\photobook@imagecell@clearance@right{%
\photobook@imagecell@clearencelist[3]}%
\setlength\photobook@imagecell@clearance@top{%
\photobook@imagecell@clearencelist[4]}\fi}%
% offsettop=<len> / offsetleft=<len>... % offsettop=<len> / offsetleft=<len>...
% XXX DOC!!! % XXX DOC!!!
@ -2291,10 +2519,12 @@
keepaspectratio, keepaspectratio,
width=\photobook@imagecell@scale\dimexpr width=\photobook@imagecell@scale\dimexpr
\cellwidth \cellwidth
- ((\photobook@imagecell@clearance) * 2) \relax, - \photobook@imagecell@clearance@left
- \photobook@imagecell@clearance@right \relax,
height=\photobook@imagecell@scale\dimexpr height=\photobook@imagecell@scale\dimexpr
\cellheight \cellheight
- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% - \photobook@imagecell@clearance@top
- \photobook@imagecell@clearance@bottom \relax]{#3}}%
% fill... % fill...
\else\ifKV@imagecell@args@fill% \else\ifKV@imagecell@args@fill%
% preload image to get its proportions... % preload image to get its proportions...
@ -2303,8 +2533,9 @@
% NOTE: here we calculate image/cell eccentricity to decide % NOTE: here we calculate image/cell eccentricity to decide
% to fit to width or heigh of cell... % to fit to width or heigh of cell...
% NOTE: did I say that I "love" how LaTeX does basic math?? % NOTE: did I say that I "love" how LaTeX does basic math??
% NOTE: \ratio{..}{..} here can break, see Issues for more info...
\setlength\photobook@imagecell@imgratio{% \setlength\photobook@imagecell@imgratio{%
1pt * \ratio{\wd\photobook@imagebox}{\ht\photobook@imagebox}}% 1pt * \ratio{\CalcOverflowFactor\wd\photobook@imagebox}{\CalcOverflowFactor\ht\photobook@imagebox}}%
\setlength\photobook@imagecell@cellratio{% \setlength\photobook@imagecell@cellratio{%
1pt * \ratio{\cellwidth}{\cellheight}}% 1pt * \ratio{\cellwidth}{\cellheight}}%
\ifdim \photobook@imagecell@imgratio < \photobook@imagecell@cellratio% \ifdim \photobook@imagecell@imgratio < \photobook@imagecell@cellratio%
@ -2312,15 +2543,17 @@
\includegraphics[% \includegraphics[%
keepaspectratio, keepaspectratio,
width=\photobook@imagecell@scale\dimexpr width=\photobook@imagecell@scale\dimexpr
+ \cellwidth \cellwidth
- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% - \photobook@imagecell@clearance@left
- \photobook@imagecell@clearance@right \relax]{#3}}%
\else% \else%
\sbox{\photobook@imagebox}{% \sbox{\photobook@imagebox}{%
\includegraphics[% \includegraphics[%
keepaspectratio, keepaspectratio,
height=\photobook@imagecell@scale\dimexpr height=\photobook@imagecell@scale\dimexpr
+ \cellheight \cellheight
- ((\photobook@imagecell@clearance) * 2) \relax]{#3}}% - \photobook@imagecell@clearance@top
- \photobook@imagecell@clearance@bottom \relax]{#3}}%
\fi\fi\fi% \fi\fi\fi%
% %
\setlength\celloffsetleft{% \setlength\celloffsetleft{%
@ -2363,7 +2596,11 @@
\maxdim{\celloffsetleft}{0pt}}% \maxdim{\celloffsetleft}{0pt}}%
\setlength\celloffsettop{% \setlength\celloffsettop{%
\maxdim{\celloffsettop}{0pt}}% \maxdim{\celloffsettop}{0pt}}%
\setlength\clearance{\photobook@imagecell@clearance}% \setlength\clearanceleft{\photobook@imagecell@clearance@left}
\setlength\clearancetop{\photobook@imagecell@clearance@top}
\setlength\clearanceright{\photobook@imagecell@clearance@right}
\setlength\clearancebottom{\photobook@imagecell@clearance@bottom}
\def\clearances{\photobook@imagecell@clearences}
% clear parent... % clear parent...
% XXX might be a good idea to put this into a special reusable cell... % XXX might be a good idea to put this into a special reusable cell...
\ifphotobook@imagecell@captionclearparent% \ifphotobook@imagecell@captionclearparent%
@ -2822,8 +3059,13 @@
- \photobook@captionblockcell@spacing - \photobook@captionblockcell@spacing
- \cellwidth - \cellwidth
- \clearcaption - \clearcaption
% XXX EXPERIMENTAL CLEARANCE
% XXX this is only present in images... % XXX this is only present in images...
- \clearance \relax% - \clearanceleft
%- \clearanceright
% XXX LEGACY CLEARANCE
%- \clearance
\relax%
\else% \else%
\photobook@captionblockcell@width\fi}% \photobook@captionblockcell@width\fi}%
\setlength\cellparentwidth{% \setlength\cellparentwidth{%
@ -2949,10 +3191,6 @@
%% but will not affect this either in size (block size) or in position %% but will not affect this either in size (block size) or in position
%% (top-left). %% (top-left).
%% %%
%\newenvironment{pagecell}{%
% \begin{cell*}{\bleed,\bleed}{\pageblockwidth}{\pageblockheight}%
%}{%
% \end{cell*}}
\newenvironment{pagecell}{% \newenvironment{pagecell}{%
\begin{cell*}{% \begin{cell*}{%
\bleed + \ifnumodd{\thepage}{\bindingoffset}{0pt},% \bleed + \ifnumodd{\thepage}{\bindingoffset}{0pt},%
@ -3473,6 +3711,7 @@
\begingroup% \begingroup%
\setsepchar{ }% \setsepchar{ }%
\readlist*\photobook@foldout@args{#1}% \readlist*\photobook@foldout@args{#1}%
\setsepchar{,}%
% %
% defaults... % defaults...
\setcounter{photobook@foldoutpanel}{1} \setcounter{photobook@foldoutpanel}{1}
@ -3611,6 +3850,7 @@
% parse args... % parse args...
\setsepchar{-}% \setsepchar{-}%
\readlist*\photobook@foldoutcell@panels{#1}% \readlist*\photobook@foldoutcell@panels{#1}%
\setsepchar{,}%
% %
% auto advance panel... % auto advance panel...
\ifnum \photobook@foldoutcell@panels[1] = 0% \ifnum \photobook@foldoutcell@panels[1] = 0%
@ -3812,7 +4052,9 @@
%%%%% Endpaper cells %%%%% Endpaper cells
% %
%% \DescribeEnv{leftside} %% \DescribeEnv{leftside}
%% \DescribeEnv{leftside*}
%% \DescribeEnv{rightside} %% \DescribeEnv{rightside}
%% \DescribeEnv{rightside*}
% %
%% \begin{minipage}{\textwidth} %% \begin{minipage}{\textwidth}
%% \begin{verbatim} %% \begin{verbatim}
@ -3828,21 +4070,43 @@
%% \end{verbatim} %% \end{verbatim}
%% \end{minipage} %% \end{minipage}
%% %%
%% The non-star versions will clip to bleeds except for the gutter side
%% that has no bleeds.
%%
%% The star versions will not clip.
%%
% XXX for some reason naming these anything starting with endpaper will % XXX for some reason naming these anything starting with endpaper will
% make LaTeX complain that that is already defined... % make LaTeX complain that that is already defined...
% ...collision with bools??? % ...collision with bools???
\newenvironment{leftside}{% \newenvironment{leftside*}{%
\begin{pagecell}% \begin{cell*}%
{\bleed, \bleed}%
{\pageblockwidth}{\pageblockheight}%
}{% }{%
\end{pagecell}} \end{cell*}}
\newenvironment{leftside}{%
\begin{leftside*}%
\begin{cliptocell}[{\bleed} {\bleed} 0mm {\bleed}]%
\setcliptocellbleeds{{\bleed} {\bleed} 0mm {\bleed}}%
}{%
\end{cliptocell}
\end{leftside*}}
\newenvironment{rightside}{% \newenvironment{rightside*}{%
\begin{cell*}% \begin{cell*}%
{\bleed + \pageblockwidth, \bleed}% {\bleed + \pageblockwidth, \bleed}%
{\pageblockwidth}{\pageblockheight}% {\pageblockwidth}{\pageblockheight}%
}{% }{%
\end{cell*}} \end{cell*}}
\newenvironment{rightside}{%
\begin{rightside*}%
\begin{cliptocell}[0mm {\bleed} {\bleed} {\bleed}]%
\setcliptocellbleeds{0mm {\bleed} {\bleed} {\bleed}}%
}{%
\end{cliptocell}
\end{rightside*}}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -4021,6 +4285,14 @@
% XXX Document metadata -- move to globals... % XXX Document metadata -- move to globals...
% XXX Use LaTeX generic metadata... % XXX Use LaTeX generic metadata...
%% \DescribeMacro{BookType=<text>}
%
%% Used in page macro text to indicate the type of document built, by default
%% this is set to |book| for the most common case but can be set to anything
%% (e.g. |brochure|, |magazine|, |presentation|, ...etc.)
%%
\def\BookType{book}
%% \DescribeMacro{BookTitle=<text>} %% \DescribeMacro{BookTitle=<text>}
\def\BookTitle{} \def\BookTitle{}
%% \DescribeMacro{BookVersion=<text>} %% \DescribeMacro{BookVersion=<text>}
@ -4045,8 +4317,8 @@
Copyright \textcopyright \ \BookYear \ \BookAuthors; All Rights Reserved. Copyright \textcopyright \ \BookYear \ \BookAuthors; All Rights Reserved.
\ifx \License \empty% \ifx \License \empty%
No part of this book may be reproduced in any form without written permission No part of this \BookType\ may be reproduced in any form without written permission
of the author except for use for brief quotation in a book review. of the author except for use for brief quotation in a review.
\else% \else%
\License\fi} \License\fi}
@ -4056,7 +4328,7 @@
\def\BookFonts{} \def\BookFonts{}
%% \DescribeMacro{SoftwareNotice=<text>} %% \DescribeMacro{SoftwareNotice=<text>}
\def\SoftwareNotice{% \def\SoftwareNotice{%
This book was designed and laid out using open source This \BookType\ was designed and laid out using open source
\ifx \BookFonts \empty\else \ifx \BookFonts \empty\else
fonts and\fi fonts and\fi
software including: software including:
@ -4595,8 +4867,9 @@
% align center -> check if image fits vertically... % align center -> check if image fits vertically...
\ifphotobook@ImagePageFit@centered\else% \ifphotobook@ImagePageFit@centered\else%
\sbox{\photobook@imagebox}{\includegraphics{#3}}% \sbox{\photobook@imagebox}{\includegraphics{#3}}%
% NOTE: \ratio{..}{..} here can break, see Issues for more info...
\setlength\photobook@ImagePageFit@imgratio{% \setlength\photobook@ImagePageFit@imgratio{%
1pt * \ratio{\wd\photobook@imagebox}{\ht\photobook@imagebox}}% 1pt * \ratio{\CalcOverflowFactor\wd\photobook@imagebox}{\CalcOverflowFactor\ht\photobook@imagebox}}%
% NOTE: subtracting \bindingoffset from \cellwidth here makes sure that % NOTE: subtracting \bindingoffset from \cellwidth here makes sure that
% we avoid offsetting images close enough in ratio to the page and % we avoid offsetting images close enough in ratio to the page and
% messing up bleeds... % messing up bleeds...
@ -4611,7 +4884,8 @@
%\clearpage% %\clearpage%
\begin{page}% \begin{page}%
% NOTE: this does not account for \bindingoffset... % NOTE: this does not account for \bindingoffset...
\begin{pagecell}% % XXX should this be a page or a paper cell???
\begin{papercell}%
\imagecell[% \imagecell[%
center, center,
clearance=-\bleed, clearance=-\bleed,
@ -4620,7 +4894,7 @@
offsetleft=\imageoffsetleft, offsetleft=\imageoffsetleft,
captionclearparent=\captionclearpage, captionclearparent=\captionclearpage,
#1]{#2}{#3}% #1]{#2}{#3}%
\end{pagecell}% \end{papercell}%
\end{page}% \end{page}%
% special case: centered vertical image -> account for \bindingoffset... % special case: centered vertical image -> account for \bindingoffset...
\else% \else%
@ -5201,6 +5475,10 @@
%% %%
%% This is a no-op for |layoutmode=block|. %% This is a no-op for |layoutmode=block|.
%% %%
%% To change text color set |\textcolor{<color>}| the usual way and for
%% line and fill colors use |\textblockrulecolour{<color>}| and
%% |\textblockcolour{<colour>}| respecitvely.
%%
% XXX should digits/rounding be configurable??? % XXX should digits/rounding be configurable???
\newcommand\photobook@TemplateCell[2][mm]{ \newcommand\photobook@TemplateCell[2][mm]{
\begin{center} \begin{center}
@ -5424,7 +5702,7 @@
%% \DescribeMacro{\TEX} %% \DescribeMacro{\TEX}
%% \DescribeMacro{\LATEX} %% \DescribeMacro{\LATEX}
% %
%% Convenience macros to display \TeX and \LaTeX in the correct font. %% Convenience macros to display \TeX\ and \LaTeX\ in the correct font.
%% %%
\def\TEX{% \def\TEX{%
{\fontfamily{lmr}\selectfont \TeX}} {\fontfamily{lmr}\selectfont \TeX}}
@ -5433,6 +5711,26 @@
%----------------------------------------------------------------------
%%%% Issues
%
%% \subsection*{Large images can cause ``Arythmetic overflow"}
%
%% \DescribeMacro{\CalcOverflowFactor=0.1}
%
%% If the issue occurs set |\CalcOverflowFactor| to a smaller value.
%% But note, a value too small can lead to errors in the affected macros,
%% a good value is between 0.1 and 0.01.
%%
%% Also note that it is recommended to pre-size images the print outside
%% of \LaTeX.
%%
%% Affected macros: |\imagecell[fill]{..}{..}|, |\ImagePageFit|.
%%
% The issue occurs in the calc's |\ratio{..}{..}| macro when calculating
% image proportions.
%
%
%---------------------------------------------------------------------- %----------------------------------------------------------------------
% Index... % Index...
% %

View File

@ -137,7 +137,7 @@ or multiples, ...etc.? At this stage this is about the presentation,
the flow of the work and not about the actual design. How many typical the flow of the work and not about the actual design. How many typical
spreads (i.e. spread templates) should it have? A good number should be spreads (i.e. spread templates) should it have? A good number should be
small-ish, for example 3-4 spread templates is a good number, if you small-ish, for example 3-4 spread templates is a good number, if you
count 10+ then you might be overcomplicating tings, but note, there are count 10+ then you might be overcomplicating things, but note, there are
no rules, a book where each spread is individually and manually layed out no rules, a book where each spread is individually and manually layed out
may work as well as a book with just a single template spread, but in may work as well as a book with just a single template spread, but in
general for a photo book the focus is on the project and the layout general for a photo book the focus is on the project and the layout
@ -344,6 +344,8 @@ IMAGE_FORMATS=jpeg|jpg|png|pdf|svg|eps
SPREADS_DIR=spreads/ SPREADS_DIR=spreads/
# if non-empty link link images to matching ones from this directory... # if non-empty link link images to matching ones from this directory...
# NOTE: this is ignored if --graphicx-path is passed or GRAPHICX_PATH
# is set.
IMAGE_HIRES_DIR= IMAGE_HIRES_DIR=
# directory where external captions are stored... # directory where external captions are stored...
@ -370,6 +372,10 @@ IMAGE_SPREAD=(
[0]=text-spread [0]=text-spread
[2]=image-image [2]=image-image
) )
# if set (or --graphicx-path is passed) the images are identified by their
# basename so as to let graphicx package resolve the paths internally.
GRAPHICX_PATH=1
``` ```
An explicit configuration file can be manually specified: An explicit configuration file can be manually specified:

View File

@ -54,13 +54,6 @@ printhelp(){
echo " in both the repo and in installed form, so .dtx is not used." echo " in both the repo and in installed form, so .dtx is not used."
} }
# Usage: printerror MESSAGE...
printerror(){
echo Error: $@
echo
printusage
}
# Usage: printmsg TEXT # Usage: printmsg TEXT
printmsg(){ printmsg(){
# print message... # print message...
@ -88,21 +81,23 @@ while true ; do
;; ;;
-p|--prefix) -p|--prefix)
PREFIX=$2 PREFIX=$2
shift shift 2
shift continue
;; ;;
-s|--strip) -s|--strip)
STRIP_DOC=1 STRIP_DOC=1
shift shift
continue
;; ;;
-n|--no-msg) -n|--no-msg)
NO_MSG=1 NO_MSG=1
shift shift
continue
;; ;;
# handle unknown options... # handle unknown options...
-*|--*) -*|--*)
printerror "unknown option \"$1\"" echo "Error: unknown option: \"$1\"" >&2
exit exit
;; ;;

102
scripts/make-spreads.sh Normal file → Executable file
View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
shopt -s nullglob extglob shopt -s nullglob extglob
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -56,9 +56,11 @@ ANOTATE_IMAGE_PATHS=${ANOTATE_IMAGE_PATHS:=}
# supported formats/extensions... # supported formats/extensions...
TEXT_FORMATS=${TEXT_FORMATS:=$CFG_TEXT_FORMATS} TEXT_FORMATS=${TEXT_FORMATS:=$CFG_TEXT_FORMATS}
TEXT_FORMATS=${TEXT_FORMATS:=txt} TEXT_FORMATS=${TEXT_FORMATS:=txt}
TEXT_FORMATS=${TEXT_FORMATS,,}
IMAGE_FORMATS=${IMAGE_FORMATS:=$CFG_IMAGE_FORMATS} IMAGE_FORMATS=${IMAGE_FORMATS:=$CFG_IMAGE_FORMATS}
IMAGE_FORMATS=${IMAGE_FORMATS:=jpeg|jpg|png|pdf|svg|eps} IMAGE_FORMATS=${IMAGE_FORMATS:=jpeg|jpg|png|pdf|svg|eps}
IMAGE_FORMATS=${IMAGE_FORMATS,,}
SPREADS_DIR=${SPREADS_DIR:=$CFG_SPREADS_DIR} SPREADS_DIR=${SPREADS_DIR:=$CFG_SPREADS_DIR}
@ -130,6 +132,9 @@ printhelp(){
echo " - text spread default template (default: ${IMAGE_SPREAD[0]})." echo " - text spread default template (default: ${IMAGE_SPREAD[0]})."
echo " --captions PATH" echo " --captions PATH"
echo " - path to search for captions (default: $CAPTION_DIR)." echo " - path to search for captions (default: $CAPTION_DIR)."
echo " --graphicx-path"
echo " - reference images by their basenames and let graphicx manage"
echo " searching."
echo echo
echo "Parameters:" echo "Parameters:"
echo " PATH - path to root pages directory (default: $SPREADS_DIR)" echo " PATH - path to root pages directory (default: $SPREADS_DIR)"
@ -177,38 +182,50 @@ while true ; do
-a|--annotate) -a|--annotate)
ANOTATE_IMAGE_PATHS=1 ANOTATE_IMAGE_PATHS=1
shift shift
continue
;; ;;
-c) -c)
$CONFIG="$2" $CONFIG="$2"
[ -e "$CONFIG" ] \ [ -e "$CONFIG" ] \
&& source "$CONFIG" && source "$CONFIG"
shift 2 shift 2
continue
;; ;;
--templates) --templates)
TEMPLATE_DIR=$2 TEMPLATE_DIR=$2
shift 2 shift 2
continue
;; ;;
--single-image-tpl) --single-image-tpl)
IMAGE_SPREAD[1]=$2 IMAGE_SPREAD[1]=$2
shift 2 shift 2
continue
;; ;;
--double-image-tpl) --double-image-tpl)
IMAGE_SPREAD[2]=$2 IMAGE_SPREAD[2]=$2
shift 2 shift 2
continue
;; ;;
--text-spread-tpl) --text-spread-tpl)
IMAGE_SPREAD[0]=$2 IMAGE_SPREAD[0]=$2
shift 2 shift 2
continue
;; ;;
--captions) --captions)
CAPTION_DIR=$2 CAPTION_DIR=$2
shift 2 shift 2
continue
;;
--graphicx-path)
GRAPHICX_PATH=1
shift
continue
;; ;;
# handle unknown options... # handle unknown options...
-*|--*) -*|--*)
echo "Error: unknown option \"$1\"" echo "Error: unknown option \"$1\"" >&2
exit exit
;; ;;
@ -341,6 +358,12 @@ templateSlots(){
# usage: # usage:
# populateTemplate SPREAD TEMPLATE ITEMS... # populateTemplate SPREAD TEMPLATE ITEMS...
# #
# closure: $populateTemplate_img, $populateTemplate_txt
#
# NOTE: this is the least hacky/ugly but could not figure out a better
# way to update a list from within a function...
populateTemplate_img=
populateTemplate_txt=
populateTemplate(){ populateTemplate(){
local spread="$1" local spread="$1"
local tpl="$2" local tpl="$2"
@ -359,12 +382,22 @@ populateTemplate(){
local txt=() local txt=()
local elem local elem
for elem in "${items[@]}" ; do for elem in "${items[@]}" ; do
if [[ "$elem" =~ $IMAGE_FORMATS ]] ; then if [[ "${elem,,}" =~ $IMAGE_FORMATS ]] ; then
img+=("$elem") img+=("$elem")
elif [[ "$elem" =~ $TEXT_FORMATS ]] ; then elif [[ "${elem,,}" =~ $TEXT_FORMATS ]] ; then
txt+=("$elem") txt+=("$elem")
fi fi
done done
local global_img=
if ! [ -z $populateTemplate_img ] ; then
global_img=1
img=(${populateTemplate_img[@]})
fi
local global_txt=
if ! [ -z $populateTemplate_txt ] ; then
global_txt=1
txt=(${populateTemplate_txt[@]})
fi
local var local var
local val local val
@ -403,6 +436,9 @@ populateTemplate(){
text=$(echo "${text}" | \ text=$(echo "${text}" | \
sed "s/\${${var}}/${val%.*}/g") sed "s/\${${var}}/${val%.*}/g")
done done
if ! [ -z $global_img ] ; then
populateTemplate_img=("${populateTemplate_img[@]:$i}")
fi
# pass 2: captions... # pass 2: captions...
for var in ${slots[@]} ; do for var in ${slots[@]} ; do
@ -447,6 +483,9 @@ populateTemplate(){
text=$(echo "${text}" | \ text=$(echo "${text}" | \
sed "s/\${${var}}/${val}/g") sed "s/\${${var}}/${val}/g")
done done
if ! [ -z $global_txt ] ; then
populateTemplate_txt=("${txt[@]}")
fi
# print out the filled template... # print out the filled template...
echo % template: $tpl echo % template: $tpl
@ -459,7 +498,7 @@ populateTemplate(){
# usage: # usage:
# handleSpread SPREAD # handleSpread SPREAD
# #
# closure: $IMAGE_HIRES_DIR, $IMAGE_SPREAD # closure: $GRAPHICX_PATH, $IMAGE_HIRES_DIR, $IMAGE_SPREAD
handleSpread(){ handleSpread(){
local spread="$1" local spread="$1"
# skip non-spreads... # skip non-spreads...
@ -484,30 +523,41 @@ handleSpread(){
local txt=() local txt=()
local items=() local items=()
for elem in "$spread"/* ; do for elem in "$spread"/* ; do
if [[ "$elem" =~ $IMAGE_FORMATS ]] ; then if [[ "${elem,,}" =~ $IMAGE_FORMATS ]] ; then
img+=("$elem") img+=("$elem")
items+=("$elem") items+=("$elem")
elif [[ "$elem" =~ $TEXT_FORMATS ]] ; then elif [[ "${elem,,}" =~ $TEXT_FORMATS ]] ; then
txt+=("$elem") txt+=("$elem")
items+=("$elem") items+=("$elem")
fi fi
done done
# graphicx paths...
if ! [ -z $GRAPHICX_PATH ] ; then
local C=0
for image in "${img[@]}" ; do
local new=`basename ${image}`
new="${new#+([0-9])-}"
img[$C]=$new
C=$(( C + 1 ))
done
# get hi-res image paths... # get hi-res image paths...
if ! [ -z $IMAGE_HIRES_DIR ] ; then elif ! [ -z $IMAGE_HIRES_DIR ] ; then
local C=0 local C=0
for image in "${img[@]}" ; do for image in "${img[@]}" ; do
# skip non-images... # skip non-images...
local new="$IMAGE_HIRES_DIR/`basename ${image/[0-9]-/}`" local new=`basename ${image}`
new="$IMAGE_HIRES_DIR/${new#+([0-9])-}"
# ignore file ext for availability test... # ignore file ext for availability test...
# NOTE: the first match may be an unsupported format... # NOTE: the first match may be an unsupported format...
new="${new%.*}" new="${new%.*}"
local target=$new
new=($new.*) new=($new.*)
if [ -e "${new[0]}" ] ; then if [ -e "${new[0]}" ] ; then
img[$C]=${new[0]} img[$C]=${new[0]}
else else
echo % echo %
echo "% WARNING: hi-res image not found for: \"${image}\" -> \"${new}\"" \ echo "% WARNING: hi-res image not found for: \"${image}\" -> \"${target}\"" \
| tee >(cat >&2) | tee >(cat >&2)
echo % echo %
fi fi
@ -528,7 +578,7 @@ handleSpread(){
# XXX this will also eat 0-imagepage.tpl / 20-textpage.tpl -- do a better pattern... # XXX this will also eat 0-imagepage.tpl / 20-textpage.tpl -- do a better pattern...
if ! [ -z $template ] ; then if ! [ -z $template ] ; then
template=(`ls "$spread/"*.tpl \ template=(`ls "$spread/"*.tpl \
| egrep -v '.*-('${IMAGE_PAGE}'|'${TEXT_PAGE}')\.tpl'`) | grep -E -v '.*-('${IMAGE_PAGE}'|'${TEXT_PAGE}')\.tpl'`)
fi fi
# no template explicitly defined -> match auto-template... # no template explicitly defined -> match auto-template...
if [ -z $layout ] && [ -z $template ] ; then if [ -z $layout ] && [ -z $template ] ; then
@ -556,43 +606,37 @@ handleSpread(){
cat "${template}" cat "${template}"
fi fi
fi fi
populateTemplate_img=("${img[@]}")
populateTemplate_txt=("${txt[@]}")
for elem in "${items[@]}" ; do for elem in "${items[@]}" ; do
C=$(( C + 1 )) C=$(( C + 1 ))
P=$([ $C == 1 ] \ P=$([ $C == 1 ] \
&& echo "left" \ && echo "left" \
|| echo "right") || echo "right")
# XXX need to use populateTemplate here...
# ...to do this need to somehow remove the used
# slots/files from list...
# image... # image...
if [[ "$elem" =~ $IMAGE_FORMATS ]] ; then if [[ "${elem,,}" =~ $IMAGE_FORMATS ]] ; then
echo % echo %
echo "% $P page (image)..." echo "% $P page (image)..."
template=`getTemplate "$spread" "$IMAGE_PAGE"` template=`getTemplate "$spread" "$IMAGE_PAGE"`
echo % template: $template populateTemplate "$spread" "$template"
anotatePath "${elem}"
local caption=$(getCaption "$spread" "${elem}")
caption=$(readCaption "$caption")
cat "${template}" \
| sed -e "s%\${IMAGE0\?}%${elem%.*}%" \
-e "s%\${CAPTION0\?}%${caption}%"
# text... # text...
else else
echo % echo %
echo "% $P page (text)..." echo "% $P page (text)..."
template=$(getTemplate "$spread" "$TEXT_PAGE") template=$(getTemplate "$spread" "$TEXT_PAGE")
echo % template: $template populateTemplate "$spread" "$template"
cat "${template}" \
| sed "s%\${TEXT}%${elem}%"
fi fi
# reset for next page... # reset for next page...
template= template=
# ignore the rest of the items when we are done # ignore the rest of the items when we are done
# creating two pages... # creating two pages...
[ $C == 2 ] \ if [ $C == 2 ] ; then
&& return populateTemplate_img=
populateTemplate_txt=
return
fi
done done
fi fi
fi fi
@ -612,6 +656,8 @@ handleSpread(){
fi fi
fi fi
populateTemplate_img=
populateTemplate_txt=
populateTemplate "$spread" "$template" "${img[@]}" "${txt[@]}" populateTemplate "$spread" "$template" "${img[@]}" "${txt[@]}"
return $? return $?

View File

@ -45,7 +45,7 @@
\usepackage{fontspec} \usepackage{fontspec}
\setmainfont[Mapping=tex-text]{Open Sans} \setmainfont[Mapping=tex-text]{Open Sans}
\setsansfont[Mapping=tex-text]{Open Sans} \setsansfont[Mapping=tex-text]{Open Sans}
\setmonofont[Mapping=tex-text, Scale=0.8]{Courier New} %\setmonofont[Mapping=tex-text, Scale=0.8]{Courier New}
\newfontfamily\titlefont[Mapping=tex-text]{Open Sans Light} \newfontfamily\titlefont[Mapping=tex-text]{Open Sans Light}
\newfontfamily\sectiontitlefont[Mapping=tex-text]{Open Sans Light} \newfontfamily\sectiontitlefont[Mapping=tex-text]{Open Sans Light}

View File

@ -42,10 +42,13 @@
%\fontsize{30pt}{36pt}\selectfont %\fontsize{30pt}{36pt}\selectfont
% fonts... % fonts...
%\usepackage{ascii}
%\usepackage[default,oldstyle,scale=0.95]{opensans}
%\usepackage[T1]{fontenc}
\usepackage{fontspec} \usepackage{fontspec}
\setmainfont[Mapping=tex-text]{Open Sans} \setmainfont[Mapping=tex-text]{Open Sans}
\setsansfont[Mapping=tex-text]{Open Sans} \setsansfont[Mapping=tex-text]{Open Sans}
\setmonofont[Mapping=tex-text, Scale=0.8]{Courier New} %\setmonofont[Mapping=tex-text, Scale=0.8]{Courier New}
\newfontfamily\titlefont[Mapping=tex-text]{Open Sans Light} \newfontfamily\titlefont[Mapping=tex-text]{Open Sans Light}
\newfontfamily\sectiontitlefont[Mapping=tex-text]{Open Sans Light} \newfontfamily\sectiontitlefont[Mapping=tex-text]{Open Sans Light}