How to break a line in fig.cap in rmarkdown (bookdown) to docx?

229 Views Asked by At

I want to have a figure caption, and right below it (on the next line), another piece of text. How can I do that?

I managed to do it with word_document output format:

---
title: "Untitled"
author: "Guilherme"
date: "10/6/2020"
output: word_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

```{r, fig.cap="Título da figura \\\n Fonte: Autor"}
plot(1:10,1:10)
```

enter image description here

But it didn't work with bookdown::word_document2:

---
title: "test-report.Rmd"
author: "Guilherme"
date: "9 de maio de 2018"
output: 
  bookdown::word_document2:
    fig_caption: TRUE
    toc: TRUE
    toc_depth: 4
    number_sections: FALSE
---

```{r setup, include=FALSE}
library(knitr)
opts_chunk$set(
    fig.path = "graficos/",
    dpi = 100,
    comment = NA,
    warning = FALSE,
    cache = FALSE,
    echo = FALSE)
```

## Heading 2

And I have this next subsection

```{r, fig.cap="Título da figura \\\n Fonte: Autor"}
plot(1:10,1:10)
```

enter image description here

0

There are 0 best solutions below