Paths to bib-file on Win and OSX

I use Windows at home and OSX at the University. My tex files are synchronized via Dropbox. However, the path rules are, evidently, different in these systems. As a result, I have to write something like this

\bibliography{D:/TeX/mybibfile}

\bibliography{/Users/df/TeX/mybibfile}


and comment/uncomment a line above depending on the operating system.

Does exist some more 'elegant/clever' way?

WBR,

Dmitri

• Can't you just use relative paths? Or do you only synchronize the tex file but not the bib file with DropBox? – Juri Robl Feb 20 '15 at 10:37
• I synchronize bib file as well. – Dmitri Feb 20 '15 at 23:20
• Well is it in the same folder? Then you don't need any path at all, only the filename. Otherwise use a relative path, that way you can copy the folder where ever you want and it works. – Juri Robl Feb 20 '15 at 23:22
• The elegant way is to set the TEXINPUTS accordingly. – jon Feb 21 '15 at 1:25

Something like this?

Use the ifplatform package and its \if.... macros to test and define some command.

\documentclass{article}

\usepackage{ifplatform}

\newcommand{\DropboxPathPrefix}{%
\ifmacosx%
/users/def/TeX%
\else%
\ifwindows%
D:/TeX%
\else%
\iflinux%
.%   (local directory) Change to appropiate values
\else%
\ifcygwin%
% ????
\fi%
\fi%
\fi%
\fi%
}

\newcommand{\PathToBibFile}{\DropBoxPrefix/standardbiblio}

\begin{document}

%% Somes stuff in here

\cite{Lam94}

\bibliographystyle{unsrt}
\bibliography{\PathToBibFile}

\end{document}


(standardbiblio.bib is in fact the biblio.bib file from texmf-dist/bibtex/bib/msc)