New InDesign Script to Set Keep Options in Indexes
InDesign’s Keep Options are very useful for, well, keeping lines of text together on a page in long documents. You can use them to prevent widows and orphans, or to ensure that section titles always stay with the following paragraph (or a specific number of lines from that paragraph). They’re most useful when applied as part of a paragraph style.

You can use InDesign’s Keep Options to ensure that headlines always stay with the paragraph that follows them.
You can read all about how keep options work in this post. If you’d rather watch a video about them, check out this one by Jason Hoppe.
Applying Keep Options in an Index
While Keep Options are very useful in body text, they don’t offer the kind of flexibility that would make them useful in an index. For example, the Keep With Next option only works on lines within a paragraph. You can’t set a single keep option to control multiple paragraphs, like you’d encounter in a list of index topics or subtopics.
But thanks to Peter Kahrel, there’s a free script that you can use to set keep options in an index. Specifically, you can set two keep options in the script:
- The number of topics to be kept with section headings
- The number of subtopics to be kept with their parent topic.
You can read all about how the script works, how to edit it, and download it here.
A Script for Showing Keeps
Whenever you use keep options, there’s the potential for confusion, especially if you’re collaborating with others. It can be hard to tell why certain lines are jumping to the next text frame, or staying put. So, as an added bonus, Peter has also released a companion script to reveal keeps by highlighting them with InDesign’s conditional text features. You can download the Show Keep script here.
Thanks, Peter! And keep up the good work!
![]() |
One INDD indexing feature I wish could be added would flow character styles through to the Index story so that, for example, a book title or newspaper name in italic character style in the document text would remain in italic character style in the generated Index story.
This has always been a pain point for InDesign users. There are a couple workarounds, neither is super quick and easy, but they do work. Both involve GREP. Here’s one https://creativepro.com/formatting-in-indesign-index-entries/