1

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

  • 3
    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
  • 2
    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
  • 1
    The elegant way is to set the TEXINPUTS accordingly. – jon Feb 21 '15 at 1:25
2

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)

enter image description here

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.