LiveTOC User Guide

LiveTOC User Guide

Purpose

LiveTOC converts a manually created table of contents (TOC) into a fully live InDesign TOC.

The script:

  1. Extracts chapter titles from TOC entries.
  2. Searches the document (or all open documents) for matching headings.
  3. Creates destinations at those headings.
  4. Replaces page number placeholders with live InDesign cross-references that point to those destinations.
  5. Optionally creates hyperlinks from TOC entries to the corresponding headings.

The result is a table of contents whose page numbers update automatically if the document is edited and headings move from one page to another.

Since the page numbers are implemented as native InDesign cross-references, it is not necessary to rerun the script after page numbers change. The TOC entries will continue to display the correct page numbers automatically.

LiveTOC is particularly useful when you need a customized TOC design that cannot easily be generated using InDesign’s built-in Table of Contents feature.


Typical Workflow

  1. Run LiveTOC with nothing selected to display the LiveTOC preferences dialog and configure the script options.
  2. Choose the heading paragraph styles used throughout the document.
  3. Configure the desired options and close the dialog.
  4. Select one or more TOC entries from the existing document TOC.
    Note: LiveTOC does not generate a TOC for you. It presumes a TOC already exists, and converts the page numbers in that TOC to live page numbers. But the TOC has to exist first. You can create a TOC manually, copy it from Word, or use InDesign’s Table of Contents feature to create the TOC.
  5. Run LiveTOC again.
  6. The script converts the selected entries into live cross-references and hyperlinks.

Once created, the page numbers remain live and update automatically as the document changes.


Running the Script

LiveTOC behaves differently depending on the current selection.

Current Selection Result
Nothing selected Opens the Preferences dialog
One paragraph or less selected Runs in Single Paragraph Mode
Multiple paragraphs selected Runs in Multi-Paragraph Mode

 


Preferences

To open the Preferences dialog, ensure that nothing is selected in the document (Edit > Deselect All) and run the script.

These options will be described below in order.

Note: If an insertion point is active but no text is selected, LiveTOC displays an error message and does not run:

“Paragraph styles used for chapter headings throughout document”

Choose one or more paragraph styles that identify chapter headings throughout the document. Click the + and − buttons to add or remove paragraph styles dropdowns.

LiveTOC searches only paragraphs using the selected styles.

Up to 20 paragraph styles may be specified.

“Scope”

Choose one of the following:

  • Search this document only
  • Search all open documents

The second option is useful when a publication is split across multiple InDesign documents.

“Live page number location”

Choose how LiveTOC identifies the page number location within each TOC entry.

a. “Replace existing numbers at end of each TOC entry with live link”

Choose this option if your TOC has existing page numbers:

The script replaces the existing page number at the end of the entry with a live cross-reference.

b. “Replace ‘000’ placeholder anywhere in TOC entry with live link”

Choose this option to replace ‘000’ anywhere in the TOC entry with a live page number.

This is especially useful for non-standard tables-of-contents where the page number does not appear at the end of the TOC entry.

The script replaces the ‘000’ placeholder, wherever it appears, with a live cross-reference.

c. “There are no page numbers (useful for ePub export)”

In this mode, no page-number cross-references are created. Hyperlinks may still be created, converting the entire chapter-title into a clickable hyperlink.

This option is useful for ePub workflows. EPubs do not have page numbers, but you may nevertheless want to allow the user to click on an entry in the TOC and be taken to the appropriate chapter in the ePub.

“Location of Chapter Names”

These options determine how LiveTOC extracts chapter titles from TOC entries when multiple paragraphs are selected.

a. Starting word

Choose the word at which the chapter title begins (options range from 1st word through 12th word).

b. Ending character

Choose where the chapter title ends.

Available delimiters: Tab, Right-indent tab, Regular space, En space, Em space, End of paragraph, and Colon (:)

Example:

If the title begins at the 3rd word and ends at the right-indent tab, the extracted title would be: “Back to Western Rationalism”.

Explanation: Word 1 = ‘Chapter’. Word 2 = ‘4’. Word 3 = ‘Back’. From ‘Back’ up to the right-indent tab = “Back to Western Rationalism”.

“Create Hyperlinks”

When enabled, LiveTOC creates clickable hyperlinks from TOC entries to their corresponding headings.

“Display Error Messages”

When enabled, LiveTOC displays warnings when entries cannot be processed.


Single Paragraph Mode

Single Paragraph Mode is activated when one paragraph or less is selected.

In this mode, LiveTOC ignores the title extraction settings described above.

Instead, it searches using the exact selected text.

For example, if the selected text is:

the script searches directly for “Revolutionary Nature” within the selected heading styles.

This mode is useful when:

  • A single TOC entry needs to be fixed
  • The title is unusual or formatted differently from other entries

Multiple Matches

If the selected text appears in multiple eligible headings, the script displays a dialog listing all matches and their page locations. You can then choose which occurrence should be used as the destination.

The script attempts to pre-select the most likely destination based on page order.

No Match Found

If no matching heading is found:

  • An error message may be displayed
  • No page-number replacement occurs

 


Multi-Paragraph Mode

Multi-Paragraph Mode is activated when more than one paragraph is selected.

This is the standard mode for processing an entire TOC.

For each selected paragraph:

  1. LiveTOC extracts a title according to the configured Start Word and Ending Character settings.
  2. Searches for matching headings.
  3. Creates a destination.
  4. Replaces the page number placeholder.
  5. Creates hyperlinks if enabled.

Missing Delimiters

If the specified delimiter cannot be found in a TOC entry, that entry is skipped.

Multiple Matches

If multiple matching headings are found, LiveTOC prompts you to choose the correct destination (see above, “Multiple Matches”).

Missing Matches

If no matching heading is found, the entry is skipped.


Search Behavior

LiveTOC performs case-insensitive searches.

It also ignores forced line breaks inside headings.

For example, the TOC entry:

Chapter Title

will match a heading formatted as:

Chapter
Title

… provided that a forced line break separates the two lines (Shift + Enter) and not a full paragraph break (Enter alone).

 


Error Handling

Depending on your settings, LiveTOC may report:

  • Missing delimiters
  • Missing heading matches
  • Missing placeholders
  • Multiple placeholders in a TOC entry
  • Other processing errors

These messages are intended to help identify entries that require manual correction.