Fan of creative technology, elearning, instructional design and a little geeky

InDesign: Introducing GREP Styles (3)

090_06_done

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!

090_01_newcharstyle

I’m naming my style Small Caps (OT). Hmmm wonder why?

090_02_newcharstyle

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.

090_03_newcharstyle

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

090_04_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.

090_04_arm_am

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.

090_05_ampm

Once we’ve made this change our third GREP style is completed.

090_06_done

Video Tutorial

 

Similar posts
  • Adobe InDesign and XML: A Reference Guide The following is a reference guide I have compiled over time for those of you who are looking at doing a little more with XML in InDesign (originally published Feb. 2011, last updated Feb 2018). If you have any extra information you’d like to see added to this guide, feel free to message me. Mapping XML tags to InDesign [...]
  • How to change the colour of bullet points in InDesig... A few weeks ago I recorded a short quick tip tutorial. InDesign’s Control panel, gives users a quick and easy way to format text as a bulleted list. Highlight the text, and click the Bulleted List button in the Paragraph Formatting Controls mode for the Control panel. This applies a universal bullet character as the [...]
  • Creating a pop-up window in a PDF with Adobe InDesig... In the following YouTube tutorial, we’ll create an interactive PDF from Adobe InDesign, in which we click on a button, which in turn opens up a simple pop-up window containing a close-box. When the close-box is clicked the pop-up window disappears [...]
  • InDesign: Facing pages with odd-numbered left pages Back in 2004 I wrote a tip for InDesign CS on how you could have the first page of your document be a left page AND have it start with page number 1. It’s hard to believe this is almost a decade ago… But a recent question on Facebook, made me think I should really [...]
  • Negative Lookbehind – GREP for Designers This is the fourth and final blog-posts in a series of posts on lookaheads and lookbehinds in GREP, written after speaking at the Perth InDesign User Group. My speaker notes are also available: What is GREP? (PDF download) (2.4Mb). In the previous three posts I briefly introduced GREP, and we took a look at Positive [...]

3 Comments

  1. September 10, 2011    

    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.

  2. August 17, 2011    

    @Dan pleasure 🙂

  3. Dan Dan
    August 9, 2011    

    Very cool Cari, thank you for putting this great series of tutorials together. Very easy to learn from.

Leave a Reply

Your email address will not be published. Required fields are marked *