在R Markdown中,我想要一个带有R Markdown本地引用样式
[@ref]
的图标题和链接引用。然而,当我将[@hawking_thermodynamics_1983]
片段插入到标题末尾时,它只会抛出一个错误:! Missing $ inserted.
<inserted text>
$
l.94 ...iontextfoo [@hawking_thermodynamics_1983]}
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
例子:
这是我的代码:
---
title: "Untitled"
author: "Author"
output: pdf_document
# bibliography: bibliography.bib
references:
- id: hawking_thermodynamics_1983
author:
- family: Hawking
given: S. W.
- family: Page
given: Don. N.
publisher: Communications in Mathematical Physics
title: Thermodynamics of Black Holes in Anti-de Sitter Space.
volume: 87
type: article-journal
issued:
year: 1983
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
\begin{figure}[h]
\centering
\includegraphics[width=13cm]{example.jpg}
\caption{Captiontextfoo}\label{fig1}
\end{figure}
[@hawking_thermodynamics_1983]
# Bibliography
以下是输出结果:
我希望括号内的引用出现在图标题中,并且有指向参考文献的链接。参考文献应像往常一样自动出现。
我该如何实现这一点?
注:
- 我也尝试了
\[@...
或不使用方括号,但都没有起作用。 - 我也尝试了此答案中的
\caption{Captiontextfoo \cite{[@hawking_thermodynamics_1983]}}
,但效果也不好,只显示[?]
。 - R版本 3.4.3(2017-11-30)
- 平台:x86_64-w64-mingw32/x64(64位)
- 运行环境:Windows 7 x64(build 7601)Service Pack 1
pandoc-citeproc
。你似乎使用那种语法... - mb21