Math & ScienceUndefined control sequence

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Bravus
Posts: 4
Joined: Sun Aug 04, 2013 10:11 am

Undefined control sequence

Post by Bravus »

Typing this sentence as part of my Masters literature review in physics:

Code: Select all

Gauss' law for electricity can be stated as $\nabla$$\cdot$E = $\rho$\textsubscript{f}/$\varepsilon$ where E = electric field strength (Vm\textsuperscript{-1}), $\rho$\textsubscript{f} = electric charge density (Cm\textsuperscript{-3}) and $\varepsilon$ = permittivity of the medium (Fm\textsuperscript{-1}).
I get an '!Undefined control sequence' error that seems to relate to this bit: "$\nabla$$\cdot$E = $\rho$\textsubscript{f}/$\varepsilon$" (without the quotes)

Three Greek letters (plus an upside down one, I guess, a dot and a fraction...

Any help with what's breaking?
Last edited by cgnieder on Sun Aug 04, 2013 10:42 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Bravus
Posts: 4
Joined: Sun Aug 04, 2013 10:11 am

Undefined control sequence

Post by Bravus »

Error message line breaks as follows:

Code: Select all

$\nabla$$\cdot$E = $\rho$\textsubscript
                                {f}/$\varepsilon$
Last edited by cgnieder on Sun Aug 04, 2013 10:42 am, edited 1 time in total.
Bravus
Posts: 4
Joined: Sun Aug 04, 2013 10:11 am

Undefined control sequence

Post by Bravus »

Hmm, looks like \textsubscript was both a longwinded and a plain bad way of doing it!

This worked:

Code: Select all

Gauss' law for electricity can be stated as $\nabla$$\cdot$E = {$\rho_{f}$/$\varepsilon$ where E = electric field strength (Vm\textsuperscript{-1}), $\rho_{f}$ = electric charge density (Cm\textsuperscript{-3}) and $\varepsilon$ = permittivity of the medium (Fm\textsuperscript{-1}).
Last edited by cgnieder on Sun Aug 04, 2013 10:43 am, edited 1 time in total.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Undefined control sequence

Post by cgnieder »

The message tells you that the command \textsubscript doesn't exist. And it doesn't without special packages or another than one of the standard classes. However, it would be wrong to use it for math typesetting, anyway. Here's how I'd do it:

Code: Select all

\documentclass{article}
\usepackage{amsmath}% typesetting math
\usepackage{siunitx}% typesetting units
\begin{document}

Gauss' law for electricity can be stated as $\nabla \cdot E =
\rho_{f}/\varepsilon$ where $E$ = electric field strength
(\si{\volt\per\metre}), $\rho_{f}$ = electric charge density
(\si{\coulomb\per\metre\cubed}) and $\varepsilon$ = permittivity of the medium
(\si{\farad\per\metre}).

\end{document}
You may be interested in mathmode, amsmath and siunitx for further reading.

Regards
site moderator & package author
Bravus
Posts: 4
Joined: Sun Aug 04, 2013 10:11 am

Re: Undefined control sequence

Post by Bravus »

Excellent, thank you. Ended up getting it, and it didn't look too dissimilar, though I like the way you've laid it out for clarity.

Thanks - still a newbie, teaching myself as I go along... no doubt it'll get a lot easier with more practice.
Post Reply