• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to give a color to each letter of a word using GREP Style ?

Explorer ,
Jan 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

Hi,

I would like to give colors to some letters.

For example, let's say I have the word "Word", I want this result : "Word".

I created 4 Characters Styles, each with a different color, now, I need to find how to "select the letter X of the word << Word >>".

Any idea please 😄 ?


TOPICS
Type

Views

381

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
Community Expert ,
Jan 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

Some context would be nice. Does this need to occur for a specific word or any word? Only four letter words? ALL four letter words? will there be other text in the paragraph? All of these will affect the solution.

Votes

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
Explorer ,
Jan 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

There are other words in the paragraph, specific Word. 

Votes

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
Explorer ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

Any idea 😛 ?

Votes

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
Community Expert ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

What is the specific word? Will it appear more than one time in a paragraph? If it does, should all occurrences be treated the same?

Votes

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
Explorer ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

"Pneumonoultramicroscopicsilicovolcanoconiosis" xD . Joking, but I dont think knowing the specific word can help us here, I would like a generic procedure to apply it on every word I would like.

Let's say it's present one time in each paragraph, but an answer for all possibilities where all occurences must be trated the same way is also interesting.

Votes

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
Community Expert ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

Unless there is something unique about your word (or list of words) you won't be able to identify it (them)using GREP. GREP matches patterns, so that pattern cannot exist anywhere you don't want to apply your style.

Votes

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
Explorer ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

Okay, now we have a word, what could be the procedure ?

Votes

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 ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

Simplistically:

 

Find/Replace “word” and insert a non-joiner before it, as:

 

Find: \bword\b

Replace by: ~j$0

 

Including Grep Styles in the para style as:

 

~j\K\w + color1
~j\w\K\w + color2

~j\w{2}\K\w + color3

~j\w{3}\K\w + color4

~j\w{4}\K\w + color5

...

 

(^/)  The Jedi

 

Votes

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
Explorer ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

I would like solution that I could use with a MergeData, I cant use find & replace (I didnt think it would involve a F&R solution so I didnt precise it, sorry).

If I understand well, this is what you propose :

 

- "Find << word >> between boundaries"
- "Store the data << word >> into the clipboard by replace it by << ~j >>"

Next, I dont see what it is, is it "find what is stored in ~j then apply a style to the letter number N from the left" ?

Votes

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 ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

Nope! ...

 

You just need to insert the non-joiner before “word”!

 

... and it will be automatically colorized through the Grep styles.

 

About the use of “data merging”, you can run a F/R after it!

 

(^/)

Votes

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
Explorer ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

There is not "step" after my DataMerging in my process, the file must not be modified.

What is a non-joiner ? The tilde " ~ " ?

I can add special characters in my text, can you give me an example please ?

Votes

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
Community Expert ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

Hi Michel,

 

I think what the OP wants to do is merge directly to PDF, so no post processing be done in this instance.

 

Rather than looking for a non-joiner, perhaps have the GREP look for a character that the user is unlikely to use in their general type such as | or © and then apply a "no fill or stroke" character style to that letter.

I've written about the "no fill or stroke" technique here: https://colecandoo.com/2012/08/08/no-fills-grep-styles-part-1/

 

What it means is that if the OP has the word paws for example, in their data merge file they would have to write |paws or ©paws for the GREP styles you've provided to be applied.

 

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!

Votes

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
Explorer ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

I'm okay with that.

Now I try to translate "

~j\K\w + color1
~j\w\K\w + color2

~j\w{2}\K\w + color3

~j\w{3}\K\w + color4

~j\w{4}\K\w + color5

"

into something usable in my case.

Votes

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
Explorer ,
Jan 25, 2022 Jan 25, 2022

Copy link to clipboard

Copied

LATEST

So, now that I renamed all my |words like that, what I can do ?

Votes

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