13 Replies Latest reply on Jan 11, 2012 2:33 AM by John Hawkinson

    Automated Table of Contents using incorrect styles

    RD. Mitchell Level 1

      Hello,

       

      I've been having InDesign generate the table of contents for me based off of styles I created. For the most part, this is working fine except for a few instances where some of the generated items have the incorrect character style applied.

       

      As an example, I have a paragraph style called Sub Header. In the Table of Contents setup window, I have Sub Header set up to have the entry style TOC Sub Header. Every single time the entry Sub Header appears, it should theoretically use the TOC Sub Header style in the table of contents. Unfortunately, for reasons I can't quite figure out, that's not what is happening. Most of the Sub Header entries are appearing correctly, using the TOC Sub Header, but some of them are populating in the table of contents with any character style modifications that were used in the main body.

       

      Does anyone know a way around this? If my example wasn't clear enough, let me know what I need to elaborate on and I'll do so.

        • 1. Re: Automated Table of Contents using incorrect styles
          Peter Spier Most Valuable Participant (Moderator)

          RD. Mitchell wrote:

            some of them are populating in the table of contents with any character style modifications that were used in the main body.

          This is normal behavior. Local overides and character styles are preserved when paragraphs are assigned a new style. You can prevent this by using nested styles or GREP syles built intothe style defintion to apply the special formatting (because they are part of the paragraph style definition they are not overrides and will not be preserved), or if this is not possible you can make a non-printing heading to use instead and apply the paragraph style to that, then make a copy of the style and give it a new name (just base it on the other style and change nothing but the name) and apply it to the one with the character style overrides so it doesn't appear in the TOC.

           

          Was that at all clear?

          • 2. Re: Automated Table of Contents using incorrect styles
            RD. Mitchell Level 1

            Well, using my example from before...would I make the nested style in TOC Sub Header, or in the Sub Header style that's in the main body?

            • 3. Re: Automated Table of Contents using incorrect styles
              Peter Spier Most Valuable Participant (Moderator)

              Theoretically it wouldn't really matter, but I'd do it in the main body as the point is to not carry the character style into the TOC. If you try to do it in the TOC you are assigneing a new character style which might not be what you want if you later decide to edit the TOC style.

               

              It occurs to me that there's a fairly easy way to fix (i.e remove) the character style from the TOC, but you'll have to do it every time the TOC is updated. You can use Find/Change and search for .+  and change to $0 (which just says replace with itself), then set the Find format to your TOC paragraph style. Set the Change format to explicitly use the [None] character style.

              1 person found this helpful
              • 4. Re: Automated Table of Contents using incorrect styles
                RD. Mitchell Level 1

                Yeah, that's what I've been doing. Removing the style every time it appears. The problem is that I won't be the only person working with this particular InDesign file, so the less confusion there is for other parties, the better.

                 

                When I create a nested style, will it apply to all items that use that particular style? What I've been doing whenever I've wanted to use a particular style but needed to make spot changes was highlight the text and then make adjustments. If I make a nested style, will it basically apply those nested changes to every item that has that particular style so far?

                • 5. Re: Automated Table of Contents using incorrect styles
                  Peter Spier Most Valuable Participant (Moderator)

                  Nested styles apply a desgnated character style when certain conditions are met. They are typically triggerd by position in the paragraph (i.e. after x words) or by the presence of a certain character (like a colon) and are usually used for some sort of pattern, like making the first word in the paragraph bold, or all words through a colon italic, or for higlighting a price (which can be identified by the currency symbol, perhaps, or by the fact that it follows a tab in a menu). You can also trigger them by inserting special "end Nested Style here" characters. You should read about them in the help file. Not knowing what your headings look like, I hesitate to say that they will be appropriate or easy to set up, though running [None] through 1 end nested style here character will leave an entire paragraph without any additional syling until you insert the ensh character someplace, so it's safe to define the nested styles as [None] through a trigger that mostly will not appear, then [Desired Character Style] up to or through some new trigger. This is trickier if you have multiple styles you need to apply, probably impossible unless they are always in the same order and never skip one in the middle.

                   

                  GREP styles are a bit more powerful in that they are triggered by the pattern of the text string. You can use them to always apply a style to a particular word, wherever it appears, or to a string of numbers, and so forth. It work similarly to find change in structuring the query string, but instead of changing the string to other characters you apply a style, and it happens automatically as you edit.

                  1 person found this helpful
                  • 6. Re: Automated Table of Contents using incorrect styles
                    RD. Mitchell Level 1

                    Based on what you've told me so far, it seems like the easiest thing by far is to just apply [None] to the character style in the TOC body. Thanks for the awesome help as usual Peter. I'll read up on nested styles because they seem like they could be very useful, but in this particular situation, I think I might end up causing myself more trouble than it's worth.

                    • 7. Re: Automated Table of Contents using incorrect styles
                      Joel Cherney Adobe Community Professional & MVP

                      The problem is that I won't be the only person working with this particular InDesign file, so the less confusion there is for other parties, the better.

                       

                      Many of my documents that rely on such workarounds have a non-printing layer as the top layer, with the phrase IMPORTANT INSTRUCTIONS ON THE PASTEBOARD.

                       

                      I'm waiting for animated GIF support in ID so I can insert a picture of me, waving my hands in the air and shaking my head vigorously.

                      • 8. Re: Automated Table of Contents using incorrect styles
                        Peter Spier Most Valuable Participant (Moderator)

                        Does that work in your office?

                        • 9. Re: Automated Table of Contents using incorrect styles
                          Joel Cherney Adobe Community Professional & MVP

                          Well, the warning layer works both in my office, and with my clients (who will write me email years later saying "Wow, thanks for leaving such clear index-update instructions on the pasteboard!").

                           

                          Dunno if I'd include the .gif for files leaving the office, though.

                          • 10. Re: Automated Table of Contents using incorrect styles
                            RD. Mitchell Level 1

                            The pasteboard is the gray space off to the side, correct?

                            • 11. Re: Automated Table of Contents using incorrect styles
                              Peter Spier Most Valuable Participant (Moderator)

                              I meant waving your hands and shaking your head. I'd like to see that.

                              • 12. Re: Automated Table of Contents using incorrect styles
                                Peter Spier Most Valuable Participant (Moderator)

                                RD. Mitchell wrote:

                                 

                                The pasteboard is the gray space off to the side, correct?

                                Yes

                                • 13. Re: Automated Table of Contents using incorrect styles
                                  John Hawkinson Level 5
                                  I'm waiting for animated GIF support in ID so I can insert a picture of me, waving my hands in the air and shaking my head vigorously.

                                  This is why we have swf support!