这个问题与这里的问题非常相关:
引用“et al.”仅适用于 natbib 和 jf.bst 中的四位或更多作者
在回答该问题时,Mico 展示了如何替换 jf.str 中的 format.lab.names 函数,以便当条目中有超过 4 位作者时,.bib 条目显示为“作者等(年份)”。但是,这是针对 nyu.edu 网站上的 jf.str 版本完成的。我希望能够使用此处的 .str 文件实现相同的行为
http://pages.stern.nyu.edu/~dbackus/GE_asset_pricing/BGTZ/jf.bst
尽管名称相同,但经过一些修改以适合计量经济学 (Econometrica) 的参考书目要求。
所以问题是,有人能向我解释为什么当我用 FUNCTION {format.lab.names} 替换
FUNCTION {format.lab.names}
{'s :=
"" 't :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr
"{vv~}{ll}" format.name$
't :=
nameptr #1 >
{
nameptr #2 =
numnames #2 > and
{ "others" 't :=
#1 'namesleft := }
'skip$
if$
namesleft #1 >
{ ", " * t * }
{
s nameptr "{ll}" format.name$ duplicate$ "others" =
{ 't := }
{ pop$ }
if$
t "others" =
{ " et~al." * }
{
numnames #2 >
{ "," * }
'skip$
if$
bbl.and
space.word * t *
}
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
}
每当 .bib 条目有超过 2 位作者时,我都不会得到“作者等(年份)”。(我意识到这可能很简单,并开始阅读 Tame the Beasthttp://www.lsv.ens-cachan.fr/~markey/BibTeX/doc/ttb_en.pdf)。 谢谢。
这是一个用于测试目的的 .tex 文件:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{abd:2007,
author = "Torben G. Andersen and Tim Bollerslev and Francis X. Diebold",
title = "Roughing it up: {Including} jump components in the
measurement, modeling and forecasting of return volatility",
journal = "Review of Economics and Statistics",
year = 2007,
volume = 89,
number = 4,
month = "November",
pages = "701--720",
}
@article{abde:2001,
author = "Torben G. Andersen and Tim Bollerslev and Francis X. Diebold
and Heiko Ebens",
title = "The distribution of realized stock return volatility",
journal = "Journal of Financial Economics",
year = 2001,
volume = 61,
number = 1,
month = "July",
pages = "43--76",
}
@unpublished{gavazzoni-santacreu-2015,
Author = {Gavazzoni, Federico and Ana Maria Santacreu},
Note = {manuscript, December},
Title = {International R\&D spillovers and Asset prices},
Year = {2015}
}
@article{segal-shaliastovich-yaron-2013,
Author = {Gill, Segal and Ivan Shaliastovich and Amir Yaron},
Journal = {Journal of Financial Economics},
Title = {Good and bad uncertainty: macroeconomic and financial market implications},
Volume={117},
Pages={369-397},
Year = {2015}
}
\end{filecontents*}
\usepackage[round,authoryear,comma]{natbib}
\bibliographystyle{jf_nyu} % or: jf3
\begin{document}
Here's the output \\
\cite{abd:2007}\\
\cite{abde:2001}\\
\cite{gavazzoni-santacreu-2015}\\
\cite{segal-shaliastovich-yaron-2013}\\
\bibliography{\jobname}
\end{document}
答案1
现在您已经向我们指出了bib
要修改的正确样式,下面是一个更短的替换format.lab.names
:
FUNCTION {format.lab.names}
{ 's :=
s num.names$ 'numnames :=
s #1 "{vv~}{ll}" format.name$
numnames #1 >
{ s #2 "{vv~}{ll}" format.name$ 't :=
numnames #2 >
t "others" =
or
{ " et~al." * }
{ " and " * t * }
if$
}
'skip$
if$
}
在您的示例文件(略微整理,见下文)中,它会产生
该函数的工作原理如下。首先将作者列表存储在 中s
。将作者数量存储在 中numnames
。格式化第一个(#1
)条目并输出。然后,如果有多个名称,则格式化下一个名称并将其分配给t
。如果t
是"others"
或实际上有两个以上的作者,则输出et al.
,否则输出 前面的第二个(最后一个)作者and
。
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{abd:2007,
author = "Torben G. Andersen and Tim Bollerslev and Francis X. Diebold",
title = "Roughing it up: {Including} jump components in the
measurement, modeling and forecasting of return volatility",
journal = "Review of Economics and Statistics",
year = 2007,
volume = 89,
number = 4,
month = "November",
pages = "701--720",
}
@article{abde:2001,
author = "Torben G. Andersen and Tim Bollerslev and Francis X. Diebold
and Heiko Ebens",
title = "The distribution of realized stock return volatility",
journal = "Journal of Financial Economics",
year = 2001,
volume = 61,
number = 1,
month = "July",
pages = "43--76",
}
@unpublished{gavazzoni-santacreu-2015,
Author = {Gavazzoni, Federico and Ana Maria Santacreu},
Note = {manuscript, December},
Title = {International R\&D spillovers and Asset prices},
Year = {2015}
}
@article{segal-shaliastovich-yaron-2013,
Author = {Gill, Segal and Ivan Shaliastovich and Amir Yaron},
Journal = {Journal of Financial Economics},
Title = {Good and bad uncertainty: macroeconomic and financial market implications},
Volume={117},
Pages={369-397},
Year = {2015}
}
\end{filecontents*}
\usepackage[round,authoryear,comma]{natbib}
\bibliographystyle{jf1} % or: jf3
\begin{document}
Here's the output
\cite{abd:2007}
\cite{abde:2001}
\cite{gavazzoni-santacreu-2015}
\cite{segal-shaliastovich-yaron-2013}
\bibliography{\jobname}
\end{document}