# Getting missing $error but I don't know where to put it Newbie in LaTeX here. On this the line I'm getting "missing$" error but I don't know where exactly it wants me to put it:

$g_2$= $N_2${$f_2$ - (\underbrace($\int_a^b g_1^{*}f_2dx$)_{$g_1^t\cdot f_2$} $g_1$}\\

Someone help?

• Please post a Minimum Working Example. That is, compilable code which shows the problem. I think you are using mathematical commands outside the mathematical environment. So \underbrace, for example, is not within the scope of the $signs yet I think it is maths (not text). The same is true of the _ between dx$) and {$g. I'm not sure what you are trying to typeset but why do you keep switching from maths to text like that? – cfr Dec 20 '13 at 3:47 • Let$f_1\ldots$be complete and normalized\Then take$g_i = N_1f_1$\$g_2 $=$N_2${$f_2$- ($\int_a^b g_1^{*}f_2dx$)$g_1^t\cdot f_2g_1$}\$\vdots$\$g_n = N_n { f_n - \displaystyle\sum_{r=1}^{n-1}(\int_a^b g_r^* f_n dx)g_r}$\\ That's what I had before but for \int_a^b g_1^{*}f_2dx I need to put something underneath and I don't know how to do it. I was told \underbrace would work but I just kept getting$ errors. – Dr. A Dec 20 '13 at 3:55
• Sorry, but this looks to me, that you lack some basic knowledge. Read an introduction to LaTeX. A (not so) “Short Introduction to LaTeX2ε” in different languages is included in all big TeX distributions. See also What is the best book to start learning LaTeX? and LaTeX Introductions in languages other than English. – Speravir Dec 20 '13 at 4:00

I'm a bit confused about what you're trying to produce here, but you've definitely split up a math expression that shouldn't be split up.

Your use of square brackets and curly brackets it a bit confusing.

Try something like (my best guess at what you meant, though I find it a bit odd):

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

$g_2 = N_2 f_2 - \bigg(\underbrace{\int_a^b g_1^{*}f_2dx}_{g_1^t\cdot f_2} g_1\bigg)$

\end{document}

\underbrace takes two arguments and should be written as

$\underbrace{<math stuff>}{<content for brace>}$

Or perhaps you meant:

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

$g_2 = N_2 \bigg\{ f_2 - \underbrace{\int_a^b g_1^{*}f_2dx}_{g_1^t\cdot f_2} g_1 \bigg\}$

\end{document}

• Thanks, but there has to be a curly bracket after N_2 and at the end of the equation. I typed in what you did and now I have a "Missing } inserted" error. – Dr. A Dec 20 '13 at 4:25
• @user42999 I've updated the answer. LaTeX what's its braces and brackets to be balanced. Check your code and make sure you've not forgotten a } or perhaps you have them improperly balanced. – A.Ellett Dec 20 '13 at 4:36
• @user42999 To obtain a curly bracket, you should type \{, \}, as in the example. Without it TeX thinks that they are grouping braces. – Przemysław Scherwentke Dec 20 '13 at 4:40

For the version from your comment, without \underbrace. General rule: open math mode and stay within it through the full formula, if possible.

\documentclass{article}

\begin{document}

$g_2 = N_2{f_2 - (\int_a^b g_1^{}f_2\,dx)g_1^t\cdot f_2g_1}$

\end{document}

Probably you want a different equality, but the general rule is clear: one opening and one closing math sign.