修改論文模板中的參考樣式

修改論文模板中的參考樣式

我正在嘗試修改參考樣式劍橋工程論文模板應我主管的要求,以類似 AIP 的方式顯示參考書目中的參考文獻。範本中的預設參考書目選項是:

\RequirePackage[backend=biber, style=numeric-comp, citestyle=numeric, sorting=nty, natbib=True]{biblatex}
\addbibresource{References/references}

\begin{document}
...
\bibliographystyle{unsrt}
\bibliography
 
...
\end{document}

目前,這會產生帶有文章標題但沒有期刊名稱的參考文獻(除了與 AIP 風格的其他差異之外)

我嘗試更改style=numeric-compstyle=phys,但這不會影響參考書目。

我嘗試將上面的內容更改為:

\usepackage[backend=biber,style=phys]{biblatex}
\addbibresource{References/references.bib}

\begin{document}
...
\printbibliography
...
\end{document}

然而,在第一次編譯運行時,這會導致我的文件在沒有參考書目的情況下進行編譯,並且我所有的文本引用都顯示為引用鍵(例如[ji2009]),而不是數字引用或作為??,而且在第二次編譯運行時,它無法產生 pdf(我正在使用背頁,但當我嘗試使用 Texmaker 單獨編譯 biber 和 pdflatex 時,同樣無法編譯)。當參考書目鍵採用“name2009a”格式時,它似乎會失敗(例如,使用“li2019”沒問題,但在包含“li2009”和“li2009a”時失敗),但這可能是巧合。

有沒有辦法更改它以使用該phys選項或修改參考書目顯示的欄位?

以下內容也包含在 .cls 檔案中 - 我custombib在類別選項中使用:

% ******************************* Bibliography *********************************
\newif\ifsetBib\setBibfalse                   % Custom Bibliography = true/false
\newif\ifsetBiBLaTeX\setBiBLaTeXfalse         % BiBLaTeX = True / False

\newif\ifPHD@biblatex\PHD@biblatexfalse       % BiBLaTeX
\DeclareOption{biblatex}{
  \ifsetBib
    \ClassWarning{PhDThesisPSnPDF}{Bibliography selection conflict: A
      bibliography style aleady specified. Please check the document class
      options in case you have defined two bibliography styles.}
  \else
    \PHD@biblatextrue
  \fi
}

\newif\ifPHD@authoryear\PHD@authoryearfalse   % Author-Year citation
\DeclareOption{authoryear}{
  \ifsetBib
    \ClassWarning{PhDThesisPSnPDF}{Bibliography selection conflict: A
      bibliography style aleady specified. Please check the document class
      options in case you have defined two bibliography styles.}
  \else
    \PHD@authoryeartrue
    \setBibtrue
  \fi
}

\newif\ifPHD@numbered\PHD@numberedfalse       % Numbered citiation
\DeclareOption{numbered}{
  \ifsetBib
    \ClassWarning{PhDThesisPSnPDF}{Bibliography selection conflict: A
      bibliography style aleady specified. Please check the document class
      options in case you have defined two bibliography styles.}
  \else
    \PHD@numberedtrue
    \setBibtrue
  \fi
}

\newif\ifuseCustomBib\useCustomBibfalse     % Custom Bibliography
\DeclareOption{custombib}{
  \ifsetBib
    \ClassWarning{PhDThesisPSnPDF}{Bibliography selection conflict: A
      bibliography style aleady specified. Please check the document class
      options in case you have defined two bibliography styles.}
  \else
    \ifPHD@biblatex
        \ClassWarning{PhDThesisPSnPDF}{Bibliography selection conflict: A
          bibliography style aleady specified. Please check the document class
          options in case you have defined two bibliography styles.}
    \else
      \useCustomBibtrue
      \setBibtrue
    \fi
  \fi
}

答案1

終於找到了編譯問題的根本原因 - 將其添加到此處,以防其他人將來搜索類似的內容!

請注意,CUED(劍橋大學工程系)論文範本 .cls 檔案有兩個部分,分別涉及參考文獻和參考書目。如果您確實需要刪除所有模板預設值並替換為您自己的設置,請確保刪除/註解掉兩個都.cls 檔案中的小節!

若要將預設引用替換為 AIP/phys樣式引用:

  1. 已刪除兩個都.cls 文件中與參考文獻/參考書目相關的小節

  2. 從序言文件中刪除了所有引用設定並替換為\usepackage[backend=biber,style=phys]{biblatex} \addbibresource{References/references.bib}

  3. 僅保留以下類別設定: \documentclass[a4paper,12pt,times]{PhDThesisPSnPDF}

導致其他引用失敗的問題(尤其是@online帶有 url 的引用)涉及我設定的自訂命令。由於我非常頻繁地在方程式之外使用下標,因此我很早就設定了以下快捷方式:

\let\sb\textsubscript

事實證明有一個\sb命令在列印參考書目/ url 格式/ 中發揮作用某物@online參考文獻中。

在我的所有子文件中進行大量查找和替換搜尋以刪除後\sb,一切終於順利進行。經過幾週的重新建置和艱苦的搜尋問題,我意識到這對於我的自訂快捷方式來說是非常具體的,但希望這可以節省一些時間!

(就上下文而言,從預設模板設定更改為phys樣式的原因是我的主管的規格)

相關內容