How do I format my table of contents so long titles do not run into the page numbering?
It's sometimes unavoidable, requiring a manual touchup (line break or other editing) of those entries after the TOC is generated. (I have one reference manual I update from time to time, and each new TOC has a short list of fixes including breaking two entries and applying a special paragraph style to the last item — there may be other methods but that's the simple one, so I stay with it.)
If you have more than a few, you're best off making the text column wider and/or the font smaller.
You can also shorten the title paragraphs, by putting the rest of a long title in a second, subtitle paragraph. You can do this "invisibly" by giving both paragraphs very similar styles so they blend together on the actual page, or the more usual route of making the subtitle smaller and set close to the title paragraph.
Set a right indent - and then a negative first line right indent of the opposite value
i.e., right indent 10mm - first line right indent -10mm
I'm not sure that will work as intended, given that the tabbed page number has to be further over than the right indent.
It can be done with no page numbers (which isn't very useful) or if an index-style layout, with the number just spaced over from the end of the text, is acceptable. But unless I've missed something, you can't fold part of the text and still position the page number at the right margin (ish).
It works, it works fine. I use it always.
I edit it. I rarely have a TOC generated that I do not need to manually tweak.
I use always a right intent. Intent last line is e.g. 8mm and last line –8mm. It works fine. No after creating editing is needed. That is what this function is made for.
Okay, I see what you and Eugene are saying now. That certainly automates the issue, and is perfect for long generated lists, but maybe moreso for indexes than TOCs. At best, you'd have to go to most TOC'ed headings and use nonbreaking spaces etc. to get the break clean and balanced without a manual edit... or live with entries that had one word broken to the next line, etc. Oogly.
It's the usual tradeoff between a large amount of meticulous prep so that an action can be "automatic" — or accepting that the "last pica" is going to be a manual step. But both work.
This is exactly why the Last Line Right Indent feature was added to InDesign—long TOC entries. The question has been answered, but I'm including the post below because it illustrates both the problem and Eugene's solution.
Hi Barb, I successfully use the hanging last line right indent option for all of my Table of contents, Table of figures etc. However, I am currently working on a document where one single entry in the List of figures, is ignoring the indent (see Figure 9 below). Do you have any ideas? I've tried every possible solution such as editing the styles, trying different indents etc but can't get this particular entry to break. It currently has a 25mm, -25mm indent set. Note that if I add an additional word to the Figure title, it works perfectly, it's only with this exact amount of words it's ignoring the right indent. I hope that makes sense.