Biblatex \noinherit:urldate 和 subtitle

Biblatex \noinherit:urldate 和 subtitle

我对 biblatex 的\noinherit命令感到困惑:它对于大多数字段都按预期工作,但我无法让它urldatesubtitle被继承。

我使用的语法灵感来自 biblatex 3.16 文档中第 238 页的示例。这是一个 mwe,其中 未被url继承(如预期的那样),但urldatesubtitle被继承(这是不想要的)。

编辑:解决方法urldate\noinherit{urlyear}Biblatex:抑制 urldate 不起作用(\clearfield)

\documentclass{article}
\usepackage[
    style=authoryear,
    backend=biber,
]{biblatex}  
\DeclareDataInheritance{*}{periodical,inproceedings,inreference,inbook,incollection}{%
    \noinherit{url}
    \noinherit{urldate}
    \noinherit{subtitle}
}
% noinherit as expected: url, addendum, note, isbn, keywords
% don't noinherit: urldate, subtitle
\begin{filecontents}{\jobname.bib}
@book{main,
  editor     = {Famous, I Am},
  date       = {1998},
  title      = {Book title},
  subtitle   = {Very long and detailed subtle subtitle of the book},
  url        = {httpz://test.com},
  urldate    = {2022-09-15},
}
@inbook{sub,
  author       = {Known, Less},
  title        = {Nice chapter title},
  pages        = {579-588},
  crossref     = {main},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

输出不需要的 urldate 和 subtitle 字段

答案1

subtitle是继承的,因为在biblatex.def(ll. 1731-1741 v3.18)

\DeclareDataInheritance{book}{inbook,bookinbook,suppbook}{%
  \inherit{title}{booktitle}
  \inherit{subtitle}{booksubtitle}
  \inherit{titleaddon}{booktitleaddon}
  \noinherit{shorttitle}
  \noinherit{sorttitle}
  \noinherit{indextitle}
  \noinherit{indexsorttitle}
}

您的前导代码将在稍后出现,但此时该字段已经被继承。

我看到的唯一解决方案是重置整个继承模型并阻止你不想要的。当然,这意味着你必须从biblatex.def

\documentclass{article}
\usepackage[
    style=authoryear,
    backend=biber,
]{biblatex}  

\ResetDataInheritance

\DefaultInheritance{all=true,override=false}

\DeclareDataInheritance{mvbook,book}{inbook,bookinbook,suppbook}{%
  \inherit{author}{author}
  \inherit{author}{bookauthor}
}

\DeclareDataInheritance{mvbook}{book,inbook,bookinbook,suppbook}{%
  \inherit{title}{maintitle}
  \noinherit{subtitle}
  \noinherit{titleaddon}
  \noinherit{shorttitle}
  \noinherit{sorttitle}
  \noinherit{indextitle}
  \noinherit{indexsorttitle}
}

\DeclareDataInheritance{mvcollection,mvreference}
{collection,reference,incollection,inreference,suppcollection}{%
  \inherit{title}{maintitle}
  \noinherit{subtitle}
  \noinherit{titleaddon}
  \noinherit{shorttitle}
  \noinherit{sorttitle}
  \noinherit{indextitle}
  \noinherit{indexsorttitle}
}

\DeclareDataInheritance{mvproceedings}{proceedings,inproceedings}{%
  \inherit{title}{maintitle}
  \noinherit{subtitle}
  \noinherit{titleaddon}
  \noinherit{shorttitle}
  \noinherit{sorttitle}
  \noinherit{indextitle}
  \noinherit{indexsorttitle}
}

\DeclareDataInheritance{book}{inbook,bookinbook,suppbook}{%
  \inherit{title}{booktitle}
  \noinherit{subtitle}
  \noinherit{titleaddon}
  \noinherit{shorttitle}
  \noinherit{sorttitle}
  \noinherit{indextitle}
  \noinherit{indexsorttitle}
}

\DeclareDataInheritance{collection,reference}
{incollection,inreference,suppcollection}{%
  \inherit{title}{booktitle}
  \noinherit{subtitle}
  \noinherit{titleaddon}
  \noinherit{shorttitle}
  \noinherit{sorttitle}
  \noinherit{indextitle}
  \noinherit{indexsorttitle}
}

\DeclareDataInheritance{proceedings}{inproceedings}{%
  \inherit{title}{booktitle}
  \noinherit{subtitle}
  \noinherit{titleaddon}
  \noinherit{shorttitle}
  \noinherit{sorttitle}
  \noinherit{indextitle}
  \noinherit{indexsorttitle}
}

\DeclareDataInheritance{periodical}{article,suppperiodical}{%
  \inherit{title}{journaltitle}
  \noinherit{subtitle}
  \noinherit{titleaddon}
  \noinherit{shorttitle}
  \noinherit{sorttitle}
  \noinherit{indextitle}
  \noinherit{indexsorttitle}
}

\DeclareDataInheritance{*}{*}{%
  \noinherit{ids}
  \noinherit{crossref}
  \noinherit{xref}
  \noinherit{entryset}
  \noinherit{entrysubtype}
  \noinherit{execute}
  \noinherit{label}
  \noinherit{options}
  \noinherit{presort}
  \noinherit{related}
  \noinherit{relatedoptions}
  \noinherit{relatedstring}
  \noinherit{relatedtype}
  \noinherit{shorthand}
  \noinherit{shorthandintro}
  \noinherit{sortkey}
  \noinherit{url}
  \noinherit{urlyear}
}


% noinherit as expected: url, addendum, note, isbn, keywords
% also noinherit: urldate, subtitle
\begin{filecontents}{\jobname.bib}
@book{main,
  editor     = {Famous, I Am},
  date       = {1998},
  title      = {Book title},
  subtitle   = {Very long and detailed subtle subtitle of the book},
  url        = {httpz://test.com},
  urldate    = {2022-09-15},
}
@inbook{sub,
  author       = {Known, Less},
  title        = {Nice chapter title},
  pages        = {579-588},
  crossref     = {main},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

Famous, I Am, ed. (1998)。书名。这本书的副标题很长,很详细。网址:httpz://test.com(访问于 2022 年 9 月 15 日)。Known, Less (1998)。“不错的章节标题”。在:书名。由 I Am Famous 编辑,第 579-588 页。

相关内容