Win 和 OSX 上 bib 檔案的路徑

Win 和 OSX 上 bib 檔案的路徑

我在家使用 Windows,在大學使用 OSX。我的 tex 檔案是透過 Dropbox 同步的。然而,這些系統中的路徑規則顯然是不同的。結果,我必須寫這樣的東西

\bibliography{D:/TeX/mybibfile}

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

並根據作業系統註解/取消註解上面的行。

是否存在一些更“優雅/聰明”的方式?

世界銀行,

德米特里

答案1

像這樣的東西嗎?

使用ifplatform套件及其\if....巨集來測試和定義一些命令。

\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實際上是biblio.bib來自的文件texmf-dist/bibtex/bib/msc

在此輸入影像描述

相關內容