Using text variables
Video: Using text variablesAny time you can take advantage of automation in a long document workflow, you should do so. One of InDesign's built-in long document features, text variables, can allow you to easily create things like running headers, chapter numbers and so forth, and while they do have some significant limitations, they are a useful tool, so let's see how they work. In this document I want to create a running header on the top of each left-hand body text page that reflects the chapter title. So right here, this text, I want to appear over here, at the top of each left-hand body text page, and for that I'm going to use a text variable.
Viewers: in countries Watching now:
Creating Long Documents with InDesign shows designers how to create book-length documents in workflows with multiple users—using both InDesign features and third-party plug-ins. Publishing veteran Mike Rankin focuses on long document elements such as page and chapter numbering, table of contents, cross-references, and indexes. The course also provides an overview of document construction, from creating master pages and applying consistent formatting with styles to placing text and images and outputting to both print and interactive PDF.
- Using text variables
- Creating templates for InDesign, InCopy, and Word
- Employing nested styles
- Creating GREP styles
- Managing color with swatches
- Building page elements with libraries and snippets
- Performing GREP find/changes
- Using InCopy workflows
- Tracking changes
- Adding footnotes and indexes
- Using InDesign book files
- Versioning documents with conditional text or object styles
- Preflighting documents
- Archiving a project
- Finding and installing useful scripts and plug-ins for frequent challenges
Using text variables
Any time you can take advantage of automation in a long document workflow, you should do so. One of InDesign's built-in long document features, text variables, can allow you to easily create things like running headers, chapter numbers and so forth, and while they do have some significant limitations, they are a useful tool, so let's see how they work. In this document I want to create a running header on the top of each left-hand body text page that reflects the chapter title. So right here, this text, I want to appear over here, at the top of each left-hand body text page, and for that I'm going to use a text variable.
So I'll go to my Type menu and choose Text Variables > Define. And in the dialog box I see a list of all the different kind of text variables InDesign has, so chapter numbers, the date the file was created, the file name, the last page number of the file, the last time the file was modified, when it was output, and the running headers. So I'll click on New to create a new text variable, and I'll call it ChapterTitle. It's going to be a running header based on a paragraph style and that style is ChapterTitle, and I'm going to select First Use on Page and leave all the other options off and click OK.
I'll click Done and then click in my text frame. And now I do insert the variable, I go back to the Type menu and choose Text Variables > Insert Variable > ChapterTitle, and I'll zoom in so I can see it. And there I have it, I picked up all the text styled in that chapter title paragraph style, so Chapter 2 The Big Cheese. But what if I didn't want all the text that was styled in a paragraph style for my running header? Like what if I just wanted the words, The Big Cheese and I didn't want Chapter 2? Well, that is a case for a character style text variable.
So the first thing to do in this instance I'll zoom out and go back to that chapter opener page, where I have the text that I want to appear in my text variable, and I'll go to my Character Styles panel and create a new character style. I'll hold down Option or Alt and click on the New Style button, and this one I'll just call runningheader. And that's all I'm going to do in this dialog box. I don't want to turn on any kind of formatting options, because I don't want to change the look here. I just want a basically tag this text, so it can be used in a text variable.
So I'll click OK, and then select the text I want to appear in my running header, The Big Cheese, and apply the Character Style, runningheader. Now I can go down to the page where I want the runningheader to appear, I'll zoom in and I'll delete that old text variable I didn't want, and I'll create the new one. So I'll go back to Type > Text Variables > Define. I'll click on New and from the Type menu I'll pick Running Header (Character Style) for the Style I'll pick my new runningheader character style and click OK.
And now because I left my cursor in the text frame, I can click on Insert, and Done. And now I can see I just have the words The Big Cheese without Chapter 2 in them. So now that we've seen what we can do with text variables, it's time to talk a little bit about what you can't do with them. First of all you can't predefine formatting for your text variables; they just take on the formatting that was active at that spot in the text frame where they were inserted. Once in the text frame, You can select the text variable and then change the formatting up in the Control panel or the Paragraph Styles panel, but it's an all or nothing kind of formatting.
You can't get your cursor inside a text veritable to select just part of it, this is one the Achilles' heels of text variables. So, for example, if you're referencing the title of a book in a text variable, You can italicize that book title separately from the rest of the variable text, which is unfortunate. In addition to the limitations on formatting, there's another big problem with text variables, and that is variable text will never wrap or break across lines. So if I take my Selection tool and decrease the width of this text frame. You'll see the text variable start to accordion in on itself.
It just becomes compressed horizontally until it's completely unreadable, and it doesn't matter how tall I make the text frame, it's never going to wrap to another line. So what do you do in this instance? Well, one option is to convert the variable to regular text. So to do this you can select the text variable and go to the Type menu and choose Text Variables > Convert Variable to Text. Now it's just regular text and you can do anything you could do to normal text, whether you can select it and apply any other kind of formatting. So nested styles, character styles, GREP styles, anything goes here.
But in exchange for that flexibility, you've given up the dynamic nature of this variable, so it's not going to respond to changes in that source text. If the chapter title changes from The Big Cheese to something else, this running headers is not going to change anymore. So if you are going to convert text variables to regular text, make sure it's one of the last things you do in the workflow, so you don't end up regretting it later, if changes make your former text variables start showing the wrong stuff. If these limitations are causing you serious time-consuming or money-consuming problems, consider checking out a product called Power Headers that in-tools.com as an alternative.
Power Headers can create running headers that are live text with all the formatting options of normal text, and many options for choosing the source text. Let's take a quick look. So I've installed Power Headers here, and I have an InTools menu, and a Power Headers choice and I'll choose Define Header Variables, and click on New, just to look at the options I have. First of all I can combine character styles and paragraph styles from my source text, so I can just find specific uses of character styles within a paragraph style. I can define alternate styles as well, so I can have many styles contribute to my running header.
I can have a different source range, so not just a page, but a spread or specific column. For the Type, I have First Instance, Last Instance or every instance of a usage of a style, or many other options as well. And I can also Copy Local Formatting into my running header. So if I had nested styles or character styles applied, those can appear my running header as well. So Power Headers by In-Tools with lots of options for creating running headers that you can't do with a normal InDesign text variable.
So while InDesign's text variables aren't especially flexible, they do fill an essential need for a little bit of automation when it comes to creating things like running headers and footers.
There are currently no FAQs about Creating Long Documents with InDesign.