Book Excerpt: InDesign Course and Compendium
Steve Laskevitch shows how to work with long document features.
This article appears in Issue 136 of InDesign Magazine.
In the following excerpt from his book Adobe InDesign CC: A Complete Course and Compendium of Features*, Steve Laskevitch shows how to work with long document features like tables of contents, text variables (which you can use to control things like chapter numbers and running headers), and cross-references.
Tables of Contents (TOCs)
Manually building a table of contents for a large document is one of the punishments awaiting those who fail to use paragraph styles for headers and subheaders. InDesignās ability to scour long documents (including Book documents composed of many individual files) to automatically create a table of contents is one of the great rewards for using paragraph styles.
Preparation
Consider this document: each chapter header has a paragraph style called Chapter title applied to it. Major topics (like the ones at the top of the page) have their own style, as do the headers under them (like āPreparationā just above). In some cases there are more granular headers used, too. In this bookās table of contents, I chose to include the first three heading levels as its entries.
I strongly recommend making a mock-up table of contents with its own paragraph styles to decorate the entries that will be generated from text using the styles youāll target in the document. In my case, I made styles with names like TOC chap header, TOC topic header, and TOC header. I wanted names that clearly showed that these would be used only in my table of contents (TOC). When InDesign is configured to look for text that uses certain styles, you are offered the option of using the same styles to decorate the TOC entries. This is rarely what we
want. So itās best to have other options at the ready.
Youāll also need a paragraph style for the TOCās title (usually the word āContents,ā but thatās up to you). And youāll be offered the chance to choose a character style for the page numbers that appear in the generated entries. In the case of this book, I made a character style that gives a consistent size and weight to the page numbers, no matter what the rest of the entry is like.
InDesign does offer to create styles for you. Youāll see them in the list of styles where you also find your own, and theyāll become real if you choose them. But theyāre very generic and youāll have to redefine them anyway.
Creating the TOC
Once youāre sure that styles have been applied to all the paragraphs with text that is to become TOC entries, and you have built styles for the TOC itself, youāll need to go to the page(s) where the TOC will be. When youāve configured and committed the Table of Contents dialog box, the cursor will become a loaded text gun. You can either create a text frame then or flow the TOC into an awaiting frame. Since I often have a master page with a primary text frame governing my tables of contents pages, I use the latter option.
There is a lot to configure in the Table of Contents dialog box (Figure 1), so I use my dummy TOC to guide me. To gain access to all of the available options, click the button labeled More Options, if you see it. On the other hand, if the button says Fewer Options, donāt click it. Near the bottom of the dialog, check Include Book Documents if you need to trawl for styles in all the documents of a Book document.

Figure 1
Now you can work from near the top of the dialog down. In the Title field, enter the text that should appear at the top of the TOC, and choose the Style for it just to the right. In the example here, Iām building the TOC for a magazine, so I chose āArticlesā as my TOCās title.
The two sections that follow are used in tandem. The Styles in Table of Contents section is where we choose the styles whose text is to become entries in the table of contents. Double-clicking on a style listed in the Other Styles box on the right adds it to the Include Paragraph Styles list on the left. Simple TOCs, like those for a novel in which we want only the chapter headers noted, may have only one style chosen. For this magazine, Iāll be choosing three: the titles of the articles, the bylines, and a brief synopsis. The first will be a Level 1 entry, which is assigned in the next section of the dialog, Style. The other two will be Level 2, since theyāre both subordinate to the title, but not to each other.
In the Style section, you also choose how to style the entries generated from the style currently highlighted in the Include Paragraph Styles section above. For entries pulled from the style called Title (which decorates the article titles), Iām using a style called TOC Article Title. As in my mock-up, I chose to have the page number Before Entry with a tab (^t) Between Entry and Number. For the Level 2 entries, I chose No Page Number since theyāre already next to the main entry (Figure 2).

Figure 2
There are times when we need a TOC entry to help a reader find a specific page, but weād prefer to not have the text appear on that page. There are three common ways to do this:
- Put the text on a hidden layer, then check the box Include Text on Hidden Layers in the Options section of the Table of Contents dialog;
- Set the frame that holds the text to be Nonprinting using the Attributes panel; or
- Place the text frame on the Pasteboard mostly off the page, barely overlapping it.
I prefer method 2 because I can see the text when I zip through my pages in InDesign, but it disappears in Preview mode and wonāt output. I may forget the text exists if itās on a hidden layer or if Iām zoomed too close to see the text that is mostly offstage.
When Iām very on top of things, I may create an object style that gives the frame a garish fill or stroke and makes it nonprinting. This way, I can recognize them when I see them, but no one else will see the garishness.
Updating a Table of Contents
What if any of the text changes? Tables of Contents donāt update automatically. However, itās easy to prompt them. Insert the Type tool cursor anywhere in the TOC. Then choose Layout > Update Table of Contents.
TOC Styles
You will likely generate a table of contents a few times before itās right, especially if it has several levels of entries (Figure 3). Sometimes youāll choose the wrong style to look for or to apply to the entry. When you finally dial it in, and you suspect you may need to use those settings again (the next issue of the magazine, for example), you can create a Table of Contents Style. I very much wish they called it a āpresetā as the word āstyleā is used so much here.

