## LaTeX forum ⇒ Math & Science ⇒ Reference to Equation fails Topic is solved

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
GustavMJ
Posts: 2
Joined: Tue Apr 16, 2013 12:54 pm

### Reference to Equation fails

Hi!

I'm totally new to both this forum and to LaTeX and have a question regarding equation numbering. I have used the command \label inside one of my equations, but later when I use the \eqref I get an error saying:
Undefined control sequence [...] The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), type I' and the correct spelling (e.g., I\hbox').

I have checked so that the code is correctly spelled and everything looks fine, but still I get this error. My code looks like this.
\begin{equation}\label{eq:malus}I_\theta = I_0 {\cos}^2 \theta\end{equation}

Followed by \eqref{eq:malus}. I'm using the following packages and document class.
\documentclass[11pt]{article}\usepackage[left=1in, right=1in, top=1in, bottom=1in]{geometry}\usepackage{graphicx}\usepackage[T1]{fontenc}\usepackage{lmodern}\usepackage[utf8]{inputenc}

Thanks!
Last edited by localghost on Tue Apr 16, 2013 5:50 pm, edited 1 time in total.
Reason: Source code has to be tagged as such to keep a post clear and legible (see Board Rules).

Tags:

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am
You need to load the amsmath package.

\documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation}  \label{eq:malus}   I_\theta = I_0\cos^2\theta\end{equation} Reference: \eqref{eq:malus} \end{document}
Last edited by svend_tveskaeg on Tue Apr 16, 2013 5:59 pm, edited 2 times in total.
In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm
The \eqref` command is provided by the amsmath package which you missed to load.

Best regards and welcome to the board
Thorsten
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

GustavMJ
Posts: 2
Joined: Tue Apr 16, 2013 12:54 pm
Ah, thanks :]