diff --git a/NEWS.md b/NEWS.md index cb1e2811..c4224568 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,6 +18,7 @@ Bugs: * Typst notes returned an error since the last release. Thanks to @DominikVogel for report #357. * Duplicate group labels are allowed in LaTeX with `group_tt()`. Thanks to @eeemda for report #362. + ## 0.5.0 New: diff --git a/R/finalize_typst.R b/R/finalize_typst.R index 5309905a..6f1de15a 100644 --- a/R/finalize_typst.R +++ b/R/finalize_typst.R @@ -19,10 +19,11 @@ setMethod( # Quarto cross-references if (isTRUE(check_dependency("knitr"))) { - quarto_caption <- isTRUE(knitr::pandoc_to("typst")) && - isFALSE(getOption("tinytable_quarto_figure", default = FALSE)) - (!is.null(knitr::opts_current$get()[["label"]]) || - !is.null(knitr::opts_current$get()[["tbl-cap"]])) + flag_typst <- isTRUE(knitr::pandoc_to("typst")) + flag_option <- isTRUE(getOption("tinytable_quarto_figure", default = FALSE)) + flag_chunk_label <- isTRUE(grepl("^tbl-", knitr::opts_current$get()[["label"]])) + flag_chunk_caption <- !is.null(knitr::opts_current$get()[["tbl-cap"]]) + quarto_caption <- flag_typst && flag_option && (!flag_chunk_label || !flag_chunk_caption) if (quarto_caption) { out <- lines_drop_between(out, regex_start = "// start figure preamble",