Indesign Tutorial : How to type Chemical Formulas in InDesign using Grep Styles

Published: 19 April 2021
on channel: TechGalaxy
1,729
45

Indesign Tutorial : How to type Chemical Formulas in InDesign using Grep Styles

In this video I have showed how to type chemical formulas in InDesign using Grep Styles.

First we have to create to Character Styles Down and UP.
Down character style is for valences and UP character style is for charges.

To shift down the valences it will look for maximum two digits and apply Down character style only if the target digits have before it a small a-z or a capital A-Z

To shift up the charges of the elements it will look for open parentheses which is denoted by \( in the code. Then it will check for zero or more occurrence of digits which is denoted by \d*. It will then look for a plus or a minus sign which is denoted by (\+|\-) and finally it looks for a closing parentheses denoted by \) in the code.

This is how the full code looks like:
\(\d*(\-|\+)\)

Please note that the symbol | means OR in regular expression code. Also please note that parentheses (), Plus(+) and Minus (-) signs have special meaning in regular expression codes so it cannot be used just like that. It needs to be escaped by \ that is why opening and closing parentheses and plus and minus sign his \ symbol before it.

Sample Formulas
===============
Na
H2O
C6H12O6
C2H6O
CasO4
NO3(-)
CO3(2-)
HSO4(-)
HCO3(-)
Sn(2+)

I hope you liked the video.
Thanks for watching


Watch video Indesign Tutorial : How to type Chemical Formulas in InDesign using Grep Styles online, duration hours minute second in high quality that is uploaded to the channel TechGalaxy 19 April 2021. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 1,729 times and liked it 45 visitors.