8 Replies Latest reply on Feb 16, 2012 4:29 PM by peter minneapolis

    Nested styles within TOC - a newbie

    Spenno

      Hi, I wonder if someone can help with a TOC query. It will involve nested character styles which I've not really got my head around

      Currently there are two paragraph styles in the book to appear in the TOC in their own styles (so four paragraph styles in total - Chapter Number, Chapter Name, Chapter Number TOC and Chapter Name TOC).

       

      They currently generate in their simplest form in the TOC as:

       

      Chapter 1

      An introduction to your new home ................8

       

      I simply want the chapter name to appear on the same line.

       

      Chapter 1 An introduction to your new home ................8

       

      Thanks for any help anyone.

        • 1. Re: Nested styles within TOC - a newbie
          Peter Spier Most Valuable Participant (Moderator)

          TOC entries are picked up as paragraphs based on the included styles, so if you want your Chapter heading and the following line to come in as a single line entry, they must be in the same paragraph. You have three basic options:

           

          Edit the body of the book to put the heading and title into one paragraph

          Edit the TOC manually

          Create a new, nonprinting, paragraph with a unique style that has exaclty the working you want to appear in the TOC and build from that style instead

           

          You can edit the body of the book to make the chapter heading and the title one paragraph, and use a nested style to do the formatting. The main problem now is that you must find a way to make the line break. Possibilities include the use of paragraph indents, a nested character style that applies No Break after the space following the heading number, or using a forced line break. One of the nice things about using a No Break nested style is that if you use a DIFFERENT paragraph style to format the TOC listing, all of the nested styles, and the unbreakability of the line, disappear and are replaced with whatever definition the new style specifies. If you use the forced line break, that's a character, not a part of a style definition, so it carries into the TOC and would need to be replaced. Styles and formatting which are applied locally, not as part of a nested style in the paragraph style defintion, also carry into the TOC.

          Using a nested No Break style is perhaps the best method since it involves the least intervention, but it only works when you want the same alignment for your chapter heading and the title, and the title itself will fit on a single line. If not, you're back to some sort of manual manipulation.

           

          Editing the TOC is straightforward. Assign a differnt style to the Chapter number paragraph and the chapter title paragraph (and it doesn't really matter what you use for the latter because it is about to disappear). Define the paragraph style you assign to the chapter number listings with whatever nested styles you need  to make the finished listing look the way you want, then use Find/Change to search for paragraph returns with that style and replace them with a white space of your choice. The titles will jump up, and the nested style will kick in. The downside here is you need to run the find/change every time the TOC is updated.

           

          The non-printing paragraph is a do it once, then forget it method, but you have to make each of those new paragraphs, and figure out how to make them flow with the text, but not interfere with the flow. My methos of choice would be to put them in a separate frame, Use the attributes panel to set that frame to non-printing, then insert it as a custom-positioned anchored object in front of the Chapter number. By being an anchored object you can move it's position to the top of the page (or smewhere else convenient, but it needs to be on the page) but it won't push any of the rest of the text around. As part of the paragraph style you are using to make these "tags," I recommend you make the type big and red so it jumps off the page in alyout view so you know it's there. You'll re-format the lisitngs themselves in the TOC.

          • 2. Re: Nested styles within TOC - a newbie
            peter minneapolis Level 4

            Great detailed summary of approaches, Peter.

             

            Please note:

             

            * If you continue to write these long posts, it'll take you forever to reach 60,000.

             

            * Seriously, you left out the part that suggests to the original poster to post a formal feature enhancement request for "Run-in paragraph properties like FrameMaker's" here:

            Adobe - Feature Request/Bug Report Form

             

            The run-in property allows a paragraph to follow another paragraph on the same line, which makes it easy to create the TOC that the original poster asked for directly, by use of paragraph styles, rather than by workarounds.

             

            Sooner or later, the quantity of requestors might get the feature added to InDesign.

            Regards,

             

             

            Peter

            _______________________

            Peter Gold

            KnowHow ProServices

            • 3. Re: Nested styles within TOC - a newbie
              Peter Spier Most Valuable Participant (Moderator)

              Good morning, Peter,

               

              You know me, more words is always better.   and I have no worries about reaching that 60 k goal (spoiler -- this is an inside joke, so ignore it).

               

              Anyway, I figure I'll leave making Frame-type feature request to you and concentrate on working withthe curently possible. ID does have a run-in option, but it only works within the same style, that is if you have:

               

              Heading

                   item

                   item

                   item

               

              you can have the TOC look like
              Heading

                   item    (page number); item    (page number); item    (page number)

               

              which doesn't seem all that useful to me, but what do I know.

              • 4. Re: Nested styles within TOC - a newbie
                peter minneapolis Level 4

                Peter Spier wrote:

                 

                Good morning, Peter,

                 

                You know me, more words is always better.   and I have no worries about reaching that 60 k goal (spoiler -- this is an inside joke, so ignore it).

                 

                Anyway, I figure I'll leave making Frame-type feature request to you and concentrate on working withthe curently possible. ID does have a run-in option, but it only works within the same style, that is if you have:

                 

                Heading

                     item

                     item

                     item

                 

                you can have the TOC look like
                Heading

                     item    (page number); item    (page number); item    (page number)

                 

                which doesn't seem all that useful to me, but what do I know.

                 

                I guess it helps if you're a speed typist, as you obviously must be, unless you've got a lot of stored keystroke macros and boilerplate text chunks on instant recall, like court reporters and simultaneous TV captioners.

                 

                Yes, the inline/run-in TOC feature isn't the same; it may be useful for specific style-guide requirements.

                 

                 

                Regards,

                 

                 

                Peter

                _______________________

                Peter Gold

                KnowHow ProServices

                • 5. Re: Nested styles within TOC - a newbie
                  Peter Spier Most Valuable Participant (Moderator)

                  peter at knowhowpro wrote:

                   

                  I guess it helps if you're a speed typist, as you obviously must be,

                  A blazing six words per minute, I think, with a minimum of one typo per line.

                   

                  Spenty half an hour responding to this thread this morning.

                  • 6. Re: Nested styles within TOC - a newbie
                    peter minneapolis Level 4

                    Peter S:

                     

                    I had the thought that there might be some form of newline character in InDesign that could be used to join the two paragraphs on the page, while keeping them as paragraph objects. This is one link that resulted from a Google search for "InDesign newline character" without quotes:

                     

                    http://forums.adobe.com/thread/421763

                     

                    There's a discussion and a unicode character, but I'm not sure how the unicode character could be used with a find/replace operation, even if just to see what the result would be. Maybe someone's got the time and skill?

                     

                     

                    Regards,

                     

                     

                    Peter

                    _______________________

                    Peter Gold

                    KnowHow ProServices

                    • 7. Re: Nested styles within TOC - a newbie
                      Peter Spier Most Valuable Participant (Moderator)

                      Peter G,

                       

                      I don't do XML, but I think the answer is basically the same as initially outlined. If it's one paragraph with some sort of magic line break character, that character is going to be carried into the TOC and create a line break there as well, and if it's two paragraphs sepatated by a magic separator, it's going to remain two paragraphs. Break characters don't just disappear on their because we decide we don't want to see them -- they have to be deleted, and styles cannot add or remove text, only change the formatting.

                       

                      The  neat thing about the No Break style (which never occurred to me before this morning), is precisly that it doesn't depend on any break characters to work, only the supposition that the second part of the paragraph will be too long to fit unbroken on the same line as the first part, and that it will fit on a new line. ID simply breaks the text at that point because it has no better choice. This is not, unfortunately, guaranteed to work for all paragraphs as it depends on column widths and text length to work in combination to force the break.

                      • 8. Re: Nested styles within TOC - a newbie
                        peter minneapolis Level 4

                        Peter Spier wrote:

                         

                        Peter G,

                         

                        I don't do XML, but I think the answer is basically the same as initially outlined. If it's one paragraph with some sort of magic line break character, that character is going to be carried into the TOC and create a line break there as well, and if it's two paragraphs sepatated by a magic separator, it's going to remain two paragraphs. Break characters don't just disappear on their because we decide we don't want to see them -- they have to be deleted, and styles cannot add or remove text, only change the formatting.

                         

                        The  neat thing about the No Break style (which never occurred to me before this morning), is precisly that it doesn't depend on any break characters to work, only the supposition that the second part of the paragraph will be too long to fit unbroken on the same line as the first part, and that it will fit on a new line. ID simply breaks the text at that point because it has no better choice. This is not, unfortunately, guaranteed to work for all paragraphs as it depends on column widths and text length to work in combination to force the break.

                        The No Break approach is a good solution if the TOC text frame and paragraph properties can be made to wrap at the allowed break position.

                         

                        I was trying to find a counterpart to FrameMaker's run-in paragraph feature, but as you verified, it's not possible. FYI, here's how it looks in FM:

                         

                        source & toc run-in.png

                        The source document uses ChapNum paragraph format (aka "ID paragraph style" for "Chapter number 1:" which is all in the autonumber part of the paragraph. The ChapTitl paragraph format is used for the "Chapter title" text.

                         

                        As in ID, the two paragraph formats/styles are designated to be extracted by the TOC process. FM's TOCs are always generated as independent files. In the TOC document, ChapNum format/style becomes ChapNumTOC, and ChapTitle format/style becomes ChapTitleTOC. The *TOC styles can be styled differently from their source paragraphs. So, ChapNumTOC is given the run-in property which allows the next paragraph in the document - here it's the ChapTitlTOC paragraph with "Chapter Title" text - to follow it on the same line. However, you can see the green pilcrow at the end of the ChapNumTOC paragraph, which identifies it as a true paragraph, that happens to lack the property that starts it on a new line. Once the TOC's formatted properly, every subsequent TOC process is completely "hands off," i.e., no manual touch up needed, nothing to forget. This is why I keep submitting an enhancement request for this ability, and also encourage others.

                         

                         

                         

                        Regards,

                         

                         

                        Peter

                        _______________________

                        Peter Gold

                        KnowHow ProServices