emacs-citar / citar

Emacs package to quickly find and act on bibliographic references, and edit org, markdown, and latex academic documents.
GNU General Public License v3.0
502 stars 54 forks source link

Fixes to citar--shorten-names #733

Closed pprevos closed 1 year ago

pprevos commented 1 year ago

When I use truncate as 1 or 2, it does not show "et al.", which should always show when namelength > truncate.

Changing tnamelength to namelength in the conditional fixes the issue.

Minor point, "et al" needs to be "et al.".

I used a citation with 7 authors for testing: https://doi.org/10.1038/s41545-022-00208-8

pprevos commented 1 year ago

Still needs some work. I get an issue with a paper with two authors and using truncate = 1

bdarcus commented 1 year ago

Still needs some work. I get an issue with a paper with two authors and using truncate = 1

Let me know when you want me to merge it to my branch?

bdarcus commented 1 year ago

Yeah, in retrospect, I have a hunch that first cond shouldn't be needed, and probably confuses things. We should try removing that.

bdarcus commented 1 year ago

Yeah, in retrospect, I have a hunch that first cond shouldn't be needed, and probably confuses things. We should try removing that.

Confirmed; I just pushed a commit that does this to my branch.

https://github.com/emacs-citar/citar/pull/732/commits/3eae3f2dbd3b42232b26ae945bae38c6c286301b

With that, I now get this:

ELISP> (citar--shorten-names "Doe, J and Smith, N and Jones, K and Lamb, H" 1)
"Doe et al."
ELISP> (citar--shorten-names "Doe, J and Smith, N" 1)
"Doe et al."
ELISP> (citar--shorten-names "Doe, J and Smith, N" 2 "&")
"Doe & Smith"

Should I just merge that then and close this?

Edit: yes, I'll probably do that, unless you uncover a problem with the logic, as among other things, my latest commits introduced a conflict with your branch ;-)

Aside: I'm still trying to figure out the formatting linting issue, hopefully before I merge.

pprevos commented 1 year ago

Thanks for all the hard work while I was asleep :)