From 556a719cebe24900f0c2bcec3c554e7c7a8ad3f9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 9 Apr 2023 19:44:26 +0000 Subject: photobook (9apr23) git-svn-id: svn://tug.org/texlive/trunk@66813 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/photobook/DEPENDS.txt | Bin 467 -> 462 bytes Master/texmf-dist/doc/latex/photobook/Makefile | 13 +- .../texmf-dist/doc/latex/photobook/photobook.pdf | Bin 141677 -> 143035 bytes .../doc/latex/photobook/scripts/README.md | 38 ++-- .../doc/latex/photobook/scripts/cls2tex.sh | 6 +- .../texmf-dist/tex/latex/photobook/photobook.cls | 205 ++++++++++++++++----- 6 files changed, 197 insertions(+), 65 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/photobook/DEPENDS.txt b/Master/texmf-dist/doc/latex/photobook/DEPENDS.txt index 1b2a77253b1..63928418440 100644 Binary files a/Master/texmf-dist/doc/latex/photobook/DEPENDS.txt and b/Master/texmf-dist/doc/latex/photobook/DEPENDS.txt differ diff --git a/Master/texmf-dist/doc/latex/photobook/Makefile b/Master/texmf-dist/doc/latex/photobook/Makefile index 7bebae3ec83..769c5c2ac4a 100644 --- a/Master/texmf-dist/doc/latex/photobook/Makefile +++ b/Master/texmf-dist/doc/latex/photobook/Makefile @@ -226,6 +226,7 @@ LN := cp -l # strip docs out... # # XXX can we unify these??? +# ....not sure how... %-stripped.tex: %.tex $(DOC) --strip $< \ $(DOC) --prefix M --strip \ @@ -244,11 +245,14 @@ LN := cp -l # 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 cat $< \ - | egrep -zo '\s*\\RequirePackage(\[[^]]*\])?\{[^}]*\}' \ - | sed 's/.*{\(.*\)}/hard \1\n/' \ + | grep -Ezo '\s*\\RequirePackage(\[[^]]*\])?\{[^}]*\}' \ + | sed -e 's/.*{\(.*\)}/hard \1\n/' \ | grep -a hard \ + | tr -d '\000' \ > $@ @@ -265,6 +269,9 @@ version: #---------------------------------------------------------------------- # Main targets... +.PHONY: dep +dep: DEPENDS.txt + .PHONY: pdf pdf: $(MODULE).pdf @@ -338,7 +345,7 @@ tag: .PHONY: all -all: pdf +all: pdf dep # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Master/texmf-dist/doc/latex/photobook/photobook.pdf b/Master/texmf-dist/doc/latex/photobook/photobook.pdf index cf3f1d0754a..82e080074f8 100644 Binary files a/Master/texmf-dist/doc/latex/photobook/photobook.pdf and b/Master/texmf-dist/doc/latex/photobook/photobook.pdf differ diff --git a/Master/texmf-dist/doc/latex/photobook/scripts/README.md b/Master/texmf-dist/doc/latex/photobook/scripts/README.md index 2e00881f705..7befc142281 100644 --- a/Master/texmf-dist/doc/latex/photobook/scripts/README.md +++ b/Master/texmf-dist/doc/latex/photobook/scripts/README.md @@ -23,8 +23,6 @@ Support scripts `make-spreads.sh` ---------------- - - Generate LaTeX block of pages/spreads from a directory tree. This was initially intended as a means to convert the exported directory @@ -52,7 +50,7 @@ book/ │ ├── image-image.tex │ ├── fullbleed.tex │ └── ... -├── spreads/ . . . . . . . . . . . . . . Main block layout. +├── spreads/ . . . . . . . . . . . . . Main block layout. │   ├── 00/ . . . . . . . . . . . . . . A basic spread. │   │   ├── tweaks.tex The spread template is built │   │   └── 0-DSC02432.jpg automatically with tweaks.tex @@ -79,23 +77,22 @@ book/ ├── block.tex . . . . . . . . . . . . . Block skeletal layout. │ This usually includes the titles, │ technical pages and sources the -│ ./block-pages.tex. -├── block-pages.tex . . . . . . . . . . The generated block content. +│ ./block-spreads.tex. +├── block-spreads.tex . . . . . . . . . The generated block content. ├── cover.tex . . . . . . . . . . . . . Cover layout. ├── jacket.tex . . . . . . . . . . . . Dust jacket layout. └── ... ``` - +For a full example see: ../examples/book Generate the block: ```shell -$ make-spreads.sh ./pages > block-pages.tex +$ make-spreads.sh ./spreads > block-spreads.tex ``` Note that `make-spreads.sh` does not force a specific layout outside of -the `pages` directory, all paths are configurable. The way the root +the `spreads` directory, all paths are configurable. The way the root files are structured in this example is just one way to organize a book's source code with minimal code duplication. @@ -123,20 +120,20 @@ work is starting to look like a book. When starting work on a layout it is good to at least have a basic understanding of the book's: - structure and how it may change, -- core templates, +- general look (i.e. core templates), - exceptions from the above. In most cases all of the above will change in one way or another during the project's lifespan, and the main goal of this stage is to make this -change as simple as possible -- it's all about providing the freedom to -make changes instead of growing work invested and thus making change -more and more expensive. +change as efgortless as possible -- it's all about providing the freedom +to make changes instead of growing the work invested and thus making +change more and more expensive. The first question is what is the _structure_ of the book we are making? Will it have chapters? How many? Text? how much, how should it be -structured? How are we going to deal with the title? How are we going +placed? How are we going to deal with the title? How are we going to present the images, full bleed, no bleeds, small, big, one per page -or multiple images, ...etc.? At this stage this is about the presentation +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 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 @@ -313,7 +310,7 @@ environment variable. Inline captions are also supported: ```bnf -pages/ +spreads/ ├── / │   ├── ... │   ├── 00-. @@ -389,6 +386,13 @@ $ make-spreads.sh -c .. Extract the documentation from photobook.cls which is used to build the photobook.pdf reference manual. +This makes it possible to keep the documentation and code it describes +in the same place/file. + +The format is in part inspired by LaTeX's [.dtx](http://tug.ctan.org/info/dtxtut/dtxtut.pdf) +format but is far simpler and retains human readability with less effort. + + ```shell $ cls2tex.sh --help ``` @@ -440,4 +444,4 @@ NOTE: the idea of keeping latex docs in a latex file is far simpler in both the repo and in installed form, so .dtx is not used. ``` - + diff --git a/Master/texmf-dist/doc/latex/photobook/scripts/cls2tex.sh b/Master/texmf-dist/doc/latex/photobook/scripts/cls2tex.sh index 34cf872b1d9..9119cd6e821 100755 --- a/Master/texmf-dist/doc/latex/photobook/scripts/cls2tex.sh +++ b/Master/texmf-dist/doc/latex/photobook/scripts/cls2tex.sh @@ -131,7 +131,7 @@ if [ -z $STRIP_DOC ] ; then printmsg "Documentation" \ > "$OUTPUT" cat "$INPUT" \ - | egrep '(^%'$PREFIX'|^\\edef\\'$MODULE'@[A-Z][A-Z]+)' \ + | grep -E '(^%'$PREFIX'|^\\edef\\'$MODULE'@[A-Z][A-Z]+)' \ | sed \ -e 's/^\(\\edef\\\)'$MODULE'@/%'$PREFIX'\1/' \ -e 's/%'$PREFIX'%%%% \(.*\)/%'$PREFIX'\\subsubsection{\1}\\label{subsubsec:\1}/' \ @@ -146,8 +146,8 @@ else printmsg "Stripped code" \ > "$OUTPUT" cat "$INPUT" \ - | egrep -v '%'$PREFIX'' \ - | egrep -v '^(\s*%)?\s*$' \ + | grep -Ev '%'$PREFIX'' \ + | grep -Ev '^(\s*%)?\s*$' \ >> "$OUTPUT" fi diff --git a/Master/texmf-dist/tex/latex/photobook/photobook.cls b/Master/texmf-dist/tex/latex/photobook/photobook.cls index 0ade3c4ac0b..74f8b8f5e16 100644 --- a/Master/texmf-dist/tex/latex/photobook/photobook.cls +++ b/Master/texmf-dist/tex/latex/photobook/photobook.cls @@ -33,8 +33,32 @@ % to edit it directly, edit the source instead. % % -% XXC FEATURE image spread: add ability to push image sides outward to -% account for gutter.,, +% +% XXX ASAP \bindingoffset should also affect fill/bleed images... (DONE) +% ...shift the macros that optionally account for \bindingoffset to +% account for \gutteroffset (DONE) +% ...everything should respect \bindingoffset (DONE) +% XXX ASAP add \gutteroffset and \gutterimageoffset to offset content +% from the gutter +% \gutterimageoffset is an additional offset added to bleed images... +% ...currently \bindingoffset is used for both... +% Q: should the gutter offsets be counted from the \bindingoffset??? +% +% +-------------------------------=-- +% | . . . = +% | . . . = +% | . . <-> \bindingoffset +% | . . . = +% | . <--> = \gutteroffset +% | . . . = +% | <--> . = \gutterimageoffset +% | . . . = +% +-------------------------------=-- +% +% XXX DOC... +% +% +% % XXX revise \clearcaption / \captionclearpage... % XXX unify API -- see CellContent env... % XXX make this loadable both as a class and as a package... @@ -76,8 +100,8 @@ %%% NOTE: \def\@[A-Z]+ macros will be visible to both the %%% code and the generated docs... -\edef\photobook@FILEVERSION{v0.1.15} -\edef\photobook@FILEDATE{2023-03-18} +\edef\photobook@FILEVERSION{v0.1.17} +\edef\photobook@FILEDATE{2023-04-09} %% \documentclass{ltxdoc} @@ -224,6 +248,8 @@ %% \DescribeMacro{blockwidth=} %% \DescribeMacro{blockheight=} %% \DescribeMacro{bindingoffset=} +%% \DescribeMacro{gutteroffset=} +%%% \DescribeMacro{gutterimageoffset=} %% \DescribeMacro{bleed=} % %% This is similar to what |geometry| does, but adds bleed support. @@ -231,39 +257,45 @@ %% \begin{minipage}{\textwidth} %% \begin{verbatim} %% -%% <---> bleed <---> bleed -%% -%% + - - - - - - - - - - - - - - - - - - - - - + - + ^ -%% . . . | bleed -%% . +---------------------------------------+----- v . . --- -%% . | ^ . = . -%% . | . . . . . . | . . = . ^ -%% . |<-- blockwidth ----------------------->= . | -%% . | . | . . = . | -%% . | | . = . textheight -%% . | . Page | . . = . | -%% . | blockheight . = . | -%% . | . | . . = . | -%% . | | <---> bindingoffset | -%% . | . . . . . . | . . = . v -%% . | v . = . -%% . +---------------------------------------+----- ^ . . --- -%% . . . . | bleed -%% + - - - - - - - - - - - - - - - - - - - - - + - + v -%% . . -%% | <-- textwidth --------------> . | -%% ^ gutter +%% <---> bleed <---> bleed +%% +%% + - - - - - - - - - - - - - - - - - - - - - - + - + ^ +%% . . . | bleed +%% . +-----------------------------------------+----- v . . --- +%% . | ^ . . = . +%% . | . . . . . . | . . . = . ^ +%% . |<-- blockwidth ------------------------->= . | +%% . | . | . . . = . | +%% . | | . . = . textheight +%% . | . Page | . . . = . | +%% . | blockheight . . = . | +%% . | . | . . <--> bindingoffset | +%% . | | . . = . | +%% . | . . . . . . | . <--> gutteroffset v +%% . | v . . = . +%% . +-----------------------------------------+----- ^ . . --- +%% . . . . | bleed +%% + - - - - - - - - - - - - - - - - - - - - - - + - + v +%% . . +%% | <-- textwidth --------------> . | +%% ^ gutter %% %% \end{verbatim} %% \end{minipage} %% +%% Note that all macros respect |\bindingoffset| but only some macros +%% account for |\gutteroffset|, namely macros that do not display content +%% with bleeds. +%% % NOTE: if blockwidth/blockheight are set they will force recalculations % and overriding of the paperwidth/paperheight if they were changed % by the user code anywhere between \documentclass[..]{photobook} % and \begin{document}... \DeclareStringOption{blockwidth} \DeclareStringOption{blockheight} -\DeclareStringOption[0pt]{bindingoffset}[10mm] +\DeclareStringOption[0pt]{bindingoffset}[0mm] +\DeclareStringOption[0pt]{gutteroffset}[0mm] +\DeclareStringOption[0pt]{gutterimageoffset}[0mm] \DeclareStringOption[5mm]{bleed}[5mm] %% \DescribeMacro{flatfold=} @@ -296,6 +328,7 @@ % %% \DescribeMacro{layoutmode=} %% \DescribeMacro{block} +%% \DescribeMacro{spread} %% \DescribeMacro{endpaper} %% \DescribeMacro{cover} %% \DescribeMacro{jacket} @@ -326,9 +359,9 @@ %% \end{minipage} %% %% -%% |endpaper|: +%% |spread|/|endpaper|: %% -%% Endpaper layout. +%% Spread/endpaper layout. %% % XXX should this use \flatfold??? %% \begin{minipage}{\textwidth} @@ -340,7 +373,7 @@ %% +---------------+---------------+ %% | . | %% | . | -%% | endpaper | +%% | spread | %% | . | %% | . | %% +---------------+---------------+ @@ -348,6 +381,9 @@ %% \end{verbatim} %% \end{minipage} %% +%% Note that |endpaper| is simply an alias to |spread|, this helps make +%% the book source to be more semantic and readable. +%% %% %% |cover| %% @@ -422,7 +458,7 @@ %% \end{verbatim} %% \end{minipage} %% -%% Note that for |cover|, |endpaper|, and |jacket|, +%% Note that for |cover|, |spread|/|endpaper|, and |jacket|, %% \href{https://ctan.org/pkg/fancyhdr}{fancyhdr}'s |\pagestyle{..}| is %% set to |empty| by default. %% @@ -436,6 +472,7 @@ \@DeclareLiteralOptionTo{layoutmode}{block} %\@DeclareLiteralOptionTo{layoutmode}{web} \@DeclareLiteralOptionTo{layoutmode}{endpaper} +\@DeclareLiteralOptionTo{layoutmode}{spread} % XXX add overhang... % XXX minght be a good idea to add cover types as separate values and % preset defeaults per type, e.g: @@ -671,6 +708,7 @@ \newif\ifhardcoverlayout \newif\ifsoftcoverlayout \newif\ifendpaperlayout +\newif\ifspreadlayout \newif\ifjacketlayout % aggregates... \newif\ifcoverlikelayout @@ -776,9 +814,25 @@ % %% Binding offset %% +%% Used to offset content to account glue-up/roughing of pages for certain +%% types of binds like perfect binds. +%% \newlength\bindingoffset \setlength\bindingoffset{\photobook@bindingoffset} +%% \DescribeMacro{\gutteroffset=} +%%% \DescribeMacro{\gutterimageoffset=} +% +%% Gutter offsets +%% +%% Mainly used to offset content without bleeds away from or into the +%% gutter. +%% +\newlength\gutteroffset +\setlength\gutteroffset{\photobook@gutteroffset} +\newlength\gutterimageoffset +\setlength\gutterimageoffset{\photobook@gutterimageoffset} + %% \DescribeMacro{\defaultfoldout=} % %% Set the default fold specification. @@ -972,6 +1026,7 @@ \hardcoverlayoutfalse \softcoverlayoutfalse \endpaperlayoutfalse + \spreadlayoutfalse \jacketlayoutfalse \coverlikelayoutfalse \blocklayoutfalse @@ -989,7 +1044,11 @@ \ifdefstring{\layoutmode}{jacket}{% \jacketlayouttrue \coverlikelayouttrue }{} + \ifdefstring{\layoutmode}{spread}{ + \spreadlayouttrue + \endpaperlayouttrue }{} \ifdefstring{\layoutmode}{endpaper}{ + \spreadlayouttrue \endpaperlayouttrue }{} % pdf layout... \ifx\photobook@pdfpagelayout\empty @@ -1087,8 +1146,8 @@ + 2\jacketwrap + \photobook@jacketflapfront@active + \photobook@jacketflapback@active \relax}\fi - % layout: endpaper... - \ifendpaperlayout + % layout: spread/endpaper... + \ifspreadlayout \pagestyle{empty}% \readlist*\pagefoldpanels{% \the\pageblockwidth, @@ -1096,7 +1155,7 @@ \photobook@setpagefold{in} \setlength\blockwidth{2\blockwidth}\fi\fi \ifdim\blockheight=0pt - % layout: block / endpaper... + % layout: block / spread... \setlength\blockheight{ \ifx\photobook@blockheight\empty \dimexpr \paperheight - 2\bleed \relax @@ -2909,22 +2968,30 @@ %% \end{verbatim} %% \end{minipage} %% -%% The star version accounts for |\bindingoffset|. +%% The star version accounts for |\gutteroffset|. %% %% Note that |layoutmode|'s other than block will change the paper size %% but will not affect this either in size (block size) or in position %% (top-left). %% +%\newenvironment{pagecell}{% +% \begin{cell*}{\bleed,\bleed}{\pageblockwidth}{\pageblockheight}% +%}{% +% \end{cell*}} \newenvironment{pagecell}{% - \begin{cell*}{\bleed,\bleed}{\pageblockwidth}{\pageblockheight}% + \begin{cell*}{% + \bleed + \ifnumodd{\thepage}{\bindingoffset}{0pt},% + \bleed}% + {\pageblockwidth - \bindingoffset}% + {\pageblockheight}% }{% \end{cell*}} \newenvironment{pagecell*}{% \begin{cell*}{% - \bleed + \ifnumodd{\thepage}{\bindingoffset}{0pt},% + \bleed + \ifnumodd{\thepage}{\bindingoffset + \gutteroffset}{0pt},% \bleed}% - {\pageblockwidth - \bindingoffset}% + {\pageblockwidth - \bindingoffset - \gutteroffset}% {\pageblockheight}% }{% \end{cell*}} @@ -3754,7 +3821,7 @@ % create the actual cell... \setlength\cellparentwidth{\cellwidth}% \setlength\cellparentheight{\cellheight}% - \setlength\cellwidth{#1\pageblockwidth}% + \setlength\cellwidth{#1\pageblockwidth - #1\bindingoffset}% \setlength\cellheight{\pageblockheight}% % \savecell{photobook@spreadtopages}{\cellwidth}{\cellheight}{\BODY}% @@ -5175,7 +5242,7 @@ \begin{page} \setlength{\parindent}{0em} % NOTE: only the relevant blocks will be visible... - \ifendpaperlayout% + \ifspreadlayout% \begin{leftside} \photobook@TemplateCell[#1]{ENDPAPER LEFT} \end{leftside} @@ -5207,7 +5274,7 @@ \newcommand\ShowMarks[1][1pt]{% % general... % XXX corners / cut marks... - \ifendpaperlayout% + \ifspreadlayout% % XXX fold... \fi% \ifcoverlikelayout% @@ -5329,7 +5396,61 @@ + ((#2 mm) * 2) \relax}} -% XXX DOC... + +%% \DescribeMacro{\pdfspreadstopages\{..\}} +% +%% \EXPERIMENTAL +%% +%% Include spreads from a pdf block as pages +%% +%% >> \pdfspreadstopages[]{} +%% +%% |\pdfspreadstopages{..}| inserts an empty page before the first page +%% in the block to push it to the right of the spread. +%% +%% To display other pages consistently it is recommended to set the +%% block width to |2\blockwidth| and set the |pdfpagelayout| to be +%% set to |SinglePage|, a simple way to do both is to: +%% +%% >> \ChangeLayout{spread} +%% +% XXX do we need to set the page format to double block width here??? +% XXX TEST... +\newcommand\pdfspreadstopages[2][0mm]{% + \includepdf[pages={{},1-}, nup=2x1, delta=#1 #1]{#2}} + + +% XXX include the cover with the foldouts removed... +\newcommand\pdfcover[1]{% + % XXX crop to frontcover cell.. + \includepdf{#1}} +% XXX include cover cells.... +\newcommand\pdfcoverfront[1]{% + % XXX crop to frontcover cell.. + \includepdf{#1}} +\newcommand\pdfcoverback[1]{% + % XXX crop to backcover cell.. + \includepdf{#1}} +% XXX do we need this??? +%\newcommand\pdfendpaper[1]{% +% \includepdf{#1}} + + +% XXX +% XXX do we include endpapers??: +\newcommand\pdfweb[2]{% + \pdfcoverfront{#1}% + \pdfspreadstopages{#2}% + \pdfcoverback{#1}} + + + + +%% \DescribeMacro{\TEX} +%% \DescribeMacro{\LATEX} +% +%% Convenience macros to display \TeX and \LaTeX in the correct font. +%% \def\TEX{% {\fontfamily{lmr}\selectfont \TeX}} \def\LATEX{% -- cgit v1.2.3