Based on the method for dynamic endnotes first outlined by Peter Gold and formalised in InDesign by Bob Bringhurst, and following on from the scripted approach of this method (see Dynamic endnotes), this page 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 footnotes in a document to sidenotes. You can convert all notes or just notes that use a selected paragraph style. 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 several things: the width of the sidenote textframes and the distance between the sidenote and the main text. At Numbering 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. At Paragraph style: you can limit the scope of the script to footnotes that use a particular paragraph style. Select Any to target all footnotes. 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:
First, select 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 space between the notes at Space between notes.
To offset a stack from the top or the bottom, enter a value at Stack offset. To offset a bottom-aligned stack up, enter a negative value.
If you check Align baselines, and stack notes at the bottom of the text frame, then the baseline of the last note is aligned with the baseline of the last line of the text (right-hand side of the screenshot). Without baseline alignment, the bottom of the last footnotes frame is aligned with the bottom of the main text frame (left-hand side of the screenshot). The difference looks like this:
Similarly, if you stack the notes to the top of the text frame and check Align baselines, then the baseline of the first note is aligned with the baseline of the first line of text on the page. Without baseline alignment, the top of the first note's frame is aligned with the top of the main text frame. As follows:
Finally, select the object style used for the side notes.
Run the sidenotes_renumber.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 set the start number, for example in book documents, click in the first sidenote in a document, then open the Paragraph panel and go to the Bullets and Numbering dialog. At Mode select Start At and enter the start number.
Sidenotes are placed in the outside margin, which is a problem if the main text is in columns: the notes appear in the wrong order. This can be fixed in two ways.
You can keep the notes in the outside margin and stack them. This in effect sorts the notes in order of appearance. For this you can use the sidenotes-stack script, see above.
Another approach is to place the sidenotes that are in the inside columns in the inside margins. This requires a separate script (sidenotes-two-columns.jsx), which you can find in the attached download. The script creates a new object style (sidenote-inside) and applies it to notes in the inside columns. The script targets only two-column frames so it handles documents that have text in one and in two columns.
The script has no interface. If after many text edits some sidenotes are out of place (in the wrong margin), simply run the script again.
In lines with more than one note, the sidenotes usually overlap. And longish sidenotes in consecutive lines, too, can cause overlap. There are two ways to fix this.
The easiest way to resolve overlap is to stack notes; see above.
Another way to deal with overlap is to move notes. This can be done with the script sidenotes-fix-overlap.jsx, which is included in the download. The overlap fixer is pretty basic in that it tries to resolve overlap only by moving frames down. If overlap can't be fixed the script just gives up. Maybe stacking will fix those pages, but the script doesn't attempt that.
The script has no interface. To target a single page/frame, select the text frame and run the script. To target the whole document, do not select anything and run the script. (Style groups are shown in parentheses.)
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.
To revert sidenotes to footnotes, run sidenotes_revert.jsx. The script 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 if you choose to number the sidenotes. 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 (in the sense of InDesign's Bulleted & Numbered 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 Page Margin 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 set-up, Text Frame can be picked as well.
X Offset The X Offset sets the space between the sidenote and the text frame.
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.
InDesign crashes when your text and/or the footnotes are set to align to the baseline grid. Other than disabling grid alignment there's nothing that can be done to prevent the crash.
12 Aug. 2024: The stacker sometimes misread the config file; fixed
16 June 2024: Added a note about setting the start number.
18 May 2024: Added an option to offset vertically a block of stacked notes.
6 Feb. 2024: The sidenote-revert script needed an upgrade for two-column texts.
4 Jan. 2024: The paragraph-style dropdown now handles style groups.
4 Dec. 2023: Added a script to fix overlapping sidenotes.
16 Oct. 2023: Added a section on dealing with sidenotes in two-column texts.
7 Apr. 2023: An empty footnote crashed the script. Fixed.
23 Mar. 2021: Better performance of the renumbering script.
6 Dec. 2020: Some refactoring, the script is now much quicker. No functional changes.
29 June 2019: A bug in the latest version of InDesign CC2019 caused the script to delete the first character of every sidenote. Fixed with a workaround.
6 May 2019: (a) The script can now target footnotes in a particular paragraph style; (b) Added a script to revert to footnotes.
25 June 2014: Rewrote the stack script for better performance; also added baseline alignment (see text for details).
12 May 2014: Notes weren't always renumbered correctly when renumbered by section; fixed.
8 February 2014: Fixed a bug in the script that renumbers notes.
30 Jan. 2014: Rewrote the stacking code. It's now quicker and more rubust.
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. (Also refreshed the text of this page and the screenshots.)
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: The 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.
Installing and running scripts
Questions, comments? Get in touch