Disambiguation failure with note style
ah-dagdelen opened this issue · 5 comments
Hi,
I have the following macro in my style file:
<macro name="disambiguate">
<choose>
<if disambiguate="true">
<text variable="title-short"/>
</if>
</choose>
</macro>
The use case of this macro is intended to disambiguate authors cited with multiple works in citations and to add short title info to the bibliography entries from authors cited with multiple works. The macro is called twice. The first call is under the citation layout for subsequent citations, and the second one is under the bibliography layout.
When I convert documents with Pandoc, this macro is ignored. The macro text, short title field, does not get printed. Apart from that, Pandoc produces the converted documented without an issue.
The citation style produces expected output with Zotero / citeproc-js. The short title is printed for the relevant authors.
Pandoc version on Linux Mint 20.2 Cinnamon I use is as follows: Compiled with pandoc-types 1.22, texmath 0.12.3, skylighting 0.11, citeproc 0.4.1, ipynb 0.1.0.1
The command lines I use to convert:
pandoc -C example.org --bibliography=example.bib --csl=example.csl -o example.docx
pandoc -C example.org --bibliography=example.json --csl=example.csl -o example.docx
style-bib.zip
Enclosed in the zip-file, I upload CSL style file and two small bib files.
You didn't include example.org, so I used this example.md instead:
[@kollerSchweizerischesWerkvertragsrecht2015;
@kollerSchweizerischesObligationenrechtBesonderer2012]
[@kollerSchweizerischesWerkvertragsrecht2015]
[@kollerSchweizerischesObligationenrechtBesonderer2012]
With this I get (plain output):
[1] Alfred Koller, Schweizerisches Obligationenrecht Besonderer Teil
Band I, Bern, Stämpfli Verlag, 2012; Alfred Koller, Schweizerisches
Werkvertragsrecht, Zürich/St. Gallen, Dike Verlag AG, 2015.[2] Koller.
[3] Koller.
Clearly 2 and 3 aren't properly disambiguated. So this seems to be a bug in citeproc.
Note: getAmbiguities
is returning an empty list in this case.
I think the root problem is that renderItems
in the disambiguation code doesn't keep track of context, so in the case of a note citation, we always get the initial rendering (not the subsequent, which is the one that will need disambiguation).
This aproach works fine for author-date, but not for note styles.
Thanks a lot.
Sorry for the missing org file. The same problem arises with tex files with cite command, too.
I am not sure whether the following information will help to solve the problem, but I am adding it anyway:
It seems to me that the processor does not catch identical citations, not just in note class but also in in-text class.
If I add match="none" right next to if condition, <if disambiguate="true" match="none">
, then I get short title info for all the subsequent citations and bibliography entries, not just for authors with multiple works but for others cited with only one work as well.
I think I understand the problem. Fixing it is going to require a fairly big change in the disambiguation code. Note to self: I think maybe the best approach is to replace the use of the simplified renderItems
with a full re-render followed by a function that strips out the renderings of individual citation items (extracting them using the TagItem tag and removing locator, prefix, and suffix, which are all now tagged). This would have some performance impact, to be measured.