I am working with a multi-volume document within a single PDF and with no reset page or section numbers.

As ConTeXt does not seem to have any \volume title, as it has for \part and \chapter, I just put in new title pages whenever needed. The document structure looks like this, with \titlepage being a custom macro which places the title information and displays the volume number:


I found that if I place the table of contents in the first volume, it is too long. I need to place one table of contents within each volume, which only shows entries, such as \part, \chapter, \section, etc., for that volume and no other.

How can I place a table of contents within my \titlepage macro, such that ConText creates one table of contents appearing after each title, and each table of contents only shows the content appearing after that title page, but not after the following title page? E.g., the table of contents for the first volume appearing above would look like this:

1 Alligators
    1 Freshwater
        1 Diet
        2 Habitat
 2 Fish

Entries for "volume" do not need to appear inside these lists.

2 Answers 2


You want the toplevel structure to be named volume and separate TOCs for each of these. The tricky part is that every structure has a list associated with it and you can’t just clear that along the way, leaving only the local items to be typeset. So the obvious solution is: don’t use the same structures all the time. Different structure, different list.

The code below demonstrates a \titlepage macro that dynamically creates new structures (headings, lists) each time it is called. Everything happens in the background, so you can just continue using your structure macros. With one exception: I took the liberty of titlecasing the labels (e.g. \part -> \Part) to avoid confusion.

Demo output on A6 paper.

%% 1. Define headings matching your structuring preferences. To get a
%%    “volume” structure at level 1, just map it to part =) These will
%%    form the base of the dynamically generated structures later.
%%    NB: To achieve a consistent overall layout you will want to
%%    \setuphead and \setuplist these blueprints here, not their
%%    copies.
\definehead [base_volume]  [part]                                    % level 1
\definehead [base_part]    [chapter]    [sectionsegments=chapter]    % level 2
\definehead [base_chapter] [section]    [sectionsegments=section]    % level 3
\definehead [base_section] [subsection] [sectionsegments=subsection] % level 4

\definelist [base_volume]  [part]
\definelist [base_part]    [chapter]    [style={\word\sc}]
\definelist [base_chapter] [section]    [style=bold]
\definelist [base_section] [subsection] [style=italic]

%% 2. Some settings to fake the  titlepage.
\definemakeup [titlepage]
\defineframed [volumetitledisplay] [


%% 3. Initialize a counter. It will be used to create macros and lists
%%    for each volume.
\newcount \nvolumes \nvolumes0

%%                            main macro
  %% 4. Increment the volume counter.

  %% 5. Define some internal shortcuts involving the current counter.
  \setevalue {currentvolume}{volume_\the\nvolumes}
  \setevalue   {currentpart}{part_\the\nvolumes}
  \setevalue   {currentlist}{list_\the\nvolumes}

  %% 6. Create the structures local to this volume. They inherit the
  %%    setups from their parents as defined above.
  \definehead [\currentvolume]  [base_volume]
  \definehead [\currentpart]    [base_part]
  \definehead [\currentchapter] [base_chapter]
  \definehead [\currentsection] [base_section]

  \definelist [\currentvolume]  [base_volume]
  \definelist [\currentpart]    [base_part]
  \definelist [\currentchapter] [base_chapter]
  \definelist [\currentsection] [base_section]

  %% 7. The TOC is a combined list. It needs to be recombined for each
  %%    volume, referencing the appropriate structure lists.
  \definecombinedlist [\currentlist] [%\currentvolume,%
  \setupcombinedlist [\currentlist] [ criterium=text, ]

  %% 8. The user macros. They are uppercased to distinguish them from
  %%    the builtin ones with the same name. Nothing special, really:
  %%    they just map to the most recently generated structures.
  \setevalue {Volume}{\csname\currentvolume\endcsname}
  \setevalue   {Part}{\csname\currentpart\endcsname}

  %% 9. Some title page stuff that is actually visible. If the volumes
  %%    should carry a title, just make \titlepage monadic and pass the
  %%    argument to \Volume{}. In order to make the title appear, don’t
  %%    forget \setuphead[base_volume][placehead=yes]!
  \Volume{\the\nvolumes} %% <= here
      {\sc Volume} \the\nvolumes

  %% 10. Typeset the table of contents.
  \csname place\currentlist\endcsname


%%                               usage



You can divide the text and put the volumes in individual files. That way you have smaller files and the table of content automatically shows only the current volume.

To adjust for the page number offset you can use


and to adjust the part numbering


The first argument is the structure level, one means part, two means chapter, etc. The second argument is the increment. It depends on the number of parts in the preceeding volume.

  • Is there any way which does not involve placing the text into different files? This manner will interfere too much with existing scripts which need all of the material in one file and which will not work if each volume is compiled separately.
    – Village
    Sep 23, 2012 at 10:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .