[Tex/LaTex] automatically update \addbibresource file path

biblatexbibliographieswinedt

Is there a way to automatically update the file path of where my references are stored? I keep them in a folder "References". This is the full path to my references:

\addbibresource{C:/Users/bossman/Desktop/Document/References/chap1.bib}
\addbibresource{C:/Users/bossman/Desktop/Document/References/chap2.bib}
\addbibresource{C:/Users/bossman/Desktop/Document/References/chap3.bib}
\addbibresource{C:/Users/bossman/Desktop/Document/References/chap4.bib}

The main folder "Document" is where all my tex and other related files are stored. If I move the Document folder now to let's say F:/LatexFiles, or even another computer, my \addbibresource complains and I have to go and update the path now manually. Is it possible to automate this filepath name?

Here is a screen shot of my folder structure. The References folder is where my .bib files are in:

enter image description here

and here is the References folder with my chap.bib files:

enter image description here

Best Answer

UPDATE

In WinEdt 9.1 build 20150713 the bug described below has been solved.

Simply use

\addbibresource{References/chap1.bib}
\addbibresource{References/chap2.bib}
\addbibresource{References/chap3.bib}
\addbibresource{References/chap4.bib}

and biber will compile your bibliographies correctly.


ORIGINAL ANSWER

The correct way is to use

\addbibresource{References/chap1.bib}
\addbibresource{References/chap2.bib}
\addbibresource{References/chap3.bib}
\addbibresource{References/chap4.bib}

But you are using WinEdt 9 and there is a bug in the compiler script for BibTeX and biber which prevents biber to run successfully when you redirect your auxiliary files to another folder.

To circumvent this (it will be fixed in the next release of WinEdt), open the file BibTeX.edt (it should be somewhere like C:\Program Files\WinEdt 9\Exec\TeX), then open the Options Interface and click on "Advanced Configuration".

Now click on the button "Create and Open Local Copy". A modifiable local copy of BibTeX.edt gets opened.

enter image description here

Just after the line

  IfIStr("%$('%!9-Executable');","bibtex.exe","<>",!"LetReg(3);");

insert the lines

  IfIStr("%$('%!9-Executable');","biber.exe","=",>
    !|IfStr('%O','%P','<>',!`LetReg(3,'--input-directory "%P"');`);|);

Now save the file and the job is done.

Try recompiling your file and now WinEdt correctly runs biber on your bibliographies.

Related Question