1

Is there a way to tell InDesign via GREP to apply a Character Style to the first paragraph of a text box before a carriage return? Not a forced line break. A carriage return.

Thank you

  • It's worth noting this question is completely new now that it has been edited. It changes the question completely. – MG_ Aug 13 '14 at 22:10
  • So I think we need more information, because it would seem that a regular paragraph style would suit you perfectly. If not, what's different about this circumstance? – MG_ Aug 13 '14 at 22:13
  • Yes ok well essentially I'm asking "How do you apply a Paragraph Style or a Character Style to the first paragraph of a text box?" Via GREP or a Nested Style. I don't care. – gmorissette Aug 14 '14 at 2:56
1

I don't think it's possible because in Indesign there is no carriage return character to define the end of a line the way you are thinking.

There is a hard return that defines the end of a paragraph, and there is a soft return that defines a forced line break.

The only way I know to style the first line is with a Nested Line Style. (bottom of the example pic) enter image description here

| improve this answer | |
1

This regular expression does it:

\A[^\r]+

| improve this answer | |
  • correct, Adds styling to the carriage return, but in Indesign this goes to the hard return and styles the whole paragraph ;) – Rsiel Aug 13 '14 at 19:50
  • Didn't do that when I tried it. Did you actually try it or are just making an assumption? – gmorissette Aug 13 '14 at 20:06
  • I did try it, and it did do the whole paragraph in CS6. ... I did not do the down vote :) – Rsiel Aug 13 '14 at 20:13
  • Weird.. I created a Character Style that I called "bold" where the only default setting I changed is the font weight that I set to bold. I then created a paragraph style, left everything as is again with the exception that I applied the "bold" character style to \A[^\r]+ via GREP. Tried it out in a text box and it worked. Every character in the text box is bold from the beginning until I press enter and afterwards I can press return as many times as I want in the remainder of the text and it will remain as is. – gmorissette Aug 13 '14 at 20:25
  • when you press Enter, you are making a new paragraph. So your GREP is styling the whole paragraph. However, my impression was that you wanted to style only the first line of the paragraph, which is a different thing. :) – Rsiel Aug 13 '14 at 20:32
0

There's a much easier way to achieve the effect you're after: that is, applying style-A to the first paragraph and style-B to the remainder. InDesign has a feature for it.

Set up two Paragraph Styles as you'd like them. Then, edit style-A by setting it's "Next style" to style-B. (Next Style is found on the general tab of Paragraph Style Options.)

Then, with your text box selected, right click on style-A in your Paragraph Style and choose "Apply style-A then Next Style". (This is a context sensitive option and won't appear unless you have made a valid selection like a text box or a text selection of more than one paragraph.)

One advantage of this approach is more than two styles can be chained together. For example if you had a heading, subheading, first paragraph and normal paragraph you can apply them all in one hit. And its more obvious than GREPping.

enter image description here

| improve this answer | |
  • Thank you for your input, I really appreciate it. However, your solution implies that I would have to go through those steps every time I paste some text inside the text box (unless I missed something?) With the regex I used, I only have to paste in the text and press return if the first line (paragraph) is not already isolated from the rest of the text and voilà! Additionally, your solution creates mixed paragraph styles which is something I like to avoid. Nevertheless remains a great alternative. Thank you! – gmorissette Aug 15 '14 at 15:47
  • I guess it's whatever you find easier. Just putting it out there! – MG_ Aug 15 '14 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.