dwww Home | Show directory contents | Find package

---
title: none
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(flextable)
library(magrittr)
library(officer)
caption_md <- "This is a caption"

knitr::opts_chunk$set(ft.shadow = FALSE,
  tab.lp = "tab:", 
  tab.cap.style = "Table Caption")

ft <- flextable(head(cars)) %>% 
  theme_vanilla() %>% 
  autofit()
```


Cross-reference is there: \@ref(tab:id1)

## A caption, no id

```{r tab.cap=caption_md}
ft
```


## A caption and an id

```{r tab.cap=caption_md, label="id1"}
ft
```

## No caption and an id

```{r tab.id="tab3"}
ft
```

## Using set caption

```{r table2}
#| tab.topcaption: true
set_caption(
  x = ft, 
  caption = as_paragraph(
      as_chunk("azerty ", props = fp_text_default(color = "cyan")),
      as_chunk("querty", props = fp_text_default(color = "orange"))
  ),
  autonum = run_autonum(seq_id = "tab", bkm = "id2"),
  fp_p = fp_par(
    padding = 10, 
    border = fp_border_default(color = "red", width = 1))
)
```

## Using set caption and chunk options

```{r label="id3"}
#| tab.topcaption: false
set_caption(
  x = ft, 
  caption = as_paragraph(
      as_chunk("azerty ", props = fp_text_default(color = "cyan")),
      as_chunk("querty", props = fp_text_default(color = "orange"))
  )
)
```

Generated by dwww version 1.15 on Tue Jun 25 09:15:10 CEST 2024.