Endnote running headers

Publications with endnotes in a separate chapter or section often have running headers that indicate the page range of the notes on that page, as in Notes to pp. 123–138. The script described here adds the page references in the running headers.

The publication can be in separate documents (chapters of a book with the endnotes in their own chapter) or in a single document, with the endnotes in a separate section. Separate documents need not be in an InDesign indb book.

Prerequisites: Setting up the documents

The script depends on several styles and named objects. Most of these can be configured using a configuration file (see below), but some need to be hard-coded in the script and, therefore, in the documents.

Endnote references

The endnote references in the documents must be formatted with a character style. That style must be used only for endnote references, and all endnote references must be styled only with that character style. Any name will do.


The endnotes must be styled with paragraph styles. You can use several styles for the endnotes, but those styles must be used for endnotes only.

Endnotes that consist of two or more paragraphs must use two paragraph styles: one style for the first paragraph, another style for the second and any other paragraphs.

In the endnote document or section, the first text frame of the note story must be named End-of-book notes (spelled exactly like that) on the Layers panel. To name a page item, select it and open the Layers panel (press F7 or go to Window > Layers). The selected frame is indicated by a solid square. A slow double-click on the name (shown by some content in angle brackets) lets you enter a name.

Running-header frames

Create a separate master spread for the endnotes and place a text frame for the running headers. Name the frame on the Layers panel. You can use any name, you'll set it in the configuration file.

Add the text for the running header, which must include placeholder text for the page range, e.g. Notes to pp. 00–00. The minimum requirement is two digits separated by a hyphen or an en rule: that's what the script looks for.

The configuration file

The configuration file is used to tell the script which style names are used. It has three entries:

#Endnote reference character style: Endnote reference
#Endnote paragraph styles: Note Text Start|Note Text Continued
#Endnote running header frame: endnotes header

The text between # and the colon are labels used by the script and must not be changed. Enter the name of the used styles and frame name after the colons. If you use two or more paragraph styles for the endnotes, enter all names separated by a pipe symbol (|). Note that the paragraph style used for the second and following paragraphs in a multi-paragraph note must not be entered in the configuration file. All names are case-sensitive.

The configuration file is a plain text file. It should have the same name as the script (with file type .txt), and it and the script must be stored in the same folder. There's a sample in the download.

Document names

In a multi-document publication, the order in which the documents are processed is important. If the documents are in a book (indb) file, the names of the documents are not important as the order is taken from the book file. Without a book file, however, the documents must be numbered so that the script knows how to order them. Document names must start with a number, which must be separated from the name proper by a hyphen or an underscore character, e.g. 00_Frontmatter.indd, 01_Chapter1.indd, 02_Chapter2.indd, etc. Naturally, in a single-document publication, the document name is immaterial.

Running the script

Open all the documents that contain endnote references. (If there are more than a handful of cross-references in the documents, open all documents that make up the publication, the script will run quicker.) Run the script. It first checks whether the items in the configuration file are present. Any problems are shown in an alert and the script stops. Fix the problem and start the script again.

When the configuration file is processed without errors, the script counts the note references and the endnotes. If the two counts do not match, an alert is displayed that tells you how many note references there are and how many endnotes. The script stops; fix the problem and run the script again.

Version history

11 Oct. 2017: Some bug fixes: the script now works in CS6 too and sorts page numbers correctly.

9 Sept. 2017: First posted.

Useful script? Saved you lots of time?

Consider making a donation. To make a donation, please press the button below. This is Paypal's payment system; you don't need a Paypal account to use it: you can use several types/brands of credit and debit card.

Peter Kahrel's paypal account


Back to notes page

Back to script index

Installing and running scripts

Questions, comments? Get in touch