jalvesaq / zotcite

Neovim plugin for integration with Zotero
GNU General Public License v3.0
159 stars 13 forks source link

Wrong citation text if surname contains apostrophe #72

Closed raffaem closed 6 months ago

raffaem commented 6 months ago

If the surname of the author of the paper contains an apostrophe, the citation is rendered incorrectly, with the part after the apostrophe rendered after the text.

Example:

# Introduction

This is a test

[@VH5CZE7U#D’Este_Patel_2007]

# References

<div id="refs"></div>

Cited paper: link.

Output (image format): image

Output (PDF format): test.pdf

Compile command:

pandoc \
  -F "$ZOTREF" --citeproc \
  --pdf-engine=xelatex \
  --output="${1%%.*}.pdf" \
  "$1"
jalvesaq commented 6 months ago

It's a curly single quote... Zotcite skips ASCII single quotes, but I have to think of a way of skipping some Unicode characters. We can't simply skip non-Latin letters because the whole author's name would disappear if it were in a non-Latin script such as Greek or Chinese.

jalvesaq commented 6 months ago

For now, I just added a curly single quote to the list of characters to be replaced, which should fix this specific issue.

raffaem commented 6 months ago

Thanks for the quick response.

I don't think this fixes the issue.

I still have the same issue.

jalvesaq commented 6 months ago

What is your operating system and file encoding? I'm using UTF-8 on Linux. I downloaded the .bib from your cited paper, added it to Zotero, completed the citation key with zotcite, and generated an HTML from a Quarto document.

raffaem commented 6 months ago

I have arch linux and my file encoding is UTF-8.

I still get this:

image

have you tried compiling the markdown file I shared into a PDF with pandoc?

raffaem commented 6 months ago

I didn't download the bib.

I used the Zotero Connector for Firefox.

Although it looks like the same character is present.

raffaem commented 6 months ago

I don't know what to say.

I'm using:

pandoc -F "[PATH]/zotcite/python3/zotref.py" --citeproc --pdf-engine=xelatex --output="test.pdf" "test.md"
jalvesaq commented 6 months ago

This works for me:

very_simple.qmd:

---
title: Exemple for zotcite
author: Your Name Here
format:
    pdf:
        filters:
            - /home/aquino/src/zotcite/python3/zotref.py
            - /home/aquino/templates/citeproc.lua
            - /home/aquino/src/zotcite/python3/abntfix.py
---

# Introduction

According to @IJDWJGM7#DEste_Patel_2007, ...

# References

Then:

quarto render very_simple.qmd
raffaem commented 6 months ago

This works for me:

very_simple.qmd:

---
title: Exemple for zotcite
author: Your Name Here
format:
    pdf:
        filters:
            - /home/aquino/src/zotcite/python3/zotref.py
            - /home/aquino/templates/citeproc.lua
            - /home/aquino/src/zotcite/python3/abntfix.py
---

# Introduction

According to @IJDWJGM7#DEste_Patel_2007, ...

# References

Then:

quarto render very_simple.qmd

Why you don't have the right single quote?

For me it is [@VH5CZE7U#D’Este_Patel_2007], not @IJDWJGM7#DEste_Patel_2007.

It is what your change was supposed to do? Remove the single quote in the inline reference?

(is the whole @IJDWJGM7#DEste_Patel_2007 called "citation key")?

raffaem commented 6 months ago

Oh sorry, I had to update the neovim plugin as well 😢

It works now. Thank you very much for your support 👍🏻

jalvesaq commented 6 months ago

Thanks for the feedback!

(is the whole @IJDWJGM7#DEste_Patel_2007 called "citation key")?

Yes, before the zotref.py filter, which deletes from "#" to the end of the citation key and inserts the whole bibliography in the YAML header. This is what pandoc-citeproc receives. Hence, in this example, the citation key visible to pandoc-citeproc is only "@IJDWJGM7".