I am trying to include a .png file in a file that I am rendering using bookdown. knitr::include_graphics()
should be the way to go.
The code:
```{r fig1, fig.cap='My Caption', echo=FALSE, message=FALSE, warning=FALSE}
knitr::include_graphics("./Figures/My Figure.png")
```
In the .Rmd file, I can run my r block, and it renders the image below. So, the path should be correct. However, when I knit the chapter, or render the entire book, the figure is not rendered.
Could it be that some of my other options are overriding the figure? Below are my YAML header of the index.Rmd file, and the code in my _output.yml file.
---
title: "My Title"
author: "My Name"
date: "`r Sys.Date()`"
output:
bookdown::gitbook:
split_by: section
bookdown::pdf_book:
keep_tex: no
documentclass: book
classoption: openany
bibliography: [Mybib.bib]
csl: Mycsl.csl
biblio-style: apalike
link-citations: yes
description: "My Description"
---
bookdown::gitbook:
config:
toc:
before: |
<li><a href="./">Short Title</a></li>
bookdown::pdf_book:
latex_engine: xelatex
citation_package: natbib
bookdown::epub_book: default
getwd()
in a chunk at the beginning to confirm where it is set. – Phelpsgetwd()
returns the folder in which the index.Rmd file exists, which is the parent folder of the Figures folder I use in my code. – Gawain![figur description blah \label{fig1bla}](path/yourFigure.png)
and reference in text with\ref{fig1bla}
? – Collateralinclude_graphics
– Phelps