Skip to main content
Participant
November 2, 2023
Question

Can I automatically italicise words after a comma?

  • November 2, 2023
  • 4 replies
  • 232 views

Hello,

 

I have a document with thousands of names, and I need to be able to italicise names that come after a comma. For example:

 

John Smith, Scrooge 

Jane Smith, Mrs Crotchit

Bob Jones, Ghost Past

 

I don't want to have to highlight each individual name to italicise, so I was wondering if there's a way I can apply it to all words that come after a comma like above?

 

Thank you!

This topic has been closed for replies.

4 replies

Peter Spier
Community Expert
Community Expert
November 2, 2023

I tend to agree with Willi here, but I also want to add a warning that this can go bad if you have names with commas in them, as John Smith, Jr., Tiny Tim.

Willi Adelberger
Community Expert
Community Expert
November 2, 2023

You can do it with GREP style or with nested Style. I would recommend to use the nested style, as GREP styles can slow down large documents. 
None style up to including comma, italic end to marker.

Community Expert
November 2, 2023

The Grep string that can be used is

(?<=,).*

This will search anything after a comma. Is this what is needed or we need to stop after some words after comma.

-Manan

-Manan
James Gifford—NitroPress
Legend
November 2, 2023

A GREP find/change could do this, or if you want it to be ongoing, a GREP style for the relevant paragraph styles would do it on the fly.

 

I'm shaky with GREP codes, but I'd bet one of the elves will provide a code string shortly if you aren't up to it either. 🙂

 

A Word macro could do it as well, if you have the doc in Word format. Not elegant, but it works.