• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Underline Molecular formulae of Chemistry like H2SO4, H2O which subscript

Community Beginner ,
Mar 21, 2024 Mar 21, 2024

Copy link to clipboard

Copied

Underline Molecular formulae of Chemistry like H2SO4, H2O which subscript

TOPICS
How to

Views

447

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 21, 2024 Mar 21, 2024

Copy link to clipboard

Copied

@suryakant256115023evw 

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 26, 2024 Mar 26, 2024

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2024 Mar 26, 2024

Copy link to clipboard

Copied

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. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2024 Mar 26, 2024

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2024 Mar 26, 2024

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2024 Mar 26, 2024

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

suryakant256115023evw_0-1711698914825.png

If I have to underline this,  I thought there could be simple solution, which I may not know.

Presently I am Anchoring rule below it.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

@suryakant256115023evw 

Find:

\b((Ac|Ag|Al|Am|Ar|As|At|Au|B|Ba|Be|Bh|Bi|Bk|Br|C|Ca|Cd|Ce|Cf|Cl|Cm|Co|Cr|Cs|Cu|Ds|Db|Dy|Er|Es|Eu|F|Fe|Fm|Fr|Ga|Gd|Ge|H|He|Hf|Hg|Ho|Hs|I|In|Ir|K|Kr|La|Li|Lr|Lu|Md|Mg|Mn|Mo|Mt|N|Na|Nb|Nd|Ne|Ni|No|Np|O|Os|P|Pa|Pb|Pd|Pm|Po|Pr|Pt|Pu|Ra|Rb|Re|Rf|Rg|Rh|Rn|Ru|S|Sb|Sc|Se|Sg|Si|Sm|Sn|Sr|Ta|Tb|Tc|Te|Th|Ti|Tl|Tm|U|V|W|Xe|Y|Yb|Zn|Zr)\d*)+\b

ChangeTo: apply underline character style. 
Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

Thanks for immediate reply.

Nice solution.  But I am comfortable with Anchoring rule.

Thanks again

Suryakant

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

LATEST

That first expression, as it turns out on furhter testing, also finds some uppercase letters that you don't want to underline, like the first character at the start of a sentence or a proper name, and at the moment I'm at a loss for how to fix that.

I'd also forgotten about the two-character symbols which renders the other expression useless. Sorry.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines