12 Replies Latest reply on Oct 2, 2013 3:38 AM by Peter Spier

    How to apply a Paragraph Style to the second paragraph in a document

    RBastier Level 1

      I have a document where the first paragraph is preceded by *[em space]*, then I want to apply a Paragraph Style to the second paragraph. I am able to use \*~m\*~b.+~b to find the first paragraph, but when I then put that search inside the positive look behind formula, I get Cannot find match. Why would that be? And is there a better way to apply a Style to the second paragraph?

       

      Here is the positive look behind I'm trying

       

      (?<=\*~m\*~b.+~b).+

      Thanks very much

        • 1. Re: How to apply a Paragraph Style to the second paragraph in a document
          Peter Spier Most Valuable Participant (Moderator)

          Lookbehinds cannot use variable length searches, so .+ is where yours breaks down.

           

          Was there a reason not to add a "next style" to the first paragraph style definition?

          • 2. Re: How to apply a Paragraph Style to the second paragraph in a document
            RBastier Level 1

            I see. I wouldn't be able to use next style, because it's not always where there's a carriage return that I want to apply this other style. And I just realised that in fact, it won't always be the second paragraph either, so I don't actually think there is a way to automate this!

             

            However, perhaps you could help me with something else?! I have a title introducing a list, all items on the list being separated by a standard carriage return, is there a way to say apply a style to all the lines in the list?

             

            Title

            Item 1

            Item 2

            etc.

            • 3. Re: How to apply a Paragraph Style to the second paragraph in a document
              Peter Spier Most Valuable Participant (Moderator)

              RBastier wrote:

               

              I see. I wouldn't be able to use next style, because it's not always where there's a carriage return that I want to apply this other style.

              Paragraph styles apply to paragraphs in their entirety, so if you want oformat only part of a paragraph differently, you need to use a character style, which you might be able to apply as a nested style, a line style, or a GREP style, but that would depend on if there are patterns in the text that could be used to trigger one of those.

               

              Again, a "next style" is probably the way to deal with your list, but you really haven't given us anywhere near enough information about the document, or how the text is getting into it, or even if there is something in the list that would allow you to use find/change to locate list paragraphs.

              • 4. Re: How to apply a Paragraph Style to the second paragraph in a document
                Eugene Tyson Adobe Community Professional & MVP

                It's not a good idea to start a paragraph with a space - probably best to use a "First Line Indent" in the Paragraph Style "indents and Spacing" section.

                 

                If you give us more information on the paragraph you want to apply a specific paragraph style to - perhaps we can help you sort that out. But using your current methods I don't think you'd have much success.

                 

                As for a list  that repeats:

                 

                http://layersmagazine.com/using-the-next-style-paragraph-feature-in-indesign.html

                 

                You can research more tutorials on this yourself.

                 

                 

                But the list would have to be identical in it's number of paragraphs

                 

                for example

                 

                Title

                Item 1

                Item 2

                Item 3

                Code

                 

                Would work fine if all the lists were the same structure.

                 

                If a list was

                Title

                Item 1

                Item 2

                Code

                 

                Then the next style would break.

                • 5. Re: How to apply a Paragraph Style to the second paragraph in a document
                  Sandee Cohen Adobe Community Professional

                  It's not a good idea to start a paragraph with a space - probably best to use a "First Line Indent" in the Paragraph Style "indents and Spacing" section.

                   

                  I agree with Eugene that it's not a good idea to start a paragraph with a space. Makes for all sorts of confusion if you're creating drop caps.

                   

                  But there is one situation where an Em or En space (or multiples) is helpful.

                   

                  If you know your text is going to change point size as you design (like in book publishing), use Em or En spaces to start the paragraph. A fixed size indent may need to be re-set each time you change the point size. Em and En spaces adjust.

                   

                  But having said that, I wish ID had percentage indents as well as Em and En space indents.

                  • 6. Re: How to apply a Paragraph Style to the second paragraph in a document
                    Eugene Tyson Adobe Community Professional & MVP

                    Valid reasons Sandee... and as always there's exceptions to general rules.

                     

                    Percentages would be very preferable for a lot of things, like paragraph rules "125%" size of the paragraph could be a useful way to make coloured frames behind text that can span columns and pages etc.

                     

                    Ah - someday... someday...

                    • 7. Re: How to apply a Paragraph Style to the second paragraph in a document
                      RBastier Level 1

                      OK, thanks for the responses so far. Sorry to be asking two things at once!

                       

                      For the first question, here is some more information. The document in question is a legal summary, so it has a list of keywords separated by en dashes in Paragraph Style Su_Keywords. Then it has a carriage return, followed by a set of 3 stars, as below, to separate the keywords from the introduction to the summary of the facts of the case. The rest of the text is in Paragraph Style Su_Para.

                       

                      "Keywords - Keywords - Keywords - etc.

                       

                      *

                      *       *

                       

                      Introduction to the facts of the case.

                       

                      Article 1: The Court found ..."

                       

                      So the paragraph I want to apply a different style to is the one that begins "Article 1". What sets it apart is that it will always start with Article BUT the introduction will sometimes be more than one paragraph long AND there will always be more than one paragraph that begins Article in the document. So, having watched the tutorial, I don't think Next Style is going to work, or have I not completely understood it? The document is imported from Word, and I am not able to tell the people who draft it to use different styles for the different paragraphs.

                       

                      For the second question, Next Style would work for the first paragraph that follows my title, but there will always be more than one paragraph that follows it, and not the same number of paragraphs each time. The list will always end with a page break or odd page break though, if that helps at all?

                      • 8. Re: How to apply a Paragraph Style to the second paragraph in a document
                        Eugene Tyson Adobe Community Professional & MVP

                        Think the best you can do to apply the Paragraph Style to "Article 1:"  and all others is with a Find/Change

                         

                        Find

                         

                        and go to the GREP tab

                         

                        ^Article\s\d+?:

                         

                         

                        And in the change format

                         

                        Select the Paragraph Style

                         

                         

                        I don't know of a way to automate that particular instance - what is really needed is a Grep Style that can apply a paragraph style automatically - currently InDesign only supports applying Character Styles through Grep Styles

                        • 9. Re: How to apply a Paragraph Style to the second paragraph in a document
                          Peter Spier Most Valuable Participant (Moderator)

                          Eugene, I think he only want's to apply the style to Article 1, not all Article numbers, but we could use some clarification.

                           

                          It also sounds like there are times when the Article 1 content is more than one paragraph long and he wants to also include the extra pararagraphs, so we need some calrification on that, as well, and whether the stopping point is always discernable by a trigger value that can be matched.

                          • 10. Re: How to apply a Paragraph Style to the second paragraph in a document
                            RBastier Level 1

                            I only want to apply the style to the first paragraph that starts with Article. I should say as well that this is in a script, perhaps there's a way to do it with a loop or an if statement?

                            • 11. Re: How to apply a Paragraph Style to the second paragraph in a document
                              Eugene Tyson Adobe Community Professional & MVP

                              Well you can do that with the Find Change I mentioned

                               

                              The thing with a Find/Change or a Script is that they don't run in the background - you need to trigger them manually.

                               

                              I don't know of a plugin/script/et al that will do what you need.

                               

                              It's a manual process. But it can be automated over your document(s) using the FInd/Change which does every paragraph that

                               

                              starts with

                              Article

                              followed by space

                              followed by any number length

                              followed by a colon

                              • 12. Re: How to apply a Paragraph Style to the second paragraph in a document
                                Peter Spier Most Valuable Participant (Moderator)

                                You can apply the style looking for Article 1: (even as a plain text search, with case sensitivity set), but it will only apply to paragraphs that contain that string, not additional paragraphs that follow in the same article. If yo have other references to Article 1: they'll get picked up as well, so you may need to use the GREP and add the ^ (start of paragraph location marker) and your em space if you are using it to be absolutely certain you grap only paragraphs you want.

                                 

                                I think you can probably apply the style to following paragraphs as well using a script, as long as you can define a condition to end the loop, but the best place to ask is over in scripting. InDesign Scripting