2

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
3
  • 1
    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, 2012 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, 2012 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. Oct 10, 2012 at 6:04

1 Answer 1

1

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

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
$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$
\end{document}

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.

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