内联代码和内联 LaTeX、R Markdown Pandoc 错误 43 [英] Inline code and inline LaTeX, R Markdown Pandoc error 43

查看:70
本文介绍了内联代码和内联 LaTeX、R Markdown Pandoc 错误 43的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在已经遇到过几次这个问题,但是每当我尝试在我的 Rmd 文件中同时包含内联 LaTeX 和内联 R 代码时,我都会收到 Pandoc 错误 43.除了手动之外,一直无法找到解决方法添加 R 代码本来应该是什么.

I've run into this issue a couple times now, but whenever I try to include both inline LaTeX and inline R code in my Rmd file, I get Pandoc error 43. Never been able to find a workaround other than just manually adding in what the R code would have been.

---
title: "HW4"
date: "2/23/2018"
header-includes:
  - \usepackage{amsmath}
  - \usepackage{amsthm}
output: 
  pdf_document
---

```{r}
x_bar <- 4
```

The blue line above is the true $\lambda = 4$, and the red line is our 
$\hat{\lambda}_{MLE} = \bar{x} = $ `r x_bar`.

错误:

l.192 \$ \hat{\lambda}

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

推荐答案

$ 符号内移动内联 R 表达式:

Move the inline R expression inside the $ symbols:

```{r}
x_bar <- 4
```

$\hat{\lambda}_{MLE} = \bar{x} = `r x_bar`$.

Rmd 输出:

来源:https://github.com/rstudio/rmarkdown/issues/385#issuecomment-77309571

或者,将内联 R 代码留在外面,但删除第二个 $ 之前的尾随空格.

Alternatively, leave the inline R code outside but delete the trailing space before the second $.

这篇关于内联代码和内联 LaTeX、R Markdown Pandoc 错误 43的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