[Tex/LaTex] Spacing in math mode

math-modespacing

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?

Best Answer

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