I tried doing this:

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

but that just came out like:


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

  • 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 Mar 28 '13 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. – 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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.