Including several tex files in one: multiple defined labels

  • Context: LaTeX 
  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    files Multiple
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 3K views
member 428835
Hi PF!

I have a divided a main.tex into chapters, chapter_1.tex, chapter_2.tex... Each chapter is included in the main.tex via \include{chapter_1}. Each chapter also references equations. Is there a way to have each of the chapter_1.tex only reference that file's equations, sections, figures? As is, I have multiple defined labels.

Thanks so much!
 
Physics news on Phys.org
Why don't you generate the pdf for each chapter separately, and then combine them into one file? This would be better than including all those chapters into the main .tex file. Adobe online, for instance, allows you to combine files for free.
 
Why not simply change the labels? Each file/chapter could have its own label prefix to make sure there can be no multiply defined labels (it is easy to perform a search and replace in each file to include those prefixes).
 
Reply
  • Like
Likes   Reactions: member 428835, Orodruin, pasmith and 2 others
Wrichik Basu said:
Why don't you generate the pdf for each chapter separately, and then combine them into one file? This would be better than including all those chapters into the main .tex file. Adobe online, for instance, allows you to combine files for free.

That breaks things if one chapter makes references to the content of another, or you have page references, or you want to generate a single bibliography for the entire work.
 
Reply
  • Like
Likes   Reactions: Wrichik Basu, member 428835 and FactChecker
Thanks everyone. I'll just rename the equations. Wasn't sure if there was a package available that made this simple, but this is still very easy.