我有 APA 样式的 BibTex 代码。参考文献中的作者姓名以“and”分隔。但是,我想将“and”改为“,”(逗号)。我在网上查了一些解决方案,但都帮不上忙。
例如我有这个参考:
“Benbir, G. 和 Korkmaz, B.,2014 年。许可证和 otizm:olgu sunumu,稍后再讨论,三十六“(1):49 – 54。”
我需要按照以下风格来做:
“Benbir, G., Korkmaz, B., 2014. 许可证和 otizm: olgu sunumu,稍后再谈,三十六“(1):49 – 54。”
这是我的.bst 代码:
FUNCTION {bbl.and}
{ "and"}
FUNCTION {format.names}
{ 'bibinfo :=
duplicate$ empty$ 'skip$ {
's :=
"" 't :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr
"{vv~}{ll}{, jj}{, f{.}.}"
format.name$
bibinfo bibinfo.check
't :=
nameptr #1 >
{
namesleft #1 >
{ ", " * t * }
{
s nameptr "{ll}" format.name$ duplicate$ "others" =
{ 't := }
{ pop$ }
if$
numnames #2 >
{ "," * }
'skip$
if$
t "others" =
{
" " * bbl.etal *
}
{
bbl.and
space.word * t *
}
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
} if$
}
FUNCTION {format.names.ed}
{
'bibinfo :=
duplicate$ empty$ 'skip$ {
's :=
"" 't :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr
"{f{.}.~}{vv~}{ll}{ jj}"
format.name$
bibinfo bibinfo.check
't :=
nameptr #1 >
{
namesleft #1 >
{ ", " * t * }
{
s nameptr "{ll}" format.name$ duplicate$ "others" =
{ 't := }
{ pop$ }
if$
numnames #2 >
{ "," * }
'skip$
if$
t "others" =
{
" " * bbl.etal *
}
{
bbl.and
space.word * t *
}
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
} if$
}
答案1
我以蛮力的方式更改了它。我注释掉了bbl.and
和space.word * t *
。然后用 新建一行"," * space.word * t
。
"," * space.word * t
%bbl.and
%space.word * t *
我还更改了下面的几行。
numnames #2 >
{ "," * }
'skip$
到
numnames #2 >
{ "" * }
'skip$
完整代码如下:
FUNCTION {format.names}
{ 'bibinfo :=
duplicate$ empty$ 'skip$ {
's :=
"" 't :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr
"{vv~}{ll}{, jj}{, f{.}.}"
format.name$
bibinfo bibinfo.check
't :=
nameptr #1 >
{
namesleft #1 >
{ ", " * t * }
{
s nameptr "{ll}" format.name$ duplicate$ "others" =
{ 't := }
{ pop$ }
if$
numnames #2 >
{ "" * }
'skip$
if$
t "others" =
{
" " * bbl.etal *
}
{
"," * space.word * t
%bbl.and
%space.word * t *
}
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
} if$
}
FUNCTION {format.names.ed}
{
'bibinfo :=
duplicate$ empty$ 'skip$ {
's :=
"" 't :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr
"{f{.}.~}{vv~}{ll}{ jj}"
format.name$
bibinfo bibinfo.check
't :=
nameptr #1 >
{
namesleft #1 >
{ ", " * t * }
{
s nameptr "{ll}" format.name$ duplicate$ "others" =
{ 't := }
{ pop$ }
if$
numnames #2 >
{ "" * }
'skip$
if$
t "others" =
{
" " * bbl.etal *
}
{
"," * space.word * t
%bbl.and
%space.word * t *
}
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
} if$
}