Nested Styles Tips in InDesign

January 25, 2006 - 1:00am ||| 2 Comments | Add new

Are you a fan of InDesign's Nested Styles? For the uninitiated, I'm referring to the ability to tell InDesign something like, "Hey, whenever I tell you to apply the Bullet paragraph style to some text, be a pal, wouldja, and apply the Character Style I made for the bullets too? Just to the first character in the paragraph. Thanks, man."

You set up these requests in the "Drop Caps and Nested Styles" panel (in ID CS or CS2) of the Paragraph Style Options dialog box. You only have to deal with four simple drop-down menus or fields per Nested Style. As long as you've already set up the Character Styles you want ID to apply, and can figure out a consistent pattern to their application ("first character," "up to the second sentence," "first three words," etc.), you can save yourself a lot of mousing around applying the same Character Style over and over throughout your text.

Here are a few Nested Styles tips I've picked up along the way to help you get more out of them.

Up To vs. Through
When you set up a Nested Style, you tell InDesign to apply the selected Character Style either "through" or "up to" a certain point (aka a "stop character" such as a space or em dash or tab). Through/Up To are the two choices available to you in a dropdown menu here, and you have to choose one for each Nested Style.

What's the difference? "Through" means, "apply this Character Style to the stop character, too;" while "up to" means, "Don't apply it to the stop character." A common example is that you're defining a Nested Style to help make the first few words in a paragraph bold (via a Character Style you created), and you want InDesign to stop applying that style when it encounters a colon. Do you want the colon bold, too? If so, choose "through." If you don't want the colon to be bold, choose "up to".

Apply After
You know what option's missing from the "up to/through" dropdown menu? I'd like to see one called "After." As it is, there's no obvious way to tell InDesign to start applying a Character Style *after* a certain point in a paragraph, leaving what came before it alone.

A little bit of logical thinking yields the answer. One of the choices always available in the Nested Styles panel's list of Character Styles is [None]. So make the first Nested Style apply the Character Style "[None]" through your stop character — guess in this case it should be called the "start" character — then make a second Nested Style apply the Character Style you want until the "real" stop character is encountered.

Example: In a travel guide's "speak like a native" section, each paragraph discusses a single foreign term. Somewhere *after* the term is first introduced, the author includes its phonetic pronounciation in parentheses, and asks that it appears in a different typeface and color. You'd like InDesign to automatically apply the "phonetic" Character Style you created to the correct string of text whenever you apply the "body text" Paragraph Style to the paragraphs in the section.

Here's what you do in the Nested Styles panel for your "body text" style:

1. Add a Nested Style that applies the Character Style [None] up to one opening parenthesis.

2. Add a second Nested Style that applies the Character Style "phonetic" through the first closing parenthesis.

Click OK and InDesign does your work for you. First, it applies the base Paragraph Style to the entire paragraph. Next, it starts from the beginning of the paragraph and applies the first Nested Style, [None], until it encounters the first opening parenthesis. Then it starts applying the second Nested Style, "phonetic," until it hits the first closing parenthesis. Job done. In other words, it doesn't apply the nested style to any other parenthetical comments in each paragraph.

Note the careful use of up to/through so that the Character Style is applied to the parentheses as well as the text within!

None is not None
After reading the previous tip, you might be wondering what a nested Character Style [None] does to text to which you've previously applied a different Character Style from the Character Style palette. Normally, if you selected that styled text in your layout and clicked [None] in the Character Style palette, it'd still look the same but it'd be unlinked from the Character Style you had applied. Does a nested [None] style unlink previously-applied Character Styles? Answer: Nope.

Text that you manually apply a Character Style to remains linked to that Character Style, even if the Paragraph Style it's linked to contains a Nested Style that has theoretically applied "[None]" to it. Interesting. And welcome! But to make this option clearer I think the nested style [None] should be renamed to Skip, or perhaps, Ignore.

Manual Trumps Nested
The "None is Not None" tip is just one instance proving a larger Nested Style rule: Any Character Style you apply manually is maintained, even if it conflicts with a Nested Character Style defined in the Paragraph Style to which that text is also linked. If text is not already linked to a Character Style, the Nested Style applies, if it is already linked, the Nested Style leaves it alone. This is why a nested [None] acts like a Skip.

It works after the fact, too. You can select text that has had a Character Style applied to it via a Nested Style and click on a different Character Style to override that one instance.

But it doesn't work with the [None] Character Style in the palette. Selecting nested styled-text and clicking on [None] does nothing (nor does the brute force Alt/Option-Shift-clicking the [None] style). You'll need to click an insertion point before the word and insert the End Nested Style Here special character from the Type menu. Doing so "turns off" the current Nested Style from that point on for the rest of the paragraph.

Or, you can create a Character Style that matches the basic formatting of the Paragraph Style. Call it something like "paragraph style reset" or "turn off nested". Then when you want to turn off a Nested Style for just a word or two, you could select the text and apply your handy dandy "turn it off for these words" Character Style manually. The nested style still works for the other text that matches the pattern.

One more time: Manual trumps Nested for any Character Style other than a manually-applied [None].

Don't Stop
I've already written up this tip in a previous issue, but it was long ago and it bears repeating.

Would you like InDesign to start applying a Character Style at some point in a paragraph, and then just keep on using it for the rest of the paragraph? In other words, you don't want to enter a Stop character?

