I am going to write my PhD thesis. I have 7 to 8 papers written in latex. Now I want to compile all the papers in to chapters of thesis. Since all the paper have almost common equation labels so when I compile my latex file then wrong equations get referred from same label in other chapters. Is possible to avoid mixing of equation within different chapters of thesis, so that I can refer an equation independent within same chapter without bothering the similar equation labels in other chapters? Or I need to compile chapter differently into single file by using command \include{chapterX} ?

Here is example code:

{\Large This is my thesis}
\vskip 5pt
\section{This is my Introduction}
Here is my equation
I can refer this equation as \eqref{1}. But since chapter 1 and 2 have common labels so the wrong equation get referred. 
\section{This is second Chapter}
Here is my another equation in second chapter 
I can also refer this equation as \eqref{1}. How I can refer equation in a chapter without mixing labels from other chapters ?
  • 1
    I'm not so experienced, but I think the problem you have is due to same equations labels in different chapters. IMO the only option you have is to give labels some unique value, e.g. "ch1:eq1" for 1st equation in chapter 1 and "ch2:eq1" for 1st equation in chapter 2. Mar 1 '17 at 10:24
  • 1
    Labelling with \label{1} and \label{2} is apparently not the best way of using labels. Repeating the label with the same label identifier is an error and you should have noticed the warning messages about multiply defined labels
    – user31729
    Mar 1 '17 at 10:51
  • 1
    @ChristianHupfer: I have found solution my problem, see answer to my own question. Now next problem is, how I can refer equation from chapter 2 in chapter 3 when I have similar labels in both chapters. The both chapters are saved in different Tex files by different names.
    – IgotiT
    Mar 1 '17 at 11:53
  • 3
    @IgotiT: No, that's not the solution actually. Again: Don't repeat label names!
    – user31729
    Mar 1 '17 at 12:01
  • 1
    @ChristianHupfer: What should I do now!!! I completely messed my latex source code with similar label. Is there any solution or I have to change labels or should take output for each chapter as pdf and then combine pdf?
    – IgotiT
    Mar 2 '17 at 0:53
  • Just open every article (LaTeX document) separately and search and replace \label{ with \label{Paper01_ and so on.
  • search and replace should be possible with most decent text or LaTeX editors.
  • Do the same for \eqref{ and \ref{.
  • Do it for every article, Paper01 to Paper_07.
  • Then you can combine the LaTeX codes of the different articles and the labels are unique!

And, of course, do all that with a copy of your project files in case something goes wrong.

  • I had to do the same as you suggested. Thanks.
    – IgotiT
    Apr 15 '17 at 7:18

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.