4

I'm writing my thesis (using a university-specific document type) and am importing many chapters (using the package import). Each chapter is taken directly from a latex file that once served as an article unto itself (with the preamble suitably removed). I also have each chapter print its own bibliography at the end of the chapter.

Unfortunately, many of the label names for sections and equations are the same across different chapters. For example, I might have two equations called \label{eq:schrodinger}, or two sections called \label{sec:intro}. I almost never want to cross-reference between chapters. I want each reference to an equation or section to refer to its own internal version. [The exception is my intro chapter, where I do refer to chapter numbers, but that's really not a big deal since it's not very common.]

Furthermore, I have the same problem with citations, since many chapters cite the same works, but I need those citations to appear (with the correct number) in each chapter. At the moment, latex has been ascribing each \cite{label} the number from the last occurrence of label in the entire document, rather than the occurrence of label in that chapter.

Is there any way I can fix these, by having all references/labels/citations internal only, so latex just ignores the existence of the other chapters' labels/bibitems when compiling the content of each chapter. Note that I use packages hyperref, cite, amsmath, amsthm (and many other packages), and have an automatically generated table of contents, which will undoubtedly add further complications.

I would really prefer not to have to re-label everything manually. Re-labelling sections and equations would be bad enough, but re-labelling citations would be very bad because I often use \cite{refa, refb, refc}. [Granted, with sufficient effort I suppose one can do https://xkcd.com/208/, but I would really prefer to keep the individual chapters unaltered.]

  • Might the combine package help? ctan.org/pkg/combine# . It may require some tweaking of the individual files, but not global relabelling. – Ethan Bolker Apr 1 '16 at 20:06
  • @EthaBolker combine seems not to work with hyperref, I think... – Peter Ebelsberger Apr 1 '16 at 20:12
  • Regarding the citations: with biblatex you could make each chapter a refsection. – Ulrike Fischer Apr 1 '16 at 20:38
  • 1
    What about the xr or xr-hyper packages to get the references from separate files correctly – user31729 Apr 1 '16 at 20:58
1

Regarding labels for equation and sections, I am able to mostly solve the issue by adapting the answer found at Using custom \locallabels command with custom \eqref command. Minor work is still required for inter-chapter cross-referencing, but as stated in the question, that seldom occurs in this case.

However, this does not fix the citation issue, which is the bigger issue.

[I apologize this is not posted as a comment to the question, which is my question. I don't have a high enough reputation since I just joined after posting this very question.]

  • you can comment on your own questions and answers. – naphaneal Apr 1 '16 at 20:54
  • @Naphaneal: It's the same user, but a different account ;-) – user31729 Apr 1 '16 at 20:54
  • 2
    Apparently you have two accounts. Please contact the SE staff to get the accounts merged – user31729 Apr 1 '16 at 20:55

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.