Bibliography imported from main and subfiles

biblateximportpackagessubfiles

I have a bib file that I need several subfiles to have access to. Currently the file structure is:

project
   main.tex
   Bib.bib
       Chapters
           Chapter1
               Chapter1.tex

I can run either the main.tex and have the bib display correctly using\addbibresource{Bib.bib} or I can have the subfiles (in this case Chapter1.tex) run correctly by having \addbibresource{../../Bib.bib} in the main.tex file. How can I have both documents run without having to change the code in main.tex each time or without using the full directory?

I understand for images and other documents the correct tool would be the import package described in this question but that doesn't appear to work correctly with biblatex.

Best Answer

If you want to compile your included files also as standalone documents, you need something more than just \input or \include.

One solution that generally works well with biblatex is subfiles, which has the magic command \subfix to fix file path mismatches caused by different working directories.

ST3: no bib files found in a subfile and When using subfiles package, where it the proper location to add the bibliography files? have elaborate examples, so suffice it to say here that it is probably enough to use .bib file names relative to the main .tex document wrapped in \subfix, e.g.

\addbibresource{\subfix{Bib.bib}}