So, you can have a heading running on each page that varies automatically based on the most recent heading (or, occurrence of any other paragraph style) by putting text with InDesign text variables based on the Running Headings text variable type ( type > text variables > define). Example tutorial.

So, for a textbook, novel, etc, where chapters span multiple pages, you could have the title of the latest chapter run in the header of each page automatically:

enter image description here

For a book like a dictionary, where each page contains multiple headings, you could get running headers that show the range of each page, by using two Running Header text variables, one set to "First in page", one set to "Last in page":

enter image description here

My question is, what if you have an awkward book or report with sections that have very variable lengths, which can be very short (several on a page) and can be multiple pages? Imagine something like an in-depth dictionary or encyclopaedia, where most entries are short, but a few are necessarily exceptionally long.

The ideal result would show just one running title where there's one or less header on the page (where the result of the "First in page" and "Last in page" lookups are the same), and the first and last where there is more than one (where the result of the lookups is different):

enter image description here

I can't find any way to do anything like this, however - even with manual input. Using the Dictionary-style method like above gives ugly duplication in cases where there are one or less entries:

enter image description here

Re-jigging the content of the book or changing the heading hierarchy isn't an option - they're all of equal importance, regardless of their awkwardly varying lengths. I'm fine with answers involving scripting or some way of manually varying text from one master page text frame between pages - but I'd really not like to need to manually set a whole different text frame in the same place with the same style on every page then manually type into and adjust all of them as independent elements...

  • 2
    This is an awesome question. I don't know much about the InDesign variables, but what about several sets of master pages, each with a different variable in the header depending on what your needs are? Sep 6, 2012 at 1:55
  • 1
    @LaurenIpsum Great idea! I've set it up to have a 'Page' master page and two additional masters based on 'Page', one with one running header, one with two. It works in that it solves the problem without needing an excess of duplicated work, so I'd say put it up as an answer and we'll see if anyone can do better. Something fully automated would be nice, but might not be possible; this is a decent answer if it's not possible. Sep 6, 2012 at 14:15

3 Answers 3


Short of a custom script, the most straightforward way to handle this is to have two master pages, one with the dual first/last variables and one with a single variable. Manually assign the single-variable master to those pages where it applies, assuming that they will be in the minority.

I've run into this and variations of the same problem, such as an entry word -- phrase, really -- so long that it entirely unbalances the page, or an entry with a non-Latin character from a Asian typeface. Variables can't handle a change of character style or font, since they are in reality a single "character."


What about several sets of master pages, each with a different variable in the header depending on what your needs are? I do this all the time with columns and sections.


Just to add another alternative: it's possible to override the text from any master page text frame for one page only by cmd-shift-clicking on it.

This creates a frame for that one page which replaces that element of the master page - delete the frame, and it reverts to using the default from the master page.

For this specific problem, I use the different master pages as Lauren I suggested, and these page-specific overrides for other little quirks and one-off problems from text variables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.