How to use GREP to format scientific expressions

New Here ,
Dec 14, 2021 Dec 14, 2021

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.

TOPICS
How to

Views

111

Likes

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

correct answers 1 Correct answer

Guide , Dec 14, 2021 Dec 14, 2021

you could try this grep style

Schermata 2021-12-14 alle 11.13.33.png

Likes

Translate

Translate
Adobe Community Professional ,
Dec 14, 2021 Dec 14, 2021

Copy link to clipboard

Copied

Likes

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
Guide ,
Dec 14, 2021 Dec 14, 2021

Copy link to clipboard

Copied

you could try this grep style

Schermata 2021-12-14 alle 11.13.33.png

Likes

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
New Here ,
Dec 14, 2021 Dec 14, 2021

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?

Likes

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
Adobe Community Professional ,
Dec 14, 2021 Dec 14, 2021

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".

Likes

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
Guide ,
Dec 14, 2021 Dec 14, 2021

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

Likes

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
Adobe Community Professional ,
Dec 14, 2021 Dec 14, 2021

Copy link to clipboard

Copied

LATEST

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."

Likes

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