4 Replies Latest reply on Jun 4, 2015 5:40 AM by Obi-wan Kenobi

    Capitalise first (entire) words of a sentence using GREP

    Kreekree

      Hey all,

       

      I bumped into a problem. Right now I'm working with a huge amount of text where I need to capitalise entire words.
      So for example, I have a sentence
      Lorem ipsum dolor sit amet, consectetur adipiscing elit.
      I want to be able to change it to LOREM IPSUM dolor sit amet, consectetur adipiscing elit. or LOREM IPSIM DOLOR sit amet, consectetur adipiscing elit. etc (1-5 capitalised words)

      I tried to use character styles for this matter however it takes a lot of time and a lot of manual work. Is there a faster way to do it?


      Thanks for all the help!

        • 1. Re: Capitalise first (entire) words of a sentence using GREP
          Peter Spier Most Valuable Participant (Moderator)

          If the number of words is consistent you can do it using a nested character style as part of the paragraph style, but if sometimes it's one word, sometimes more, then there is no way to automate in a paragraph style without some other trigger to inidcate where all caps should end.

          • 2. Re: Capitalise first (entire) words of a sentence using GREP
            [Jongware] Most Valuable Participant

            > .. it takes a lot of time and a lot of manual work


            If there are "1-5 capitalized words" then yes, you must go over them one by one – i.e., how could InDesign know how many words to use? Maybe you could assign a shortcut key to your character style.

             

            I'd probably apply a GREP or nested style to the first word only and then use non-breaking spaces to glue as much words together as needed (and that still needs to be done manually).

            • 3. Re: Capitalise first (entire) words of a sentence using GREP
              Kreekree Level 1

              Thank you very much! I completely forgot about nested styles, this solved my problem!

              • 4. Re: Capitalise first (entire) words of a sentence using GREP
                Obi-wan Kenobi Adobe Community Professional

                Hi,

                 

                Obviously manually! …

                To do this, I use QuicKeys!

                I create six shortcuts as,

                [num] 0:

                The little script inserts 0 non-joiner after the first char (a capital) of a sentence, then searches the following capital (normally the first char of the following sentence).

                [num] 1:

                The little script inserts 1 non-joiner after the first char (a capital) of a sentence, then searches the following capital (normally the first char of the following sentence).

                [num] 2:

                The little script inserts 2 non-joiner after the first char (normally a capital) of a sentence, then searches the following capital (normally the first char of the following sentence).

                [num] 5:

                The little script inserts 5 non-joiner after the first char (normally a capital) of a sentence, then searches the following capital (normally the first char of the following sentence).


                We have created 5 grep styles:

                1 non-joiner: 1 word put in bold

                2 non-joiner: 2 words put in bold

                5 non-joiner: 5 words put in bold


                So, we search the first capital and then only type one of the five QuicKeys shortcuts! If I type "5", 5 non-joiner are typed by the shortcut (so 5 words are put in bold by the grep style) and we jump to the next capital, with another choice: 1, 2, 3, 4 or 5!! … And so on!


                Manually but quick!