Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

removing Figure text in rmarkdown

Tags:

r

r-markdown

When I insert an image in Rmarkdown I see "Figure #:" below the image.

How do you get rid of the "Figure:" text?

for example here is my code

![my caption](C:/mypath/myimage.png)

and the image appear with "Figure 1: my caption" below it. I just want the caption to the "my caption"

I looked here http://yihui.name/knitr/options/#chunk_options and fig.lp seems like it might be a solution but when I include that in the header like:

---
title: "My Title"
output: pdf_document
fig.lp: ('';character)
---

the "Figure :" still shows up.

Thank you.

like image 981
user3022875 Avatar asked Jul 21 '16 21:07

user3022875


People also ask

How do I hide text in R Markdown?

Hide source code: ```{r, echo=FALSE} 1 + 1 ``` Hide text output (you can also use `results = FALSE`): ```{r, results='hide'} print("You will not see the text output.") ``` Hide messages: ```{r, message=FALSE} message("You will not see the message.") ``` Hide warning messages: ```{r, warning=FALSE} # this will generate ...

How do I hide results in R Markdown?

You use results="hide" to hide the results/output (but here the code would still be displayed). You use include=FALSE to have the chunk evaluated, but neither the code nor its output displayed.

What is knitr R Markdown?

RMarkdown is an extension to markdown which includes the ability to embed code chunks and several other extensions useful for writing technical reports. The rmarkdown package extends the knitr package to, in one step, allow conversion between an RMarkdown file (.Rmd) into PDF, HTML, word document, amongst others.

How do you not run a chunk in R Markdown?

If you don't want any code chunks to run you can add eval = FALSE in your setup chunk with knitr::opts_chunk$set() . If you want only some chunks to run you can add eval = FALSE to only the chunk headers of those you don't want to run.


2 Answers

All you have to do is add a backslash to the end of the line:

![my caption](C:/mypath/myimage.png)\
like image 90
Hannah Avatar answered Oct 27 '22 00:10

Hannah


You can use the fig_caption option in the header, like so:

---
title: "My Title"
output: 
  pdf_document:
    fig_caption: false
---
like image 35
Brent Kerby Avatar answered Oct 26 '22 23:10

Brent Kerby