plk / biblatex

biblatex is a sophisticated bibliography system for LaTeX users. It has considerably more features than traditional bibtex and supports UTF-8
518 stars 118 forks source link

\noinherit subtitle #1245

Closed user7303 closed 1 year ago

user7303 commented 2 years ago

As discussed here Biblatex \noinherit: urldate and subtitle, \noinherit{subtitle} does not avoid the subtitle to be inherited, as a more detailed inheritance rule set up for it.

The workaround provided by moewe's answer is fine for me, however:

\documentclass{article}
\usepackage[
    style=authoryear,
    backend=biber,
]{biblatex}  
\DeclareDataInheritance{*}{periodical,inproceedings,inreference,inbook,incollection}{%
    \noinherit{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}
moewew commented 2 years ago

As far as I understand the \noinherit{subtitle} does not work in the MWE because the default inheritance setup has

https://github.com/plk/biblatex/blob/23cdfb68e0209946350f7fa1940900e133964d0c/tex/latex/biblatex/biblatex.def#L1738-L1746

The default inheritance comes before your added rules. If Biber follows the rules sequentially, your \noinherit has no effect, because at that point the default inheritance will already have taken place.

As such, the default inheritance as documented in appendix B allows you to conclude for which fields \noinherit does not have any effect.

user7303 commented 2 years ago

Thanks for the hint to Appendix B for the list of no-noinherit-able fields.