LaTeX forum ⇒ Math & ScienceReference to Equation fails Topic is solved

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

Reference to Equation fails

Postby GustavMJ » Tue Apr 16, 2013 1:03 pm


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.
  1. \begin{equation}
  2. \label{eq:malus}
  3. I_\theta = I_0 {\cos}^2 \theta
  4. \end{equation}

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

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).


User avatar
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Postby svend_tveskaeg » Tue Apr 16, 2013 5:51 pm

You need to load the amsmath package.

  1. \documentclass{article}
  3. \usepackage{amsmath}
  5. \begin{document}
  7. \begin{equation}
  8. \label{eq:malus}
  9. I_\theta = I_0\cos^2\theta
  10. \end{equation}
  12. Reference: \eqref{eq:malus}
  14. \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)

User avatar
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Tue Apr 16, 2013 5:53 pm

The \eqref command is provided by the amsmath package which you missed to load.

Further reading:

Best regards and welcome to the board
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes

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

Posts: 2
Joined: Tue Apr 16, 2013 12:54 pm

Postby GustavMJ » Tue Apr 16, 2013 5:58 pm

Ah, thanks :]

Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 1 guest