6

Possible Duplicate:
How to typeset $:=$ correctly?

One of the first math books I read used "A := B" to mean "A is defined to be B". In the font used in that book, the upper dot of the colon was aligned with the upper bar of the equals sign, and ditto for the lower dot and lower bar. Because of this early imprinting, the default appearance of ":=", with the vertical space between the dots of the colon much larger than the vertical space between the bars of the equal sign, looks Deeply Wrong to me.

Question: What's the best (or at least a good) way to typeset ":=" with alignment as described above?

Note that I am not asking about vertically centering the colon or about horizontal spacing to the right and left of ":=", as discussed in Typesetting the "define equals" symbol

I'm also aware of the colonequals package, but it doesn't do what I want.

I'm also open to suggestions for completely different symbols to use for "defined as", like \stackrel{def}{=}, but I realize that's not really a TeX question and so might be off topic for this site.


EDIT: One of the answers at How to typeset $:=$ correctly? seems to do what I want. Thank you morbusg and egreg for pointing this out, and I apologize for not finding that question before I asked this one.

I should clarify that I'm concerned with a mathematical colon-equals, not a pseudo-code or computer science colon-equals. The meanings are different: in mathematical contexts it means "is, by definition" or "is defined to be". It has nothing to do with assignment, imperative or otherwise. In pseudo-code, I think the default appearance of ":=" is fine, since I'm used to seeing code in low resolution raster fonts. In math contexts, I prefer that ":=" look the way it does in certain math texts I read as a student.

Put another way, in computer code I think of ":=" as a juxtaposition of two ASCII characters, ":" and "=", and I would not expect the colon to change its appearance. In math contexts, I think of ":=" as a single glyph, and typesetting it as a standard ":" followed by a standard "=" seems like an ugly hack, similar to using a typewriter's double quote in place of a typesetter's curly quotes.

  • What makes you say it looks Deeply Wrong? This symbol AFAIK has its roots it Pascal like computer languages (we used to read it as becomes), any of the books of the period show it as the default you described (just have a look at a few books at google books). My thesis at the time had a lot of Pascal code and I used a right arrow in descriptions of the algorithms. – Yiannis Lazarides Jan 28 '12 at 9:37
  • There is no best way: it's just personal test. To the question linked by morbusg there are various answers, including how to have the dots lined with the bars. I've never felt the necessity of a symbol for this, however. I used "def over =" when I was a student, because some of the teachers used it; when I grew up I discovered it's useless. :) – egreg Jan 28 '12 at 10:04
  • "def over =" has the problem that is not directional: when you read A \stackrel{def}{=} B, you don't know if that's a definition of A in terms of B or vice versa. – Federico Poloni Jan 28 '12 at 10:22
  • 1
    @Kevin The best advice I can give is not to use = in pseudo-code. There are several problems with = as pseudo-code may be mistaken with math. First, as an assignment operator it doesn't mean equals because the rhs may have side effects. Second, as an assignment operator it's not symmetric: you can't write 1 = a. I'd stick to the colon equals or a left arrow. @Yannis we also pronounced it as becomes. Now I'm pronouncing assignment as "gets". – user10274 Jan 28 '12 at 13:07
  • Based on the edit, this is a dupe: closing – Joseph Wright Jan 28 '12 at 16:06