Reputation: 515
I am having an issue with bookdown, not sure the reason why.
When add images (these are files, so I use knitr::include_graphics) like this:
# This is a minimal example
I want the image "mas.gif". Where is it?
```{r mas, echo=F, fig.cap="image", ref.label="fig:mas"}
knitr::include_graphics("mas.gif")
```
Hmmm...no clue!
The chunk just disappears in the epub, md, tex and pdf files.
What could be wrong? It used to work some while ago...
Upvotes: 0
Views: 371
Reputation: 639
Just remove , ref.label="fig:mas"
, like this
# This is a minimal example
I want the image "mas.gif". Where is it?
```{r mas, echo=F, fig.cap="image"}
knitr::include_graphics("mas.gif")
```
Hmmm...no clue!
See the documentation by bookdown package's author:
If we assign a figure caption to a code chunk via the chunk option
fig.cap
, R plots will be put into figure environments, which will be automatically labeled and numbered, and can also be cross-referenced. The label of a figure environment is generated from the label of the code chunk, e.g., if the chunk label isfoo
, the figure label will befig:foo
(the prefixfig:
is added beforefoo
). To reference a figure, use the syntax\@ref(label)
, wherelabel
is the figure label, e.g., fig:foo.
Upvotes: 2