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?
Asked
Active
Viewed 9.0k times
3 Answers
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
-
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
-
1In 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
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.
Claudio Fiandrino
- 63,575
Andre9
- 11
- 2
-
Welcome to TSE. Your answer adds nothing new to the already existing answers. – José Carlos Santos Nov 30 '21 at 09:23
\thetais a macro that need to be used within a math-mode. So you should use$(x,y,\theta)$to create an in-line mathematical environment (or replace$s by\[(opening) and\](closing) for centered formula in a new line). Or if you don't want to use math-mode, you can have a look on how to use greek letters in text without changing to math mode – ebosi Jun 10 '16 at 13:34