Copy link to clipboard
Copied
Hi GREP Experts,
I wonder if i can use grep to copy every first letter of first word in lines of paragraphs in Index and Make it capital and put it over the lines (paragraphs) of those words , no matter if the word start by capital letter or small letter, so it will auto genearate those letters as Index by letter key like dictianary Automatically, Please have a look in the picture - generated Capital letters is between Rectangles :
is it Possible by GREP? and Thanks in Advance.
See here: https://creativepro.com/files/kahrel/indesign/index_skip.html
That's a script. With INDesign 2021 and later you can use this GREP query:
Find what: (\u).+\r(\1.+\r)+\K(?=(.))
Change to: $3\r
You'd better narrow it down to one-letter paragraphs so that you catch only the section letters:
Find: ^[a-z]$
Change: empty
Change format: All caps
It's probably better to apply a separate paragraph style to those section letters so that you can add space before. So you would add AllCaps as a property in the paragraph style.
But that works only if the font you use supports AllCaps.
P.
Copy link to clipboard
Copied
See here: https://creativepro.com/files/kahrel/indesign/index_skip.html
That's a script. With INDesign 2021 and later you can use this GREP query:
Find what: (\u).+\r(\1.+\r)+\K(?=(.))
Change to: $3\r
Copy link to clipboard
Copied
Copy link to clipboard
Copied
@Peter Kahrel , The GREP is Good but i Noticed that it Skip First A Capital and it generate small letters also , can this be ignored? Thanks again
Copy link to clipboard
Copied
Ah, that it doesn't do the A is unavoidable, you'll have to add the A manually.
> it generates small letters also
Sorry, I don't understand what you mean here.
P.
Copy link to clipboard
Copied
Yes, i have to insert ( A ) letter manually, I mean can i avoid generating small letters? and many thanks to you
Copy link to clipboard
Copied
if tried solution and worked by GREP to get rid of small letters :
Find : ^[abcdefghijklmonopqrstuvwxyz]+$
Change : EMPTY
Copy link to clipboard
Copied
You'd better narrow it down to one-letter paragraphs so that you catch only the section letters:
Find: ^[a-z]$
Change: empty
Change format: All caps
It's probably better to apply a separate paragraph style to those section letters so that you can add space before. So you would add AllCaps as a property in the paragraph style.
But that works only if the font you use supports AllCaps.
P.
Copy link to clipboard
Copied
Thanks Lot @Peter Kahrel