我对 biblatex 的\noinherit
命令感到困惑:它对于大多数字段都按预期工作,但我无法让它urldate
不subtitle
被继承。
我使用的语法灵感来自 biblatex 3.16 文档中第 238 页的示例。这是一个 mwe,其中 未被url
继承(如预期的那样),但urldate
和subtitle
被继承(这是不想要的)。
编辑:解决方法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}
答案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}