mabentwickeltsich / MendeleyMacros

New functionalities for Mendeley's plugin: hyperlinks for citations pointing to bibliography, hyperlinks for URLs in bibliography, and fix to maintain Microsoft Word style of bibliography.
41 stars 25 forks source link

References from same year are directed to the same bookmark for APA #12

Closed larsfjaera closed 2 years ago

larsfjaera commented 3 years ago

First of all, thanks for creating this great tool.

I have a small problem that I am unable to resolve. When I reference different publications, but from the same year, all the bookmarks from the given year are directed to the first reference of that year.

To provide an example:

Lorem ipsum (Gentile et al., 2017; Guan et al., 2015; Prusator et al., 2017)
[...]
References:
Gentile, M. S., Yeap, B. Y., Goebel, C., Gaudet, D., Gallotto, S., Weyman, E., Morgan, M., MacDonald, S. M., Giantsoudi, D., Adams, J., Paganetti, H., Tarbell, N. J., Kooy, H., & Yock, T. I. (2017). Brainstem Injury in Pediatric Patients with Posterior Fossa Tumors Treated with Proton Beam Therapy and Associated Dosimetric Factors. International Journal of Radiation Oncology Biology Physics, 100(3), 719–729. https://doi.org/10.1016/j.ijrobp.2017.11.026
Guan, F., Bronk, L., Titt, U., Lin, S. H., Mirkovic, D., Kerr, M. D., Zhu, X. R., Dinh, J., Sobieski, M., Stephan, C., Peeler, C. R., Taleei, R., Mohan, R., & Grosshans, D. R. (2015). Spatial mapping of the biologic effectiveness of scanned particle beams: towards biologically optimized particle therapy. Scientific Reports, 5(1), 9850. https://doi.org/10.1038/srep09850
Prusator, M., Ahmad, S., & Chen, Y. (2017). TOPAS Simulation of the Mevion S250 compact proton therapy unit. Journal of Applied Clinical Medical Physics, 18(3), 88–95. https://doi.org/10.1002/acm2.12077

In this case, Gentile et al., 2017 and Prusator et al., 2017 have the bookmark SignetBibliographie_001, while Guan et al. 2015 has SignetBibliographie_002, and none are assigned _003, which should be the case for Prusator et al.

Please see the attached image were the pointer hovers over the last reference. APA_reference_bookmarks

I have tried using completely different references, but the same issue occurs.

Many thanks!

mabentwickeltsich commented 3 years ago

Dear @larsfjaera,

Sorry for the delay, I have been busy and could not have a look at GitHub before.

Could you provide a smal document that produces the output you mentioned? Just a test document that you are sure the references are linked incorrectly. That would make things easier to check and track the bug.

Cheers Luis

larsfjaera commented 3 years ago

@mabentwickeltsich, no worries. Thanks for getting back to me.

I have attached a sample document as requested. I tried to mix up the references a bit. But look for example at Underwood et al., 2017, while it is the last reference in the list (number 11), the hyperlink in the text points to Chapman & Ermoian, 2017 (number 3), which is the first instance from 2017. The same phenomenon also occurs for the other years.

MendeleyMacrosSample_issue12.docx

mabentwickeltsich commented 3 years ago

Dear @larsfjaera,

Sorry for the late response, but I finally have an answer for you that would help.

There are, however, some observations that I have for you.

First, the document that you provided have custom APA citation styles. If you modify the citation style (CSL file) the macros may be affected and not work properly. Please, stick to the original versions unless you really know what you are doing. Second, the macros will not link the citations as you described. There will be a message of an orphan citation and it will not be linked. I assume that you removed this verification and the macros are wrongly linking orphan citations to a previous found correct citation. I did not test this theory, but it is the most likely scenario. Third, some of your citations need work. For example, Debus et al., 1997 has half of the authors duplicated and with different spelling. Please, check all your bibliography in Mendeley to have a spotless list of entries in your document. Fourth, It would also be helpful if I know before hand that you are using modified versions of the CSL citation style and MendeleyMacros. Please, give as much information as you can in the future. That will reduce the time I take to find what the problem is.

The most helpful part for you is this. I noticed that the entries in Mendeley with the month of publication will be labeled as orphans and not linked by the macros. As a workaround, remove the months from your entries (I know it is not ideal, but it is a quick fix and also this info is not included in the visible text of the document) and the problem should be fixed. The other thing I found is an apostrophe (two due the duplicated author) in Debus et al., 1997. It seems that the regular expression does not like this situation. If you remove the apostrophe from O'Farrel, D. then this last citation will also be linked.

I will see if I can come up with a solution for both, the month and apostrophe in the next weeks. The month has to do with a change in the CSL citation style that I need to address. The apostrophe is just how the regular expression works.

Cheers Luis

larsfjaera commented 3 years ago

@mabentwickeltsich I want to thank you very much for your reply and investigation into this issue. It is much appreciated.

First off, I apologize that the Debus et al. reference had duplicate authors. That was a mistake that I missed. With that said, I must inform you that I have not done any edits or customizations to either the MendeleyMacros or the APA citation style. I am not sure in what regard you mean that the citation style I have used diverges from APA?

After reading you reply, I updated all references in Mendeley using DOI lookup. I then used the APA citation generator from www.scribbr.com. Except a few minor differences that can be attributed to the different DOI lookup methods between Mendeley and Scribbr (such as Issue: May in the Battistoni reference), the citations are identical and does not have different styles. I am using the unmodified American Psychology Association 7th edition updated November 4th, 2020 by Brenton M. Wiernik ([Mendeley style link]( http://www.zotero.org/styles/apa](http://www.zotero.org/styles/apa )).

As mentioned, I have also not done any modifications to your macros. While I have forked your repository and did play around a bit with the code, I made sure that the modified version was not used when I noticed the issue. However, I double checked it today by first removing all macros in Word regarding MendeleyMacros. I then added the latest version of your macros into Word followed by an immediate run of GAUG_createHyperlinksForCitationsAPA. And I still get the references linked to the first reference of the given year and no messages regarding orphan citations are displayed.

In regards to your solution, I removed both Day and Month in Mendeley for all the 11 references I used. I did a sync in Mendeley followed by a Refresh in Word. I ran GAUG_cleanEnvironment and GAUG_createHyperlinksForCitationsAPA. This did not solve the issue for me. Inskip et al. are still linked to SignetBibliographie_001 and Underwood et al. to SignetBibliographie_003. With that said, I have not had any issues with the Debus et al. and the apostrophe. In my document, this reference is linked to SignetBibliographie_004.

It baffles me why we see such different results. I am not sure if there could be anything wrong with either my Word setup or Mendeley setup. I think I will have to try to set it all up from scratch on a clean computer with a new Mendeley account to see what my results are then. Nevertheless, I want to point out that the citations are linked correctly when using IEEE.

Again, thank you for your help. I will get back to you after I have tried setting it all up from scratch.

PS. I am using the following versions: