Thanks for coming to, the world's #1 resource for all things InDesign!

Building a “Conditional Text” Document

Andy wrote:

We have a long document with numerous paragraphs. We would like to select certain paragraphs (every 3rd one for example) and use these to automatically produce another document, so that later, when the large document changes, the smaller document changes, too.

Well, InDesign isn’t really set up to do this, but here is one workaround that may help anyone who is trying to build subsets of longer documents based on some condition. For example, let’s you imported a document with three types of paragraphs: questions, answers, and notes. You want to build a document that is just for questions, another for answers, a third for notes. One way to do this is to copy-and-paste like mad. Another way is to use InDesign’s table of contents feature.

Most people mistake table of contents feature (under the Layout menu) as something for building a table of contents. Well, I suppose you could use it for that, but there are so many other cool uses for it! For example, conditional text. In this case, we want to create a “condition” called “Questions” that will display only the paragraphs with that paragraph style.

First, put the whole long story in a frame on some layer and hide that layer (no need to see the whole story anymore). It’s okay if the story is too long to fit in a single frame; just leave it overset.

Next, open Layout > Table of Contents and set it up to capture just the paragraphs you’re interested in. Here, I’m grabbing all the Questions:

Note that I’ve selected “Include Text on Hidden Layers” because I want to grab text from that long story. I’ve also set the Page Number pop-up menu to No Page Number, and the Entry Style is set to Same Style, which means the final paragraph will look just like the original. (If you don’t see some of these controls, be sure to click the More Options button.)

When I click OK, InDesign asks if I want to include text in overset frames. Yes, of course. Et voila, InDesign grabs all those paragraphs and loads them into the text cursor (or places them into the current frame).

Some older versions of InDesign could only grab the first 256 characters of the paragraph, but I believe that changed in CS2 and CS3, which grabs the whole enchilada.

Later, when we want to create the “Notes” document, we just have to repeat the steps, but specify the Notes paragraph style in the Table of Contents dialog box (and possibly deselect Replace Existing Table of Contents, depending on whether you want the first one anymore). Even better, click the Save Style button first, so you can save a Questions style, an Answers style, and a Notes style. Then you can pull them up quickly to switch from one “condition” to the next.

Even better, if the original story (in that text frame on the hidden layer) changes, you can always just put the text cursor in the “table of contents” frame and choose Layout > Update Table of Contents to “sync” it.

Unfortunately, if you’re looking for character-level conditions (like the conditional text some folks lust after in FrameMaker), this trick won’t help. But it’s a step in the right direction, eh? Moral of the story: Don’t let the name of a feature convince you that that’s all it’s good for.

David Blatner

David Blatner

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at are among the most watched InDesign training in the world. You can find more about David at
David Blatner

Latest posts by David Blatner (see all)

  • - November 30, -0001
Related Articles

8 Comments on “Building a “Conditional Text” Document

  1. If you want the “TOC’s” as a separate doc you can create a book containing 2 docs: the original and the “TOC” doc.
    This will save you the hidden layer and the overset. (but you’ll have to select the “Include Book Documents”in the TOC dialog box)

  2. If you plan on using the same design and layout, you can also use Martinho De Gloria’s “Layout Zone” script (previously mentioned on the show), to export a section of the design as it’s own InDesign file.

    It’s then a simple act of placing the InDesign file of the section into the various documents. You can then make changes to the section, save, and update links in the design files.

    limited to identical layouts, but still an option.

  3. Some older versions of InDesign could only grab the first 256 characters of the paragraph, but I believe that changed in CS2 and CS3, which grabs the whole enchilada.

    Unfortunately, that is not true with CS2. I remember creating TOC that included lead paragraph (for series of articles) and CS2 was cutting them after 256th character… I don’t know about CS3, because I have created homebrew script that prepared TOC the way I liked it and still use it, instead of ID TOC feature.

  4. The “Level” spec under Style is a mystery to me. Other than indenting the list of “Include paragraph styles” I don’t see it’s function?

    Also when two Paragraph Styles are included the order to which they flow into the TOC is determinded by the page geometry. Not the order that the style is listed in the “Include Paragraph Style:”

    And if you inbed a graphic frame into the paragraph the graphic flows into the TOC.

  5. Tim if your images are being included in the list for the TOC and you don’t want them to then create a new style that isn’t in the TOC and apply it to the image by doing a GREP search for


    And apply a the new paragraph style.

    *You could base this style on the body text style, or whatever you want.

    **Note though that ~a will find ANY anchored object, so it would be wise to be careful doing this.

  6. Thanks Harbs that helps my understanding of “Level”.

    Thanks Eugene on the ~a wild card to find anchored objects.

    I still have issue with the order in which the content flows into the TOC list. Say we have 2 different text frames with 2 different paragraph styles applied on the same page. It is not the order in the “include Paragraph Styles:” but the order is determined by the page geometry of the text frame. Upper left is first.

    Wouldn’t the logical way to order the discreet content be in the “Include Paragraph Styles:” list?

  7. this was one of my absolute favorite things in Framemaker. I was even able to use conditional text as the justification for purchasing it. Now, I haven’t used Framemaker in 12 years, but doing 1200 pages of training materials and being able to keep instructor guides and participant guides in the same file saved me *SO* much time.

Leave a Reply

Your email address will not be published. Required fields are marked *