In Math mode, if I write ":", it will automatically insert spaces before and after the colon. For example, $s:type$ will be shown as "s : type". How can I remove these spaces?

3 Answers 3


Add a pair of brackets around the colon, and put type inside a \text command. Alternatively, you can use \colon which looks better, in my opinion:

$ \begin{array}{l}
     s: \text{type}\\
    s{:}\text{type} \\
     s\colon \text{type}
\end{array} $

enter image description here


The colon : is declared by LaTeX as a binary relation, which means it is separated from ordinary symbols by a thick mathematical space.

The \colon command makes a punctuation symbol, so no space before it and a medium math space after it. However amsmath slightly changes colon to have some space before it and some more than a punctuation symbol after it.

You can make any character into another math atom by using an “atom declaration”: thus \mathbin{:} would make the colon into a binary operation symbol (spaced like +); with \mathord{:} you get an “ordinary atom”, like a letter. Also \text{...} makes an ordinary atom so


is what you probably want. However, \mathord{:} can be abbreviated into {:}, because TeX treats as an ordinary symbol any subformula inserted in a pair of braces (provided they don't delimit the argument to a command).

Beware, though that \text{type} might produce the text in italics if the formula is inside the statement of a theorem. Better doing something like


in the preamble and type the formula as


(choose a better name than \foo).


If you are going to use this for other things, may be the best would be to make a macro


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .