Skip to main content
Known Participant
March 22, 2024
Question

Underline Molecular formulae of Chemistry like H2SO4, H2O which subscript

  • March 22, 2024
  • 2 replies
  • 953 views

Underline Molecular formulae of Chemistry like H2SO4, H2O which subscript

This topic has been closed for replies.

2 replies

Peter Spier
Community Expert
Community Expert
March 26, 2024

Perhaps I'm not understanding what you want to do, but it seems to me as if you want to underline formulas EXCEPT the subscript characters.

If that's the case, I think a GREP style added to the paragraph style , as suggested by Robert, should do it. Since, as I recall, subscripts would only be digits and would follow only capital letters, you could look for (?<=\u)\d+ and set the style to turn off underline.

Peter Spier
Community Expert
Community Expert
March 26, 2024

You might actually need two GREP styles, depending on how you are applying the underline to start with.

First style \u+\d* should find sequences of capital letters mixed with digits and can be used to apply the underline and then the second grep, as above, to remove from the digits.

Peter Spier
Community Expert
Community Expert
March 26, 2024

and as a further thought, the same expression used to remove the underline can be used to make the digits subscript...

Anantha Prabu G
Legend
March 22, 2024

@suryakant256115023evw 

Find: (?<=[A-Z]|[a-z])\d{1,2}
Change: Apply subscript
Design smarter, faster, and bolder with InDesign scripting.
Known Participant
March 26, 2024

Thanks for reply.

OK. In Grep I have to find and change.   I thought there may be easy way which I don't know. 

Currently I am anchoring rule.

If Adobe add one button in underline options. If tick will give plane underline  if untick usual.

Thanks

Suryakant

Robert at ID-Tasker
Legend
March 26, 2024
quote

Thanks for reply.

OK. In Grep I have to find and change.   I thought there may be easy way which I don't know. 

Currently I am anchoring rule.

If Adobe add one button in underline options. If tick will give plane underline  if untick usual.

Thanks

Suryakant


By @suryakant256115023evw

 

You can set is as a GREP rule in ParaStyle.