Skip to main content
Participant
July 14, 2022
Answered

Problem with nested styles

  • July 14, 2022
  • 1 reply
  • 104 views

I have a paragraph style with a nested style:

initletter through 1 letter

smallcap through 3 words

initletter sets the first letter larger then the rest of the line along with font and color while smallcap is a charater style that sets font, size, and color. 

This works on the first letter and first three words unless the first word is the word I.  In that case the styles format 4 words not 3. 

I suspect that when the paragraph begins with I, then initletter formats the I,  but looses the fact that it's formated one word and then the next style does three more.

How do I construct styles that will give me only three words like:

I wrote this style today. or He wrote this style today.

 

instead of:

I wrote this style today. or He wrote this style today.

 

This topic has been closed for replies.
Correct answer Barb Binder

That's how nested styles work. Use a GREP style instead:

 

Apply style: 3 Words
To Text: ^([a-zA-Z]+\s){3}

Apply style: Drop Cap
To Text: ^[\u]

 

~Barb

 

 

NOTE: I edited my original answer. It occurred to me this morning that what I wrote would not only assign a drop cap to every capital letter, it would also apply the 3 Word style to every group of three words. I added a ^ to the beginning of both lines to indicate this should only happen at the beginning of a paragraph and not in the middle. 

1 reply

Barb Binder
Community Expert
Barb BinderCommunity ExpertCorrect answer
Community Expert
July 14, 2022

That's how nested styles work. Use a GREP style instead:

 

Apply style: 3 Words
To Text: ^([a-zA-Z]+\s){3}

Apply style: Drop Cap
To Text: ^[\u]

 

~Barb

 

 

NOTE: I edited my original answer. It occurred to me this morning that what I wrote would not only assign a drop cap to every capital letter, it would also apply the 3 Word style to every group of three words. I added a ^ to the beginning of both lines to indicate this should only happen at the beginning of a paragraph and not in the middle. 

~Barb at Rocky Mountain Training