Thanks for coming to InDesignSecrets.com, the world's #1 resource for all things InDesign!

Three Small TOC Tricks

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.

Tags
Related Articles
Comments

8 Comments on “Three Small TOC Tricks

  1. 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?

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

  2. 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. :/

  3. 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.

  4. 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.

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

  5. 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.

  6. 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!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
http://indesignsecrets.com/three-small-toc-tricks.php
indesignsecrets.com
crawl=CC-MAIN-2014-35
74746
application/http; msgtype=response
sha1:7DGOOE6DEHRSQYFH5ZFQ545ELWGVTQ4G
<urn:uuid:08bc3e3f-1f52-43ed-85be-db479bfcc2a5>
2014-08-22T11:46:52Z
96.126.116.53
sha1:F4WPLV4ZJLCUICJTUQPVUQPQZOSG7KAF
<urn:uuid:9c5576d9-d73f-4417-a158-3d5d9a833c7f>
http://indesignsecrets.com/three-small-toc-tricks.php
length
response
<urn:uuid:19a4b6ff-d8e6-4993-9b89-e0b03410dc19>
robots: classic
hostname: ip-10-180-136-8.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2014-35
operator: CommonCrawl Admin
description: Wide crawl of the web with URLs provided by Blekko for August 2014
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf