0

I am using the procedure in writing a document of setting a main page and including sections in side tex documents using \include{...}. In one section I have an equation that I labeled as \label{6}. This equation I want to ref to in another section but when I type \ref{6} nothing ever happens and it does not refer to this equation because it is in another section. What should I do to solve this problem? Because my document could be subjected to a lot of editing, I do not want simply to write equation (6) without this label and refer procedure.

My question: How to refer to an equation in one section if the equation in mind is in another section?

  • It's generally a good idea to make your labels a little more explicit. For example, many people preface their equation labels like \label{Eqn:6} and sections like \label{Sec:6} to avoid confusion or possible duplication. – grfrazee Aug 11 '15 at 12:58
  • What exactly does "nothing ever happens" mean? Do you get a warning or error message? Have you checked that the tex files that contain the statements \label{6} and \ref{6} are both \included in the main tex file? Incidentally, to avoid the nearly inevitable confusion over whether 6 refers to an equation, a section, or something else entirely, it's considered good practice to be a bit more verbose when setting up labels. E.g., if you wrote \label{eq:6} (and, elsewhere in the document, \ref{eq:6}) no confusion would arise to begin with. – Mico Aug 11 '15 at 12:58
  • Also, having a minimum working example (MWE) would be helpful here. Are you using the package hyperref? – grfrazee Aug 11 '15 at 12:59
  • 1
    The answer is "the same way you would refer to an equation in the same section". As Mico says, as long as both sections are included in the document, and you use the same, unique, label, then this should work. Edit: in other words, we would need some more information about your setup to give more specific advice, I think. – Torbjørn T. Aug 11 '15 at 13:15
2

The best practice to label equations, chapter, section, images and tables is to use a labeling system like this:

\label{what:name}
  • with what you name the type you label, for example you can use equ for equations, cha for chapter, sec for section, fig for figures and images and tab for tables
  • with name you create a name that is easy to remember.

The complete label (what:name) should be unique: in your hole document there is only one such a label!

The advantage is, that you now can name everything to be easy located. For example, if you have an image of Einstein you label it \label{fig:einstein}, if you have the famous equation E=mc*c you can label it \label{equ:einstein} and if you have a table with calculated values for the equation you label it \label{tab:einstein}. Now all references exists only one time, but you can easy remember them.

Then it does not matter where in your document the labels are used. because they do exist only one time in your document (that's the trick with this best practice) you can refer to them where ever you need with \ref{fig:einstein} etc.

Your \label{6} has another disadvantage: Suppose your equation 6 has to be removed where it stood and to be added three pages later, now beeing equation 12. Be sure you will never remember this and your references will become incorrect. An label existing surely only one time is the best you can do and with good naming you can easy remember the label.

  • Wow, almost one year without upvote! ... Well, almost ;-) – user31729 Feb 3 '17 at 21:47

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.