ulyngs / oxforddown

Template for writing an Oxford University thesis in R Markdown; uses the OxThesis LaTeX template and was inspired by thesisdown.
https://ulyngs.github.io/oxforddown/
MIT License
220 stars 81 forks source link

Unaligned italic numbers in table #64

Open fabian-buerkin opened 1 year ago

fabian-buerkin commented 1 year ago

I took your excellent template as a starting point for my thesis, in which I am now stuck with a formatting problem regarding numbers in tables: As soon as I select italic via the "row_spec" option, some numbers (like the 4 in my example) are no longer at the correct height:

grafik

I tried to use the suggested solutions from this link and manipulated several tex-files, but I am still facing the same problems. I am only moderately versed with latex, if I have overlooked something essential I apologize!

I use the following code to generate the table:

library(knitr) 
library(tidyverse)
library(kableExtra)

tbl <- data.frame(good= c("1.3%"),
                  bad=c("45.84%"))

kbl(tbl, 
    caption= "Caption",
    "latex",
    booktabs = TRUE) %>% 
  row_spec(1, italic=T)
ulyngs commented 1 year ago

Are you sure it is 'misaligned'? It looks to me like it's just a feature of the font -- i.e., that with this particular font, the bottom of the number 4 by design extends below the line?

You could try to also use kableExtra to change the font, if you don't like this typographical choice?