TransWikia.com

Problems with referencing equations

TeX - LaTeX Asked by Talkingstreet on December 24, 2020

documentclass[10pt,a4paper]{article}
usepackage[utf8]{inputenc}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
title{Test File}
author{test}
date{today}
begin{document}
maketitle
section{Introduction}
This is the Introduction.
subsection{Some further intoduction}
equation: 
begin{equation}
a^{-n}=frac{1}{a^{n}} 
end{equation}

Whatever... For this reason... eqref{eq:1}
end{document}

When compiling this code, I get questionmarks in parantheses instead of a reference, but when I replace eqref with ref , it works (obviously without parentheses) Anyone know why?

2 Answers

eqref{eq:1} would reference the equation with label{eq:1} but you have no such label.

It is best to avoid numbers, use label{eq:myfrac} in the equation, then eqref{eq:myfrac} (Despite your comment in the question, ref would not work, and would give the same error as eqref on an undefined label.)

Correct answer by David Carlisle on December 24, 2020

One of the general advantages of LaTeX is that you can give things like figures, equations, tables, chapters, sections etc. labels with a name that means something to you, and when you compile that document LaTeX automatically assigns numbers to all of these things and inserts the correct numbers for all references.

When you are writing only a short document this step may seem as extra work to you, but once you start writing something longer, like a thesis, you will be really glad that you can insert or delete something on the top without having to change the numbering in the entire document by hand.

begin{equation} label{eqn:negative_power}
a^{-n}=frac{1}{a^{n}} 
end{equation}

Half of my students cannot understand equation ref{eqn:negative_power} despite my best efforts. 

Answered by terri on December 24, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP