3

I'd like to type non-math text inside of the bracket math text lines, or know of a better way to do what I'm trying to do.

In the following, I don't literally type \nomath. I don't know what I need to type there in order to make this work.

This is what I type (the dashes are disappearing, I don't know why):

\begin{document}

\[ K=L \]

\[ A = B \nomath or \nomath A_1 = B_1\]

\end{document}

This is what I get:

K=L

A=B

or

A_1=B_1

This is what I want:

K=L

A=B or A_1=B_1

What I'd like for the or word to be in non-math text mode, with everything around it following the normal rules according to the dashes and brackets. Can anyone help me?

yo'
  • 51,322
rod
  • 33

1 Answers1

8

If you use the amsmath package, you should be able to write something like

\[A = B \text{ or } A_1 = B_1\]

You'll have to manually add space around the or. You can do it as I did or you can do it as:

\[A = B \quad \text{or} \quad A_1 = B_1\]

EDIT 1

Here's a complete MWE:

\documentclass{article}
\usepackage{amsmath}
\pagestyle{empty}
\begin{document}

\[A = B \text{ or } A_1 = B_1\]

\[A = B \quad \text{or} \quad A_1 = B_1\]

\end{document}

EDIT 2

A comparison of \mbox{...} vs \text{...}

\[ A_{\mbox{Hi}} \text{ vs } A_{\text{Hi}}\]

If you want to know more about the differences between these, you should probably post another question.

Or see Difference between various methods for producing text in math mode

A.Ellett
  • 50,533
  • Thanks for the answer. Although I couldn't get any of your suggestions to work, you gave me the terminology I needed to find what I could get to work, which was using "\mbox{ or }". – rod Mar 26 '13 at 22:03
  • 1
    Did you use \usepackage{amsmath} in the preamble to your document? – A.Ellett Mar 26 '13 at 22:30
  • Maybe? I guess the preamble isn't the part before the \documentclass{article}, but after. When I put \usepackage{amsmath} before \documentclass{article}, \text{or} doesn't work as I desired. After, and it does. On a related note, is there any effective difference between \mbox{or} and \text{or}? – rod Mar 27 '13 at 04:42
  • Usually, the \documentclass{...} declaration should come at the beginning of the document. There are exceptions to this. But if you are new to LaTeX, that might be a good rule of thumb to initially follow. Yes, there is a difference between \mbox{or} and \text{or}. In brief, \text{...} is sensitive to its context and chooses the correct font size. See 2nd edit above. – A.Ellett Mar 27 '13 at 05:19