No line breaks in TOC

Learn / Forums / General InDesign Topics / No line breaks in TOC

Tagged: 

Viewing 21 reply threads
  • Author
    Posts
    • #100421

      I am a newbie in InDesign and am working on a book with a quire specific request for the TOC. I have created a document per chapter in the book and I am using the following paragraph styles:
      – Chapter
      – Chapter number
      – Chapter header
      – Sub Header
      – Example Header

      I want the TOC to format like this
      ‘Chapter’ ‘Chapter number’ ‘Chapter header’………………page #
      ‘Sub Header’ – ‘Sub Header’ – ‘Sub Header’ – ‘Sub Header’
      Examples: ‘Example Header’ – ‘Example Header’
      I.e. using several paragraph styles on the same row and with individual styles shown in the TOC. The number of ‘Sub Header’ and ‘Example Header’ may vary the latter might not even exist in all chapters.

      Is this possible? and if so, how?

    • #100458
      David Blatner
      Keymaster

      There’s certainly no way to make this kind of TOC automatically. You’d probably have to make a regular TOC with sections, and then use find/change to remove the page numbers and carriage returns in the subhead and example sections.

    • #100462

      Thank you David for the quick reply. Then I know there is no need to pursue a fully automatic version of the TOC. What I have so far is quite OK and I will just have to format the final parts just before print.

      Related question… Is there a way to only update the page numbers in the TOC without affecting the layout? It would be a bummer if the formatting resulted in one page less and I get stuck in a Catch 22 situation.

    • #100464

      Hi,

      Can you show 2 screenshot (before/after) on a small sample (3 chapters)?

      (^/)

    • #100475

      I would love to post a screenshot or two. One tiny problem though. I haven’t figured out how to attach screenshots in this forum. I can’t paste and there is no ‘upload file’ button.

    • #100477
      David Blatner
      Keymaster

      We need to find a way to do screenshots here… but in the meantime, you can upload on imgur.com or imgbb.com and post the url here.

      • #100784
        Masood Ahmad
        Participant

        Indeed David! and that should be on top priority. Also program the forum to accept IDMLs and scripts.

    • #100478

      No screenshot, no Christmas gift! …

      (^/)

    • #100635

      I finally came around and got some screenshots together and posted them at https://imgur.com/gallery/kUDLg

      The pictures are to be viewed bottom up
      4) Extract from chapter 3 (or “Key” number three as they are called in this book(“Nyckel” = “Key” in Swedish)
      3) The wanted look of the TOC
      2) This is the current design of the TOC
      1) Chapter 1 in the TOC has been manually updated to look like I want

      What do you think? any way to automate the final part?

      A new question: I realized that I don’t want the period marks leading up to the page number but although I removed them from the Paragraph style they still appear!?! Any ideas?

    • #100636

      I’m afraid Santa Claus came but left nothing for you! Sorry! …

      Just a word: where is this TOC line?

      “Examples: ‘Example Header’ – ‘Example Header’”

      (^/)

    • #100844
      Vinny –
      Member

      Hi there… Maybe Santa was just late?
      Question is: are subheaders always placed before training tips in your document?
      If so, I guess it would be doable… just need some GREP magic…
      I got to go know, but I can explain this on Thursday ^^
      https://imgur.com/a/WC5UW

    • #100851

      Yes, the Subheaders comes first and then the training tips. There will always be subheaders in a chapter but not necessarily any training tips

    • #100852

      …and now I noticed your videolink :) It goes a bit too fast for me to keep up and the French menu’s doesn’t help either ;) but it seems like you managed to solve the issue of adding each sub chapter and training tip horisontally and separating them with a dash.

      The book is still far from finished and I am in no hurry but I am still very eager to see you explain this Thursday.

    • #100855

      Oh! I now read your question again and realized that I got your question wrong. No, the training tips will not always be last in a chapter.

      I just had a word with the author and actually there will be two TOC’s. First the regular one (not including the training tips) followed by one only including the training tips showing the page number for each training tip. That was very easy to do.

      To sum up, I still have two issues
      1) To get ‘Chapter’ ‘Chapter number’ ‘Chapter header’………………page # on one row correctly formatted
      2) Have the sub chapters appear in a horizontal sequence with a separator of some sort. For now a dash will do

    • #100857
      Vinny –
      Member

      Hey. Well I won’t be in front of my computer before Thursday but I still can explain briefly how it may be possible to achieve what you want.
      About setting the entries inline, it’s very easy to do. Juste check “Run in” Toc option. This will display the entries inline, with a semicolon and a space as separators. A grep trick could turn it into a fake dash. (Oops, a typography expert just had a heart attack…).
      The trickiest part is to get the chapter number and chapter header in the same line. Well, it’s basically not possible, so I just replaced chapter header para style by existing chapter number para style. Grep styles are faking the formatting. Now, these 2 entries can be set up inline since they use the same style. Grep styling again to hide page number and separator between these 2:entries.
      Got it?

    • #100881

      Hi Vinny,

      Oh, oh, oh, so close. I used IndyFont to create my own font replacing the semicolon with a neat little paw print. That part is done although I found a new issue which I will get back to in a minute.

      I read up A LOT on GREP styling (I love it) and I created a new paragraph style where I Switched character format on the word “Nyckel” and yet another on any digits thus using only one paragraph style for the two lines (paragraphs). In the TOC I did a similar paragraph styles. Thus still leaving me with the issue of the semicolon and the page number between the two. How do you hide that with styling? https://imgur.com/gallery/6CbZJ

      The new issue I found was the chapter 2 actually doesn’t contain any subchapter. The current work around is to add an empty paragraph with the proper styling but I don’t know if it can be handled in a better way. If I don’t add id chapter 3 will end up on the same row as chapter 2 which is kind of ugly.

      Looking forward to your response

    • #100884
      Vinny –
      Member

      Hi Peter
      Yes… so close ^^
      For your first issue, start by setting a “magical” character style. Let’s call it “invisible”. Set it as follows: 0.1pt font size, no color, 1% horizontal scaling and -1000 approach. This character style will come so handy in so many GREP tricks that I’m sure you won’t be able to live without it^^
      Then apply this character style to the page number and the semicolon using this grep style query:
      Nyckel\s\d+\t\K\d+;

      Now, for the second issue… that’s a bummer but let’s see if we can solve this.
      So, just create a new paragraph in chapter 2 and type “hidden”, then apply Subheader paragraph style.
      Now add grep style to your Subheader para style:
      hidden\v
      and apply… “invisible” character style of course. I told you you won’t be able to live without it ^^
      Of course, don’t forget to add the same grep style to your TOC subheader style.

      Let’s be clear, this is not so great to have this kind of hidden text in your document. You might accidentally delete it for example. So, be cautious…

      Hmm Ok… You have a new issue now? Some extra spacing before and after the “hidden” subheader, right? So you used Space before and/or after in your para style. Unfortunately, those properties are paragraph ones, not characters, and for the moment, I can’t think of another trick to get rid of them.
      If you didn’t use space before and after, well, good for you, you should be nearly done then…

      Hope that helps
      Vinny

    • #100901
      Vinny –
      Member

      Hey Peter
      I think I answered a bit too fast yesterday… Was kinda thinking out loud.
      About the issue of Chapters with no subheaders, forget about what I said. Simply create a new para style based on “Chapter”. Call it i.e. “Chapter with no subheader”. Just apply it to your 2 paragraphs Chapter 2 and add it as as new entry in your TOC.
      Also, I had a look at your TOC screenshot and like to share a thought: in your TOC Chapter para stle, make sure you set up your tabs properly: first tab must allow enough space in case you have a two (or more?) digits chapter number. Second tab must be right aligned up to your frame.

    • #100902

      That is brilliant.

      I created the “invisible” character style and applied the grep style Q you provided and I still have issues :P I tried to interpret the grep and I am not sure that I am doing such a good job. What I get is a tab after the chapter number and the page number that follows the chapter number is not right indent.

      It is looking for the word “Nyckel” followed by a white space, any number of digits and a tab. Then the \K. A little bit of googling tells me that \K is a neater version of Positive Lookbehind (?<=) The actual entry to replace is then any number of digits followed by a semicolon. Is this the correct interpretation? If so, what about the tab preceding the page number, shouldn’t that as well be part of the replacement?

      I then tried to switch the ^t to ^y in the TOC and, in order to match the switch, replacing the \t with a ~y in the GREP to no avail. I am starting to feel bad asking you for help again but we are so close.

      The link includes the current look of the TOC both ^t and ^y settings for the page number, the TOC with the chapter header para style highlighted and the Tabulation view of the para style used in for the chapter header. https://imgur.com/a/6ZNSp

      As for the missing-subheader-problem I have an idea for a less risky solution that I will try out today

    • #100903

      Hahaha,

      Didn’t see your second post. I fixed the tabs and everything works swell!!!

      I will get back to you on how my other idea went

    • #100937

      I now have the final TOC in place. In order to ensure a line break even though I didn’t have any sub chapters I added yet another paragraph style which IS present in all chapters. The giant tick.

      At the end of all chapters I have a rather big tick marker (I’m not 100% sure what it is called in English but if you have a checkbox you tick it with something that looks like an extravagant v). In order to implement it I used my newly acquired GREP skills and made two search/replace queries (REALLY annoying but I cannot see how this can be done using formatting or even only one s/r operation).

      The first finds the end of the chapter (article) and adds a carriage return and the letter P. Search ($)\Z Replace: $1P The second changes the style of the paragraph in order to convert the P to a tick (Wingdings 2) and to get a paragraph style I can use to fix the TOC problem. Search: (^P$) and then the new paragraph style.

      I am getting to the point where I need to write a manual for the InDesign book I have created in order to remember all the fancy stuff I have used. I am well aware of the dangers of being too inventive but it is very much fun :)

    • #114478

      I’m back if anyone is still listening in on this post (Vinny?). If not I will post a new one.

      The book was put on hold shortly after the last update but is now VERY close to printing.

      The (final) issue I am currently facing is that sometimes my chapter name is quite long and needs two rows but I would REALLY like my page number to stay on the first row.

      Normal layout:
      ‘Chapter’ ‘Chapter number’ ‘Chapter header’………………page #
      ‘Sub Header’ – ‘Sub Header’ – ‘Sub Header’ – ‘Sub Header’

      In case of a long chapter name:
      ‘Chapter’ ‘Chapter number’ ‘Chapter header [start]’…page #
      ‘Chapter header [end]’
      ‘Sub Header’ – ‘Sub Header’ – ‘Sub Header’ – ‘Sub Header’

      Today I am getting: ‘Chapter’ ‘Chapter number’ ‘Chapter header [start]’
      ‘Chapter header [end]’…page #

      • #114508
        Vinny –
        Member

        Hi
        Fun puzzle again.
        Probably a new thread would have been a good idea.

        Anyway, thinking out loud, my first thought would be… Grep magic again ^^

        What about using Grep style to apply a character style with some Baseline shift depending on the amount of characters in the chapter header?

        For instance: .{40,}~y\K\d+ will catch numbers (your pages) that follow at least 40 characters and a right indent tab.

        Of course, 40 is just an example, you’ll have to count what will be the limit of characters before your header breaks.

        Please note:
        – unless you use monospace font, the technique is a bit approximate and you’ll have to check your Toc carefully
        – when using right indent tabs, last line can extend past the right margin, which is not good. You might want to consider using two normal tabs instead. See https://creativepro.com/20-obscure-features.php and my comments at the very bottom

      • #114509
        Vinny –
        Member
    • #114607

      Hi again Vinny. My GREP overlord guru magician,

      Thanx for the speedy reply. I almost got it to work with using just \t instead of the \t{2}. I only have one tab. But then I realized that I have manually inserted line breaks (shift+return) in the chapter headings, i.e. the line break will not occur after x number of characters. This makes it much easier and the GREP string now reads: .{10,}\D\K\d+

      – The .{10,} part is needed since the first line contains a word “nyckel” followed by the chapter number

      Yet another – VERY BASIC – question:
      I want to use a TOC header including the header and then “Page” right aligned on top of the page numbers. I must be blind but I cannot figure this one out

Viewing 21 reply threads
  • You must be logged in to reply to this topic.
>