Your table of contents is always in sync


Compositions that are large enough to have a table of contents can benefit from the BLUEPHRASE listmark feature. This is especially convenient when the structure of your composition is being adjusted during its development.

BLUEPHRASE has special listmark notation to help authors to correctly build lists. The most basic list that most large compositions need is the "Table of Contents". With BLUEPHRASE though, other types of list, such as "List of Figures", "List of Tables", and so forth, are possible with this same listmark feature.

Items that should be included in the list are marked within the body-matter of the document using listmark notation. Each place where significant subject matter occurs in the body-matter, the author surrounds the identifying phrase with parenthetical doppelmarks that look like this (( ... )).

Inside the doppelmarks, are two delimited expressions:

  • an interscribed expression delimited with single-quotes ' ... ', and
  • an adjunct expression delimited with double-quotes " ... ".

Here's an example of listmarks:

h1 (('1: Physics' "Physics"))
h2 (('1.1 Motion' "-- Motion"))
h1 (('2: Chemistry' "Chemistry"))
h2 (('2.1 Covalence' "-- Covalence"))

When this BLUEPHRASE is compiled, the emitted HTML contains the interscribed expression, with a hyperlink back to the table of contents, which appears elsewhere. Here's how the example would be emitted:

<h1><a id=lm20 href='#lm24'>1: Physics</a></h1>
<h2><a id=lm20 href='#lm25'>1.1 Motion</a></h2>
<h1><a id=lm20 href='#lm26'>2: Chemistry</a></h1>
<h2><a id=lm20 href='#lm27'>2.1 Covalence</a></h2>

Building the table of contents

The adjunct expressions from all of the listmarks in your manuscript are gathered together and emitted where a build pragma occurs. Lists can be ordered sequentially (such as for a Table of Contents) or alphabetically (for other types of lists). Here's what it might look like:

div {
h1 Table of Contents
!build-list *order=sequential

Then, the relevant portion of the emitted output (ignoring all other listmarks, for brevity) would look like this:

<h1>Table of Contents</h1>
<ol class='toc'>
<li id=lm24><a href='#lm20'>Physics</a></li>
<li id=lm25><a href='#lm21'>-- Motion</a></li>
<li id=lm26><a href='#lm22'>Chemistry</a></li>
<li id=lm27><a href='#lm23'>-- Covalence</a></li>

Each item in the list is hyperlinked to the place in the body matter where the significant subject matter occurs.

Your table of contents is always in sync

🔗 🔎