使用 biblatex authoryear 样式和简写时标签日期错误

使用 biblatex authoryear 样式和简写时标签日期错误

我有一个书目,其中包含同一作者的多部作品,这些作品也在同一年出版。我使用 Biblatex 的 authoryear 样式,因此,正如预期的那样,我得到了作者 (2020a)作者 (2020b)文中。

然而,有些作品是通过简写来引用的。因此,我打印了一份缩写列表。在该列表中,年份是混在一起的:使用简写的作品的附录年份是错误的(请参阅下面的 MWE 和输出)。

我认为我已经阅读了 Biblatex 的大部分手册。我还尝试使用 Bibliography Checks 自己打印速记,而且成功了,但样式很糟糕,因为速记标签没有与条目的其余部分分开。我也更喜欢非黑客解决方案。问题似乎是如何\printbiblist与 ; 不同\printbibliography,但我现在真的停下来了,不知道如何继续。任何帮助甚至正确方向的推动都将不胜感激。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[bibstyle=authoryear,citestyle=authoryear-ibid]{biblatex}
\bibliography{mwe}

\begin{filecontents}{mwe.bib}
  @book{Author_2020,
    title = {Some Title},
    author = {Some Author},
    year = {2020},
    location = {Someplace}
  }
  @book{Author_2020_2,
    title = {Some Other Title},
    shorthand = {MOT},
    author = {Some Author},
    year = {2020},
    location = {Someplace}
  }
\end{filecontents}

\begin{document}
  \section{Section}
    I am citing \cite{Author_2020} and \cite{Author_2020_2}.
    \printbiblist{shorthand}
    \printbibliography
\end{document}

最小工作示例输出

答案1

这是一个棘手的问题,可能被归类为一个错误(如果我对问题产生的怀疑是正确的,有人可能会试图争辩说这不是一个错误,但无论如何,这是一种非常非常出乎意料的行为)。我报告了这个问题https://github.com/plk/biblatex/issues/1009


与此同时,如果您不介意没有带有sextradate的条目的字母,这里有一个解决方法。shorthand

