Skip navigation
Currently Being Moderated

Manipulate table of contents results

Jul 5, 2012 5:50 AM

Hi everyone,

Within each chapter of a book I’m working on, there are level 1 headings that look like the following:

 

¶5-100 Context

 

So each of these headings has a paragraph number, ie. ¶5-100 and then the name of the heading, ie. Context. There’s a tab between the para number and the content of the heading.

I need to create a specific chapter by chapter table of contents using the content of these level 1 headings. The information will be located at the start of each chapter.

It’s easy enough to do but when the TOC is genereated I get the following effect:

 

¶5-100 Context  [tab]    page number

¶5-120 next heading   [tab]   page number

¶5-140 next heading   [tab]   page number

¶5-160 next heading   [tab]   page number

 

I don’t need the page numbers at all and instead of the above, I need the following result:

 

Context [tab] ¶5-100

next heading [tab] ¶5-120

next heading [tab] ¶5-140

next heading [tab] ¶5-160

 

Once I have the above effect, I would then go ahead and create cross references where the para numbers within the TOC are the source of the Xref and the destination is the relevant heading within the body of the chapter.

 

So is there a way to manipulate the results so that the headings appear as the above? I know it probably can’t be done but just thought I’d ask incase I’m missing something.

 

Appreciate any help.

 
Replies
  • Currently Being Moderated
    Jul 5, 2012 6:56 AM   in reply to gwhPoster

    I don't think you can do it with a standard TOC by itself, but you might be able to do it with cross-references, or maybe using a standard TOC in combination with character style-based running head variables that would populate non-printing frames to be included in the TOC. That method would only work, though, for one heading per page.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2012 7:24 AM   in reply to gwhPoster

    Well it wouldn't be hard to set up a GREP query for find/change that would move the numbers after making the TOC. Downside is you'de have to do it each time you update.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2012 8:12 AM   in reply to gwhPoster

    try

     

    ^(\d+-\d+)\s(.+)

     

    and change to $2\t$1

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2012 9:12 AM   in reply to gwhPoster

    Are you on the GREP tab or the Text tab of the Find/Change dialog? I often make the mistake of entering GREP queries in the text search and it takes me awhile to figure out why no match is found.

     

    Can you post a screen cap of the un-altered TOC with hidden characters showing? Might be something at the start of the line you didn't mention. Or perhaps I misinterpreted and you really have the pilcrow there as part of the text? for that change the find to ^(~7\d+-\d+) (.+)

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2012 12:41 PM   in reply to gwhPoster

    Sorry, Looks like I didn't catch Jive changing the \s to a space when I copied the query. You want ^(~7\d+-\d+)\s(.+)

     

    That translates to at the start of a paragraph find (a pilcrow [paragraph mark] followed by one or more digits, a hyphen,then one or more digits) any whitespace (any characters up to the end of the paragraph).

     

    The replace is the any characters expression, a tab, and the pilcrow/digits group, and the 'any white space' is thrown away.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 6, 2012 4:10 AM   in reply to gwhPoster

    ^(~7\d+-\d+)\s(.+) works here, and should work for you, too. Make sure you typed it correctly.

     

    If it doesn't work, try \t in place of \s (\t is the tab character, \s is any whitespace, so a bit more versatile).

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 6, 2012 4:39 AM   in reply to Peter Spier

    \s picks up a single space/tab -- perhaps there is more than one? Try with \s+ ("one or more white space").

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 9, 2012 1:31 AM   in reply to gwhPoster

    a. Use this GREP style:

     

    (?<=\t).+

     

    This will look for a tab, then apply a character style of your choice to the rest of the line, excluding the tab (which might be important if you apply underlining).

     

    GREP styles are my favourite because I can express virtually everything I need with those -- they are so versatile! However:

     

    b. Use this Nested Style:

     

    [None] through 1 [Tab Characters]

    yourStyle up to 5 [Words]

     

    (The latter number is because I'm not sure how InDesign counts 'words'. There doesn't seem to be a "Up to End Of Line" code.)

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 9, 2012 2:39 AM   in reply to [Jongware]

    [Jongware] wrote:

     

    b. Use this Nested Style:

     

    [None] through 1 [Tab Characters]

    yourStyle up to 5 [Words]

     

    (The latter number is because I'm not sure how InDesign counts 'words'. There doesn't seem to be a "Up to End Of Line" code.)

    When I want to run a nested style up to the end of a paragraph in a situation like this I often just tell it to run up to an end nested character style marker and don't insert one. You can use any character that isn't encountered and the nested style will run to the end of the paragraph. In this particular case you could also "swap" the formatting and define the paragraph style the way you want the numbers to look, then apply a nested style through 1 tab to change the text ahead of it, then there's no need for a "none."

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points