rootstock
rootstock copied to clipboard
Decreasing font size for tables
Hi guys! Is there a way to customize tables? Like a .css where I can decrease font size? I would like to do this for 2 reasons:
- I would like to show the .html during a presentation, and my table is too wide. Scrolling sideways would not show the first left column, where I have my variable names
- I would like to submit the .pdf to bioRxiv once done, and tables should be fully visible. Hope this is an easy fix! Thanks! :)
Yes, the .css is (probably confusingly) in the file build/themes/default.html.
The styling classes for tables are on these lines for normal and on these lines for printing (pdf export or ctrl + p in browser).
It seems like you already know CSS, but for anyone else looking at this answer, you can add one of the following lines to change the font size:
font-size: 12px; /* set size in terms of pixels (character height) */
font-size: 10pt; /* set size in terms of points */
font-size: 0.75em; /* set size relative to main document font-size */
See: https://kyleschaeffer.com/css-font-size-em-vs-px-vs-pt-vs-percent
@sbonaretti would you like to change the font size of all tables or just specific ones? There should also be a way to select specific tables for smaller font size, but it is a bit challenging due to https://github.com/jgm/pandoc/issues/684#issuecomment-479955298.
I changed the font size of all tables, and this works pretty well, both for the .html and .pdf. Thanks!
In case it's useful, I have also added to the table sections of build/themes/default.html some lines to warp URLs in one cell (to avoid that they "invade" the next cell):
table td {
word-wrap: break-word;
overflow-wrap: break-word;
}