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 ='>')' –