Running headers can be placed in InDesign by using text variables. This is a useful feature, but unfortunately there are some problems:
These problems are well documented and have been noted and discussed in various forums, and feature requests and bug reports have been submitted – all to no avail. Some of these problems can be handled by a third-party plug-in sold by In-Tools, PowerHeaders; it has a number of attractive additional features to boot.
However, on top of these problems I needed functionality to specify short titles for running headers when the running header's text is too long. Some heading titles simply don't fit; and some publishers stipulate that a running header shouldn't be longer than two-thirds of the text measure.
To cater for these requirements, the script discussed on this page deals with all this. The document I use for illustrating the set-up is attached as well.
The script and the set-up are geared towards a format common in sholarly publishing. There are essentially two types of layout for running headers:
Open the attached document. Enable Normal screen mode (View > Screen mode > Normal) to expose all special characters. The document has two parent spreads, one for the chapter's first page (O-Opener), the other for the body of the text (M-Main).
The first page has two text frames. One contains the chapter title (entered manually). The second one is a configuration frame that tells the script whether it should include section numbers in the running headers. The sample says 'yes'; if you don't want the numbers replace 'yes' with 'no'. The frame is labelled Config on the Layers panel. If the script can't find the frame or can't interpret its content, the script uses InDesign's default, which is not to use paragraph/section numbers. These two frames are on a non-printing layer.
The master pages used for the body of the text contain a running-header frame each. The left-hand pages are handled in the usual way, so I'll focus on the right-hand page. The frame is labelled Running header on the Layers panel and a dedicated paragraph style is applied to the frame. The content is a page-number variable (the M in the illustration, which is the parent page's prefix), preceded by an em-space (change to whatever you need) and an end-nested-style-here code (the blue backslash; if you don't see it on your screen, enable Normal screen mode: View > Screen mode > Normal).
The end-nested-style-here code is used as a delimiter so that the script can be run again at some later stage: it needs to remove the header's content, but not the page-number variable and the space before it.
InDesign's text variables strip all formatting from referenced text, which is one of the big complaints about them. The script preserves character styles, local overrides are removes (out of necessity, can't be avoided). Character styles in running headers will probably need some updating.
Running headers are often set in italics. You can't set that in the runing header's paragraph style because the page number should stay Roman and if you include section numbers, they too may have to stay Roman. To handle this, use a nested style to apply italics to part of the running header.
For another approach to styling in text variables in running headers, see here.
When a section heading is too long it's useful to have a mechanism to provide short titles. I borrow the method used in Latex, which is to add a short title in brackets before the long title. An example is op page 4 of the attached sample document.
Open the story editor (Edit > Story editor) to expose the full title. The short title (Temperature measurements in the example) is in brackets. It's made invisible by the character style Short title, which sets the type size to 0.1 points, the horizontal scale to 1 per cent, applies superscript (for even more reduction), an applies the Paper colour. The script places this short title, not the full title, in the running header.
Note: Naturally, this short title appears in the table of contents as well. After generating it, the table of contents should be updated manually.
The script has no interface. Before you run it, indicate whether section numbers should be included in the running headers (see above). Then place the cursor in one of the numbered headings that should be used in the running headers and run the script.
If texts edits can have moved headings to another page or if any changes are made in section titles, the script should be run again.
August 2024: Posted.
Consider making a donation. To make a donation, please click 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.
Installing and running scripts
Questions, comments? Get in touch