5

Hi I want to replace the "and" inside the bibliography if there are listed two or more authors. The "and" should be replaced by a simple comma, so:

Name.A, Name.B, Name.C

My following code:

\documentclass[a4paper,12pt]{scrartcl} \usepackage[ngerman]{babel} \usepackage{csquotes} \usepackage [style=authoryear, sorting=nyt, labelnumber ,maxbibnames=9,maxcitenames=2,uniquelist=false, backend=biber, doi=false,isbn=false,url=false, uniquename=false, date=year, giveninits=true] {biblatex} \usepackage{filecontents} \DeclareNameAlias{sortname}{last-first} \DeclareNameAlias{default}{last-first} \DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}} %Remove Dot and Add Space \renewbibmacro*{volume+number+eid}{% \printfield{volume}% % \setunit*{\adddot}% DELETED % \setunit*{\addnbspace}% NEW (optional); there's also \addnbthinspace \printfield{number}% \setunit{\addcomma\space}% \printfield{eid}} \DeclareFieldFormat[article]{number}{\mkbibparens{#1}} \renewbibmacro{in:}{} \DeclareFieldFormat{labelnumberwidth}{[#1]} \defbibenvironment{bibliography} % from numeric.bbx {\list {\printtext[labelnumberwidth]{% \printfield{prefixnumber}% \printfield{labelnumber}}} {\setlength{\labelwidth}{\labelnumberwidth}% \setlength{\leftmargin}{\labelwidth}% \setlength{\labelsep}{\biblabelsep}% \addtolength{\leftmargin}{\labelsep}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% \renewcommand*{\makelabel}[1]{\hss##1}} {\endlist} {\item} \begin{filecontents}{\jobname.bib} @Book{ISL, author = {James, Gareth and Witten, Daniela and Hastie, Trevor and Tibshirani, Robert}, title = {An Introduction to Statistical Learning: With Applications in R}, year = {2014}, publisher = {Springer Publishing Company, Incorporated}, isbn = {1461471370, 9781461471370}, } \end{filecontents} \addbibresource{\jobname.bib} \begin{document} \textcite{ISL} \printbibliography \end{document} 
2
  • I have to ask, do you know tex.stackexchange.com/q/446855/35864? Commented Aug 21, 2018 at 15:25
  • A student colluege :) Commented Aug 21, 2018 at 15:26

1 Answer 1

4
\DeclareDelimAlias{finalnamedelim}{multinamedelim} 

should do that.

\documentclass[a4paper,12pt]{scrartcl} \usepackage[ngerman]{babel} \usepackage{csquotes} \usepackage [style=authoryear, labelnumber, maxbibnames=9, maxcitenames=2, uniquelist=false, backend=biber, doi=false,isbn=false,url=false, uniquename=false, date=year, giveninits=true] {biblatex} \usepackage{filecontents} \DeclareNameAlias{default}{family-given} \DeclareNameAlias{sortname}{default} \DeclareDelimAlias{finalnamedelim}{multinamedelim} \DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}} %Remove Dot and Add Space \renewbibmacro*{volume+number+eid}{% \printfield{volume}% % \setunit*{\adddot}% DELETED % \setunit*{\addnbspace}% NEW (optional); there's also \addnbthinspace \printfield{number}% \setunit{\addcomma\space}% \printfield{eid}} \DeclareFieldFormat[article]{number}{\mkbibparens{#1}} \renewbibmacro{in:}{} \DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}} \defbibenvironment{bibliography} % from numeric.bbx {\list {\printtext[labelnumberwidth]{% \printfield{prefixnumber}% \printfield{labelnumber}}} {\setlength{\labelwidth}{\labelnumberwidth}% \setlength{\leftmargin}{\labelwidth}% \setlength{\labelsep}{\biblabelsep}% \addtolength{\leftmargin}{\labelsep}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% \renewcommand*{\makelabel}[1]{\hss##1}} {\endlist} {\item} \begin{filecontents}{\jobname.bib} @book{ISL, author = {James, Gareth and Witten, Daniela and Hastie, Trevor and Tibshirani, Robert}, title = {An Introduction to Statistical Learning}, subtitle = {With Applications in R}, year = {2014}, publisher = {Springer}, isbn = {9781461471370}, } \end{filecontents} \addbibresource{\jobname.bib} \begin{document} \textcite{ISL} \printbibliography \end{document} 

James, G., Witten, D., Hastie, T., Tibshirani, R. (2014). An Introduction to Statistical Learning. With Applications in R. Springer.


If you only want the change to apply to the bibliography you need

 \DeclareDelimFormat[bib,biblist]{finalnamedelim}{\addcomma\space} 

instead. Unfortunately, there is no elegant way to solve this with an alias, so we have to have an explicit definition here.

8
  • 1
    @Vala Glad I could help. Is it a usual requirement at your university to number the bibliography even though the citations are author-year and the numbers therefore useless (except for counting the references)? (BTW: You can take the solution from tex.stackexchange.com/q/446855/35864, it has slightly less overhead than actually ordering labelnumbers from Biber). Commented Aug 21, 2018 at 15:31
  • Yes unfortunately we have to number it through despite author-year style. This makes it very cumbersome for latex beginners who only know how to write formulas Commented Aug 22, 2018 at 7:11
  • 1
    ... Finally, in my opinion the added numeric labels make it a bit harder to navigate a bibliography that should be cut out for author-year references. In the standard bibliography output of ´authoryear`, the first line is slightly further to the left than subsequent lines, which are indented, that makes it very easy to find the beginning of an entry and focuses the reader on the first letter of the name (by which the bibliography is sorted). If instead the numeric labels appear they are more prominent and the names don't really jump right at the reader, making thinsg harder to find. ... Commented Aug 22, 2018 at 7:46
  • 1
    ... Since the numbers have absolutely no meaning they just distract from the real sorting. Commented Aug 22, 2018 at 7:47
  • 2
    @Vala Edited the answer with a suggestion that only changes the "and" in the bibliography. When I read 'bibliography' I usually include the entire document, so I misunderstood your question, sorry. In those cases I usually need an explicit mention that the cite behaviour should not be changed as a reminder. I'll be happy to discuss the numbers in author-year bibliographies with your supervisor ;-) Commented Aug 22, 2018 at 12:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.