74

problem

Hello All,

I have the possibility of a centralised, updated .bib file using Mendeley Desktop. This file will stay updated with all the changes I make using my Mendeley citation software.

I want to access this centralised .bib file via biblatex from any .tex scripts from any possible directory

possible solutions

I've read that I can place my .bib file somewhere in the root of my latex install, so it can be found by latex from any tex file, but I'm not sure where to exactly place it?

I don't think it's possible, but perhaps there are options to declare the path in the \bibliography{bibliography} declaration?

note

I would like to use biblatex with biber.exe

lockstep
  • 250,273
Timtico
  • 2,250
  • 3
    with bibtex at least, you can have full paths in your \bibliography. For example, my standard working template has \bibliography{../bib_files/jabrefmaster.bib} and running bibtex against filename.aux works just fine. I'd assume this would also be possible with biblatex? – Willie Wong Dec 09 '10 at 15:05
  • biblatex does allow relative path names in the \bibliography command... – Seamus Dec 09 '10 at 15:23
  • I am using texshop on mac, I just wrote \bibliography{./bibfolder/file} and compile with macros - applescript - bibliorgaphy and it works. – zyy Sep 24 '18 at 02:52

8 Answers8

32

You can store your bib file in $LOCALTEXMF/bibtex/bib or any subdirectory of it. Then LaTeX (and BibTeX, biblatex, and biber) will find it. Note that you have to update the filename database whenever you put a new file in this location (but not when the file is only updated). The $LOCALTEXMF part can be any directory which is known to your TeX distribution. For further information about this, see the TeX FAQ:

domwass
  • 11,563
  • @matth, this file normally resides in the distribution’s TEXMF tree under doc/latex/biblatex/examples/biblatex-examples.bib. – domwass Mar 08 '12 at 07:22
  • no, it’s $TEXMF/doc/latex/biblatex/examples/biblatex-examples.bib, as I said (c: But, of course, as long as bibtex/biber finds it (and that should be the case in a standard installation), you don’t have to know the exact location. – domwass Mar 08 '12 at 08:16
  • thanks, I guess it is too early for me... deleted my comments with wrong path. – matth Mar 08 '12 at 08:18
  • Well, your first comment was quite useful, I just wanted to give the corrected path to biblatex-examples. – domwass Mar 08 '12 at 08:25
18

Another possibility is to call bibtex with the --include-directory flag. So, instead of,

bibtex myfile.tex

do

bibtex --include-directory="path/to/bibliography/folder" myfile.tex

This is a particularly easy solution if you're using a dedicated editor such as Texmaker, WinEdt, TeXnic Center or emacs with AUCTex. In Texmaker, you can edit the bibtex command used by the editor by going to Options -> Configure Texmaker -> Commands. Directions for the other editors I mentioned are described in this post.

15

Since v1.2, biblatex supports remote location of bibliography resources (i.e. resource from a website); this feature requires Biber as backend (and the use of the \addbibresource command which replaces \bibliography). See section 3.7.1 of the biblatex manual for details (http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf).

moewe
  • 175,683
lockstep
  • 250,273
12

As mentioned in other comments bibliography can have relative pathnames to reference a location:

\usepackage[backend=bibtex]{biblatex}
\bibliography{../../Mendeley/myBibFile}

\begin{document}
This is an example \cite{peter1999}
\end{document}

(Depending on your backend you need instead to use \addbibresource or refence the bib-file including its ending ("myBibFile.bib")

Tapper
  • 361
4

Neither do I, but a few solutions are described over there. I personally like to store all *.bib files in one directory and then to use symbolic links from my paper's directory, but I still need to specify exactly which files I need in the \bibliography command.

Creating a symbolic link in Linux

To create a symbolic link file in your paper's directory to your master bib file you can write

ln -s <path to master bib file> link.bib

then in your latex file refer to link.bib rather than the master bib file. See https://kb.iu.edu/d/abbe

Stefan Pinnow
  • 29,535
2

Have you experimented with

bibber.exe --output_directory <d>

?

Files (.bbl and .log) are output to directory instead of the current directory. Input files are also looked for in before current directory.

I just tried that, it works exactly as I need.

1

How about setting the BIBINPUTS environment variable to include the shared directory that holds your bib file? This gives you complete freedom over where you put it. I use that to specify a directory where we store one shared bib file. Oddly, it doesn't seem to be mentioned at all in the TeX Frequently Asked Questions although I may have just missed it.

Simd
  • 6,785
0
\bibliographystyle{plainnat}

\bibliography{/Volumes/cld/Dropbox/Articles/references}  %take care don't write '...  **.bib**'

\end{document}
Mensch
  • 65,388
Joe
  • 11
  • 2
    Welcome to TeX.SE! Please do not only post a code snippet, explain also in your word what the solution is and why. (And no, I did not downvote!) – Mensch Aug 01 '19 at 16:47
  • 1
    @down-voter: Please don't downvote below a score of -1, even if the question in its current form needs some improvement. A score of -1 is enough to show that the question needs work, anything below that is of no use. Also, if you downvote or vote to close, please leave a comment explaining why you did so, but wait at least 24 hours after asking the OP for improvements to the question before voting to close. – Mensch Aug 01 '19 at 16:49
  • I know this isn't the best answer in terms of its format, but the code did actually help me with the problem, so I've upvoted. – Jim421616 Jul 31 '22 at 22:16