Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepending author duplicates the author name for textual citations #151

Closed
digikar99 opened this issue Jan 3, 2024 · 3 comments
Closed

Comments

@digikar99
Copy link

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

;; Prepend author to textual citations
(when (eq (citeproc-citation-mode c) 'textual)
(let* ((first-elt (car cites)) ;; First elt is either a cite or a cite group.
;; If the latter then we need to locate the
;; first cite as the 2nd element of the first
;; cite group.
(first-cite (if (eq 'group (car first-elt))
(cadr first-elt)
first-elt))
(author-cite
(append '((suppress-author . nil) (stop-rendering-at . names)
(prefix) (suffix) (locator))
first-cite))
(rendered-author (citeproc-cite--render author-cite style 'no-links)))
(when (listp rendered-author)
(setq result `(nil ,rendered-author " " ,result)))))

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
Copy link
Owner

andras-simonyi commented Jan 3, 2024

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
Copy link
Owner

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants