繁体   English   中英

Pandoc中的错误43:使用rmarkdown渲染Rmd包含LaTeX qtree

[英]error 43 in pandoc: render Rmd with rmarkdown include LaTeX qtree

我正在尝试在Rmd文件中生成树状图,我希望看起来像这样:

使用rmarkdownrender函数。

但是出现错误43我不知道该怎么解释。 如何获取pdf进行渲染? 是什么导致错误?

Rmd文件

---
title: "testtree"
header-includes:
   - \usepackage{qtree}
output:
    pdf_document
---

\Tree [.S [.NP LaTeX ] [.VP [.V is ] [.NP fun ] ] ]

Success 

错误信息

> rmarkdown::render("testtree.Rmd", "all")


processing file: testtree.Rmd
  |.................................................................| 100%
  ordinary text without R code


output file: testtree.knit.md

"C:/Users/trinker/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS testtree.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output testtree.pdf --template "C:\R\R-3.2.2\library\rmarkdown\rmd\latex\default-1.14.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in" 
! Paragraph ended before \doanode was complete.
<to be read again> 
                   \par 
l.90 

pandoc.exe: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
In addition: Warning message:
running command '"C:/Users/trinker/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS testtree.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output testtree.pdf --template "C:\R\R-3.2.2\library\rmarkdown\rmd\latex\default-1.14.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in"' had status 43 
> 

以下.Rnw文档成功编译:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{qtree}

\begin{document}

Here is a code chunk.

\Tree [.S a [.NP {\bf b} c ] d ]

You can also write inline expressions, e.g. $\pi=\Sexpr{pi}$, and \Sexpr{1.598673e8} is a big number.

\end{document}

Pandoc将最后两个右括号] ]{]} {]} ,如果使用输出选项keep_tex: true则可以看到此行为。 我不确定这是否是错误,您应该在pandoc邮件列表中询问此问题或提交报告

一种快速的解决方法是使用pandoc的功能来忽略环境中的代码,并在虚拟环境中包围命令:

---
title: "testtree"
header-includes:
   - \usepackage{qtree}
   - \newenvironment{dummy}{}{}
output:
    pdf_document:
      keep_tex: true
---

\begin{dummy}
\Tree [.S [.NP LaTeX ] [.VP [.V is ] [.NP fun ] ] ]
\end{dummy}

Success 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM