Skip to main content
elshocht
Inspiring
December 27, 2021
Answered

Create a toc with on one line the text of 2 styles

  • December 27, 2021
  • 9 replies
  • 3659 views

In the book I have a style for "Chapter" (for the chapter number) and a style for the "chapter title" (for the title).

I have 2 different style because they come on 2 lines and with different style.

How can I get in the TOC Chapter the content of "chapter" followed on the same line by the contenbt of "chpter title" and the page number.

In fact, I woulmd need a paragraph style with no line feed carriage return at the end.

ex :

in the book :

 Chapter 12

 This is the title of this chapter

and in the TOC:

Chapter 12 Thjis is the title of this chapter ...... 25

Thank for any suggestion

 

This topic has been closed for replies.
Correct answer Bevi Chagnon - PubCom.com

@Lukas Engqvist  and @vladan saveljic both suggested using the numbered heading method, which can be very helpful when making long technical documents with many chapters.

 

I created a new demonstration of this method (TOC-3) at www.PubCom.com/tutorials/toc-3

 

Note for those making accessible PDFs:
Ensure that the paragraph style's Export Tags are set to <H2> or another heading level. Numbered headings usually are NOT numbered lists.

 

9 replies

Lukas Engqvist
Community Expert
Community Expert
December 28, 2021

