4

I am very new at LaTeX, so please bear with me if I am re-posting something. I have found a lot of info online, but nothing simple enough for me to duplicate it.

I am trying to set-up my document to use a bib file in a local directory, so that multiple documents can share the same bib file. I will need the tex files to be able to link to this bib file, regardless of the tex file location on my machine.

I have the following code to start my document,

\documentclass[aip]{revtex4-1}
\begin{document}
\title{Connecting  a detection system net for Interplanetary counterparts of Coronal Mass Events to warning signals aimed in a spherical pattern to activate automated emergencies procedures aboard interplanetary space craft}
\author{\firstname{Sara-jeanne} Vogler}
\date{\today}
\maketitle
\section{Premises}
    hello\cite{Vog13a}
\section{Technique}
    \subsection{Timeline}
\section{Evaluation}
\bibliography{C:/LocalTexFiles/bibtex/bib/sarabibs}
\end{document}

My bib file is in C:\LocalTexFiles\bibtex\bib\misc and C:\LocalTexFiles has been added as a Root Directory in MikTex Maintenance Options.

The messages during compile says

I couldn't open database file C:/LocalTexFiles/bibtex/bib/sarabibs.bib and the pdf shows a ? instead of a numerical citation within the text.

  • 1
    Use simply \bibliography{sarabibs} – Ulrike Fischer Jan 9 '14 at 0:21
  • Well, you no need to complicate your life so much. I'm not shure why you should not place your .bib file in that path. Just to be tidy and have everything in the same directory. Just place the .bib file in that folder and ensures that your .tex documents will use that .bib file are on the same directory or in a subdirectory and problem solved. You don't need to specify paths. – Aradnix Jan 9 '14 at 5:08
1

For example, I have stored central master bib file in the path:

c:\Users\jafa\Documents\Wiking\localtexmf\bibtex\bib\local\MasterBiblioLib.bib

Subdirectories \localtexmf\bibtex\bib\local are required. Then, in the MikTeX options on card Roots add your path. It works also on Windows 10.

enter image description here

0

I have also met this perplexing problem. I want multiple .tex files can share the same .bib file. Actually, using absolute directory paths is hard to accomplish this task. I usually try to add the absolute path of my.bib file in the MiKTeX options, but never succeed. Below is my method to handle this problem with the way of relative path.

If your .bib file is in the directory C:\LocalTexFiles\bibtex\bib\sarabibs.bib, put your .tex file into a folder named mytexfile (the folder's name is arbitrary), and put this folder into C:\LocalTexFiles\. At the end of your .tex file, use \bibliography{../bibtex/bib/sarabibs} instead of \bibliography{C:/LocalTexFiles/bibtex/bib/sarabibs}. This describes the relative path between your .bib file and your .tex file. The common path C:\LocalTexFiles is represented by .., and the relative part is /bibtex/bib/sarabibs.

Your .tex file can reside in the folder mytexfile, which is separate from other irrelevant files, and that reaches the objective. And you will find that your .tex file runs well again. This is a method of relative paths, with the advantage that this method doesn't require you to add the path of your.bib file in the MiKTeX options.

  • Welcome to TeX.SX! That's much more complicated and as the OP has a kind of special setup it's maybe not the best solution. – TeXnician Sep 28 '17 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.