Automated Index Page Headers (InDesign)

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.

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.


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.


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.


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.


  • 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”.


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:


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

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


Lists in ePub generated from InDesign CS6

Recently, I wrote an article for InDesign Magazine titled “What’s New with ePub in CS6?” (Issue #48 – June/July 2012). In that article, I include a section called “Support for Custom Bullet and Numbering Marker Strings”. For the purposes of the article, I only included the part of this update that “works”, which is complicated numbered lists retaining their intended numbering when exported to ePub. Unfortunately, the solution that the Adobe engineers came up with to solve this problem ends up breaking (pretty much) everything else about numbered and bulleted lists.

For a great explanation of the actual problem, followed by some fantastic solutions, see Liz Castro’s post on the subject.

Since Liz’s explanation and solutions are (pretty much) exactly my thoughts, I will not bother to duplicate them here. Instead, I will use this space to elaborate on some of my other thoughts and suggestions for Adobe.

What was Adobe thinking?

Since the introduction of ePub export from InDesign (way back in CS3), one of my constant complaints was the fact that I could not get complicated numbered lists to export correctly to ePub. I have many books in my workflow that are loaded with complicated lists. (My current workaround for these lists is to select the option to “Convert Numbered Lists to Text”. However, I do not prefer this option, because I want my lists to be valid HTML lists, which these are not)

For clarification, here is an example of a simple list (through CS5.5, these lists export to ePub just fine):

  1. First list item
  2. Second list item
  3. Third list item
  4. Fourth list item
  5. Fifth list item

And here is an example of a complicated list:

  1. First list item
    Additional paragraph to extend the content for the first list item.
  2. Second list item
  3. Third list item
    Additional paragraph to extend the content for the third list item.
    A second paragraph to extend the content for the third list item.
  4. Fourth list item
    1. Sublisting under the Fourth list item
    2. Sublisting under the Fourth list item
    3. Sublisting under the Fourth list item
  5. Fifth list item

With CS6, the Adobe engineers attempted to come up with a creative solution to maintain proper numbering when dealing with these types of more complex numbered lists. As I mentioned before, this solution solves the problem of complicated list numbering, but creates a whole bunch of other problems, including bad code and double bullets (in bulleted lists).

Here is an example of the (above) complicated list, when exported to ePub via InDesign CS5.5 (or earlier):


The list, exported to ePub via InDesign CS5.5, and displayed using Adobe Digital Editions

And here is the html from that ePub file:


View of the HTML code contained in the CS5.5-generated ePub file

As you can see, when the list is viewed in your ePub reader, it is broken in a way that makes the numbering useless.
The code is pretty clean, except for one key issue (which I will explain in a minute).

Here is the same list, when exported to ePub via InDesign CS6:


The list, exported to ePub via InDesign CS6, and displayed using Adobe Digital Editions

And here is the xhtml from that ePub file:


View of the XHTML code contained in the CS6-generated ePub file

As you can see here, the list looks good when viewed in an ePub reader, but the code is awful and does not translate well.

Though I believe their hearts were in the right place, the direction that the Adobe engineers took (with CS6), was the wrong one.

Suggested Solution

I suggest that Adobe goes back to how Lists were exported to ePub in CS5.5 (and earlier), but with one minor change. If you look at the HTML code from the CS5.5 generated ePub again, you will notice that Ordered Lists (<ol></ol>) keep resetting, because InDesign does not know what to do with them:

Too Many ols

The “ol” tags (circled in red) are causing the list to constantly be reset

These need to be treated as “single” listings, and not broken up into smaller lists. This is the reason that the numbering does not continue correctly.

Here is what the code would look like with the unnecessary <ol>s removed:

Correct Code

The opening/closing “ol” tags should dictate the beginning and ending of the full numbered listing

And here is what the resulting list now looks like in your ePub reader:

Correct ADE

Properly formatted ePub listing, viewed in Adobe Digital Editions

As you can see here, the code is cleaner and the resulting complicated list is numbered correctly. In this example, the indents are not ideal, but that can be fixed by tweaking the stylesheet (CSS).

Challenge for Adobe

The challenge here is that, there is no good way for InDesign to know when a complicated list is intended to end. For simple lists, it is easy: when there are no more list items, the that list is ended.

For these more complicated lists, you may have unnumbered paragraphs, inline figures, or other elements included within the numbering. The engineers at Adobe will need to come up with a way to call this out.

I welcome any and all feedback regarding this issue.



Preparing your InDesign files for ePub export

A few years ago, I did a presentation on “Preparing your InDesign files for ePub export”.

At the time, CS4 was the most recent incarnation of InDesign. As we all know by now, the ePub export functionality in that version was pretty flawed, but significantly better than it was in CS3.

There was not very much improvement with the release of InDesign CS5, but version CS5.5 brought the whole thing to a new level.

The ePub-specific enhancements with the release of CS5.5 include:

  • The new Articles Panel
  • Style Export Tagging
  • Much improved ePub Export Dialog
  • etc.

With that said, I have gone ahead and updated my presentation to include these very helpful additions to Adobe InDesign CS5.5.

Click here to download the PDF. I also included an updated list of References and Resources at the end.

I hope you find this information helpful.