5

I have a problem using a tilde in the \bibliography{}. Consider the following code

\documentclass{article}
\begin{document}
\cite{ref09:man}

\bibliographystyle{plain}
\bibliography{~/bug.bib}
\end{document}

with "bug.bib" located in my home directory "~/" and defined as

@Manual{ref09:man, title = {Reftex user manual, Version 4.34}, year = 2009 }

Now running "pdflatex" and then "bibtex", give then following error from BibTeX

White space in argument---line 4 of file d.aux
 : \bibdata{\protect
 :                   \unhbox \voidb@x \penalty \@M \ {}/bug.bib}
I'm skipping whatever remains of this command
I found no database files---while reading file d.aux
Warning--I didn't find a database entry for "ref09:man"

This error can be fixed by using \string~ instead of ~, i.e.

\bibliography{\string~/bug.bib}

However, now there is a problem with RefTeX not finding the BibTeX database. When I enter \cite and hit return in emacs I get:

No valid bibliography in this document, and no default available

(An absolute path would have solved this issue, e.g. \bibliography{/home/userName/bug.bib}, but I cannot use that since I use two machines one at home and one at work with different absoulte path to the home directory)

4

Create a directory $HOME/texmf/bibtex/bib and put your bib files there. Then you can use just \bibliography{bug.bib}, since both BibTeX and RefTeX search this directory (with the default settings).

  • Thank you this works fine.. I found that I can also use export "BIBINPUTS=~" – Håkon Hægland Mar 12 '13 at 23:24
  • I did not know RefTeX checks BIBINPUTS - of course bibtex does... – Boris Mar 12 '13 at 23:27
  • 1
    No need to specify the file extension (.bib); it's better to write \bibliography{bug}. – Mico Mar 13 '13 at 1:09
  • @boris I think RefTeX also checks BIBINPUTS, see chapter 4.1 of the RefTeX manual. – Håkon Hægland Mar 13 '13 at 6:33

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.