Learn it fast with expert-taught software and skills training at lynda.com. See what you can learn

By David Blatner | Thursday, April 04, 2013

InDesign Secrets: Formatting prices with nested and GREP styles

No one likes formatting prices, but in this week’s free InDesign Secrets video, Adobe InDesign guru David Blatner shows you how to add custom dollar signs and superscripts for your cents with one single paragraph style. The magic lies with nested styles and GREP styles. Let David show you how these work.

First you need to create separate character styles for each pricing element: one for the dollar sign, one for the cents, and one for the decimal.

To hide the decimal, David suggests creating a character style that changes the font size to 1 pt and change the Character Color to None. David named this style “disappear.”

  1. The trick is to embed these character styles in a paragraph style. First, select the price you would like to format and choose New Paragraph Style from the Paragraph Styles panel. Go to the General pane and choose Apply Style to Selection.
  2. Go to the Drop Caps and Nested Styles pane. Click New Nested Style. Select your dollar symbol style and apply it through the first character. It is important to change the default Words to Characters in this menu.

  1. Click New Nested Style again and choose [None] up to 1 and replace the default Words with a period by actually typing the character (.) in the menu.
  2. Click New Nested Style a third time and apply your disappear style through 1 Characters.

  3. Finally, choose your cents style through 2 Characters.

  4. Click the Preview check box to see the immediate results and click OK to create your new paragraph style.

Now this method only works when your price is in its own paragraph, not inline with other text. To format a price in running text, you need to use a GREP style. This technique still requires the 3 separate character styles for the dollar sign, decimal, and cents.

  1. Once again, choose New Paragraph Style from the Paragraph Styles panel. Go to the GREP Style pane. Click New GREP Style.
  2. Choose your dollar symbol style from the Apply Style menu and type \$ in the To Text field.

The dollar sign is a reserved character in GREP and the backslash tells it to treat it as a normal character, not a special code.

  1. Click New GREP Style again. Choose your cents style from the Apply Style menu and type \d\d in the To Text field. This tells InDesign to look for two digits in a row. But we want to make sure these numbers are preceded by a period.
  2. Click the @ button and choose Match > Positive Lookbehind from the flyout menu. This inserts the GREP code (?<=).

  3. Between the equal sign and closing parenthesis, type . to ask InDesign to look for a literal decimal character behind our two digits.

  4. Now to make that decimal disappear! Click New GREP Style, choose your disappear style, and type . in the To Text field. Next, click the @ button and choose Match Positive Lookahead from the flyout menu to insert the code (?=). Lastly, before the closing parenthesis, type \d\d.

  1. Click OK to create your new GREP style. The style will be accessible from the normal Paragraph Styles menu and you can apply it to any text that might contain an inline price.

Both nested styles and GREP styles are great for boosting your efficiency in InDesign. They can seem intimidating at first, but they’re well worth investing some time in—it will quickly pay off. To learn more about GREP styles, check out David’s course called InDesign: 10 Things to Know About GREP.

And for more InDesign insider tips, join Anne-Marie Concepción in a member-exclusive video called Checking out the Gridify tricks.

The InDesign Secrets dynamic duo will be back in two weeks with more tips.

Interested in more?

• The entire InDesign Secrets biweekly series • Courses by David Blatner and Anne-Marie Concepción on lynda.com • All lynda.com InDesign courses • Start a free trial membership at lynda.com

Learn it from the experts.

With online video courses at lynda.com, you can reach your goals faster. Learn software, improve your skills, and get an inside look at how the professionals work.

See what you can learn


Share this article:

Tags: , , , ,

Get the latest news

  •   New course releases
  •   Pro tips and tricks
  •   News and updates
  
New releases submit clicked

You can change your email preferences at any time. We will never sell your email. More info

Featured articles

A lynda.com membership includes:

Unlimited access to thousands of courses in our library
Certificates of completion
New courses added every week (almost every day!)
Course history to track your progress
Downloadable practice files
Playlists and bookmarks to organize your learning
Become a member

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.