InQuestion: Hanging Page Numbers on the Right Side of a Table of Contents
Sandee Cohen shows how to use an obscure bit of paragraph formatting make page numbers stand out from the rest of a TOC.

This article appears in Issue 118 of InDesign Magazine.

InQuestion is a regular column devoted to answering your questions about working with InDesign.
Q. I need to make a table of contents, but each paragraph is a long description that needs to be indented from the column. The last line should have a leader tab with the page number all the way to the width of the column. In the past I’ve created this effect with forced line breaks, but this was way too much work and would cause problems if the text changed. Then I used a frame with no fill or stroke but with a text wrap applied. That was a little better, but I can’t help but think there’s got to be a more efficient solution
A. Yes, there is a very elegant solution—the seldom-used Last Line Indent. This setting can be used to apply an indent to the last character of a paragraph and the rest of the text above it (Figure 1). In your case, you want to hang the page number of the table of contents (TOC) entry outside the edge of the text. Instead of an indent, this is called an outdent. This is similar to how the numbers in the first line of a numbered paragraph hang outside the rest of the text. However, with this setting, the number at the end of the paragraph will hang on the right, outside the rest of the text.

Figure 1. An example of how the Last Line Indent can hang the numbers outside the right indent of a paragraph.
Since you’ve already
created TOCs for previous documents, I won’t go over those steps.
The first thing you want to do is create a paragraph style to set the indents for each TOC entry. Open the New Paragraph Style dialog box, and set all the controls for font, size, leading, and so on. The Indents and Spacing section is where the magic to “outdent” the last line will be set (Figure 2). Follow these steps in this order. (The order is important, or you’re going to get stuck in an “Invalid indent value. Indents cannot extend outside text frame” loop.) Start by setting the Right Indent to the amount of space between the text and the column width. Next, set the Last Line Indent to a negative amount that is less than the Right Indent. It has to be less because text can’t extend outside the frame.

Figure 2. The settings for the Right Indent and Last Line Indent to hang a character outside the right side of the text.
Next, switch over to the Table of Contents settings (Figure 3). Choose the paragraph style you created that has the last line indent. Then set the Page Number to After Entry. Apply a right indent tab between the entry and the page number. This will create an outdent for the page number with the text above it indented.

Figure 3. The Table of Contents settings to set the page number that hangs outside the text of the paragraph.
Most likely you’re going to want to apply a character style for the page number to help it stand out from the rest of the TOC. Also, I suggest applying a character style to reduce the size of the periods entered as the leader tab. This makes the dots a little less clunky.
Commenting is easier and faster when you're logged in!
Leave a Reply
Recommended for you

Illustrator Downloadable: Tropical Shadow Overlay Kit
This downloadable package comes with two Illustrator files containing 14 symbols...

Illustrator Downloadable: Summer Citrus Pattern Set
Downloadables are an exclusive benefit for CreativePro members! (Not a member ye...

InDesign Downloadable: Tables SuperGuide
Downloadables are an exclusive benefit for CreativePro members! (Not a member ye...
GREAT tip! Thanks.