plk / biblatex

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

Inherit data annotations with crossref (feature request) #1344

Closed vjeffcott closed 8 months ago

vjeffcott commented 9 months ago

I would like to be able to inherit data annotations by the crossref mechanism. This would be useful for cases in which, e.g., a collection and related incollection have titles in different languages.

An MWE (not related to my use case) is given below:

\documentclass{article}
\usepackage[%
    style=authoryear,%
  ]{biblatex}
  \addbibresource{\jobname.bib}

\begin{filecontents}[force]{\jobname.bib}
  @collection{foo,
    editor = {John Doe},
    date = {2000-01-01},
    title = {The Title},
    publisher = {Publisher},
    publisher+an = {="Publisher Annotation"},
  }

  @incollection{bar,
    crossref = {foo},
    author = {Jane Doe},
    title = {The Other Title},
  }
\end{filecontents}

\renewbibmacro*{finentry}{\getfieldannotation[publisher]}

\begin{document}
  \nocite{*}

  \printbibliography
\end{document}

...where the desired behavior is to print 'Publisher Annotation' in both entries.

larsgw commented 9 months ago

I was just about to open the same issue! My use case is ORCIDs of authors being transferred to bookauthor.

plk commented 9 months ago

This is implemented already in biber 2.20 DEV but for XDATA rather then CROSSREF. You might want to look at that method since it's more extensible than the older CROSSREF mechanism.

moewew commented 9 months ago

It's true that XDATA is more versatile than crossref, but crossref is an extremely useful (and commonly used) feature, so it would be great if field annotations could be inherited here as well.

Just for bookkeeping: https://tex.stackexchange.com/q/712131/35864

vjeffcott commented 9 months ago

This is implemented already in biber 2.20 DEV but for XDATA rather then CROSSREF. You might want to look at that method since it's more extensible than the older CROSSREF mechanism.

I do use XDATA for most cases of inheritance, and the new feature is very useful. But there remain some cases where CROSSREF is preferable to XDATA, such as the core use case of @in- type entries and their parents.

I can think of a few potential workarounds.

  1. For each parent entry, provide a parallel XDATA entry to redundantly specify the data annotations. For each child entry, inherit from both using both inheritance mechanisms.
  2. For each parent entry, create a parent XDATA entry with title and booktitle fields and corresponding annotations redundantly specified. For child entries, inherit from the XDATA entry and use xref for cross-reference tracking. This might require providing vacuous annotations in the child entries to override a title annotation intended for the parent.
  3. Modify the data model so that fields that would be remapped by CROSSREF instead remain constant; e.g., replace title in the @book type with booktitle. Do option 1 or 2 with less redundancy.
  4. Modify the data model to turn every data annotation name I want to use into its own field and define an appropriate inheritance setup. This is what I was doing before my current project.
  5. Simply specify data annotations redundantly in both parent and child entries. This is probably what I'll actually do.
  6. Alternatively, it could be possible to implement the desired inheritance behavior using sourcemaps, but there's no mention of data annotations in the relevant section of the manual, so I assume that's not supported.
plk commented 9 months ago

I will implement for CROSSREF too and update here.

plk commented 9 months ago

Please try biber 2.20 from the development folder on SourceForge.

vjeffcott commented 9 months ago

It doesn't seem to work. I've installed the development versions of biblatex and biber from sourceforge to my texmf. The example code from above now returns an empty bibliography and prompts to rerun biber, which doesn't seem to help. I've attached an archive with all the output from trying to build the file, as well as the .blg file that results from running biber alone.

biber-test-1.zip

biblatex-test3.blg.txt

vjeffcott commented 9 months ago

...and here's the bbl file that biber generates when I run it manually:  biblatex-test3.bbl.txt

plk commented 9 months ago

Are you running from perl source or a DEV binary? If the latter, which platform?

vjeffcott commented 9 months ago

DEV binary, on x86_64-linux.

plk commented 9 months ago

I thought so. I just updated the build server for that platform and I think I have some issues. Will check and get back to you.

vjeffcott commented 9 months ago

I decided to try installing biber from the perl source since you mentioned it, and it works. Thank you!

plk commented 9 months ago

Build and binary should be fixed now for linux x64 - I uploaded a fixed binary for DEV 2.20.

moewew commented 8 months ago

The MWE works fine with biblatex v3.20 and Biber 2.20 that were released a couple of days ago.