GREP - change regular space to small or minum space

Engaged ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Hi people 

I have a GREP command to convert all numbers inside parenthesis in superscript notes.

 

2.png

 

I would like to change the regular separation space of the superscript to a small space so it is no so distant from the word. I mean this space in the image


4.jpg

so if i can change it to this smaller space

 

3.jpg


How can i do that?

Any help or ideas?

Thanks 1000!

 

TOPICS
How to , Scripting

Views

156

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 2 Correct answers

Adobe Community Professional , May 07, 2022 May 07, 2022

Hi @SebastiaoV, I'd go for something like this:

Find what:

 

\s?\((\d{1,2})\)

 

Change to:

 

\x{2009}$1

 

 

In the Find What, the \s? means match a whitespace character or not, so will match kibutz (3) as well as kibutz(3). I've changed your + to "{1,2}" which means match 1 or 2 digits, so it will match (3) and (30) but not (2022). Just an idea.

 

In the Change To, the \x{2009} is a unicode for a thin space. Other unicode values for narrow spaces can be found here. Basically \x{2004} to \x{200A}

...

Likes

Translate

Translate
Adobe Community Professional , May 07, 2022 May 07, 2022

The problem is you have added \r but the actual text has a period. Try removing the \r and let me know how it goes.

Likes

Translate

Translate
Adobe Community Professional ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Are you using the Footnote/Endnote tool? If so, the find is:

 

\h(?=~F)

 

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
Engaged ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Not really using the footnote tool but thanks for the tip 😉
They send me the Word file with the footnotes as numbers inside parenthesis, for example: (6) and that GREP command will convert them all as superscript. The only thing is that they get a bit far a part from the text with a regular space. 

 

 

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 ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Hi @SebastiaoV, I'd go for something like this:

Find what:

 

\s?\((\d{1,2})\)

 

Change to:

 

\x{2009}$1

 

 

In the Find What, the \s? means match a whitespace character or not, so will match kibutz (3) as well as kibutz(3). I've changed your + to "{1,2}" which means match 1 or 2 digits, so it will match (3) and (30) but not (2022). Just an idea.

 

In the Change To, the \x{2009} is a unicode for a thin space. Other unicode values for narrow spaces can be found here. Basically \x{2004} to \x{200A} — higher code points = thinner spaces (\x{200B} is zero-width).

- Mark

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
Engaged ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Thanks for the good advice m1b
The code looks very interesting but I might be doing something wrong since i get the sign "No matches" when applying it 😉

how can solve it?

Thanks!


1.jpg 

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 ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

The problem is you have added \r but the actual text has a period. Try removing the \r and let me know how it goes.

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
Engaged ,
May 09, 2022 May 09, 2022

Copy link to clipboard

Copied

LATEST

It works beautiful! 
I don´t know why when i copy + paste from this website it did include an added \r, but not i have remove it it just great!
Thanks for the great help with these issue 😉

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 ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

You could use this in a GREP style as part of a paragraph style. Make a character style that uses horizontal scaling at, maybe, 50% and apply that with the GEP Style.

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