From the course: InDesign Secrets

322 Change character style for text inside parentheses - InDesign Tutorial

From the course: InDesign Secrets

322 Change character style for text inside parentheses

- [Instructor] I'd like to change the styling for all the text that is inside parentheses or brackets inside these paragraphs, like this figure reference here and this one down here. Now of course I could just select the text and change the formatting, but I'd like something a little bit more automated. So I'm going to use GREP styles. It sounds scary, but it's really easy if you just follow along. Now before I make the GREP style, I need to have a character style that applies all the formatting I want. And you can see that I've saved one here inside my character styles panel. It's called figure reference. This character style changes the font and the color of the text. Okay, so now I'm going to edit my paragraph style to apply that character style to just the text inside the brackets. I'll open my paragraph styles panel, and then I'm going to edit my body paragraph style. I'll do that by right-clicking with my mouse, right-click on body, and then choose edit body. Here inside my paragraph style options dialog box, I'm going to choose GREP style. And you can see that currently I don't have any GREP styles listed. So I'll come down here and click new GREP style. That adds my first one. So I'm going to make this rule, this GREP style apply the character style that I made. So I'll choose that up here by clicking on apply style and then choosing the character style that I already made. Now I need to write a little bit of GREP code. And I admit the codes are a little bit weird, but it's nothing that you can't do. Just follow along. Okay, the main question you need to ask right now is when you're applying the style, do you want to also include the parentheses? If you do, then it's a pretty easy code. You simply come in here, click on this code here. I'll delete that 'cause I want to replace it, and then I'll type backslash, open parentheses, and then a dot or period plus question mark. Finally, backslash close parentheses. The backslashes mean look for a real open and closed parenthesis character. The dot plus question mark means basically find everything, all the text in between those parentheses. Now to finish, I'll simply click in this blank area out here. That applies the GREP style. Now because the preview checkbox is turned on, you'll see that it worked. All the text inside the parentheses and the parentheses themselves have been styled with my character style. So okay, what if I now decide I want to format the text but not the parentheses? I can do that. The code just gets a tiny bit more complicated, but it's not too bad. First I'm going to come up here and delete the code that I had typed. Now I need to add some codes that I honestly can never remember. So I'm going to ask InDesign to type them for me. To do that, I'll click on this little at symbol, and I'll scroll down and choose from the match sub-menu. Here I'm going to choose positive look behind. Did you see that? InDesign typed those codes for me. Now I need to place my cursor in between the equal symbol and that closed parentheses. And I'm going to type backslash open parenthesis just like I did earlier. That means look for an open parenthesis but don't format it. Now I'm going to place my cursor to the right outside that code, and I'm going to type the dot plus question mark just like I did before. That finds all the text, right? And now to finish I'm going to go back to that match sub-menu, but this time I'm going to choose a positive look ahead. Then right after that equal symbol, I'm going to type backslash, close parentheses. So that's it. That crazy-looking code looks for all the text inside parentheses but not including the parentheses. So when I click out here, you can see that it worked. The preview checkbox is turned on so I see that all the text inside the parentheses has been formatted but not the parentheses themselves. Looks good, so I'll come over here and click okay. GREP styles are incredibly powerful for automating your text styles. You can do it. You just need to take these codes one step at a time.

Contents