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

GREP – % symbol to show to the left of any number

Community Beginner ,
Nov 13, 2024 Nov 13, 2024

I'm assisting a client who wants the percentage symbol to show on the right of any set of numbers. The scenario is as follows… Arabic text going from right to left that has Arabic numerals within the text, when the percentage symbol is typed, it normally goes to the right of the numerals eg. 2.5%.

The client is deleting the % symbol manually, then type it to show as follows… %2.5 which is what they need.

Is there a way to use GREP search to shift the % position from right to left? Note, the number of digits varies such as 12.07%, or 1%.

TOPICS
Scripting
1.1K
Translate
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

Community Expert , Nov 13, 2024 Nov 13, 2024

Strange, the four Arabic fonts I have installed (Adobe Arabic, Lotus Linotype, Myriad Arabic, and Adobe Naskh) place the %-sign before the number:

PeterKahrel_0-1731507527255.png

Maybe check whether all the character settings are corect.

 

If you do need to move the %-signs, use this GREP query:

 

Find what: ([\d\.]+)%

Change to: %$1

 

Translate
Community Beginner ,
Nov 13, 2024 Nov 13, 2024

text sample here…

إذ يتوقع صندوق النقد الدولي استقرار نمو الاقتصاد العالمي ليبلغ %3.20 في عامي 2024 و 2025

Translate
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 ,
Nov 13, 2024 Nov 13, 2024

In ME version of InDesign you need to go to the Paragraph Style Options

and for Middle East Character Formats setting set it from Default to Arabic

 

For individual cases - you may need to adjust the Character Pallet setting in the flyout menu - there should be Character Direction and with 25% selected changed the Character Direction from Right to Left.

 

 

Translate
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 Beginner ,
Nov 13, 2024 Nov 13, 2024

I first thought about the character direction, however it provies to be risky in this case as the 3.10% will display %01.3

In this case, the user must visit each number then retype each in reverse manner.

Translate
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
Mentor ,
Nov 15, 2024 Nov 15, 2024

What happens if you set the language of those numbers with the percent to no language or any LTR language?

If it works, you could perform that change with a grep style.

Translate
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 ,
Nov 16, 2024 Nov 16, 2024

I did try as many tricks I had under my sleeve before posting, one of which was changing the Language as shown below…

percentage-location.jpg

The more I think about it, I admit that InDesign is providing a logical behaviour for this percentage, and there is nothing wrong with the percentage symbol appearing on the right side of the number. See, when we type Arabic we would ideally select the appropriate input keyboard for Arabic that will force the input cursor to move right-to-left hence any number with a percentage symbol will appear correctly to the left as ٪٣،١٠ (note this is ٪ percentage symbol in Arabic). 

Since the client is switching to English keyboard input when they type the number 3.10%, InDesign considers this as English or left-to-right text hence the symbol to the right.

What the client is claiming is that this behaviour was not like this in the previous InDesign version and that they need the percentage symbol to appear to the left of the figure as they used to. Once again, I started to be convinced that InDesign is doing the right thing, it is just the client who's used to something odd.

@Dirk Becker back to your idea, although your suggestion didn't work, however even if your idea worked, the client will still need to visit many numbers on the document to fix it manually. The provided GREP solution will universally give the client what they need. Thanks for your input though.

Translate
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
LEGEND ,
Nov 16, 2024 Nov 16, 2024

@Zaid AlHilali 

 

Can you share a sample file "to play with"?

 

Translate
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 ,
Nov 17, 2024 Nov 17, 2024

Here is a page sample from my client, I cleanedup few elements, and left the font in for proper testing, kindly don't share the font(s).

 

Translate
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
LEGEND ,
Nov 18, 2024 Nov 18, 2024
LATEST
quote

[...] I cleanedup few elements, and left the font in for proper testing, kindly don't share the font(s).

 

By @Zaid Al Hilali

 

Thanks.

Of course, it's just for my personal "use". You can delete the package.

 

Translate
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 ,
Nov 13, 2024 Nov 13, 2024

Strange, the four Arabic fonts I have installed (Adobe Arabic, Lotus Linotype, Myriad Arabic, and Adobe Naskh) place the %-sign before the number:

PeterKahrel_0-1731507527255.png

Maybe check whether all the character settings are corect.

 

If you do need to move the %-signs, use this GREP query:

 

Find what: ([\d\.]+)%

Change to: %$1

 

Translate
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 ,
Nov 13, 2024 Nov 13, 2024

Thank you Peter. The GREP query worked like a charm.

With regards to your experience when you type, you get the percentage symbol to the left by default. Well, the client and myself didn't have the issue explained in my original post till we updated to the latest InDesign Middle Eastern version v.20.0 so my guess is that Adobe changed something in the text engine.

 

Note. I posted this case from another machine, I didn't notice that I wasn't using this Adobe profile!

Translate
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 ,
Nov 13, 2024 Nov 13, 2024

I typeset ME languages almost every day and do this percentage numbering regularly - I can't get it to behave how you describe - but then again it might be a separate setup or font or another issue. 

 

You seem to have solved it with the GREP solution - but I would say it's likely some other ME setting that needs to be adjusted. 

Translate
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 Beginner ,
Nov 13, 2024 Nov 13, 2024

You maybe right Eugene, it could be the font or any other. However, the customer claims that such issue occured after the update/upgrade to the latest InDesign. I guided them to use the File>Place method instead of the copy/pasting Arabic text from elswhere into InDesign.

So they and I are expereminting some solution, but for a quick solution to many numbers with percentage symbol they will be using the GREP method.

Translate
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