rmarkdown :: render编译LaTeX文档 [英] rmarkdown::render to compile LaTeX documents

查看:54
本文介绍了rmarkdown :: render编译LaTeX文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个示例 LaTeX 文件 使用 Rstudio 对我来说编译得很好,TexShop和 pdflatex example.tex .但是 rmarkdown :: render 不起作用.

This example LaTeX file compiles just fine for me using Rstudio, TexShop, and pdflatex example.tex. But rmarkdown::render does not work.

> rmarkdown::render("example.tex", output_format = "pdf_document")
/usr/local/bin/pandoc +RTS -K512m -RTS example.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output example.pdf --template /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rmarkdown/rmd/latex/default.tex --highlight-style tango --latex-engine /Library/TeX/texbin/pdflatex --variable graphics=yes --variable 'geometry:margin=1in' 
! LaTeX Error: Can be used only in preamble.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.88 \documentclass

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

有没有办法告诉 rmarkdown 我是从LaTeX文档开始的?我正在使用

Is there a way to tell rmarkdown that I'm starting with a LaTeX document? I am using

  • Mac OS 10.11.5
  • R 3.3.0
  • rmarkdown 0.9.6
  • pandoc 1.13.2
  • pdfTeX 3.14159265-2.6-1.40.17(TeX Live 2016)

推荐答案

没关系. tools :: texi2pdf("example.tex")在命令行中与Rstudio和R一起为我工作. R GUI错误地失败了.

Never mind. tools::texi2pdf("example.tex") worked for me with Rstudio and R from the command line. The R GUI failed in error, though.

这篇关于rmarkdown :: render编译LaTeX文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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