is now part of CreativePro.com!

Fixing Problems With Hyperlink Formatting in TOCs

7

They say the difference between comedy and tragedy is that tragedy is something bad happening to you, comedy is when it happens to someone else. So you may get a laugh out of this story.

Or maybe someday, you’ll be the one with wrong styles showing up in an InDesign table of contents and you’ll remember reading this article. Oh who are we kidding, you probably won’t remember it at all, so I’ll just leave it here for you to find when you Google, “InDesign TOC hyperlink wrong style.”

Once upon a time, I was building a TOC that contained headings harvested from another document in an InDesign book. In that document, the headings were all hyperlinks to web pages. The headings didn’t have any special formatting to indicate they were hyperlinks. However, hyperlinks elsewhere (like in body text) did get underlined via a character style.

20160303-hyperlinks1

The headings were not supposed to be underlined when they appeared in the table of contents.

20160303-hyperlinks5

Follow me so far?

As part of my normal production work, I’d create hyperlinks in the body text, and apply the Hyperlink character style in the New Hyperlink dialog box.

20160303-hyperlinks2

And if I came across a heading, I’d create a hyperlink there too. But because the Character Style setting in the New Hyperlink dialog box is “sticky,” I’d find much to my dismay that the character style got applied to the heading.

20160303-hyperlinks3

So being the lazy guy I am, I simply removed the character style formatting from the heading by selecting the text and applying the [None] character style.

20160303-hyperlinks4

Everything looked fine on the page. But when I updated the TOC, this is what I saw:

20160303-hyperlinks6

The Hyperlink character style was added to the table of contents document and applied to this entry! What the heck? I had manually removed the character style from the heading. Why was it still being put into the TOC where I didn’t want it?

The answer is that I didn’t remove the character style in the Hyperlink dialog box.

Remember, it’s “sticky.” Very sticky. So sticky that it will stick even if you manually remove the style from the source of the hyperlink on the page. So I double-clicked the hyperlink in the Hyperlinks panel to edit it. In the dialog box, I set the character style to [None] and clicked OK.

20160303-hyperlinks7

Then I updated the TOC (Layout > Update Table of Contents), everything was as I wanted it.

20160303-hyperlinks8

So to sum up, if you have mysterious unwanted text formatting in a TOC, go to the source of the TOC entry and check if it’s a hyperlink. There might be a character style selected in the Hyperlink dialog box that is being passed on to your TOC.

Editor in Chief of CreativePro. Instructor at LinkedIn Learning with courses on InDesign, Illustrator, Photoshop, GIMP, Inkscape, and Affinity Publisher. Co-author of The Photoshop Visual Quickstart Guide with Nigel French.
  • Wow, that is somewhat evil. Maybe a bug! I can reproduce it easily. I was curious whether the actual hyperlink came along with it (if the hyperlink still worked in the TOC)… the answer is no. Just the character style (the “look” of the hyperlink.)

  • Shane Smith says:

    Here is what I want to know… lets say you have a bunch of headings but some have character styling. You create your TOC and in comes the Characters style with it. Is there no way to remove the characters style from the TOC automatically? I thought maybe I could use a nested character of none to counter act it but that didn’t work. I really hate that I have to remove the formatting every time I update the TOC.

    • Mike Rankin says:

      You might be onto something with the nested style, but it would have to be applied to create the formatting on the document pages (the stuff you DONT want in the TOC), then use a different style for the TOC entry that did not include the nested style. Otherwise, I think you’re stuck removing the character level formatting every time. The problem (or solution, depending on how you look at it) is that a nested style is “weak”, it easily gets overridden by most other formatting. Here’s a breakdown I wrote many moons ago: https://creativepro.com/when-character-styles-collide.php

  • Mat Nova says:

    Something similiar happen when you override paragraph style (heading whatsoever) and then update TOC. Even if you have in TOC panel assigned special TOC’s paragraph style – it doesnt work. What you will see will be overrided style in TOC – not assigned one.

    I dont know if this is bug or not..but inner TOC style should be always honored in my opinion.

  • Silver Wolf says:

    I was wondering why my TOC had a tab BEFORE the entry, which caused tons of trouble in the layout.I am at a loss as to how to get a clean TOC. I resolved the issue by editing the TOC by hand, since it blatantly ignores anything I do to the paragraph format. I even went so far as to create a no-frills format and it still added the tab! go figure! Now, to understand how to make a TOC entry link to a page so clicking on it will bring the requested page up… that too seems to be deep water!

  • Kate-M says:

    You’re amazing! I laughed so hard because of this article and what I was going through with my TOC! I normally don’t leave a comment but you deserve it! Thank you! <3

  • julie says:

    Hello. I am just mind-blown that InDesign can automatically create hyperlinks when you export a .pdf if using the TOC.
    The hyperlinks are there, but on my file, the underline is not shown so you can’t really tell it is a hyperlink. Do I have to apply some kind of style to show the underline/link?

    – someone who is afraid to change styles..

  • >