7

I try to write (x,y,\theta) but I get an error that says, "Missing $ inserted". If I remove \theta the error disappears. What is wrong?

erik
  • 12,673
naman
  • 103

3 Answers3

14

\theta is defined in math mode which is why TeX makes the announcement $ inserted. If what you type is indeed a formula, surround it with $:

$(x, y, \theta)$

If it is normal text, the correct input depends a bit on whether you use (normal) (La)TeX or e.g. XeLaTeX (or other compiler that understands unicode input). XeLaTeX allows for direct Unicode input and does not need \theta.

See also How to typeset greek letters

dariok
  • 755
  • Does it also applies for x of t when I want to writ in in text, like this: $x_{t}$ ? I'm using sharelatex – naman Jun 10 '16 at 13:44
  • 1
    In general, all mathematical formulae should be typeset using $...$ (or \( ... \)) when within a stretch of text or, if they are longer, within an environment such as \begin{equation} ... \end{equation}. For some more info and help, https://en.wikibooks.org/wiki/LaTeX/Mathematics might be helpful – dariok Jun 10 '16 at 13:53
  • Thnaks. But it does not work for equation for me when I try this: \begin{equation} $ \overline{bel}(x_{t}) = p ( x_{t} \textbar z_{1:t-1} , u_{1:t} ) $ \end{equation} If I remove $..$ then I get worming: Command \textbar invalid in math mode on input line 12 – naman Jun 10 '16 at 13:59
  • 1
    @naman Your last comment seems to be asking a new question, so please do that: ask a new question. This time include a MWE (a very small complete document with just the one mistake). Format it as code so we can cut and paste it and fix it. – Ethan Bolker Jun 10 '16 at 14:17
  • @naman Within the equation environment you don't need $ since \begin{equation} switch on the math mode. The warning you get only means that the \textbar command is not for use in math mode. – DRi Jun 10 '16 at 14:40
2

You need math mode: $(x,y,\theta)$.

Ethan Bolker
  • 9,333
  • 3
  • 42
  • 69
1

You need to be at math mode to enable Greek letters and other math symbols. you should write: $(x,y,\theta)$ or (x,y,$\theta$). I recommend the first version as it also write the x and y with a math type font, the same used on the equations.

Andre9
  • 11
  • 2