Members Only

GREP of the Month: Superscripting Suffixes

Automatically convert all your numerical suffixes to superscript when applying a paragraph style.

Sometimes you want to automate certain repetitive tasks, like changing numerical suffixes to superscript. Luckily, there’s a great GREP style you can use for this.

First you need to create a new character style that uses the superscript setting. Then take the paragraph style that’s applied to your text, and add a new GREP style. Type in the code (?<=\d)(st|nd|rd|th) to accomplish your goal.

Here’s the explanation: (st|nd|rd|th) looks for any of the sets of letters within the parentheses that will act as a suffix, for example “st” for 1st, “nd” for 2nd,” and so forth. The vertical bars in the expression mean “or.” Of course you don’t want to superscript any pair of letters, just the ones that are preceded by a number. That’s why we add the \d at the beginning of the expression. But to avoid applying the superscript to the actual number, we put it within a “Positive Lookbehind” string (available from the”@” flyout menu), giving you the (?<=\d) result.

This means that the presence of a number before any of our letter pairs is the condition upon which the superscript should be applied. Adding this ensures that numbers themselves will be left alone—only the letter pairs will receive the superscript styling.

And remember that this is all applied live, meaning that InDesign will automatically apply your superscript to the correct letter pairs even while you’re adding, changing, or removing text.

Bookmark
Please login to bookmark Close

Not a member yet?

Get unlimited access to articles and member-only resources with a CreativePro membership.

Become a Member

Comments (1)

Leave a Reply

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

Loading comments...