Simple GREP help needed – Style first Word in Paragraph
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Simple GREP help needed – Style first Word in Paragraph
Tagged: first line of paragraph style
- This topic has 6 replies, 6 voices, and was last updated 6 years, 10 months ago by Jamie Hinojosa.
-
AuthorPosts
-
-
July 8, 2015 at 4:53 am #76457Scott CroftMember
Hi All
I’m new to GREP though I’ve been using InDesign for 5 years or so. I’ve never had call to use scripting like this before but with a new line manager having come along, I’m in need of a, hopefully, simple script.
What I’m trying to achieve is a for InDesign to automatically apply a style to the whole first word of the first paragraph of a section of text but I have no idea where to start really, if anyone can help me I would be very grateful.
Thanks
Valve
-
July 8, 2015 at 5:52 am #76458Loic AigonMember
Hi,
Why not starting by not scripting it and use nested styles inside a paragraph style ?
Loic
-
July 8, 2015 at 6:21 am #76459David BlatnerKeymaster
I agree that Nested Styles are much easier to use.
https://creativepro.com/nested-versus-next.php -
July 8, 2015 at 9:07 am #76462Scott CroftMember
I’m open to that..though Again it’s not something I’ve used before so any tips on how to achieve it would be most welcome! :)
-
July 12, 2015 at 1:39 am #76522Masood AhmadParticipant
Try any of these:
GREP styles under the paragraph style:
Apply Style:
your character style
to text:^\w+
OR
Nested Styles under the paragraph style:
• Click on the ‘New Nested Style’ button
• Select the character style from the first drop down list.
• Select ‘Through’ or ‘Upto’
• Type in ‘1’
• Select ‘Words’Hope this is all you need :)
-
July 25, 2015 at 5:12 am #76878Michel Allio for FRIdNGEParticipant
Hi, the problem with this question is: What is the first word?
What about: New York, The White House, Water-polo, …
So, I prefer to use a grep style keeping the possibility to manually insert a non-joiner to include this kind of complex word.
^.+~j|[\w-]+
;-)
-
May 23, 2017 at 9:32 am #94818Jamie HinojosaMember
I was looking for a way just to style the first line of every paragraph for a directory that I’m putting together.
I found it was easy to use “nested line styles” in the paragraph styles.Choose a “new line style” select the character style you want to use and then input the number of lines you want to assign the character style too.
Hope this helps someone else out there.
-
-
AuthorPosts
- You must be logged in to reply to this topic.