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. (After finishing the scripts and these pages I became aware of Martin Fischer's script dealing with sidenotes in CS3 – see this thread on www.hilfdirselbst.ch.)
The script can be used to set up sidenotes in a new document, too, both numbered and unnumbered notes. A second script can be used to create new notes in a document. Like InDesign's footnotes, sidenotes can be numbered by document, by section, by spread, or by page.
The screenshot shows an example of a document whose footnotes have been converted to 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.
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 shown are script defaults):
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.
All details (such as typeface, pointsize, width, 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 and/or recycles some styles and some other required items.
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.
New sidenotes are best added using the sidenote_add.jsx 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:
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.
If you create an empty sidenote and add text to it, the frame adjusts automatically in CS6 and later. In earlier versions, press Ctrl+Alt+C (or Cmd+Opt+C) 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.
The width of the text frames is set in the notes' object style (sidenotes). To change the width, therefore, simply change the setting in the object style (see below for details) or run the script described in the next paragraph.
In versions before CS6, the height of frames is not adjusted automatically. To fit the note frames vertically in CS5.5 and earlier, run the separate script sidenotes_width.jsx. It shows this dialog:
Enter the new width and press Enter/Return to start the script. All sidenotes are resized and their frames fitted vertically.
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 foot 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.
To stack notes, run the sidenotes_stack script. It shows this dialog:
Four 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 choose to do all notes in the document as well. Then set the vertical space between the notes at Space between notes. Finally, select the object style used for the side notes.
Run the sidenotes_restart_numbering.jsx script – which is included in the download – to set the numbering policy in the document. This works in the same way as InDesign's footnote numbering policy:
Sidenotes can be numbered by page, spread, or section. Uncheck the checkbox to disable renumbering.
To reset all the document's notes to their original size and position, run the sidenotes_reset.jsx script. It simply reapplies the object style to all notes to remove overrides. It has no interface.
All sidenote 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 used for the sidenotes is the style set in the Footnote Options dialog. Paragraph numbering is added. 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 a character style for the numbers in the notes: sidenote_number. If a character style is set in the Footnote Options dialog, then that style is used for the note references; if no such style is set, the script creates a character style for the references (sidenote_reference)
Size and position - These 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 width of the notes is set at Text Frame General Options:
The height of the notes is set automatically in CS6 and later. In earlier InDesign versions the height of note frames needs to be set manually after edits.
The position of the notes is set at X Offset in the Anchored Object Options in the Object Styles Options window:
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 - This is the note frame's anchor in the text. It 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.
11 Dec. 2013: Clarified the text describing how globally to change the size and position of the side notes. Scripts not changed.
29 Aug. 2012: Fixed problem with the stacker (sidenotes_stack.jsx). Added a progress indicater which shows progress when the stacker is used to stack a whole document.
30 June 2012: Sidenote numbering can now be restarted by page, spread, or section; this works in the same way as for InDesign's footnotes. (And refreshed the text and the illustrations.)
27 April 2012: (1) (Finally) used a trick described by Keith Gilbert (see here) to set the width of text frames in an object style. (2) In CS6 the script makes use of the new auto size feature for text frames, which makes creating and updating sidenotes much more efficient. (The scripts continue to work in earlier CS versions.)
14 Sept. 2010: Fixed problem with documents whose units are set in picas.
28 July 2010: In the dialog of the sidenote_stack script, added a dropdown so that you can select an object style.
28 June 2010: Fixed problem with style names.
22 June 2010: Added script to restart sidenote numbering on every page.
21 June 2010: The script now works with documents that have more than one story with notes. Progress bar replaced with a simple message window. The script now uses the paragraph style set in the footnote options dialog; if a character style is set for the footnote reference, then that style is used by the script, otherwise a new character style is made.
2 June 2010: Progress bar wasn't always dismissed after scripts finished. Fixed.
If you find this script useful you might 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.
Download (56 Kb)
The download contains all scripts illustrated on this page and an InDesign document that can be used for testing.
Questions, comments? Get in touch