TransWikia.com

Removing given name in bibliography

TeX - LaTeX Asked by Enredanrestos on April 20, 2021

I wish to use all the DeclareNameFormat code of the standard biblatex styles, but I do not want to write given names nor initials in the bibliography. Is it possible to empty the constant namepartgiven AtEveryBibitem? I guess this should do the trick, right? How to clear (for example) parts of the name list? I know how to clear fields, but not parts of the author name.

This is a bad solution, for example:

DeclareNameFormat{author}{namepartfamily}

because I lose the ‘et al.’ and all the smartness of the default citing styles.

One Answer

biblatex already has a name format called labelname which does this. It also allows for disambiguation on the basis of the uniquename option if you use that. Just add this to your preamble:

DeclareNameAlias{default}{labelname}

If you don't wan't the initials in the following MWE, then leave out the uniquename=init option.

documentclass{article}
begin{filecontents}[overwrite]{jobname.bib}
@book{a,
  author = {Doe, Jane and Doe, John},
  title = {A Title},
  date = {2021}
}
@book{b,
  author = {Doe, Barry and Doe, Sheila},
  title = {Another Title},
  date = {2021}
}
@book{c,
  author = {Author, An and Writer, Another},
  title = {Yet Another Title},
  date = {2021}
}
end{filecontents}
usepackage[uniquename=init]{biblatex}
addbibresource{jobname.bib}
DeclareNameAlias{default}{labelname}
begin{document}
nocite{*}
printbibliography
end{document}

output

Addendum: Why does this work?

biblatex creates a special field for citations called labelname. Most often this is just the family name, but can include a given name or initial if we need to remove ambiguity. In order to print this field, we need a name format that just prints the family name. This name format is defined in biblatex.def as:

DeclareNameFormat{labelname}{%
  ifcasevalue{uniquename}%
    usebibmacro{name:family}
      {namepartfamily}
      {namepartgiven}
      {namepartprefix}
      {namepartsuffix}%
  or
    ifuseprefix
      {usebibmacro{name:given-family}
        {namepartfamily}
        {namepartgiveni}
        {namepartprefix}
        {namepartsuffixi}}
      {usebibmacro{name:given-family}
        {namepartfamily}
        {namepartgiveni}
        {namepartprefixi}
        {namepartsuffixi}}%
  or
    usebibmacro{name:given-family}
      {namepartfamily}
      {namepartgiven}
      {namepartprefix}
      {namepartsuffix}%
  fi
  usebibmacro{name:andothers}}

In this format there is logic for disambiguation. But if disambiguation isn't needed, then the macro name:family (also defined in biblatex.def) is called to print just the family name.

Now all we need to do is tell biblatex to use this format when printing names in the bibliography. The simplest and most global way to do this is to change the default way names are printed from given-family to labelname. We do this using an alias:

DeclareNameAlias{default}{labelname}

Be aware that not all bibliography styles use the default name format in the bibliography though. Some use sortname so you'd need to change that instead.

Correct answer by David Purton on April 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP