3

In this small snippet of code, I'm doing quick derivation to arrive at an equation to be used later in the analysis:

$
|\vec{F}|=q|\vec{v}||\vec{B}|sin(\theta)\\
m\frac{v^2}{r}=qvB\\
\frac{2qV}{r}=qvB\\
\frac{2qV}{r}=qB\sqrt{\frac{2qV}{m}}\\
\frac{V}{r}=B\sqrt{\frac{q}{2m}}\sqrt{V}\\
$
\begin{equation}
\frac{V}{r}=\lambda\sqrt{V},\lambda\equiv B\sqrt{\frac{q}{2m}}
\end{equation}

I am admittedly new to LaTeX, but not to programming or mark-up languages. I included

\usepackage{amsmath}

to be able to use

\begin{gather*}
\end{gather*}

but this nor align is working on either side of the dollar signs. I receive the error:

Missing } inserted. <inserted text> } \end{gather*}

Any information on the reconciliation of this problem is greatly appreciated.

  • 1
    Welcome to TeX.SX! You don't need the $ characters for align* or gather*. – user31729 Apr 18 '15 at 23:02
  • Lorentz force and centripetal force of a charge in magnetic field? ;-) – user31729 Apr 18 '15 at 23:18
  • Yup - specifically the Fine Beam Tube experiment for determining the charge-to-mass ratio of electrons! – Jeesubmyunu Apr 18 '15 at 23:24
  • Well, my students' favorite experiment. They like to deflect the beam with external magnets ;-) – user31729 Apr 18 '15 at 23:25
3

None of the align, gather and equation environments must be typeset within of a $...$ pair, since those environments start the math mode for themselves. This is true for the starred variants of the mentioned environments as well.

Some side remarks:

  • Use \sin instead of sin -- it's a math operator which should not be typeset in italics.
  • \dfrac{}{} is (sometimes) a better replacement for nicer fractions.
  • \DeclairedPairedDelimiters{\abs}{\lvert}{\rvert} is much better than |some stuff|

\documentclass{article}
\usepackage{mathtools}


\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\begin{document}
%$
%m\dfrac{v^2}{r}=qvB\\
%\dfrac{2qV}{r}=qvB\\
%\dfrac{2qV}{r}=qB\sqrt{\dfrac{2qV}{m}}\\
%\dfrac{V}{r}=B\sqrt{\dfrac{q}{2m}}\sqrt{V}\\
%$

\begin{align*}
\abs{\vec{F}} &=\abs{q}\abs{\vec{v}}\abs{\vec{B}}\abs{\sin(\theta)}\\
m\dfrac{v^2}{r}& =qvB\\
\dfrac{2qV}{r} &=qvB\\
\dfrac{2qV}{r} & =qB\sqrt{\dfrac{2qV}{m}}\\
\dfrac{V}{r} &=B\sqrt{\dfrac{q}{2m}}\sqrt{V}\\
\end{align*}

\begin{align*}
\dfrac{V}{r} &=\lambda\sqrt{V}  &\lambda\equiv B\sqrt{\dfrac{q}{2m}}
\end{align*}

\begin{gather*}
\dfrac{V}{r}=\lambda\sqrt{V},\lambda\equiv B\sqrt{\dfrac{q}{2m}}
\end{gather*}

\begin{equation}
\dfrac{V}{r}=\lambda\sqrt{V},\lambda\equiv B\sqrt{\dfrac{q}{2m}}
\end{equation}

\end{document}
  • I'd be tempted to insert \quad after the \lambda\sqrt{V}, terms in the gather* and equation environments. – Mico Apr 19 '15 at 1:42
  • 1
    @Mico: I left that as an exercise to the OP -- he will realize that it doesn't look very nice. And if egreg's thunderbold should struck me down, I have to stand it ;-) Thanks anyway – user31729 Apr 19 '15 at 1:43
  • 1
    shouldn't \DeclarePairedDelimiter be in the preamble? – barbara beeton Apr 19 '15 at 2:16
  • @barbarabeeton: Yes, of course. I was in a hurry. Thanks for notifying me – user31729 Apr 19 '15 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.