Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erroneous indentation in titles in text or markdown output #671

Closed
ryancbriggs opened this issue Sep 25, 2023 · 2 comments
Closed

Erroneous indentation in titles in text or markdown output #671

ryancbriggs opened this issue Sep 25, 2023 · 2 comments

Comments

@ryancbriggs
Copy link

I like to save tables of results in separate scripts and then later import them into the documents I'm writing. To make cross-referencing work, I will have a title argument such as "title = test \\label{tab:stud_reg}". This used to work. I wish I knew when, but at some point this broke and the reason it broke seems to be that modelsummary is adding 5 spaces before the titles in tables saved as txt or md.

This reproduces the problem:

library(modelsummary)
mod <- lm(speed ~ dist, data = cars)
modelsummary(mod,
             title = "test",
             output = "test.txt")

The first line of test.txt is 5 spaces followed by "Table: test". If I save the output as .md then the first line again is 5 spaces followed by "Table: test". In a markdown file, which I would typically use, the titles are then read as code blocks and this breaks the \label{} portion of the title. It also renders the title like a code block instead of a title.

One other person that I mentioned this to has reproduced it on their machine.

I think this is incorrect behaviour and that the indentation should not be there.

sessionInfo() output
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.5.2

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Toronto
tzcode source: internal

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

other attached packages:
[1] modelsummary_1.4.2

loaded via a namespace (and not attached):
[1] httr_1.4.7 svglite_2.1.1 cli_3.6.1
[4] knitr_1.44 rlang_1.1.1 xfun_0.40
[7] stringi_1.7.12 generics_0.1.3 glue_1.6.2
[10] backports_1.4.1 colorspace_2.1-0 performance_0.10.5
[13] htmltools_0.5.6 parameters_0.21.2 datawizard_0.9.0
[16] scales_1.2.1 rmarkdown_2.25 evaluate_0.21
[19] munsell_0.5.0 kableExtra_1.3.4 fastmap_1.1.1
[22] lifecycle_1.0.3 stringr_1.5.0 insight_0.19.5
[25] compiler_4.3.1 rvest_1.0.3 rstudioapi_0.15.0
[28] systemfonts_1.0.4 digest_0.6.33 viridisLite_0.4.2
[31] R6_2.5.1 magrittr_2.0.3 checkmate_2.2.0
[34] webshot_0.5.5 tools_4.3.1 bayestestR_0.13.1
[37] tables_0.9.17 xml2_1.3.5

vincentarelbundock added a commit that referenced this issue Sep 25, 2023
@vincentarelbundock
Copy link
Owner

should be resolved in version 1.4.2.9006 on Github. (You can thank United Airlines and their flight delays for this quick fix)

@ryancbriggs
Copy link
Author

Resolved.
That's got to be some record on response time. safe travels!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants