[Tex/LaTex] Abbreviated first names without spaces in between

bibtexnatbib

I would like A. B. Lastname to appear as A.B. Lastname in the bibliography. (I have already found how to abbreviate first names.)

(I have to solve this with bibtex and natbib because I am already using a hacked version of natbib.)

Best Answer

There are a couple of ways you can do this kind of thing. One is hacking the BST file yourself; the other is using custom-bib. In most cases, I would recommend the latter. However, in this case, it won’t quite do what you want it to; also, since you are already using a hacked BST, the first will be quicker for you anyway. I will discuss both, though.

Option 1: Hacking the BST

The first step is to grab a copy of the BST file you’re using and put it in your working directory. Based on the previous question you linked, it looks like you’ve already done that, and you have a BST called abbrvnamed.bst in your working directory. So I’ll start from there.

Now, find the line in the BST file that formats author names. Again, you already did this if you followed the advice in the previous question. In the case of abbrvnamed.bst, it looks like this:

{ s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=

Change it to this:

{ s nameptr "{f{.}.~}{vv~}{ll}{, jj}" format.name$ 't :=

That extra {.} tells the built-in BibTeX function format.name$ to replace the default “.␣” that appears between initials within the abbreviated first name with “.”. And that’s all there is to it!

If you’d like to learn how to hack BST files yourself, there’s a nice guide called Tame the BeaST.

Option 2: Using custom-bib

custom-bib (also known as makebst) is a great utility for creating your own BST files without having to hack them up yourself. I’m not going to give you any kind of tutorial here; it comes with plenty of documentation. But the way it works is that you pick a bunch of options from multiple-choice prompts, and it generates a BST based on your choices. For example, one of the prompts looks like this:

AUTHOR NAMES:
(*) Full, surname last (John Frederick Smith)
(f) Full, surname first (Smith, John Frederick)
(i) Initials + surname (J. F. Smith)
(r) Surname + initials (Smith, J. F.)
(s) Surname + dotless initials (Smith J F)
(w) Surname + comma + spaceless initials (Smith, J.F.)
(x) Surname + pure initials (Smith JF)
(y) Surname + comma + pure initials (Smith, JF)
(z) Surname + spaceless initials (Smith J.F.)
(a) Only first name reversed, initials (AGU style: Smith, J. F., H. K. Jones)
(b) First name reversed, with full names (Smith, John Fred, Harry Kab Jones)

Pretty cool, eh? Unfortunately, it doesn’t actually have the exact option that you want, “Spaceless initials + surname”. So you’d have to settle for one of the other options, or end up hacking the BST file anyway. But if you like customizing your bibliography styles, this is a utility you might want to get familiar with. (In fact, to figure out the syntax for Option 1, I generated two different BST files using custom-bib, one with the “Surname + initials” option and one with the “Surname + comma + spaceless initials” option, then diffed them.)