4

In my Indesign Style (CS6 on Windows 7) I want to apply the style underline to all initials that come after a tab.

NASCAR    National Association for Stock Car Racing

So the initials all get underlined in the expansion to indicate the letters for the acronym. I am making a list of acronyms, so I want to grep this.

Here is what I have:

(?:(?<=\t))(\<.)*
(?<=\t)(\<.)

These will only underline the first letter after the tab.

So I thought of just underlining capital letters in the expansion, because in acronyms it's not always just the first letters of words:

(?<=\t)((?i)[A-Z])

But that does the same thing.

How can I do this?

3

Solution 1

You can achieve this with 2 Grep styles (in the right order).

First catch all uppercase characters and apply underline character style to this first query:

\u+

Then catch all characters before tab and apply a new character style set with no underlining:

.+(?=\t)

grep1

Solution 2

For an 'all-in-one' solution, try this:

\u(?!.*\t)
Which basically would translate as Catch all uppercase characters except those followed by the pattern 'Any character (zero or more times) followed by a tab'

grep2

  • 1
    Solution 2—very creative! – Janus Bahs Jacquet Nov 9 '17 at 17:45
  • Solution 2! This is absolutely perfect. I don't even have to manually underline anything of the characters. I had actually derived the idea already of using capitals to cause the underlines, but I couldn't figure out how to get them on all the ones after the tab and got pretty close with this: (\u+(?=\l)). But yours is perfect! – bgmCoder Nov 10 '17 at 16:18
2

It’s all depends of your actual text... If you just have a bunch of lines with Acronymes you can use this simple one.

\u(?=\l+)
  • Thanks for your help. However, this also underlines letters in the acronym itself - nothing before the tab should get underlined. – bgmCoder Nov 8 '17 at 14:23
  • How do use this without affecting what comes before the tab? – bgmCoder Nov 8 '17 at 16:22

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.