0

I am using rmarkdown and knitr

I have two questions:

Q1: I am not sure why the figure caption does not appear when I build my rmarkdown document.

Here is an example. I get the figure there but with not the figure caption!

---
title: "Untitled"
author: "XXXX"
date: "9 September 2016"
output: pdf_document
---

## R Markdown

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

![figure1 caption](my photo.png)

Q2: I am developing an R-package using RStudio. I am able to create an html_vignette using the code below. However, I am not sure why I am not able to create a PDF vignette when I change the output to output: rmarkdown::pdf_vignette? The latter gives an error:

Error: 'pdf_vignette' is not an exported object from 'namespace:rmarkdown' Execution halted

---
title: "TITLE XXX"
author: "AMT"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{package-intro}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

I am new to this area, so if somebody can explain that would be great.

daragh
  • 173
  • 1
  • 11
  • 1
    You should split up your questions into 2 separate questions. Asking both together discourages people who know the answer for one from responding. – Gregor Thomas Sep 09 '16 at 05:52
  • 1
    The standard [markdown specification](https://daringfireball.net/projects/markdown/syntax#img) is that the text in brackets before an image link is produced as *alt text* (visible on mouseover), not printed as a caption. I believe RMarkdown follows this specification. – Gregor Thomas Sep 09 '16 at 05:54
  • Your second question [appears to be a duplicate of this one](http://stackoverflow.com/q/31037907/903061). – Gregor Thomas Sep 09 '16 at 05:56
  • Q1: I can't reproduce your example. When I use any picture (.jpg or .png), I get the caption I wrote in the [...] brackets. You can try, if it does not appear when you knit to a HTML file. – J_F Sep 09 '16 at 08:26

0 Answers0