added a full book example...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-03-29 18:21:06 +03:00
parent aed58ffe70
commit cf2b95a1d5
25 changed files with 264 additions and 2 deletions

126
examples/book/Makefile Normal file
View File

@ -0,0 +1,126 @@
#----------------------------------------------------------------------
#
#
#
#----------------------------------------------------------------------
# make config...
.SECONDEXPANSION:
.DEFAULT_GOAL := all
ifeq ($(DEBUG),)
STDERR := > /dev/null
endif
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# config...
DIST_DIR := dist/PRINT
SPREAD_DIR := spreads
TEMPLATE_DIR := templates
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# sources...
SETUP := \
setup.tex \
macros.tex
TEMPLATE_FILES := \
$(wildcard $(TEMPLATE_DIR)/*)
SPREADS := \
spreads.tex
COMPONENTS := \
cover.pdf jacket.pdf endpaper.pdf \
block.pdf
# things that we need that does not need to be built my this Makefile,
# this could include custom graphics, manual layouts, ...etc.
EXTRAS :=
#----------------------------------------------------------------------
# config/commands...
MD = @mkdir -p
# primary engine, everything works...
# NOTE: several hacks had to be made -- see setup.tex
CMD = lualatex
#ARGS = -output-driver="xdvipdfmx -q -E -V 3"
MAKESPREADS := ../../scripts/make-spreads.sh
#----------------------------------------------------------------------
# components and rules...
# generic latex -> pdf...
%.pdf: %.tex $(SETUP)
-$(CMD) $< $(STDERR)
spreads.tex: $(SPREAD_DIR) $(wildcard $(SPREAD_DIR)/*/*) $(TEMPLATE_FILES)
$(MAKESPREADS) $< $(SPREAD) > $@
# in case we need multiple chapters/sections, i.e. sets of spreads...
# XXX needs testing -- % in the wildcard function...
%-spreads.tex: $(SPREAD_DIR)/% $(wildcard $(SPREAD_DIR)/%/*/*) $(TEMPLATE_FILES)
$(MAKESPREADS) $< $(SPREAD) > $@
block.pdf: $(SPREADS)
#----------------------------------------------------------------------
# production targets...
.PHONY: all
all: $(COMPONENTS) $(EXTRAS)
#----------------------------------------------------------------------
# packageing...
.PHONY: dist
dist: $(COMPONENTS) $(EXTRAS)
$(MD) $(DIST_DIR)
cp $? $(DIST_DIR)
#----------------------------------------------------------------------
# utility trgets...
.PHONY: sweep
sweep:
-rm -f *.out *.aux *.log *.upa ; true
.PHONY: clean
clean: sweep
-rm -rf *.pdf PRINT *.image-list $(SPREADS) ; true
.PHONY: clean-dist
clean-dist:
-rm -rf dist ; true
.PHONY: clean-all
clean-all: clean clean-dist
#----------------------------------------------------------------------
#

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

@ -0,0 +1,28 @@
%----------------------------------------------------------------------
\input{setup}
\begin{document} %-----------------------------------------------------
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% XXX half title...
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\BookInfoPage
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% XXX intro...
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% XXX title...
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\input{spreads}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\BookSoftwareInfoPage
\end{document} %-------------------------------------------------------
% vim:set ts=4 sw=4 :

17
examples/book/cover.tex Normal file
View File

@ -0,0 +1,17 @@
%----------------------------------------------------------------------
\input{setup}
\ChangeLayout{cover}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{document}
\GenerateTemplate
\end{document}
%----------------------------------------------------------------------
% vim:set ts=4 sw=4 :

View File

@ -0,0 +1,17 @@
%----------------------------------------------------------------------
\input{setup}
\ChangeLayout{endpaper}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{document}
\GenerateTemplate
\end{document}
%----------------------------------------------------------------------
% vim:set ts=4 sw=4 :

17
examples/book/jacket.tex Normal file
View File

@ -0,0 +1,17 @@
%----------------------------------------------------------------------
\input{setup}
\ChangeLayout{jacket}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{document}
\GenerateTemplate
\end{document}
%----------------------------------------------------------------------
% vim:set ts=4 sw=4 :

0
examples/book/macros.tex Normal file
View File

41
examples/book/setup.tex Normal file
View File

@ -0,0 +1,41 @@
%----------------------------------------------------------------------
\documentclass[
layoutmode=block,
% page size...
blockwidth=240mm, blockheight=220mm,
bleed=4mm,
bindingoffset=5mm,
% cover...
coverboardgrow=3mm,
coverflap=17mm,
spinewidth=15mm,
spinefold=5mm,
spinefold=5mm,
% jacket...
jacketflap=50mm,
jacketwrap=1mm,
% image block configuration...
imageblockwidth=0.98, imageblockheight=0.98,
imageblockoffsettop=-0.1,
% misc...
9pt,final,openany
]{photobook}
\def\BookTitle{Info page demo}
\def\BookVersion{1.0}
\def\BookAuthors{John J. Smith}
\def\ByNotice{%
Graphics: none
Text: almost none}
\def\ThanksTo{%
Everyone}
\def\ISBN{000-0-0000000-0-0}
\def\Edition{I 500}
%----------------------------------------------------------------------
% vim:set ts=4 sw=4 :

View File

@ -0,0 +1 @@
Some text

View File

@ -0,0 +1 @@
Some text

View File

@ -0,0 +1 @@
page text

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

View File

@ -0,0 +1 @@
Some text

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

View File

@ -0,0 +1 @@
caption text

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

View File

@ -0,0 +1,2 @@
\cleardoublepage
\ImagePage{${CAPTION0}}{${IMAGE0}}

View File

@ -0,0 +1 @@
\ImageSpreadFill{${CAPTION}}{${IMAGE0}}

View File

@ -0,0 +1,2 @@
\ImagePage{${CAPTION0}}{${IMAGE0}}
\emptypage

View File

@ -0,0 +1,2 @@
\ImagePage{${CAPTION0}}{${IMAGE0}}
\ImagePage{${CAPTION1}}{${IMAGE1}}

View File

@ -0,0 +1 @@
\ImagePage{${CAPTION}}{${IMAGE}}

View File

@ -0,0 +1,4 @@
\parbox{\textwidth}{%
\setlength{\parskip}{1em}
\input{${TEXT}} }
\newpage

View File

@ -84,8 +84,7 @@ book/
└── ...
```
<!-- XXX
For a live example see: ../examples/book -->
For a full example see: ../examples/book
Generate the block:
```shell