Figure 3
When youāre in the TOC dialog, and all the settings are correct, click the Save Style⦠button and give this preset a name. TOC Styles are among the things that get synchronized in a Book file.
Theyāre also used to generate the electronic TOC in an eBook (like those read on an iPad or Kindle). You may generate an attractive TOC from that TOC Style as well, but for those media itās truly optional. However, the TOC Style is not; itās the way we describe the hierarchy in an eBookās code.
We will discuss eBooks in the āOutputā chapter of this bookāsee āePub and Tagged File Formatsāābut you might consider creating a TOC Style that excludes page numbers just for that medium. In a reflowable ePub, a reader can change the font or font size of the text, which makes the whole concept of a page rather fluid. TOC entries become hyperlinks that will take the reader to the correct page, so knowing the number of a page becomes irrelevant.
To load TOC Styles from a different document (a previous project, perhaps), choose Layout > Table of Contents Styles⦠where you can click a Load button. You can also create new or edit existing TOC Styles, but itās done a bit blindly, as this approach doesnāt generate a TOC afterward.
Text Variables
Tables of contents arenāt the only InDesign feature to extract content based on the styles applied to it. Text variables can be a convenient way to repeat or reference text that uses a paragraph or character style. Much of what you see along the tops of pages in the print edition of this book uses text variables to remind you of which chapter youāre reading (at the top of left-hand pages) and which topic (on right-hand pages).
Variables can also be a way to insert document data, like date and time of the most recent edit or output. And they can be used to extract and render metadata from placed images for captions. As in so much, there is good news and bad with this feature.
Chapter Numbers
When using the Book feature (discussed at the beginning of this chapter), you can inform each document which chapter it is or to begin automatic chapter numbering. To display the number, we insert a text variable: right-click and choose Insert Variable > Chapter Number. The chapter number will display in the same style as the text around it. Here is this chapterās number: 7. Yes, that ā7ā is a variable. I used the Book feature to set the first chapter of the Compendium section as ā1.ā This is the seventh (Figure 4).

Figure 4
Another way to insert variables and, better, to define them, is by going to Type > Text Variables and choosing either Insert Variable or Defineā¦. So I donāt redefine a variable Iām using, Iāll choose Define⦠and click Newā¦. The settings above produce this:
If I put that in a narrow text frame, however, it will look like this:
Warning: Text variables donāt break across lines. I bet you wondered when Iād get to the bad news. If the space available is too narrow, the variable text will get crushed.
If we redefine the variable to be less verbose, it will change everywhere and may fit in narrower quarters. Or I can select the variable, right-click, and choose Convert Variable to Text, and the following will result: it will wrap, but it will no longer update if the chapter number changes.
Captions
Of course, we can create our own captions, but if our images have metadata, we can generate captions that utilize it. Although we go through a different procedure for these, they, too, are text variables (Figure 5).

Figure 5
Metadata is added to images in one of several places. One can do so in Photoshop via the File Info dialog box. In Adobe Bridge or Lightroom, one can use a Metadata panel. For the image above, I added data to the Description and Creator fields. Object > Captions > Caption Setup⦠allows us to choose which metadata to include and what text should surround it in the caption weāll later generate. To make the caption, I right-clicked a selected image and at first chose Captions > Generate Live Caption. The first problem was that InDesign didnāt read the Creator metadata. To force it to do so, I had to choose Author in the Caption Setup dialogāan obvious (and long-lived) bug.
Then I saw the result: the description was crushed on one line. If all my captions are very short, this may not be an issue. If a linked imageās metadata changes, the caption will automatically change as well. But few captions are short enough, and metadata like this doesnāt often change. So I used Undo, and this time right-clicked and chose Captions > Generate Static Caption. Static Captions are not variables, thus they are not linked to their source nor do they get crushed when the space is too narrow. Once these are generated, theyāre just text.
Running Headers
These text variables are among the most useful. If youāre reading this in print, youāll see a running header at the top of each page of this spread. One of them reads āText Variables.ā That one āseesā the last use of a particular paragraph style, which decorates the large header earlier in the text announcing this topic. Hereās its definition (Figure 6):

