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:
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":
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):
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:
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...