Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Homogeneous coordinates in projective geometry are usually denoted like this: $[x:y:z]$. However, I think that ':' plays the role of a comma, and should be surrounded by much smaller spaces than for other uses of ':'. Is there a simple way in LaTeX to automatically adjust the spacing in homogeneous coordinates, without messing with the spacing of other uses of ':'?

share|improve this question
Personally, I think the colon should be treated like a binary operator (written as \mathbin:) in this context. No, I understand it is not binary, it's n-ary, but it still walks and quacks like an operator to me, not as punctuation. (To me, the square brackets are incidental, and I'd just as soon do without them. It is the colons that turn the list of coordinates into a point in projective space.) –  Harald Hanche-Olsen Feb 14 '11 at 16:42
add comment

1 Answer

up vote 7 down vote accepted

Set it as a {:} or use \mathpunct{:}

  #1\ifx\relax#2\relax ]\else\mathpunct{:}\Coor@i#2:#3\@nil\fi\endgroup}


foo $\Coor{1:2}$ bar $\Coor{1:2:3}$ baz $[1:2:3]$

share|improve this answer
Thank you, but the number of coordinates may vary. Is there a way to ask LaTeX to systematically treat ':' specially inside a given command? –  Benoît Kloeckner Feb 14 '11 at 14:22
see edited answer –  Herbert Feb 14 '11 at 14:39
I think you can remove \@nil and #3. –  Bruno Le Floch Feb 14 '11 at 15:07
Thanks, your solution works... except it's overrun by babel (I write in French). –  Benoît Kloeckner Feb 14 '11 at 15:19
@Benoît, I edited the code for french and an active : –  Herbert Feb 14 '11 at 16:15
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.