# Including several tex files in one: multiple defined labels

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!

Wrichik Basu
Gold Member
2020 Award
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.

DrClaude
Mentor
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).

joshmccraney, Orodruin, pasmith and 2 others
pasmith
Homework Helper
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.

Wrichik Basu, joshmccraney and FactChecker
Orodruin
Staff Emeritus