Copy link to clipboard
Copied
Hi everyone,
Does anyone know how to prevent InDesign from splitting names that are separated by commas at the end of a line? I’ve tried a few GREP expressions, but they haven’t been entirely effective. Any suggestions?
I don't say this Grep code that groups complete names will work in all situations! …
((\u\.?['\w-]*)\h?(\u\.\h?)*)+(?2)
Best,
(^/) The Jedi
Copy link to clipboard
Copied
Replace the spaces within names with nonbreaking spaces.
Or apply a no-break character style across each name.
Copy link to clipboard
Copied
Hi James,
Thanks for your prompt response. I tried both options and once again it's not working. When I replaced the spaces with nonbreading spaces, suddenly the text disappeared. Any further support?
Copy link to clipboard
Copied
Use the non-breaking spaces only between the parts of a single name, NOT between the names or anywhere else you want the text to break.
you can use the following GREP to get you most of the way there:
Find: (\u\l+)( )(\u\l+)(?!,)
Change: $1~S$3
This will work for most names, but will fail for those with lowercase prefix portions or that have a suffix such as Jr.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Don't think so. That last is a negative look ahead. Expression works here as-is.
Copy link to clipboard
Copied
Don't think so. That last is a negative look ahead. Expression works here as-is.
By @Peter Spier
Right sorry.
Copy link to clipboard
Copied
No worries. I'm hardly a GREP guru.
Copy link to clipboard
Copied
Sorry if I wasn't more clear — as already noted, you replace ONLY the spaces you don't want to break with this method. It's fairly standard to create or process name lists with a hard or nonbreaking space within each name, so that they will not break no matter how or where they are used further in the project or process.
A hard space in every slot just makes a string the app can't process. 🙂
Copy link to clipboard
Copied
Create a character style with no language and apply it to names.
i doubt that it is possible to apply names such a style automatically as names do not follow any regular rules.
Applying this character style will also exclude them from any spell checks.
Copy link to clipboard
Copied
I don't say this Grep code that groups complete names will work in all situations! …
((\u\.?['\w-]*)\h?(\u\.\h?)*)+(?2)
Best,
(^/) The Jedi
Copy link to clipboard
Copied
This GREP command seems to be working well for me so far.
Thank you!