1

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?

actlee
  • 147
  • Does kpsewhich find the file, i.e. what is the output of kpsewhich library.bib? – Ralf Stubner Sep 01 '17 at 18:07
  • @RalfStubner if I hit kpsewhich library.bib, no response returns. if typing kpsewhich -show-path=***.bib it always returns same results what I wrote above. – actlee Sep 01 '17 at 19:05
  • Have a look at https://tex.stackexchange.com/questions/20796/how-to-have-access-to-or-manage-bib-files-in-miktex. I found the suggestion to use a subdirectory particularly interesting. I have no MikTeX and cannot compare. The equivalent of your approach works with TeXLive on Linux. – Ralf Stubner Sep 01 '17 at 19:31
  • @RalfStubner It works fine so far!! But one important thing is that it needs to restart the LaTeX editor when .bib has been changed. :) It does not matter at all so this is exactly what I wanted to do!! Why don't you write as the answer, then I definitely pick it up! Thank you! – actlee Sep 02 '17 at 11:04

1 Answers1

0

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.

Ralf Stubner
  • 2,614