This is the third in a series of tutorials about InDesign’s GREP styles.
Part 1: Automatically apply a character style to all text between parentheses
Part 2: Change the appearance of numbers (figures) within a given paragraph style
Part 4: Formatting price tags containing dollars and cents with multiple character styles
In this third tutorial we look at how we can convert text typed in Capital Letters to Small Caps.
We’re jumping straight into the Paragraph Style and GREP style this time around (see the previous tips (1) and (2) for different approaches)
Right click the paragraph style in the Paragraph Styles panel to edit it and in the Paragraph Style Options click GREP Style.
Then Click New GREP Style, this adds a third GREP Style to our “Body Text” paragraph style.
At the bottom of the Apply Style pop-up I can still choose New Character Style. Yay! That’s very cool. Thank you Adobe!
I’m naming my style Small Caps (OT). Hmmm wonder why?
Changing Cases
So someone typed in A.M and P.M. through this James Cook Voyages diary manuscript whilst holding down the Shift-key on the keyboard. Normally that would require a painful Find/Change that changes them to lowercase first, before we can change them back to small caps, as presently no “Upper Case” style has been recorded.
However since I’m using an Open Type font for my Body Text, I can prevent myself from having to jump through all sorts of hoops – Type > Change Case, being another one of them – to get this looking right.
One of OpenType’s extended features is that of having the ability to set true small caps characters to text, regardless of the current formatting.
John D. Berry talks about extended features including the OpenType small caps feature back in October 2006, in an article he wrote for Creative Pro.Com. It’s worth a read.
Let’s click Basic Character Formats and look at the Case menu.
There it is the Open Type All Small Caps. Let’s choose this and click OK to define our newly created Character Style for our GREP style.
So that’s it our Character Style has been defined. Let’s get to the GREP Expression.
GREP Expression
Basically there are only two occurrences of text that I want to change in Cook’s journal. The words “A.M.” and “P.M.”. So what I’m looking at setting is that either A.M. OR P.M. when encountered must be formatted using our Character Style.
OR, means that either A.M or P.M. can appear in the paragraph. There is no need for both of them to be inserted as text in the paragraph.
To set the expression, let’s start by entering A.M. as literal text for the To Text (I’m making a mistake here on purpose, we’ll fix that in a little while).
Match
So what is it we are trying to match with our GREP style… Oooh yes, A.M. or P.M.
Now as to the OR…
From Special Characters for Search choose Match > Or
Next let’s set P.M. And ensure you click the Preview box in the Paragraph Style Options dialog to see the effects of the current settings.
It looks kind-off OK… but no it’s not.
Remember back in the first GREP tutorial, I mentioned that certain characters are reserved by GREP for other things. We actually used one of them in our very first GREP the “.” (fullstop), and it meant “Any Character”. Now that we are looking closer, you might notice that not only the word “A.M.” is set to small caps, but the word ARM as well.
The solution is that we need to change this “.” “Any Character” into a literal character… and that’s done by escaping it with the “\” (Backslash) character. We’ll need to make this change manually.
Once we’ve made this change our third GREP style is completed.
Video Tutorial
Thanks Cari! I was having a hard time creating the proper string for my RegEx. In my case, the a.m. p.m. was in lower case but that was an easy adaptation. Your tutorial got it working for me.
@Dan pleasure 🙂
Very cool Cari, thank you for putting this great series of tutorials together. Very easy to learn from.