

Nothing magic about it it’s just seeing the pattern then using the positive lookbehind and positive lookahead features in grep.

Make any caret that falls after a number disappear.Here, then is the set of grep styles I’ve created: 1 pt, and the horizontal and vertical scale to 1%. To do that, make a character style that sets the fill and stroke to None, the size. So “Hsub2O” means make the 2 subscript.īut of course, I also don’t want that caret or the word “sub” to appear in the final document! No problem: Just make a character style that makes the text disappear. I honestly don’t know if there’s a standard way to type this. In my case, I’m saying, “use sub2” to mean make this number a subscript. In order to do this for subscript character, we need to come up with a standard to tell our authors. You can immediately see the pattern, right? “Look for one or more digits after a caret and make them superscript.” As soon as you have a pattern, you can grep-it - create a GREP style that applies formatting to it. The caret means make the following number a superscript. In my case, the manuscript uses the typical ascii format for exponential numbers, such as 10^9. I really don’t want to manually format all those numbers, and fortunately I don’t have to. There are a number of ways to do this, but I’m working on a manuscript right now that has a lot of superscripted numbers such as “109” (except that 9 is supposed to pop up a bit, to mean “ten to the ninth” or “one billion” in the modern, long form nomenclature). How should you format H20 or MC2? Generally, you’d want to subscript the 2 in the first instance and superscript it in the second.
