You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for this awesome package, a lot of the new features are real game changers for me!
Is it possible to use the styling options provided by officer::ftext within the figure caption (fig.cap) of a code chunk?
My unsuccessful attempt was to first create a caption object: test_caption <- officer::fpar(officer::ftext("hello", officer::shortcuts$fp_bold()))
which I then tried referencing in a chunk like this: r, echo=FALSE, fig.cap=test_caption, fig.id='sinus', fig.width=6, fig.height=4, fig.align='center'
I know that you have added Math latex support to captions, but I would love combining, for example, two colors within one figure caption. At the moment, I am only aware of Claus Wilke's ggtext package for multi-colored captions - which have to be included as part of the figure. However, I would prefer a way of combining Word's image captions (for the numbering and so on) with officer's advanced formatting options (that exceed changing the "Image Caption" style in the reference.docx).
The text was updated successfully, but these errors were encountered:
Yes, but you will have to recreate the caption from scratch. You will find below an example:
---
output: officedown::rdocx_document
---
```{r setup, include=FALSE}
library(officedown)
library(officer)
library(flextable)
fp_1 <- fp_text(color = "red")
fp_2 <- fp_text(color = "pink", bold = TRUE)
```
<!---BLOCK_TOC{seq_id: 'fig'}--->
::: {custom-style="Image Caption"}
<caption>
`r run_autonum(seq_id = 'fig', bkm = 'coco', pre_label = "Figure ")` `r ftext("This is red ",fp_1)` and `r ftext("this is pink ",fp_2)`
</caption>
:::
\@ref(fig:coco)
This is famous `mtcars` dataset:
```{r tab.cap='cars', tab.id='cars', first_column = TRUE}
qflextable(cars[1:10,])
```
aaaa
```{r tab.cap='mtcars', tab.id='mtcars', first_column = TRUE}
head(mtcars, n = 10)
```
This is a linked reference to a table: \@ref(tab:mtcars), its number is computed by Word
and it's linked to the corresponding table when clicking on it.
This is a linked reference to an image: \@ref(fig:tsplot), its number is computed by Word
and it's linked to the corresponding table when clicking on it.
```{r fig.cap="economics plot", fig.id = "tsplot", fig.cap.style="Image Caption"}
year <- function(x) as.POSIXlt(x)$year + 1900
with(ggplot2::economics, plot(date, unemploy / pop, type = "l"))
```
Thank you for this awesome package, a lot of the new features are real game changers for me!
Is it possible to use the styling options provided by
officer::ftext
within the figure caption (fig.cap) of a code chunk?My unsuccessful attempt was to first create a caption object:
test_caption <- officer::fpar(officer::ftext("hello", officer::shortcuts$fp_bold()))
which I then tried referencing in a chunk like this:
r, echo=FALSE, fig.cap=test_caption, fig.id='sinus', fig.width=6, fig.height=4, fig.align='center'
I know that you have added Math latex support to captions, but I would love combining, for example, two colors within one figure caption. At the moment, I am only aware of Claus Wilke's
ggtext
package for multi-colored captions - which have to be included as part of the figure. However, I would prefer a way of combining Word's image captions (for the numbering and so on) withofficer
's advanced formatting options (that exceed changing the "Image Caption" style in the reference.docx).The text was updated successfully, but these errors were encountered: