Biblatex 3.3 name formatting

I would like to create a custom format for citing authors' names in the text, let's call it "newformat". One option I can think of is creating a new bibmacro for names where the parameters are changed to my liking, such as

\documentclass{article}

\usepackage{filecontents}
% biber is version 2.4; the latest?

\begin{filecontents}{\jobname.bib}
@misc{Doe12,
author = {Doe, John},
year = {2012},
title = {A macro for formatting names},
}
\end{filecontents}

\nocite{*}

\newbibmacro{name:newformat}{\printnames{authors}}
\DeclareNameFormat{newformat}{%
\usebibmacro{name:newformat}{\textbf{#1}}{\textbf{#3}}{#5}{#7}%
\usebibmacro{name:andothers}%
}

\begin{document}

\section*{Testing the format here}

I am citing
\citename{Doe12}[newformat]{author}

\printbibliography % to make sure that the .bib file is properly formated.

\end{document}


Here, I just used \textbf for the sake of the example, but I ultimately want to use other functions, say upper case or palindrome!

However, I get this weird error message:

! Illegal parameter number in definition of \blx@defformat@d.
3
l.20   \usebibmacro{name:last}{#1}{#3
}{#5}{#7}%


which seems to indicate that the second option {#3} is not expected. I am a bit at a lost here; I checked the biblatex package and \usebibmacro{name:last} must be given 4 parameters, isn't it? Please advise.

• The syntax of the command has changed. See github.com/plk/biblatex/issues/372 – Ulrike Fischer Mar 14 '16 at 21:14
• You could probably achieve what you want here by temporary redefining \mkbibnamefamily and friends. That way you don't have to fiddle round with name formats. – moewe Mar 15 '16 at 6:59
• @UlrikeFischer Do you want to write up an answer? I feel we are going to see quite some of those questions (this one, for example) and a good go-to answer would be nice. – moewe Mar 15 '16 at 7:00

In biblatex 3.3. the format of \DeclareNameFormat has changed. In its code part it no longer accepts 8 arguments, but only one. For the various parts of a name there are now macros which you get by splitting the main name data with \namepart.

The change in the name formatting also affects commands like \mkbibnamelast (now \mkbibnamefamily) and bib-macros like \name:first-last (now name:given-family) and options like firstinits (now giveninits). This means that quite a number of older documents and styles must be adapted. One should to check the documentation when using older examples involving the formatting of names.

Your example could look like this in the new format

\documentclass{article}

\usepackage{filecontents}
% biber is version 2.4; the latest?

\begin{filecontents}{\jobname.bib}
@misc{Doe12,
author = {Doe, John},
year = {2012},
title = {A macro for formatting names},
}
\end{filecontents}

\nocite{*}

\newbibmacro{name:newformat}{%
\textbf{\namepartfamily}  % #1->\namepartfamily, #2->\namepartfamilyi
\textbf{\namepartgiven}   % #3->\namepartgiven,  #4->\namepartgiveni
[prefix: \namepartprefix] % #5->\namepartprefix, #6->\namepartprefixi
[suffix: \namepartsuffix] % #7->\namepartsuffix, #8->\namepartsuffixi
}

\DeclareNameFormat{newformat}{%
\nameparts{#1}% split the name data, will not be necessary in future versions
\usebibmacro{name:newformat}%
\usebibmacro{name:andothers}%
}

\begin{document}

\section*{Testing the format here}

I am citing
\citename{Doe12}[newformat]{author}

\end{document}


Be aware: I did not try to make a good looking format. E.g I didn't add suitable tests for empty name parts.

The example also don't use the same style as the standard definitions. biblatex itself would define the bib macro as a macro with 4 arguments:

   \newbibmacro*{name:newformat}[4]{ \textbf{#1} \textbf{#2} ...}


and then call the macro with arguments in \DeclareNameFormat

    \usebibmacro{name:newformat}{\namepartfamily}{\namepartgiven}{...}{...}


Imho my version is easier to understand and easier to extend, but this is a matter of taste.

The bonus is that the name system is now extensible and new name parts can be added in the future.

https://github.com/plk/biblatex/issues/372

http://www.texdev.net/2016/03/13/biblatex-a-new-syntax-for-declarenameformat/

Check also the documentation, the release notes (in the doc folder of biblatex) and the examples (for an example how to extend the name system).

• Thank you very much. I believe this answer would work very well as a go-to name formatting with version >= 3.3 answer. Would you mind adding some of the links and references you put in tex.stackexchange.com/questions/299061/… – moewe Mar 15 '16 at 9:41
• Maybe you could add an easy to parse list of things that need changing along with their new counterparts. I suppose we are going to send a lot of people here and it would be nice if this answer could give an easy-to-find solution to all name-related problems in v 3.3. – moewe Mar 15 '16 at 13:35
• @moewe: I will try to expand the answer when I see new related questions. But I don't have much time now, so it will have to go step by step. (I already moved the list of other things to change to the top, so that it can be seen directly). – Ulrike Fischer Mar 15 '16 at 13:38
• Oh, there is no need to rush this at all. – moewe Mar 15 '16 at 13:49
• Many thanks @UlrikeFischer for this answer, it is much appreciated. – Denis Cousineau Mar 15 '16 at 14:07

Bolding name, family name and date in biblatex. I tried, it works

\AtBeginBibliography{%
\renewcommand*\mkbibnamegiven[1]{\mkbibbold{#1}}
\renewcommand*\mkbibnamefamily[1]{\mkbibbold{#1}}
\renewcommand*\mkbibnameprefix[1]{\mkbibbold{#1}}
\renewcommand*\mkbibnameaffix[1]{\mkbibbold{#1}}
\DeclareFieldFormat{parens}{\mkbibbold{\mkbibparens{#1}}}
\DeclareFieldFormat{date}{\mkbibbold{#1}}
\DeclareFieldFormat{author}{\mkbibbold{#1}}
}
\DeclareNameAlias{sortname}{family-given}
\DeclareNameAlias{default}{family-given}

• Welcome to TeX.SX! You may want to add a few % here and there to prevent unwanted space. I don't think this quite answers the question as posed in the OP. While you show how to bold certain elements of the bibliography, this answer does not show how to adapt code using the old name format to the new format. – moewe May 31 '18 at 16:34