Skip to main content
Participant
December 27, 2024
Answered

Need phrase/word/characters - mm2 - where the 2 always needs to be superscript

  • December 27, 2024
  • 4 replies
  • 799 views

This unit of measure is copy/pasted from another doc - mm2. The 2 always needs to be superscript. I have tried looking up grep styles but haven't found a way to make it so that the 2 is superscript.

 

Basically, need to do a find/replace for all mm2 and make it be mm2 (superscripted 2)

 

Is this possible?

This topic has been closed for replies.
Correct answer Barb Binder

Hi @amandaj97527555:

 

I'm wondering if you are new to GREP styles and/or styles in general? You were asking for a find and change query, but the GREP style suggested by @jmlevy is the better solution.

 

Here are the steps:

  1. Create a Character style for superscript
  2. Create a Paragraph style for the paragraphs that will contain the mm2 and format as usual
  3. Edit the Paragraph style > GREP Styles
  4. Click Add GREP Style
  5. Apply the the superscript character style to (?<=mm)2. (See notes below.)

 

InDesign will then locate each occurrence of mm2 and apply superscript to the 2. An advantage of a GREP style is that if you ever type in mm2 and assign that paragraph style, InDesign will see it and assign the GREP style to the 2 automatically. 

 

 

Note 1:  I added a second m to @jmlevy's expression just in case you have a single m followed by a 2 that should not be superscript. If that's never going to happen, then you can just leave it the way he showed you.

Note 2: @Eugene Tyson's solution will work equally well, and has the bonus of being a few less characters: just substitute mm\K2 for (?<=mm)2.

 

~Barb

4 replies

Barb Binder
Community Expert
Barb BinderCommunity ExpertCorrect answer
Community Expert
December 28, 2024

Hi @amandaj97527555:

 

I'm wondering if you are new to GREP styles and/or styles in general? You were asking for a find and change query, but the GREP style suggested by @jmlevy is the better solution.

 

Here are the steps:

  1. Create a Character style for superscript
  2. Create a Paragraph style for the paragraphs that will contain the mm2 and format as usual
  3. Edit the Paragraph style > GREP Styles
  4. Click Add GREP Style
  5. Apply the the superscript character style to (?<=mm)2. (See notes below.)

 

InDesign will then locate each occurrence of mm2 and apply superscript to the 2. An advantage of a GREP style is that if you ever type in mm2 and assign that paragraph style, InDesign will see it and assign the GREP style to the 2 automatically. 

 

 

Note 1:  I added a second m to @jmlevy's expression just in case you have a single m followed by a 2 that should not be superscript. If that's never going to happen, then you can just leave it the way he showed you.

Note 2: @Eugene Tyson's solution will work equally well, and has the bonus of being a few less characters: just substitute mm\K2 for (?<=mm)2.

 

~Barb

~Barb at Rocky Mountain Training
Participant
December 30, 2024

Hi Barb - you guessed correctly - I am new to GREP. I was afraid it was more of a find/replace because I didn't know if they used paragraph styles, but luckily it looks like they did and it's working!!! Thank you so much!!!

Barb Binder
Community Expert
Community Expert
December 31, 2024

We are always happy to help, Amanda. Come back and see us next time you get stuck. 

 

~Barb

~Barb at Rocky Mountain Training
Community Expert
December 28, 2024

Should be working 

Another GREP you could try is 

 

mm\K2 

 

 

Willi Adelberger
Community Expert
Community Expert
December 28, 2024

No scrpt needed use a GREP Style. 

  1. Create a character style for the 2 superscrpt
  2. Create in your basic style the GREP style: lokk behind mm (you can extend it for m, cm, dm and other length units) for 2 (and extend it for 3)

 

Any paragraph style based on this one will inherit it. 

I do not understand, why many want tongetba script for inbuilt functions. 

jmlevy
Community Expert
Community Expert
December 28, 2024

Hi @Willi Adelberger 

No scrpt needed use a GREP Style. 

Nobody has mentioned any script.

jmlevy
Community Expert
Community Expert
December 27, 2024

Use this GREP expression to apply a superscript character style.

 

Participant
December 27, 2024

I believe I copied this scenario, but it superscripted the entire phrase/word. 

Robert at ID-Tasker
Legend
December 28, 2024
quote

I believe I copied this scenario, but it superscripted the entire phrase/word. 


By @amandaj97527555

 

Would be best if you post a similar screenshot - of what you've copied.