Copy link to clipboard
Copied
Hi everyone,
I'm designing a Chemistry coursebook, and dealing with a lot of chemical compounds, anions, cations etc. All of them use subscripts and superscrips - for an amount of elements - O2, Na2, Ca(OH)2, H2SO4 - or cations/anions - ClO4-,Ca+2, Li+.
So far, I've been using GREPs to put all digits as subscripts:
(?<=\l|\u)(\d{1,3}), (?<=\))(\d{1,3}) and (?<=\l|\u)(+|2+|3+|4+|-|2-|3-).
But that's not enough when I insert an advanced anions, eg. NH4+, AsO43-, PO43-, SO42-. In these examples, digits become subscripts and minuses and pluses stay on a standard level:
I'd like to prepare one, or few, GREP styles to automate the process. There's a list of most popular anions and cations: http://myweb.astate.edu/mdraganj/cationanion.html, is it better to make a one specific GREP, list all of them as 'exceptions' to the rules? Or is there another way to do it?
Thank you for your time and for a help 🙂
Unfortunately, you cannot solve this with GREP in all cases.
This is possible, for example:
But there is no general GREP that can differentiate between these cases, for example!
NH4+
Ca2+
Sorry.
Finally:
Maybe it is possible if you can rewrite your chemical compounds.
Then you set the "1" without fill color with font size 0.1pt and you can identify and edit these cases.
Copy link to clipboard
Copied
Sorry, the link might not work. Here's a complete list with a proper format:
Copy link to clipboard
Copied
Unfortunately, you cannot solve this with GREP in all cases.
This is possible, for example:
But there is no general GREP that can differentiate between these cases, for example!
NH4+
Ca2+
Sorry.
Finally:
Maybe it is possible if you can rewrite your chemical compounds.
Then you set the "1" without fill color with font size 0.1pt and you can identify and edit these cases.
Copy link to clipboard
Copied
Of course, you can play your game with Grep styles! …
But here you will have to think first as a chemist and surely not as a grepper! 😉
(^/) The Jedi
Copy link to clipboard
Copied
Some things are possible and some are not.
But it does not matter. I will first wait and see if the TO will answer.
Copy link to clipboard
Copied
A chemist knows how to write NH4+ or CA2+!
(^/)
Copy link to clipboard
Copied
😄
The goal is formatting using Grep. Then the chemist should also think a bit as a grepper in order to achieve his goal.