is now part of CreativePro.com!

Three Small TOC Tricks

29

Tables of contents in InDesign documents aren’t just for books. You can tag anything with paragraph styles and include them in a special kind of a list called a Table of Contents. In addition to a traditional TOC like you might see in a book or magazine, you can create lists of illustrations, advertisers or whatever you want. TOCs can be exported to bookmarks in a PDF file. EPUB files require you create a Navigational TOC which you can create using the same commands you use for print TOCs.

In her book written with Diane Burns, Digital Publishing with Adobe InDesign CS6, Sandee Cohen describes the process of creating a table of contents like this:

Creating a table of contents (TOC) in an InDesign document is like creating a massive set of cross references. The TOC not only keeps track of the location of a specific paragraph in a document (along with the page number on which it appears), but it also automatically creates electronic links from the text in the TOC to the text in the document.

But sometimes when creating TOCs you run into special issues which require tricks or workarounds. David wrote up one on formatting headings for inclusion in a TOC here. Kelly Vaughn wrote about using a TOC to create PDF bookmarks here. Here are three TOC tricks and workarounds I’ve run into recently.

Multiple Styles at a TOC Level

I always assumed that you could only use one paragraph style for each level of a table of contents because that’s the way they’re usually created. But sometimes the heading style you want to include in a TOC may have variations. Perhaps for design reasons, a heading might appear in one color in some instances, and in another color in other cases.

In the Edit Table of Contents Style dialog box, include both paragraph styles (Heading1_Green and Heading1_Red in the illustration below). Then just move both of them to the same level of the TOC. They’ll correctly export in the right order in the final table of contents.

Print TOC Style

Print TOC Style

Adding Text That’s Not Viewed or Printed to a TOC

You can also apply a paragraph style to text that’s not intended to be viewed or printed and then include it within a table of contents. You might do this for an Advertiser List or a Table of Illustrations. To add these pictures to a Table of Illustrations, labels were added to the two pictures on this page, and formatted with the Illustration List paragraph style. The text frames were placed onto a layer called Hidden Description, and the layer was hidden. These labels will appear as entries in the TOC if you check Include Text on Hidden Layers as shown above in the Edit Table of Contents Styles dialog box.

Hidden Description

Hidden Description

Here’s the resulting Table of Illustrations:

Table of Illustrations

Table of Illustrations

When Styling Within a TOC Doesn’t Seem to Work

A table of contents isn’t just ordinary text although it looks like it is. It is “live” and can be updated at any time by choosing Layout > Update Table of Contents. Although you can select and edit the text, this is not a good idea because if you subsequently update the TOC, the changes you made will disappear.

For the same reason, I learned, the styles that are referenced within a TOC cannot be called out for other purposes. Let me give you two examples: The first one is a table of contents for the EPUB version of the same book. You can use the Table of Contents Style to generate the navigational TOC required in an EPUB. You can also place the TOC into the document to create an inline or HTML TOC. Below is this book’s navigational TOC as previewed in Adobe Digital Editions (left) and an inline TOC placed on a page at the beginning of the eBook (right). Both are hyperlinked to the destination text. I had designated the word “Contents” to be the “Title” of the TOC in the Edit Table of Contents Style dialog box, and I had formatted it with the same Heading1 paragraph style I used  for the top level heads in the rest of the EPUB. Everything appeared to be OK.

EPUB Navigational TOC

EPUB Navigational TOC

However, I wanted to force a page break whenever Heading1 appeared in the EPUB. I did this by specifying Heading1 to Split the Document (force a page break) in the Edit All Export Tags dialog box, chosen from the Paragraph Styles panel menu. Then I specified Split Document: Based on Paragraph Export Tags when exporting the EPUB file. All the pages broke correctly, except the Contents head in the table of contents which did not work.

The problem is that text within the special live text of the TOC cannot be referenced by another feature or another table of contents. The solution is to set the Title field to be blank (circled below), and to create a separate frame in the layout containing the word “Contents” to which the Heading1 style is applied. (Notice also that an inline TOC should have No Page Number selected because EPUB files are reflowable and don’t have real page numbers. Nevertheless, the hyperlinks work correctly.) In the lower illustration, the word “Contents” is in a separate frame from the TOC, and now the eBook broke before the TOC the way I wanted.

EPUB TOC Style

EPUB TOC Style

EPUB Contents - Style Break

EPUB Contents – Style Break Workaround

The same problem would occur if you wanted to include a reference to the Table of Illustrations within the main Table of Contents. Again, you should make a separate text frame, formatted with the style used to call out the entry in the main TOC. You couldn’t expect that a paragraph style in the Table of Illustrations would appear in the main TOC without the workaround.

Steve Werner is a trainer, consultant, and co-author (with David Blatner and Christopher Smith) of InDesign for QuarkXPress Users and Moving to InDesign. He has worked in the graphic arts industry for more than 20 years and was the training manager for ten years at Rapid Lasergraphics. He has taught computer graphics classes since 1988.
  • Eugene Tyson says:

    Nice post – I was just explaining TOC to another person and things like this crept up – handy reference.

    Can images for the articles be a bit larger?

    • Steve Werner says:

      I made then the same way I usually do, but I think it’s the way they’ve set up WordPress. I notice that the illustrations in David’s post are also small. (Of course, you can click on them to view them larger.)

    • Jim says:

      Just click on the image to see it full size

  • C says:

    I have a series of images (essentially a comic) that I am trying to export from indesign to epub. I have used this hidden Layer technique to build a toc using an xml flow with tags. But even though my text (that comprises the toc entries) are hidden they still show up in my epub. I have tried exporting the same doc with an article flow which does hide the text but doesnt generate the toc. Running out of ideas and cant seem to find anything on the net that attempts to do the same thing. :/

    • It has been a while since I’ve had time to visit your blog. Your work continues to be gorgeous. I especially love what you are doing with Obama’s portrait and his change symbol. When I have a minute (or two), I am heading to your etsy store. Thanks for stopping by my blog. :) M

  • Marty says:

    Steve, thank you. I’ve batted my head against the wall trying to make a page break at “Contents” just as you described. I sort of stumbled upon the workaround, but I didn’t know why it worked. Now I do.

  • Leslie says:

    I have created an internal TOC based on paragraph styles for an epub. When I export from InDesign CS6, all the links are working fine but after export it adds additional blank pages to the navigational TOC and to the epub itself. Any advise on preventing these extra pages from being added.

    • Typesmith says:

      The most likely reason the blank pages are created because you have chosen to use a paragraph style to split up the document in the export tagging or through export preferences. If you have any extraneous paragraph returns tagged with that style, usually before or after a section, the export creates the extra pages and adds them to the TOC. Do a find and search to locate these extra tags and change them to default paragraph style or another style of your choosing.

  • BC says:

    Thanks for these tips/tricks!

    Here’s another twist for handling both a list of articles and photographs.

    In my case, I wanted to display the both lists based on the author or photographer. So the list would look something like this:

    Photos

    Jan Doe
    Hills in Autumn …….. 3
    Valleys in Spring …… 7
    Paul Vandyke
    Hills in Summer …….. 5
    Lakes Region ……….. 24

    Photo captions and attributions didn’t include only the photographer’s name, but also “Photo courtesy of” and “Photo by”.

    In some instances a shortened version of the caption was also needed.

    Neither of these pieces of information would be included in the print layout, so they had to go on a hidden layer which I’d access through the photo list (TOC).

    Two styles were used — one for photographer name and one for the photo title (short caption).

    On each page with a photograph, I added a text frame with the photographer’s name (photographer name paragraph style) and the short caption (short caption paragraph style). This text frame was on a hidden, non-printing layer and had no text-wrapping to avoid impacting the existing layout.

    In the photo list, I used the photographer name paragraph style as list item 1 with no page number. Item 2 was the caption with it’s page number. They were set in alphabetical order.

    The resulting list looked like this:

    Jan Doe
    Hills in Autumn …….. 3
    Jan Doe
    Valleys in Spring …… 7
    Paul Vandyke
    Hills in Summer …….. 5
    Paul Vandyke
    Lakes Region ……….. 24

    Here’s the ‘twist’ — in order to suppress the repeating name, and shorten up the photo listing, I used conditional text similar to what you’d see in teacher vs. student editions of a book.

    Two conditions were created — Show and Hide. Hide was set up with a style that gave a 0.1% line height and no text color. The effect is to cause the text with this style to disappear.

    When I was ready to finish the book and the photo list (after all tweaks that would change page numbers were done), I manually edited my photo list. To “Hide” a photographer’s name the second and subsequent times, I highlighted the name and gave it the “Hide” condition. This collapsed that particular line and gave the following result:

    Jan Doe
    Hills in Autumn …….. 3
    ^Valleys in Spring …… 7
    Paul Vandyke
    Hills in Summer …….. 5
    ^Lakes Region ……….. 24

    The second caption shows a non-printing character (like a caret, though it actually is at the base of the line). This is the indicator for the conditional text (the repeated photographer’s name) that now is hidden.

    If you’re interested in this solution, search for “InDesign, conditional text” and “hiding text” — there are a number of references out there.

    So far this works pretty well, though I’m now chasing down a problem for the ordering of the pages for one photographer. Everything else seems to be working fine.

    If any InDesign guru has any ideas on what can cause a TOC to put things out of order when the styles used are done in separate, non-threaded text frames please reply!

    So far I’ve chased down a number of trails without success including — page position of the text frame (they’re added to the same position on the page) and tabs (no tabs used). It almost looks like the TOC logic is reading from L to R and going from the first L hand page for a photographer (106) to the first R page (69) then the next L (134) and next R (71), next L and so on. So the page sequence is rather wacky (106, 69, 134, 71…). Interestingly all photographers aside from the one come out in the proper order.

    Thanks in advance for any ideas and hopefully the twist will give another tool for folks to use.

  • Kename Fin says:

    Another use we found for TOC is for generating definition/glossaries across multi-file books. Occasionally we have entries that we want to show up in the glossary but not in the text. We put those in a non-printing layer and – voila, Roberto is the brother of your mother or father!

  • Oscar Desmonteix says:

    What may cause ID CS5 to create “empty” bookmarks when exporting a book to “Print” PDF?

    I am working with multi-chapter books on Win 7 64.

    In all my books I use the same settings, whether for the TOC, LOF, or LOT.

    However, I only create bookmarks for the TOC due to style conventions.

    After exporting to PDF, the TOC bookmarks work fine most of the time.

    However, there are times when the bookmarks show on the PDF but clicking on them causes a shift to the cover page or do nothing if I am already there.

    Also due to style conventions, I must open the exported PDF with Acrobat Pro to add the document title (not to show the file name) and the appearance (show BMs, show two pages side by side, and show cover).

    Sometimes, if I make small changes to the ID book and re-export it, the BMs work fine afterward, although not always.

    Any clue?

  • Melise Gerber says:

    Just wanted to post an update here, in case it helps anyone else. I found this article a while back, and have been happily using the trick of placing TOC information on a non-printing layer ever since.

    But, yesterday, I opened a document that had worked correctly in the past, and exported it to PDF and this time, all of the text on the hidden layer was included in the PDF. After digging around to troubleshoot, I realized that I was using a PDF preset that includes bookmarks.

    Once I exported using a preset without bookmarks, the text was hidden properly in my PDF document. Problem solved.

    One additional odd thing, however-the PDF that included the hidden text did NOT actually include any bookmarks.

  • Bryan says:

    Hi Steve,

    I have Header 1s to appear in the table of content. Everything looks good, except for when I click on one of the items in the table of contents, it takes me to exactly 1 page before that item. Any idea why this might be happening? I have a forced page break that occurs before each Header 1, so the only thing I can figure is that the code for the table of contents link is before the code for the page break maybe? How do I fix this?

  • CaseyLacey says:

    I lose my live captions on images in the TOC when I convert to epub. I have spent several days to find a workaround, but I cannot find anything that makes the live captions show up in the TOC. They show up fine in a PDF for the print version. I hope somebody can get me a solution for this.

  • Marcia Machliss says:

    I have 7 documents that I am working on that was created by someone else. they have in average 150 pages each.
    I created a table of content, I have done it other times but this one keeps pulling some of the style from the paragraph style instead from the TOC style.
    The document had the following:
    Paragraph styles
    Heading 1 font size 15
    Heading 2 font size 12
    etc
    For Heading 1 I associate a TOC 1 style (font size 10 orange colour)
    Heading 2 I associate a TOC 2 style (font size 9 black colour)

    My table of content result comes with all the items and their respective page numbers that I need in TOC style and on top of them some duplication of item with the paragraph style.

    I have checked every single title and subtitle to see if they have got the correct style and they do.
    I going to my second day of research and can’t find the solution for this one.

    Is there anyone to help me with this one.

    Thank you
    MM

  • Nadia says:

    I have a document with chapters using numbered heading (level 1).
    When I create the TOC at the start of the document, chapter 1 becomes chapter 2.
    It is driving me crazy.
    Any help?
    Thank you

    • Nadia: You must be using the same numbered paragraph style someplace else in the TOC document. Maybe it is applied to something in the TOC itself!

      • Nadia says:

        Thank you David!
        I finally figured it out: Select the TOC and uncheck the numbered list icon on the menu bar.

  • Bogdan says:

    Hello,

    I would kindly ask for help. I am working on some booklet and the client requested that each page has chapter name and the TOC to be formated like this (in cases where same chapter name repeats on several pages):

    ABOUT US…2
    OUR MISSION…..3-6 *this is where I stuck, is there a way to format TOC this way

    I searched but I couldn’t find anywhere solution to this problem.

    Thank you

  • i have designed a document in which there is a master page set up as an intro to each chapter, i.e., Chapter 16: Modulation. The title of the intro page consists of 2 centered paragraph styles, the top (Chapter 16) with rule below applied and secondly, the name of the chapter (Modulation) below it.

    I want the TOC to link to the intro page versus the first page of that chapter, which is just titled Modulation. Is there any way to accomplish this?

  • Liz says:

    Hello.

    I am having issues creating a navigational TOC. I have to have separate Chapter numbers from headings. I linked the text boxes so it appears as one item on the page. When I export as fixed epub, it won’t let me select name of my style. If I use the multilevel option, it generates the chapter number and heading as 2 separate entries in my epub nav menu. Any way to fix this?

  • Herb says:

    I have been looking for a definitive answer to the following question, but have been unable to find one.

    After completing paragraph and character styles in your master InDesign doc, is there a feature in InDesign that automatically changes the TOC when you have to repaginate some of the pages in the document without the need of multiple Indesign (book file) documents linked into this master document?

  • Very helpful information, thanks!

    My navigational TOC looks lovely, and I placed it in the .indd file where I want it to appear in the EPUB — just before the Preface — but upon export the TOC ends up at the very END of the EPUB document instead of where I had put it. I’m about ready to release the book as-is, because even if I can’t figure out how to make the TOC appear where I want it to at least having it functional is better than not having it at all. Is that something I need to fix in the EPUB file itself, or have I left something unchecked in ID that I should have checked?

    Thanks,
    G

  • Haradhan Sharma says:

    Hello,

    While i am creating TOC for epub using world-ready paragraph composer, TOC is not responding to navigate to the anchored paragraph . But when I am changing to Adobe paragraph composer then updated TOC is responding to navigate! By staying on World-ready paragraph composer, how i can get TOC are working?

  • Susan Culligan says:

    This is in regard to the main topic of creating lists of tables and lists of illustrations. I just make two TOC styles using the Figure Caption paragraph style and the Table Title paragraph style, respectively, and it created my lists just fine.

  • Marisa Vitiello says:

    Hi. I have a gorgeous TOC up to page 34 of my 126 page document. I’m using paragraph styles and they are consistent. at page 34 I have a complicated grid that is the only thing that distinguishes it from any other page. I can’t seem to get the rest of the TOC to show up (and no, it’s not overset).

    Please help!!

    Thanks much,
    Marisa

  • Thomas da Silva says:

    In Indesign latest version for windows 10, How do I setup a table of contents so that the entry is on the left, they page numbers on the right, and separated by a series of dots …. Seems simple, but there is nothing in the instruction book and I can’t seem to find anything on line.

  • >