0

I have a project with several tex files in different folders, all of which use the same bib file that is in the parent folder:

ref.bib
Folder1 -> file1.tex
Folder2 -> file2.tex
...

I compile the tex files with TexStudio. Inside the tex files, I can reference ref.bib as follows:

\bibliography{../ref}

However, my colleagues work in Overleaf. There, for some reason, this does not work, and they have to reference it as follows:

\bibliography{ref}

Probably, TexStudio looks for bib files in the folder of the current tex files, while Overleaf looks for them in the root of the current project.

The bib file changes frequently, so duplicating it to the different folders is not a good option.

Is there a way to make this work on both TexStudio and Overleaf?

NOTE: I am on Windows 10.

1 Answer 1

2

You could use \bibliography{ref} and locally set BIBINPUTS enviornment variable to the parent directory but perhaps simpler would be to use

\bibliography{\ifnum\pdfstrcmp{\jobname}{output}=0 ref\else ../ref\fi}

as Overleaf always sets the jobname to output

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .