Skip to content

Instantly share code, notes, and snippets.

@fak
Last active November 16, 2016 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fak/8578582 to your computer and use it in GitHub Desktop.
Save fak/8578582 to your computer and use it in GitHub Desktop.
No period after one-letter initials in biblatex

In an ideal bibliography file, authors are identified by full last name and full first name. The citation formatting will then abbreviate first names to initials or keep full names according to user specifications. However, when parsing meta-data from articles, full names are often abbreviated to initials. Biblatex takes these initials as full names, which is logical but not practical, given the incomplete nature of many of the meta-data. Thus, authors with only a single first name will not have a period after their name initial if the initial was the only first name information available to biblatex. To fix this, a hack was proposed in a post on stackexchange. For me and my limited understanding of biblatex, this did not work out of the box, but combined with this post I figured that what I needed to do was to set my name format to last-first and then define last-first accordingly, as shown below.

\DeclareNameAlias{sortname}{last-first}
\DeclareNameFormat{last-first}{%
  \iffirstinits
    {\usebibmacro{name:last-first}{#1}{#4\adddot}{#5}{#7}}
    {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
  \usebibmacro{name:andothers}}

This was a modification to the CUEDthesisPSnPDF.cls file, just below

\usepackage[firstinits=true,natbib=true,doi=false,isbn=false,url=false,style=authoryear,maxnames=2,maxbibnames=20,mergedate=false,maxcitenames=2,hyperref=true,dashed=false,backend=bibtex8]{biblatex}
@valbert4
Copy link

valbert4 commented Nov 16, 2016

Thanks for clarifying this. Unfortunately, it doesn't work with style=phys. The errors I get are of this form:

! Illegal parameter number in definition of \blx@defformat@d.
<to be read again>
4
l.103 {\usebibmacro{name:last-first}{#1}{#4
\adddot}{#5}{#7}}
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.

It does this for arguments 3,4,5,7. I am OK with using terseinits=true, but wanted to run this by you in case you knew how to fix. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment