# Can I have a path argument that contains spaces?

I'm trying to get biblatex to see where I have my .bib file located, but I have a space in the path to the file:

\addbibresource{~/Documents/My Project/TheBib.bib}


How do I specify a full path that includes a space? Is there a way to specify a relative path?

M(Not)WE, as requested:

\documentclass[nobib]{tufte-handout}

\usepackage{hyphenat}
\usepackage[backend=bibtex, natbib=true, citestyle=verbose]{biblatex}

\begin{document}

Test.\cite{CiteKey}

\printbibliography

\end{document}

-
@MarcoDaniel: Yes, corrected. The path question remains. – raxacoricofallapatorius Mar 2 '12 at 19:52
the file paths accepted depend on the tex implementation but I believe web2c based ones will accept paths with spaces if you surround them with "..." – David Carlisle Mar 2 '12 at 20:04
@DavidCarlisle: That doesn't work for me (OS X; MacTeX). – raxacoricofallapatorius Mar 2 '12 at 20:12
sorry I know nothing about macs. Also you the ~ may cause problems as it expands to non breakable space normally, you might need \string~ (or you might not if biblatex quotes it automatically, not sure) – David Carlisle Mar 2 '12 at 20:22
Can't help with spaces in names as I learned to avoid them many years ago, but you should now use \addbibresource{TheBib.bib} for recent versions of biblatex. – jon Mar 2 '12 at 20:46

(Note: I'm working on a mac)

There are two problems with the path you specify:

1- The space: simply enclose the path in double quotes (")

2- The ~. TeX won't treat it as a substitute for /Users/You. You might want to consider using relative paths: a) ./indicates the current working directory b) ../ moves one step up the directory tree.

So if your file structure is as

My project
main.tex
bib --> TheBib.bib


You need only use ./bib/TheBib.bib. If however your file structure is something like

My project
tex --> main.tex
bib --> TheBib.bib


You use ../bib/TheBib.bib

And so on

-
Are you sure about that? The ~ works fine for me (to a location with no spaces in the path); ./ never works (with or without quotes); quotes don't help with spaces. – raxacoricofallapatorius Mar 2 '12 at 23:55
I just tried everything again. The ~ does not work for me. Can you add a M(Not)WE. Maybe there is something in your file I or others can see. – Frédéric Mar 3 '12 at 2:39
Pretty much as stated: see MWE above. – raxacoricofallapatorius Mar 3 '12 at 4:16
I just tried your example, with the same file structure and names. The problem I'm having is from the documentclass. When I use article, there is no problem: all 3 different addbibresource calls work. With the tufte-handout, it doesn't compile when I include all the bib stuff. – Frédéric Mar 3 '12 at 4:44
You'll need the latest tuft-common.def (3.5.2) to get it to compile. – raxacoricofallapatorius Mar 3 '12 at 5:06

This might be helpful for Windows people,

Found this on http://osdir.com/ml/tex.miktex/2005-07/msg00022.html and all credit should go to them,

Use command prompt and MSDOS dir /x command in each parent folder of the folder with "spaces" to extract MSDOS 8.3 compliant names. The final path would look something like this,

normal Windows path, "T:/My Docs/MyBibTeXFiles/Zotero2012.bib"

With MSDOS names, "T:/MYDOCS~1/MyBibTeXFiles/Zotero2012.bib"

finally in .tex, \addbibresource{T:/MYDOCS~1/MyBibTeXFiles/Zotero2012.bib}

Don't forget to delete previous .aux file before you bibtex the .tex with this new folder. Worked great in MikTex in Win 7 here.

-
It is easier to build a local texmf tree where you can include your bib file. If your distributions knows this local texmf you can simple use \addbibresource{Zotero2012.bib}. It will be found. – Kurt Oct 19 '12 at 21:38