jacob-long / jtools

Tools for summarizing/visualizing regressions and other helpful stuff
https://jtools.jacob-long.com
GNU General Public License v3.0
162 stars 22 forks source link

Problem with table caption in Quarto document Tufte layout. #140

Open rjazwiec opened 1 year ago

rjazwiec commented 1 year ago

I generate table in Quarto.

Header of the file:

format:
    pdf:
      tbl-cap-location: margin
    html: 
      css: rj.css
      self-contained: true
      grid: 
        margin-width: 300px
lang: pl
reference-location: margin
citation-location: margin
cap-location: margin

Code chunk

#| message: false
#| echo: false
#| warning: false
#| label: tbl-modele1
#| tbl-cap: "Porównanie modeli: bez ważenia, ważonego 1/x i ważonego 1/x^2^."
#| tbl-cap-location: margin
#| results: asis

jtools::export_summs(reg_lin_bw, reg_lin_1px, reg_lin_1px2,
             model.names = c("Bez", "1/X", "1/X^2"),
             digits = 4)

It renders to pdf like this:

Tabele2

For example, table generated by flextable renders like this (and that is my goal):

Tabele1

There is no problem when knitting to HTML. Above chunk generates:

Tabele3

PDF engine

XeTeX, Version 3.141592653-2.6-0.999995 (MiKTeX 23.5) (preloaded format=xelatex.fmt)

sessionInfo

R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale: [1] LC_COLLATE=Polish_Poland.utf8 LC_CTYPE=Polish_Poland.utf8 LC_MONETARY=Polish_Poland.utf8 [4] LC_NUMERIC=C LC_TIME=Polish_Poland.utf8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] ggfortify_0.4.16 forecast_8.21 ggforce_0.4.1 cowplot_1.1.1 wesanderson_0.3.6 hrbrthemes_0.8.0 [7] flextable_0.9.1 ggpubr_0.6.0 gt_0.9.0 janitor_2.2.0 lubridate_1.9.2 forcats_1.0.0
[13] stringr_1.5.0 dplyr_1.1.1 purrr_1.0.1 readr_2.1.4 tidyr_1.3.0 tibble_3.2.1
[19] ggplot2_3.4.2 tidyverse_2.0.0

loaded via a namespace (and not attached): [1] colorspace_2.1-0 ggsignif_0.6.4 ellipsis_0.3.2 showtext_0.9-5
[5] snakecase_0.11.0 httpcode_0.3.0 rstudioapi_0.14 showtextdb_3.0
[9] farver_2.1.1 ggrepel_0.9.3 bit64_4.0.5 fansi_1.0.4
[13] xml2_1.3.3 splines_4.2.2 extrafont_0.19 knitr_1.42
[17] polyclip_1.10-4 jsonlite_1.8.4 broom_1.0.4 Rttf2pt1_1.3.12
[21] shiny_1.7.4 compiler_4.2.2 backports_1.4.1 Matrix_1.5-3
[25] assertthat_0.2.1 fastmap_1.1.1 cli_3.6.0 later_1.3.0
[29] tweenr_2.0.2 htmltools_0.5.5 tools_4.2.2 gtable_0.3.3
[33] glue_1.6.2 Rcpp_1.0.10 carData_3.0-5 fracdiff_1.5-2
[37] fontquiver_0.2.1 vctrs_0.6.1 crul_1.3 urca_1.3-3
[41] nlme_3.1-162 extrafontdb_1.0 lmtest_0.9-40 timeDate_4022.108
[45] xfun_0.38 timechange_0.2.0 mime_0.12 lifecycle_1.0.3
[49] rstatix_0.7.2 MASS_7.3-58.3 zoo_1.8-11 scales_1.2.1
[53] vroom_1.6.1 ragg_1.2.5 hms_1.1.3 promises_1.2.0.1
[57] parallel_4.2.2 huxtable_5.5.2 fontLiberation_0.1.0 yaml_2.3.7
[61] quantmod_0.4.21 curl_5.0.0 gridExtra_2.3 pander_0.6.5
[65] gdtools_0.3.3 stringi_1.7.12 fontBitstreamVera_0.1.1 tseries_0.10-53
[69] TTR_0.24.3 zip_2.2.2 rlang_1.1.0 pkgconfig_2.0.3
[73] systemfonts_1.0.4 evaluate_0.20 lattice_0.20-45 labeling_0.4.2
[77] bit_4.0.5 tidyselect_1.2.0 magrittr_2.0.3 R6_2.5.1
[81] generics_0.1.3 mgcv_1.8-42 pillar_1.9.0 withr_2.5.0
[85] jtools_2.2.1 xts_0.13.0 abind_1.4-5 nnet_7.3-18
[89] crayon_1.5.2 car_3.1-2 gfonts_0.2.0 uuid_1.1-0
[93] utf8_1.2.3 tzdb_0.3.0 rmarkdown_2.21 officer_0.6.2
[97] sysfonts_0.8.8 grid_4.2.2 data.table_1.14.8 digest_0.6.31
[101] xtable_1.8-4 httpuv_1.6.9 textshaping_0.3.6 openssl_2.0.6
[105] munsell_0.5.0 askpass_1.1 quadprog_1.5-8

jacob-long commented 8 months ago

I'm sorry, I'm unsure of how the desired output differs from what you're getting. Are you wanting the table title to appear on the right-hand column, separate from the table?

rjazwiec commented 7 months ago

Sorry for delay.

Yes that's the problem.

There is

'''

| tbl-cap-location: margin

'''

in quarto chunk options to place table caption in the margin column. Jtools ignores that.

Pozdrawiam Radek