How to create automated Index page headers in InDesign

By Ron Bilodeau
November 3, 2010 | Comments: 3

Ever since Adobe included the use of Variables in InDesign, I have been thinking about ways to use it to create auto-generated index headings.
Well, after trying lots of different things, I finally came up with a simple solution that anyone can use.

Background:
Have you ever wanted to include "Real" index headers for your index file? Only to find that if anything changes or the index re-flows, you need to update them all manually?
Now this can be set up to happen "on-the-fly" by simply using Text Variables and invisible Nested Styles.

The biggest obstacle that I needed to overcome was how to have the header variable consistently pull the index listing while ignoring the page numbers.

Here is how I now set up my InDesign index files in order to make this happen:


Step 1: Set up your "Generate Index" settings

In your "Generate Index" dialog, set everything as you normally would.
The trick here lies inside the "Following Topic" field in the "Entry Separators" section at the bottom of the dialog.

In my example below, I have a comma followed by a Figure Space (,^/).
The reason I chose to use a Figure Space instead of just a regular space is because it gives me a "special character" that I can use later when setting up my custom Nested Style.
Feel free to use any "special character" that suits your needs. The key here is to choose something that is not otherwise being used in your document.

Index-settings.png

Step 2: Create an empty Character Style

You will need to create a Character Style with no attributes. This style will be applied as a Nested Style to your 1st level index Paragraph Style. In my example below, I named the style "Index_Header", but feel free to name this however you wish.

Char_Style.png

Notice that there are no settings being applied. This is because I do not want the Character Style to affect the text, visually, at all.
In a few steps, you will create a custom variable that will call upon this "hidden" Character Style.


Step 3: Update the Paragraph setting for your First Level index entries

This next step will add a Nested Style to your 1st level index entry Paragraph Style. In my example below, this style is named "Index Level 1", which is the default in InDesign. However, if you are using a different name for your 1st level index entry Paragraph Style, be sure to use that one.
Open up the Paragraph Style Options dialog for your style and then choose the "Drop Caps and Nested Styles" option from the list on the left.

Para_Style.png

As you can see in my example (above), I am Nesting the Character Style "Index_Header" up to the first instance of a "Figure Space" character.


Step 4: Create the custom header Variables

Now that our Character and Paragraph styles are set, it is time to create our header Variables.
We will need 2 separate Variables:


  1. The first will grab the first entry on the page

  2. The second will grab the last entry on the page


Go to Type-->Text Variables-->Define to open up the Text Variables dialog.
Select "New" to create the first Variable.
See my example (below) for the correct Variable settings.

Variable1.png


  • In my example (above), I named the Variable "Header_First", but feel free to name yours whatever you wish.

  • From the Type drop down menu, be sure to choose "Running Header (Character Style)".

  • Then, from the Style drop down menu, choose "Index_Header" (or whatever you named your empty Character Style back in step 2).

  • Choose "First on Page" from the Use drop down menu.

  • Finally, in the Options section, select the "Delete End Punctuation" check box. (This is only necessary because I am using a comma to separate my index entries from the corresponding page numbers. If you are not using a punctuation character here, it is not necessary to check this box). Checking this box makes sure to not include the end comma in the Variable.

  • All other options in this dialog are up to you depending on how you want your Variable to look.

For the second Variable, give it a different name (I used "Header_Last).
All of the settings should match your first Variable, exactly (except for the Use drop down option). For this Variable, choose "Last on Page".

Variable2.png


Step 5: Apply the Header Variables

Now that your Header Variables have been defined, all that is left to do is place them into your Master pages.
In my experience, there are 2 main ways that Index Headers are set up per spread:


  1. Left Page Header: "First entry on page";
    Right Page Header: "Last entry on page"

  2. Left and Right Page Header: "First entry on page" - "Last entry on page"


Whichever way you prefer, your new Variables are ready to handle either.

To place your variables on your master page(s), simply draw a text frame in your preferred location on the Master page, and then go to Type-->Text Variables-->Insert Variable.

Here is an example of the first Variable in use on the left page of an Index spread:

Example.png

Notice that the Variable is pulling the correct first Level One Index entry from the page. But also notice that the comma and page numbers have conveniently been left out in order to keep the Variable clean.

Now, your Index file can reflow at will, and your headers will always be correct.

I have included my example Index file for you to download and use or inspect if you wish to dig deeper (saved as .idml to be compatible with InDesign CS4, CS5, and newer):
Index_Header_Example.idml

Feel free to contact me with any questions or comments.
Otherwise, enjoy.

3 Comments

Great Scott! This is amazing! I definitely need to learn more about variables. That's one area of InDesign that I haven't delved into. Thanks, Ron!

Oh. My. God.
This rocks the house.

Thanks, Ron.

Ron,

With the proper right and left indention settings, this can actually be used for setting vertical running tabs in the outside margins of lengthy directories too.
This is fantastic. Thanks again.

Projects

Bookworm

The free platform for reading EPUB books online from any device.

Integrated with O'Reilly Labs 02/09/09.

First translations added 03/11/09.

Feedbooks integration & one-click addition added 07/29/09.

Beta Projects

Open Feedback Publishing System (OFPS)

Participate in collaborative community feedback to help refine in-progress, open manuscripts like Building iPhone Apps with HTML, CSS, and JavaScript or the published Programming Scala.

Released 05/20/09.

O'Reilly Product Metadata Interface (OPMI)

Want to know all we know about an  O'Reilly book? Give us an ISBN and we'll let you in on our (RDF) secrets!

Released 02/09/09.

Open Source

DocBook-XSL 1.74.3 with Improved ePub Output

Keith Fahlgren (O'Reilly Media) helped release the stable 1.74.3 release of the open source DocBook-XSL project and improved the EPUB generation stylesheets. Paul Norton (Adobe) and Liza Daly (Threepress) provided very helpful patches.

Released 02/17/09.

DocBook-XSL 1.74.0 EPUB Output

Paul Norton (Adobe) and Keith Fahlgren (O'Reilly Media) have contributed code to the 1.74.0 release of the open source DocBook-XSL project that generates EPUB documents from DocBook. An alpha-quality reference implementation in Ruby was also been provided.

EPUB is an open standard of  the The International Digital Publishing Forum (IDPF) and something O'Reilly is trying  to help gain wider adoption.

Released 06/02/08.