gadenbuie / xaringanthemer

😎 Give your xaringan slides some style

Home Page:https://pkg.garrickadenbuie.com/xaringanthemer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

extra_css classes no longer affect font size of output

vaiseys opened this issue · comments

Hello!

I used to be able to customize output font sizes by adding a custom class and then using it to adjust the font size of my (text) results so they'd fit on a slide. Here's my xaringan-themer block:

style_mono_light( 
  base_color = "#00539B",
  background_color = "#FFFFFF",
  code_font_size = ".8rem",
  extra_css = list("li" = list("padding" = "8px 0px 0px"),
                   ".small" = list("font-size" = "60%"))
  )

So if I, for example, wrapped a Rmd code block containing (say) summary(fit) in .small[] it would make the output smaller. Now for the life of me I can't get that to work. I've tried a lot (many hours) to figure this out but I'm stumped. I even reverted my remarkjs chakra to 0.14.0 hoping that that would work but it didn't. Any help would be greatly appreciate!

Can you try replacing .small with .small .remark-code? If that doesn't work you can also try .small pre code. And if that doesn't work let me know and I'll take another look.

Thanks for the response. Do you mean replacing them in both places? Or just one or the other? I tried both and neither worked but I'm not sure I did it correctly.

I made a small demo Rmd with what I was thinking. Hopefully this works for you too! I did notice that 60% and 0.8rem are really close and might be hard to tell apart.

style_mono_light( 
  base_color = "#00539B",
  background_color = "#FFFFFF",
  code_font_size = ".8rem",
  extra_css = list(
    "li" = list("padding" = "8px 0px 0px"),
    ".small .remark-code" = list("font-size" = "50%"),
    ".tiny pre code" = list("font-size" = "33%")
  )
)

image

This worked!!! I have no idea why my old way stopped working but I suppose that doesn't matter. I can't tell you how much I appreciate the help and how much I love what you're doing to make my slides better. :)

You're welcome, glad to hear that worked and that xaringanthemer is helpful to you!