If I am writing a LaTeX document on TexMaker and I want to number my equation but most probably I will be adding details later on and I do not want to fall into retyping it all over again. So if for example I have an equation and currently called equation (1.2) that I want to refer later as in the following sentence "As you can see in (1.2)" but then I had to edit my document in a way that it becomes (1.3) now instead of (1.2) what should I do in order to avoid editing large number of equations and my reference to them?

  • 2
    How are you currently numbering your equations? Are you using the equation environment? – Werner Feb 22 '15 at 21:40
  • 1
    Use the \label and \ref commands (and possibly \eqref from the amsmath package). en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing – Franck Pastor Feb 22 '15 at 21:40
  • and if I want to label them as (1.1) instead of (1)? Also please write it as an answer so I can choose it as best answer because it answered my question. – user72867 Feb 22 '15 at 21:46
  • @Werner I haven't yet numbered anything – user72867 Feb 22 '15 at 21:47

LaTeX supports this cross-referencing mechanism out-of-the-box. Fundamentally you should use

  <your equation here> \label{<label>}

for single-line equations, and amsmath's align-style environment for multi-line equations (you can also use it for single-line equations). For example,

  <eqn 1 LHS> & <eqn 1 RHS> \label{<label1>} \\
  <eqn 2 LHS> & <eqn 2 RHS> \label{<label2>} \\

See the mathmode document for a host of examples on the amsmath align-environment usages, as well as others.

The above allows you to use \ref{<label>} inside your document to obtain the number/label associated with <label>. It's better to \usepackage{amsmath} and to use \eqref{<label>} just because this includes the (..).

\labels are stored in the .aux, and may only settle after a second compilation. So, if things move around, make sure to compile twice. See Understanding how references and labels work.

If you want to change the numbering of the equations (from say (1.1) to (1)), see Continuous v. per-chapter/section numbering of figures, tables, and other document elements. The chngcntr package is useful for adjusting the resetting of the numbering scheme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.