Skip to main content
Participant
October 20, 2024
Answered

Numbering style misplaces character style

  • October 20, 2024
  • 1 reply
  • 292 views
Sometimes when I apply a numbering style to a paragraph through GREP, the character styles misplace a few characters ahead.
It happened to me more than once or twice, and with different ID versions and different computers, but I can never find a similar post anywhere. Why does it happen? What should I do?
 
In the example in the image, the GREP query was to find ^\d+(\.|\))\s+(.+) and change it to %2 applying the Numbering Paragraph Style.
This topic has been closed for replies.
Correct answer Robert at ID-Tasker

It's perfectly "normal". 

 

When you replace Text Contents - all so called Text Style Ranges remain in place - but because you are removing some characters - you are shifting "raw" Text Contents.

 

Take a closer look - your bold formatting has been shifted 3x Characters to the right - as you've removed number+dot+space. 

 

I'm not a GREP guru so not sure if it can be done in one go - but you can do it in two steps:

1) apply ParaStyle, 

2) remove only "^\d+(\.|\))\s+" in the ParaStyle applied in the 1st step.

 

1 reply

Robert at ID-Tasker
Robert at ID-TaskerCorrect answer
Legend
October 20, 2024

It's perfectly "normal". 

 

When you replace Text Contents - all so called Text Style Ranges remain in place - but because you are removing some characters - you are shifting "raw" Text Contents.

 

Take a closer look - your bold formatting has been shifted 3x Characters to the right - as you've removed number+dot+space. 

 

I'm not a GREP guru so not sure if it can be done in one go - but you can do it in two steps:

1) apply ParaStyle, 

2) remove only "^\d+(\.|\))\s+" in the ParaStyle applied in the 1st step.

 

Participant
October 20, 2024

I was trying to make it in one go, but ended up making it your way.
Thanks for taking your time to help me, you actually explained much more than the issue of the question (like, I didn't know why some characters appeared bold/italic out from nowhere lol Now I see that it happened whenever I deleted an expression with those attributes through GREP)