1

I want to cite references within a subfile and have the subfile correctly compile, but I seem not to be able to access my .bib from the subfiles, since it always gives me an error message when I try to do so.

An MWE is as follows:

 \documentclass[12pt,a4paper,twoside,final]{memoir}
 \usepackage[T1]{fontenc}
 \usepackage[utf8]{inputenc}
 \usepackage[english]{babel}
 \usepackage{subfiles}
 \usepackage[
  backend=biber,
  style=authoryear-icomp,
  sorting=nyt
  ]{biblatex}
    \addbibresource{/bib/ref.bib}
  %End of Preamble
  \begin{document}
  \subfile{chap/chapter1/ch1.tex}
  \printbibliography
  \end{document}

And in my ch1.tex file I have the following set:

 \documentclass[../../thesis.tex]{subfiles}
 \begin{document}
 \chapter*{1}
 Testing a citation \cite{Aigner2014}.
 \end{document}

Where the cited entry is to be found in the ref.bib inside the bib-subdirectory of my main-directory. However, when I try to compile the document, biber gives the following error:

INFO - This is Biber 1.9 INFO - Logfile is 'ch1.blg' INFO - Reading 'ch1.bcf' INFO - Found 1 citekeys in bib section 0 INFO - Processing section 0 INFO - Looking for bibtex format file '/bib/ref.bib' for section 0 ERROR - Cannot find '/bib/ref.bib'! INFO - ERRORS: 1 Process exited with error(s)

Is there any possible way to make the ch1.tex file able to find my ref.bib file?

I have tried the workaround provided in the answer here, but it doesn't seem to help me anyway. I can't make much sense of the code there however.

Any help is much appreciated!

Bartuc
  • 297
  • 1
    Did you try to remove the leading / from /bib/ref.bib. /bib/ref.bib looks like an absolute file path, where the bib directory sits in the root of your computer. – Guido May 12 '16 at 23:53
  • Just to expand on Guido's comment: there is a big difference between /bib/ref.bib and bib/ref.bib (the former is, on many systems, an absolute path, the latter is relative). In general, however, if you want a 'clean' working directory, why not simply put the .bib file where TeX will naturally search for it (as Kurt suggests)? (For me, that would be ~/texmf/bibtex/bib/.) – jon May 13 '16 at 03:03
  • @Guido I did try to change it to what you suggested, but the subfile is still not able to find the bib file. I have not tried localtexmf, but it seems like it is supposed to be a subdirectory inside my tex distributions directory. I would very much like the structure to stay as it is, since it feels more natural to have the project files in the same directory. I am on Windows 7 using TexLive 2014. – Bartuc May 13 '16 at 07:20
  • I have also tried putting in the code \addbibresource{../../ref.bib} into the preamble of both the mainfile and the subfile and moving the bib file out into the directory alongside the mainfile, but this does not work either. – Bartuc May 13 '16 at 11:49
  • 1
    I solved it by modifying the code from here – Bartuc May 13 '16 at 12:17
  • 1
    It may be closed yes. – Bartuc May 16 '16 at 20:27

0 Answers0