Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In the last chapter, we looked at how to find text patterns using GREP in the Find/Change dialog box. You can even use Find/Change to apply a character style to whatever text you find, but that has a drawback. You have to manually run the Find/Change each time the text gets edited. InDesign CS4 has a solution, GREP styles. GREP styles let you apply a character styles to any text pattern and you can even do it as a part of a paragraph style. Let me show you how. I am going to place my cursor in this paragraph and zoom into 200% by pressing Command+2 on Mac, or Ctrl+2 on Windows and I can see that I have several numbers throughout this paragraph. I would like to apply the OpenType old style formatting just to those numbers, but I don't what to do it by hand. That would take forever. So instead I am going to use GREP styles. Up in the Control panel flyout menu, I will choose GREP styles. Once the GREP style dialog box is open, I will click the New GREP styles button to add my first style.
Now I can choose a character style from this pop up menu. I know it doesn't look like a pop up menu, but if I click on that word None, it turns into a pop up menu and now I can choose my character style. If you don't have one already created, you can go ahead and create New Character Style at the bottom. In this case, I am going to create one called old style numerals and the only thing it's going to do is apply the old style numeral formatting. So I will choose that from the Figure Style pop up menu here. So now my GREP styles is going to apply the old style numeral character style that I just created to some GREP formatting and in this case I happen to know that code /d+ as a default GREP code that appears whenever you make a GREP styles. That codes means all the digits, one or more digits in a row and in fact if we look at the text below the dialog box here in the background, we can see that those numbers changed to old style. That's because the Preview check box is turned on.
Let's see a before and after. I will turn Preview off, knows they are regular numbers, Preview on that's the old style numbers, so we can see that our GREP style is working. Let's click OK and I want to show you another little bit more complex GREP style. I want to scroll over here and I can see that I have text throughout my documents that inside brackets. I don't really want it to be inside brackets. What I really want is for that text to be in italics, but when I imported it, that's what the editor wrote. They typed in those brackets. Now I would like to get rid of those brackets and make that stuff Italic. Can I do that, sure, I can do it with GREP styles, but in this case I am not going to do it just to this one paragraph, I am going to change the paragraph style itself. So I will open up the Paragraph Style panel and I am going to edit the style, not of the numbering list but of Body, only because numbering list is actually based on body and I want this to apply to all the paragraph in my documents with Body, Paragraphs and numbering list. So I will edit Body by right clicking on it or Ctrl clicking with one button mouse, and I will click Edit "Body." Just move it over little bit so we can see what we are doing and then I am going to go right to the GREP style pane.
First thing I am going to do here is actually just recreate what I have done. I am going to apply the old style numerals character style to all numerals, one or more numbers in all my paragraphs that are assigned to body or anything based on body. The next thing I am going to do is create a new GREP style, which is going to apply Italic to that text inside the brackets. In this case, I will apply Italic Body Text, to text not to the digits so I will delete that, I just click on that code and that made it active, so I can delete it and I am going to apply to anything inside brackets.
Now I can't just type brackets, I happen to know. I have to type some special code to get those brackets. So this is what I am going to do. I will go to the little menu off on this side here, the one that has the @ sign in it and I will click on that and I will choose from the Symbols pop out menu, the Open Bracket Character. That shows me the code for a bracket is Slash+Bracket. Now I want any character, in other words, anything inside brackets, so I will go to the Wildcards and say give me Any Character at all and let's go ahead and Repeat that one or more times, shortest match and then a Closed Bracket again from the Symbol pop up menu. So this is going to apply the Italic Body Text character style to anything that looks like a bracket and then some text and then a closed bracket. I will click on this blank area in the bottom to make it apply and I will move the dialog box out of the way and we'll see if it worked.
Yup, there we go. My numbers got changed to old style and all of this text got changed to Italic. Now, for the last step. I want to get rid of those brackets. I could use a Find/Change to do search for a bracket and delete it, but again if I later had to edit the text and more brackets got in there, well, I would have to do the Find/Change over again. So let's use GREP styles. I am going to make a New GREP styles and in this case I am going to look for anything that's a bracket, either a closed bracket or an open bracket. You can do that by GREP by using this code. Bracket, I know this is going to be weird, but I want to type to the regular bracket symbol and then the code for looking for a bracket which is Slash+Bracket, and then the code for looking for the closed bracket, which is Slash+Closed Bracket, and then we want to type the Bracket again.
It's a very strange code. When you are working with GREP you get all kinds of weird combinations. So it's Bracket+Slash+ Open Bracket+Slash+Closed Bracket+Closed Bracket. That's the code we are looking for because that means search for either an Open or a Closed Bracket. And now what do I want to do when I find one of those two characters? I want it to go away. Now the GREP styles feature cannot change your text at all. It can only apply character styles, but here is a secret way to make text go away, or at least mostly they go away. You will see what I mean in a minute. I am going to create a new character style, so I will click on that little what they said None there and I am going to scroll down to New Character Style and I am going to make my new character style called hidden, you can call it anything you want really, but I am going to mine hidden and the style for this is going to be, the Horizontal Scale is going to be 1%, just 1%.
In other words, make it as thin as it can possibly be. It's almost zero. It takes the character and pushes it down to 1%. Then I am going to go to the Character Color and change its fill color to None. A character which has a horizontal width of 1% takes up almost no room on the page and if it's filled with none, you can't it at all. So it is in fact hidden. I will click OK, I will click off here and we can see if I move this out of the way that my brackets have disappeared. Everything that was inside a bracket is Italic and the brackets are now hidden.
Personally I think GREP styles is the coolest new feature in InDesign CS4. I am sure it's geeky, but wow, it's mighty powerful for formatting a document quickly.
Get unlimited access to all courses for just $25/month.Become a member
119 Video lessons · 49891 Viewers
117 Video lessons · 37181 Viewers
113 Video lessons · 81157 Viewers
65 Video lessons · 10481 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.