Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
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
    
@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

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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