%20%E5%BC%95%E7%94%A8%E5%B0%8E%E8%87%B4%E5%8F%83%E8%80%83%E6%9B%B8%E7%9B%AE%20URL%20%E6%BA%A2%E4%BD%8D%E5%88%B0%E5%85%A9%E5%88%97%EF%BC%9F.png)
我希望我的引用風格是哈佛。
我正在使用以下內容:
\documentclass[conference]{IEEEtran}
\usepackage[comma]{natbib}
\usepackage{url}
\begin{document}
foo \citep{vitz_history_2016}
\bibliographystyle{IEEEtran}
\bibliography{references}
\end{document}
引用文件中的範例.bib
:
@online{vitz_history_2016,
year = {2016},
title = {History of the Periodic Table},
url = {https://chem.libretexts.org/Bookshelves/Ancillary_Materials/Exemplars_and_Case_Studies/Exemplars/Culture/History_of_the_Periodic_Table},
titleaddon = {Chemistry {LibreTexts}},
author = {Vitz, Ed and Moore, John and Shorb, Justin and Prat-Resina, Xavier and Wendorff, Tim and Hahn, Adam},
urldate = {2019-11-25},
date = {2016-05-26},
langid = {english},
file = {fname}
}
我通常使用\cite{author}
and創建文檔\bibliographystyle{IEEEtran}
,因此透過包含\usepackage{url}
URL 可以正確顯示:
我希望第二個範例中出現相同的引用,但使用哈佛風格的引用,如第一個範例中那樣。
任何幫助將非常感激!
答案1
似乎有幾個問題。
由於您使用的是
IEEEtran
文檔類,因此將IEEEtran
參考書目樣式與套件一起使用應專門與和命令natbib
結合使用;兩者都會產生數字式的引文標註。不適用於參考書目風格。\cite
\citep
\citet
IEEEtran
如果您希望將
natbib
套件與IEEEtran
文件類別一起使用,您可能應該使用IEEEtranN
參考書目樣式。 (N
inIEEEtranN
代表natbib
...)透過這種設置,\cite
並且\citep
仍然會產生數字樣式的標註,但\citet
現在也“有效”,因為它創建了作者-數位風格引用標註。儘管你可能會嘗試,但你不會讓這個設定產生作者-年風格,又稱“哈佛風格”和“agsm 風格”,引文標註。也就是說,我會回應 @moewe 的評論:大多數(全部?!)需要使用
IEEEtran
文檔類的期刊都採用數字樣式的引文標註;他們可能會拒絕使用作者編號或作者年份風格的引用標註的提交內容。以防萬一這不是拼字錯誤:正確的語法是
\citep{<some_key>}
, 而不是\citep(<some_key>)
。
\documentclass[conference]{IEEEtran}
\begin{filecontents}[overwrite]{mybib.bib}
@online{vitz_history_2016,
year = {2016},
title = {History of the Periodic Table},
url = {https://chem.libretexts.org/Bookshelves/Ancillary_Materials/Exemplars_and_Case_Studies/Exemplars/Culture/History_of_the_Periodic_Table},
titleaddon = {Chemistry {LibreTexts}},
author = {Vitz, Ed and Moore, John and Shorb, Justin and Prat-Resina, Xavier and Wendorff, Tim and Hahn, Adam},
urldate = {2019-11-25},
date = {2016-05-26},
langid = {english},
file = {fname}
}
\end{filecontents}
\usepackage[numbers,comma]{natbib}
\bibliographystyle{IEEEtranN} % not 'IEEEtran'
\usepackage{xurl}
\usepackage[colorlinks,allcolors=blue]{hyperref} % just for this example
\begin{document}
foo \citep{vitz_history_2016} % not "\citep(author)"
bar \citet{vitz_history_2016}
\bibliography{mybib}
\end{document}
附錄:我實際上可以重現看起來很糟糕的非斷行 URL 字串,用下標代替下劃線,如果我替換\bibliographystyle{IEEEtranN}
為 ,則如您的第一個螢幕截圖所示\bibliographystyle{agsm}
。這種agsm
風格相當古老,並且使用了一個名為 的宏\harvardurl
,它確實不是\url
採取與排版 URL 字串時相同的預防措施;這些預防措施與 TeX 特殊字元有關,例如_
和%
,它們可能出現在 URL 字串中。 (非常感謝@moewe向我指出了這一點!)
如果你必須使用agsm
參考書目風格,那麼,有兩種方法可以進行:首先,您可以提供說明
\renewcommand\harvardurl{\textbf{URL:} \url}
後\bibliographystyle{agsm}
。其次,你可以改變
url = {https://chem.libretexts.org/Bookshelves/Ancillary_Materials/Exemplars_and_Case_Studies/Exemplars/Culture/History_of_the_Periodic_Table},
到
url = {\url{https://chem.libretexts.org/Bookshelves/Ancillary_Materials/Exemplars_and_Case_Studies/Exemplars/Culture/History_of_the_Periodic_Table}},
當然,這兩種方法都假設您已經加載了一個合適的套件——url
並且xurl
想到了——它定義了一個「真正的」\url
巨集。
順便說一下,如果你想使用agsm
參考書目風格,你應該加載har2nat
包,而不是natbib
直接加載包。為什麼?這agsm
款式是哈佛大學引文管理包,它附帶了一些專門的命令。包har2nat
(a) 載入natbib
包並 (b) 將harvard
特定宏「翻譯」為natbib
包識別的宏。如果您希望hyperref
在文件中使用該包,這尤其有用:hyperref
與該包完全相容natbib
,但與該包不太相容harvard
。
\documentclass[conference]{IEEEtran}
\begin{filecontents}[overwrite]{mybib.bib}
@online{vitz_history_2016,
year = {2016},
title = {History of the Periodic Table},
url = {\url{https://chem.libretexts.org/Bookshelves/Ancillary_Materials/Exemplars_and_Case_Studies/Exemplars/Culture/History_of_the_Periodic_Table}},
titleaddon = {Chemistry {LibreTexts}},
author = {Vitz, Ed and Moore, John and Shorb, Justin and Prat-Resina, Xavier and Wendorff, Tim and Hahn, Adam},
urldate = {2019-11-25},
date = {2016-05-26},
langid = {english},
file = {fname}
}
\end{filecontents}
\usepackage{har2nat} % not 'natbib' directly
\bibliographystyle{agsm}
\usepackage{xurl}
\usepackage[colorlinks,allcolors=blue]{hyperref}
\begin{document}
foo \citep{vitz_history_2016} % not "\citep(author)"
bar \citet{vitz_history_2016}
\bibliography{mybib}
\end{document}