0
我试图在r markdown中使用LaTeX grid-system包。有谁知道这是怎么做到的吗?当制造细胞,包括明文一切顺利的话,而是试图包括R块,当我得到这个错误:如何在r markdown中使用LaTeX网格系统包(并将r块放在LaTeX环境中)?
output file: testtest.knit.md
! You can't use `macro parameter character #' in horizontal mode.
\[email protected] ...(cars) ``` \par ``` ##
## speed dist #### Min. : ...
l.106 \end{Row}
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
In addition: Warning message:
running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS testtest.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output testtest.pdf --template "C:\Users\pc\Documents\R\win-library\3.3\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --latex-engine xelatex --variable graphics=yes --variable "geometry:margin=1in"' had status 43
Execution halted
我用这个代码:
---
output:
pdf_document:
latex_engine: xelatex
header-includes:
- \usepackage{grid-system}
---
\begin{Row}%
\begin{Cell}{2}
```{r cars}
summary(cars)
```
\end{Cell}
\begin{Cell}{1}
Some text using 1/3 of the width.
\end{Cell}
\end{Row}
更新:
上述代码中提到的解决方案comment=">"
适用于上面的代码,但是当试图包含一个图时,如下所示:
---
output:
pdf_document:
latex_engine: xelatex
header-includes:
- \usepackage{grid-system}
---
\begin{Row}
\begin{Cell}{5}
```{r, comment='>'}
plot(pressure)
```
\end{Cell}
\begin{Cell}{1}
Some text using 1/6 of the width.
\end{Cell}
\end{Row}
它产生这个错误:
! Missing $ inserted.
<inserted text>
$
l.98 \end{Row}
最简单的方法是避免哈希。尝试使用另一个字符作为评论,使用'comment ='>''作为您的组块。 –
谢谢你的回应。我不确定我是否明白你的意思。作为大块选项? – rdatasculptor
'{r cars,comment ='>'}'。或者你可以通过调用'opts_chunk $ set(comment ='>')' –