How to abbreviate author's firstname in bibliography

Assuming that you're otherwise satisfied with the formatted output produced by the bibliography style unsrtdin -- i.e., if the only thing you want to change in the style file is to force BibTeX to always abbreviate first names down to their initials -- you could proceed as follows:

  • Make a copy of the file unsrtdin.bst and call it, say, myunsrtdin.bst. (Never edit the original style file directly.)

  • Open the file myunsrtdin.bst in your favorite text editor.

  • Search for the following line (in the function format.names):

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

    and change it to

    { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
    
  • Next, in the function format.crossref.editor, search for the line

        { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
    

    and change it to

        { editor #2 "{f. }{vv }{ll}{ jj}" format.name$ "others" =
    
  • Save the file and start using it by issuing the instruction \bibliographystyle{unsrtdin}.


I can't help but make a few remarks about the use of Zotero. You've already discovered one inconsistency: Sometimes the tool provides full first names of authors and editors, at other times it provides only abbreviated first names. Sadly, this is likely going to be the least of your worries with Zotero's output. Be sure to always check the .bib file (or files) generated by this tool for correctness of all input fields. In my own experience with Zotero, its output can contain quite a few embarrassing typos and, much worse, outright errors, such as missing authors in a multi-author publication.

This piece of advice about double-checking the validity of the files generated by Zotero (or any other online tool like it!) is independent of whether you end up using unsrtdin/BibTeX or biblatex/biber: BibTeX and bibLaTeX can do nothing about errors contained in the inputs they operate on.


Edit : For the current version (3.12) of biblatex, firstinits argument is depreciated. Use giveninits instead (cf. this question).


When using biblatex, just state this in your preamble:

\usepackage[backend=bibtex,firstinits=true]{biblatex}

If you want to add an unsorted style use this:

  \usepackage[backend=bibtex,style=numeric-comp,sorting=none,firstinits=true]{biblatex}

I currently use this line:

 \usepackage[backend=bibtex,citestyle=numeric-comp,bibstyle=ieee,sorting=none,minbibnames=5,maxbibnames=5,defernumbers=true,firstinits=true]{biblatex}

This allows for multiple bibliographies, limits the amount of reference names to 5, and uses a different citing and bibliography style.


Here are some possible alternatives for the solution. You can choose the one that fits you best.

1- switch to biblatex. It is a newer package to deal with bibliography; it is much easier to configure than bibtex styles. The manual might look scary, but you only have to change a few lines to get it working.

2- as already suggested in the comments, you can use an automated tool to generate a new bst file from scratch, if you have some liberty. You can use makebst, or the GUI program included in bib-it.

3 - hacking the bst files directly is also possible. You will need some programming experience to be able to understand what is going on, but since you speak of hacking Zotero, I guess this won't be a problem; keep in mind that bst files are written in a rather unusual stack-based language which might be difficult to understand at first. In your case, you probably only have to copy the format.name function used in abbrv.bst into unsrt.bst, replacing the existing one.

EDIT: maybe I should clarify what a bst file is. Bibliography styles in bibtex are handled through style files with extension .bst. If you use \bibliographystyle{unsrtdin}, then the file that will be loaded is unsrtdin.bst. The default styles can be found inside the tex install directory (on my Ubuntu for instance it's /usr/share/texlive/texmf-dist/bibtex/bst/); but, if you wish, you can create a new one by yourself and drop it in the same folder as your .tex file (or use some more involved "local install" method, if you think you need it for multiple tex files).