andras-simonyi / citeproc-el

A CSL 1.0.2 Citation Processor for Emacs.
GNU General Public License v3.0
84 stars 9 forks source link

Prepending author duplicates the author name for textual citations #151

Closed digikar99 closed 6 months ago

digikar99 commented 6 months ago

Is there a reason why the author name is being prepended here?

https://github.com/andras-simonyi/citeproc-el/blob/c61c98b9d230ea28b2ca49498134803e1f8ea526/citeproc-cite.el#L230-L245

While using org-ref, I expect some text citet:&test_org_ref more text to be producing a non-parenthetical some text [non-paren citation] more text. However, I get the output as some text author [non-paren citation] more text. Is this intended? Is there an alternative to prevent duplicate author name?

For example, the org file below:

#+title: Testing org ref

[[citet:&test_org_ref]] wrote the paper in 2023.

bibliographystyle:unsrtnat

bibliography:tmp.bib

[[printbibliography:]]

And tmp.bib contains:

@inproceedings{test_org_ref,
  title={Testing org ref},
  author={Author, Some},
  booktitle={Proceedings},
  volume={},
  number={},
  year={}
}

In both pdf and html, I get (Author, n.d. is hyperlinked as expected):

Author Author, n.d. wrote the paper in 2023.
Author, Some. n.d. "Testing Org Ref." In Proceedings.

while I only expect:

Author, n.d. wrote the paper in 2023.
Author, Some. n.d. "Testing Org Ref." In Proceedings.

with Author, n.d. hyperlinked.

andras-simonyi commented 6 months ago

Yes, there is a reason: a canonical textual (AKA in-text) citation is of the form

<author's name> <normal citation with author's name suppressed>

and citeproc-el produces that by rendering separately the two components and concatenating them.

The problem in this particular case seems to be that org-ref adds a (suppress-author . nil) cons-cell to the alist describing the cite, which is not an allowed component (suppress-author can only be used as the citation's mode, see the corresponding README section). If I remove the lines adding suppress-author to the alist from org-ref-export.el (lines 215-223) then the rendering is correct.

Of course, that change can have negative side-effects as well so it is not necessarily a full fix; the bottom line is that having a suppress-author key in the alist is unsupported, and it should be used only as a citation mode, as the documentation states.

andras-simonyi commented 6 months ago

As the reported problem is not caused by citeproc-el I'm planning tho close this issue shortly in the absence of further comments or objections.

digikar99 commented 6 months ago

Hello, thanks for the quick response earlier! Sorry for the delay, and right, org-ref seems like the better place to fix this issue.