biblatex citestyle 和 bibliographystyle 中的定制相互影响

biblatex citestyle 和 bibliographystyle 中的定制相互影响

我正在使用 biblatex,需要满足以下要求:

引用应该是这样的:

  • 当只有一位作者时:<lastname1> <year>
  • 当有两位作者时:<lastname1> and <lastname2> <year>
  • 当作者超过两位时:<lastname1> et al. <year>

参考书目应如下所示:

<lastname>, <f>; <lastname>, <f>; <lastname>, <f>; <year> : Title. … (f = 名字的首字母)

到目前为止,我已经自定义了 authoryear 样式,如下所示:

作者年份.cbx:

\ProvidesFile{authoryear-ing.cbx}
\RequireCitationStyle{authoryear-comp}

\DefineBibliographyStrings{german}{%
andothers     = {et\,al\adddot}
}

\endinput

作者年份.bbx:

\ProvidesFile{authoryear-ing.bbx}

\RequireBibliographyStyle{authoryear}

% Redefining the separator between author-names
\renewcommand*{\multinamedelim}{\addsemicolon\addspace}

% Redefining the separator between the last two author-names
\renewcommand*{\finalnamedelim}{\multinamedelim}


% Redefining the separator between author-names  / editor-names and year in bibliography(not working yet)
\renewbibmacro*{author}{%
  \ifboolexpr{
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }
    {\usebibmacro{bbx:dashcheck}
       {\bibnamedash}
       {\usebibmacro{bbx:savehash}%
        \printnames{author}%
        \iffieldundef{authortype}
          {\setunit{\addsemicolon\space}}
          {\setunit{\addsemicolon\space}}}%
     \iffieldundef{authortype}
       {}
       {\usebibmacro{authorstrg}%
        \setunit{\addsemicolon\space}}}%
     {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}%
     \setunit*{\addsemicolon\space}}%
     \usebibmacro{date+extrayear}}

\renewbibmacro*{editor}{%
  \usebibmacro{bbx:editor}{editorstrg}}
\renewbibmacro*{editor+others}{%
  \usebibmacro{bbx:editor}{editor+othersstrg}}
\newbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
    {\usebibmacro{bbx:dashcheck}
       {\bibnamedash}
       {\printnames{editor}%
        \setunit{\addsemicolon\space}%
        \usebibmacro{bbx:savehash}}%
     \usebibmacro{#1}%
     \clearname{editor}%
     \setunit{\addsemicolon\space}}%
    {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}%
     \setunit*{\addsemicolon\space}}%
  \usebibmacro{date+extrayear}}

\renewbibmacro*{translator}{%
  \usebibmacro{bbx:translator}{translatorstrg}}
\renewbibmacro*{translator+others}{%
  \usebibmacro{bbx:translator}{translator+othersstrg}}
\newbibmacro*{bbx:translator}[1]{%
  \ifboolexpr{
    test \ifusetranslator
    and
    not test {\ifnameundef{translator}}
  }
    {\usebibmacro{bbx:dashcheck}
       {\bibnamedash}
       {\printnames{translator}%
        \setunit{\addsemicolon\space}%
        \usebibmacro{bbx:savehash}}%
     \usebibmacro{translator+othersstrg}%
     \clearname{translator}%
     \setunit{\addsemicolon\space}}%
    {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}%
     \setunit*{\addsemicolon\space}}%
  \usebibmacro{date+extrayear}}


% firstname is displayed after the lastname
\DeclareNameAlias{sortname}{last-first}

% no parenthesis
\renewbibmacro*{date+extrayear}{%
  \iffieldundef{\thefield{datelabelsource}year}
    {}
    {\iffieldsequal{year}{\thefield{datelabelsource}year}
      {\printdateextralabel}%
      {\printfield{labelyear}%
       \printfield{extrayear}}}}%

\endinput

我的文档如下所示:

 \documentclass[a4paper, ngerman, bibliography=totocnumbered, listof=numbered, 12pt]{scrartcl}

%% Codierung
\usepackage[ngerman]{babel}
\usepackage[latin9]{inputenc}

%% Biblatex
\usepackage[
backend = biber, 
sorting = nyt, 
citestyle = authoryear-ing, 
bibstyle = authoryear-ing,
maxcitenames = 2,
mincitenames = 1, 
maxbibnames = 100,
minbibnames = 100,
firstinits = true,
abbreviate = true
]{biblatex}

\begin{filecontents}{mwe.bib}
@book{buch1,
    Author = {Vornameeins Nachnahmeeins and Vornamezwei Nachnahmezwei},
    Title = {Title},
    Year = {2010}}

