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?

2
  • Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it).
    – jub0bs
    Commented Mar 26, 2013 at 20:43
  • Thanks for editing the post so it looks nicer, and where I can find more posting tips.
    – rod
    Commented Mar 26, 2013 at 22:19

1 Answer 1

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

4
  • 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
    Commented Mar 26, 2013 at 22:03
  • 1
    Did you use \usepackage{amsmath} in the preamble to your document?
    – A.Ellett
    Commented Mar 26, 2013 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
    Commented Mar 27, 2013 at 4: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
    Commented Mar 27, 2013 at 5:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .