# Changing the number of figure or equation automatically in text by changing the places of figures and equations

Is it possible to automatically reference a figure and equations in text? I meant sth like bibliography references. Moreover, by changing the place of the figures or equations relevant figure or equation number can be changed automatically in text. Exp.:

In remote sensing Equation 1. is applied widely.

Equation 1. x= a+b

-
+1 because it's something newbies would want to know but you should really read a LaTeX introduction e.g. "A not so short introduction to LaTeX". It will provide this and many other things that you don't even know you need :) – recluze Dec 6 '12 at 13:41
@recluze I will just add that that you can find this document in many languages: ctan.org/pkg/lshort – yo' Dec 6 '12 at 13:44

Do you mean something like

\documentclass{article}
\begin{document}

$$\label{eq:abc} a^2+b^2=c^2$$

The Theorem of Pythagoras says that as soon as equation \ref{eq:abc} is satisfied, ...
\end{document}


If this is what you mean, the preferred variant for cross-referencing equations is the one provided by the amsmath package:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$$\label{eq:abc} a^2+b^2=c^2$$

The Theorem of Pythagoras says that as soon as equation~\eqref{eq:abc} is satisfied, ...
\end{document}

-

Be smart and use some smart package :-):

\documentclass{article}
\usepackage{cleveref}
\begin{document}
In remote sensing \cref{eq:myeqn} is applied widely. \Cref{eq:myeqn} is my equation.

$$\label{eq:myeqn} x = a + b$$
\end{document}


For details refer the documentation (run texdoc cleveref from command prompt). With hyperref loaded, the links can be made click-able. You may also be interested in varioref and prettyref. Please go through their documentation and also refer to this answer by @cmhughes.

-

To complete the answers by adding solutions for figures and tables. When you add figures and tables with their respective environments \begin{figure} ... \end{figure} and \begin{table} ... \end{table} you can add a label to each using the \label{} command inside the \begin{} ... \end{}. A minor point but one I find useful is to add something to the label that identifies the kind. Hence, I add start the labels with eq: fig: and tab:. A reference to a figure in a figure object would then be made with \ref{fig:xxx} and th eobject defined as

\begin{figure}[ht]
\includegraphics{filename}
\caption{figure caption text}\label{fig:xxx}
\end{figure}

-
Yes, good point – Peter Jansson Dec 6 '12 at 16:49