7 Replies Latest reply: Nov 12, 2012 6:02 AM by Peter Spier RSS

    Table of Contents - Page Range

    samallen3 Community Member

      I am formatting a catalog in Indesign CS5 and I am trying to work out snags now before our vendors send in their files.  I have a simple template with the Product Classification and the Section at the top of each page (created as master pages, different master for each section but all based on the same master) and I want to automate a Table of Contents to include each Product classification.  I formatted each product class with the same paragraph style and when I generate the TOC, it simply lists each page number instead of a range which is what I would expect it to do.  For example:

       

      Product Classification A........2

      Product Classification A........3

      Product Classification A........4

       

      The same product class runs across multiple pages,  and because I have the paragraph style applied in the master page they show up as individual TOC entries.   I was wondering if there was a way to automate the TOC with page ranges, instead of just each instance of the paragraph style.  The only workaround I could come up with was just including the text that I want to show in TOC on a hidden layer on the first page of the page range with the correct paragraph style applied to each one and then typing the range in manually after my whole catalog is finished.  Or I could just let ID do its thing and then delete the unecessary entries when it's updated.

       

      I need it to look like this:

       

      Product Classification A.......2-4

      Product Classification B.......5-10

       

      Better yet, I need the heirarchy to look like this if possible:

       

      Section

           Product Classification A.......2-4

           Product Classification B.......5-10

       

      In order for items to show up in an automated TOC, they have to be overridden in the document (if they are on master pages)...so I don't think I could even automate it this last way unless I would override all master items, which would cause more harm than good in this case ( I never know when something might change).

       

      Could someone offer a solution or another workaround that might be easier than just typing out the TOC and formatting it by hand?

       

      Thanks in advance.

        • 1. Re: Table of Contents - Page Range
          daveTannoy

          I'm in the same situation at the moment as well but if it helps i'm looking for a script or messing with the index to get a similar result.

          • 2. Re: Table of Contents - Page Range
            peter at knowhowpro Community Member

            The commercial InDesign Cross-References Plug-In from dtptools.com might work for you. There are some free supplementary scripts mentioned on the product page that you can request. One creates a TOC by using cross-references to extract source content that you specify. It works a lot like the built-in InDesign TOC tool, but it may be more customizable. There's a free trial. If you can't make it do what you need, often an email to their support techs will get a prompt reply (allowing for time differences between Europe and wherever you are) and some useful suggestions.

             

             

            HTH

             

             

            Regards,

             

             

            Peter

            _______________________

            Peter Gold

            KnowHow ProServices

             

            samallen3 wrote:

             

            I am formatting a catalog in Indesign CS5 and I am trying to work out snags now before our vendors send in their files.  I have a simple template with the Product Classification and the Section at the top of each page (created as master pages, different master for each section but all based on the same master) and I want to automate a Table of Contents to include each Product classification.  I formatted each product class with the same paragraph style and when I generate the TOC, it simply lists each page number instead of a range which is what I would expect it to do.  For example:

             

            Product Classification A........2

            Product Classification A........3

            Product Classification A........4

             

            The same product class runs across multiple pages,  and because I have the paragraph style applied in the master page they show up as individual TOC entries.   I was wondering if there was a way to automate the TOC with page ranges, instead of just each instance of the paragraph style.  The only workaround I could come up with was just including the text that I want to show in TOC on a hidden layer on the first page of the page range with the correct paragraph style applied to each one and then typing the range in manually after my whole catalog is finished.  Or I could just let ID do its thing and then delete the unecessary entries when it's updated.

             

            I need it to look like this:

             

            Product Classification A.......2-4

            Product Classification B.......5-10

             

            Better yet, I need the heirarchy to look like this if possible:

             

            Section

                 Product Classification A.......2-4

                 Product Classification B.......5-10

             

            In order for items to show up in an automated TOC, they have to be overridden in the document (if they are on master pages)...so I don't think I could even automate it this last way unless I would override all master items, which would cause more harm than good in this case ( I never know when something might change).

             

            Could someone offer a solution or another workaround that might be easier than just typing out the TOC and formatting it by hand?

             

            Thanks in advance.

            • 3. Re: Table of Contents - Page Range
              Peter Spier CommunityMVP

              Don't know how I missed this the first time through...

               

              Here's a script Peter Kahrel wrote for me a few years ago that consolidates all page numbers for a single topic and separates them with a comma for use in making an "index to advertisers". It will get you part way there:

               

              //Consolidate lisitngs

              //By Peter kahrel with some minor additions by Peter Spier

               

              var myFrame = app.selection[0];

              if (myFrame != null && (myFrame.constructor.name == "TextFrame" ||myFrame.parent.constructor.name == "Story")) {

               

                 app.findGrepPreferences = app.changeGrepPreferences = null;

                 app.findGrepPreferences.findWhat = "^(.+
              s)()
              r
              1(
              )$";

                 app.changeGrepPreferences.changeTo = "$1$2, $3";

                 f = myFrame.parentStory.changeGrep ();

               

                 while (f.length > 0)

                  f = myFrame.parentStory.changeGrep ();

                   

              } else { alert ("Select the Index Frame");  

              }

               

              I can't log in this morning, so I'm replying by email and I don't know if the script will come through intact. but if it does this would be the first step. You can then use find/change to replace the middle numbers and commas with a dash, if the numbers are continuous for each section, or you can do it manually if not.

              • 4. Re: Table of Contents - Page Range
                Peter Spier CommunityMVP

                As feared, the script did not make it...

                 

                I'll try to come back when the forum lets me log in, or you can try searching for "index to advertisers" and my name, and an earlier thread with bot the script and more discussion may come up. This was all done for an article that appeared in ID MAG June-July 2009  if you want to purchase the back issue and get the whole story from start to finish.

                • 5. Re: Table of Contents - Page Range
                  Peter Spier CommunityMVP

                  OK, I'm logged in now, so here's the script as it should be:

                   

                   

                  //Consolidate lisitngs
                  //By Peter Kahrel with some minor additions by Peter Spier
                  
                  var myFrame = app.selection[0];     
                       if (myFrame != null && (myFrame.constructor.name == "TextFrame" ||myFrame.parent.constructor.name == "Story")) {
                       
                                 app.findGrepPreferences = app.changeGrepPreferences = null;
                                 app.findGrepPreferences.findWhat = "^(.+\\s)([\\d,\\s]+)\\r\\1([\\d,\\s]+)$";
                                 app.changeGrepPreferences.changeTo = "$1$2, $3";
                                 f = myFrame.parentStory.changeGrep ();
                  
                                 while (f.length > 0)
                                      f = myFrame.parentStory.changeGrep ();
                                      
                       } else { alert ("Select the Index Frame");               
                  }
                  
                  • 6. Re: Table of Contents - Page Range
                    daveTannoy Community Member

                    Thanks Peter I'll have a look at this to see if this is what i need

                    • 7. Re: Table of Contents - Page Range
                      Peter Spier CommunityMVP

                      It isn't exactly what you need, but it will consolidate consecutive entries into a single line.