I would have thought "Chapter nn" should be a Numbering style. (Bullets and Numbering). The easy part is doing this in the TOC, the difficult is the headers, which have to start with a Forced Line Break for them to start right indented under the numbering, but these days Forced Line Break can be ignored in the TOC (Would be nice if that could be an option in the numbering style but ^n doesn't work there)

Bevi Chagnon - PubCom.com
Legend
December 29, 2021

@Lukas Engqvist  and @vladan saveljic both suggested using the numbered heading method, which can be very helpful when making long technical documents with many chapters.

 

I created a new demonstration of this method (TOC-3) at www.PubCom.com/tutorials/toc-3

 

Note for those making accessible PDFs:
Ensure that the paragraph style's Export Tags are set to <H2> or another heading level. Numbered headings usually are NOT numbered lists.

 

|&nbsp;&nbsp;&nbsp;&nbsp;Bevi Chagnon &nbsp;&nbsp;|&nbsp;&nbsp;Designer, Trainer, &amp; Technologist for Accessible Documents ||&nbsp;&nbsp;&nbsp;&nbsp;PubCom |&nbsp;&nbsp;&nbsp;&nbsp;Classes &amp; Books for Accessible InDesign, PDFs &amp; MS Office |
vladan saveljic
Inspiring
December 28, 2021

vladan saveljic
Inspiring
December 28, 2021

vladan saveljic
Inspiring
December 28, 2021

You could use only your "Chapter Title" for the TOC,

and set the TOC paragraph style with numbered list (for example Chapter ^#)

casinclaire
Inspiring
September 29, 2022

Thanks for adding this info to the thread. I didn't see it the first time around, and someone else answered me with similar information. I just wanted you to know I did finally see your post, too, and will be trying this. 🙂

 

 

Bevi Chagnon - PubCom.com
Legend
December 28, 2021

We do this type of construct very frequently and have a free online tutorial for our students and clients at https://www.pubcom.com/tutorials/toc-2/  It shows how to format both the Section Headings and the TOC entries.

 

Benefits: easy one-click formatting of the section headings. Suitable for reuse in future layouts, templates, and database publishing. And it creates an accessible PDF, if you need that for your project.

 

  1. For the chapter INDD file, we make the entire text one paragraph in one text frame, but we add a shift+enter after Chapter 1 (space) to force a line break to the next line.
     
  2. One paragraph style formats the entire paragraph of text but uses a nested character style to format the "Chapter 1" in a different font and have it apply to the text up through the first forced line break.
     
  3. Then, when building the TOC style, check the option to remove manual line breaks.  The TOC will now pick up the entire paragraph as one unit along with its corresponding page number.

 

Hope this helps!

 

 

|&nbsp;&nbsp;&nbsp;&nbsp;Bevi Chagnon &nbsp;&nbsp;|&nbsp;&nbsp;Designer, Trainer, &amp; Technologist for Accessible Documents ||&nbsp;&nbsp;&nbsp;&nbsp;PubCom |&nbsp;&nbsp;&nbsp;&nbsp;Classes &amp; Books for Accessible InDesign, PDFs &amp; MS Office |
casinclaire
Inspiring
September 29, 2022

This is a good solution if you are using a forced line return between two lines; but (unless I've misunderstood) it doesn't help if you are using actual "breaking" returns. I have a chapter number and chapter head (both text) that are currently on two lines. For the TOC, I want to combine them on one line, separated by a colon, and followed by the page #. Any ideas how to do this when using real returns vs. forced line returns?

James Gifford—NitroPress
Legend
September 29, 2022

There isn't a simple solution, but the two basic options are:

 

1) Don't pull the chapter number paragraph, only the chapter title. And then in TOC styles, assign it auto-numbering.

 

2) Pull both styles and use zero leading on one to make them stack onto the same line; use indent spacing on the title to make it set inwards from the chapter number. (I can never remember which style to set to zero leading; I think it's the chapter name.)

 

Willi Adelberger
Community Expert
Community Expert
December 28, 2021

Another solution could be: 1 style for chapter in the toc, but make a baseline shift to the next line and and another style for the next level with an inset of the space the text for chapter 1 would need.

 

Another solution would be, to make chapter and text part of the same paragraph, use inline style and nested style to get the difference and supress the forced return in the toc creation.

Peter Spier
Community Expert
Community Expert
December 27, 2021

One way to do this is to create a non-printing "tag" frame to hold the text you will use in the TOC and give it a unique style name that you can include instead of using the two styles you have defined for chapter heads and titles, so for example, this tag would say "Chapter 12 This is the title of the chapter" (without the quotation marks). I usually do these tags in a big red character style so I can find them easily. In the TOC itself you can use any paragraph style you like and include nested or GREP styles to format parts of the listing differently.

James Gifford—NitroPress
Legend
December 27, 2021

The really, really simple method is to generate the TOC and then apply a style to "Chapter 1" in each line. I have a number of books where the TOC needs just one or two tweaks after each update and it's not worth finding a completely automated solution.

 

A more advanced method would be to use the GREP style attached to the TOC1 (or whichever) paragraph style. You should be able to define "Chapter nn" as the target and apply a character style automatically.

 

However, I don't think you can combine two paragraphs/styles in one TOC line. That would be another job for GREP or a script, to combine two entries into one for each line. It might be worth re-thinking your chapter heading layout if a simple numbering of the TOC lines isn't enough.

elshocht
elshochtAuthor
Inspiring
December 27, 2021

Of course, I just needed to ask the question to find a solution

I Have "Chapter # This is the chapter Title"

I put the text in two boxes, a small one for "Chapter" and a larger for "This is the Chapter Title" with a style for each box.

I then create the TOC which comes with text attributes from the boxes.
I then use  the script "ClearStyleOverrides.jsx"

Done .... 🙂

I needed to have a 90% automatic way because the documnet will be translated into 27 languages using tools ...

 

Thank for the time spent to answer my question

 

Alain Elshocht(PI removed by moderator. Do not add URLs/websites/email address to your signature or your account will be banned])
Nancy OShea
Community Expert
Community Expert
December 27, 2021

Which Adobe App or Service are you asking about?

 

Nancy O'Shea— Product User & Community Expert
elshocht
elshochtAuthor
Inspiring
December 27, 2021

oops sorry, I'm using InDesign

 

Alain Elshocht(PI removed by moderator. Do not add URLs/websites/email address to your signature or your account will be banned])
Nancy OShea
Community Expert
Community Expert
December 27, 2021

[Moderator moved from Using the Community (forums) to InDesign.]

 

Nancy O'Shea— Product User & Community Expert