# Text inside Math

I tried doing this:

\usepackage{amsmath}
$x^2 \text{something} y^2$


but that just came out like:

x^2somethingy^2

Anyone know how to fix this issue? I need to have text inside my math environment

-
In math mode, spaces are ignored. Thus, you need to supply the spaces inside the \text command: $x^2 \text{ something } y^2$. (The spaces outside the argument of \text continue to be ignored, of course.) –  Mico Mar 28 '13 at 15:28
@Mico ah that's it, thanks! –  Richard Mar 28 '13 at 15:37
You can also do things like $x^2\quad\text{something}\quad y^2$. For example, when I have punctuation at the end of a line of displayed math, I put a \qquad before the punctuation. –  Ben Crowell Mar 28 '13 at 20:48

For inline text between inline math expressions it is usually better to just stop and start the math

$x^2$ something $y^2$


then the interword spacing and line breaking matches the rest of the paragraph.

If that isn't possible then you can put them inside the \text

$x^2 \text{ something } y^2$


But this is essentially like putting the text fragment in \mbox so it freezes all white space at its natural size, not allowing any stretch or shrink, and prevents line breaking.

-