该命令\DeclareExtradate规定添加到年份的字母的范围,extradate以使引用标签独一无二。您可以添加\field{shorthand}到当前定义 (biblatex.def,第 1350-1355 行于 v3.14

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[style=authoryear-ibid]{biblatex}

\DeclareExtradate{%
  \scope{
    \field{shorthand}
    \field{labelyear}
    \field{year}
  }
}

\begin{filecontents}{\jobname.bib}
@book{Author_2020,
  title    = {Some Title},
  author   = {Some Author},
  year     = {2020},
  location = {Someplace}
}
@book{Author_2020_2,
  title     = {Some Other Title},
  shorthand = {MOT},
  author    = {Some Author},
  year      = {2020},
  location  = {Someplace}
}

@book{Buthor_2020_1,
  title    = {Some Title},
  author   = {Some Buthor},
  year     = {2020},
  location = {Someplace}
}
@book{Buthor_2020_2,
  title     = {Some Title},
  shorthand = {ZOT},
  author    = {Some Buthor},
  year      = {2020},
  location  = {Someplace}
}
@book{Buthor_2020_3,
  title    = {Some Title},
  author   = {Some Buthor},
  year     = {2020},
  location = {Someplace}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
  I am citing \autocite{Author_2020} and \autocite{Author_2020_2}.

  I am citing \autocite{Buthor_2020_1,Buthor_2020_2,Buthor_2020_3}.

  \printbiblist{shorthand}
  \printbibliography
\end{document}

我引用了 (作者 2020) 和 (MOT)。


这是一个不同的解决方案,它重新定义\printbiblist,以便条目从其默认引用上下文而不是书目列表的引用上下文中获取条目数据。本质上,这意味着所有唯一性信息仍应符合预期(与引文和书目中的信息相同),但书目列表仍将正确排序。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[style=authoryear-ibid]{biblatex}

\makeatletter
\def\blx@biblistitem#1{%
  \blx@getrefcontext{#1}%
  \blx@ifdata{#1}
    {\begingroup
     \blx@getdata{#1}%
     \blx@bibcheck
     \iftoggle{blx@skipentry}{}{%
       \blx@setdefaultrefcontext{#1}%
       \global\let\blx@noitem\@empty
       \blx@setoptions@type\abx@field@entrytype
       \blx@setoptions@entry
       \addtocounter{instcount}\@ne
       \iftoggle{blx@labelnumber}
         {\blx@bbl@locallabelnumberwidth}
         {}%
       \iftoggle{blx@labelalpha}
         {\blx@bbl@locallabelalphawidth}
         {}%
       \nottoggle{blx@skipbiblist}
         {\blx@bbl@locallabelfields}
         {}%
       \csuse{blx@item@\blx@theenv}\relax
       \csuse{blx@hook@biblistitem@\blx@thebiblist}%
       \blx@execute
       \blx@initunit
       \blx@beglangbib
       \bibsentence
       \blx@pagetracker
       \blx@driver{\blx@thebiblistdriver}%
       \blx@postpunct
       \blx@endlangbib}%
     \endgroup}
    {}}
\makeatother

\begin{filecontents}{\jobname.bib}
@book{Author_2020,
  title    = {Some Title},
  author   = {Some Author},
  year     = {2020},
  location = {Someplace}
}
@book{Author_2020_2,
  title     = {Some Other Title},
  shorthand = {MOT},
  author    = {Some Author},
  year      = {2020},
  location  = {Someplace}
}

@book{Buthor_2020_1,
  title    = {Some Title},
  author   = {Some Buthor},
  year     = {2020},
  location = {Someplace}
}
@book{Buthor_2020_2,
  title     = {Some Title},
  shorthand = {ZOT},
  author    = {Some Buthor},
  year      = {2020},
  location  = {Someplace}
}
@book{Buthor_2020_3,
  title    = {Some Title},
  author   = {Some Buthor},
  year     = {2020},
  location = {Someplace}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
  I am citing \autocite{Author_2020} and \autocite{Author_2020_2}.

  I am citing \autocite{Buthor_2020_1,Buthor_2020_2,Buthor_2020_3}.

  \printbiblist{shorthand}
  \printbibliography
\end{document}

答案2

由于这似乎比预期的更深,如果您不能按照 moewe 建议的那样做(extradate对于简写条目没有字母),我建议使用以下解决方法:

定义新的书目检查:

\defbibcheck{isshorthand}{%
  \iffieldundef{shorthand}{\skipentry}{}}

定义新的排序模板:

\DeclareSortingTemplate{snyt}{
  \sort{
    \field{shorthand}
  }
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{sortname}
    \field{author}
    \field{editor}
    \field{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
  \sort{
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{volume}
    \literal{0}
  }
}

打印您的速记列表:

\newrefcontext[sorting=snyt]
\printbibliography[check=shorthandset,env=shorthand,title=Abbreviations]

然后将 refcontext 重置为您所需要的,默认值为nyt

这看起来不太明显,但就我而言,它完成了工作。MWE 和输出如下。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[bibstyle=authoryear,citestyle=authoryear-ibid]{biblatex}
\bibliography{\jobname}

\begin{filecontents*}{\jobname.bib}
  @book{Author_2020,
    title = {Some Title},
    author = {Some Author},
    year = {2020},
    location = {Someplace}
  }
  @book{Author_2020_2,
    title = {Some Other Title},
    shorthand = {MOT},
    author = {Some Author},
    year = {2020},
    location = {Someplace}
  }
  @book{Author_1900,
    title = {Some Other Title},
    shorthand = {LongShorthand},
    author = {Zop Zop},
    year = {1900},
    location = {Someplace}
  }
  @book{Author_1950,
    title = {Some Other Title},
    shorthand = {1950},
    author = {Zip Zap},
    year = {1950},
    location = {Someplace}
  }
\end{filecontents*}

\defbibcheck{shorthandset}{%
  \iffieldundef{shorthand}{\skipentry}{}}

\DeclareSortingTemplate{snyt}{
  \sort{
    \field{shorthand}
  }
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{sortname}
    \field{author}
    \field{editor}
    \field{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
  \sort{
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{volume}
    \literal{0}
  }
}


\begin{document}

\section{Section}

I am citing \cite{Author_2020} and \cite{Author_2020_2} and \cite{Author_1900} and \cite{Author_1950}.

\newrefcontext[sorting=snyt]
\printbibliography[check=shorthandset,env=shorthand,title=Abbreviations]
\newrefcontext[sorting=nyt]
\printbibliography

\end{document}

微波辐射计 2

相关内容