Add CSS Codes within RMarkdown
When using Xaringan to create slides, one may include a custom.css or use the xaringanthemer package to change styles in whole or by part.
Recently, I found another trick that allow you make changes to styles within your rmarkdown file. It’s very simple. You simply only need to add a CSS code chunk1 at the beginning of your content.
Here is an example.
With the above code, as you can see, the background color, borders, and empty header in tables will be removed.
Identify html Tags for Xaringan
To change the style of a html tag in Xaringan, we have to know the tag name. The tag name can be found in the source of the html file. One easy way to check the source of a webpage is to inspect
the page. In Google Chrome, right-clicking the part you saw on the webpage and then clicking inspect
will lead you to the source code.
Define TeX Macros
Similarly, one may define customized tex macros for MathJax at the beginning the content. For example, to define \RR
for the blackboard bold \RR
.
Use MathJax Native Math Delimiters in KableExtra
When using Xaringan, the math delimiter ‘