# LaTeX 'Missing $' Cannot find the reason So i am writing up some maths definitions for my exams and for some reason Texworks says that I have a 'missing$' in my line of work, however I cannot see anything wrong with it.

\subsection{Directional Derivative}
Let $\Omega \subset \mathbb{R}^n$ be open and let $f:\Omega \to \mathbb{R}$ be a continuosly differentiable scalar field on $\Omega$. Let $\vec{\hat{a}}$ be a unit vector in $\mathbb{R}^n$ Then:
$$D\hat{a}f(\vec{x_0})=\lim_{h \to 0}\frac{(f(\vec{x_0}+h\vec{\hat{a}}-f(\vec{x_0})}{h}$$
is the \bi{directional derivative} of fin the direction $\vec{\hat{a}}$

\subsection{ $\nabla$ Operator}
The \textit{\textbf{ $\nabla$ or del operator}} is written formally as
$$\nabla = \frac{\partial}{\partial x_1}\vect{e_1} + \frac{\partial}{\partial x_2}\vect{e_2}+ \dots \frac{\partial}{\partial x_n}\vect{e_n}$$

\subsection{Gradient}
Let $f:\Omega \to \mathbb{R}$ be a continuously differentiable scalar field on an open set $\Omega \subset \mathbb{R}^n$ Then:
$$grad \, f\equiv \nabla f:=\frac{\partial f}{\partial x_1}\vect{e}_1+\dots+\frac{\partial f}{\partial x_n}\vec{e}_n$$ is the \bi{gradient} on $\Omega$ which is itself a vector field. And is obatained by applying the $\nabla$ Operator to the function.

\subsection{Divergence of F}


If I ignore the error and force it to finish I get a weird repitition of e_1 getting smaller and smaller and then one partial derivative at the end.

When in fact it should be a sum of partial derivatives.

Does anybody know what I am doing wrong?

-
Please post a minimal working example illustrating the error. In particular, include the necessary packages from your preamble for reproducing the error. In particular, how are you defining \vect{} or which packages are you loading that provides that command? –  Willie Wong May 2 '13 at 11:09
If you format the LaTeX, it is probably much easier to see where it went wrong... a rapid check doesn't show any obvious problem. I'd suggest using $$...$$ and the equation environments, it is easier not to mess them up. The "missing $" is most often for using a math-only construct outside of math. – vonbrand May 2 '13 at 11:09 Note: unrelated to your problem I think, but you shouldn't use $$...$$, see Why is $…$ preferable to $$? – Torbjørn T. May 2 '13 at 11:18 With this \documentclass{article} \usepackage{amsmath,amsfonts} \let\vect\vec \let\bi\emph as a preamble, I have no problem. So there must be something else hidden in your preamble. – cjorssen May 2 '13 at 11:26 ## 1 Answer You're inconsistent in your typing. 1. Choose between \vec{x}_0 or \vec{x_0} and stick to the convention; in the example the first form is used, which seems to be more common. 2. Once you have defined \bi to give "bold italic", always use it. 3. Be careful with spaces in arguments. 4. Always use $...$ and not $$...$$ (see Why is $...$ preferable to$$ ...$$?). 5. \colon is preferred to : for function notation. 6. Punctuation should be consistent; a colon after "Then" doesn't seem necessary, while final periods are necessary. Whether adding them also to displayed equations that end a paragraph or a sentence is a matter of personal taste. 7. Don't use "hand made" operator names such as grad\,, prefer the higher level \DeclareMathOperator way. \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \DeclareMathOperator{\grad}{grad} \newcommand{\bi}[1]{\textbf{\textit{#1}}} % guess \begin{document} \subsection{Directional Derivative} Let$\Omega \subset \mathbb{R}^n$be open and let$f\colon\Omega \to \mathbb{R}$be a continuosly differentiable scalar field on$\Omega$. Let$\vec{\hat{a}}$be a unit vector in$\mathbb{R}^n$. Then $D\hat{a}f(\vec{x}_0)=\lim_{h \to 0}\frac{(f(\vec{x}_0+h\vec{\hat{a}}-f(\vec{x}_0)}{h}$ is the \bi{directional derivative} of fin the direction$\vec{\hat{a}}$. \subsection{$\nabla$Operator} The \bi{$\nabla$or del operator} is written formally as $\nabla = \frac{\partial}{\partial x_1}\vec{e}_1 + \frac{\partial}{\partial x_2}\vec{e}_2+ \dots \frac{\partial}{\partial x_n}\vec{e}_n.$ \subsection{Gradient} Let$f\colon\Omega \to \mathbb{R}$be a continuously differentiable scalar field on an open set$\Omega \subset \mathbb{R}^n$. Then $\grad f\equiv \nabla f:= \frac{\partial f}{\partial x_1}\vec{e}_1+\dots+\frac{\partial f}{\partial x_n}\vec{e}_n$ is the \bi{gradient} on$\Omega$which is itself a vector field. And is obtained by applying the$\nabla$Operator to the function. \subsection{Divergence of$F\$}
\end{document}

-
Actually I'd recommend the equation* env over $...$, but that is just because it is easier to change in Emacs ;-) –  daleif May 2 '13 at 11:42