jgm / pandoc-citeproc

Library and executable for using citeproc with pandoc
BSD 3-Clause "New" or "Revised" License
291 stars 61 forks source link

Support biblatex field ids for citekey aliases #356

Closed nichtich closed 5 years ago

nichtich commented 6 years ago

The biblatex manual defines field "ids" as comma separated list of citation key aliases for the main citation key. pandoc-citeproc seems to just ignore this field. Instead it should allow to use alias ids for citation:

@book{foo,
  author = {Alice},
  year = {2042},
  ids = {bar, doz}
}

Then reference book foo in Markdown:

@bar
jgm commented 6 years ago

Only way to do this would be to create several references that are identical except for the id. We could do that, though.

njbart commented 6 years ago

Only way to do this would be to create several references that are identical except for the id.

I’m afraid this won’t work without further modifications. As it is, pandoc-citeproc creates two reference section entries in such cases, and disambiguates these. I’m not sure whether there are other workable solutions: Checking whether biblio database entries are identical (except for the citekey) would of course work in principle, but I have no idea what that would mean performance-wise. Other solutions might be to allow a field called other-ids or similar. (Arguably, this wouldn’t even infract upon the CSL specs, since the commonly used id field isn’t defined there either …)

(The reason I’m interested: zotxt allows users to define additional citekeys for an entry by adding these to a tag or a note – but if more than one citekey per entry is used in a pandoc document, the entry is duplicated in the references section as well. An easy workaround is to avoid using different citekeys for the same entry, but a more foolproof approach, if possible at all, would of course be welcome.)

MWE:

pandoc -s -F pandoc-citeproc -t plain << EOT

Snow is white [@item1, 1]. Water is wet [@item2, 2].

# References {-}

---
references:
- id: item1
  type: book
  author:
  - family: Doe
    given: Jane
  issued:
    - year: 2018
  title: A title
- id: item2
  type: book
  author:
  - family: Doe
    given: Jane
  issued:
    - year: 2018
  title: A title
...
EOT

Actual output:

Snow is white (Doe 2018a, 1). Water is wet (Doe 2018b, 2).

REFERENCES

Doe, Jane. 2018a. _A Title_.

———. 2018b. _A Title_.

Expected:

Snow is white (Doe 2018, 1). Water is wet (Doe 2018, 2).

REFERENCES

Doe, Jane. 2018. _A Title_.
jgm commented 6 years ago

Yes, actually, I think we could introduce an other-ids field. This would require:

Not sure if that would suffice by itself, but it would be a start.