Skip to main content
Participant
May 11, 2023
Answered

Replace "CO2" by a "2" in subscript

  • May 11, 2023
  • 1 reply
  • 3282 views

Hi everyone !
I have an InDesign document with more than 400 times "CO2". 
I absolutely need to replace all "CO2" by CO2 : the "2" has to be in subscript.
Is there a way to use the tool "Replace" with subscript ? 
Thanks

Correct answer Frans v.d. Geest

Use GREP!

Create a subscript character style, then create a Paragraph style that had that character style to be used with this GREP:

(?<=CO)2

 

Do you have NO2 and H2O as well? You can catch them all in one GREP:

([CN]O)\K2|(H)\K2(?=O)

1 reply

Frans v.d. Geest
Community Expert
Frans v.d. GeestCommunity ExpertCorrect answer
Community Expert
May 11, 2023

Use GREP!

Create a subscript character style, then create a Paragraph style that had that character style to be used with this GREP:

(?<=CO)2

 

Do you have NO2 and H2O as well? You can catch them all in one GREP:

([CN]O)\K2|(H)\K2(?=O)

Participant
February 8, 2024

How can this be solved so that the "2" is not shown as a subscript but as small capital?

Participating Frequently
August 22, 2024

When creating the character style, don't choose "position: subscript", but instead choose "Case: small caps". Both options can be found in the Character Styles Options menu, on the Basic Character Formats tab