What exactly is the difference between ~ and $

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
macula
Posts: 167
Joined: Mon Oct 19, 2009 1:14 pm

What exactly is the difference between ~ and $

Post by macula »

I have read the user's manual but the difference between the two symbols still eludes me. Sometimes on works and the other one does not. Sometimes, on the other hand, they work interchangeably. And overall, I have failed to discern the underlying difference.

Could someone please enlighten me?

Thank you!
Jon
Site Admin
Posts: 10297
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: What exactly is the difference between ~ and $

Post by Jon »

You mean ` and $?

` is used in formats to force any text between it to be output, no matter what.

$ is used in formats to tell Bookends to output the text if the field before it is present (or if a space occurs before it). Example:

If there is an editor Smith,

e$ (editor)$

will result in

Smith (editor)

If there is no editor, nothing will be output.

Jon
Sonny Software
macula
Posts: 167
Joined: Mon Oct 19, 2009 1:14 pm

Re: What exactly is the difference between ~ and $

Post by macula »

Thank you, Jon, for the response.

Your explanation is clear. I still do not understand, however, the difference between $ and ~

To my understanding, the two expressions below are equivalent:

e$ (editor)$
e~ (editor)~

However, this redundancy cannot be possible… So, what is the difference between these the two operators?

Thanks again.
Jon wrote:You mean ` and $?
` is used in formats to force any text between it to be output, no matter what.

$ is used in formats to tell Bookends to output the text if the field before it is present (or if a space occurs before it). Example:

If there is an editor Smith,

e$ (editor)$

will result in

Smith (editor)

If there is no editor, nothing will be output.

Jon
Sonny Software
Jon
Site Admin
Posts: 10297
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: What exactly is the difference between ~ and $

Post by Jon »

Sorry, the ~ looked like a dash to me -- I've got to enlarge the font!

From the user guide:

"The ~ is similar to $ in that any text between a pair of ~'s is output as is (i.e. quoted). If the field preceding or following the ~ is empty, the text will not be output. The ~ must immediately follow or precede the dependent field (i.e. no space or punctuation between them). If the quoted text is in between two fields, it will be bound to the the preceding field. If you want it bound to the following field, insert a | (pipe character) immediately before the
initial ~."

So, the main difference is that you can use ~ (with the |, if the text is between two fields) to bind the text to the field that comes after it, rather than the field the precedes it.

Jon
Sonny Software
macula
Posts: 167
Joined: Mon Oct 19, 2009 1:14 pm

Re: What exactly is the difference between ~ and $

Post by macula »

Thanks a lot, Jon, for the stellar technical support. Five stars for speed.

I understand then that the tilde is bidirectional in scope, whereas the dollar sign is unidirectional (pointing only at the preceding field).

Which means that it is pointless to use the $ in conjunction with the pipe…

OK, I begin understand some of the difficulties I've had. :D
Jon
Site Admin
Posts: 10297
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: What exactly is the difference between ~ and $

Post by Jon »

Right. The pipe only breaks the binding for ~, not $.

Note that the ~ always binds to the succeeding field if it is preceded by a space, no need for a pipe. So

a. ~Title ~t.

binds the text "Title" to the title field.

Jon
Sonny Software
Post Reply