[Tex/LaTex] bibliographies from different directory

bibliographiesbibtex

I would like to make a database bibliography file library.bib, then load it when I write a paper.

Though I already had a look this link, it seems not for my case.

Using the below command, I though I found the candidate paths for .bib:

kpsewhich -show-path=bib

then it returned the below paths:

.;%AppData%/MiKTeX/2.9/bibtex/bib//;%LocalAppData%/MiKTeX/2.9/bibtex/bib//;
%ProgramData%/MiKTeX/2.9/bibtex/bib//;%ProgramFiles%/MiKTeX/2.9/bibtex/bib//

Note that I use absolute paths which do contain not %AppData% but C:\Users\<User name>\AppData\Roaming.

So I set BibTeX Syncing path in Mendeley as one of the above path: %AppData%/MiKTeX/2.9/bibtex/bib//(even this folder didn't exist, I made it manually), now I have a library.bib file in this folder:

%AppData%/MiKTeX/2.9/bibtex/bib/library.bib

I though that it should work if I import this on my .tex such that

\bibliography{library}

but it returns an error

This is BibTeX, Version 0.99d (MiKTeX 2.9.6210 64-bit)
The top-level auxiliary file: myfilename.aux
The style file: style.bst
I couldn't open database file db.bib
---line 32 of file myfilename.aux
 : \bibdata{library
 :                 }
I'm skipping whatever remains of this command
I found no database files---while reading file myfilename.aux
Warning--I didn't find a database entry for "firstcitation"
(There were 2 error messages)

When I, however, assign the absolute path, then it works fine.

\bibliography{%AppData%/MiKTeX/2.9/bibtex/bib/library.bib}

Although there is a way to load my library.bib using absolute path, then there is no need to use TDS. Besides, I would like to use relative path not absolute path.

Can I use a relative path when I have library.bib in different directory from myfilename.tex?

Best Answer

Have a look at the suggestions in How to have access to (or manage) bib files in MiKTeX?. For MikTeX it seems to be necessary to use a subdirectory, e.g. %AppData%/MiKTeX/2.9/bibtex/bib/mybib/library.bib.

Related Question