% =============================================================
% bookaspro-doc.tex -- user manual for the bookaspro class
% Compile with: pdflatex bookaspro-doc.tex  (two or three times
% for the table of contents and cross-references)
% =============================================================
\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{array}
\usepackage{booktabs}

\EnableCrossrefs
\DoNotIndex{\begin,\end,\centering,\small,\large,\par,\vspace}
\DoNotIndex{\textwidth,\textheight,\paperwidth,\paperheight,\linewidth}
\DoNotIndex{\includegraphics,\caption,\label,\clearpage,\cleardoublepage}
\DoNotIndex{\chapter,\section,\subsection,\tableofcontents,\listoffigures}
\DoNotIndex{\usepackage,\documentclass,\frontmatter,\mainmatter,\backmatter}
\DoNotIndex{\texttt,\textsf,\textbf,\textit,\verb,\relax,\quad}

\newcommand{\pkg}[1]{\textsf{#1}}
\newcommand{\opt}[1]{\texttt{#1}}
\providecommand{\cls}[1]{\textsf{#1}}
\providecommand{\env}[1]{\texttt{#1}}
\providecommand{\file}[1]{\texttt{\detokenize{#1}}}
\setlength{\emergencystretch}{1.5em}

\title{The \cls{bookaspro} class\\[0.5ex]
       \large Trim-and-bleed page geometry, proofing marks,\\
       and image composition for print-ready illustrated books}
\author{Stefano Dalpez}
\date{2026/11/29\quad v2.0.1}

\begin{document}
\maketitle

\begin{abstract}
\noindent
The \cls{bookaspro} class builds on \LaTeX's native typographic
quality to provide a ready-to-use workflow for illustrated,
print-on-demand books: a trim-size-plus-bleed page geometry, styled
chapter openings, centered folios, classical paragraph typography,
and a unified set of image macros (grids, column compositions,
wrapped figures and full/partial/vertical bleed pages). A shipout
proofing overlay draws the trim line, crop marks, the inner safety
margin and the text-block border on every page for visual
verification before the file is sent to the printer. All commands
and options are in English; the class requires LuaLaTeX or XeLaTeX.

\medskip
\noindent
\textbf{About this class.} \cls{bookaspro} is the fruit of numerous
book-layout projects carried out in \LaTeX, progressively refined
with the help of artificial intelligence. It is being prepared for
official publication on CTAN (the Comprehensive \TeX{} Archive
Network). The source code, bug reports and further details are
managed at \url{https://gitlab.com/stedal80/bookaspro}.
\end{abstract}

\tableofcontents

% =============================================================
\section{Introduction}
% =============================================================

Preparing an illustrated book for a print-on-demand service involves
more than choosing margins: the PDF pages must be larger than the
final (trimmed) book size by a \emph{bleed} allowance, photographs
that reach the page edge must cover that allowance, and the printer's
safety distances must be respected on every page. Doing this by hand
is error-prone.

Rather than assembling and maintaining such a preamble by hand, you
can simply load \cls{bookaspro} as your document class; it provides:

\begin{itemize}
\item a configurable \emph{trim + bleed} page geometry
      (Section~\ref{sec:layout});
\item styled chapter and section headings, centered folios,
      classical paragraph typography (Section~\ref{sec:typo});
\item three image macros --- \cs{imageGrid}, \cs{imageColumns} and
      \cs{imageBleed} --- that cover every composition case of an
      illustrated book with one consistent key--value interface
      (Section~\ref{sec:images});
\item structural helpers for unnumbered chapters and chapter
      closing ornaments (Section~\ref{sec:structural});
\item a non-invasive proofing overlay that draws the trim line,
      cam crop marks, the inner safety margin and the text-block
      border on every page (Section~\ref{sec:proofing}).
\end{itemize}

The defaults reproduce a $170\times240$~mm book with 3~mm bleed
(PDF pages $176\times246$~mm), thread-sewn binding, single pages,
1:1 PDF, \emph{without} crop marks in the final file. Every value
can be changed with \cs{bookasprosetup}.

Throughout this manual, the options of each command are reported as a
left-aligned list where each entry states the option, its default and
its meaning.

% =============================================================
\section{Requirements and installation}
% =============================================================

\subsection{Requirements}

\begin{itemize}
\item \textbf{Engine:} LuaLaTeX or XeLaTeX (the class uses
      \pkg{fontspec} and OpenType fonts). PdfLaTeX is not supported.
\item \textbf{LaTeX format:} 2020-10-01 or newer. The class uses
      the kernel commands \cs{NewDocumentCommand} and
      \cs{AddToHook}.
\item \textbf{Packages:} \pkg{iftex}, \pkg{fix-cm}, \pkg{keyval},
      \pkg{geometry}, \pkg{fontspec}, \pkg{microtype}, \pkg{graphicx},
      \pkg{xcolor}, \pkg{textcomp}, \pkg{csquotes}, \pkg{float},
      \pkg{wrapfig}, \pkg{rotating}, \pkg{caption}, \pkg{lscape},
      \pkg{longtable}, \pkg{placeins}, \pkg{fancyhdr}, \pkg{emptypage},
      \pkg{setspace}, \pkg{titlesec}, \pkg{tikz}, \pkg{hyperref},
      \pkg{bookmark}. All are part of a standard TeX~Live or MiKTeX
      installation. The main font is TeX~Gyre Pagella
      (\pkg{tex-gyre}).
\end{itemize}

Note: \pkg{pdflscape} is deliberately \emph{not} used because it
conflicts with LuaLaTeX; use the \env{lscape} environment from
\pkg{lscape} for landscape tables.

\subsection{Installation}

Copy \file{bookaspro.cls} to a directory searched by TeX, e.g.
\begin{quote}
\small
|TEXMFHOME/tex/latex/bookaspro/bookaspro.cls|
\end{quote}
and the documentation to
|TEXMFHOME/doc/latex/bookaspro/|. Alternatively, keep
\file{bookaspro.cls} in the same folder as your document. Refresh
the file name database if your distribution requires it
(|mktexlsr| or MiKTeX's automatic refresh).

% =============================================================
\section{Loading the class}
% =============================================================

\begin{quote}
\begin{verbatim}
\documentclass{bookaspro}
\end{verbatim}
\end{quote}

The class configures the page geometry, the headings, the running
heads, the captions and the paragraph typography at load time.
Language support is \emph{not} forced: load \pkg{babel} or
\pkg{polyglossia} yourself, before or after \cls{bookaspro}, and set
your language as usual.

\subsection{Class options}

\cls{bookaspro} understands five options of its own; every other
option is passed through to the underlying \cls{book} class, so the
standard \cls{book} options (\opt{10pt}, \opt{11pt}, \opt{12pt},
\opt{oneside}, \opt{twoside}, \opt{openright}, \opt{openany},
\opt{draft}, \opt{a4paper}, \dots) also work. The defaults passed to
\cls{book} are \opt{10pt}, \opt{twoside} and \opt{openright}, so an
explicit \opt{11pt} or \opt{oneside} cleanly overrides them.

\begin{description}
\item[\opt{nofont}] Do not load \pkg{fontspec} and do not set the
  main font (use your own font setup).
\item[\opt{notitles}] Do not load \pkg{titlesec} and do not apply
  the heading styles (use your own).
\item[\opt{nohyperref}] Do not load \pkg{hyperref}+\pkg{bookmark};
  load them yourself \emph{after} \cls{bookaspro} if you need custom
  options.
\item[\opt{showframe}] Pass \opt{showframe} to \pkg{geometry}:
  draws the layout frames for proofing.
\item[\opt{bleedmarks}] Enable \cs{showBleedMargin} with default
  values (3~mm bleed, 5~mm inner margin) at load time.
\end{description}

Example:
\begin{quote}
\begin{verbatim}
\documentclass[nohyperref,bleedmarks]{bookaspro}
\usepackage[colorlinks=false,hidelinks]{hyperref}
\usepackage{bookmark}
\end{verbatim}
\end{quote}

% =============================================================
\section{Page layout}\label{sec:layout}
% =============================================================

\subsection{The trim-and-bleed model}

The printer receives single PDF pages at 1:1 scale, \emph{without}
crop marks. Each PDF page is larger than the final book size
(the \emph{trim size}) by the \emph{bleed} allowance on every side:
\[
  \text{PDF page} = \text{trim size} + 2\times\text{bleed}.
\]
Photographs that must reach the trimmed page edge are scaled to
cover the whole PDF page; the excess is trimmed away.

All typographic margins are measured \emph{from the trim line};
\cls{bookaspro} adds the bleed automatically when it calls
\pkg{geometry}. With the defaults (trim $170\times240$~mm, bleed
3~mm) the PDF page is $176\times246$~mm and the text block is
$138\times200$~mm. The binding side receives an extra
\opt{bindingoffset} (5~mm by default), so the text sits 20~mm from
the trim line on the binding side --- comfortably above the usual
15~mm safety requirement --- and 12~mm from the trim line on the
outer side.

\subsection{Configuration: \cs{bookasprosetup}}

\DescribeMacro{\bookasprosetup}
\cs{bookasprosetup}\marg{key=value,\dots} changes any layout or
typography parameter and re-applies the geometry immediately.
Because it re-applies the page geometry through the \pkg{geometry}
package, it can only be used in the preamble, before
\cs{begin}|{document}|.

\subsubsection{Geometry keys}

\begin{description}
\item[\opt{trimwidth} = 170\,mm] Final book width (after
  trimming).
\item[\opt{trimheight} = 240\,mm] Final book height (after
  trimming).
\item[\opt{bleed} = 3\,mm] Bleed allowance on every side.
\item[\opt{top} = 20\,mm] Text top margin, measured from the trim
  line.
\item[\opt{bottom} = 20\,mm] Text bottom margin, measured from the
  trim line.
\item[\opt{inner} = 15\,mm] Binding-side margin from the trim
  line, computed before \opt{bindingoffset} is applied.
\item[\opt{outer} = 12\,mm] Outer margin, from the trim line.
\item[\opt{bindingoffset} = 5\,mm] Extra shift towards the outer
  edge on the binding side.
\item[\opt{headheight} = 14\,pt] Height of the running-head box.
\item[\opt{headsep} = 13\,mm] Distance from the head box to the
  text block.
\item[\opt{footskip} = 13\,mm] Distance from the text block to the
  folio baseline.
\end{description}

\subsubsection{Typography keys}

\begin{description}
\item[\opt{stretch} = 1.15] Line-height factor (\pkg{setspace}).
\item[\opt{parindent} = 1.5\,em] Paragraph indentation.
\item[\opt{parskip} = 0\,pt] Extra space between paragraphs
  (classical style: indentation only).
\item[\opt{emergencystretch} = 1.5\,em] Extra end-of-line
  elasticity to avoid overfull lines.
\item[\opt{imagepath} = \texttt{./img/}] Additional image search
  path (\cs{graphicspath}).
\end{description}

\subsubsection{Caption keys}

These keys control the appearance of every figure caption, whether
it is produced by the image macros or by a standard
\env{figure} environment:
\begin{description}
\item[\opt{captionfont} = footnotesize] Font used for the image
  captions (e.g.\ \texttt{scriptsize}, \texttt{footnotesize},
  \texttt{small}, \texttt{normalsize}).
\item[\opt{captionskip} = 3\,pt] Vertical distance between an image
  and its caption.
\item[\opt{captionmargin} = 0\,pt] Horizontal margin inset applied
  to the captions.
\item[\opt{bleedcaptionskip} = 6\,mm] Vertical offset of an
  overlaid bleed caption above the folio (\opt{mode=full} and
  \opt{mode=vertical}).
\end{description}

\opt{captionfont} and \opt{captionskip} can also be set
\emph{per figure} --- overriding the global values above --- as keys
of \cs{imageGrid}, \cs{imageColumns} and \cs{imageBleed}; see
Section~\ref{sec:images}.

\subsubsection{The original book, with all its parameters}

The complete configuration of the original $170\times240$~mm book
from which the class was derived is reproduced below; every
parameter is listed explicitly, so it can be used as a starting
point for a new project. The values shown are exactly the class
defaults.

\begin{quote}
\begin{verbatim}
\bookasprosetup{
  trimwidth=170mm, trimheight=240mm, bleed=3mm,
  top=20mm,    bottom=20mm,
  inner=15mm,  outer=12mm,
  bindingoffset=5mm,
  headheight=14pt, headsep=13mm, footskip=13mm,
  stretch=1.15,
  parindent=1.5em, parskip=0pt,
  emergencystretch=1.5em,
  captionfont=footnotesize, captionskip=3pt,
  captionmargin=0pt, bleedcaptionskip=6mm,
  imagepath=./img/
}
\end{verbatim}
\end{quote}

Change only the values you need; omitted keys keep their default.
For example, a $148\times210$~mm book (A5) with 3~mm bleed needs
only:

\begin{quote}
\begin{verbatim}
\bookasprosetup{
  trimwidth=148mm, trimheight=210mm,
  top=18mm, bottom=18mm, inner=14mm, outer=11mm,
  bindingoffset=4mm
}
\end{verbatim}
\end{quote}

% =============================================================
\section{Typography, headings and folios}\label{sec:typo}
% =============================================================

At load time the class applies:

\begin{itemize}
\item \cs{raggedbottom}: with many figures, the bottom of the text
      block is not stretched; this removes pages with exaggerated
      vertical gaps.
\item Float-flow tuning: \cs{topfraction} |0.9|,
      \cs{bottomfraction} |0.85|, \cs{textfraction} |0.08|,
      \cs{floatpagefraction} |0.8|; at most 2 top floats, 1 bottom
      float, 3 floats per page; large float queues
      (\cs{extrafloats} |{500}|, \cs{maxdeadcycles} |500|).
\item \cs{clubpenalty}, \cs{widowpenalty} and \cs{brokenpenalty}
      set to 10000: no widows, no orphans, no hyphenated word
      split across pages.
\item Line height \opt{stretch} (default 1.15), paragraph indent
      \opt{parindent}, no extra paragraph skip.
\end{itemize}

\subsection{Heading styles}

Unless the \opt{notitles} option is given, \pkg{titlesec} formats:

\begin{itemize}
\item \cs{chapter}: centered display; the label
      (``\textsc{chapter}~$n$'', uppercased and letterspaced) at
      16~pt bold, the title at 22~pt bold, a short centered rule
      below the title, generous space above the opening.
\item \cs{section}: 16~pt bold, number slightly smaller.
\item \cs{subsection}: bold italic at normal size.
\item \cs{subsubsection}: italic at normal size, unnumbered label.
\end{itemize}

\subsection{Running heads and folios}

The page style is \pkg{fancyhdr} with \emph{no} running heads and
\emph{no} head rule: a small centered folio at the bottom, on both
regular pages and chapter-opening (\opt{plain}) pages. Blank verso
pages inserted by \cs{cleardoublepage} are truly empty
(\pkg{emptypage}).

\subsection{Captions}

Captions use a bold label followed by a period and a wide space
(the separator \opt{broadsep}: |.\quad|). Multi-line captions are
justified; single-line captions stay centered. Figure numbers run
continuously through the whole book (no chapter prefix), so
cross-references remain unambiguous in the List of Figures. The
caption font, the image--caption skip and the caption margins are
configurable with \opt{captionfont}, \opt{captionskip} and
\opt{captionmargin} (Section~\ref{sec:layout}).

% =============================================================
\section{Structural commands}\label{sec:structural}
% =============================================================

\begin{macro}{\unnumberedchapter}
\cs{unnumberedchapter}\marg{title} produces an unnumbered chapter
that is correctly wired for \pkg{hyperref}/\pkg{bookmark}: it opens
on a fresh recto page, creates a phantom anchor, adds a table of
contents entry and sets the running-head marks. Use it for a
preface, an afterword, acknowledgments, etc.
\begin{quote}
\begin{verbatim}
\unnumberedchapter{Afterword}
The story behind this book ...
\end{verbatim}
\end{quote}
\end{macro}

\begin{macro}{\chapterornament}
\cs{chapterornament} typesets the closing ornament --- three
centered asterisks --- with some vertical space above. Place it as
the last line of a chapter.
\begin{quote}
\begin{verbatim}
... and the mountain kept its silence.
\chapterornament
\end{verbatim}
\end{quote}
\end{macro}

% =============================================================
\section{Image macros}\label{sec:images}
% =============================================================

Three public macros cover every image case of an illustrated book.
All share the same argument structure
\begin{quote}
\cs{imageGrid}\oarg{options}\marg{files}\marg{caption}\marg{label}\\
\cs{imageColumns}\oarg{options}\marg{columns}\marg{caption}\marg{label}\\
\cs{imageBleed}\oarg{options}\marg{file}\marg{caption}\marg{label}
\end{quote}
and the same key--value interface. Each call produces exactly
\emph{one} figure number and one List-of-Figures entry; an empty
caption |{}| still produces a numbered figure with an empty entry.
Captions are typeset in \opt{captionfont} (default
\cs{footnotesize}), placed \opt{captionskip} below the image and
inset horizontally by \opt{captionmargin}.

The options \opt{place}, \opt{width}, \opt{maxheight}, \opt{gap}/
\opt{hgap}/\opt{vgap}, \opt{rotate}, \opt{letters},
\opt{lettercolor}, \opt{captionfont} and \opt{captionskip} are
accepted by all three macros, in addition to the function-specific
keys listed in each subsection below. \opt{captionfont} and
\opt{captionskip} override the corresponding \cs{bookasprosetup}
values for that figure only, and fall back to them when omitted;
the other caption keys (\opt{captionmargin}, \opt{bleedcaptionskip})
are global, settable only with \cs{bookasprosetup}.

\subsection{\cs{imageGrid}: single photos, grids, stacks, wraps}

\begin{macro}{\imageGrid}
\cs{imageGrid}\oarg{options}\marg{file1,file2,\dots}\marg{caption}\marg{label}
\begin{itemize}
\item \textbf{One file} $\to$ a single centered photograph at the
      composition width.
\item \textbf{Two or more files} $\to$ a grid with \opt{columns}
      columns (default 2); rows are computed automatically.
\item \opt{columns=1} with several files $\to$ a vertical stack.
\item \opt{wrap=left} or \opt{wrap=right} $\to$ a
      \env{wrapfigure}: the text flows beside the photograph;
      \opt{width} is the wrap width. In this mode \opt{place},
      \opt{columns} and \opt{mode} are ignored.
\item \opt{mode=bleed} $\to$ the whole composition covers a
      dedicated page (edge photos are trimmed --- this is the
      documented bleed behavior).
\end{itemize}

\paragraph{Options.}
\begin{description}
\item[\opt{place} = \texttt{htbp}] Float placement (\texttt{h},
  \texttt{t}, \texttt{b}, \texttt{p}, \texttt{H} and combinations).
\item[\opt{width} = \cs{textwidth}] Composition width.
\item[\opt{maxheight} = 0.70\cs{textheight}] Per-photo height cap
  (aspect ratio preserved); \texttt{none} disables the cap.
\item[\opt{gap} = 2\,mm] Spacing between photos, both directions.
\item[\opt{hgap} = 2\,mm] Horizontal spacing (overrides
  \opt{gap}).
\item[\opt{vgap} = 2\,mm] Vertical spacing (overrides \opt{gap}).
\item[\opt{columns} = 2] Number of grid columns
  (rows automatic).
\item[\opt{rotate} = 0] Rotation angle in degrees.
\item[\opt{letters} = \texttt{false}] Overlay letters a, b, c,
  \dots\ on the top-left corner of each photo.
\item[\opt{lettercolor} = \texttt{black}] Letter color (any
  \pkg{xcolor} expression).
\item[\opt{wrap} = \texttt{none}] \texttt{left} / \texttt{right} to
  wrap the text beside the photo; \texttt{none} for a normal
  figure.
\item[\opt{mode} = \texttt{normal}] \texttt{normal} floating
  figure / \texttt{bleed} full-page cover composition.
\end{description}

\paragraph{Examples.}
\begin{quote}
\begin{verbatim}
% Single centered photo
\imageGrid{summit}{The summit at dawn.}{fig:summit}

% 2x2 grid with overlaid letters
\imageGrid[columns=2,letters=true,lettercolor=white]
  {a,b,c,d}{The four stages of the ascent.}{fig:stages}

% Vertical stack
\imageGrid[columns=1,maxheight=0.45\textheight,vgap=1.5ex]
  {before,after}{The hut before and after the restoration.}{fig:hut}

% Rotated photo
\imageGrid[rotate=90,width=0.65\textheight,
           maxheight=0.90\textwidth]{map}{The route map.}{fig:map}

% Wrapped figure
\imageGrid[wrap=right,width=0.38\textwidth]
  {portrait}{The guide.}{fig:guide}

% Full-page bleed cover composition
\imageGrid[mode=bleed]{a,b,c,d}{}{fig:covergrid}
\end{verbatim}
\end{quote}
\end{macro}

\subsection{\cs{imageColumns}: column compositions}

\begin{macro}{\imageColumns}
\cs{imageColumns}\oarg{options}\marg{columns}\marg{caption}\marg{label}
builds a composition of top-aligned columns. The \meta{columns}
argument is a comma-separated list of \emph{braced groups}; each
group is one column, and the files inside a group (comma-separated)
are stacked vertically.

\paragraph{Options.}
\begin{description}
\item[\opt{place} = \texttt{htbp}] Float placement (\texttt{h},
  \texttt{t}, \texttt{b}, \texttt{p}, \texttt{H} and combinations).
\item[\opt{width} = \cs{textwidth}] Composition width.
\item[\opt{maxheight} = \texttt{none}] Per-photo height cap
  (aspect ratio preserved).
\item[\opt{gap} = 2\,mm] Spacing between photos, both directions.
\item[\opt{hgap} = 2\,mm] Horizontal spacing (overrides
  \opt{gap}).
\item[\opt{vgap} = 2\,mm] Vertical spacing (overrides \opt{gap}).
\item[\opt{widths} = equal] Column widths in percent, e.g.\
  \texttt{30,40,30}; a sum $\neq 100$ is redistributed
  proportionally (warning logged).
\item[\opt{rotate} = 0] Rotation angle in degrees.
\item[\opt{letters} = \texttt{false}] Overlay letters a, b, c,
  \dots\ on each photo.
\item[\opt{lettercolor} = \texttt{black}] Letter color (any
  \pkg{xcolor} expression).
\item[\opt{mode} = \texttt{normal}] \texttt{normal} floating
  figure / \texttt{bleed} full-page cover composition.
\end{description}

\paragraph{Examples.}
\begin{quote}
\begin{verbatim}
% Two equal columns, the right one stacks two photos
\imageColumns{{a},{b,c}}{Left: the valley. Right: the two
  summits.}{fig:valley}

% 40/60 split with letters
\imageColumns[widths={40,60},letters=true]
  {{a},{b,c}}{A 40/60 composition.}{fig:split}

% Three columns as a bleed cover
\imageColumns[mode=bleed,widths={30,40,30}]
  {{a},{b,c},{d}}{}{fig:colcover}
\end{verbatim}
\end{quote}
\end{macro}

\subsection{\cs{imageBleed}: full, partial and vertical bleed}

\begin{macro}{\imageBleed}
\cs{imageBleed}\oarg{options}\marg{file}\marg{caption}\marg{label}
places a single photograph with bleed.

\paragraph{Options.}
\begin{description}
\item[\opt{mode} = \texttt{full}] \texttt{full} whole-sheet cover
  / \texttt{partial} horizontal bleed / \texttt{vertical}
  full-height bleed.
\item[\opt{place} = \texttt{htbp}] Float placement for
  \texttt{partial} mode; \texttt{c} $\to$ dedicated plate page.
\item[\opt{rotate} = 0] Rotation angle in degrees.
\item[\opt{page} = \texttt{auto}] Force the page parity:
  \texttt{auto}, \texttt{even} or \texttt{odd} (a blank page is
  inserted as needed).
\item[\opt{folio} = \texttt{true}] Overlaid page number.
\item[\opt{background} = \texttt{true}] Semi-transparent panels
  behind caption/folio (the text is always solid).
\item[\opt{color} = \texttt{white}] Caption/folio color.
\item[\opt{orientation} = \texttt{auto}] Preferred cover fill side
  (\texttt{mode=full}): \texttt{auto}, \texttt{landscape},
  \texttt{portrait} (a full cover is guaranteed in any case).
\item[\opt{extend} = \texttt{none}] \texttt{mode=partial} only:
  \texttt{top} banner (with \texttt{place=t}) / \texttt{bottom}
  footer (with \texttt{place=b}).
\item[\opt{overlay} = \texttt{false}] \texttt{mode=partial},
  \opt{extend=bottom} only: overlay the caption on the footer image
  (colored with \opt{color}, paneled with \opt{background}), like
  the \texttt{full} and \texttt{vertical} bleeds. \texttt{false}
  keeps the caption above the image.
\end{description}

\paragraph{Full mode (default, \opt{mode=full}).}
A dedicated page: the image covers the \emph{whole physical sheet}
(paper + bleed) with uniform scaling --- no distortion; the excess
on the long side is trimmed. The caption and the folio are
overlaid at the bottom on semi-transparent panels
(\opt{background}, \opt{color}, \opt{folio}). The page parity can
be forced with \opt{page=even} or \opt{page=odd}. The preferred
fill side can be suggested with \opt{orientation}; a full cover is
guaranteed regardless. \opt{rotate} is applied before the cover
scale is computed.

\paragraph{Partial mode (\opt{mode=partial}).}
The image spans the full sheet width (\cs{paperwidth}) but keeps
its natural height; it behaves as a floating figure
(\opt{place}) with text above and below and a standard caption.
The alignment is parity-safe even with asymmetric margins.
\opt{rotate} works here too (the width is computed on the rotated
image). Too-tall images are uniformly reduced to fit the page
(a warning is logged). Special placements:
\begin{itemize}
\item \opt{place=c}: a dedicated \emph{plate page} --- the image
      is centered on the physical sheet (horizontal bleed, natural
      height), caption below, normal folio, no text above/below.
\item \opt{extend=top} (with \opt{place=t} or \texttt{p}, without
      \texttt{h}): the image top reaches the \emph{physical} page
      top, covering the top bleed --- a full-width top banner. On a
      chapter-opening page a \texttt{t} float sits \emph{below} the
      chapter title; for a true edge-to-edge banner put the figure
      on a page without a title (e.g.\ \cs{clearpage} first).
\item \opt{extend=bottom} (with \opt{place=b} or \texttt{p},
      without \texttt{h}): the image bottom reaches the
      \emph{physical} page bottom --- a full footer; the caption is
      placed \emph{above} the image (or overlaid on it with
      \opt{overlay}). Works on chapter pages too.
\end{itemize}
\opt{extend} is validated against \opt{place}: if the placement
contains \texttt{h} or lacks the required \texttt{t}/\texttt{b}
(or \texttt{p}), a warning is logged and \opt{extend} is ignored.

\paragraph{Vertical mode (\opt{mode=vertical}).}
The image fills the \emph{whole physical sheet height} (uniform
scale, top and bottom bleed past the trim), while its width stays
natural: a portrait image therefore leaves white bands on the left
and right. The image, the caption and the folio are horizontally
centered on the \emph{text block} (parity-aware asymmetric
margins), not on the physical sheet. \opt{rotate} works as in the
other modes.

\paragraph{Examples.}
\begin{quote}
\begin{verbatim}
% Full-page cover, white caption on panels
\imageBleed{panorama}{The ridge at sunset.}{fig:panorama}

% Full cover on a verso page, no panels, black text
\imageBleed[page=even,background=false,color=black]
  {forest}{The old forest.}{fig:forest}

% Partial bleed, bottom of the text flow
\imageBleed[mode=partial,place=b]{river}
  {The river, full sheet width.}{fig:river}

% Top banner reaching the physical page edge
\clearpage
\imageBleed[mode=partial,place=t,extend=top]{sky}
  {A full-width top banner.}{fig:sky}

% Full footer, caption above the image
\imageBleed[mode=partial,place=b,extend=bottom]{meadow}
  {A full-width footer.}{fig:meadow}

% Centered plate page
\imageBleed[mode=partial,place=c]{plate}
  {A centered plate.}{fig:plate}

% Vertical bleed: full sheet height, natural width
\imageBleed[mode=vertical]{spire}
  {A full-height vertical image.}{fig:spire}
\end{verbatim}
\end{quote}
\end{macro}

% =============================================================
\section{Bleed proofing overlay}\label{sec:proofing}
% =============================================================

\begin{macro}{\showBleedMargin}
\cs{showBleedMargin}\oarg{options} draws, on \emph{every} page
(shipout foreground, visible even over full-bleed images):
\begin{itemize}
\item the \textbf{trim line in red}, inset from the PDF edge by
      the bleed amount, plus black cam crop marks at the corners;
\item the \textbf{inner safety margin in dashed blue}, further
      inside the trim line by the margin amount;
\item the \textbf{text block border in dashed green}
      (parity-aware, follows the asymmetric inner margin);
\item a small data label at the bottom reporting the bleed and
      margin values in millimetres.
\end{itemize}
It is \emph{pure drawing}: no margin, layout or paper-size change.
Each layer can be toggled independently, and per-side values are
supported (\texttt{bleedleft}, \texttt{bleedright}, \texttt{bleedtop},
\texttt{bleedbottom} and \texttt{marginleft}, \texttt{marginright},
\texttt{margintop}, \texttt{marginbottom}).

\paragraph{Options.}
\begin{description}
\item[\opt{bleed} = 3\,mm] Bleed on all sides (from the PDF edge);
  per-side keys \texttt{bleedleft}, \texttt{bleedright},
  \texttt{bleedtop}, \texttt{bleedbottom}.
\item[\opt{margin} = 5\,mm] Inner safety margin on all sides (from
  the trim line); per-side keys \texttt{marginleft},
  \texttt{marginright}, \texttt{margintop}, \texttt{marginbottom}.
\item[\opt{showbleed} = \texttt{true}] Draw the red trim line +
  crop marks.
\item[\opt{showmargin} = \texttt{true}] Draw the blue dashed
  margin.
\item[\opt{showtext} = \texttt{true}] Draw the green dashed
  text-block border.
\item[\opt{label} = \texttt{true}] Draw the bottom data label
  (values in mm).
\end{description}

\begin{quote}
\begin{verbatim}
\showBleedMargin[bleed=3mm,margin=5mm]
% ... or asymmetric values:
\showBleedMargin[bleedleft=4mm,bleedright=3mm,
                 margin=6mm,label=false]
\end{verbatim}
\end{quote}
\end{macro}

\begin{macro}{\hideBleedMargin}
\cs{hideBleedMargin} disables the overlay (the default state).
\end{macro}

\begin{macro}{\showBleed}
Legacy alias kept for compatibility:
\cs{showBleed}\marg{mm} is equivalent to
\cs{showBleedMargin}|[bleed=|\meta{mm}|mm]|.
\end{macro}

\begin{macro}{\hideBleed}
Legacy alias of \cs{hideBleedMargin}, kept for compatibility.
\end{macro}

\textbf{Important:} the overlay is for visual verification only.
Disable it (or remove the call) before sending the file to the
printer: the final PDF must contain neither crop marks nor debug
labels. The \opt{bleedmarks} class option enables it at load
time; without that option the overlay is off by default.

% =============================================================
\section{Development and availability}
% =============================================================

\cls{bookaspro} is maintained in a Git repository at
\begin{quote}
\url{https://gitlab.com/stedal80/bookaspro}
\end{quote}
where the source code, the issue tracker and the release artifacts
are kept. Bug reports, feature requests and contributions are
welcome there.

The class is being prepared for official publication on CTAN
(the Comprehensive \TeX{} Archive Network), so that it can be
installed through the usual distributions and package managers
(\pkg{tlmgr}, MiKTeX Console, etc.).

The class is the result of numerous book-layout projects carried
out in \LaTeX, consolidated and progressively refined with the help
of artificial intelligence.

% =============================================================
\section{Compilation notes}
% =============================================================

\begin{itemize}
\item \textbf{Two compilations.} The bleed overlays and the
      partial-bleed alignment use TikZ's ``remember picture''
      mechanism: compile \emph{twice} (or use |latexmk|) for
      correct positioning.
\item \textbf{Warnings.} The class logs a warning when
      \opt{widths} do not sum to 100 (proportional redistribution
      is applied), when a partial-bleed image is too tall and is
      reduced, and when \opt{extend} is incompatible with
      \opt{place} (it is then ignored).
\item \textbf{Image paths.} The default additional search path is
      |./img/|; change it with \cs{bookasprosetup}|{imagepath=...}|
      or add your own \cs{graphicspath} entries.
\item \textbf{Language.} Load \pkg{babel} or \pkg{polyglossia}
      yourself; \cls{bookaspro} does not set any language.
\end{itemize}

% =============================================================
\section{A complete example}
% =============================================================

\begin{quote}
\begin{verbatim}
\documentclass{bookaspro}
\usepackage{polyglossia}
\setmainlanguage{english}

% Proofing only -- remove before printing:
\showBleedMargin[bleed=3mm,margin=5mm]

\begin{document}
\frontmatter
\begin{titlepage}
  \centering
  \vspace*{3.5cm}
  {\Huge\bfseries The Printed Mountain\par}
  \vspace{1.2cm}
  {\large\itshape A story in photographs\par}
  \vfill
\end{titlepage}
\tableofcontents

\mainmatter
\chapter{The Ascent}
The trail begins at the old hut ...

\imageGrid[columns=2,letters=true]
  {hut,trail,ridge,summit}
  {The four stages of the ascent.}{fig:stages}

\imageBleed{panorama}{The ridge at sunset.}{fig:panorama}
\chapterornament

\unnumberedchapter{Afterword}
How this book was made ...

\backmatter
\listoffigures
\end{document}
\end{verbatim}
\end{quote}

A compilable version of this example, using the placeholder images
of the \pkg{mwe} package, is distributed as \file{example_bookaspro.tex}.

% =============================================================
\section{License}
% =============================================================

Copyright (C) 2026 Stefano Dalpez.

This work may be distributed and/or modified under the conditions
of the \LaTeX{} Project Public License, either version~1.3c of
this license or (at your option) any later version. The latest
version of this license is in
\begin{quote}
\url{http://www.latex-project.org/lppl.txt}
\end{quote}
and version~1.3c or later is part of all distributions of \LaTeX{}
version 2005/12/01 or later.

This work has the LPPL maintenance status `maintained'.

The Current Maintainer of this work is Stefano Dalpez.

This work consists of the files \file{bookaspro.cls},
\file{bookaspro-doc.tex}, \file{example_bookaspro.tex} and
\file{README.md}.

\end{document}