October 23, 2024
Chicago 12, Melborne City, USA
HTML

Rmarkdown Cross-references with flextable not working in html


I’m trying to cross-reference tables in an HTML Rmarkdown output.

I’m using both kable and flextable.

In HTML output flextable cross-reference is not working anymore. It works if the output is a PDF

A reproducible example and session info are at the following link

https://rpubs.com/stebif68/1236124

The Rmd is:


title: "reproducible example"
date: "2023-04-13"
output:
bookdown::html_document2: default
bookdown::pdf_document2: default

knitr::opts_chunk$set
library(tidyverse)

library(flextable)
library(officer)
sessionInfo()

Table @ref(tab:test) with kable is working in both html & pdf


kableExtra::kable(tibble(variable= "hello", another = "bye"), caption = "The mtcars data.")

Table @ref(tab:tab2) with flextable in html in not working

ft <- flextable(head(airquality))
# ft <- set_caption(ft, "airquality dataset", 
#   autonum = run_autonum(seq_id = "tab", bkm = "airquality6"))
ft



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video