Проблемы с PDF-задачами с\includegraphics
Используя новый пустой документ .rmd, этот код работает:

\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
Weird. Любая помощь ценится!
Ответы
Ответ 1
Это потому, что шаблон латекса не загружает пакет graphicx по умолчанию. Вы можете сделать это вручную, добавив это в заголовок yaml:
---
title: "Untitled"
header-includes: \usepackage{graphicx}
output:
pdf_document:
keep_tex: true
---
Ответ 2
Вы можете позволить Pandoc знать, что у вас есть графика в этом документе, указав метаданные YAML:
---
graphics: yes
---