Mauritz
Mauritz

Reputation: 117

Automating InDesign to place italicized text in a new paragraph

I'm making a book about quotes. Got in the thousands of them. They all apear like this:

Patience is a tree whose root is bitter, but its fruit very sweet. Persian proverb

And I would like to make them appear like this

Patience is a tree whose root is bitter, but its fruit very sweet.
Persian proverb

So I basically need the program to understand that when the text ends with regular, then have a space and then there is italic the space needs to be converted into a paragraph enter (^p). Don't know the exact word for it...

Something in Applescript would be appreciated!

BTW: I use quotes that are made out of many sentences as well.

Upvotes: 1

Views: 651

Answers (1)

Evan
Evan

Reputation: 2440

From what you've said, it sounds like you can do this with Find/Change. No AppleScript needed.

This worked for me, in InDesign CS6.

enter image description here

Doing a GREP match means that "Find what" is a regular expression. We're using .+$ for our expression. Let's break that expression down:

  • .+ will match a sequence of one or more characters
  • $ matches the end of a paragraph.
  • The find format will only match text that's in italics. (Hopefully you used character styles for the attributions; if so, use your style instead.)
  • Putting it all together, we're finding everything that's in italics at the end of a paragraph. If there are no italics at the end of a paragraph, we won't match anything.

For "Change to" you want \r$0.

  • \r creates a new paragraph
  • $0 is the text you matched in "Find what."
  • So you'll end up with a new paragraph before the italicized text you matched.

After you do "Change All" you'll have your italic text in new paragraphs. But some of those paragraphs may start with a space character (if the space was in italics, and matched by the previous "Find What"). You can clean that up with another GREP match.

  • Find What: ^ (caret, then space). The caret matches the start of a paragraph. So we're finding all spaces at the start of a paragraph.
  • Change to: empty.
  • This will remove all spaces that are at the start of a paragraph.

Upvotes: 1

Related Questions