Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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).

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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