TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
What is the “correct” way of embedding text into math mode?

What formatting is perfect for word in an equation? Is \text{ text is here } the best way? For example,

a = x_j \text{ for } i = 1, 2, \dots, M
share|improve this question

marked as duplicate by doncherry, lockstep, Marco Daniel, Hendrik Vogt, Stefan Kottwitz Oct 10 '12 at 7:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Yes, and you could also use \mbox{ text is here }, but this will not scale to where it's used. Some also use \ \text{text is here}\ . – Werner Oct 10 '12 at 5:46
The whitespace before and after the text does look to close to the math. Is \ there to fix that? – qazwsx Oct 10 '12 at 5:50
Yes, the \ is there to add additional space, but I think $a = x_j \text{, for } i = ... is better, but really up to you which to use. – Peter Grill Oct 10 '12 at 6:04
up vote 1 down vote accepted

Not sure whether this is an answer...

Spaces are gobbles and replaced with appropriate math spacing when in math mode. However, forced spacing always sets the same; there is no difference in the spacing between the following alternatives:

enter image description here

\usepackage{amsmath}% http://ctan.org/pkg/amsmath
$a = x_j \text{ for } i = 1, 2, \dots, M$ \par
$a = x_j\ \text{for } i = 1, 2, \dots, M$ \par
$a = x_j \text{ for}\ i = 1, 2, \dots, M$ \par
$a = x_j\ \text{for}\ i = 1, 2, \dots, M$ \par
$a = x_j \text{~for~} i = 1, 2, \dots, M$ \par
$a = x_j~\text{for~} i = 1, 2, \dots, M$ \par
$a = x_j \text{~for}~i = 1, 2, \dots, M$ \par
$a = x_j~\text{for}~i = 1, 2, \dots, M$

As such, it may be left up to user preference. That is, whether you consider the space before/after the text to form part of the text or not and what kind of spacing you use.

share|improve this answer

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