To tackle this problem I used a combination of markings and
lists. The volume indicating the topics is very similar to a table
of contents, so I used that mechanism. Instead of listing all the
contained parts, only the first and last one should be displayed. I
defined a custom list alternative which does exactly that. An
additional check is included to catch the case of only one section
element to prevent output like “This part covers Beans - Beans”.
The same mechanism is used for the chapter summary. The sections are
displayed in the footer of the page and use the markings
mechanism, which works without any special modifications.
The custom list is hooked into the part and chapter macros using the
insidesection
key. This key only works with the MkIV sectioning
style. So you have to use \startchapter … \stopchapter
instead of
\chapter{…}
.
The setup:
%% only for the screenshot %%%%%%%%%%%%%%%%%%%%%%%%
\setuppapersize [A6] [A4, landscape] %%
\setuparranging [2SIDE] %%
\setuplayout [marking=on, location=middle] %%
\setupbodyfont [16pt] %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setuplist [alternative=ListRange] %% a custom list alternative is used
\setupfootertexts [\setups{footer}]
%% displays the topic of the current page in the footer
\startsetups [footer]
\getmarking [section] [top] --\space
\getmarking [section] [bottom]
\stopsetups
\setuphead [part] [insidesection=\PartIntro, footer=empty]
\setuphead [chapter] [insidesection=\ChapterIntro]
\starttexdefinition PartIntro
This part covers:
\placecontent [list=chapter]
\stoptexdefinition
\starttexdefinition ChapterIntro
This chapter covers:
\placecontent [list=section]
\stoptexdefinition
%% The default list alternatives don't meet the requirements, but it's easy to
%% define a custom one
\definelistalternative
[ListRange]
[renderingsetup=list:ListRange]
%% The default lists print a list of all structure elements, but in this case
%% only the first and last one is desired.
\startsetups [list:ListRange]
%% catch the case of only one chapter per part
\doifelse\structurelistsize1
{\crlf\currentlistentrytitle}
{\doif\currentlistindex1{\crlf\currentlistentrytitle\space--\space}
\doif\currentlistindex\structurelistsize\currentlistentrytitle}
\stopsetups
The content:
\starttext
\noheaderandfooterlines
This volume covers: \placecontent [list=part]
\startpart [title=A]
\startchapter [title=Animals]
\startsection [title=Koalas]
\stopsection
\startsection [title=Kangaroos]
\stopsection
\stopchapter
\startchapter [title=Animation]
\startsection [title=Disney]
\stopsection
\startsection [title=Japanese]
\stopsection
\startsection [title=South American]
\stopsection
\stopchapter
\stoppart
\startpart [title=B]
\startchapter [title=Beans]
\startsection [title=Kidney Beans]
\stopsection
\startsection [title=Green Beans]
\stopsection
\startsection [title=Jelly Beans]
\stopsection
\stopchapter
\stoppart
\stoptext