Answer: Specify a Stop character that doesn't exist in the text flow, such as one of the more arcane ones from the stop character's dropdown list (Section Marker, anyone?), or enter a high number in the number field, like "999" colons or periods or something. (999 is the upper limit for the number field.)

Since InDesign never encounters the stop character — or the 999th one in a single paragraph — it keeps on applying that Character Style till the end of the paragraph.

Stop Here or Here
The editable field for a Nested Style's "stop" character is a Boolean OR. (This will be on the mid-term, people.)

That is, InDesign will stop applying the selected Character style when it encounters the first character entered there, like a colon. But if you click in the field and add a period, comma, semi-colon, and space, InDesign will use any of those — whichever it encounters first — to stop applying the Character Style.

This trick is ideal for situations like Bold Lead-ins … where in-line subheads sometimes end in a colon, sometimes in an em-dash, sometimes with a period, and so on. You could include all the possibilities in a single Nested Style.

Apply Again
Here's a tricky one. How do you get InDesign to apply the same Nested Style multiple times in a single paragraph, depending on the text string instead of a pattern? It's kind of like combining a Find/Change with Formatting but using variable characters.

Honestly, the only time I've been asked for this and come up with a Nested Styles answer has been for one particular situation, and for all I know it's not useful anywhere else in the Known Universe. But who knows, you might find yourself in a situation where a variation of this technique could mean the difference between making a deadline and blowing it.

The situation was this: A designer wanted to apply a Character Style called "web address" to all the URLs mentioned in a long story that threaded through a hundred pages … hundreds of paragraphs all styled with "body," hundreds more URLs within these paragraphs, none with a Character Style currently applied.

She couldn't use InDesign's Find/Change because while finding them wouldn't be a problem (they all started with "http://"), changing them would be … applying the Character Style via Change Format and clicking Change All would only apply it to the http:// part. She could've just limited herself to Find (and Find Next), tediously finding the beginning of a URL, dragging over the rest of it with her mouse, applying the Character Style, then pressing Find Next, and so on … but was looking for a way to do it quickly with Nested Styles.

The answer was to use Find/Change to embed a specific non-printing character that flagged the beginning of a URL, then set up a series of Nested Styles inside her "body" Paragraph Style to look for them.

After setting up Find/Change as follows, we Changed All:

Find: http
Change: [End Nested Style]http
Search: Story

(Note: Adding the Hidden Character for "End Nested Style" via the Change field's dropdown menu confuses the issue, I know. Normally, you insert this character manually via Type > Insert Special Character to stop a particular Nested Style from being applied to that one instance of text. But it's a convenient character to use as a marker because not only can it be specified as a stop/start character in Nested Styles, it doesn't add any white space, change any formatting, or appear in any printout. In cases where it doesn't work well, you can always use [Hair Space] instead, which adds a virtually undetectable amount of white space when used at body text size. Hey, I'd love it if Adobe added a few 0-width Hidden Characters just for flagging things, like Marker1, Marker2, and so on — but until they do, we'll work with what we've got.)

Now that all the URLs are preceded with a marker (the End Nested Style hidden character) — the operation took about 4 seconds — we can use that to our advantage with Nested Styles.

The designer said at most a paragraph would have three URLs, so we loaded the Paragraph Style "body" (already linked to the paragraphs containing the URLs) with enough Nested Styles to account for up to three instances:

1. Apply Character Style [None] up to 1 [End Nested Style]
2. [web address] up to 1 [space]
3. [None] up to 1 [End Nested Style]
4. [web address] up to 1 [space]
5. [None] up to 1 [End Nested Style]
6. [web address] up to 1 [space]

This did the trick. As soon as she clicked OK in the Paragraph Style Options dialog box, all the URLs in her 100-page document were formatted with her Character Style.

It worked because if a paragraph had no URLs, InDesign never encountered an End Nested Style marker and thus applied the first Nested Style [None] to the end of the paragraph, which as you know is the same as "Skip." If a paragraph had only one or two URLs, InDesign wouldn't find another End Nested Style character after the first one, and so would continue applying the [None] Character Style to the remaining text. If a URL wasn't immediately followed by a space, the "web address" style was applied to the trailing punctuation (a period, a comma, whatever) and then stopped at the space following the punctuation. This was fine with the designer.

I'm not sure where else this technique could be used — it'd have to be in cases where the text string doesn't contain any spaces (such as a URL) and where each text string begins with the same unique pattern (to embed the marker in Find/Change).

But … if it ever comes up, now you know. ;-)

Comments (Subscribe to Comments RSS)

1 June 5, 2011 - 5:16pm by Magda (not verified):

So nested styles only apply to Characters Styles and not Paragraphs Styles? I guess you have to use GREPS for nested paragraph styles, huh?

2 October 19, 2011 - 9:43am by Effie (not verified):

to my understanding, in order to use nested style or grep syle you must have a character style established before. you can create new character style within nested style pull down menu. Charecter styles embed in paragraph styles (in Nested or Grep style). then you can also take these paragraphs and can embed in Object style.
check this very good video tutorial about nested styles.…

Post new comment

The content of this field is kept private and will not be shown publicly.
By submitting this form, you accept the Mollom privacy policy.