5 Replies Latest reply on Jan 23, 2013 9:30 AM by Jack Ball

    Underlining just the word(s) in selected text string

      How do I get InDesign 2 or 3 to underline just the individual words selected and NOT the spaces?

      We work with legal documents and we have to style them exactly the way the judge has indicated (some underline everything, some just the words). This can become a time consuming endeavor when there are multi-worded court cases cited and sometimes over one hundred cites within one document.

      This was quick and easy under Quark, either from the control palette (click of a button) or the keyboard shortcut (Apple + shift + W). This shortcut closes the document in InDesign (even though the keyboard shortcut for that is supposed to be just Apple + W, both do the same thing). I could reassign the shortcut if I could find the action to link it too (but can't find the action even mentioned in the Help or the forums).

      Have checked under the Underline Options dialog, but there isn't anything there that would solve this problem.

      If there isn't a direct way to do it in InDesign, is there some sort of plug-in available that anyone knows about?

      Thanks in advance.
        • 1. Re: Underlining just the word(s) in selected text string
          Level 1
          This can be done in CS4 using the following technique:

          1. Create a character style named Null and have it apply a fill color of None.
          2. In your paragraph styles, use a GREP style to seek out any white space (you can be more selective if you like) and apply the Null character style.

          Now, when you apply underline to a selection, assuming that the underline setup is to apply the text color to the underline, the spaces will appear to have no underline -- it actually is there, but it is invisible.

          In CS3, you could run a GREP to do the same thing to all spaces and it would still work, but it would be static and could interfere with editing because any new word you typed immediately after a space would pick up the text color of None.

          • 2. Re: Underlining just the word(s) in selected text string
            RodneyA Level 3
            I don't believe there's a direct way to do it in Indesign. There are some shortcuts that help.

            In CS4 you can set up a GREP search to find Words, set Change Format to change "basic character format" to include underline, then do a replace all in selection. You can set up keyboard shortcuts for some of this, but a script would be even more convenient.

            Unfortunately, with the normal "Find" function, the "character" wildcard also seems to find spaces, and there isn't a "whole word" wildcard, so this won't work in CS2 or CS3.

            The best I can think of at the moment is: Underline the whole text. Set Find What to find spaces (^w), leave Change To blank but in the Change Format box, turn off underline on Basic Character Formatting. Close the dialog box. Then, placing the cursor at the beginning, press shift-F3 (the standard shortcut for "Replace with Change To text and find next") for each space in the sentence. You can zip through the section fairly quickly.

            This is really a job for scripting -- the script should change all characters in the selection to underline, then change all white space characters in the selection back to non-underline. Scripts can be assigned a keyboard shortcut for ultimate convenience.

            • 3. Re: Underlining just the word(s) in selected text string
              RodneyA Level 3
              I just tried a variant of Dave's trick (I created a character style called "Spaces" that is underlined but the underline color is set to "none"). Then I defined my body paragraph style so that it contains a GREP Style to set all spaces to style "Spaces." Presto! When I underline the text, all of the words are underlined and the spaces are skipped.

              A second paragraph style could be created for solid underlines that go through the text, it would just omit the GREP style.

              Larry, you need to upgrade to CS4 :-)

              • 4. Re: Underlining just the word(s) in selected text string
                RodneyA Level 3
                Oh, and as for Larry's complaint about option-command-W -- command-W closes the document. option-command-W closes all open documents. If you only have one document open, it appears to do the same thing, but it's really a different command.
                • 5. Re: Underlining just the word(s) in selected text string
                  Jack Ball Level 1

                  OMG are you kidding me?

                  This has been available in Quark for 20 years with a single button.


                  This makes me want to GREP all over my keyboard.


                  I think I will set this document in QuarkExpress rather than mess up my keyboard.