删除参考书目中的“and”

删除参考书目中的“and”

嗨,如果列出了两位或更多作者,我想替换参考书目中的“and”。应该用一个简单的逗号替换“and”,因此:

姓名.A, 姓名.B, 姓名.C

我的以下代码:

\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}

答案1

\DeclareDelimAlias{finalnamedelim}{multinamedelim}

应该这么做。

\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)。《统计学习简介。R 中的应用》。Springer。


如果你只希望更改应用于你需要的参考书目

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

不幸的是,没有优雅的方法用别名来解决这个问题,所以我们必须在这里有一个明确的定义。

相关内容