vincentarelbundock / tinytable

Simple and Customizable Tables in `R`
https://vincentarelbundock.github.io/tinytable
GNU General Public License v3.0
196 stars 16 forks source link

Font selection for cells, headers, notes, etc. #302

Open botan opened 3 months ago

botan commented 3 months ago

Thank you for this amazing package!

Sorry if this feature already exists, but I couldn't find it in the documentation. The only thing holding me back from fully migrating and using tinytable in production is not being able to use custom fonts. Are there any plans to enable this in the near future?

vincentarelbundock commented 3 months ago

Thanks for the kind words!

I'm curious about your use case. So far, I've taken the view that fonts are better set as a document property. Otherwise, people end up with tables with a different font from the text, and that is usually very ugly. Obviously, this is opinionated...

What output format are you using? If your are writing HTML tables, it is trivial to change the font using CSS (see tutorial).

botan commented 3 months ago

Thanks for the quick reply!

I use Quarto for generating Word documents, but the tricky point is that my company's primary font is not monospace. Unsurprisingly, it doesn't look great in tables with number alignments. So, being able to specify a different font for the tables is quite handy in my case.

vincentarelbundock commented 3 months ago

Ah yes, I had not thought of that situation, but it makes total sense. Thanks for clarifying.

I don't want to make too many promises here. For HTML output, this would be relatively easy to add. For Word output, however, I expect this to be more difficult. The challenge is that tinytable creates a markdown table, and then uses Pandoc to convert it to a Word document. I have not researched this in detail, but I don't know of a way to use different fonts for different text in a pandoc-converted documented.

Setting a global font for the full table might be an easier goal to achieve in the medium run.

Note to self: If we do this, I'd like the solution to work in all output formats.

botan commented 3 months ago

Wonderful, thank you for considering!