Figure 6
Using Type > Text Variables > Defineā¦, I clicked the New button. I usually name a variable after the style to which it refers. I chose ātopic titleā and selected Running Header (Paragraph Style) as the Type. I have almost never used the character style variant. Iām sure itās lovely.
For a running header, we are usually referring to a topic that is ongoing, and so we want the most recent use of it. Thus, I chose Last on Page for Use. We can choose a wide variety of special characters to automatically be added before or after the text weāre grabbing, or we may type into the Text Before or Text After fields. InDesign even supplies a thoughtful way to remove punctuation or change the case of the text.
To insert the variable, we locate our cursor in a text frame (for running headers, this is usually on a master page, and often near the Current Page Number marker), right-click, and choose Insert Variable > [name of variable].
Warning: Yes, another bug! When you change the text to which a variable refers, youāll have to force the page to redraw. Simply zooming out and in again will do it. Otherwise, it appears that the variable is not updating.
Cross References
Cross references are cousins of text variables with a bit of TOC genes thrown in. They refer to and can echo text that uses a certain paragraph style, and they most often cite the page on which to find itāe.g., āsee Hogwarts on page 993.ā Since cross references are also hyperlinks in electronic documents like ePub, I often suppress the appearance of page numbers there. The Cross References panel can be opened via Window > Type & Tables.
The Destination
If you need to refer to a word or phrase rather than a paragraph, you can make it a named text anchor. Usually, Iām referring to entire short paragraphs, like headers, or to parts of paragraphs, like their numbers (when the Bullets and Numbering feature is used, a common scenario for figures or tables).
To create a text anchor, highlight the text to which you anticipate making a reference later. Go to the Cross-References panel menu and choose New Hyperlink Destinationā¦. For Type, choose Text Anchor. The Name is important, as it will be the text cited in the cross reference. When hidden characters are visible, the anchor will look like a colon. The TOC feature also has the option to create text anchors, so you may see some already.
A future cross reference doesnāt have to use a text anchor; it can cite an entire paragraph, a paragraph number if it exists (or both), or a partial paragraph up to some character you can specify (like a tab). By using the supplied building blocks when editing the referenceās format, you may also include a Chapter Number and a File Name, and you can even apply a character style to portions of the reference. You donāt have to build a lot of text anchors in your documents.
Building a Cross Reference
First, insert the text cursor where you want the reference inserted. If youāre to make reference to text in another document in a Book, make sure that document is open! Then you can use the Cross-References panel menu to choose Insert Cross-Reference⦠or use the Create New Cross- Reference button at the bottom of the panel. Youāll then be looking at the New Cross-Reference dialog box (Figure 7).

Figure 7
Choose what to Link To: a paragraph or text anchor. Then choose the Document that contains the referenceās destination. If youāre linking to a text anchor, you simply choose its name. If youāre linking to a paragraph, it can get a little trickier. On the left, choose the Paragraph Style that your destination is using. Yes, despite the search feature there, itās much easier if you know the style. Once the correct style is highlighted, a list of each occurrence in the destination document is presented on the right. If you highlight one of those occurrences and look where your cursor was blinking, youāll see a preview of the cross reference forming.
The formatting may not be what you want, yet. The built-in list in Format may be sufficient for most needs. If you simply want to cite the page number, choose that. You may choose Full Paragraph & Page Number or Text Anchor Name & Page Number. In the classroom, I often get asked the difference between Full Paragraph and Paragraph Text because few see any difference. There is no difference unless the paragraph uses automatic numbering. If it does, Full Paragraph includes the number and Paragraph Text does not.
Note that thereās a choice for Paragraph Number & Page Number. The example in the previous figure shows a caption that reads, āFigure 2. A bad day at Cornish College of the Arts!ā Everything leading up to the āAā (āFigure 2.ā and the em space) is part of the paragraph number as defined in the paragraph style for that caption. So Paragraph Number & Page Number would yield āFigure 2 on page 4.ā However, I based my custom format on Paragraph Text & Page Number. I chose that, then clicked the pencil icon to its right, opening the Cross-Reference Formats dialog box (and disabling the preview, sadly).
Since I was making a custom format, I added it by clicking the plus sign (+) at the lower left of the Cross-Reference Formats dialog box. I input a name that mimics the format Iām building so I can readily identify it. The Definition field is where we construct our format by a combination of typing and choosing from the Building Block () or Special Character () menus. Building blocks look like HTML or XML tags using ā<ā and ā>ā to form wildcards of sorts (Figure 8).

Figure 8
The above yields the paragraph number; a colon and space I simply typed; the paragraphās text in quotes; a space; and, in parentheses, the word āpage,ā a space, and the page number.
*Affiliate link disclosure: CreativePro will earn a commission on any purchases made through the Amazon links in this article, at no additional cost to you.
Commenting is easier and faster when you're logged in!
Recommended for you
InDesigner: Raphaƫl Freeman
Addison Lalier shows how one designer has mastered the complex layouts and types...
Peter Kahrel’s Long Document Scripts for InDesign
Find out what these amazing InDesign scripts can do for you!
How to Mirror a Layout
Flipping a whole layout from a left to a right hand page doesn't have to be a pa...
