Dynamic sidenotes (CS4 and later)

Based on the method for dynamic endnotes first outlined by Peter Gold and formalised in InDesign by Bob Bringhurst (see Bob's blog), and following on from the scripted approach of this method (see Dynamic endnotes), this page now provides scripts to convert InDesign footnotes to sidenotes (or "margin notes") and to set up a sidenote system in new documents, to add sidenotes to a document, to stack sidenotes, and to reset sidenotes. (After finishing the scripts and these pages did I become aware of Martin Fischer's script dealing with sidenotes in CS3 -- see this thread on www.hilfdirselbst.ch.)

The script can also be used to set up sidenotes in a new document, both numbered and unnumbered notes. A second script can be used to create new notes in a document.

The screenshot shows an example of a document whose footnotes have been converted to sidenotes.

Dynamic sidenotes

The notes are added to the document as anchored text frames, so that when the main text is edited, the notes travel with the note references. When new notes are added, the numbers are updated automatically.

Convert footnotes to sidenotes

The script (sidenotes.jsx) converts all footnotes in a document to sidenotes. Open the document whose footnotes you want to convert to sidenotes and run the script. It displays this dialog (the values are simply script defaults):

Dynamic sidenotes

You're asked to enter two things: the width of the sidenote textframes and the distance between the sidenote and the main text. At Numbered notes you indicate whether the notes should be numbered: check this box to add note numbers and references in the text. To suppress all numbering, uncheck the box. Click OK or press Enter/Return to run the script.

Apart from the width of the sidenotes, all details (such as typeface, pointsize, and the position of the notes) are handled by styles so that any options you want to change are to be changed in the styles; see Some details, below.

The script first creates some styles and some other required items:

  1. a character style for the numbers in the notes;
  2. a character style for the note references;
  3. a numbered list for use in the paragraph style's bullet & numbering section;
  4. a cross-reference format;
  5. a paragraph style for the sidenotes;
  6. an object style for the note frames.

All these are called sidenote; the names of the two character styles are sidenote_reference and sidenote_number. For unnumbered sidenotes, only the last two items, paragraph and object style, are created. The download includes a small sample file that can be used to test the scripts.

Setting up sidenodes in new documents

To set up sidenotes in a document and add notes manually later, just run the sidenotes script in that document. The script creates the same six items that were described above (for unnumbered notes just two).

Adding new sidenotes

New sidenotes are best added using the sidenote_add script. You can opt to add a sidenote in either of three ways: (1) add a new empty sidenote frame and type text in it; (2) select some text, create a new sidenote, and let the script move that selected text to the new note; or (3) create a new note and copy the contents of the clipboard into it. These are the options shown in the script's dialog:

Dynamic sidenotes: add

To add a sidenote, position the cursor where the note reference is supposed to be and run the script. Type the relevant number or the underscored letter at Mode: or just press Enter/Return if the selection at Mode: is the correct one.

When you create an empty sidenote and add text to it, press Ctrl+Alt+C (or Cmd+Opt+C) afterwards to fit the note's frame to the text. That's all you need to do: there shouldn't be any need to apply any style to the new note: the object style applied to the sidenote has all styles defined in it.

Changing the width of placed sidenotes

A frame's width is just about the only thing that can't be set in its object style, so to change the width of existing notes we need a script. To resize all sidenotes, run the separate script sidenotes_width.jsx. It shows this dialog:

Dynamic sidenotes: resize

Enter the new width and press Enter/Return to start the script. This applies to all sidenotes.

Stacking sidenotes

Sidenotes are created where they are cued, that is, where the reference is, as shown in the first screenshot, above. A separate script lets you stack all sidenotes at the bottom of the text area, at the top, or at the centre. The screenshot shows sidenotes stacked at the bottom of the left-hand page and placed at the top of the right-hand page.

Dynamic sidenotes: resize

To stack notes, run the sidenotes_stack script. It shows this dialog:

Dynamic sidenotes: resize

Three things to select here. First, pick a vertical position for the stack (top, centre, or bottom). Next, if you've selected a text frame that contains sidenotes, you can choose to stack just the sidenotes linked to text in that frame. You can also choose to do all notes in the document. Finally, set the vertical space between the notes at Space between notes.

Resetting notes

To reset all the document's notes to the original size and position, run the sidenotes_reset script. It reapplies the object style to all notes and resets their size. It has no interface.

Some details

Apart from the width of the sidenotes, all their properties are captured in styles. Here's a rundown so you know where to look if you want to change anything.

Paragraph style - The paragraph style is set to some initial values (point size and alignment) and uses paragraph numbering. The paragraph style uses the numbered list sidenote. Numbers are formatted by the character style sidenote_number. The paragraph style is set in the object style.

List - The list used in the paragraph style determines whether numbering should span stories (it is set to Yes, leave it like that) and whether numbers should restart in each document (in a Book). Renumbering starts at each chapter by default; to change this, edit the list via Type > Bulleted & Numbered Lists > Define Lists...

Character styles - The script adds two character styles. sidenote_reference determines the format of the note references, sidenote_number formats the numbers in the sidenotes.

Object style - All aspects of positioning the sidenotes are handled by the object style. To change any of these aspects, edit the object style sidenote (Window > Object styles; right-click sidenote and pick Edit "sidenote"...). The screenshot shows the defaults set by the script (this is part of the Object Style Options dialog).

Dynamic sidenotes: object-style panel

A brief explanation of the options follows. Several of the options in this dialog interact, and the best way to find out how all this works is to change the options and see what happens (check the dialog's Preview box, which not visible in the screenshot).

Relative to spine - Keep this box checked: it ensures that the sidenotes are placed correctly on left- and right-hand pages, as shown in the screenshot at the top of this page.

Anchored object - This is the sidenote. The position of the selected reference points indicates that the top right of sidenotes on left-hand pages and top left of those on right-hand pages aligns with the note reference.

Anchored position - Should be interpreted together with X Relative To, which is set to Column Edge here. The selection of the reference points in Anchored Object and Anchored Position, together with the selected X Relative To, on a left-hand page places the top right of sidenotes against the left-hand side of the main text frame. On right-hand pages everything is mirrored. (Selecting a different reference point here sometimes unchecks "Relative to Spine" -- be aware of that.)

X Relative To - See previous point. In this setup, Text Frame can be picked as well.

X Offset - The X Offset sets the space between the sidenote and the text frame. This is the only item set by the script.

Y Relative To - Determines the vertical position of the sidenote. Should be considered together with the anchored object's (i.e. the sidenote's) selected reference point.

Y Offset - For fine-tuning the vertical position.

Keep within Top/Bottom Column Boundaries - Keep this checked. It ensures that the sidenotes stay on the page. When, because of text edits, the note reference approaches the bottom of its text frame, the sidenote will stay on the page, overriding the selected reference point.


Download (56 Kb)

The download contains all scripts illustrated on this page and an InDesign document that can be used for testing.


Back to script index

Installing and running scripts

Questions, comments? Get in touch