gpt4 book ai didi

R knitr PDF 问题与\includegraphics

转载 作者:行者123 更新时间:2023-12-03 14:44:29 25 4
gpt4 key购买 nike

使用新的空 .rmd 文档,此代码有效:

![](RainbowDolphin.png)
\begin{center}
\includegraphics[width=4in]{RainbowDolphin.png}
\end{center}

但是没有第一行,它不会:
\begin{center}
\includegraphics[width=4in]{RainbowDolphin.png}
\end{center}

我收到一个错误:
! Undefined control sequence.
l.71 \includegraphics

pandoc.exe: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
In addition: Warning message:
running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" Sampling_03.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output Sampling_03.pdf --template "C:\PROGRA~1\R\R-31~1.2\library\RMARKD~1\rmd\latex\default.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in"' had status 43
Execution halted

奇怪的。任何帮助表示赞赏!

最佳答案

这是因为latex模板默认不加载graphicx包。您可以通过将其添加到 yaml header 来手动执行此操作:

---
title: "Untitled"
header-includes: \usepackage{graphicx}
output:
pdf_document:
keep_tex: true
---

关于R knitr PDF 问题与\includegraphics,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28266473/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com