r markdown error resulting from math in figure caption

醉酒当歌 提交于 2019-12-24 15:35:35

问题


I had an R markdown document that was working perfectly until I added a caption with latex math. Now I get the error:

! Argument of \reserved@a has an extra }. \par l.75 \end{verbatim}}

pandoc: Error producing PDF from TeX source Error: pandoc document conversion failed with error 43 Execution halted

The code below produces the error in Rstudio, Version 0.99.896, using knitr with pdflatex. Thanks!!

---
title: Title goes here
author: Names go here
date: "\today"
output:
  pdf_document:
    fig_caption: yes
---

Some stuff goes here

```{r ex1, echo=FALSE, fig.height=3, fig.cap="The sampling distribution of  $\\beta_1$."}
curve(dnorm(x))
```

Some more stuff goes here...

来源:https://stackoverflow.com/questions/37216390/r-markdown-error-resulting-from-math-in-figure-caption

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!