将参考书目中的“and”改为“&”并删除牛津逗号

将参考书目中的“and”改为“&”并删除牛津逗号

我需要将参考书目中的“and”改为“&”,并删除牛津逗号。我看到了一个解决方案删除牛津逗号建议更改 .bst 文件,但如果可能的话,我宁愿不这样做。它还建议使用bibstyle=trad-unsrt选项,但我没有使用bibstyle。我找不到有关如何将“and”更改为“&”的任何建议,但由于“&”,搜索起来很困难。

编辑于 2014 年 3 月 31 日晚上 9:02(美国东部时间):我发现了如何在“等人“ 是不是存在(感谢@cfr)。但是,当“等人“ 存在。

编辑于 2014 年 3 月 31 日 10:21 EST:我发现了如何将“and”更改为“&”,并将代码合并到我的 MWE 中。

以下是我的引文的图片:

图片 1. enter image description here

“之前的逗号等人“第一个引文中的”是我想要删除的。

以下是我的 MWE。

\documentclass [12pt]{article}
\usepackage[
backend=bibtex,
citestyle=numeric,
isbn=false,
bibstyle=authoryear,
maxnames=3, % Max number of names before "et al" starts
minnames=3, % Must show at least three names for citations and bibliography
firstinits=true, % Removes period after first name intial 
terseinits=true, % Removes period after first name intial 
sorting=none] % List citations in order they appear
{biblatex}

\DeclareFieldFormat[article]{volume}{\textbf{#1}\addcomma\space} % Bolds volume of citation and adds comma after volume
\DeclareFieldFormat{pages}{#1} % No prefix for the "pages" field in the bibliography
\renewcommand*{\revsdnamepunct}{} % Removing the comma after last name in bibliography 
\renewcommand*{\revsdnamepunct}{} % Removing the periods after first name intial in bibliography
\renewcommand{\labelnamepunct}{\addspace} % Removes period after year in bibliography
\DeclareFieldFormat[article]{title}{#1}  % Remove quotes from journal title in bibliography
\DeclareNameAlias{sortname}{last-first} % Lists all authors with last name first in bibliography
\renewcommand*{\finalnamedelim}{\addspace\bibstring{and}\space} % Removes comma after penultimate name

\AtBeginBibliography{% Replaces "and" with "&" in bibliography
\renewcommand*{\finalnamedelim}{%
\ifnumgreater{\value{liststop}}{2}{}{}%
\addspace\&\space}%
}

\usepackage{xpatch}

\xpatchbibmacro{name:andothers}{ % Makes the "et al" italicized bibliography
\bibstring{andothers}%
}{%
\bibstring[\emph]{andothers}%
}{}{}

\renewbibmacro{in:}{% Removes "In" from bibliography entries
\ifentrytype{article}{}{%
\printtext{\bibstring{in}\intitlepunct}}}

\defbibenvironment{bibliography}
{\list 
{\printfield[labelnumberwidth]{labelnumber}} % Adds numbers to references and wraps the text for each bibliography entry
{\setlength{\labelwidth}{\labelnumberwidth}% 
\setlength{\leftmargin}{0pt}% 
\setlength{\labelsep}{\biblabelsep}% 
\setlength{\itemsep}{\bibitemsep}% 
\setlength{\itemindent}{\labelwidth}% 
\addtolength{\itemindent}{\labelsep}% 
\setlength{\parsep}{\bibparsep}}% 
\renewcommand*{\makelabel}[1]{\hss##1}} 
{\endlist} 
{\item}

\DeclareFieldFormat{labelnumberwidth}{#1.} % Adds a period after each reference number in bibliography

\usepackage{filecontents}
\begin{filecontents*}{test.bib}

@article{author2014,
author = {Author, A. B. and Author, A. B. and Author, A. B.},
journal = {Journal of the happy but frustrated biblatex user},
pages = {1070--1074},
title = {{Biblatex hurts so good}},
volume = {10},
date = {2014}
}
@article{author2013,
author = {Author, A. D. and Author, A. B. and Author, A. B. and Author, A.B},
journal = {Journal of the happy but frustrated biblatex user},
pages = {1070--1074},
title = {{Biblatex hurts so good}},
volume = {10},
date = {2013}
}
\end{filecontents*}

\bibliography{test.bib}

\begin{document}

Be excellent, Dudes \supercite{author2013,author2014}

\printbibliography

\end{document}

答案1

你自己已经解决了大部分原始问题;你可以解决最后一点,删除等。等在参考书目条目中将以下代码添加到您的 MWE:

\xpatchbibmacro{name:andothers}{ % Removes comma before the "et al"
{\finalandcomma}%
}{%
\addspace%
}{}{}

得出:

bibliography

最终的工作示例如下:

\documentclass [12pt]{article}
\usepackage[
backend=bibtex,
citestyle=numeric,
isbn=false,
bibstyle=authoryear,
maxnames=3, % Max number of names before "et al" starts
minnames=3, % Must show at least three names for citations and bibliography
firstinits=true, % Removes period after first name intial 
terseinits=true, % Removes period after first name intial 
sorting=none] % List citations in order they appear
{biblatex}

\DeclareFieldFormat[article]{volume}{\textbf{#1}\addcomma\space} % Bolds volume of citation and adds comma after volume
\DeclareFieldFormat{pages}{#1} % No prefix for the "pages" field in the bibliography
\renewcommand*{\revsdnamepunct}{} % Removing the comma after last name in bibliography 
\renewcommand*{\revsdnamepunct}{} % Removing the periods after first name intial in bibliography
\renewcommand{\labelnamepunct}{\addspace} % Removes period after year in bibliography
\DeclareFieldFormat[article]{title}{#1}  % Remove quotes from journal title in bibliography
\DeclareNameAlias{sortname}{last-first} % Lists all authors with last name first in bibliography
\renewcommand*{\finalnamedelim}{\addspace\bibstring{and}\space} % Removes comma after penultimate name

\AtBeginBibliography{% Replaces "and" with "&" in bibliography
\renewcommand*{\finalnamedelim}{%
\ifnumgreater{\value{liststop}}{2}{}{}%
\addspace\&\space}%
}

\usepackage{xpatch}

%<<<<<<<<<<<<<<<<<<<<<<<<<<
\xpatchbibmacro{name:andothers}{ % Removes comma before the "et al"
{\finalandcomma}%
}{%
\addspace%
}{}{}

\xpatchbibmacro{name:andothers}{ % Makes the "et al" italicized bibliography
\bibstring{andothers}%
}{%
\bibstring[\emph]{andothers}%
}{}{}

\renewbibmacro{in:}{% Removes "In" from bibliography entries
\ifentrytype{article}{}{%
\printtext{\bibstring{in}\intitlepunct}}}

\defbibenvironment{bibliography}
{\list 
{\printfield[labelnumberwidth]{labelnumber}} % Adds numbers to references and wraps the text for each bibliography entry
{\setlength{\labelwidth}{\labelnumberwidth}% 
\setlength{\leftmargin}{0pt}% 
\setlength{\labelsep}{\biblabelsep}% 
\setlength{\itemsep}{\bibitemsep}% 
\setlength{\itemindent}{\labelwidth}% 
\addtolength{\itemindent}{\labelsep}% 
\setlength{\parsep}{\bibparsep}}% 
\renewcommand*{\makelabel}[1]{\hss##1}} 
{\endlist} 
{\item}

\DeclareFieldFormat{labelnumberwidth}{#1.} % Adds a period after each reference number in bibliography

\usepackage{filecontents}
\begin{filecontents*}{test.bib}

@article{author2014,
author = {Author, A. B. and Author, A. B. and Author, A. B.},
journal = {Journal of the happy but frustrated biblatex user},
pages = {1070--1074},
title = {{Biblatex hurts so good}},
volume = {10},
date = {2014}
}
@article{author2013,
author = {Author, A. D. and Author, A. B. and Author, A. B. and Author, A.B},
journal = {Journal of the happy but frustrated biblatex user},
pages = {1070--1074},
title = {{Biblatex hurts so good}},
volume = {10},
date = {2013}
}
\end{filecontents*}

\bibliography{test.bib}

\begin{document}

Be excellent, Dudes \supercite{author2013,author2014}

\printbibliography

\end{document}

答案2

如果有意义的话,我建议使用没有牛津逗号的语言(british例如)。

但如果这不是一个选择,那么一个简单的\let\finalandcomma=\empty方法\DefineBibliographyExtras{english}就可以了:

\DefineBibliographyExtras{english}{\let\finalandcomma=\empty}

如果我们使用它,我们甚至不需要\renewcommand*{\finalnamedelim}{\addspace\bibstring{and}\space}

我还将的重新定义更改\finalnamedelim\DeclareDelimFormat[bib,biblist]{finalnamedelim}{\addspace\&\space},因为测试没有添加任何内容。

平均能量损失

\documentclass[12pt]{article}
\usepackage[
backend=biber,
citestyle=numeric,
isbn=false,
bibstyle=authoryear,
maxnames=3,
minnames=3,
giveninits=true,
terseinits=true,
sorting=none]
{biblatex}

\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}\addcomma\space}
\DeclareFieldFormat{pages}{#1}
\renewcommand*{\revsdnamepunct}{}
\DeclareDelimFomat[bib]{nametitledelim}{\addspace}
\DeclareFieldFormat[article]{title}{#1}
\DeclareNameAlias{sortname}{family-given}

\DeclareDelimFormat[bib,biblist]{finalnamedelim}{\addspace\&\space}%

\DefineBibliographyExtras{english}{\let\finalandcomma=\empty}

\usepackage{xpatch}
\xpatchbibmacro{name:andothers}
  {\bibstring{andothers}}
  {\bibstring[\emph]{andothers}}
  {}{}

\renewbibmacro{in:}{%
  \ifentrytype{article}
    {}
    {\printtext{\bibstring{in}\intitlepunct}}}

\defbibenvironment{bibliography}
  {\list
    {\printtext[labelnumberwidth]{%
        \printfield{labelprefix}%
        \printfield{labelnumber}}}
    {\setlength{\labelwidth}{\labelnumberwidth}%
     \setlength{\leftmargin}{0pt}%
     \setlength{\labelsep}{\biblabelsep}%
     \setlength{\itemsep}{\bibitemsep}%
     \setlength{\itemindent}{\labelwidth}%
     \addtolength{\itemindent}{\labelsep}%
     \setlength{\parsep}{\bibparsep}}%
     \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

\DeclareFieldFormat{labelnumberwidth}{#1\addperiod} % Adds a period after each reference number in bibliography

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{author2014,
author = {Author, A. B. and Author, A. B. and Author, A. B.},
journal = {Journal of the happy but frustrated biblatex user},
pages = {1070--1074},
title = {{Biblatex hurts so good}},
volume = {10},
date = {2014}
}
@article{author2013,
author = {Author, A. D. and Author, A. B. and Author, A. B. and Author, A.B},
journal = {Journal of the happy but frustrated biblatex user},
pages = {1070--1074},
title = {{Biblatex hurts so good}},
volume = {10},
date = {2013}
}
\end{filecontents*}

\addbibresource{\jobname.bib}
\begin{document}
  Be excellent, Dudes \supercite{author2013,author2014}.
  \printbibliography
\end{document}

example output

相关内容