tinytable caption appearing at bottom of the table

Can anyone suggest why

library(tinytable)
library(data.table)

DT <- data.table(AA = LETTERS[1:20], BB = sample(1:7, 20, replace = TRUE))

cap <- "An outstanding table"

tt(DT, caption = cap)

is giving me a caption on the bottom of the table?

Hey jrkrideau,

Try this instead:

if (!require("gt")) install.packages("gt")
library(gt)

DT <- data.table(AA = LETTERS[1:20], BB = sample(1:7, 20, replace = TRUE))

DT |>
gt() |>
tab_header(
title = "An outstanding table"
)

Thanks but I really want {tinytable}. I did use {gt} as a substitute but for some things I prefer {tinytable}. {tinytable} also seems to be having a fight with Quarto.

I guess I'll have to reinstal {tinytable} and see what happens.

Thanks again.

1 Like

Of course! You might want to consider submitting an issue on the {tinytable} GitHub repository. The authors are typically very helpful (and friendly) with specific concerns and would likely appreciate being informed about any issue. Good luck!

I am going to play around for a day or so before doing that, just in case I am doing something stupid.

Thanks

Looks like the table has the following CSS styling by default

table {
    caption-side: bottom;
}

You can override it

tt(DT, caption = cap) |>
  style_tt(bootstrap_css_rule = "table{caption-side: top;}")
1 Like