Reputation: 111
I wish to use in line R code as part of a header in a r markdown file. However when i knit the file the fonts used on the header are different. How can I ensure the fonts are the same. A simple example is below.
`r 1+1` Header
-------------------------
Upvotes: 11
Views: 6679
Reputation: 49640
Without a reproducible example it is hard to be precise, but one thing you might want to consider is to use the results="asis"
chunk option in your R code so that the results are not wrapped in a code markup block. I am not sure how this works with inline commands, but you could use a regular R block and have it create the entire header from the R code, something like:
```r results="asis"
cat('# ', 1+1, " Header")
```
Upvotes: 2
Reputation: 44638
You can wrap content in backticks to denote r code inline, as follows:
## Title `r 1+1` Header
Upvotes: 9