R markdown compile error:

后端 未结 3 1826
你的背包
你的背包 2021-01-12 07:18

When I try to compile an Rmarkdown document to pdf, I get this error:

    Error: Functions that produce HTML output found in document targeting latex output.         


        
相关标签:
3条回答
  • 2021-01-12 07:44

    I ran into this problem when using Bookdown, and the accepted solution did not work in my context. I resolved it after figuring out what the "YAML front-matter of your RMarkdown file" is. With bookdown, there is a .travis.yml file and a _bookdown.yml file, but you want to leave these two alone and these are not what the error message is referencing.

    The "front-matter" would be the top of your RMarkdown file (if using bookdown it would be the "index.Rmd" file), see screenshot below:

    So just add it to the YAML header as its own line and it should work as expected (or give you a different error)

    0 讨论(0)
  • 2021-01-12 07:48

    You need to choose what format you want to KNIT to, tried to look at mine.

    ---
    title: "<img src='www/binary-logo.jpg' width='240'>"
    subtitle: "[<span style='color:blue'>binary.com</span>](https://github.com/englianhu/binary.com-interview-question) Interview Question I"
    author: "[<span style='color:blue'>®γσ, Lian Hu</span>](https://englianhu.github.io/) <img src='www/ENG.jpg' width='24'> <img src='www/RYO.jpg' width='24'>白戸則道®"
    date: "`r Sys.Date()`"
    output:
      tufte::tufte_html:
        toc: yes
      tufte::tufte_handout:
        citation_package: natbib
        latex_engine: xelatex
      tufte::tufte_book:
        citation_package: natbib
        latex_engine: xelatex
    link-citations: yes
    ---
    

    0 讨论(0)
  • 2021-01-12 08:08

    Have you tried the following? (FROM: https://bookdown.org/yihui/bookdown/html-widgets.html)

    install.packages("webshot")
    webshot::install_phantomjs()
    

    It worked for me. See also: https://github.com/rstudio/bookdown/issues/440

    0 讨论(0)
提交回复
热议问题