@book{buch2,
    Author = {Vornameeins Nachnahmeeins},
    Title = {Title},
    Year = {2015}}

@book{buch3,
    Author = {Vornameeins Nachnahmeeins and Vornamezwei Nachnahmezwei and Vornamedrei Nachnahmedrei},
    Title = {Title},
    Year = {2010}}
\end{filecontents}

\addbibresource{mwe.bib}

\begin{document}

\cite{buch1}\\
\cite{buch2}\\
\cite{buch3}

\printbibliography

\end{document}

结果如下:

在此处输入图片描述

看起来 citestyle 和 bibstyle 互相影响。有没有办法满足我上面提到的要求?我做错了什么?

答案1

在较新版本的 中,biblatex有许多新功能和特性可让您的生活更加轻松。除其他外,multinamedelimfinaldnamedelim现在具有上下文相关性,这使得更容易对引文和参考书目有不同的定义。此外,nametitledelimnameyeardelim可以分别帮助您获取年份后的冒号和参考书目中的结束分号。

我的建议是基于ext-authoryear-comp(我的biblatex-ext) 因为这样可以更简单地去掉参考书目中年份周围的括号(参见如何(正确地)删除 authoryear 样式中年份周围的括号?(v3))。

我已将加载时间选项移至相关的.bbx.cbx文件,并且还添加了uniquelistuniquename选项,因为我思考您可能希望它们与默认值不同。例如,请参见在 biblatex 中使用“et al.”时,限制为一位作者含有 Biber 的文献会产生奇怪的引用:名字出现不规律以及biblatex有关这两个选项的文档。

在 MWE 中我也曾经filecontents制作过.bbx和文件。.cbx警告:由于filecontents包已加载authoryear-ing.bbx,并且authoryear-ing.cbx文件.bib将在未经事先通知或交互的情况下被覆盖。请在新的空文件夹中测试此 MWE,以避免丢失您宝贵的工作。

\documentclass[a4paper, ngerman, bibliography=totocnumbered, 12pt]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage{filecontents}
\begin{filecontents}{authoryear-ing.bbx}
\ProvidesFile{authoryear-ing.bbx}

\RequireBibliographyStyle{ext-authoryear-comp}

\ExecuteBibliographyOptions{
  maxbibnames = 100,
  minbibnames = 100,
  giveninits = true,
  abbreviate = true,
}

\DeclareNameAlias{sortname}{family-given}

\DeclareDelimFormat[bib]{multinamedelim}{\addsemicolon\space}
\DeclareDelimAlias*[bib]{finalnamedelim}{multinamedelim}

\DeclareDelimAlias*[bib]{nameyeardelim}{multinamedelim}
\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space}

\DeclareFieldFormat{biblabeldate}{#1}


\endinput
\end{filecontents}

\begin{filecontents}{authoryear-ing.cbx}
\ProvidesFile{authoryear-ing.cbx}

\RequireCitationStyle{ext-authoryear-comp}

\ExecuteBibliographyOptions{
  maxcitenames = 2,
  mincitenames = 1,
  uniquelist   = false,
  uniquename   = init,
}

\DefineBibliographyStrings{german}{%
  andothers     = {et\,al\adddot}
}

\endinput
\end{filecontents}

\usepackage[
  backend = biber, 
  style = authoryear-ing, 
]{biblatex}

\begin{filecontents}{\jobname.bib}
@book{buch1,
  author = {Vornameeins Nachnahmeeins and Vornamezwei Nachnahmezwei},
  title  = {Title},
  year   = {2010},
}
@book{buch2,
  author = {Vornameeins Nachnahmeeins},
  title  = {Title},
  year   = {2015},
}
@book{buch3,
  author = {Vornameeins Nachnahmeeins and Vornamezwei Nachnahmezwei
            and Vornamedrei Nachnahmedrei},
  title  = {Title},
  year   = {2010},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\cite{buch1}

\cite{buch2}

\cite{buch3}

\printbibliography
\end{document}

引用文件中写道“Nachnahmeeins und Nachnahmezwei 2010//Nachnahmeeins 2015//Nachnahmeeins et al. 2010”。 “Nachnahmeeins,V.;2015:标题。//Nachnahmeeins,V.;Nachnahmezwei,V.;2010:标题。//Nachnahmeeins,V.;Nachnahmezwei,V.;Nachnahmedrei,V.;2010:标题。”在参考书目中。

相关内容