3

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

2
  • 1
    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
    Commented Mar 28, 2013 at 15:28
  • 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.
    – user6853
    Commented Mar 28, 2013 at 20:48

1 Answer 1

5

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.

You must log in to answer this question.

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