![修改 agsm.bst 包参考书目输出](https://linux22.com/image/317479/%E4%BF%AE%E6%94%B9%20agsm.bst%20%E5%8C%85%E5%8F%82%E8%80%83%E4%B9%A6%E7%9B%AE%E8%BE%93%E5%87%BA.png)
我想更改 URL 输出从:
URL:html 链接
进入:
[在线]网址:[访问日期]
我在用:
\usepackage[comma]{natbib}
\bibliographystyle{agsm}
答案1
这里我已经逐步解释了如何修改哈佛束中的另一个 bst;请参考它以了解分步说明。
agsm.bst
没有提供 urldate 字段,因此您必须自己添加到修改后的 bibtex 样式中。我agsm-url.bst
从原始样式创建了agsm.bst
并添加了urldate
创建了并向其中这个答案. 差异:
43a44
> urldate
165c166,171
< { "\newline\harvardurl{" URL * "}" * write$ newline$ }
---
> { "\newline\harvardurl{" URL * "}" * write$ newline$
> urldate empty$
> { skip$ }
> { "[Accessed on: " urldate * "]" * write$ newline$ }
> if$
> }
如果你不想在 URL 块前换行,只需删除\newline
然后我\harvardurl
用重新定义宏
\renewcommand{\harvardurl}[1]{[Online] URL: \textit{#1}}
以下是 MWE:
% Adapted bib file from tugboat.bib
\begin{filecontents}{\jobname.bib}
@article{online,
author = {Robert Welland},
title = {{Editor's Comments}},
journal = {TUGboat},
volume = {1},
number = {1},
pages = {2--3},
month = oct,
year = {1980},
ISSN = {0896-3207},
urldate = {Fri Jul 13 10:24:20 MDT 2007},
url = {http://www.math.utah.edu/pub/tex/bib/tugboat.bib}
}
@article{offline,
author = {Richard Palais},
title = {{Message from the Chairman}},
journal = {TUGboat},
volume = {1},
number = {1},
pages = {3--7},
month = oct,
year = {1980},
}
\end{filecontents}
\documentclass{article}
\usepackage[comma]{natbib}
% natbib.sty, line 1042:
\renewcommand{\harvardurl}[1]{[Online] URL: \textit{#1}}
\begin{document}
\cite{online,offline}
\bibliographystyle{agsm-url}
\bibliography{\jobname}
\end{document}
输出结果如下: