I am compiling a bibliography in a book by means of bibtex
using plain.bst
style (or rather its Polish version plplain.bst
). Using answers to other questions on similar problems, I have modified plplain.bst
so as to change the default order of names and surnames, and now an exemplary entry from my bibliography looks like this:
However, I do not know how to convince bibtex
to put a comma after the name's initial (and before the title) to have something like the following:
[10] Surname, N., The title
and similarly in case of more than one author or more than one-letter initials. I tried tinkering with bst
file, yet with no success.
Currently, the part of the file responsible for names syntax looks like this:
FUNCTION {format.names}
{ 's :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr "{vv }{ll}{, jj}{, f.}" format.name$ 't :=
nameptr #1 >
{ numnames #2 =
{ ", " * }
'skip$
if$
namesleft #1 >
{ ", " * t * }
{ numnames #2 >
{ "," * }
'skip$
if$
t "others" =
{ " i~in." * }
{ " " * t * }
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$ }
I would be grateful if you could explain to me how to achieve what I want.
Following Guido's answer and my problems with implementation of his solution I thought I could add code of those fragments of
bst
file to which he refers.
FUNCTION {format.authors}
{ author empty$
{ "" }
{ author format.names }
if$
}
FUNCTION {output.nonnull}
{ 's :=
output.state mid.sentence =
{ ", " * write$ }
{ output.state after.block =
{ add.period$ write$
newline$
"\newblock " write$
}
{ output.state before.all =
'write$
{ add.period$ " " * write$ }
if$
}
if$
mid.sentence 'output.state :=
}
if$
s
}
FUNCTION {output.check}
{ 't :=
duplicate$ empty$
{ pop$ "empty " t * " in " * cite$ * warning$ }
'output.nonnull
if$
}
I probably misunderstood something from Guido's answer, so it would be great if you could help me to get it straight.
output.state mid.sentence =
rather thanmid.sentence output.state :=
. Or is that the original and not what you've tried? Note that you shouldn't be editingplplain.bst
itself but a renamed copy of it. – cfr May 21 '16 at 0:55