8

For university I have to use a certain format for my references:

(1) If there are only two authors I have to write 'and' between them (I got this),

(2) but if there are three or more authors I have to write only a comma like between the first and second author.

I've prepared a MWE for this, but it doesn't include the 2nd rule:

\documentclass[a4paper,10pt]{article}
\usepackage[ansinew]{inputenc}
\usepackage{csquotes}
\usepackage[style=authoryear, 
sorting=nyt, 
natbib=true,
giveninits=true, %to shorten the first names
maxcitenames=2,  %I use these two options to produce the short form with 'et al' for citations with 3 or more authors
mincitenames=1   %see above
]{biblatex}

\begin{filecontents}{references.bib}
    @article{AB.2022,
      title = {Test Title},
      volume = {128},
      journaltitle = {Journal ab},
      author = {AuthorA, A. and AuthorB, B.},
      date = {2022},
      pages = {62--69},}
      
    @article{C+.2022,
      title = {Another Test Title},
      volume = {182},
      journaltitle = {Journal cde},
      author = {AuthorC, C. and AuthorD, D. and AuthorE, E.},
      date = {2022},
      pages = {58--93},}
\end{filecontents}
\addbibresource{references.bib}

\DeclareNameAlias{sortname}{family-given} %order of sirname and first name in the bibliography


\begin{document}
First citation \parencite{AB.2022}.
And second citation \parencite{C+.2022}.
\printbibliography
\end{document}

I end up getting this:

AuthorA, A. and AuthorB, B. (2022). “Test Title”. In: Journal ab 128, pp. 62– 69.

AuthorC, C., AuthorD, D., and AuthorE, E. (2022). “Another Test Title”. In: Journal cde 182, pp. 58–93.

I need the first 'and' (italic) but I don't want the second 'and' (bold), just like this:

AuthorC, C., AuthorD, D., AuthorE, E. (2022). “Another Test Title”. In: Journal cde 182, pp. 58–93.

Do you think this is possible? I've already searched for a solution but found nothing helpful. I know that there's something like this \DeclareDelimFormat[bib]{finalnamedelim}{\space\&\space} but this means you change the 'and' to whatever you want for both references. I just want it to change if there are three or more authors.

I hope you can help me with this, so I thank you in advance!

1 Answer 1

9

You were very much in the right direction. Indeed, if you look at the default definition of the finalnamedelim format, you'll find that it already differentiates when there are up to two from when there are more names in the list, this to handle the serial comma. So it is straightforward to adjust the default definition for what you are wanting to achieve:

\documentclass[a4paper,10pt]{article}
\usepackage[ansinew]{inputenc}
\usepackage{csquotes}
\usepackage[style=authoryear,
sorting=nyt,
natbib=true,
giveninits=true, %to shorten the first names
maxcitenames=2,  %I use these two options to produce the short form with 'et al' for citations with 3 or more authors
mincitenames=1   %see above
]{biblatex}

\begin{filecontents}{references.bib}
    @article{AB.2022,
      title = {Test Title},
      volume = {128},
      journaltitle = {Journal ab},
      author = {AuthorA, A. and AuthorB, B.},
      date = {2022},
      pages = {62--69},}

    @article{C+.2022,
      title = {Another Test Title},
      volume = {182},
      journaltitle = {Journal cde},
      author = {AuthorC, C. and AuthorD, D. and AuthorE, E.},
      date = {2022},
      pages = {58--93},}
\end{filecontents}
\addbibresource{references.bib}

\DeclareNameAlias{sortname}{family-given} %order of sirname and first name in the bibliography

\DeclareDelimFormat{finalnamedelim}{%
  \ifnumgreater{\value{liststop}}{2}{%
    \printdelim{multinamedelim}}{\addspace\bibstring{and}\space}}

\begin{document}
First citation \parencite{AB.2022}.
And second citation \parencite{C+.2022}.
\printbibliography
\end{document}

enter image description here

2
  • 4
    A couple of side-comments. Your MWE gives you a warning of conflicting options for giveninits, I haven't changed it, but you may want to take a look at it. Second, that's a nice first question! Clearly formulated, well researched, a proper MWE. Welcome to TeX.SX!
    – gusbrs
    Mar 12, 2022 at 0:07
  • For the giveninits problem I now use uniquename=init before which works great. This might be deleted later but just wanted to say thanks for your fast answer and the nice comments!
    – JAsch
    Mar 12, 2022 at 14:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .