5.3 Include additional LaTeX packages
The use of additional LaTeX packages can allow for extensive customization of document styling. In addition, several packages such as kableExtra (Zhu 2019) may have LaTeX dependencies for the R package to function. Much like R, we need to load packages within the R Markdown document before we are able to use their functions.
5.3.1 Loading LaTeX packages
We can load additional LaTeX packages using the
extra_dependencies option within the
pdf_document YAML settings. This allows us to provide a list of LaTeX packages to be loaded in the intermediate LaTeX output document, e.g.,
If you need to specify options when loading the package, you can add a second-level to the list and provide the options as a list, e.g.,
For those familiar with LaTeX, this is equivalent to the following LaTeX code:
5.3.2 Example packages
There is an extensive community for LaTeX, and there are over 4,000 packages available through the Comprohensive TeX Archive Network (CTAN). As some examples of LaTeX packages you could consider using within your report:
Zhu, Hao. 2019. KableExtra: Construct Complex Table with ’Kable’ and Pipe Syntax. https://CRAN.R-project.org/package=kableExtra.