如何修改`unsrt.bst`檔案以產生簡潔易讀的Journal of Applied Phyisics(JAP)風格的.bbl檔案?

如何修改`unsrt.bst`檔案以產生簡潔易讀的Journal of Applied Phyisics(JAP)風格的.bbl檔案?

我打算向《應用物理學雜誌》(JAP) 提交一篇文章。所以我正在使用 using revtex4-1 document class \documentclass[aip,jap,reprint,superscriptaddress,amsmath,amssymb]{revtex4-1}

在準備論文期間,我使用 .bib 檔案來產生參考文獻清單。但現在到了提交時間,我想將引用作為 \bibitems 嵌入到我的乳膠文件中。一種方法是複製 .bbl 檔案的內容,該檔案是在 Latex 處理過程中由 .bib 檔案自動產生的。

正如喬恩評論的那樣,.bbl 文件的內容由文檔類控制。但問題是我發現JAP documentclass風格產生的.bbl檔案是如此複雜、冗長且不可讀。就像是:

\begin{thebibliography}{2}%
\makeatletter
\providecommand \@ifxundefined [1]{%
 \@ifx{#1\undefined}
}%
\providecommand \@ifnum [1]{%
 \ifnum #1\expandafter \@firstoftwo
 \else \expandafter \@secondoftwo
 \fi
}%
\providecommand \@ifx [1]{%
 \ifx #1\expandafter \@firstoftwo
 \else \expandafter \@secondoftwo
 \fi
}%
\providecommand \natexlab [1]{#1}%
\providecommand \enquote  [1]{``#1''}%
\providecommand \bibnamefont  [1]{#1}%
\providecommand \bibfnamefont [1]{#1}%
\providecommand \citenamefont [1]{#1}%
\providecommand \href@noop [0]{\@secondoftwo}%
\providecommand \href [0]{\begingroup \@sanitize@url \@href}%
\providecommand \@href[1]{\@@startlink{#1}\@@href}%
\providecommand \@@href[1]{\endgroup#1\@@endlink}%
\providecommand \@sanitize@url [0]{\catcode `\\12\catcode `\$12\catcode
  `\&12\catcode `\#12\catcode `\^12\catcode `\_12\catcode `\%12\relax}%
\providecommand \@@startlink[1]{}%
\providecommand \@@endlink[0]{}%
\providecommand \url  [0]{\begingroup\@sanitize@url \@url }%
\providecommand \@url [1]{\endgroup\@href {#1}{\urlprefix }}%
\providecommand \urlprefix  [0]{URL }%
\providecommand \Eprint [0]{\href }%
\providecommand \doibase [0]{http://dx.doi.org/}%
\providecommand \selectlanguage [0]{\@gobble}%
\providecommand \bibinfo  [0]{\@secondoftwo}%
\providecommand \bibfield  [0]{\@secondoftwo}%
\providecommand \translation [1]{[#1]}%
\providecommand \BibitemOpen [0]{}%
\providecommand \bibitemStop [0]{}%
\providecommand \bibitemNoStop [0]{.\EOS\space}%
\providecommand \EOS [0]{\spacefactor3000\relax}%
\providecommand \BibitemShut  [1]{\csname bibitem#1\endcsname}%
\let\auto@bib@innerbib\@empty
%</preamble>
\bibitem [{\citenamefont {Mazin}\ \emph {et~al.}(2008)\citenamefont {Mazin},
  \citenamefont {Singh}, \citenamefont {Johannes},\ and\ \citenamefont
  {Du}}]{10.1103/PhysRevLett.101.057003}%
  \BibitemOpen
  \bibfield  {author} {\bibinfo {author} {\bibfnamefont {I.~I.}\ \bibnamefont
  {Mazin}}, \bibinfo {author} {\bibfnamefont {D.~J.}\ \bibnamefont {Singh}},
  \bibinfo {author} {\bibfnamefont {M.~D.}\ \bibnamefont {Johannes}}, \ and\
  \bibinfo {author} {\bibfnamefont {M.~H.}\ \bibnamefont {Du}},\ }\href
  {\doibase 10.1103/PhysRevLett.101.057003} {\bibfield  {journal} {\bibinfo
  {journal} {{Phys. Rev. Lett.}}\ }\textbf {\bibinfo {volume} {{101}}},\
  \bibinfo {pages} {057003} (\bibinfo {year} {2008})}\BibitemShut {NoStop}%
\bibitem [{\citenamefont {Mazin}(2010)}]{10.1038/nature08914}%
  \BibitemOpen
  \bibfield  {author} {\bibinfo {author} {\bibfnamefont {I.~I.}\ \bibnamefont
  {Mazin}},\ }\href {\doibase 10.1038/nature08914} {\bibfield  {journal}
  {\bibinfo  {journal} {{Nature}}\ }\textbf {\bibinfo {volume} {{464}}},\
  \bibinfo {pages} {183} (\bibinfo {year} {2010})}\BibitemShut {NoStop}%
\end{thebibliography}%

參考的外觀是這樣的 在此輸入影像描述

好吧,將這麼大的資料塊貼到乳膠檔案中肯定可行。但它是不可讀的。

實際上,如果我們使用unsrt這裡提到的修改樣式是否可以取得 unsrt + abbrv 參考書目?。我們可以產生與 JAP 風格非常相似的參考外觀。修改已在unsrt.bst文件中完成。由於原著中作者的名字unsrt不是JAP風格。因此ff~將 中的 f.~ 改為 f.~ FUNCTION {format.names},我們得到了 JAP 作者姓名樣式。生成的 .bbl 檔案現在已經很清晰了,如下所示:

\begin{thebibliography}{1}

\bibitem{10.1103/PhysRevLett.101.057003}
I.~I. Mazin, D.~J. Singh, M.~D. Johannes, and M.~H. Du.
\newblock {\em {Phys. Rev. Lett.}}, {101}(5):057003, 2008.

\bibitem{10.1038/nature08914}
I.~I. Mazin.
\newblock {\em {Nature}}, {464}(7286):183--186, 2010.

\end{thebibliography}

在此輸入影像描述

產生精確的 JAP 參考外觀。我們可以做一些文字替換,例如:

  1. 刪除\em
  2. 刪除(5)和(7286)
  3. 將“:”替換為“,”
  4. 為年份加上圓括號。
  5. 粗體 101 和 464
  6. 將183--186改為183

使用一些正規表示式替換知識可以輕鬆完成上面的操作清單。最後我們得到了以下 \bibitems,它們產生完全相同的 JAP 參考樣式。

\begin{thebibliography}{1}
\bibitem{10.1103/PhysRevLett.101.057003}
I.~I. Mazin, D.~J. Singh, M.~D. Johannes, and M.~H. Du.
\newblock {{Phys. Rev. Lett.}} \textbf{101}, 057003 (2008).

\bibitem{10.1038/nature08914}
I.~I. Mazin.
\newblock {{Nature}} \textbf{464}, 183 (2010).
\end{thebibliography}

就像更改ff~f.~inunsrt.bst給出正確的 JAP 風格作者姓名一樣。我相信我們只需要對文件進行一些修改,unsrt.bst即可一步生成 JAP 風格的正確且清晰的 \bibitems,因此我不需要任何正則表達式替換後處理。

答案1

我想也許我現在可以回答我自己的問題了。

這個問題的關鍵是產生自訂參考書目風格的bst檔案。

有兩種方法可以做到這一點

  1. 使用包中的makebst工具客製化圍兜
  2. 使用基於java的軟體圍兜

makebst是一個命令列工具,用於在回答一系列大約 70 個與所需參考樣式格式相關的問題後產生自訂 .bst 檔案。對我來說它不是那麼友好,你可以透過閱讀這篇文章來逐步學習如何使用它LaTeX、參考書目管理和樣式

另一方面,我發現使用起來bib-it要容易得多(感謝作者bib-it)。它有一個Bibtex style generator,它是圖形化的。現在我將展示如何bib-it在短短幾分鐘內產生 JAP 風格的 .bst 檔案。


打開bib-it,點選「工具-->樣式產生器」。您將看到一個標題為 的圖形介面Bibtex style generator。您所要做的就是如下圖所示的 3 個步驟設定:

  1. 文章 在此輸入影像描述
  2. 在此輸入影像描述
    1. 作者 在此輸入影像描述

最後,您只需按“生成並儲存”,您就得到了自訂的 bst 檔案。

產生的引用的外觀類似於 在此輸入影像描述

自動產生的.bbl檔案非常清晰

\begin{thebibliography}{}

\bibitem{10.1103/PhysRevLett.101.057003}
I.~I. Mazin, D.~J. Singh, M.~D. Johannes and M.~H. Du, {Phys. Rev. Lett.}
  \textbf{{101}}, 057003 (2008).

\bibitem{10.1038/nature08914}
I.~I. Mazin, {Nature} \textbf{{464}}, 183--186 (2010).

\end{thebibliography}

唯一的缺點是“頁面”,JAP只需要起始頁。這可以透過使用正規表示式的單一替換操作來修復。

答案2

您可以使用環境將 bib 檔案的內容插入到序言的開頭(在該\documentclass行之後)filecontents

\usepackage{filecontents} 
\begin{filecontents} {mwe.bib}
@online{tab:test,
  author                   = {Doe, John},
  Url                      = {http://www.example.com/images/image.jpg},
  Urldate                  = {2014-02-25},
  Timestamp                = {2014.06.13},
  Note                     = {Table \ref{tab1}}, %<== this should point to your table caption label
  year                     = {2014}, %this is necessary for the in-text citation to work
}
\end{filecontents}

相關內容