Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Text Variables and Punctuation

Community Beginner ,
Apr 18, 2019 Apr 18, 2019

Hello, everyone!

We have a lengthy service proposal document that we re-use with different clients, with slight tweaks to customize it to each recipient. We use the client company's name frequently in the text, so I have made it a text variable, and now I don't need to worry about somehow missing an instance of an old name when we update the doc. However, we have a few cases where the client name comes at the end of a sentence. Which was fine... until we worked with a client with "Inc." at the end of their name.

Now, if I change my text variable from "Acme Anvils" to "Acme Inc.", I'll have double punctuation in sentences like "Service can be cancelled with written notice from Acme Inc.." (And no, I'm not in a position where I can just impose a re-write on the contract to avoid cases like this.)

The best workaround I can think of for this is to use 2 text variables in my document - one regular "Client Name", and one "Client Name No Period", and insert the second wherever the name happens to fall at the end of a sentence. (In the case of Acme Anvils, both variables would hold the same string (Acme Anvils). But in the case of Acme Inc., "Client Name" would hold (Acme Inc.) and "Client Name No Period" would hold (Acme Inc).) I would need to change both variables with each version of the document, but 2 changes are still much better than 30!

I have 2 questions.

1. Are text variables even the best way to accomplish this?

2. If they are, is this the best solution? Or am I missing something really obvious?

Thanks, everyone! This isn't an urgent problem - just something that's vexing me a bit and I thought I'd see if there was a better way.

1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Apr 22, 2019 Apr 22, 2019

The "Modification Date" Grep code is ~o!

Use [[:punct:]] posix is a very bad way to play -- I let you take a look at its definition! … So you'll need to define what you could have behind the variable!

If several para styles, you'll need to map the Grep styles in them too!

If you need to make text bigger, you'll have a problem!

So, maybe this trick seems to be cool, it is not truly! …

It's really simpler to play with 2 variable definitions!

Translate
Community Expert ,
Apr 21, 2019 Apr 21, 2019

No worries. Assuming that the name is the ONLY text variable, then you could use the following solution if you type the fullstop into the variable:

  • Create two character styles: call the first one "show" and make sure it has no attributes. call the second one "hide", giving it a size of 0.1pt, character width of 1% and color as [None].
  • In your paragraph style, make a GREP style that looks like this:

Screen Shot 2019-04-21 at 21.06.21.png

The first part of the GREP style will find the custom text and a piece of punctuation and apply the hide style. The second GREP will find the custom text and apply the show style. The lower the GREP style appears on the list, the more it will override the styles before it.

In theory, the GREP should simply be one line applying hide with  (?<=~u)[[:punct:]] but it doesn't work and I'm not sure why.

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 22, 2019 Apr 22, 2019

Since I'm using Date Modified as well, it's not the only text variable. I am guessing that means this solution won't work for my doc, but it's very clever! Thanks for the idea!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 22, 2019 Apr 22, 2019

I should have been clearer in my post. If the name was the only CUSTOM text variable, not text variable generally.

In GREP (find options or GREP styles) custom text variables can be found using characters ~u

If using the Modified date, this text variable can be found using different characters ~o

Others can be found by diving into the options within the find/change dialog as pictured:

Screen Shot 2019-04-22 at 22.40.11.png

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 22, 2019 Apr 22, 2019

The "Modification Date" Grep code is ~o!

Use [[:punct:]] posix is a very bad way to play -- I let you take a look at its definition! … So you'll need to define what you could have behind the variable!

If several para styles, you'll need to map the Grep styles in them too!

If you need to make text bigger, you'll have a problem!

So, maybe this trick seems to be cool, it is not truly! …

It's really simpler to play with 2 variable definitions!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 21, 2019 Apr 21, 2019

I would proceed as you with 2 variable definitions and, of course, the same definition if no dot!

Simplistically simple and clever!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 22, 2019 Apr 22, 2019

Thanks to both folks who are offering their expertise - it's very helpful in planning out how this document may evolve, and certainly very helpful with my limited GREP skills. I'm going to go with two variables for the reasons stated in the discussion (type size, different paragraph styles, etc.) but I really appreciate both answers, as I can see times when using the GREP code given will be really helpful as well. Thanks again!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 22, 2019 Apr 22, 2019
LATEST

Btw:  In the 2 approaches, you'll need to modify the "client" variable(s)! Once in Colin's way, 2 times in your present way (and mine).

It just took me 7 seconds to copy the new definition in the first variable form, open the second variable window, "2-tab" to jump in the right form, paste it in it adding or not a dot and play "Enter" two times!

Sure It took me truly more time to convince you you was right! 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines