What I’m trying to do
Hi all! I am writing a manuscript in Obsidian and I would like to finish it in LaTeX. However, whenever I export my text, Obsidian renders citations in .md format — [@citekey]
. What I want is Obsidian to export, say, [@Abbott2019Self, p. 6]
to \autocite[6]{@Abbott2019Self}
. I use Citations plugin with Pandoc Reference List. For export I use Enhancing Export, but I also tried Pandoc plugin. Is there a way to do something with the settings that would allow me to export citations in a LaTeX format, and more specifically in the \autocite
format?
Things I have tried
I have pandoc downloaded and I tried to use .lua but I might be doing something wrong. I created a .lua file with the following code:
function Cite(el)
local citations = {}
for _, citation in ipairs(el.citations) do
local prefix = citation.prefix and table.concat(citation.prefix, " ") or ""
local suffix = citation.suffix and table.concat(citation.suffix, " ") or ""
local page = suffix:match("p%. (%d+)") or ""
table.insert(citations, "\\autocite[" .. page .. "]{" .. citation.id .. "}")
end
return pandoc.RawInline("latex", table.concat(citations, ", "))
end
In the Obsidian Enhancing Export argument I have: --lua-filter=/Users/heideggerian/Documents/autocite.lua