Copy link to clipboard
Copied
I have a huge text with a lot of scientific expressions like "Cmax" and "Tmax" that require a subscript on the "max" but not on the "C", or italics on the text between brackets but not to the backets. How can I use GREP styles or GREP find/replace to apply the character style to the letters "max" in "Cmax" and "tmax". And of course the word "maximum" is also present in the text but should not be subscripted.
I am new to GREP, but I'm quite sure there must be a way to use it to apply the right character styles only where I need it, just haven't found it yet.
you could try this grep style
Copy link to clipboard
Copied
Copy link to clipboard
Copied
you could try this grep style
Copy link to clipboard
Copied
It works! Thanks a lot!
Can you explain how did you come to this style? I mean, how do you "write" the exception?
Copy link to clipboard
Copied
With GREP you have often several solutions
Create a character style
Use it for
Try to use the hints in the menu:
Positive look behind, insert C | T (the pipe | means or) this will not include to the style, but mus come before
Insert the character chain you want to apply the style to "max".
Copy link to clipboard
Copied
[l\u] - any letter
\K - positive lookbehind
\b - Word Boundary
in your case the grep style takes into consideration only the whole word "max" preceded with any letter
Copy link to clipboard
Copied
Perhaps it would be a good idea to modify the expression to \b[\l\u]\Kmax\b to limit it to only words with a single letter before the "max."