1

This is another case in which a previous biblatex code no longer performs the desired function due to changes in biber/biblatex.

When running the code from Commas in biblatex entries, which itself is an update from Placement of Jr. and Sr. with biblatex, the words Jr. and Sr. are no longer placed after the person's name in the reference list. I'm running biblatex verson 3.11 with biber version 2.11.

\documentclass{article}
\usepackage[style = authoryear-comp]{biblatex}


\renewbibmacro*{name:last-first}[4]{%
  \ifuseprefix
    {\usebibmacro{name:delim}{#3#1}%
     \usebibmacro{name:hook}{#3#1}%
     \ifblank{#3}{}{%
       \ifcapital
         {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
         {\mkbibnameprefix{#3}\isdot}%
       \ifpunctmark{'}{}{\bibnamedelimc}}%
     \mkbibnamelast{#1}\isdot
     \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{#2}\isdot}%
     \ifblank{#4}{}{\revsdnamepunct\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
    {\usebibmacro{name:delim}{#1}%
     \usebibmacro{name:hook}{#1}%
     \mkbibnamelast{#1}\isdot
     \ifblank{#2#3}{}{\revsdnamepunct}%
     \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{#2}\isdot}%
     \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
     \ifblank{#4}{}{\revsdnamepunct\bibnamedelimd\mkbibnameaffix{#4}\isdot}}}

\DeclareStyleSourcemap{
    \maps[datatype = bibtex]{
        \map{%% Make sure a field like [Adam John Smith] comes out as [Smith, Adam John]
            \step[fieldsource = author,
                match = \regexp{\A\[(.+)\s+([^\s]+)\]\Z},
                replace = {[$2, $1]}]
    }
        \map{%% Abbreviate an entry such as Adam J[ohn] Smith to Smith, Adam J.
            \step[fieldsource = author,
                match = \regexp{(\w+)\[(.+?)\]},
                replace ={$1.}]
    }
        \map{%% Abbreviate an entry such as [Adam John] Smith to Smith
            \step[fieldsource = author,
                notmatch = \regexp{\A\[(.+)\]\Z},
                final]
            \step[fieldsource = author,
                match = \regexp{(\A|\,\s)\[(.+?)\]},
                replace = {$1}]
    }
  }
}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{lennon1970,
    AUTHOR = "J[ohn] Lennon",
    TITLE = "My life with the Beatles",
    YEAR = "1970",
    SORTNAME = "John Lennon"}
@BOOK{lennon1971,
    AUTHOR = "[John Lennon]",
    TITLE = "Moving on",
    YEAR = "1971",
    SORTNAME = "John Lennon"}
@BOOK{lennon1972,
    AUTHOR = "[J. John Lennon]",
    TITLE = "Moving further on",
    YEAR = "1972",
    SORTNAME = "John Lennon"}
@BOOK{lennon1973,
    AUTHOR = "John Lennon",
    TITLE = "Still moving on",
    YEAR = "1973",
    SORTNAME = "John Lennon"}
@BOOK{lennon1974,
    AUTHOR = "[John] Lennon",
    TITLE = "I'm out of here",
    YEAR = "1974",
    SORTNAME = "John Lennon"}
@BOOK{lennon1975,
    AUTHOR = "Lennon, [John]",
    TITLE = "I'm out of here",
    YEAR = "1975",
    SORTNAME = "John Lennon"}
@BOOK{beatles1970,
    AUTHOR = "John W[inston] Lennon and J[ames] Paul McCartney",
    TITLE = "Let it be",
    YEAR = "1970"}
@BOOK{gauch2012,
    AUTHOR = "Gauch, Jr., Hugh G.",
    TITLE = "Scientific method in brief",
    YEAR = "2012",
    LOCATION = "Cambridge",
    PUBLISHER = "Cambridge University Press"}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}
\printbibliography
\end{document}

enter image description here

Sverre
  • 20,729

1 Answers1

4

This is due to changes in the name format for biblatex 3.3. See also Biblatex 3.3 name formatting.

While details are different in the new name format, the general structure of macros like name:family-given (formerly name:last-first) has stayed the same. With some experience it is therefore possible to convert from the old to the new name format (as explained in Ulrike's answer to the linked question and the links there). So to make my life easier I just copied name:family-given from biblatex.def and compared it to your name:last-first. The only structural change to the original name:family-given is the position of the lines involving #4/\mkbibnamesuffix.

Note that I made the comma before "Jr."/"Sr." customisable with \bibnamedelimsuffix.

\documentclass{article}
\usepackage[style = authoryear-comp]{biblatex}

\newcommand*{\bibnamedelimsuffix}{\addcomma\bibnamedelimd}

\renewbibmacro*{name:family-given}[4]{%
  \ifuseprefix
    {\usebibmacro{name:delim}{#3#1}%
     \usebibmacro{name:hook}{#3#1}%
     \ifdefvoid{#3}{}{%
       \ifcapital
         {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
         {\mkbibnameprefix{#3}\isdot}%
       \ifprefchar{}{\bibnamedelimc}}%
     \mkbibnamefamily{#1}\isdot
     \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{#2}\isdot}%
     \ifdefvoid{#4}{}{\bibnamedelimsuffix\mkbibnamesuffix{#4}\isdot}}
    {\usebibmacro{name:delim}{#1}%
     \usebibmacro{name:hook}{#1}%
     \mkbibnamefamily{#1}\isdot
     \ifboolexpe{%
       test {\ifdefvoid{#2}}
       and
       test {\ifdefvoid{#3}}}
       {}
       {\revsdnamepunct}%
     \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{#2}\isdot}%
     \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
     \ifdefvoid{#4}{}{\bibnamedelimsuffix\mkbibnamesuffix{#4}\isdot}}}

\DeclareStyleSourcemap{
  \maps[datatype = bibtex]{
    \map{%% Make sure a field like [Adam John Smith] comes out as [Smith, Adam John]
      \step[fieldsource = author,
          match = \regexp{\A\[(.+)\s+([^\s]+)\]\Z},
          replace = {[$2, $1]}]
    }
    \map{%% Abbreviate an entry such as Adam J[ohn] Smith to Smith, Adam J.
      \step[fieldsource = author,
          match = \regexp{(\w+)\[(.+?)\]},
          replace ={$1.}]
    }
    \map{%% Abbreviate an entry such as [Adam John] Smith to Smith
      \step[fieldsource = author,
          notmatch = \regexp{\A\[(.+)\]\Z},
          final]
      \step[fieldsource = author,
          match = \regexp{(\A|\,\s)\[(.+?)\]},
          replace = {$1}]
    }
  }
}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{lennon1970,
    AUTHOR = "J[ohn] Lennon",
    TITLE = "My life with the Beatles",
    YEAR = "1970",
    SORTNAME = "John Lennon"}
@BOOK{lennon1971,
    AUTHOR = "[John Lennon]",
    TITLE = "Moving on",
    YEAR = "1971",
    SORTNAME = "John Lennon"}
@BOOK{lennon1972,
    AUTHOR = "[J. John Lennon]",
    TITLE = "Moving further on",
    YEAR = "1972",
    SORTNAME = "John Lennon"}
@BOOK{lennon1973,
    AUTHOR = "John Lennon",
    TITLE = "Still moving on",
    YEAR = "1973",
    SORTNAME = "John Lennon"}
@BOOK{lennon1974,
    AUTHOR = "[John] Lennon",
    TITLE = "I'm out of here",
    YEAR = "1974",
    SORTNAME = "John Lennon"}
@BOOK{lennon1975,
    AUTHOR = "Lennon, [John]",
    TITLE = "I'm out of here",
    YEAR = "1975",
    SORTNAME = "John Lennon"}
@BOOK{beatles1970,
    AUTHOR = "John W[inston] Lennon and J[ames] Paul McCartney",
    TITLE = "Let it be",
    YEAR = "1970"}
@BOOK{gauch2012,
    AUTHOR = "Gauch, Jr., Hugh G.",
    TITLE = "Scientific method in brief",
    YEAR = "2012",
    LOCATION = "Cambridge",
    PUBLISHER = "Cambridge University Press"}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}
\printbibliography
\end{document}

Gauch, Hugh G., Jr. (2012). Scientific method in brief. Cambridge: Cambridge University Press.

moewe
  • 175,683