Pandoc - 引文不連結到參考文獻

Pandoc - 引文不連結到參考文獻

我正在使用 Markdown 編寫文本,並使用 Pandoc 將該文本轉換為 PDF。我的問題是,引文在 PDF 中正確生成(例如,[@somekey] 轉換為 [1]),但它們沒有連結到最後一頁上產生的實際參考。我無法點擊引文(例如[1])來獲取參考文獻(例如[1] Djikstra - Some Book)。網路連結照常可點擊。

具體例子如下:

測試.md

Some text that needs a citation. [@somekey]

測試圍脖

@misc{somekey,
  title = {{sometitle}},
  howpublished = {https://www.google.com}
}

轉換為pdf的命令:

pandoc -o test.pdf  --citeproc --bibliography=test.bib test.md

PDF 看起來像這樣(滑鼠指標指向我期望的連結):

在此輸入影像描述

產生的中間 .tex 檔如下:

pandoc -o test.tex  --citeproc --bibliography=test.bib test.md

看起來像這樣:

測試文件

Some text that needs a citation. ({``{sometitle},''} n.d.)

\hypertarget{refs}{}
\begin{CSLReferences}{1}{0}
\leavevmode\vadjust pre{\hypertarget{ref-somekey}{}}%
{``{sometitle}.''} n.d. https://www.google.com.

\end{CSLReferences}

我發現這個舊線程記錄了鏈接應該像 7 年前修復的那樣工作。

有人可以幫我找出為什麼它對我不起作用嗎?謝謝。

答案1

缺少的是定義引文應使用以下命令連結到元資料:

pandoc -o test.pdf -M link-citations=true --citeproc --bibliography=test.bib test.md

https://pandoc.org/MANUAL.html#other-relevant-metadata-fields

連結引用

如果為真,引文將超連結到相應的參考書目條目(僅適用於作者日期和數字樣式)。預設為 false。

相關內容