# Centering a text properly

I want to center a set with contains words as follows

{

x in A : x is suppose to be centered}.

I tried the following:
$$\{x\in A : x is suppose to be centered}$$


which outputs {x in A : xissupposetobecentered}. All of the letters are smashed together, which is something I don't want. How can I fix this?

• Please give us some clues, are you using plain Tex or context or latex? – David Carlisle May 23 '14 at 21:56
• \usepackage{amsmath} $\{x \in A : x \text{ is supposed to be centered} \}$ – Gonzalo Medina May 23 '14 at 21:56
• You are not supposed to write words inside dollars. A sequence of chars is seen by tex as a product of single-char-named variables, and spaces are ignored. So $Hello$ is indeed the product of $H$, $o$, $l$, $l$, and $o$. This explains the awkward spacing. To write words inside a math environment use \text{} (from amstext package). – JLDiaz May 23 '14 at 22:31
• @JLDiaz perhaps better to directly recommend loading amsmath which internally loads amstext and offers other useful features? – Gonzalo Medina May 23 '14 at 22:44
• @GonzaloMedina Right. Unfortunately comments cannot be edited. – JLDiaz May 23 '14 at 23:00

$\{x\in A : x \text{ is suppose to be centered} \}$

• Please, don't suggest $$...$$ for LaTeX documents; use $...$ instead. Also, braces need to be escaped: \{ and \} and there's a space missing between the x and the text. – Gonzalo Medina May 23 '14 at 21:57
• Thanks, changed it. Could you tell me the difference between $$and [ ? – zeroset May 23 '14 at 22:01 • $$... is a TeX command which might produce undesired results under certain circumstances in LaTeX. See tex.stackexchange.com/q/503/3954. – Gonzalo Medina May 23 '14 at 22:02