Way to adapt plugin "obsidian-pandoc-reference-list" so it reads LaTeX style citations?

Can you say more about how you are citing? Share your citekeys / citations as you had them in the markdown. I can’t replicate your issue when testing with the Chicago 17th Edition author-date CSL file from the Zotero repository here:

https://www.zotero.org/styles/chicago-author-date

Here’s my test source (click to expand):

Test document

This is a sentence with a footnote.[^1]

This is a sentence with a parenthetical citation [@Oreskes.Conway2010DefeatingMerchantsDoubt]. @Oreskes.Conway2010DefeatingMerchantsDoubt [p. 28] narrative citation here.

[^1]: Here, I am citing something [@Oreskes.Conway2010DefeatingMerchantsDoubt]. In another sentence, @Oreskes.Conway2010DefeatingMerchantsDoubt said something.

And the result:

In the narrative citation, the parenthesis is meant to be there, and in the bibliography, there’s no parenthesis around the year.

Here’s the entry of the bib file:

@article{Chiang2005What,
  title = {What's Expected of Us},
  author = {Chiang, Ted},
  year = {2005},
  month = jul,
  journal = {Nature},
  volume = {436},
  number = {7047},
  pages = {150--150},
  issn = {0028-0836, 1476-4687},
  doi = {10.1038/436150a},
  urldate = {2024-02-10},
  langid = {english},
  file = {/home/Chiang - 2005 - What's expected of us.pdf}
}

Here’s what my Obsidian note:
image

Here’s the resulting PDF:

The parentheses in that footnote are not meant to be there.

When you use Pandoc citations, you don’t put the citekeys into footnotes like that yourself.
That’s handled by the citation style. What you ought to do is this:

Textabc [@chiang2005What, p. 3].

And then use a citation style that uses footnotes, as I mentioned earlier. The author-date style is an in-text style. It doesn’t use footnotes for citations in the way that you want.

Since none of the default Chicago styles will give you the result you are after, you can use a custom CSL style as found in this Zotero forum post to achieve the result you are after (chicago-author-date-footnotes.csl). Or one of the similar styles mentioned in the thread.

So, this was actually just a mismatch of expectations, and a matter of getting familiar with the Pandoc citation syntax.

If you need further tweaking, you can use the Zotero style editor.

Replied above :point_up:

I just realized that I was using a modified version because I need to do author-date but in footnotes. You can find the CSL file here in the first reply.

However, I’m now struggling with adding a period to the end of the note. In that Zotero thread someone says to add a suffix thing to line 597 which I did, so now that line looks like
<layout delimiter="; " suffix=".">

That adds a period at the end of a note, but only if there’s no page numbers. If there are page numbers, it doesn’t add anything.

Thanks so much for all your help, really appreciate it!

That’s the same link I sent to you…

But alright, so you were already using the custom one. Alright, well then you just have to get more familiar with the Pandoc citation syntax.

You’re welcome. I can’t help you with the period problem, but you can try the Zotero style editor as suggested, or ask for help in the Zotero forum.

Oh, dear, I’m so sorry! I’ve lost sight since we’ve tried multiple things. Anyways, thanks and I’ll have a look at the pandoc syntax :slight_smile:

1 Like

Sorry, another question: How can I edit the resulting bibliography style since pandoc doesn’t take the style from the LaTeX template?
I.e. I need the bibliography to be single spaced and have a hanging indent.

The bibliography style should be derived from the CSL file. Perhaps your template is interfering somehow? Or perhaps this is yet another custom requirement? What is the default for Chicago author-date? This might help: Primer — An Introduction to CSL — Citation Style Language 1.0.1-dev documentation

Btw, it’s best practise to keep help posts limited to one issue at a time, and to create new post for new issues. This gets more eyes on your post, increasing your likelihood of getting help, and decreasing pressure on the limited amount of people present in this post. Furthermore, this also aids in discovery, so that others with the same needs have a better chance of utilizing existing answers.

In case you’re interested, I sort of found a way around my problem. I created a script that converts the [@pandoc] citations into \footcite{citekey}

#!/bin/bash


awk -v RS='[[]@[^]]+]' -v ORS= '
    RT {
        ckpnsStr = gensub(/^\[|\s*]$/,"","g",RT)
        numCkpns = split(ckpnsStr,ckpnsArr,/\s*;\s*/)
        RT = "\\foot"
        for ( ckpnNr=1; ckpnNr <= numCkpns; ckpnNr++ ) {
            ckpn = ckpnsArr[ckpnNr]
            n = split(ckpn,ck_pn,/\s*,\s*/)
            ck = gensub(/@/,"",1,ck_pn[1])
            pn = ck_pn[2]
            if ( numCkpns == 1 ) {
                RT = RT "cite" (n > 1 ? "[" pn "]" : "") "{" ck
            }
            else {
                RT = RT ( ckpnNr == 1 ? "note{" : ", " )
                RT = RT "\\cite[" pn "]{" ck "}"
            }
        }
        RT = RT "}"
    }
    { print $0 RT }
' "${@:--}"

I’ve combined that with creating a _temp copy of the .md file which is then used to create the LaTeX document and from there the PDF

bash /home/Scripts/convert-cite.sh {{file_path:absolute}} > {{folder_path:absolute}}/{{title}}_temp.md

Now I can use the reference list plugin :slight_smile: