[Tex/LaTex] Placement of Jr. and Sr. with biblatex

biblatex

In most bibliographic styles, the suffixes Jr. and Sr. go after both names of an author in the bibliography, preceded by a comma:

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

It seems like most BibTeX styles have struggled to get this right. I've also found now that the default behavior of biblatex doesn't follow the standard either. In the example below, the suffix Jr. is placed according to the general guidelines.

\documentclass{article}
\usepackage[style = authoryear-comp]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@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

I've tried other permutations of the order First name, Last name, Jr. in the .bib file, but I haven't found one that gives the desired output.

According to the comments to Have the BibTeX styles gotten the placement of a name's "junior" part wrong?, both biblatex-apa and biblatex-chicago have the desired order, so it is at least possible to implement this in biblatex. How can I do it?


EDIT

When implementing Guido's suggestion, the default layout of subsequent authors, which is first namelast name, changes to last namecommafirst name.

\documentclass{article}
\usepackage[style = authoryear-comp]{biblatex}
\DeclareNameFormat{author}{%
  \usebibmacro{name:delim}{#5#1}%
  \ifblank{#5}{#1}{#5 #1}\addcomma\addspace
  #3\isdot
  \ifblank{#7}{}{\addcomma\addspace #7}\isdot
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{gauch2012,
    AUTHOR = "Gauch, Jr., Hugh G.",
    TITLE = "Scientific method in brief",
    YEAR = "2012",
    LOCATION = "Cambridge",
    PUBLISHER = "Cambridge University Press"}
@BOOK{chomsky1968,
    AUTHOR = "Noam Chomsky and Morris Halle",
    TITLE = "The sound pattern of English",
    YEAR = "1968",
    LOCATION = "New York, NY",
    PUBLISHER = "Harper \& Row",
    SERIES = "Studies in language"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

Best Answer

The standard biblatex directives to format names use some auxiliary bibmacro:

name:first-last
name:last-first
name:last 

For predefined name formats. Each of these take four arguments: the first is for the family name, the second is for the given name, the third for the "von" part, and the fourth for the "junior" part.

Thus, one can use of the auxiliary format, for example

\DeclareNameFormat{author}{
  \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}
}

For the parameters, \DeclareNameFormat splits a name in 8 parts:

#1: last name
#2: last name (as initials)
#3: first name
#4: first name (as initials)
#5: name prefix (von part)
#6: name prefix (as initials)
#7: name affix (junior part)
#8: name affix (as initials)

If the auxiliary bib macros do not produce the desired format, one has to provide a new definition. For example, a simplified definition for the format in the OP can look like the following:

\DeclareNameFormat{author}{%
  \usebibmacro{name:delim}{#5#1}%
  \ifblank{#5}{#1}{#5 #1}\addcomma\addspace
  #3\isdot
  \ifblank{#7}{}{\addcomma\addspace #7}\isdot
}

author (or other names) are lists, thus \DeclareNameFormat loops over all the elements in the list (up to a limit if give, for example by maxcitenames) and for each name it executes the code it the body of the definition.

Here the first step is the predefined biblatex macro name:delim. This macro takes care of the punctuation between the names. For the first name it does nothing, for successive names it insert a comma an and a comma and and before the last one.

The second step is to see if the "von" part is empty (parameter #5): if it is it print the last name (parameter #1), otherwise it prints the von part and the last name (#5 #1).

The next step is to print first name (parameter #3) (here the definition assumes that there is a first name!), so the separator between the last and first name is printed with e first name. The scope of \isdot is to ensure that a period in an initial is not consider as full stop, and thus the following punctuation is not ignored.

The final step is to check if there is a junior part (parameter #7). If it is not black it is printed. The \isdot is to cover the same situation as before.

EDIT

To use the above definition in a last-first/first-last schema, the above definition can replace the standard name:last-first macro, namely:

\renewbibmacro{name:last-first}[4]{
  \usebibmacro{name:delim}{#3#1}%
  \ifblank{#3}{#1}{#3 #1}\addcomma\addspace
  #2\isdot
  \ifblank{#4}{}{\addcomma\addspace #4}\isdot
}

enter image description here