我正在编纂参考书目,其中有些作者名单很长(超过 100 人)。我知道 BibTeX 样式的“et al.”选项,但
One, Two, Three, et al. (2016)
或者类似的东西,我宁愿有类似的东西
One, Two, Three, and 97 other authors (2016)
针对一篇有 100 位作者的论文。
我曾经latex makebst
创建过自定义书目样式,我几乎可以看到 BibTeX 知道“et al.”的剩余作者数量(在format.names
我的自定义中bst
)。但我对 BibTeX 的了解还不够,不知道如何将其放入引文中。
有没有办法得到想要的输出?
附言:如果这是重复的,请原谅,但我只能在参考文献中加入“et al.”来提出很多问题和答案。
答案1
首先,您要定义一个数字,即您想要显示的作者数量,为此,将其添加ENTRY {
到您的.bst
文件中nbr
,它将变成:
ENTRY
{ address
author
booktitle
chapter
edition
editor
eid
howpublished
institution
journal
key
month
note
number
organization
pages
publisher
school
series
title
type
volume
year
nbr % added
}
然后搜索FUNCTION {format.names}
并替换为
FUNCTION {format.names}
{ 'bibinfo :=
duplicate$ empty$ 'skip$ {
's :=
"" 't :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr
"{f.~}{vv~}{ll}{, jj}"
format.name$
highlight.if.cv.author
bibinfo bibinfo.check
't :=
nameptr #1 >
{
nameptr #1
#3 + = %#15 + =
numnames #0
#10 + %#30 +
> and
{ "others" 't :=
#1 'namesleft := }
'skip$
if$
namesleft #1 >
{ ", " * t * }
{
s nameptr "{ll}" format.name$ duplicate$ "others" =
{ 't := }
{ pop$ }
if$
" " *
t "others" =
{
* "and " * nbr " other authors" *
}
{ ", " * t * }
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
} if$
}
并在您的bib
文件中添加nbr = {33}
例如Author 1, Author 2, Author 3 and 33 other authors
注意:这将仅显示 3 位作者姓名(如果作者人数超过 10 人),后跟and nbr other authors
,其中必须以与添加, ... 等nbr
相同的方式添加到 BiTeX 条目中。要更改此设置,只需将和替换为您想要的数字。pages
journal
#3
#10
更新:作为沃里克建议您不需要添加nbr
,而只需用nbr
上面的内容替换format.names
numnames #3 - int.to.str$
梅威瑟:
\documentclass{article}
\begin{filecontents*}{MWE.bib}
@article{A,
archivePrefix = {arXiv},
arxivId = {hep-th/9605032},
author = {AuthorI, A. and AuthorII, B. and AuthorIII, C.},
eprint = {9605032},
journal = {Journal of Bla bla},
pages = {12},
primaryClass = {hep-th},
title = {{Title of the paper A}},
volume = {123},
year = {2016}
}
@article{B,
archivePrefix = {arXiv},
author = {Author1, A and Author2, A and Author3, A and Author4, A and Author5, A and Author6, A
and Author6, A and Author7, A and Author8, A and Author9, Aand Author10, A and Author11, A
and Author12, A
},
arxivId = {1512.00704},
eprint = {1512.00704},
journal = {Journal of bla bla},
pages = {1233},
title = {{Title of the paper B}},
volume = {567},
year = {2016},
nbr = {9}
}
@article{C,
archivePrefix = {arXiv},
author = {Author1, A and Author2, A and Author3, A and Author4, A and Author5, A and Author6, A
and Author6, A and Author7, A and Author8, A and Author9
},
arxivId = {1512.00704},
eprint = {1512.00704},
journal = {Journal of bla bla},
pages = {1233},
title = {{Title of the paper B}},
volume = {567},
year = {2016}
}
\end{filecontents*}
\begin{document}
~\nocite{*}
%Bibleography
\bibliographystyle{example}
\bibliography{MWE}
\end{document}
答案2
这是一个使用的解决方案biblatex
:
我们要做的就是定义一个新的指令来格式化名称:
\newcounter{namesleft}
\DeclareNameFormat{andNothers}{%
\setcounter{namesleft}{\value{author}-\value{liststop}}%
\nameparts{#1}%
\namepartfamily
\ifthenelse{\value{listcount}<\value{liststop}}
{\addcomma\addspace}%
{\ifmorenames{\printtext{ and other \thenamesleft{} authors}}{}}
}
\DeclareNameAlias{author}{andNothers}
在上面的代码片段中,我们首先创建一个新的计数器 ( names left
) 来存储要处理的剩余姓名数量。该数字是从姓名被截断时要打印的数字(存储在minames
要为其提供选项的参数中biblatex
)与计数器存储的列表中姓名总数(author
在本例中)之间的差值获得的。当我们打印最后一个姓名时,我们使用\ifmorenames
条件来检查列表是否会被截断;如果是,它会打印 的值namesleft
。
最后,我们用来\DeclareNameAlias
指定使用新格式来打印作者列表。
该解决方案使用calc
包来简化计数器的计算,并且在截断列表之前需要多少个名称以及截断时包含多少个名称的参数是标准的maxnames
和minnames
。因此,
\usepackage[minnames=3,maxnames=5]{biblatex}
指定如果有超过 5 个名称则截断名称列表,但仅显示前 3 个名称。
以下是完整的 MWE:
\documentclass{article}
\begin{filecontents*}{\jobname.bib}
@article{A,
archivePrefix = {arXiv},
arxivId = {hep-th/9605032},
author = {AuthorI, A. and AuthorII, B. and AuthorIII, C.},
eprint = {9605032},
journal = {Journal of Bla bla},
pages = {12},
primaryClass = {hep-th},
title = {{Title of the paper A}},
volume = {123},
year = {2016}
}
@article{B,
archivePrefix = {arXiv},
author = {Author1, A and Author2, A and Author3, A and Author4, A and Author5, A and Author6, A
and Author6, A and Author7, A and Author8, A and Author9, Aand Author10, A and Author11, A
and Author12, A
},
arxivId = {1512.00704},
eprint = {1512.00704},
journal = {Journal of bla bla},
pages = {1233},
title = {{Title of the paper B}},
volume = {567},
year = {2016},
nbr = {9}
}
@article{C,
archivePrefix = {arXiv},
author = {Author1, A and Author2, A and Author3, A and Author4, A and Author5, A and Author6, A
and Author6, A and Author7, A and Author8, A and Author9
},
arxivId = {1512.00704},
eprint = {1512.00704},
journal = {Journal of bla bla},
pages = {1233},
title = {{Title of the paper C}},
volume = {567},
year = {2016}
}
\end{filecontents*}
\usepackage{calc}
\usepackage[minnames=3,maxnames=5]{biblatex}
\addbibresource{\jobname.bib}
\newcounter{namesleft}
\DeclareNameFormat{andNothers}{%
\setcounter{namesleft}{\value{author}-\value{liststop}}%
\nameparts{#1}%
\namepartfamily
\ifthenelse{\value{listcount}<\value{liststop}}
{\addcomma\addspace}%
{\ifmorenames{\printtext{ and other \thenamesleft{} authors}}{}}
}
\DeclareNameAlias{author}{andNothers}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
制作
答案3
我对这个问题有另一种解决方案。我修改/调整了芝加哥风格 (Chicago.sty),并在参考书目风格 (ChicagoFred.bst) 中将“et al.”替换为“and others”;下面是一个例子;它包含一个 .tex 作为示例。
我修改芝加哥风格的一些行是因为括号有问题(如果你使用彩色超链接,那么括号就是无色的)。我修复了它。