Copy Just Part of a Chapter Title to a Header
Here’s a fun challenge: I have a chapter title here that has some extra text in it—in this case, an em dash on either side of the text.

I want to put that chapter title in the headers in my chapter, but I don’t want those dashes. Similarly, I want to the put the author’s name in the header, but I don’t want the word “by” or the person’s degree or title… just the name.
Normally the way you put text like this in a running head or footer is to use a text variable, which you can find by choosing Type > Text Variables > Define:

And then you create a Running Head variable that is based on the paragraph style of the Chapter Title, and another one based on the paragraph style for the Author:

But this won’t work in this situation because it picks up all the text from the paragraph style, including the em dashes and the “by” and so on. So we need a trick.
(By the way, this excellent question was first posed by Ginger Marks on our InDesignSecrets Facebook group, and key insights were made by Peter Goodman, Brett Stone, and Keith Snyder. A big thank you to them!)
OK, so instead of making the text variable based on the paragraph style, you need to make it based on a character style. But then you need to apply the character style to the correct text, which can be annoying if you do it manually for a lot of chapters. So tell InDesign to do it automatically!
First, let’s make two character styles that do nothing… they don’t apply formatting at all. One is going to be for the text in the chapter title, and the other will be for the author.

Next, in your chapter title style, add a nested style that applies None to the text before the real chapter title — in this case, “through the em dash.”

(If you don’t know this trick, you should: Normally, the nested style is “through 1 word.” But you can replace the word “Word” with any character you want! Here I just typed an em dash, which is Command-Option-dash or Ctrl-Alt-dash.)
OK, now we want to add a new nested style that applies a character style to the text, so we’re going to say “up to” another em dash:

That’s it! Now save that and edit the Author paragraph style to have a similar set of nested styles:

See how that applies the character style to just the author name?
Now that we have character styles applied to the stuff we want to capture, we can return to the Define Text Variables dialog box and make two new variables. But in this case, we’re going to make them based on character styles instead:

Finally, we can insert those text variables (using Type > Text Variables > Insert Variables) into text frames on our master page:

And the result is perfect:

Now, when this is applied in every chapter, the running heads will update automatically as the chapter title and the author names change—ignoring the extra characters we don’t need!
This article was last modified on July 7, 2021
This article was first published on January 30, 2019
