GSK-Biostatistics / tfrmt

r package for formatting tables
https://gsk-biostatistics.github.io/tfrmt/
Other
70 stars 8 forks source link

More flexibility with fonts and alignments #474

Open hafen opened 2 months ago

hafen commented 2 months ago

It appears that the idea of a monospaced font is baked into this package, since for example alignment is handled by adding spaces to the table cells which only works for monospaced fonts.

While I understand and prefer the benefits of using monospaced fonts for reporting numbers, there are many users who have styles they must adhere to within their company that use proportional fonts. I have been able to change the font of table contents by overriding the gt::tab_style() that is set by tfrmt, but then things like right alignment get messed up. It would be nice to be able to change the font more easily and then have more flexibility over alignment such as center-aligning columns.

bzkrouse commented 3 days ago

@hafen Thank you for your suggestion! You are right that we achieve alignment by padding values, and that is designed for monospaced fonts. This allows for more precise control over alignment. Can I ask, if you change the font with tab_style(), does using gt::cols_align(align = "center") for alignment give the desired result? Or are there issues? Thanks!