Smaller font for some paragraphs with r markdown knitr to word docx

246 Views Asked by At

I am using r-markdown, knitr, and pandoc to generate MS Word reports in RStudio. My tables require a data source line underneath each. The font size of this text needs to be 2 points smaller than the rest of the document. Is there a way to specify a smaller font size for a specific paragraph?

I have tried redefining Header 7 in a Word template, but using a header in this way causes it to show in the table of contents which is not acceptable.

Here is an example of what I need to do:

---
title: "Test Smaller Font"
output: word_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(pander)
```

## R Markdown
An example

```{r cars, echo=F, warning=F, message=F, error=F, results='asis'}
pandoc.p("This is a table about cars")
pander(cars)
# the following text should be smaller:
pandoc.p("Data source: some source.")
```
0

There are 0 best solutions below