Automating InDesign to place italicized text in a new paragraph

一世执手 提交于 2019-12-11 11:52:35

问题


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.


回答1:


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.

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.


来源:https://stackoverflow.com/questions/23180988/automating-indesign-to-place-italicized-text-in-a-new-paragraph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!